Skip to main content

Client

npm

The Polywrap JavaScript client exists to help developers integrate wrappers into their applications. It's designed to run in any environment that can execute JavaScript (think websites, node scripts, etc.).

Installation#

npm install @polywrap/client-js

Usage#

Use an import or require statement, depending on which your environment supports.

import { PolywrapClient } from "@polywrap/client-js";

Then, you will be able to use the PolywrapClient like so:

// Simply instantiate the PolywrapClient.
const client = new PolywrapClient();
// ...And then you'll be able to use the `invoke`
// method to execute methods within the wrapper
// located at the specified URI.
const result = await client.invoke({
uri: 'ens/api.example.eth',
method: "doSomething",
args: {
variable: 555,
value: "important value"
}
});