rainbow-me / rainbowkit

The best way to connect a wallet 🌈 🧰
https://rainbowkit.com
MIT License
2.36k stars 613 forks source link

While connecting metamask User rejected request comes #2067

Closed Snehagupta1907 closed 7 hours ago

Snehagupta1907 commented 4 days ago

Is there an existing issue for this?

RainbowKit Version

2.0.5

wagmi Version

2.6.7

Current Behavior

If the browser has phantome and metamask wallet then on connecting metamask and doing any transaction user rejected request comes but if we delete the phantom wallet from browsers everything works fine.

issue is here

this.selectExtension = ()=>jt(this, null, function*() { var e; if (!this.targetProvider && !this.isSelectingExtension) { this.isSelectingExtension = !0; try { let t = (e = Yf.phantom) == null ? void 0 : e.ethereum; if (t) { if (!this.detected.length) { this.setProvider(t), window.dispatchEvent(new Event("ethereum#initialized")); return } switch (yield t.request({ method: "wallet_selectEthereumProvider", params: [] })) { case "ALWAYS_USE_PHANTOM": case "CONTINUE_WITH_PHANTOM": { this.setProvider(t); break } case "CONTINUE_WITH_METAMASK": case "ALWAYS_USE_METAMASK": { let[o] = this.detected; for (let s of this.detected) s.isMetaMask && this.setProvider(s); !this.targetProvider && o && this.setProvider(o); break } } } } catch (t) { console.error(t) } finally { this.isSelectingExtension = !1 } }

            in this rainbowkit code

Expected Behavior

We want that if the browser has any wallet irrespective if we choose metamask and it get connected so transaction should proceed.

Steps To Reproduce

Just install both metamask and phantom try to do evm transaction from metamask

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

No response

Anything else?

Use chrome browser

magiziz commented 4 days ago

@Snehagupta1907 What RainbowKit and Wagmi version are you using at the moment ? Could you also share a small reproducible example ?

Snehagupta1907 commented 4 days ago

"wagmi": "^2.5.7","@rainbow-me/rainbowkit":"2.0.5"

To reproduce this issue install phantom and metamask now connect with metamask and try doing the evm transaction. in my website i have used this and there always user rejected issue is coming untill i uninstall the phantom wallet.And the code which throwing this error is above in the mentioned issue