@metamask-previews/keyring-api 21.1.0-7d43e97 → 21.3.0-2d9d5c0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/README.md +11 -0
- package/dist/api/account-options.cjs +44 -7
- package/dist/api/account-options.cjs.map +1 -1
- package/dist/api/account-options.d.cts +41 -3
- package/dist/api/account-options.d.cts.map +1 -1
- package/dist/api/account-options.d.mts +41 -3
- package/dist/api/account-options.d.mts.map +1 -1
- package/dist/api/account-options.mjs +43 -6
- package/dist/api/account-options.mjs.map +1 -1
- package/dist/api/account.cjs +15 -1
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +18 -0
- package/dist/api/account.d.cts.map +1 -1
- package/dist/api/account.d.mts +18 -0
- package/dist/api/account.d.mts.map +1 -1
- package/dist/api/account.mjs +14 -0
- package/dist/api/account.mjs.map +1 -1
- package/dist/api/index.cjs +1 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +1 -0
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +1 -0
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +1 -0
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/keyring.cjs +0 -2
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs +0 -2
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/api/transaction.cjs +10 -0
- package/dist/api/transaction.cjs.map +1 -1
- package/dist/api/transaction.d.cts +18 -6
- package/dist/api/transaction.d.cts.map +1 -1
- package/dist/api/transaction.d.mts +18 -6
- package/dist/api/transaction.d.mts.map +1 -1
- package/dist/api/transaction.mjs +10 -0
- package/dist/api/transaction.mjs.map +1 -1
- package/dist/api/v2/create-account/bip44.cjs +57 -0
- package/dist/api/v2/create-account/bip44.cjs.map +1 -0
- package/dist/api/v2/create-account/bip44.d.cts +83 -0
- package/dist/api/v2/create-account/bip44.d.cts.map +1 -0
- package/dist/api/v2/create-account/bip44.d.mts +83 -0
- package/dist/api/v2/create-account/bip44.d.mts.map +1 -0
- package/dist/api/v2/create-account/bip44.mjs +54 -0
- package/dist/api/v2/create-account/bip44.mjs.map +1 -0
- package/dist/api/v2/create-account/custom.cjs +14 -0
- package/dist/api/v2/create-account/custom.cjs.map +1 -0
- package/dist/api/v2/create-account/custom.d.cts +25 -0
- package/dist/api/v2/create-account/custom.d.cts.map +1 -0
- package/dist/api/v2/create-account/custom.d.mts +25 -0
- package/dist/api/v2/create-account/custom.d.mts.map +1 -0
- package/dist/api/v2/create-account/custom.mjs +11 -0
- package/dist/api/v2/create-account/custom.mjs.map +1 -0
- package/dist/api/v2/create-account/index.cjs +83 -0
- package/dist/api/v2/create-account/index.cjs.map +1 -0
- package/dist/api/v2/create-account/index.d.cts +68 -0
- package/dist/api/v2/create-account/index.d.cts.map +1 -0
- package/dist/api/v2/create-account/index.d.mts +68 -0
- package/dist/api/v2/create-account/index.d.mts.map +1 -0
- package/dist/api/v2/create-account/index.mjs +66 -0
- package/dist/api/v2/create-account/index.mjs.map +1 -0
- package/dist/api/v2/create-account/private-key.cjs +28 -0
- package/dist/api/v2/create-account/private-key.cjs.map +1 -0
- package/dist/api/v2/create-account/private-key.d.cts +45 -0
- package/dist/api/v2/create-account/private-key.d.cts.map +1 -0
- package/dist/api/v2/create-account/private-key.d.mts +45 -0
- package/dist/api/v2/create-account/private-key.d.mts.map +1 -0
- package/dist/api/v2/create-account/private-key.mjs +25 -0
- package/dist/api/v2/create-account/private-key.mjs.map +1 -0
- package/dist/api/v2/export-account/index.cjs +38 -0
- package/dist/api/v2/export-account/index.cjs.map +1 -0
- package/dist/api/v2/export-account/index.d.cts +48 -0
- package/dist/api/v2/export-account/index.d.cts.map +1 -0
- package/dist/api/v2/export-account/index.d.mts +48 -0
- package/dist/api/v2/export-account/index.d.mts.map +1 -0
- package/dist/api/v2/export-account/index.mjs +21 -0
- package/dist/api/v2/export-account/index.mjs.map +1 -0
- package/dist/api/v2/export-account/private-key.cjs +36 -0
- package/dist/api/v2/export-account/private-key.cjs.map +1 -0
- package/dist/api/v2/export-account/private-key.d.cts +53 -0
- package/dist/api/v2/export-account/private-key.d.cts.map +1 -0
- package/dist/api/v2/export-account/private-key.d.mts +53 -0
- package/dist/api/v2/export-account/private-key.d.mts.map +1 -0
- package/dist/api/v2/export-account/private-key.mjs +33 -0
- package/dist/api/v2/export-account/private-key.mjs.map +1 -0
- package/dist/api/v2/index.cjs +23 -0
- package/dist/api/v2/index.cjs.map +1 -0
- package/dist/api/v2/index.d.cts +8 -0
- package/dist/api/v2/index.d.cts.map +1 -0
- package/dist/api/v2/index.d.mts +8 -0
- package/dist/api/v2/index.d.mts.map +1 -0
- package/dist/api/v2/index.mjs +7 -0
- package/dist/api/v2/index.mjs.map +1 -0
- package/dist/api/v2/keyring-capabilities.cjs +56 -0
- package/dist/api/v2/keyring-capabilities.cjs.map +1 -0
- package/dist/api/v2/keyring-capabilities.d.cts +143 -0
- package/dist/api/v2/keyring-capabilities.d.cts.map +1 -0
- package/dist/api/v2/keyring-capabilities.d.mts +143 -0
- package/dist/api/v2/keyring-capabilities.d.mts.map +1 -0
- package/dist/api/v2/keyring-capabilities.mjs +53 -0
- package/dist/api/v2/keyring-capabilities.mjs.map +1 -0
- package/dist/api/v2/keyring-type.cjs +44 -0
- package/dist/api/v2/keyring-type.cjs.map +1 -0
- package/dist/api/v2/keyring-type.d.cts +40 -0
- package/dist/api/v2/keyring-type.d.cts.map +1 -0
- package/dist/api/v2/keyring-type.d.mts +40 -0
- package/dist/api/v2/keyring-type.d.mts.map +1 -0
- package/dist/api/v2/keyring-type.mjs +41 -0
- package/dist/api/v2/keyring-type.mjs.map +1 -0
- package/dist/api/v2/keyring.cjs +3 -0
- package/dist/api/v2/keyring.cjs.map +1 -0
- package/dist/api/v2/keyring.d.cts +107 -0
- package/dist/api/v2/keyring.d.cts.map +1 -0
- package/dist/api/v2/keyring.d.mts +107 -0
- package/dist/api/v2/keyring.d.mts.map +1 -0
- package/dist/api/v2/keyring.mjs +2 -0
- package/dist/api/v2/keyring.mjs.map +1 -0
- package/dist/api/v2/private-key.cjs +53 -0
- package/dist/api/v2/private-key.cjs.map +1 -0
- package/dist/api/v2/private-key.d.cts +77 -0
- package/dist/api/v2/private-key.d.cts.map +1 -0
- package/dist/api/v2/private-key.d.mts +77 -0
- package/dist/api/v2/private-key.d.mts.map +1 -0
- package/dist/api/v2/private-key.mjs +50 -0
- package/dist/api/v2/private-key.mjs.map +1 -0
- package/dist/api/v2/wrapper/index.cjs +19 -0
- package/dist/api/v2/wrapper/index.cjs.map +1 -0
- package/dist/api/v2/wrapper/index.d.cts +3 -0
- package/dist/api/v2/wrapper/index.d.cts.map +1 -0
- package/dist/api/v2/wrapper/index.d.mts +3 -0
- package/dist/api/v2/wrapper/index.d.mts.map +1 -0
- package/dist/api/v2/wrapper/index.mjs +3 -0
- package/dist/api/v2/wrapper/index.mjs.map +1 -0
- package/dist/api/v2/wrapper/keyring-account-registry.cjs +135 -0
- package/dist/api/v2/wrapper/keyring-account-registry.cjs.map +1 -0
- package/dist/api/v2/wrapper/keyring-account-registry.d.cts +88 -0
- package/dist/api/v2/wrapper/keyring-account-registry.d.cts.map +1 -0
- package/dist/api/v2/wrapper/keyring-account-registry.d.mts +88 -0
- package/dist/api/v2/wrapper/keyring-account-registry.d.mts.map +1 -0
- package/dist/api/v2/wrapper/keyring-account-registry.mjs +131 -0
- package/dist/api/v2/wrapper/keyring-account-registry.mjs.map +1 -0
- package/dist/api/v2/wrapper/keyring-wrapper.cjs +116 -0
- package/dist/api/v2/wrapper/keyring-wrapper.cjs.map +1 -0
- package/dist/api/v2/wrapper/keyring-wrapper.d.cts +146 -0
- package/dist/api/v2/wrapper/keyring-wrapper.d.cts.map +1 -0
- package/dist/api/v2/wrapper/keyring-wrapper.d.mts +146 -0
- package/dist/api/v2/wrapper/keyring-wrapper.d.mts.map +1 -0
- package/dist/api/v2/wrapper/keyring-wrapper.mjs +112 -0
- package/dist/api/v2/wrapper/keyring-wrapper.mjs.map +1 -0
- package/dist/btc/types.d.cts +16 -0
- package/dist/btc/types.d.cts.map +1 -1
- package/dist/btc/types.d.mts +16 -0
- package/dist/btc/types.d.mts.map +1 -1
- package/dist/eth/erc4337/types.d.cts +4 -4
- package/dist/eth/erc4337/types.d.mts +4 -4
- package/dist/eth/index.cjs +2 -0
- package/dist/eth/index.cjs.map +1 -1
- package/dist/eth/index.d.cts +2 -0
- package/dist/eth/index.d.cts.map +1 -1
- package/dist/eth/index.d.mts +2 -0
- package/dist/eth/index.d.mts.map +1 -1
- package/dist/eth/index.mjs +2 -0
- package/dist/eth/index.mjs.map +1 -1
- package/dist/eth/rpc/index.cjs +18 -0
- package/dist/eth/rpc/index.cjs.map +1 -0
- package/dist/eth/rpc/index.d.cts +2 -0
- package/dist/eth/rpc/index.d.cts.map +1 -0
- package/dist/eth/rpc/index.d.mts +2 -0
- package/dist/eth/rpc/index.d.mts.map +1 -0
- package/dist/eth/rpc/index.mjs +2 -0
- package/dist/eth/rpc/index.mjs.map +1 -0
- package/dist/eth/rpc/params.cjs +151 -0
- package/dist/eth/rpc/params.cjs.map +1 -0
- package/dist/eth/rpc/params.d.cts +215 -0
- package/dist/eth/rpc/params.d.cts.map +1 -0
- package/dist/eth/rpc/params.d.mts +215 -0
- package/dist/eth/rpc/params.d.mts.map +1 -0
- package/dist/eth/rpc/params.mjs +148 -0
- package/dist/eth/rpc/params.mjs.map +1 -0
- package/dist/eth/types.cjs.map +1 -1
- package/dist/eth/types.d.cts +13 -5
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +13 -5
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/eth/types.mjs.map +1 -1
- package/dist/eth/v2/eth-keyring-wrapper.cjs +165 -0
- package/dist/eth/v2/eth-keyring-wrapper.cjs.map +1 -0
- package/dist/eth/v2/eth-keyring-wrapper.d.cts +54 -0
- package/dist/eth/v2/eth-keyring-wrapper.d.cts.map +1 -0
- package/dist/eth/v2/eth-keyring-wrapper.d.mts +54 -0
- package/dist/eth/v2/eth-keyring-wrapper.d.mts.map +1 -0
- package/dist/eth/v2/eth-keyring-wrapper.mjs +161 -0
- package/dist/eth/v2/eth-keyring-wrapper.mjs.map +1 -0
- package/dist/eth/v2/index.cjs +18 -0
- package/dist/eth/v2/index.cjs.map +1 -0
- package/dist/eth/v2/index.d.cts +2 -0
- package/dist/eth/v2/index.d.cts.map +1 -0
- package/dist/eth/v2/index.d.mts +2 -0
- package/dist/eth/v2/index.d.mts.map +1 -0
- package/dist/eth/v2/index.mjs +2 -0
- package/dist/eth/v2/index.mjs.map +1 -0
- package/dist/events.cjs +0 -2
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +19 -3
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +19 -3
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +0 -2
- package/dist/events.mjs.map +1 -1
- package/dist/rpc.cjs +15 -11
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.cts +40 -16
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +40 -16
- package/dist/rpc.d.mts.map +1 -1
- package/dist/rpc.mjs +15 -11
- package/dist/rpc.mjs.map +1 -1
- package/dist/sol/types.d.cts +4 -0
- package/dist/sol/types.d.cts.map +1 -1
- package/dist/sol/types.d.mts +4 -0
- package/dist/sol/types.d.mts.map +1 -1
- package/dist/trx/types.cjs +4 -0
- package/dist/trx/types.cjs.map +1 -1
- package/dist/trx/types.d.cts +8 -0
- package/dist/trx/types.d.cts.map +1 -1
- package/dist/trx/types.d.mts +8 -0
- package/dist/trx/types.d.mts.map +1 -1
- package/dist/trx/types.mjs +4 -0
- package/dist/trx/types.mjs.map +1 -1
- package/package.json +7 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction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Ae,CAAC,IAAI,EAAE;QACzB,GAAG,eAAe,CAAC,UAAU,EAAE;QAC/B,GAAG,eAAe,CAAC,aAAa,EAAE;QAClC,GAAG,eAAe,CAAC,OAAO,EAAE;KAC7B,CAAC;IAEF;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE9B;;OAEG;IACH,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE5B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IAEtB;;;;;OAKG;IACH,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC;CACtC,CAAC,CAAC;AASH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;IAC3C;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE9B;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import type { InferEquals } from '@metamask/keyring-utils';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, nullable, number, string } from '@metamask/superstruct';\n\nimport { AssetStruct } from './asset';\nimport { CaipChainIdStruct } from './caip';\nimport type { Paginated } from './pagination';\n\n/**\n * This struct represents a participant in a transaction.\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: true,\n * type: 'eip155:1/slip44:60',\n * unit: 'ETH',\n * amount: '0.01',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: false,\n * id: 'eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: null,\n * },\n * ```\n */\nconst ParticipantStruct = object({\n /**\n * Participant address.\n */\n address: string(),\n\n /**\n * Asset being transferred.\n */\n asset: nullable(AssetStruct),\n});\n\n/**\n * Fee types.\n */\nexport enum FeeType {\n /**\n * Base fee. It is the minimum fee required to include a transaction in the\n * blockchain.\n *\n * For non-confirmed transactions, it must be the maximum base fee. For\n * confirmed transactions, it must be the actual base fee paid.\n */\n Base = 'base',\n\n /**\n * Priority fee. It is an optional fee used to prioritize the transaction.\n *\n * For non-confirmed transactions, it must be the maximum priority fee. For\n * confirmed transactions, it must be the actual priority fee paid.\n */\n Priority = 'priority',\n}\n\n/**\n * This struct represents a transaction fee.\n */\nconst FeeStruct = object({\n /**\n * Fee type {@see FeeType}.\n */\n type: enums([`${FeeType.Base}`, `${FeeType.Priority}`]),\n\n /**\n * Asset used to pay for the fee.\n */\n asset: AssetStruct,\n});\n\n/**\n * Transaction statuses.\n */\nexport enum TransactionStatus {\n /**\n * The transaction has been submitted but is not yet in the\n * blockchain. For example, it can be in the mempool.\n */\n Submitted = 'submitted',\n\n /**\n * The transaction is in the blockchain but has not been\n * confirmed yet.\n */\n Unconfirmed = 'unconfirmed',\n\n /**\n * The transaction has been confirmed.\n */\n Confirmed = 'confirmed',\n\n /**\n * The transaction has failed. For example, it has been reverted.\n */\n Failed = 'failed',\n}\n\n/**\n * Transaction types.\n */\nexport enum TransactionType {\n /**\n * The transaction was originated by the account. If the transaction\n * has a change output that goes back to the same account, it must be tagged\n * as a send transaction.\n */\n Send = 'send',\n\n /**\n * The transaction was received by the account, but originated by\n * another account.\n */\n Receive = 'receive',\n\n /**\n * The transaction is a swap. It decreases the balance of one asset and\n * increases the balance of another asset in a single transaction.\n *\n * A swap transaction must be originated by the account.\n */\n Swap = 'swap',\n\n /**\n * Represents an outgoing bridge transaction, transferring assets from\n * the account to another blockchain.\n */\n BridgeSend = 'bridge:send',\n\n /**\n * Represents an incoming bridge transaction, transferring assets from\n * another blockchain to the account.\n */\n BridgeReceive = 'bridge:receive',\n\n /**\n * The transaction type is unknown. It's not possible to determine the\n * transaction type based on the information available.\n */\n Unknown = 'unknown',\n}\n\n/**\n * This struct represents a transaction event.\n */\nexport const TransactionEventStruct = object({\n /**\n * New status of the transaction.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the event occurred.\n */\n timestamp: nullable(number()),\n});\n\n/**\n * This struct represents a blockchain transaction.\n *\n * @example\n * ```ts\n * const tx = {\n * id: 'f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6',\n * chain: 'bip122:000000000019d6689c085ae165831e93',\n * account: 'b9beb861-9761-4b97-89ce-d992be5f34da',\n * status: 'confirmed',\n * timestamp: 1716367781,\n * type: 'send',\n * from: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * to: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * {\n * address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * fees: [\n * {\n * type: 'priority',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * };\n * ```\n */\nexport const TransactionStruct = object({\n /**\n * Chain-specific transaction ID.\n */\n id: string(),\n\n /**\n * Chain ID (CAIP-2).\n */\n chain: CaipChainIdStruct,\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Transaction status {@see TransactionStatus}.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the transaction was added to the blockchain. The\n * timestamp can be null if the transaction has not been included in the\n * blockchain yet.\n */\n timestamp: nullable(number()),\n\n /**\n * Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction\n * details on the UI.\n */\n type: enums([\n `${TransactionType.Send}`,\n `${TransactionType.Receive}`,\n `${TransactionType.Swap}`,\n `${TransactionType.BridgeSend}`,\n `${TransactionType.BridgeReceive}`,\n `${TransactionType.Unknown}`,\n ]),\n\n /**\n * Transaction sender addresses and amounts.\n */\n from: array(ParticipantStruct),\n\n /**\n * Transaction receiver addresses and amounts.\n */\n to: array(ParticipantStruct),\n\n /**\n * Total transaction fee.\n */\n fees: array(FeeStruct),\n\n /**\n * List of events related to the transaction {@see TransactionEventStruct}.\n *\n * The events are tracked in a best-effort basis and may not be available for\n * all transactions.\n */\n events: array(TransactionEventStruct),\n});\n\n/**\n * Transaction object.\n *\n * See {@link TransactionStruct}.\n */\nexport type Transaction = Infer<typeof TransactionStruct>;\n\n/**\n * This struct represents a page of transactions.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: null, // No more results\n * }**\n * ```\n */\nexport const TransactionsPageStruct = object({\n /**\n * List of transactions.\n */\n data: array(TransactionStruct),\n\n /**\n * Next cursor to iterate over the results. If null, there are no more\n * results.\n */\n next: nullable(string()),\n});\n\n/**\n * Transactions page object.\n *\n * See {@link TransactionsPageStruct}.\n */\nexport type TransactionsPage = InferEquals<\n typeof TransactionsPageStruct,\n Paginated<Transaction>\n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AAE,KAAK,CAAC;QACV,GAAG,eAAe,CAAC,IAAI,EAAE;QACzB,GAAG,eAAe,CAAC,OAAO,EAAE;QAC5B,GAAG,eAAe,CAAC,IAAI,EAAE;QACzB,GAAG,eAAe,CAAC,UAAU,EAAE;QAC/B,GAAG,eAAe,CAAC,aAAa,EAAE;QAClC,GAAG,eAAe,CAAC,YAAY,EAAE;QACjC,GAAG,eAAe,CAAC,aAAa,EAAE;QAClC,GAAG,eAAe,CAAC,OAAO,EAAE;KAC7B,CAAC;IAEF;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE9B;;OAEG;IACH,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE5B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IAEtB;;;;;OAKG;IACH,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC;CACtC,CAAC,CAAC;AASH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;IAC3C;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE9B;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import type { InferEquals } from '@metamask/keyring-utils';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, nullable, number, string } from '@metamask/superstruct';\n\nimport { AssetStruct } from './asset';\nimport { CaipChainIdStruct } from './caip';\nimport type { Paginated } from './pagination';\n\n/**\n * This struct represents a participant in a transaction.\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: true,\n * type: 'eip155:1/slip44:60',\n * unit: 'ETH',\n * amount: '0.01',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: false,\n * id: 'eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: null,\n * },\n * ```\n */\nconst ParticipantStruct = object({\n /**\n * Participant address.\n */\n address: string(),\n\n /**\n * Asset being transferred.\n */\n asset: nullable(AssetStruct),\n});\n\n/**\n * Fee types.\n */\nexport enum FeeType {\n /**\n * Base fee. It is the minimum fee required to include a transaction in the\n * blockchain.\n *\n * For non-confirmed transactions, it must be the maximum base fee. For\n * confirmed transactions, it must be the actual base fee paid.\n */\n Base = 'base',\n\n /**\n * Priority fee. It is an optional fee used to prioritize the transaction.\n *\n * For non-confirmed transactions, it must be the maximum priority fee. For\n * confirmed transactions, it must be the actual priority fee paid.\n */\n Priority = 'priority',\n}\n\n/**\n * This struct represents a transaction fee.\n */\nconst FeeStruct = object({\n /**\n * Fee type {@see FeeType}.\n */\n type: enums([`${FeeType.Base}`, `${FeeType.Priority}`]),\n\n /**\n * Asset used to pay for the fee.\n */\n asset: AssetStruct,\n});\n\n/**\n * Transaction statuses.\n */\nexport enum TransactionStatus {\n /**\n * The transaction has been submitted but is not yet in the\n * blockchain. For example, it can be in the mempool.\n */\n Submitted = 'submitted',\n\n /**\n * The transaction is in the blockchain but has not been\n * confirmed yet.\n */\n Unconfirmed = 'unconfirmed',\n\n /**\n * The transaction has been confirmed.\n */\n Confirmed = 'confirmed',\n\n /**\n * The transaction has failed. For example, it has been reverted.\n */\n Failed = 'failed',\n}\n\n/**\n * Transaction types.\n */\nexport enum TransactionType {\n /**\n * The transaction was originated by the account. If the transaction\n * has a change output that goes back to the same account, it must be tagged\n * as a send transaction.\n */\n Send = 'send',\n\n /**\n * The transaction was received by the account, but originated by\n * another account.\n */\n Receive = 'receive',\n\n /**\n * The transaction is a swap. It decreases the balance of one asset and\n * increases the balance of another asset in a single transaction.\n *\n * A swap transaction must be originated by the account.\n */\n Swap = 'swap',\n\n /**\n * Represents an outgoing bridge transaction, transferring assets from\n * the account to another blockchain.\n */\n BridgeSend = 'bridge:send',\n\n /**\n * Represents an incoming bridge transaction, transferring assets from\n * another blockchain to the account.\n */\n BridgeReceive = 'bridge:receive',\n\n /**\n * Represents a stake deposit transaction.\n */\n StakeDeposit = 'stake:deposit',\n\n /**\n * Represents a stake withdrawal transaction.\n */\n StakeWithdraw = 'stake:withdraw',\n /**\n * The transaction type is unknown. It's not possible to determine the\n * transaction type based on the information available.\n */\n Unknown = 'unknown',\n}\n\n/**\n * This struct represents a transaction event.\n */\nexport const TransactionEventStruct = object({\n /**\n * New status of the transaction.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the event occurred.\n */\n timestamp: nullable(number()),\n});\n\n/**\n * This struct represents a blockchain transaction.\n *\n * @example\n * ```ts\n * const tx = {\n * id: 'f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6',\n * chain: 'bip122:000000000019d6689c085ae165831e93',\n * account: 'b9beb861-9761-4b97-89ce-d992be5f34da',\n * status: 'confirmed',\n * timestamp: 1716367781,\n * type: 'send',\n * from: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * to: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * {\n * address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * fees: [\n * {\n * type: 'priority',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * };\n * ```\n */\nexport const TransactionStruct = object({\n /**\n * Chain-specific transaction ID.\n */\n id: string(),\n\n /**\n * Chain ID (CAIP-2).\n */\n chain: CaipChainIdStruct,\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Transaction status {@see TransactionStatus}.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the transaction was added to the blockchain. The\n * timestamp can be null if the transaction has not been included in the\n * blockchain yet.\n */\n timestamp: nullable(number()),\n\n /**\n * Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction\n * details on the UI.\n */\n type: enums([\n `${TransactionType.Send}`,\n `${TransactionType.Receive}`,\n `${TransactionType.Swap}`,\n `${TransactionType.BridgeSend}`,\n `${TransactionType.BridgeReceive}`,\n `${TransactionType.StakeDeposit}`,\n `${TransactionType.StakeWithdraw}`,\n `${TransactionType.Unknown}`,\n ]),\n\n /**\n * Transaction sender addresses and amounts.\n */\n from: array(ParticipantStruct),\n\n /**\n * Transaction receiver addresses and amounts.\n */\n to: array(ParticipantStruct),\n\n /**\n * Total transaction fee.\n */\n fees: array(FeeStruct),\n\n /**\n * List of events related to the transaction {@see TransactionEventStruct}.\n *\n * The events are tracked in a best-effort basis and may not be available for\n * all transactions.\n */\n events: array(TransactionEventStruct),\n});\n\n/**\n * Transaction object.\n *\n * See {@link TransactionStruct}.\n */\nexport type Transaction = Infer<typeof TransactionStruct>;\n\n/**\n * This struct represents a page of transactions.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: null, // No more results\n * }**\n * ```\n */\nexport const TransactionsPageStruct = object({\n /**\n * List of transactions.\n */\n data: array(TransactionStruct),\n\n /**\n * Next cursor to iterate over the results. If null, there are no more\n * results.\n */\n next: nullable(string()),\n});\n\n/**\n * Transactions page object.\n *\n * See {@link TransactionsPageStruct}.\n */\nexport type TransactionsPage = InferEquals<\n typeof TransactionsPageStruct,\n Paginated<Transaction>\n>;\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateAccountBip44DiscoverOptionsStruct = exports.CreateAccountBip44DeriveIndexOptionsStruct = exports.CreateAccountBip44DerivePathOptionsStruct = void 0;
|
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
+
const derivation_1 = require("../../derivation.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Struct for {@link CreateAccountBip44DerivePathOptions}.
|
|
8
|
+
*/
|
|
9
|
+
exports.CreateAccountBip44DerivePathOptionsStruct = (0, superstruct_1.object)({
|
|
10
|
+
/**
|
|
11
|
+
* Type of the options.
|
|
12
|
+
*/
|
|
13
|
+
type: (0, superstruct_1.literal)('bip44:derive-path'),
|
|
14
|
+
/**
|
|
15
|
+
* ID of the entropy source to be used to derive the account.
|
|
16
|
+
*/
|
|
17
|
+
entropySource: (0, superstruct_1.string)(),
|
|
18
|
+
/**
|
|
19
|
+
* BIP-44 derivation path to be used to derive the account.
|
|
20
|
+
*/
|
|
21
|
+
derivationPath: derivation_1.DerivationPathStruct,
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Struct for {@link CreateAccountBip44DeriveIndexOptions}.
|
|
25
|
+
*/
|
|
26
|
+
exports.CreateAccountBip44DeriveIndexOptionsStruct = (0, superstruct_1.object)({
|
|
27
|
+
/**
|
|
28
|
+
* The type of the options.
|
|
29
|
+
*/
|
|
30
|
+
type: (0, superstruct_1.literal)('bip44:derive-index'),
|
|
31
|
+
/**
|
|
32
|
+
* ID of the entropy source to be used to derive the account.
|
|
33
|
+
*/
|
|
34
|
+
entropySource: (0, superstruct_1.string)(),
|
|
35
|
+
/**
|
|
36
|
+
* The index of the account group to be derived.
|
|
37
|
+
*/
|
|
38
|
+
groupIndex: (0, superstruct_1.number)(),
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Struct for {@link CreateAccountBip44DiscoverOptions}.
|
|
42
|
+
*/
|
|
43
|
+
exports.CreateAccountBip44DiscoverOptionsStruct = (0, superstruct_1.object)({
|
|
44
|
+
/**
|
|
45
|
+
* The type of the options.
|
|
46
|
+
*/
|
|
47
|
+
type: (0, superstruct_1.literal)('bip44:discover'),
|
|
48
|
+
/**
|
|
49
|
+
* ID of the entropy source to be used to derive the account.
|
|
50
|
+
*/
|
|
51
|
+
entropySource: (0, superstruct_1.string)(),
|
|
52
|
+
/**
|
|
53
|
+
* The index of the account group to be derived.
|
|
54
|
+
*/
|
|
55
|
+
groupIndex: (0, superstruct_1.number)(),
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=bip44.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bip44.cjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/bip44.ts"],"names":[],"mappings":";;;AAAA,uDAM+B;AAE/B,qDAAwD;AAExD;;GAEG;AACU,QAAA,yCAAyC,GAAG,IAAA,oBAAM,EAAC;IAC9D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,mBAAmB,CAAC;IAClC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,cAAc,EAAE,iCAAoB;CACrC,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,0CAA0C,GAAG,IAAA,oBAAM,EAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACnC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC;AAYH;;GAEG;AACU,QAAA,uCAAuC,GAAG,IAAA,oBAAM,EAAC;IAC5D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,gBAAgB,CAAC;IAC/B;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC","sourcesContent":["import {\n literal,\n number,\n object,\n string,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { DerivationPathStruct } from '../../derivation';\n\n/**\n * Struct for {@link CreateAccountBip44DerivePathOptions}.\n */\nexport const CreateAccountBip44DerivePathOptionsStruct = object({\n /**\n * Type of the options.\n */\n type: literal('bip44:derive-path'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * BIP-44 derivation path to be used to derive the account.\n */\n derivationPath: DerivationPathStruct,\n});\n\n/**\n * Options for creating an account using the given BIP-44 derivation path.\n */\nexport type CreateAccountBip44DerivePathOptions = Infer<\n typeof CreateAccountBip44DerivePathOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DeriveIndexOptions}.\n */\nexport const CreateAccountBip44DeriveIndexOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:derive-index'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating an account using the given BIP-44 account group index.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DeriveIndexOptions = Infer<\n typeof CreateAccountBip44DeriveIndexOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DiscoverOptions}.\n */\nexport const CreateAccountBip44DiscoverOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:discover'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating accounts by performing a BIP-44 account discovery.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DiscoverOptions = Infer<\n typeof CreateAccountBip44DiscoverOptionsStruct\n>;\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Struct for {@link CreateAccountBip44DerivePathOptions}.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CreateAccountBip44DerivePathOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
6
|
+
type: "bip44:derive-path";
|
|
7
|
+
derivationPath: `m/${string}`;
|
|
8
|
+
entropySource: string;
|
|
9
|
+
}, {
|
|
10
|
+
/**
|
|
11
|
+
* Type of the options.
|
|
12
|
+
*/
|
|
13
|
+
type: import("@metamask/superstruct").Struct<"bip44:derive-path", "bip44:derive-path">;
|
|
14
|
+
/**
|
|
15
|
+
* ID of the entropy source to be used to derive the account.
|
|
16
|
+
*/
|
|
17
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
|
18
|
+
/**
|
|
19
|
+
* BIP-44 derivation path to be used to derive the account.
|
|
20
|
+
*/
|
|
21
|
+
derivationPath: import("@metamask/superstruct").Struct<`m/${string}`, null>;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Options for creating an account using the given BIP-44 derivation path.
|
|
25
|
+
*/
|
|
26
|
+
export type CreateAccountBip44DerivePathOptions = Infer<typeof CreateAccountBip44DerivePathOptionsStruct>;
|
|
27
|
+
/**
|
|
28
|
+
* Struct for {@link CreateAccountBip44DeriveIndexOptions}.
|
|
29
|
+
*/
|
|
30
|
+
export declare const CreateAccountBip44DeriveIndexOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
31
|
+
type: "bip44:derive-index";
|
|
32
|
+
groupIndex: number;
|
|
33
|
+
entropySource: string;
|
|
34
|
+
}, {
|
|
35
|
+
/**
|
|
36
|
+
* The type of the options.
|
|
37
|
+
*/
|
|
38
|
+
type: import("@metamask/superstruct").Struct<"bip44:derive-index", "bip44:derive-index">;
|
|
39
|
+
/**
|
|
40
|
+
* ID of the entropy source to be used to derive the account.
|
|
41
|
+
*/
|
|
42
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
|
43
|
+
/**
|
|
44
|
+
* The index of the account group to be derived.
|
|
45
|
+
*/
|
|
46
|
+
groupIndex: import("@metamask/superstruct").Struct<number, null>;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Options for creating an account using the given BIP-44 account group index.
|
|
50
|
+
*
|
|
51
|
+
* Note that the keyring can support non-standard BIP-44 paths for
|
|
52
|
+
* compatibility with other wallets.
|
|
53
|
+
*/
|
|
54
|
+
export type CreateAccountBip44DeriveIndexOptions = Infer<typeof CreateAccountBip44DeriveIndexOptionsStruct>;
|
|
55
|
+
/**
|
|
56
|
+
* Struct for {@link CreateAccountBip44DiscoverOptions}.
|
|
57
|
+
*/
|
|
58
|
+
export declare const CreateAccountBip44DiscoverOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
59
|
+
type: "bip44:discover";
|
|
60
|
+
groupIndex: number;
|
|
61
|
+
entropySource: string;
|
|
62
|
+
}, {
|
|
63
|
+
/**
|
|
64
|
+
* The type of the options.
|
|
65
|
+
*/
|
|
66
|
+
type: import("@metamask/superstruct").Struct<"bip44:discover", "bip44:discover">;
|
|
67
|
+
/**
|
|
68
|
+
* ID of the entropy source to be used to derive the account.
|
|
69
|
+
*/
|
|
70
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
|
71
|
+
/**
|
|
72
|
+
* The index of the account group to be derived.
|
|
73
|
+
*/
|
|
74
|
+
groupIndex: import("@metamask/superstruct").Struct<number, null>;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Options for creating accounts by performing a BIP-44 account discovery.
|
|
78
|
+
*
|
|
79
|
+
* Note that the keyring can support non-standard BIP-44 paths for
|
|
80
|
+
* compatibility with other wallets.
|
|
81
|
+
*/
|
|
82
|
+
export type CreateAccountBip44DiscoverOptions = Infer<typeof CreateAccountBip44DiscoverOptionsStruct>;
|
|
83
|
+
//# sourceMappingURL=bip44.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bip44.d.cts","sourceRoot":"","sources":["../../../../src/api/v2/create-account/bip44.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,KAAK,EACX,8BAA8B;AAI/B;;GAEG;AACH,eAAO,MAAM,yCAAyC;;;;;IACpD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG,KAAK,CACrD,OAAO,yCAAyC,CACjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;IACrD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,oCAAoC,GAAG,KAAK,CACtD,OAAO,0CAA0C,CAClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uCAAuC;;;;;IAClD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG,KAAK,CACnD,OAAO,uCAAuC,CAC/C,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Struct for {@link CreateAccountBip44DerivePathOptions}.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CreateAccountBip44DerivePathOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
6
|
+
type: "bip44:derive-path";
|
|
7
|
+
derivationPath: `m/${string}`;
|
|
8
|
+
entropySource: string;
|
|
9
|
+
}, {
|
|
10
|
+
/**
|
|
11
|
+
* Type of the options.
|
|
12
|
+
*/
|
|
13
|
+
type: import("@metamask/superstruct").Struct<"bip44:derive-path", "bip44:derive-path">;
|
|
14
|
+
/**
|
|
15
|
+
* ID of the entropy source to be used to derive the account.
|
|
16
|
+
*/
|
|
17
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
|
18
|
+
/**
|
|
19
|
+
* BIP-44 derivation path to be used to derive the account.
|
|
20
|
+
*/
|
|
21
|
+
derivationPath: import("@metamask/superstruct").Struct<`m/${string}`, null>;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Options for creating an account using the given BIP-44 derivation path.
|
|
25
|
+
*/
|
|
26
|
+
export type CreateAccountBip44DerivePathOptions = Infer<typeof CreateAccountBip44DerivePathOptionsStruct>;
|
|
27
|
+
/**
|
|
28
|
+
* Struct for {@link CreateAccountBip44DeriveIndexOptions}.
|
|
29
|
+
*/
|
|
30
|
+
export declare const CreateAccountBip44DeriveIndexOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
31
|
+
type: "bip44:derive-index";
|
|
32
|
+
groupIndex: number;
|
|
33
|
+
entropySource: string;
|
|
34
|
+
}, {
|
|
35
|
+
/**
|
|
36
|
+
* The type of the options.
|
|
37
|
+
*/
|
|
38
|
+
type: import("@metamask/superstruct").Struct<"bip44:derive-index", "bip44:derive-index">;
|
|
39
|
+
/**
|
|
40
|
+
* ID of the entropy source to be used to derive the account.
|
|
41
|
+
*/
|
|
42
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
|
43
|
+
/**
|
|
44
|
+
* The index of the account group to be derived.
|
|
45
|
+
*/
|
|
46
|
+
groupIndex: import("@metamask/superstruct").Struct<number, null>;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Options for creating an account using the given BIP-44 account group index.
|
|
50
|
+
*
|
|
51
|
+
* Note that the keyring can support non-standard BIP-44 paths for
|
|
52
|
+
* compatibility with other wallets.
|
|
53
|
+
*/
|
|
54
|
+
export type CreateAccountBip44DeriveIndexOptions = Infer<typeof CreateAccountBip44DeriveIndexOptionsStruct>;
|
|
55
|
+
/**
|
|
56
|
+
* Struct for {@link CreateAccountBip44DiscoverOptions}.
|
|
57
|
+
*/
|
|
58
|
+
export declare const CreateAccountBip44DiscoverOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
59
|
+
type: "bip44:discover";
|
|
60
|
+
groupIndex: number;
|
|
61
|
+
entropySource: string;
|
|
62
|
+
}, {
|
|
63
|
+
/**
|
|
64
|
+
* The type of the options.
|
|
65
|
+
*/
|
|
66
|
+
type: import("@metamask/superstruct").Struct<"bip44:discover", "bip44:discover">;
|
|
67
|
+
/**
|
|
68
|
+
* ID of the entropy source to be used to derive the account.
|
|
69
|
+
*/
|
|
70
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
|
71
|
+
/**
|
|
72
|
+
* The index of the account group to be derived.
|
|
73
|
+
*/
|
|
74
|
+
groupIndex: import("@metamask/superstruct").Struct<number, null>;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Options for creating accounts by performing a BIP-44 account discovery.
|
|
78
|
+
*
|
|
79
|
+
* Note that the keyring can support non-standard BIP-44 paths for
|
|
80
|
+
* compatibility with other wallets.
|
|
81
|
+
*/
|
|
82
|
+
export type CreateAccountBip44DiscoverOptions = Infer<typeof CreateAccountBip44DiscoverOptionsStruct>;
|
|
83
|
+
//# sourceMappingURL=bip44.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bip44.d.mts","sourceRoot":"","sources":["../../../../src/api/v2/create-account/bip44.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,KAAK,EACX,8BAA8B;AAI/B;;GAEG;AACH,eAAO,MAAM,yCAAyC;;;;;IACpD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG,KAAK,CACrD,OAAO,yCAAyC,CACjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;IACrD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,oCAAoC,GAAG,KAAK,CACtD,OAAO,0CAA0C,CAClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uCAAuC;;;;;IAClD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG,KAAK,CACnD,OAAO,uCAAuC,CAC/C,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { literal, number, object, string } from "@metamask/superstruct";
|
|
2
|
+
import { DerivationPathStruct } from "../../derivation.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Struct for {@link CreateAccountBip44DerivePathOptions}.
|
|
5
|
+
*/
|
|
6
|
+
export const CreateAccountBip44DerivePathOptionsStruct = object({
|
|
7
|
+
/**
|
|
8
|
+
* Type of the options.
|
|
9
|
+
*/
|
|
10
|
+
type: literal('bip44:derive-path'),
|
|
11
|
+
/**
|
|
12
|
+
* ID of the entropy source to be used to derive the account.
|
|
13
|
+
*/
|
|
14
|
+
entropySource: string(),
|
|
15
|
+
/**
|
|
16
|
+
* BIP-44 derivation path to be used to derive the account.
|
|
17
|
+
*/
|
|
18
|
+
derivationPath: DerivationPathStruct,
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Struct for {@link CreateAccountBip44DeriveIndexOptions}.
|
|
22
|
+
*/
|
|
23
|
+
export const CreateAccountBip44DeriveIndexOptionsStruct = object({
|
|
24
|
+
/**
|
|
25
|
+
* The type of the options.
|
|
26
|
+
*/
|
|
27
|
+
type: literal('bip44:derive-index'),
|
|
28
|
+
/**
|
|
29
|
+
* ID of the entropy source to be used to derive the account.
|
|
30
|
+
*/
|
|
31
|
+
entropySource: string(),
|
|
32
|
+
/**
|
|
33
|
+
* The index of the account group to be derived.
|
|
34
|
+
*/
|
|
35
|
+
groupIndex: number(),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Struct for {@link CreateAccountBip44DiscoverOptions}.
|
|
39
|
+
*/
|
|
40
|
+
export const CreateAccountBip44DiscoverOptionsStruct = object({
|
|
41
|
+
/**
|
|
42
|
+
* The type of the options.
|
|
43
|
+
*/
|
|
44
|
+
type: literal('bip44:discover'),
|
|
45
|
+
/**
|
|
46
|
+
* ID of the entropy source to be used to derive the account.
|
|
47
|
+
*/
|
|
48
|
+
entropySource: string(),
|
|
49
|
+
/**
|
|
50
|
+
* The index of the account group to be derived.
|
|
51
|
+
*/
|
|
52
|
+
groupIndex: number(),
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=bip44.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bip44.mjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/bip44.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EAEP,8BAA8B;AAE/B,OAAO,EAAE,oBAAoB,EAAE,6BAAyB;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,MAAM,CAAC;IAC9D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,mBAAmB,CAAC;IAClC;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE;IACvB;;OAEG;IACH,cAAc,EAAE,oBAAoB;CACrC,CAAC,CAAC;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,0CAA0C,GAAG,MAAM,CAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,oBAAoB,CAAC;IACnC;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE;CACrB,CAAC,CAAC;AAYH;;GAEG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,MAAM,CAAC;IAC5D;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAC/B;;OAEG;IACH,aAAa,EAAE,MAAM,EAAE;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE;CACrB,CAAC,CAAC","sourcesContent":["import {\n literal,\n number,\n object,\n string,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { DerivationPathStruct } from '../../derivation';\n\n/**\n * Struct for {@link CreateAccountBip44DerivePathOptions}.\n */\nexport const CreateAccountBip44DerivePathOptionsStruct = object({\n /**\n * Type of the options.\n */\n type: literal('bip44:derive-path'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * BIP-44 derivation path to be used to derive the account.\n */\n derivationPath: DerivationPathStruct,\n});\n\n/**\n * Options for creating an account using the given BIP-44 derivation path.\n */\nexport type CreateAccountBip44DerivePathOptions = Infer<\n typeof CreateAccountBip44DerivePathOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DeriveIndexOptions}.\n */\nexport const CreateAccountBip44DeriveIndexOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:derive-index'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating an account using the given BIP-44 account group index.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DeriveIndexOptions = Infer<\n typeof CreateAccountBip44DeriveIndexOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DiscoverOptions}.\n */\nexport const CreateAccountBip44DiscoverOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:discover'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating accounts by performing a BIP-44 account discovery.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DiscoverOptions = Infer<\n typeof CreateAccountBip44DiscoverOptionsStruct\n>;\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateAccountCustomOptionsStruct = void 0;
|
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
+
/**
|
|
6
|
+
* Struct for {@link CreateAccountCustomOptions}.
|
|
7
|
+
*/
|
|
8
|
+
exports.CreateAccountCustomOptionsStruct = (0, superstruct_1.type)({
|
|
9
|
+
/**
|
|
10
|
+
* The type of the options.
|
|
11
|
+
*/
|
|
12
|
+
type: (0, superstruct_1.literal)('custom'),
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=custom.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.cjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/custom.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAElE;;GAEG;AACU,QAAA,gCAAgC,GAAG,IAAA,kBAAI,EAAC;IACnD;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;CACxB,CAAC,CAAC","sourcesContent":["import { literal, type, type Infer } from '@metamask/superstruct';\n\n/**\n * Struct for {@link CreateAccountCustomOptions}.\n */\nexport const CreateAccountCustomOptionsStruct = type({\n /**\n * The type of the options.\n */\n type: literal('custom'),\n});\n\n/**\n * Options for creating an account using a custom, keyring-specific method.\n *\n * This is an opaque type that allows keyrings with non-standard account\n * creation flows to define their own options. Keyrings using this type\n * should declare `custom.createAccounts: true` in their capabilities.\n *\n * The actual options accepted by the keyring are implementation-specific\n * and not validated by this struct beyond the `type` field. Adaptors should\n * handle any additional options as needed and add type intersections as necessary.\n */\nexport type CreateAccountCustomOptions = Infer<\n typeof CreateAccountCustomOptionsStruct\n>;\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Struct for {@link CreateAccountCustomOptions}.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CreateAccountCustomOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
6
|
+
type: "custom";
|
|
7
|
+
}, {
|
|
8
|
+
/**
|
|
9
|
+
* The type of the options.
|
|
10
|
+
*/
|
|
11
|
+
type: import("@metamask/superstruct").Struct<"custom", "custom">;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Options for creating an account using a custom, keyring-specific method.
|
|
15
|
+
*
|
|
16
|
+
* This is an opaque type that allows keyrings with non-standard account
|
|
17
|
+
* creation flows to define their own options. Keyrings using this type
|
|
18
|
+
* should declare `custom.createAccounts: true` in their capabilities.
|
|
19
|
+
*
|
|
20
|
+
* The actual options accepted by the keyring are implementation-specific
|
|
21
|
+
* and not validated by this struct beyond the `type` field. Adaptors should
|
|
22
|
+
* handle any additional options as needed and add type intersections as necessary.
|
|
23
|
+
*/
|
|
24
|
+
export type CreateAccountCustomOptions = Infer<typeof CreateAccountCustomOptionsStruct>;
|
|
25
|
+
//# sourceMappingURL=custom.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.d.cts","sourceRoot":"","sources":["../../../../src/api/v2/create-account/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,KAAK,EAAE,8BAA8B;AAElE;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;IAC3C;;OAEG;;EAEH,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAC5C,OAAO,gCAAgC,CACxC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Struct for {@link CreateAccountCustomOptions}.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CreateAccountCustomOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
6
|
+
type: "custom";
|
|
7
|
+
}, {
|
|
8
|
+
/**
|
|
9
|
+
* The type of the options.
|
|
10
|
+
*/
|
|
11
|
+
type: import("@metamask/superstruct").Struct<"custom", "custom">;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Options for creating an account using a custom, keyring-specific method.
|
|
15
|
+
*
|
|
16
|
+
* This is an opaque type that allows keyrings with non-standard account
|
|
17
|
+
* creation flows to define their own options. Keyrings using this type
|
|
18
|
+
* should declare `custom.createAccounts: true` in their capabilities.
|
|
19
|
+
*
|
|
20
|
+
* The actual options accepted by the keyring are implementation-specific
|
|
21
|
+
* and not validated by this struct beyond the `type` field. Adaptors should
|
|
22
|
+
* handle any additional options as needed and add type intersections as necessary.
|
|
23
|
+
*/
|
|
24
|
+
export type CreateAccountCustomOptions = Infer<typeof CreateAccountCustomOptionsStruct>;
|
|
25
|
+
//# sourceMappingURL=custom.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.d.mts","sourceRoot":"","sources":["../../../../src/api/v2/create-account/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,KAAK,EAAE,8BAA8B;AAElE;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;IAC3C;;OAEG;;EAEH,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAC5C,OAAO,gCAAgC,CACxC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { literal, type } from "@metamask/superstruct";
|
|
2
|
+
/**
|
|
3
|
+
* Struct for {@link CreateAccountCustomOptions}.
|
|
4
|
+
*/
|
|
5
|
+
export const CreateAccountCustomOptionsStruct = type({
|
|
6
|
+
/**
|
|
7
|
+
* The type of the options.
|
|
8
|
+
*/
|
|
9
|
+
type: literal('custom'),
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=custom.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.mjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAc,8BAA8B;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,CAAC;IACnD;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC;CACxB,CAAC,CAAC","sourcesContent":["import { literal, type, type Infer } from '@metamask/superstruct';\n\n/**\n * Struct for {@link CreateAccountCustomOptions}.\n */\nexport const CreateAccountCustomOptionsStruct = type({\n /**\n * The type of the options.\n */\n type: literal('custom'),\n});\n\n/**\n * Options for creating an account using a custom, keyring-specific method.\n *\n * This is an opaque type that allows keyrings with non-standard account\n * creation flows to define their own options. Keyrings using this type\n * should declare `custom.createAccounts: true` in their capabilities.\n *\n * The actual options accepted by the keyring are implementation-specific\n * and not validated by this struct beyond the `type` field. Adaptors should\n * handle any additional options as needed and add type intersections as necessary.\n */\nexport type CreateAccountCustomOptions = Infer<\n typeof CreateAccountCustomOptionsStruct\n>;\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.CreateAccountOptionsStruct = exports.AccountCreationType = void 0;
|
|
18
|
+
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
19
|
+
const bip44_1 = require("./bip44.cjs");
|
|
20
|
+
const custom_1 = require("./custom.cjs");
|
|
21
|
+
const private_key_1 = require("./private-key.cjs");
|
|
22
|
+
__exportStar(require("./bip44.cjs"), exports);
|
|
23
|
+
__exportStar(require("./custom.cjs"), exports);
|
|
24
|
+
__exportStar(require("./private-key.cjs"), exports);
|
|
25
|
+
/**
|
|
26
|
+
* Enum representing the different ways an account can be created.
|
|
27
|
+
*/
|
|
28
|
+
var AccountCreationType;
|
|
29
|
+
(function (AccountCreationType) {
|
|
30
|
+
/**
|
|
31
|
+
* Represents an account created using a BIP-44 derivation path.
|
|
32
|
+
*/
|
|
33
|
+
AccountCreationType["Bip44DerivePath"] = "bip44:derive-path";
|
|
34
|
+
/**
|
|
35
|
+
* Represents accounts created using a BIP-44 account index.
|
|
36
|
+
*
|
|
37
|
+
* More than one account can be created, for example, the keyring can create
|
|
38
|
+
* multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account
|
|
39
|
+
* index.
|
|
40
|
+
*/
|
|
41
|
+
AccountCreationType["Bip44DeriveIndex"] = "bip44:derive-index";
|
|
42
|
+
/**
|
|
43
|
+
* Represents accounts created through BIP-44 account discovery.
|
|
44
|
+
*
|
|
45
|
+
* More than one account can be created, for example, the keyring can create
|
|
46
|
+
* multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account
|
|
47
|
+
* index.
|
|
48
|
+
*/
|
|
49
|
+
AccountCreationType["Bip44Discover"] = "bip44:discover";
|
|
50
|
+
/**
|
|
51
|
+
* Represents an account imported from a private key.
|
|
52
|
+
*/
|
|
53
|
+
AccountCreationType["PrivateKeyImport"] = "private-key:import";
|
|
54
|
+
/**
|
|
55
|
+
* Represents an account created using a custom, keyring-specific method.
|
|
56
|
+
*
|
|
57
|
+
* This is used by keyrings that have non-standard account creation flows
|
|
58
|
+
* and declare `custom.createAccounts: true` in their capabilities.
|
|
59
|
+
*/
|
|
60
|
+
AccountCreationType["Custom"] = "custom";
|
|
61
|
+
})(AccountCreationType || (exports.AccountCreationType = AccountCreationType = {}));
|
|
62
|
+
/**
|
|
63
|
+
* Struct for {@link CreateAccountOptions}.
|
|
64
|
+
*/
|
|
65
|
+
exports.CreateAccountOptionsStruct = (0, keyring_utils_1.selectiveUnion)((value) => {
|
|
66
|
+
const accountCreationType = value?.type;
|
|
67
|
+
switch (accountCreationType) {
|
|
68
|
+
case AccountCreationType.Bip44DerivePath:
|
|
69
|
+
return bip44_1.CreateAccountBip44DerivePathOptionsStruct;
|
|
70
|
+
case AccountCreationType.Bip44DeriveIndex:
|
|
71
|
+
return bip44_1.CreateAccountBip44DeriveIndexOptionsStruct;
|
|
72
|
+
case AccountCreationType.Bip44Discover:
|
|
73
|
+
return bip44_1.CreateAccountBip44DiscoverOptionsStruct;
|
|
74
|
+
case AccountCreationType.PrivateKeyImport:
|
|
75
|
+
return private_key_1.CreateAccountPrivateKeyOptionsStruct;
|
|
76
|
+
case AccountCreationType.Custom:
|
|
77
|
+
return custom_1.CreateAccountCustomOptionsStruct;
|
|
78
|
+
default:
|
|
79
|
+
// Return first struct as fallback - validation will fail with proper error indicating the type mismatch
|
|
80
|
+
return bip44_1.CreateAccountBip44DerivePathOptionsStruct;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2DAAyD;AAGzD,uCAIiB;AACjB,yCAA4D;AAC5D,mDAAqE;AAErE,8CAAwB;AACxB,+CAAyB;AACzB,oDAA8B;AAE9B;;GAEG;AACH,IAAY,mBAoCX;AApCD,WAAY,mBAAmB;IAC7B;;OAEG;IACH,4DAAqC,CAAA;IAErC;;;;;;OAMG;IACH,8DAAuC,CAAA;IAEvC;;;;;;OAMG;IACH,uDAAgC,CAAA;IAEhC;;OAEG;IACH,8DAAuC,CAAA;IAEvC;;;;;OAKG;IACH,wCAAiB,CAAA;AACnB,CAAC,EApCW,mBAAmB,mCAAnB,mBAAmB,QAoC9B;AAED;;GAEG;AACU,QAAA,0BAA0B,GAAG,IAAA,8BAAc,EAAC,CAAC,KAAU,EAAE,EAAE;IACtE,MAAM,mBAAmB,GAAG,KAAK,EAAE,IAA2B,CAAC;IAC/D,QAAQ,mBAAmB,EAAE,CAAC;QAC5B,KAAK,mBAAmB,CAAC,eAAe;YACtC,OAAO,iDAAyC,CAAC;QACnD,KAAK,mBAAmB,CAAC,gBAAgB;YACvC,OAAO,kDAA0C,CAAC;QACpD,KAAK,mBAAmB,CAAC,aAAa;YACpC,OAAO,+CAAuC,CAAC;QACjD,KAAK,mBAAmB,CAAC,gBAAgB;YACvC,OAAO,kDAAoC,CAAC;QAC9C,KAAK,mBAAmB,CAAC,MAAM;YAC7B,OAAO,yCAAgC,CAAC;QAC1C;YACE,wGAAwG;YACxG,OAAO,iDAAyC,CAAC;IACrD,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { selectiveUnion } from '@metamask/keyring-utils';\nimport { type Infer } from '@metamask/superstruct';\n\nimport {\n CreateAccountBip44DiscoverOptionsStruct,\n CreateAccountBip44DeriveIndexOptionsStruct,\n CreateAccountBip44DerivePathOptionsStruct,\n} from './bip44';\nimport { CreateAccountCustomOptionsStruct } from './custom';\nimport { CreateAccountPrivateKeyOptionsStruct } from './private-key';\n\nexport * from './bip44';\nexport * from './custom';\nexport * from './private-key';\n\n/**\n * Enum representing the different ways an account can be created.\n */\nexport enum AccountCreationType {\n /**\n * Represents an account created using a BIP-44 derivation path.\n */\n Bip44DerivePath = 'bip44:derive-path',\n\n /**\n * Represents accounts created using a BIP-44 account index.\n *\n * More than one account can be created, for example, the keyring can create\n * multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account\n * index.\n */\n Bip44DeriveIndex = 'bip44:derive-index',\n\n /**\n * Represents accounts created through BIP-44 account discovery.\n *\n * More than one account can be created, for example, the keyring can create\n * multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account\n * index.\n */\n Bip44Discover = 'bip44:discover',\n\n /**\n * Represents an account imported from a private key.\n */\n PrivateKeyImport = 'private-key:import',\n\n /**\n * Represents an account created using a custom, keyring-specific method.\n *\n * This is used by keyrings that have non-standard account creation flows\n * and declare `custom.createAccounts: true` in their capabilities.\n */\n Custom = 'custom',\n}\n\n/**\n * Struct for {@link CreateAccountOptions}.\n */\nexport const CreateAccountOptionsStruct = selectiveUnion((value: any) => {\n const accountCreationType = value?.type as AccountCreationType;\n switch (accountCreationType) {\n case AccountCreationType.Bip44DerivePath:\n return CreateAccountBip44DerivePathOptionsStruct;\n case AccountCreationType.Bip44DeriveIndex:\n return CreateAccountBip44DeriveIndexOptionsStruct;\n case AccountCreationType.Bip44Discover:\n return CreateAccountBip44DiscoverOptionsStruct;\n case AccountCreationType.PrivateKeyImport:\n return CreateAccountPrivateKeyOptionsStruct;\n case AccountCreationType.Custom:\n return CreateAccountCustomOptionsStruct;\n default:\n // Return first struct as fallback - validation will fail with proper error indicating the type mismatch\n return CreateAccountBip44DerivePathOptionsStruct;\n }\n});\n\n/**\n * Represents the available options for creating a new account.\n */\nexport type CreateAccountOptions = Infer<typeof CreateAccountOptionsStruct>;\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type Infer } from "@metamask/superstruct";
|
|
2
|
+
export * from "./bip44.cjs";
|
|
3
|
+
export * from "./custom.cjs";
|
|
4
|
+
export * from "./private-key.cjs";
|
|
5
|
+
/**
|
|
6
|
+
* Enum representing the different ways an account can be created.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum AccountCreationType {
|
|
9
|
+
/**
|
|
10
|
+
* Represents an account created using a BIP-44 derivation path.
|
|
11
|
+
*/
|
|
12
|
+
Bip44DerivePath = "bip44:derive-path",
|
|
13
|
+
/**
|
|
14
|
+
* Represents accounts created using a BIP-44 account index.
|
|
15
|
+
*
|
|
16
|
+
* More than one account can be created, for example, the keyring can create
|
|
17
|
+
* multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account
|
|
18
|
+
* index.
|
|
19
|
+
*/
|
|
20
|
+
Bip44DeriveIndex = "bip44:derive-index",
|
|
21
|
+
/**
|
|
22
|
+
* Represents accounts created through BIP-44 account discovery.
|
|
23
|
+
*
|
|
24
|
+
* More than one account can be created, for example, the keyring can create
|
|
25
|
+
* multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account
|
|
26
|
+
* index.
|
|
27
|
+
*/
|
|
28
|
+
Bip44Discover = "bip44:discover",
|
|
29
|
+
/**
|
|
30
|
+
* Represents an account imported from a private key.
|
|
31
|
+
*/
|
|
32
|
+
PrivateKeyImport = "private-key:import",
|
|
33
|
+
/**
|
|
34
|
+
* Represents an account created using a custom, keyring-specific method.
|
|
35
|
+
*
|
|
36
|
+
* This is used by keyrings that have non-standard account creation flows
|
|
37
|
+
* and declare `custom.createAccounts: true` in their capabilities.
|
|
38
|
+
*/
|
|
39
|
+
Custom = "custom"
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Struct for {@link CreateAccountOptions}.
|
|
43
|
+
*/
|
|
44
|
+
export declare const CreateAccountOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
45
|
+
type: "bip44:derive-path";
|
|
46
|
+
derivationPath: `m/${string}`;
|
|
47
|
+
entropySource: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: "bip44:derive-index";
|
|
50
|
+
groupIndex: number;
|
|
51
|
+
entropySource: string;
|
|
52
|
+
} | {
|
|
53
|
+
type: "bip44:discover";
|
|
54
|
+
groupIndex: number;
|
|
55
|
+
entropySource: string;
|
|
56
|
+
} | {
|
|
57
|
+
type: "custom";
|
|
58
|
+
} | {
|
|
59
|
+
type: "private-key:import";
|
|
60
|
+
encoding: "hexadecimal" | "base58";
|
|
61
|
+
privateKey: string;
|
|
62
|
+
accountType?: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
|
|
63
|
+
}, null>;
|
|
64
|
+
/**
|
|
65
|
+
* Represents the available options for creating a new account.
|
|
66
|
+
*/
|
|
67
|
+
export type CreateAccountOptions = Infer<typeof CreateAccountOptionsStruct>;
|
|
68
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/api/v2/create-account/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAE,8BAA8B;AAUnD,4BAAwB;AACxB,6BAAyB;AACzB,kCAA8B;AAE9B;;GAEG;AACH,oBAAY,mBAAmB;IAC7B;;OAEG;IACH,eAAe,sBAAsB;IAErC;;;;;;OAMG;IACH,gBAAgB,uBAAuB;IAEvC;;;;;;OAMG;IACH,aAAa,mBAAmB;IAEhC;;OAEG;IACH,gBAAgB,uBAAuB;IAEvC;;;;;OAKG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;QAiBrC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|