@metamask/keyring-api
Version:
MetaMask Keyring API
1 lines • 2.29 kB
Source Map (JSON)
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/trx/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gCAAgC;AAEjD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AACxE,OAAO,EAAE,aAAa,EAAE,wBAAwB;AAEhD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACf,yBAAe;AAEhB;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,+BAA+B,CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;IAEnC,yCAAyC;IACzC,4CAA+B,CAAA;IAC/B,qCAAqC;IACrC,gDAAmC,CAAA;AACrC,CAAC,EARW,SAAS,KAAT,SAAS,QAQpB;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;IACxC,GAAG,oBAAoB,CAAC,MAAM;IAC9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IACzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,CAAC;IACtC;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;CAChD,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal, nonempty } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\n\nimport {\n CaipChainIdStruct,\n KeyringAccountStruct,\n TrxAccountType,\n} from '../api';\n\n/**\n * TRON addresses are Base58-encoded strings that are exactly 34 characters long\n * and start with the letter 'T'.\n */\nexport const TrxAddressStruct = definePattern(\n 'TrxAddress',\n /^T[1-9A-HJ-NP-Za-km-z]{33}$/iu,\n);\n\n/**\n * Supported TRON methods.\n */\nexport enum TrxMethod {\n SignMessage = 'signMessage',\n SignTransaction = 'signTransaction',\n\n // @deprecated Use `SignMessage` instead.\n SignMessageV2 = 'signMessageV2',\n // @deprecated Not supported anymore.\n VerifyMessageV2 = 'verifyMessageV2',\n}\n\nexport const TrxEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n /**\n * Account address.\n */\n address: TrxAddressStruct,\n /**\n * Account type.\n */\n type: literal(`${TrxAccountType.Eoa}`),\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * Account supported methods.\n */\n methods: array(enums(Object.values(TrxMethod))),\n});\n\nexport type TrxEoaAccount = Infer<typeof TrxEoaAccountStruct>;\n"]}