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

[@cosmos-kit/cosmos-extension-metamask]Coin type 60 is forbidden #405

Open
eric-notifi opened this issue Feb 21, 2024 · 1 comment
Open

Comments

@eric-notifi
Copy link

eric-notifi commented Feb 21, 2024

Hey team,
We are running into a situation when building a dapp with cosmos-kit react wallet on Injective chain

  • @cosmos-kit/cosmos-extension-metamask
  • @cosmos-kit/react
import { wallets as metaMaskWallets } from '@cosmos-kit/cosmos-extension-metamask';
import { wallets as keplrWallets } from '@cosmos-kit/keplr';

export const CosmosWalletProvider: FC<PropsWithChildren> = ({ children }) => {

  return (
    <ChainProvider
      chains={[injChain]} // https://github.com/cosmos/chain-registry/blob/master/injective/chain.json
      assetLists={[assetList]}
      wallets={[...keplrWallets, ...metaMaskWallets]}
    >
      {children}
    </ChainProvider>
  );
};

Keplr is working like a charm, but Metamask is not working as expected. There are two scenarios:

  1. The wallet is successfully connected, but the "inj" address seems not correct. (different from the one showing in injective hub. See the video below):
Screen.Recording.2024-02-21.at.19.18.35.mov
  1. The error Coin type 60 is forbidden is thrown when I try to use client.signArbitrary.
Screenshot 2024-02-21 at 19 24 02

Code:

 const { client, status } = useWalletClient();
//...

        <div
          onClick={() => {
            if (client?.signArbitrary && client.getAccount) {
              client.getAccount('injective-1').then((account) => {
                // Along with the following 'arr', I also tried inj addr and eth hex addr. But still no luck
                const arr = Buffer.from(
                  new Uint8Array(Object.values(account.pubkey)),
                ).toString('base64');
                console.log({ addr: arr });
                client?.signArbitrary?.('injective-1', arr, 'test');
              });
            }
          }}
        >
          Sign with metamask
       </div>
//...

Not sure if it is caused by INJ chain's being not supported (or even the .signArbitrary is not support using Metamask?).
Please point me out if I miss anything.

@schnetzlerjoe
Copy link
Contributor

@eric-notifi Hello! Thanks for this. The issue you are seeing is because Coin Type 60 is the coin type for all native Metamask addresses and they block Coin Type 60 in the Metamask Snap SDK. Thus any coin type 60 chains are supported natively by Metamask, not with the Cosmos Extension for Metamask.

Hope that clears it up!

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

2 participants