@metamask/keyring-api
Version:
MetaMask Keyring API
1 lines • 2.06 kB
Source Map (JSON)
{"version":3,"file":"discovery.cjs","sourceRoot":"","sources":["../../src/api/discovery.ts"],"names":[],"mappings":";;;AACA,uDAA+D;AAE/D,qCAA2C;AAC3C,iDAAoD;AAEpD;;;;;GAKG;AACH,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,8BAA8B;IAC9B,wCAAe,CAAA;AACjB,CAAC,EAHW,qBAAqB,qCAArB,qBAAqB,QAGhC;AAED;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG,IAAA,oBAAM,EAAC;IACjD;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAqB,CAAC,KAAK,EAAE,CAAC;IAE/C;;OAEG;IACH,MAAM,EAAE,IAAA,mBAAK,EAAC,wBAAiB,CAAC;IAEhC;;OAEG;IACH,cAAc,EAAE,iCAAoB;CACrC,CAAC,CAAC;AASH,+DAA+D;AAClD,QAAA,uBAAuB,GAAG,oCAA4B,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, literal, object } from '@metamask/superstruct';\n\nimport { CaipChainIdStruct } from './caip';\nimport { DerivationPathStruct } from './derivation';\n\n/**\n * Account type tag.\n *\n * The main use of this enum is to tag the {@link DiscoveredAccount} type for\n * future use.\n */\nexport enum DiscoveredAccountType {\n // BIP-44 compatible accounts.\n Bip44 = 'bip44',\n}\n\n/**\n * This struct represents a discovered BIP-44 compatible account.\n *\n * It supports BIP-44 in a non-strict way. The derivation path MUST HAVE at\n * least 1 segment.\n */\nexport const DiscoveredBip44AccountStruct = object({\n /**\n * Account type.\n */\n type: literal(`${DiscoveredAccountType.Bip44}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: array(CaipChainIdStruct),\n\n /**\n * The derivation path for this account. It MUST HAVE at least 1 segment.\n */\n derivationPath: DerivationPathStruct,\n});\n\n/**\n * Discovered BIP-44 account object.\n *\n * See {@link TransactionStruct}.\n */\nexport type DiscoveredBip44Account = Infer<typeof DiscoveredBip44AccountStruct>;\n\n// Could become a union if we have new discovered account type.\nexport const DiscoveredAccountStruct = DiscoveredBip44AccountStruct;\n\n/**\n * Discovered account object.\n *\n * See {@link DiscoveredAccountStruct}.\n */\nexport type DiscoveredAccount = Infer<typeof DiscoveredAccountStruct>;\n"]}