@polywrap/ethereum-wallet-js
v0.1.0
Published
Ethereum Wallet JS Plugin
Downloads
107
Readme
@polywrap/ethereum-wallet-js
The Ethereum Wallet plugin implements the ethereum-wallet-interface
@ wrapscan.io/polywrap/[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 wallet plugin:
import { PolywrapClient } from "@polywrap/client-js";
import { ethereumWalletPlugin } from "@polywrap/ethereum-wallet-js";
const client = new PolywrapClient({
// 1. Add the plugin package @ an arbitrary URI
packages: [{
uri: "plugin/ethereum-wallet",
package: ethereumWalletPlugin({ })
}],
// 2. Register this plugin as an implementation of the interface
interfaces: [{
interface: "wrapscan.io/polywrap/[email protected]",
implementations: ["plugin/ethereum-wallet"]
}],
});
2. Invoke The Ethereum Wrapper
Invocations to the Ethereum wrapper may trigger sub-invocations to the Ethereum Wallet plugin:
await client.invoke({
uri: "wrapscan.io/polywrap/[email protected]",
method: "getSignerAddress",
});