Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addChain should return if a chain is already supported #474

Open
pyramation opened this issue Jun 18, 2024 · 1 comment
Open

addChain should return if a chain is already supported #474

pyramation opened this issue Jun 18, 2024 · 1 comment

Comments

@pyramation
Copy link
Collaborator

pyramation commented Jun 18, 2024

So what im seeing now is that we are using the useChains hook, with some chains in there that are already in my Keplr wallet, but still they pop up as if they are new chains and need to be added to Keplr as new chain

async addChain(chainInfo: ChainRecord) {
const suggestChain = chainRegistryChainToKeplr(
chainInfo.chain,
chainInfo.assetList ? [chainInfo.assetList] : []
);
if (chainInfo.preferredEndpoints?.rest?.[0]) {
(suggestChain.rest as string | ExtendedHttpEndpoint) =
chainInfo.preferredEndpoints?.rest?.[0];
}
if (chainInfo.preferredEndpoints?.rpc?.[0]) {
(suggestChain.rpc as string | ExtendedHttpEndpoint) =
chainInfo.preferredEndpoints?.rpc?.[0];
}
await this.client.experimentalSuggestChain(suggestChain);
}

for now, only do keplr mobile and keplr extension, you can leverage JSON from

https://github.com/cosmos/wallet-registry/blob/8a644ef3d1cadbb8ab240b969d381d07b79897e0/wallets/keplrextension/wallet.json#L8C3-L35C5

https://github.com/cosmos/wallet-registry/blob/8a644ef3d1cadbb8ab240b969d381d07b79897e0/wallets/keplrmobile/wallet.json#L8C2-L46C20

@pyramation
Copy link
Collaborator Author

modify this to have supportedChains? property that stores an array of chain names

export interface Wallet {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant