Synchronizing with Web3Auth Status

How can I synchronise with the connection and authentication status of the Web3Auth. For example to get the balance of the default account immediately the authentication is completed?

In particular, I want to listen to the web3auth.status changing. If the status is not_ready, I want to show an 'initialising...' message, and when it goes to either ready or connected, I would show the login and logged in views respectively.

ATM, I can see no way to listen to the event that is emitted when the web3auth moves from not_ready to ready.



Originally posted by: robport

Check the discussion at: https://github.com/orgs/Web3Auth/discussions/649

Pls refer to this docs: https://web3auth.io/docs/sdk/web/core/initialize#adapter-events



Originally posted by: rinzler99
Thanks. However, the ready event is never emitted. e.g.

const web3auth = new Web3Auth({
clientId: clientId,
chainConfig: {
chainNamespace: CHAIN_NAMESPACES.SOLANA,
rpcTarget: rpcTarget,
}
});

web3auth.on(ADAPTER_EVENTS.READY, () => {
console.error(‘ready’);
});

I see that the state changes to Ready (via a setTimeout), but the
event is not emitted.

Can you point me to a demo repo where the Ready event is working?

Cheers,

Rob


On Wed, Sep 28, 2022 at 6:36 PM Pradeep Nokwal ***@***.***> wrote: Pls refer to this docs: https://web3auth.io/docs/sdk/web/core/initialize#adapter-events


Reply to this email directly, view it on GitHub
<#649 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGLVXXC6ATUR2BOA6LFAX23WAR6ZBANCNFSM6AAAAAAQWU42EA>
.
You are receiving this because you authored the thread.Message ID:
@.***>



Originally posted by: robport
1 Like
I've been through the next-app version, which is structured the same way, and it doesn't distinguish between not_ready and ready.

This means you get a connect button when it’s not_ready (when it should say
‘Initialising…’ or display spinner or something



Originally posted by: robport