Skip to content

Commit

Permalink
chore: update naming to EthereumWallet
Browse files Browse the repository at this point in the history
  • Loading branch information
dOrgJelli committed Jul 26, 2023
1 parent be321e6 commit 277a78a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions implementations/js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [{
Expand All @@ -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/[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion implementations/js/polywrap.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 8 additions & 8 deletions implementations/js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ProviderConfig> {
export class EthereumWalletPlugin extends Module<WalletConfig> {
private _connections: Connections;

constructor(config: ProviderConfig) {
constructor(config: WalletConfig) {
super(config);
this._connections = config.connections;
}
Expand Down Expand Up @@ -202,12 +202,12 @@ export class EthereumProviderPlugin extends Module<ProviderConfig> {
}
}

export const ethereumProviderPlugin: PluginFactory<ProviderConfig> = (
config: ProviderConfig
export const ethereumWalletPlugin: PluginFactory<WalletConfig> = (
config: WalletConfig
) =>
new PluginPackage<ProviderConfig>(
new EthereumProviderPlugin(config),
new PluginPackage<WalletConfig>(
new EthereumWalletPlugin(config),
manifest
);

export const plugin = ethereumProviderPlugin;
export const plugin = ethereumWalletPlugin;
22 changes: 11 additions & 11 deletions implementations/js/tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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({
Expand All @@ -34,7 +34,7 @@ describe("Ethereum Plugin", () => {
clientNoSigner = new PolywrapClient(
new PolywrapClientConfigBuilder().setPackage(
uri,
ethereumProviderPlugin({
ethereumWalletPlugin({
connections: new Connections({
networks: {
binance: new Connection({
Expand All @@ -50,7 +50,7 @@ describe("Ethereum Plugin", () => {
clientWithWeb3Provider = new PolywrapClient(
new PolywrapClientConfigBuilder().setPackage(
uri,
ethereumProviderPlugin({
ethereumWalletPlugin({
connections: new Connections({
networks: {
testnet: new Connection({
Expand All @@ -73,7 +73,7 @@ describe("Ethereum Plugin", () => {
);
});

describe("EthereumProviderPlugin", () => {
describe("EthereumWalletPlugin", () => {
it("eth_chainId", async () => {
const response = await client.invoke<string>({
uri,
Expand Down Expand Up @@ -161,7 +161,7 @@ describe("Ethereum Plugin", () => {
chainId: 1,
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
};

// The named list of all type definitions
const types = {
EIP712Domain: [
Expand Down Expand Up @@ -192,7 +192,7 @@ describe("Ethereum Plugin", () => {
{ name: 'contents', type: 'string' }
]
};

// The data to sign
const message = {
from: {
Expand All @@ -205,7 +205,7 @@ describe("Ethereum Plugin", () => {
},
contents: 'Hello, Bob!'
};

const response = await clientWithWeb3Provider.invoke<string>({
uri,
method: "request",
Expand All @@ -227,7 +227,7 @@ describe("Ethereum Plugin", () => {
chainId: 1,
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
};

// The named list of all type definitions
const types = {
EIP712Domain: [
Expand Down Expand Up @@ -258,7 +258,7 @@ describe("Ethereum Plugin", () => {
{ name: 'contents', type: 'string' }
]
};

// The data to sign
const message = {
from: {
Expand Down

0 comments on commit 277a78a

Please sign in to comment.