@polywrap/client-js
TypeScript icon, indicating that this package has built-in type declarations

0.12.2 • Public • Published

@polywrap/client-js

npm

The Polywrap client extends the PolywrapCoreClient to provide UX features, such as an additional constructor and additional configuration options.

Installation

npm install --save @polywrap/client-js

Usage

Instantiate

Use the PolywrapClient constructor to instantiate the client with the default configuration bundle.

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

  const client = new PolywrapClient();

Configure

Use the @polywrap/client-config-builder-js package to build a custom configuration for your project.

  const config = new PolywrapClientConfigBuilder().addDefaults().build();

  const client = new PolywrapClient(config);

Invoke

Invoke a wrapper.

  const result = await client.invoke({
    uri: "wrapscan.io/polywrap/logging@1",
    method: "info",
    args: {
      message: "Hello World!"
    }
  });

  if (!result.ok) throw result.error;

  const value = result.value;

Reference

Configuration

Below you will find a reference of object definitions which can be used to configure the Polywrap client. Please note that the intended way of configuring the client is to use the PolywrapClientConfigBuilder, as explained above.

PolywrapClient

Constructor

  /**
   * Instantiate a PolywrapClient
   *
   * @param config - a client configuration
   */
  constructor(config?: CoreClientConfig) 

Readme

Keywords

none

Package Sidebar

Install

npm i @polywrap/client-js

Weekly Downloads

54

Version

0.12.2

License

MIT

Unpacked Size

146 kB

Total Files

45

Last publish

Collaborators

  • polywrap-build-bot
  • dorgjelli