Skip to main content

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.

tip

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 wrapper using the Polywrap client
  • Configure custom Polywrap URI redirects
  • 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 wrappers 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-react <project-name>

Where <project-name> is replaced with a custom name of your choosing. For example my-wrapper.

This command will create a new project folder with a "Hello World" app that lets you interact with a simple Wasm wrapper at ens/rinkeby/helloworld.dev.polywrap.eth.