@polywrap/client-js
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)