@metamask/keyring-api 14.0.0 → 16.0.0

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.
Files changed (114) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/dist/api/account.cjs +2 -2
  3. package/dist/api/account.cjs.map +1 -1
  4. package/dist/api/account.d.cts +2 -2
  5. package/dist/api/account.d.cts.map +1 -1
  6. package/dist/api/account.d.mts +2 -2
  7. package/dist/api/account.d.mts.map +1 -1
  8. package/dist/api/account.mjs +5 -5
  9. package/dist/api/account.mjs.map +1 -1
  10. package/dist/api/address.cjs +14 -0
  11. package/dist/api/address.cjs.map +1 -0
  12. package/dist/api/address.d.cts +19 -0
  13. package/dist/api/address.d.cts.map +1 -0
  14. package/dist/api/address.d.mts +19 -0
  15. package/dist/api/address.d.mts.map +1 -0
  16. package/dist/api/address.mjs +11 -0
  17. package/dist/api/address.mjs.map +1 -0
  18. package/dist/api/asset.cjs +15 -9
  19. package/dist/api/asset.cjs.map +1 -1
  20. package/dist/api/asset.d.cts +25 -9
  21. package/dist/api/asset.d.cts.map +1 -1
  22. package/dist/api/asset.d.mts +25 -9
  23. package/dist/api/asset.d.mts.map +1 -1
  24. package/dist/api/asset.mjs +14 -8
  25. package/dist/api/asset.mjs.map +1 -1
  26. package/dist/api/index.cjs +1 -1
  27. package/dist/api/index.cjs.map +1 -1
  28. package/dist/api/index.d.cts +1 -1
  29. package/dist/api/index.d.cts.map +1 -1
  30. package/dist/api/index.d.mts +1 -1
  31. package/dist/api/index.d.mts.map +1 -1
  32. package/dist/api/index.mjs +1 -1
  33. package/dist/api/index.mjs.map +1 -1
  34. package/dist/api/keyring.cjs.map +1 -1
  35. package/dist/api/keyring.d.cts +16 -2
  36. package/dist/api/keyring.d.cts.map +1 -1
  37. package/dist/api/keyring.d.mts +16 -2
  38. package/dist/api/keyring.d.mts.map +1 -1
  39. package/dist/api/keyring.mjs.map +1 -1
  40. package/dist/api/transaction.d.cts +30 -30
  41. package/dist/api/transaction.d.mts +30 -30
  42. package/dist/btc/constants.cjs +9 -10
  43. package/dist/btc/constants.cjs.map +1 -1
  44. package/dist/btc/constants.d.cts +1 -2
  45. package/dist/btc/constants.d.cts.map +1 -1
  46. package/dist/btc/constants.d.mts +1 -2
  47. package/dist/btc/constants.d.mts.map +1 -1
  48. package/dist/btc/constants.mjs +8 -9
  49. package/dist/btc/constants.mjs.map +1 -1
  50. package/dist/btc/types.cjs +7 -0
  51. package/dist/btc/types.cjs.map +1 -1
  52. package/dist/btc/types.d.cts +7 -2
  53. package/dist/btc/types.d.cts.map +1 -1
  54. package/dist/btc/types.d.mts +7 -2
  55. package/dist/btc/types.d.mts.map +1 -1
  56. package/dist/btc/types.mjs +8 -1
  57. package/dist/btc/types.mjs.map +1 -1
  58. package/dist/eth/constants.cjs +7 -6
  59. package/dist/eth/constants.cjs.map +1 -1
  60. package/dist/eth/constants.d.cts +4 -3
  61. package/dist/eth/constants.d.cts.map +1 -1
  62. package/dist/eth/constants.d.mts +4 -3
  63. package/dist/eth/constants.d.mts.map +1 -1
  64. package/dist/eth/constants.mjs +6 -5
  65. package/dist/eth/constants.mjs.map +1 -1
  66. package/dist/eth/types.cjs +7 -2
  67. package/dist/eth/types.cjs.map +1 -1
  68. package/dist/eth/types.d.cts +9 -6
  69. package/dist/eth/types.d.cts.map +1 -1
  70. package/dist/eth/types.d.mts +9 -6
  71. package/dist/eth/types.d.mts.map +1 -1
  72. package/dist/eth/types.mjs +8 -3
  73. package/dist/eth/types.mjs.map +1 -1
  74. package/dist/events.cjs +75 -1
  75. package/dist/events.cjs.map +1 -1
  76. package/dist/events.d.cts +248 -9
  77. package/dist/events.d.cts.map +1 -1
  78. package/dist/events.d.mts +248 -9
  79. package/dist/events.d.mts.map +1 -1
  80. package/dist/events.mjs +78 -4
  81. package/dist/events.mjs.map +1 -1
  82. package/dist/rpc.cjs +18 -4
  83. package/dist/rpc.cjs.map +1 -1
  84. package/dist/rpc.d.cts +77 -29
  85. package/dist/rpc.d.cts.map +1 -1
  86. package/dist/rpc.d.mts +77 -29
  87. package/dist/rpc.d.mts.map +1 -1
  88. package/dist/rpc.mjs +18 -4
  89. package/dist/rpc.mjs.map +1 -1
  90. package/dist/sol/constants.cjs +7 -8
  91. package/dist/sol/constants.cjs.map +1 -1
  92. package/dist/sol/constants.d.cts +1 -2
  93. package/dist/sol/constants.d.cts.map +1 -1
  94. package/dist/sol/constants.d.mts +1 -2
  95. package/dist/sol/constants.d.mts.map +1 -1
  96. package/dist/sol/constants.mjs +6 -7
  97. package/dist/sol/constants.mjs.map +1 -1
  98. package/dist/sol/types.cjs +5 -0
  99. package/dist/sol/types.cjs.map +1 -1
  100. package/dist/sol/types.d.cts +5 -2
  101. package/dist/sol/types.d.cts.map +1 -1
  102. package/dist/sol/types.d.mts +5 -2
  103. package/dist/sol/types.d.mts.map +1 -1
  104. package/dist/sol/types.mjs +6 -1
  105. package/dist/sol/types.mjs.map +1 -1
  106. package/package.json +4 -4
  107. package/dist/api/caip.cjs +0 -21
  108. package/dist/api/caip.cjs.map +0 -1
  109. package/dist/api/caip.d.cts +0 -21
  110. package/dist/api/caip.d.cts.map +0 -1
  111. package/dist/api/caip.d.mts +0 -21
  112. package/dist/api/caip.d.mts.map +0 -1
  113. package/dist/api/caip.mjs +0 -18
  114. package/dist/api/caip.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { Balance } from './balance';\nimport type { CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
1
+ {"version":3,"file":"keyring.cjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { JsonRpcRequest } from '@metamask/keyring-utils';\nimport type {\n Json,\n CaipChainId,\n CaipAssetType,\n CaipAssetTypeOrId,\n} from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { ResolvedAccountAddress } from './address';\nimport type { Balance } from './balance';\nimport type { KeyringAccountData } from './export';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Resolves the address of an account from a signing request.\n *\n * This is required by the routing system of MetaMask to dispatch\n * incoming non-EVM dapp signing requests.\n *\n * @param scope - Request's scope (CAIP-2).\n * @param request - Signing request object.\n * @returns A Promise that resolves to the account address that must\n * be used to process this signing request, or null if none candidates\n * could be found.\n */\n resolveAccountAddress?(\n scope: CaipChainId,\n request: JsonRpcRequest,\n ): Promise<ResolvedAccountAddress | null>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
@@ -1,7 +1,8 @@
1
- import type { Json } from "@metamask/utils";
1
+ import type { JsonRpcRequest } from "@metamask/keyring-utils";
2
+ import type { Json, CaipChainId, CaipAssetType, CaipAssetTypeOrId } from "@metamask/utils";
2
3
  import type { KeyringAccount } from "./account.cjs";
4
+ import type { ResolvedAccountAddress } from "./address.cjs";
3
5
  import type { Balance } from "./balance.cjs";
4
- import type { CaipAssetType, CaipAssetTypeOrId } from "./caip.cjs";
5
6
  import type { KeyringAccountData } from "./export.cjs";
6
7
  import type { Paginated, Pagination } from "./pagination.cjs";
7
8
  import type { KeyringRequest } from "./request.cjs";
@@ -93,6 +94,19 @@ export type Keyring = {
93
94
  * respective balances.
94
95
  */
95
96
  getAccountBalances?(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
97
+ /**
98
+ * Resolves the address of an account from a signing request.
99
+ *
100
+ * This is required by the routing system of MetaMask to dispatch
101
+ * incoming non-EVM dapp signing requests.
102
+ *
103
+ * @param scope - Request's scope (CAIP-2).
104
+ * @param request - Signing request object.
105
+ * @returns A Promise that resolves to the account address that must
106
+ * be used to process this signing request, or null if none candidates
107
+ * could be found.
108
+ */
109
+ resolveAccountAddress?(scope: CaipChainId, request: JsonRpcRequest): Promise<ResolvedAccountAddress | null>;
96
110
  /**
97
111
  * Filter supported chains for a given account.
98
112
  *
@@ -1 +1 @@
1
- {"version":3,"file":"keyring.d.cts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAe;AAC/D,OAA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AI,CAAC,CAAC;IAEtD;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAExD;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE3C;;;;;;;;OAQG;IACH,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjE;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C,CAAC"}
@@ -1,7 +1,8 @@
1
- import type { Json } from "@metamask/utils";
1
+ import type { JsonRpcRequest } from "@metamask/keyring-utils";
2
+ import type { Json, CaipChainId, CaipAssetType, CaipAssetTypeOrId } from "@metamask/utils";
2
3
  import type { KeyringAccount } from "./account.mjs";
4
+ import type { ResolvedAccountAddress } from "./address.mjs";
3
5
  import type { Balance } from "./balance.mjs";
4
- import type { CaipAssetType, CaipAssetTypeOrId } from "./caip.mjs";
5
6
  import type { KeyringAccountData } from "./export.mjs";
6
7
  import type { Paginated, Pagination } from "./pagination.mjs";
7
8
  import type { KeyringRequest } from "./request.mjs";
@@ -93,6 +94,19 @@ export type Keyring = {
93
94
  * respective balances.
94
95
  */
95
96
  getAccountBalances?(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
97
+ /**
98
+ * Resolves the address of an account from a signing request.
99
+ *
100
+ * This is required by the routing system of MetaMask to dispatch
101
+ * incoming non-EVM dapp signing requests.
102
+ *
103
+ * @param scope - Request's scope (CAIP-2).
104
+ * @param request - Signing request object.
105
+ * @returns A Promise that resolves to the account address that must
106
+ * be used to process this signing request, or null if none candidates
107
+ * could be found.
108
+ */
109
+ resolveAccountAddress?(scope: CaipChainId, request: JsonRpcRequest): Promise<ResolvedAccountAddress | null>;
96
110
  /**
97
111
  * Filter supported chains for a given account.
98
112
  *
@@ -1 +1 @@
1
- {"version":3,"file":"keyring.d.mts","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAe;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAiB;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,yBAAqB;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAkB;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAmB;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,0BAAsB;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE1C;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAE5D;;;;;;;;OAQG;IACH,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;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CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { Json } from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { Balance } from './balance';\nimport type { CaipAssetType, CaipAssetTypeOrId } from './caip';\nimport type { KeyringAccountData } from './export';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
1
+ {"version":3,"file":"keyring.mjs","sourceRoot":"","sources":["../../src/api/keyring.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// This rule seems to be triggering a false positive on the `KeyringAccount`.\n\nimport type { JsonRpcRequest } from '@metamask/keyring-utils';\nimport type {\n Json,\n CaipChainId,\n CaipAssetType,\n CaipAssetTypeOrId,\n} from '@metamask/utils';\n\nimport type { KeyringAccount } from './account';\nimport type { ResolvedAccountAddress } from './address';\nimport type { Balance } from './balance';\nimport type { KeyringAccountData } from './export';\nimport type { Paginated, Pagination } from './pagination';\nimport type { KeyringRequest } from './request';\nimport type { KeyringResponse } from './response';\nimport type { Transaction } from './transaction';\n\n/**\n * Keyring interface.\n *\n * Represents the functionality and operations related to managing accounts and\n * handling requests.\n */\nexport type Keyring = {\n /**\n * List accounts.\n *\n * Retrieves an array of KeyringAccount objects representing the available\n * accounts.\n *\n * @returns A promise that resolves to an array of KeyringAccount objects.\n */\n listAccounts(): Promise<KeyringAccount[]>;\n\n /**\n * Get an account.\n *\n * Retrieves the KeyringAccount object for the given account ID.\n *\n * @param id - The ID of the account to retrieve.\n * @returns A promise that resolves to the KeyringAccount object if found, or\n * undefined otherwise.\n */\n getAccount(id: string): Promise<KeyringAccount | undefined>;\n\n /**\n * Create an account.\n *\n * Creates a new account with optional, keyring-defined, account options.\n *\n * @param options - Keyring-defined options for the account (optional).\n * @returns A promise that resolves to the newly created KeyringAccount\n * object without any private information.\n */\n createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;\n\n /**\n * Lists the assets of an account (fungibles and non-fungibles) represented\n * by their respective CAIP-19:\n * - Asset types for fungibles assets.\n * - Asset IDs for non-fungible ones.\n *\n * @param id - The ID of the account to list the assets for.\n * @returns A promise that resolves to list of assets for that account.\n */\n listAccountAssets?(id: string): Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Lists the transactions of an account, paginated and ordered by the most\n * recent first.\n *\n * The pagination options are used to limit the number of transactions in the\n * response and to iterate over the results.\n *\n * @param id - The ID of the account to list the transactions for.\n * @param pagination - The pagination options.\n * @returns A promise that resolves to the next page of transactions.\n */\n listAccountTransactions?(\n id: string,\n pagination: Pagination,\n ): Promise<Paginated<Transaction>>;\n\n /**\n * Retrieve the balances of a given account.\n *\n * This method fetches the balances of specified assets for a given account\n * ID. It returns a promise that resolves to an object where the keys are\n * asset types and the values are balance objects containing the amount and\n * unit.\n *\n * @example\n * ```ts\n * await keyring.getAccountBalances(\n * '43550276-c7d6-4fac-87c7-00390ad0ce90',\n * ['bip122:000000000019d6689c085ae165831e93/slip44:0']\n * );\n * // Returns something similar to:\n * // {\n * // 'bip122:000000000019d6689c085ae165831e93/slip44:0': {\n * // amount: '0.0001',\n * // unit: 'BTC',\n * // }\n * // }\n * ```\n * @param id - ID of the account to retrieve the balances for.\n * @param assets - Array of asset types (CAIP-19) to retrieve balances for.\n * @returns A promise that resolves to an object mapping asset types to their\n * respective balances.\n */\n getAccountBalances?(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Resolves the address of an account from a signing request.\n *\n * This is required by the routing system of MetaMask to dispatch\n * incoming non-EVM dapp signing requests.\n *\n * @param scope - Request's scope (CAIP-2).\n * @param request - Signing request object.\n * @returns A Promise that resolves to the account address that must\n * be used to process this signing request, or null if none candidates\n * could be found.\n */\n resolveAccountAddress?(\n scope: CaipChainId,\n request: JsonRpcRequest,\n ): Promise<ResolvedAccountAddress | null>;\n\n /**\n * Filter supported chains for a given account.\n *\n * @param id - ID of the account to be checked.\n * @param chains - List of chains (CAIP-2) to be checked.\n * @returns A Promise that resolves to a filtered list of CAIP-2 IDs\n * representing the supported chains.\n */\n filterAccountChains(id: string, chains: string[]): Promise<string[]>;\n\n /**\n * Update an account.\n *\n * Updates the account with the given account object. Does nothing if the\n * account does not exist.\n *\n * @param account - The updated account object.\n * @returns A promise that resolves when the account is successfully updated.\n */\n updateAccount(account: KeyringAccount): Promise<void>;\n\n /**\n * Delete an account from the keyring.\n *\n * Deletes the account with the given ID from the keyring.\n *\n * @param id - The ID of the account to delete.\n * @returns A promise that resolves when the account is successfully deleted.\n */\n deleteAccount(id: string): Promise<void>;\n\n /**\n * Exports an account's private key.\n *\n * If the keyring cannot export a private key, this function should throw an\n * error.\n *\n * @param id - The ID of the account to export.\n * @returns A promise that resolves to the exported account.\n */\n exportAccount?(id: string): Promise<KeyringAccountData>;\n\n /**\n * List all submitted requests.\n *\n * Retrieves an array of KeyringRequest objects representing the submitted\n * requests.\n *\n * @returns A promise that resolves to an array of KeyringRequest objects.\n */\n listRequests?(): Promise<KeyringRequest[]>;\n\n /**\n * Get a request.\n *\n * Retrieves the KeyringRequest object for the given request ID.\n *\n * @param id - The ID of the request to retrieve.\n * @returns A promise that resolves to the KeyringRequest object if found, or\n * undefined otherwise.\n */\n getRequest?(id: string): Promise<KeyringRequest | undefined>;\n\n /**\n * Submit a request.\n *\n * Submits the given KeyringRequest object.\n *\n * @param request - The KeyringRequest object to submit.\n * @returns A promise that resolves to the request response.\n */\n submitRequest(request: KeyringRequest): Promise<KeyringResponse>;\n\n /**\n * Approve a request.\n *\n * Approves the request with the given ID and sets the response if provided.\n *\n * @param id - The ID of the request to approve.\n * @param data - The response to the request (optional).\n * @returns A promise that resolves when the request is successfully\n * approved.\n */\n approveRequest?(id: string, data?: Record<string, Json>): Promise<void>;\n\n /**\n * Reject a request.\n *\n * Rejects the request with the given ID.\n *\n * @param id - The ID of the request to reject.\n * @returns A promise that resolves when the request is successfully\n * rejected.\n */\n rejectRequest?(id: string): Promise<void>;\n};\n"]}
@@ -146,8 +146,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
146
146
  asset: {
147
147
  unit: string;
148
148
  type: `${string}:${string}/${string}:${string}`;
149
- fungible: true;
150
149
  amount: string;
150
+ fungible: true;
151
151
  } | {
152
152
  id: `${string}:${string}/${string}:${string}/${string}`;
153
153
  fungible: false;
@@ -166,8 +166,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
166
166
  asset: {
167
167
  unit: string;
168
168
  type: `${string}:${string}/${string}:${string}`;
169
- fungible: true;
170
169
  amount: string;
170
+ fungible: true;
171
171
  } | {
172
172
  id: `${string}:${string}/${string}:${string}/${string}`;
173
173
  fungible: false;
@@ -178,8 +178,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
178
178
  asset: {
179
179
  unit: string;
180
180
  type: `${string}:${string}/${string}:${string}`;
181
- fungible: true;
182
181
  amount: string;
182
+ fungible: true;
183
183
  } | {
184
184
  id: `${string}:${string}/${string}:${string}/${string}`;
185
185
  fungible: false;
@@ -229,8 +229,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
229
229
  asset: {
230
230
  unit: string;
231
231
  type: `${string}:${string}/${string}:${string}`;
232
- fungible: true;
233
232
  amount: string;
233
+ fungible: true;
234
234
  } | {
235
235
  id: `${string}:${string}/${string}:${string}/${string}`;
236
236
  fungible: false;
@@ -240,8 +240,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
240
240
  asset: {
241
241
  unit: string;
242
242
  type: `${string}:${string}/${string}:${string}`;
243
- fungible: true;
244
243
  amount: string;
244
+ fungible: true;
245
245
  } | {
246
246
  id: `${string}:${string}/${string}:${string}/${string}`;
247
247
  fungible: false;
@@ -257,8 +257,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
257
257
  asset: import("@metamask/superstruct").Struct<{
258
258
  unit: string;
259
259
  type: `${string}:${string}/${string}:${string}`;
260
- fungible: true;
261
260
  amount: string;
261
+ fungible: true;
262
262
  } | {
263
263
  id: `${string}:${string}/${string}:${string}/${string}`;
264
264
  fungible: false;
@@ -272,8 +272,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
272
272
  asset: {
273
273
  unit: string;
274
274
  type: `${string}:${string}/${string}:${string}`;
275
- fungible: true;
276
275
  amount: string;
276
+ fungible: true;
277
277
  } | {
278
278
  id: `${string}:${string}/${string}:${string}/${string}`;
279
279
  fungible: false;
@@ -283,8 +283,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
283
283
  asset: {
284
284
  unit: string;
285
285
  type: `${string}:${string}/${string}:${string}`;
286
- fungible: true;
287
286
  amount: string;
287
+ fungible: true;
288
288
  } | {
289
289
  id: `${string}:${string}/${string}:${string}/${string}`;
290
290
  fungible: false;
@@ -300,8 +300,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
300
300
  asset: import("@metamask/superstruct").Struct<{
301
301
  unit: string;
302
302
  type: `${string}:${string}/${string}:${string}`;
303
- fungible: true;
304
303
  amount: string;
304
+ fungible: true;
305
305
  } | {
306
306
  id: `${string}:${string}/${string}:${string}/${string}`;
307
307
  fungible: false;
@@ -315,8 +315,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
315
315
  asset: {
316
316
  unit: string;
317
317
  type: `${string}:${string}/${string}:${string}`;
318
- fungible: true;
319
318
  amount: string;
319
+ fungible: true;
320
320
  } | {
321
321
  id: `${string}:${string}/${string}:${string}/${string}`;
322
322
  fungible: false;
@@ -326,8 +326,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
326
326
  asset: {
327
327
  unit: string;
328
328
  type: `${string}:${string}/${string}:${string}`;
329
- fungible: true;
330
329
  amount: string;
330
+ fungible: true;
331
331
  } | {
332
332
  id: `${string}:${string}/${string}:${string}/${string}`;
333
333
  fungible: false;
@@ -346,8 +346,8 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
346
346
  asset: import("@metamask/superstruct").Struct<{
347
347
  unit: string;
348
348
  type: `${string}:${string}/${string}:${string}`;
349
- fungible: true;
350
349
  amount: string;
350
+ fungible: true;
351
351
  } | {
352
352
  id: `${string}:${string}/${string}:${string}/${string}`;
353
353
  fungible: false;
@@ -423,8 +423,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
423
423
  asset: {
424
424
  unit: string;
425
425
  type: `${string}:${string}/${string}:${string}`;
426
- fungible: true;
427
426
  amount: string;
427
+ fungible: true;
428
428
  } | {
429
429
  id: `${string}:${string}/${string}:${string}/${string}`;
430
430
  fungible: false;
@@ -443,8 +443,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
443
443
  asset: {
444
444
  unit: string;
445
445
  type: `${string}:${string}/${string}:${string}`;
446
- fungible: true;
447
446
  amount: string;
447
+ fungible: true;
448
448
  } | {
449
449
  id: `${string}:${string}/${string}:${string}/${string}`;
450
450
  fungible: false;
@@ -455,8 +455,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
455
455
  asset: {
456
456
  unit: string;
457
457
  type: `${string}:${string}/${string}:${string}`;
458
- fungible: true;
459
458
  amount: string;
459
+ fungible: true;
460
460
  } | {
461
461
  id: `${string}:${string}/${string}:${string}/${string}`;
462
462
  fungible: false;
@@ -476,8 +476,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
476
476
  asset: {
477
477
  unit: string;
478
478
  type: `${string}:${string}/${string}:${string}`;
479
- fungible: true;
480
479
  amount: string;
480
+ fungible: true;
481
481
  } | {
482
482
  id: `${string}:${string}/${string}:${string}/${string}`;
483
483
  fungible: false;
@@ -496,8 +496,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
496
496
  asset: {
497
497
  unit: string;
498
498
  type: `${string}:${string}/${string}:${string}`;
499
- fungible: true;
500
499
  amount: string;
500
+ fungible: true;
501
501
  } | {
502
502
  id: `${string}:${string}/${string}:${string}/${string}`;
503
503
  fungible: false;
@@ -508,8 +508,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
508
508
  asset: {
509
509
  unit: string;
510
510
  type: `${string}:${string}/${string}:${string}`;
511
- fungible: true;
512
511
  amount: string;
512
+ fungible: true;
513
513
  } | {
514
514
  id: `${string}:${string}/${string}:${string}/${string}`;
515
515
  fungible: false;
@@ -523,8 +523,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
523
523
  asset: {
524
524
  unit: string;
525
525
  type: `${string}:${string}/${string}:${string}`;
526
- fungible: true;
527
526
  amount: string;
527
+ fungible: true;
528
528
  } | {
529
529
  id: `${string}:${string}/${string}:${string}/${string}`;
530
530
  fungible: false;
@@ -543,8 +543,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
543
543
  asset: {
544
544
  unit: string;
545
545
  type: `${string}:${string}/${string}:${string}`;
546
- fungible: true;
547
546
  amount: string;
547
+ fungible: true;
548
548
  } | {
549
549
  id: `${string}:${string}/${string}:${string}/${string}`;
550
550
  fungible: false;
@@ -555,8 +555,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
555
555
  asset: {
556
556
  unit: string;
557
557
  type: `${string}:${string}/${string}:${string}`;
558
- fungible: true;
559
558
  amount: string;
559
+ fungible: true;
560
560
  } | {
561
561
  id: `${string}:${string}/${string}:${string}/${string}`;
562
562
  fungible: false;
@@ -606,8 +606,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
606
606
  asset: {
607
607
  unit: string;
608
608
  type: `${string}:${string}/${string}:${string}`;
609
- fungible: true;
610
609
  amount: string;
610
+ fungible: true;
611
611
  } | {
612
612
  id: `${string}:${string}/${string}:${string}/${string}`;
613
613
  fungible: false;
@@ -617,8 +617,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
617
617
  asset: {
618
618
  unit: string;
619
619
  type: `${string}:${string}/${string}:${string}`;
620
- fungible: true;
621
620
  amount: string;
621
+ fungible: true;
622
622
  } | {
623
623
  id: `${string}:${string}/${string}:${string}/${string}`;
624
624
  fungible: false;
@@ -634,8 +634,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
634
634
  asset: import("@metamask/superstruct").Struct<{
635
635
  unit: string;
636
636
  type: `${string}:${string}/${string}:${string}`;
637
- fungible: true;
638
637
  amount: string;
638
+ fungible: true;
639
639
  } | {
640
640
  id: `${string}:${string}/${string}:${string}/${string}`;
641
641
  fungible: false;
@@ -649,8 +649,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
649
649
  asset: {
650
650
  unit: string;
651
651
  type: `${string}:${string}/${string}:${string}`;
652
- fungible: true;
653
652
  amount: string;
653
+ fungible: true;
654
654
  } | {
655
655
  id: `${string}:${string}/${string}:${string}/${string}`;
656
656
  fungible: false;
@@ -660,8 +660,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
660
660
  asset: {
661
661
  unit: string;
662
662
  type: `${string}:${string}/${string}:${string}`;
663
- fungible: true;
664
663
  amount: string;
664
+ fungible: true;
665
665
  } | {
666
666
  id: `${string}:${string}/${string}:${string}/${string}`;
667
667
  fungible: false;
@@ -677,8 +677,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
677
677
  asset: import("@metamask/superstruct").Struct<{
678
678
  unit: string;
679
679
  type: `${string}:${string}/${string}:${string}`;
680
- fungible: true;
681
680
  amount: string;
681
+ fungible: true;
682
682
  } | {
683
683
  id: `${string}:${string}/${string}:${string}/${string}`;
684
684
  fungible: false;
@@ -692,8 +692,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
692
692
  asset: {
693
693
  unit: string;
694
694
  type: `${string}:${string}/${string}:${string}`;
695
- fungible: true;
696
695
  amount: string;
696
+ fungible: true;
697
697
  } | {
698
698
  id: `${string}:${string}/${string}:${string}/${string}`;
699
699
  fungible: false;
@@ -703,8 +703,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
703
703
  asset: {
704
704
  unit: string;
705
705
  type: `${string}:${string}/${string}:${string}`;
706
- fungible: true;
707
706
  amount: string;
707
+ fungible: true;
708
708
  } | {
709
709
  id: `${string}:${string}/${string}:${string}/${string}`;
710
710
  fungible: false;
@@ -723,8 +723,8 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
723
723
  asset: import("@metamask/superstruct").Struct<{
724
724
  unit: string;
725
725
  type: `${string}:${string}/${string}:${string}`;
726
- fungible: true;
727
726
  amount: string;
727
+ fungible: true;
728
728
  } | {
729
729
  id: `${string}:${string}/${string}:${string}/${string}`;
730
730
  fungible: false;