Closed logsdk closed 2 weeks ago
Hi @logsdk can you provide more context for me around what this code is trying to do?
Hi. The same issue. You need to connect to the DApp using Rabby wallet. After pressing the disconnect button (calling the disconnect function) - an error is thrown.
const [{ wallet }, disconnect] = useConnectWallet()
await disconnect(wallet)
The reason is that the onboard.js:last_connected_wallet
key is missing from the local storage
@ignromanov Disconnect using the approach as shown above working without issue on our demo sites - https://github.com/blocknative/react-demo/blob/89509379f4cd09299b45b2301769aa80a7c58991/src/App.js#L543 If you can provide more code for context I can assist further
The reason was that flags autoConnectLastWallet
and autoConnectAllPreviousWallet
were false during onboard initialization
@ignromanov does that mean we can close this issue?
@Adamj1232 I think you should test with these flags set to False. You will get a disconnect error.
@ignromanov I am still unable to reproduce the disconnect error - I made a video of what I am seeing when trying this locally. https://www.loom.com/share/3d73a7ccfa1645cb9deb820fb8ea438c?sid=93f5efb4-5539-4075-a204-c9ea9dcea605
Might be good to confirm you are on the latest version of "@web3-onboard/injected-wallets": "^2.11.1"
@Adamj1232 I tried it on your test application. Try with these changes to reproduce it. I got an error.
@ignromanov I am still unable to reproduce an error with that change
@Adamj1232 Recorded a video reproduction of the error. Launched your repository with the change described above.
https://github.com/blocknative/web3-onboard/assets/3179314/c4428a70-e6ae-4056-909e-0adf7bf19bdb
We are seeing this same issue with the latest version on all packages and brave browser.
@ignromanov ahh ok I think I got it figured out, required a local storage clear to reproduce. Looking into this today. Will have a fix shortly.
@ignromanov please give this a shot with the latest alpha version of @web3-onboard/core or framework package noted in the PR above - would love validation on your end prior to release
Current Behavior
1、connect wallet, tips successful 2、discount wallet, error
SyntaxError: Unexpected end of JSON input at JSON.parse ()
at disconnect (index-34745058.js:3597:25)
at async eval (useConnectWallet.js:25:29)
in packages/core/src/disconnect.ts:47
if can not get last connected wallet, the default value '', can not be parsed by JSON.
Expected Behavior
disconnect wallet successful
Steps To Reproduce
No response
What package is effected by this issue?
@web3-onboard/core
Is this a build or a runtime issue?
Runtime
Package Version
2.22.1
Node Version
No response
What browsers are you seeing the problem on?
No response
Relevant log output
No response
Anything else?
No response
Sanity Check