From 277a78afa803077c4b7ccdeb81d384b3de3da0d5 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Wed, 26 Jul 2023 04:33:33 +0200 Subject: [PATCH] chore: update naming to EthereumWallet --- implementations/js/README.md | 8 ++++---- implementations/js/polywrap.yaml | 2 +- implementations/js/src/index.ts | 16 ++++++++-------- implementations/js/tests/index.spec.ts | 22 +++++++++++----------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/implementations/js/README.md b/implementations/js/README.md index 30cc508..b544645 100644 --- a/implementations/js/README.md +++ b/implementations/js/README.md @@ -3,16 +3,16 @@ The Ethereum Wallet plugin implements the `ethereum-wallet-interface` @ [wrapsca ## Usage ### 1. Configure Client -When creating your Polywrap JS client, add the ethereum provider plugin: +When creating your Polywrap JS client, add the ethereum wallet plugin: ```typescript import { PolywrapClient } from "@polywrap/client-js"; -import { ethereumProviderPlugin } from "@polywrap/ethereum-wallet-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: ethereumProviderPlugin({ }) + package: ethereumWalletPlugin({ }) }], // 2. Register this plugin as an implementation of the interface interfaces: [{ @@ -23,7 +23,7 @@ const client = new PolywrapClient({ ``` ### 2. Invoke The Ethereum Wrapper -Invocations to the Ethereum wrapper may trigger sub-invocations to the Ethereum Provider plugin: +Invocations to the Ethereum wrapper may trigger sub-invocations to the Ethereum Wallet plugin: ```typescript await client.invoke({ uri: "wrapscan.io/polywrap/ethers@1.0", diff --git a/implementations/js/polywrap.yaml b/implementations/js/polywrap.yaml index 5d1b64b..5746ea5 100644 --- a/implementations/js/polywrap.yaml +++ b/implementations/js/polywrap.yaml @@ -1,6 +1,6 @@ format: 0.4.0 project: - name: ethereum-provider-js + name: ethereum-wallet-js type: plugin/typescript source: module: ./src/index.ts diff --git a/implementations/js/src/index.ts b/implementations/js/src/index.ts index d6e1d7e..60e53b9 100644 --- a/implementations/js/src/index.ts +++ b/implementations/js/src/index.ts @@ -20,14 +20,14 @@ import { ethers } from "ethers"; export * from "./Connection"; export * from "./Connections"; -export interface ProviderConfig { +export interface WalletConfig { connections: Connections; } -export class EthereumProviderPlugin extends Module { +export class EthereumWalletPlugin extends Module { private _connections: Connections; - constructor(config: ProviderConfig) { + constructor(config: WalletConfig) { super(config); this._connections = config.connections; } @@ -202,12 +202,12 @@ export class EthereumProviderPlugin extends Module { } } -export const ethereumProviderPlugin: PluginFactory = ( - config: ProviderConfig +export const ethereumWalletPlugin: PluginFactory = ( + config: WalletConfig ) => - new PluginPackage( - new EthereumProviderPlugin(config), + new PluginPackage( + new EthereumWalletPlugin(config), manifest ); -export const plugin = ethereumProviderPlugin; +export const plugin = ethereumWalletPlugin; diff --git a/implementations/js/tests/index.spec.ts b/implementations/js/tests/index.spec.ts index d36b450..8eb890b 100644 --- a/implementations/js/tests/index.spec.ts +++ b/implementations/js/tests/index.spec.ts @@ -2,7 +2,7 @@ import { PolywrapClient, PolywrapClientConfigBuilder } from "@polywrap/client-js import { BigNumber, Wallet } from "ethers"; -import { ethereumProviderPlugin, Connection, Connections } from "../src"; +import { ethereumWalletPlugin, Connection, Connections } from "../src"; import { provider as Web3MockProvider } from "ganache" jest.setTimeout(360000); @@ -11,13 +11,13 @@ describe("Ethereum Plugin", () => { let client: PolywrapClient; let clientNoSigner: PolywrapClient; let clientWithWeb3Provider: PolywrapClient; - const uri = "wrap://plugin/ethereum-provider"; + const uri = "wrap://plugin/ethereum-wallet"; beforeAll(async () => { client = new PolywrapClient( new PolywrapClientConfigBuilder().setPackage( uri, - ethereumProviderPlugin({ + ethereumWalletPlugin({ connections: new Connections({ networks: { binance: new Connection({ @@ -34,7 +34,7 @@ describe("Ethereum Plugin", () => { clientNoSigner = new PolywrapClient( new PolywrapClientConfigBuilder().setPackage( uri, - ethereumProviderPlugin({ + ethereumWalletPlugin({ connections: new Connections({ networks: { binance: new Connection({ @@ -50,7 +50,7 @@ describe("Ethereum Plugin", () => { clientWithWeb3Provider = new PolywrapClient( new PolywrapClientConfigBuilder().setPackage( uri, - ethereumProviderPlugin({ + ethereumWalletPlugin({ connections: new Connections({ networks: { testnet: new Connection({ @@ -73,7 +73,7 @@ describe("Ethereum Plugin", () => { ); }); - describe("EthereumProviderPlugin", () => { + describe("EthereumWalletPlugin", () => { it("eth_chainId", async () => { const response = await client.invoke({ uri, @@ -161,7 +161,7 @@ describe("Ethereum Plugin", () => { chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC' }; - + // The named list of all type definitions const types = { EIP712Domain: [ @@ -192,7 +192,7 @@ describe("Ethereum Plugin", () => { { name: 'contents', type: 'string' } ] }; - + // The data to sign const message = { from: { @@ -205,7 +205,7 @@ describe("Ethereum Plugin", () => { }, contents: 'Hello, Bob!' }; - + const response = await clientWithWeb3Provider.invoke({ uri, method: "request", @@ -227,7 +227,7 @@ describe("Ethereum Plugin", () => { chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC' }; - + // The named list of all type definitions const types = { EIP712Domain: [ @@ -258,7 +258,7 @@ describe("Ethereum Plugin", () => { { name: 'contents', type: 'string' } ] }; - + // The data to sign const message = { from: {