Skip to content

polywrap/javascript-client

Repository files navigation

polywrap-banner

Javascript Client

Implementation of the Polywrap client in JavaScript.

Installation

npm install @polywrap/client
# or
yarn add @polywrap/client

Getting Started

Create a new Polywrap client config builder instance, add the bundles you want to use, and then create a new Polywrap client instance with the config.

import { 
    PolywrapClient,
    PolywrapClientConfigBuilder
} from "@polywrap/client";

const builder = new PolywrapClientConfigBuilder();
builder.addBundle("sys");
const client = new PolywrapClient(builder.build());

const result = await client.invoke<boolean>({
  uri: "wrapscan.io/polywrap/logging@1.0.0",
  method: "info",
  args: {
    message: "Hello from hello world wrap!",
  }
});

if (!result.ok) {
  throw Error("Log message error: " + result.error);
}

Resources

Support

For any questions or problems, please visit our Discord.