blocknative / web3-onboard

Client library to onboard users to web3 apps
https://onboard.blocknative.com/
MIT License
854 stars 510 forks source link

web3auth provider not changing chains when calling `switchChain`, but `connectedChain` does #2241

Open bengobeil opened 5 months ago

bengobeil commented 5 months ago

Current Behavior

Hey @Adamj1232, it seems as though calling setChain on the useSetChain hook when connected to web3auth wallet does not update the provider in wallet on the useConnectWallet hook. I'm not familiar with the codebase enough to fix this, I've been taking a look at day and it seems as though web3auth is not integrate with the rx/js based state, not sure about this. Would it be possible to have your help on this?

Expected Behavior

I expect the wallet.provider on useConnectWallet to have changed it's chain Id so I can use the signer on the new connected chain.

Steps To Reproduce

Notice in the demo app, when changing chains, the native token symbol changes, but it seems the provider is still connected to the original chain.

What package is effected by this issue?

@web3-onboard/web3auth

Is this a build or a runtime issue?

Runtime

Package Version

latest

Node Version

No response

What browsers are you seeing the problem on?

Firefox

Relevant log output

No response

Anything else?

No response

Sanity Check

Adamj1232 commented 4 months ago

@bengobeil there will probably need to be a patch made to the web3auth provider to ensure chain ID is passed properly - have a look at packages/coinbase/index for a starting point example. Web3Onboard is expecting the chainID in hex

bengobeil commented 4 months ago

Hey @Adamj1232, opened a PR trying to solve this issue but no dice. https://github.com/blocknative/web3-onboard/pull/2249

Any help would be appreciated, thanks.

bengobeil commented 3 months ago

Hey @Adamj1232, just checking in, would it be possible to take a look at this? Many thanks!