From eb4f86e65904db2eff1a26f91aeaa2ad3dd31c43 Mon Sep 17 00:00:00 2001 From: calvinchang Date: Mon, 23 Oct 2023 16:31:20 +0800 Subject: [PATCH 1/3] feat: adjust eth_accounts to not require prior enable --- packages/blocto-sdk/src/providers/ethereum.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/blocto-sdk/src/providers/ethereum.ts b/packages/blocto-sdk/src/providers/ethereum.ts index 5368a519..ddd39348 100644 --- a/packages/blocto-sdk/src/providers/ethereum.ts +++ b/packages/blocto-sdk/src/providers/ethereum.ts @@ -355,6 +355,8 @@ export default class EthereumProvider case 'wallet_disconnect': { return this.handleDisconnect(); } + case 'eth_accounts': + return getEvmAddress(sessionKey, blockchainName) || []; } // Method that requires user to be connected @@ -369,13 +371,11 @@ export default class EthereumProvider try { let response = null; let result = null; + switch (payload.method) { case 'eth_requestAccounts': await this.fetchAccounts(); // eslint-disable-next-line - case 'eth_accounts': - result = getEvmAddress(sessionKey, blockchainName); - break; case 'eth_coinbase': { result = getEvmAddress(sessionKey, blockchainName)?.[0]; break; From 90c6bd22f151a5edd852fe5941d23cddefe33e39 Mon Sep 17 00:00:00 2001 From: calvinchang Date: Mon, 23 Oct 2023 16:33:08 +0800 Subject: [PATCH 2/3] fix: fix connector.ts type --- adapters/wagmi-connector/src/connector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adapters/wagmi-connector/src/connector.ts b/adapters/wagmi-connector/src/connector.ts index 0968af44..0cc7f971 100644 --- a/adapters/wagmi-connector/src/connector.ts +++ b/adapters/wagmi-connector/src/connector.ts @@ -179,7 +179,7 @@ class BloctoConnector extends Connector { account, chain, transport: custom(provider), - }); + }) as WalletClient; } protected onAccountsChanged(): void { From 58ef7a0a511d0ea47b5f7891cc4d7dcfc0656f6c Mon Sep 17 00:00:00 2001 From: calvinchang Date: Mon, 23 Oct 2023 16:38:00 +0800 Subject: [PATCH 3/3] chore: add changeset --- .changeset/curvy-students-trade.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/curvy-students-trade.md diff --git a/.changeset/curvy-students-trade.md b/.changeset/curvy-students-trade.md new file mode 100644 index 00000000..25e154fa --- /dev/null +++ b/.changeset/curvy-students-trade.md @@ -0,0 +1,5 @@ +--- +'@blocto/sdk': patch +--- + +adjust eth_accounts to not require prior enable