cosmology-tech / cosmos-kit

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

addChain does not support stakeCurrency which is required for Sei and Keplr #191

Closed lvn-skate-dragon closed 1 year ago

lvn-skate-dragon commented 1 year ago

When trying to connect to the Sei testnet (atlantic-2) using Keplr, an error is thrown of:

"stakeCurrency" is required

In the Keplr Chain Registry the param stakeCurrency can be found. However, in the Cosmos Chain Registry this param can't be found. That includes its case-respective alternative, stake_currency.

If the Sei network is added to Keplr by connecting it through an external source, such as their faucet, it will connect without an issue.

In the chain blob Keplr presents for approval you can see the following:

"stakeCurrency": {
  "coinDenom": "SEI",
  "coinMinimalDenom": "usei",
  "coinDecimals": 6
},

Now that Sei is included in Keplr, connecting to a cosmos-kit app will work, since we added it with the stakeCurrency param.

Please add the ability to include this param.

liujun93 commented 1 year ago

@lvn-skate-dragon

We're using import { chainRegistryChainToKeplr } from '@chain-registry/keplr'; to convert Cosmos Chain Registry to Keplr Chain Registry.

stakeCurrency is converted here.

So "stakeCurrency" should be obtained if you correctly provide Sei testnet (atlantic-2) chain and assetList info.

Did you add them in ChainProvider?

lvn-skate-dragon commented 1 year ago

@liujun93 thanks, you pointed me in the right direction.

It seems like seitestnet is mapped to 3 different AssetLists instead of just the one relevant for v1.

Since I'm using seitestnet2 I would expect the chain_name to have this key. Look at item 164 in my screenshot.

Screenshot 2023-05-04 at 9 31 55
liujun93 commented 1 year ago

@lvn-skate-dragon Glad it helps.

About the 3 items on screenshot, I don't see difference. Maybe you can choose any one?

As for chain_name, feel free to modify it before it's added to ChainProvider props (both chains and assetLists).

lvn-skate-dragon commented 1 year ago

@liujun93 sorry if it wasn't clear. The difference with those three objects is the chain_name. Each of them have the value seitestnet, but really they should have the values seidevnet3, seitestnet, and seitestnet2.

The issue then comes when trying to map them. So if I know my chain is seitestnet2 and I loop through the assets list for a chain_name with this value, none will return.

It seems like this issue however is not with you but with chain-registry. If that's correct, then this can be closed.

lvn-skate-dragon commented 1 year ago

Opened a PR. This can be closed.