Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Visual

Functionality

FIO Handle Resolution

image-20240909-182644.png
  • Overview

    • When user has the FIO Snap installed, FIO Handles will be resolved inside MetaMask on send.

  • Manifest spec - this ensures OnNameLookupHandler receives any data typed for any chain

Code Block
languagejson
"endowment:name-lookup": {
  "chains": [
    "eip155:1",
    "eip155:10",
    "eip155:56",
    "eip155:61",
    "eip155:137",
    "eip155:324",
    "eip155:1101",
    "eip155:5000",
    "eip155:8453",
    "eip155:42161",
    "eip155:42220",
    "eip155:43114",
    "eip155:59144",
    "eip155:7777777"
  ]
}
  • Look-up logic

    • Verify that the string received matches the FIO Handle format

    • Convert chainID chainId to chain_code and token_code - DEV NOTE: mapping static file TBD, e.g. eip155:1 is based on the following (chainId, chain_code: ETH, token_code)

      Code Block
      eip155:1,ETH,ETH
      eip155:10,OP,ETH
      eip155:56,BSC,BNB
      eip155:61,ETC,ETC
      eip155:137,POL,POL
      eip155:324,ZKSYNC,ETH
      eip155:1101,POLZK,ETH
      eip155:5000,MNT,MNT
      eip155:8453,BASE,ETH
      eip155:42161,ARB,ETH
      eip155:42220,CELO,CELO
      eip155:43114,AVAX,AVAX
      eip155:59144,LINEA,ETH
      eip155:7777777,ZORA,ETH
    • Execute /get_pub_address

    • Return public address

    • Example OnNameLookupHandler

Code Block
languagetypescript
export const onNameLookup: OnNameLookupHandler = async (request) => {
  const { chainId, address, domain } = request;

  if (domain) {
    const resolvedAddress = '0xc0ffee254729296a45a3885639AC7E10F9d54979';
    return {
      resolvedAddresses: [{
        protocol: 'FIO Handle',
        resolvedAddress: resolvedAddress,
        domainName: domain,
      }]
    };
  }

  return null;
};

DEV NOTE: specification: https://metamask.github.io/SIPs/SIPS/sip-12

SNAP Home Page

No FIO Handle and No FIO Tokens and No Pending FIO Requests

image-20240422-164358.png

1+ FIO Handles and >0 FIO Tokens and 1+ FIO Requests

image-20240422-171619.png

...