Snap RPC APIs

Connecting to a non-metamask(external) account

Users can connect to both metamask accounts and non-metamask accounts with Identify Snap. For connecting to metamask accounts, everything is handled automatically as snap has direct access to Metamask APIs however for connecting to non-metamask accounts, some additional flags must be passed so the snap recognizes that the user is trying to connect to an external account.

The flag for an external flag is as follows:

const externalAccountParams = {
  externalAccount: {
    network: 'evm',
    data: {
      address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
    }
  }
}

In addition to evm accounts, Identify Snap also lets users connect to non-evm accounts which may have additional fields. For example, in the case of Hedera Hashgraph, each account has an account id(in the format 0.0.xxxxx) that must also be set and as such, when connecting to a non-metamask hedera account, the following external flag would be passed instead:

const externalAccountParams = {
  externalAccount: {
      network: "hedera",
      data: {
        accountId: "0.0.15215"
      }
  }
}

Note: While there are plans to support more blockchain networks in the future, Identify Snap currently supports only two types of networks:

  1. evm: All EVM compatible blockchain networks. This includes any kind of network that is EVM compatible(Layer1s, Layer2s, etc). The params value for network must be "evm" and the params value for "address" must be an EVM address.

  2. hedera: Hedera Hashgraph network. The params value for network must be "hedera" and the params value for "accountId" must be a valid hedera account id.

Last updated