cosmology-tech / cosmos-kit

Universal wallet connector for the Cosmos ⚛️
https://cosmology.zone/products/cosmos-kit
BSD 3-Clause Clear License
182 stars 132 forks source link

First modal view sometimes auto connecting to the second wallet in the list #380

Closed vexxvakan closed 10 months ago

vexxvakan commented 10 months ago

@pyramation I updated to the latest cosmos-kit and chain-registry version, and i have encountered a different error. When im connecting the wallet, it first shows the "cosmostation not installed" error and then i have to click x to go to the wallet connection screen.

I made a small loom to show what is happening: https://www.loom.com/share/dfdd19246d2b4cd0ba35fa53f761fc48?sid=6094e036-adba-4e81-88fc-5f13bd700dfb

The exact versions of cosmos-kit i have installed during this error are:

{
    "@cosmjs/stargate": "^0.31.3",
    "@cosmos-kit/core": "2.7.10",
    "@cosmos-kit/cosmostation": "2.5.0",
    "@cosmos-kit/keplr": "2.5.0",
    "@cosmos-kit/keplr-extension": "^2.6.0",
    "@cosmos-kit/leap": "2.5.0",
    "@cosmos-kit/leap-extension": "^2.6.0",
    "@cosmos-kit/react": "2.9.14",
    "@cosmos-kit/terrastation": "^0.1.7",
    "@cosmos-kit/xdefi-extension": "2.5.12",
    ...
    "chain-registry": "^1.23.0",
    }

Originally posted by @MbBrainz in https://github.com/cosmology-tech/cosmos-kit/issues/372#issuecomment-1857505648

liujun93 commented 10 months ago

@vexxvakan the local storage will store the current wallet name in cosmos-kit@2:core//current-wallet once you tried to connect the wallet, no matter you connected or rejected or the wallet not installed. So the next time you open the same site (within the session duration, by default 30mins), it will automatically connect the wallet stored in cosmos-kit@2:core//current-wallet.

if you don't want this feature, you can choose to remove cosmos-kit@2:core//current-wallet in local storage when tab closed

vexxvakan commented 10 months ago

@liujun93 no, for some reason when clearing cache and opening cosmos-kit wallet modal for the first time it opens at the rejected view of the second wallet in the list... I can create a loom video when I am back at work. Reconnecting works just fine however 👍

This bug also happens for me on the cosmos kit docs so its not caused by our custom wallet modal either

twhy commented 10 months ago

@vexxvakan Please upgrade @cosmos-kit/react to ^2.9.16. This should be fixed in this version that just published.

MbBrainz commented 10 months ago

Bumping @cosmos-kit/react to 2.9.16 gave me the following build error: Module not found: Can't resolve '@interchain-ui/react/styles' that wasn't there on 2.9.6. Reverted for now.

twhy commented 10 months ago

@MbBrainz What version of Next.js are you using ?

vexxvakan commented 10 months ago

@twhy we are on Next 13.4.8. The initial issue is fixed by the new release according to what I can see so far, this is on a branch that uses react-lite and a custom wallet modal so the styles issue wouldnt come up here,

twhy commented 10 months ago

@vexxvakan OK. I can reproduce this issue on my side now and will fix it ASAP.

twhy commented 10 months ago

This issue can be reproduced in this way

  1. Connect to a extension wallet you haven't installed / enabled
  2. Close the modal
  3. Refresh the page The actual issue is the modal shows the Install Wallet view when modal opens for the wallet that is not installed.
blackpanther1881 commented 9 months ago

@twhy I'm still facing same issue, when I use openView from useChain, default walletRepo getting as cosmostationExtension