From 7f5b4ad6bc83b3bc41ac7ee72817cabd70da5f17 Mon Sep 17 00:00:00 2001 From: Nikki Gaudreau Date: Fri, 1 Nov 2024 01:35:24 -0400 Subject: [PATCH 1/2] Revert "Try not waiting for WC" This reverts commit b1c34ab83fc8c88250345cac264eaf6e5a5ff6cb. --- client/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/index.ts b/client/src/index.ts index d6203bb..2fac172 100644 --- a/client/src/index.ts +++ b/client/src/index.ts @@ -385,7 +385,7 @@ function main() { rpcMap: rpcMap, }); - spawn(async () => await provider.connect())(); + await provider.connect(); await run(provider); }), From 5761a35f23fa727ded14c0e6a5dfaff65eed3a94 Mon Sep 17 00:00:00 2001 From: Nikki Gaudreau Date: Fri, 1 Nov 2024 01:50:33 -0400 Subject: [PATCH 2/2] Fiddle with the order of connecting --- client/src/index.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/client/src/index.ts b/client/src/index.ts index 2fac172..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, }); - await provider.connect(); await run(provider); }),