Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

wagmi : calling `await getAccount()` keeps returning undefined

$
0
0

I am working with wagmi core in svelte and am looking to make a basic wallet connect and disconnect flow.

I am able to successfully connect by pressing the connect button, and having it call handleConnect.

    async function handleConnect() {        await connect(config, { connector: injected() })        const account = await getAccount(config)        console.log(account)    }

The console successfully shows an account.

After I do this, I can see my wallet has successfully connect.

enter image description here

However, upon refreshing, when checking the status of my connection, it says undefined when calling getAccount.

    onMount(async () => {        const account = await getAccount(config)        console.log(account)    })

I get the following:

{address: undefined, addresses: undefined, chain: undefined, chainId: undefined, connector: undefined, …}

Why is that?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>