keplr-wallet
keplr-wallet copied to clipboard
Call window.keplr.experimentalSuggestChain({…}) in turn to add a new chain. When the value prefix of the parameter chain-id is the same, only the first one is added successfully.
Describe the bug When I call window.keplr.experimentalSuggestChain({…}) to Keplr Browser Extension in turn, the chainId is passed exchain-65 for the first time and exchain-66 for the second time, and there is only a pop-up window prompting me to add exchain-65 chain, the chain corresponding to exchain-66 is not responding.
The result is that the two chains whose chainId is exchain-65 and exchain-66 cannot join the Keplr Browser Extension at the same time. After Keplr Browser Extension has added the exchain-65 chain, if you want to use the exchain-66 chain, you need to manually delete the exchain-65 chain before adding it successfully. In the same way, if you want to use exchain-65, you need to delete exchain-66 first, and the experience is very bad.
However, when I set the chainId to exchain-65 and xchain-66 in turn, the pop-up window successfully allows me to join the two chains of exchain-65 and xchain-66, which is in line with expectations. It can be seen that if the prefix is the same, it will fail to be added, and if it is different, it can be added successfully.
To Reproduce Steps to reproduce the behavior: call in sequence
window.keplr.experimentalSuggestChain({
chainId: "exchain-65",
chainName: "OKC testnet",
rpc: "https://exchaintesttmrpc.okex.org",
rest: "https://exchaintestrpc.okex.org",
stakeCurrency: {
coinDenom: "OKT",
coinMinimalDenom: "wei",
coinDecimals: 18,
coinGeckoId: "oec-token"
},
bip44: {
coinType: 60,
},
bech32Config: {
bech32PrefixAccAddr: "ex",
bech32PrefixAccPub: "expub",
bech32PrefixValAddr: "exvaloper",
bech32PrefixValPub: "exvaloperpub",
bech32PrefixConsAddr: "exvalcons",
bech32PrefixConsPub: "exvalconspub"
},
currencies: [{
coinDenom: "OKT",
coinMinimalDenom: "wei",
coinDecimals: 18,
coinGeckoId: "oec-token"
}],
feeCurrencies: [{
coinDenom: "OKT",
coinMinimalDenom: "wei",
coinDecimals: 18,
coinGeckoId: "oec-token"
}],
coinType: 60,
gasPriceStep: {
low: 200000000,
average: 250000000,
high: 400000000
},
features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
});
window.keplr.experimentalSuggestChain({
chainId: "exchain-66",
chainName: "OKC mainnet",
rpc: "https://exchaintmrpc.okex.org",
rest: "https://exchainrpc.okex.org",
stakeCurrency: {
coinDenom: "OKT",
coinMinimalDenom: "wei",
coinDecimals: 18,
coinGeckoId: "oec-token"
},
bip44: {
coinType: 60,
},
bech32Config: {
bech32PrefixAccAddr: "ex",
bech32PrefixAccPub: "expub",
bech32PrefixValAddr: "exvaloper",
bech32PrefixValPub: "exvaloperpub",
bech32PrefixConsAddr: "exvalcons",
bech32PrefixConsPub: "exvalconspub"
},
currencies: [{
coinDenom: "OKT",
coinMinimalDenom: "wei",
coinDecimals: 18,
coinGeckoId: "oec-token"
}],
feeCurrencies: [{
coinDenom: "OKT",
coinMinimalDenom: "wei",
coinDecimals: 18,
coinGeckoId: "oec-token"
}],
coinType: 60,
gasPriceStep: {
low: 200000000,
average: 250000000,
high: 400000000
},
features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
});
Expected behavior When calling window.keplr.experimentalSuggestChain({chainId: exchain-65,}), window.keplr.experimentalSuggestChain({chainId: exchain-66,}) in turn, the value prefix of chainId is not used for distinction.
The two chains whose chainId is exchain-65 and exchain-66 can be successfully added to the Keplr Browser Extension in turn, and the two chains can be used at the same time, without the need to delete one of them.
Screenshots N/A
Device details (please complete the following information):
- OS: OS X
- Browser: Chrome Version 103.0.5060.53 (Official Build)
- Keplr Browser Extension Version: 0.10.1
Additional context N/A
This is completely intentional.
First, in cosmos chains, when the chain is updated, the prefixed version of the chain id increases by 1 as a de-facto standard. And in ibc, chain update is handled through the version of prefix of chain id in the same way.
Chain updates are handled in Keplr in the same way. Since there cannot be two identical chains, the prefixed version is ignored when chains are added.
Thank you for your quick reply, can you use the full name of chain-id to distinguish instead of prefix ? @Thunnini
No
No
So how do I solve the problem that the chain-id equal to exchain-65 and exchain-66 cannot be added at the same time?
Change the chain ids
Can you explain why the chain id have different numbers at the end? I would be able to offer some advice for the integration if I have context.
If the numbers are necessary, you might want to take a look at EVMOS, which has chain id with numbers using underscore.
Can you explain why the chain id have different numbers at the end? I would be able to offer some advice for the integration if I have context.
If the numbers are necessary, you might want to take a look at EVMOS, which has chain id with numbers using underscore.
Hi, we are using the "prefix-number" format as our chain-id such as exchain-65. Because we are compatible with EVM (it's similar to EVMOS). So the number was used as EVM side chain-id and the prefix was used as cosmos side chain-id. In most use cases of using testnet or mainnet is EVM, so we just focused on the number zone. Now we are going to integrate ibc and cosmwasm to our chain but chain-id has been already configured to our net while a long time, so it's hard to change our chain-id directly to be compatible with keplr wallet(some historical reasons). so we are here to ask for some help
Can you explain why the chain id have different numbers at the end? I would be able to offer some advice for the integration if I have context. If the numbers are necessary, you might want to take a look at EVMOS, which has chain id with numbers using underscore.
Hi, we are using the "prefix-number" format as our chain-id such as exchain-65. Because we are compatible with EVM (it's similar to EVMOS). So the number was used as EVM side chain-id and the prefix was used as cosmos side chain-id. In most use cases of using testnet or mainnet is EVM, so we just focused on the number zone. Now we are going to integrate ibc and cosmwasm to our chain but chain-id has been already configured to our net while a long time, so it's hard to change our chain-id directly to be compatible with keplr wallet(some historical reasons). so we are here to ask for some help
@Thunnini For the above reasons, what is your advice?