From 02613c5ef89de8453e9a27626d97b2418ae99a5c Mon Sep 17 00:00:00 2001 From: Shadab Khan Date: Tue, 3 Jan 2023 13:37:49 +0530 Subject: [PATCH] feat(bridge): autoconnect wallet on load --- packages/bridge-ui/src/App.svelte | 2 +- .../src/components/AddressDropdown.svelte | 6 ++- .../src/components/buttons/Connect.svelte | 53 ++++++++++--------- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/packages/bridge-ui/src/App.svelte b/packages/bridge-ui/src/App.svelte index 10329e6a3b1..88f0dacfb5d 100644 --- a/packages/bridge-ui/src/App.svelte +++ b/packages/bridge-ui/src/App.svelte @@ -69,7 +69,6 @@ const { chains: wagmiChains, provider, - webSocketProvider, } = configureChains( [mainnet, taiko], [ @@ -83,6 +82,7 @@ ); $wagmiClient = createClient({ + autoConnect: true, provider, connectors: [ new MetaMaskConnector({ diff --git a/packages/bridge-ui/src/components/AddressDropdown.svelte b/packages/bridge-ui/src/components/AddressDropdown.svelte index 81e2ef37a21..3a56cd727b5 100644 --- a/packages/bridge-ui/src/components/AddressDropdown.svelte +++ b/packages/bridge-ui/src/components/AddressDropdown.svelte @@ -18,8 +18,10 @@ let addressAvatarImgData: string = ""; let tokenBalance: string = ""; - onMount(async () => { - await setAddress($signer); + onMount(() => { + (async () => { + await setAddress($signer); + })(); }); $: getUserBalance($signer); diff --git a/packages/bridge-ui/src/components/buttons/Connect.svelte b/packages/bridge-ui/src/components/buttons/Connect.svelte index 21d1791f852..3f417aa79cc 100644 --- a/packages/bridge-ui/src/components/buttons/Connect.svelte +++ b/packages/bridge-ui/src/components/buttons/Connect.svelte @@ -1,6 +1,5 @@