diff --git a/adapters/wagmi-connector/CHANGELOG.md b/adapters/wagmi-connector/CHANGELOG.md index fe2a0e36..81086bea 100644 --- a/adapters/wagmi-connector/CHANGELOG.md +++ b/adapters/wagmi-connector/CHANGELOG.md @@ -5,6 +5,7 @@ ### Patch Changes - 4835522: Fix export unreconize type for old typescript +- Updated dependencies [58ef7a0] - Updated dependencies [4835522] - Updated dependencies [e742f66] - @blocto/sdk@0.7.1 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 { diff --git a/adapters/web3-react-connector/CHANGELOG.md b/adapters/web3-react-connector/CHANGELOG.md index 607505f4..fb714cdf 100644 --- a/adapters/web3-react-connector/CHANGELOG.md +++ b/adapters/web3-react-connector/CHANGELOG.md @@ -5,6 +5,8 @@ ### Patch Changes - 4835522: Fix export unreconize type for old typescript +- 1d05082: refactor: adjust web3-react-connector's activate method to comply with @blocto/sdk's changes +- Updated dependencies [58ef7a0] - Updated dependencies [4835522] - Updated dependencies [e742f66] - @blocto/sdk@0.7.1 diff --git a/adapters/web3-react-connector/src/index.ts b/adapters/web3-react-connector/src/index.ts index 9e043b93..7ff4c990 100644 --- a/adapters/web3-react-connector/src/index.ts +++ b/adapters/web3-react-connector/src/index.ts @@ -71,7 +71,7 @@ export class BloctoConnector extends Connector { !desiredChainId || parseChainId(desiredChainId) === parseChainId(this.provider.chainId) ) { - const accounts = await this.provider.request({ method: 'eth_accounts' }); + const accounts = await this.provider.request({ method: 'eth_requestAccounts' }); return this.actions.update({ chainId: parseChainId(this.provider.chainId), accounts, diff --git a/packages/blocto-sdk/CHANGELOG.md b/packages/blocto-sdk/CHANGELOG.md index c76d8fd8..9add1e3a 100644 --- a/packages/blocto-sdk/CHANGELOG.md +++ b/packages/blocto-sdk/CHANGELOG.md @@ -4,6 +4,7 @@ ### Patch Changes +- 58ef7a0: adjust eth_accounts to not require prior enable - 4835522: Fix export unreconize type for old typescript - e742f66: AccountChange use addSelfRemovableHandler 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;