Skip to content

[Bug]: Wallet errors not propagated to onboard promises #1257

@mario-iliev

Description

@mario-iliev

Current Behavior

Hey guys. I noticed something which makes handling errors impossible and lead to wrong/bad UX.
I only tested this with MetaMask and I can't confirm for other wallets but I suspect it's the same.
When using onboard.connectWallet({ autoSelect: { label: 'MetaMask', disableModals: true }, })

Case 1: User choose to connect with MetaMask, MM extension window is promped but user clicks outside of it so it gets hidden automatically. If the user tries to connect again, MetaMask fires this error MetaMask - RPC Error: Already processing eth_requestAccounts. Please wait. {code: -32002, message: 'Already processing eth_requestAccounts. Please wait.'} but the onboard.connectWallet Promise is not resolved so we can't show anything to the user and we actually don't know the current status of the "connectWallet" method.

Case 2: User choose to connect with MetaMask, MM extension is promped but user decides to cancel the connection. MM will fire this error MetaMask - RPC Error: User rejected the request. {code: 4001, message: 'User rejected the request.'} and the onboard.connectWallet will resolve with the currently connected wallets instead of rejecting with an error.

Expected Behavior

Wallet errors should propagate to web3-onboard Promises which caused them.

Steps To Reproduce

Steps to reproduce are described in the "Current Behavior" section.

What package is effected by this issue?

@web3-onboard/core

Is this a build or a runtime issue?

Runtime

Package Version

2.8.1

Node Version

16.14.2

What browsers are you seeing the problem on?

No response

Relevant log output

No response

Anything else?

No response

Sanity Check

  • If this is a build issue, I have included my build config. If this is a runtime issue, I have included reproduction steps and/or a Minimal, Reproducible Example.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions