diff --git a/client/src/index.ts b/client/src/index.ts index d6203bb..8ff4864 100644 --- a/client/src/index.ts +++ b/client/src/index.ts @@ -289,11 +289,6 @@ function main() { const open = spawn(async () => { webSocket?.removeEventListener("open", open); - await glue.activateChain({ - chainId: "0x" + chainId.toString(16), - rpcUrl: rpcUrl.href, - }); - let requestAccountsPromise: unknown = null; const unsubscribe = glue.on("requestaccounts", (event) => { unsubscribe(); @@ -304,6 +299,15 @@ function main() { }); }); + if (baseProvider instanceof EthereumProvider) { + await baseProvider.connect(); + } + + await glue.activateChain({ + chainId: "0x" + chainId.toString(16), + rpcUrl: rpcUrl.href, + }); + await unboundWallet.wallet.requestAddresses(); unsubscribe(); if (requestAccountsPromise instanceof Promise) { @@ -385,7 +389,6 @@ function main() { rpcMap: rpcMap, }); - spawn(async () => await provider.connect())(); await run(provider); }),