@polywrap/ethereum-provider-js
v0.3.1
Published
Ethereum Provider JS Plugin
Downloads
51
Readme
@polywrap/ethereum-provider-js
The Ethereum Provider plugin implements the ethereum-provider-interface
@ ens/wraps.eth:[email protected] (see ../../interface/polywrap.graphql). It handles Ethereum wallet transaction signatures and sends JSON RPC requests for the Ethereum wrapper.
Usage
1. Configure Client
When creating your Polywrap JS client, add the ethereum provider plugin:
import { PolywrapClient } from "@polywrap/client-js";
import { ethereumProviderPlugin } from "@polywrap/ethereum-provider-js";
const client = new PolywrapClient({
// 1. Add the plugin package @ an arbitrary URI
packages: [{
uri: "plugin/ethereum-provider-js",
package: ethereumProviderPlugin({ })
}],
// 2. Register this plugin as an implementation of the interface
interfaces: [{
interface: "ens/wraps.eth:[email protected]",
implementations: ["plugin/ethereum-provider-js"]
}],
});
2. Invoke The Ethereum Wrapper
Invocations to the Ethereum wrapper may trigger sub-invocations to the Ethereum Provider plugin:
await client.invoke({
uri: "ens/wraps.eth:[email protected]",
method: "getSignerAddress",
});