Installing the Polywrap JS client
Introduction
If you're a JavaScript developer building Browser, Node.js, or React based apps, this guide is for you.
In the future, JavaScript will be one of many supported languages. Our goal is to enable the use of Polywrap in every major programming language.
By the end of this document, you'll gain the following skills:
- How to instantiate the Polywrap client in your JavaScript App
- Invoke any wrap using the Polywrap client
- Configure the Polywrap client
- Build React apps with ease
If you get stuck during this guide, send us a message on our Discord!
Prerequisites
As prerequisites for this guide, we recommend having familiarity with TypeScript. React will also be used in the latter sections.
Installation
To use wraps in your app, all you need is the Polywrap Client!
npm install --save @polywrap/client-js
The Polywrap JavaScript Client works in both Node.js, and browser applications.
Examples
Some example projects that integrate the JS client can be found here.
The next section assumes that you're integrating Polywrap into an existing app project. If you want a quick start with our template project, simply run:
npx polywrap create app typescript <project-name>
Where
<project-name>
is replaced with a custom name of your choosing. For examplemy-app
.This command will create a new project folder with a "Hello World" app that lets you interact with two simple Wasm wraps at
wrap://wrapscan.io/polywrap/logger@1.0
andwrap://wrapscan.io/polywrap/ethereum@1.0
.