@metamask/keyring-api 23.4.0 → 23.5.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 (146) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/api/account-options.cjs +3 -3
  3. package/dist/api/account-options.cjs.map +1 -1
  4. package/dist/api/account-options.d.cts.map +1 -1
  5. package/dist/api/account-options.d.mts.map +1 -1
  6. package/dist/api/account-options.mjs +2 -2
  7. package/dist/api/account-options.mjs.map +1 -1
  8. package/dist/api/account.cjs +1 -1
  9. package/dist/api/account.cjs.map +1 -1
  10. package/dist/api/account.mjs +2 -2
  11. package/dist/api/account.mjs.map +1 -1
  12. package/dist/api/asset.cjs +3 -3
  13. package/dist/api/asset.cjs.map +1 -1
  14. package/dist/api/asset.d.cts.map +1 -1
  15. package/dist/api/asset.d.mts.map +1 -1
  16. package/dist/api/asset.mjs +2 -2
  17. package/dist/api/asset.mjs.map +1 -1
  18. package/dist/api/balance.cjs +1 -1
  19. package/dist/api/balance.cjs.map +1 -1
  20. package/dist/api/balance.mjs +2 -2
  21. package/dist/api/balance.mjs.map +1 -1
  22. package/dist/api/options.cjs +3 -2
  23. package/dist/api/options.cjs.map +1 -1
  24. package/dist/api/options.d.cts +1 -1
  25. package/dist/api/options.d.cts.map +1 -1
  26. package/dist/api/options.d.mts +1 -1
  27. package/dist/api/options.d.mts.map +1 -1
  28. package/dist/api/options.mjs +2 -1
  29. package/dist/api/options.mjs.map +1 -1
  30. package/dist/api/pagination.cjs +2 -3
  31. package/dist/api/pagination.cjs.map +1 -1
  32. package/dist/api/pagination.d.cts +1 -1
  33. package/dist/api/pagination.d.cts.map +1 -1
  34. package/dist/api/pagination.d.mts +1 -1
  35. package/dist/api/pagination.d.mts.map +1 -1
  36. package/dist/api/pagination.mjs +1 -2
  37. package/dist/api/pagination.mjs.map +1 -1
  38. package/dist/api/request.cjs +3 -3
  39. package/dist/api/request.cjs.map +1 -1
  40. package/dist/api/request.d.cts +1 -1
  41. package/dist/api/request.d.cts.map +1 -1
  42. package/dist/api/request.d.mts +1 -1
  43. package/dist/api/request.d.mts.map +1 -1
  44. package/dist/api/request.mjs +2 -2
  45. package/dist/api/request.mjs.map +1 -1
  46. package/dist/api/response.cjs +5 -6
  47. package/dist/api/response.cjs.map +1 -1
  48. package/dist/api/response.d.cts.map +1 -1
  49. package/dist/api/response.d.mts.map +1 -1
  50. package/dist/api/response.mjs +1 -2
  51. package/dist/api/response.mjs.map +1 -1
  52. package/dist/api/transaction.cjs +10 -10
  53. package/dist/api/transaction.cjs.map +1 -1
  54. package/dist/api/transaction.d.cts +11 -11
  55. package/dist/api/transaction.d.cts.map +1 -1
  56. package/dist/api/transaction.d.mts +11 -11
  57. package/dist/api/transaction.d.mts.map +1 -1
  58. package/dist/api/transaction.mjs +2 -2
  59. package/dist/api/transaction.mjs.map +1 -1
  60. package/dist/btc/types.cjs +5 -6
  61. package/dist/btc/types.cjs.map +1 -1
  62. package/dist/btc/types.d.cts.map +1 -1
  63. package/dist/btc/types.d.mts.map +1 -1
  64. package/dist/btc/types.mjs +1 -2
  65. package/dist/btc/types.mjs.map +1 -1
  66. package/dist/eth/erc4337/types.cjs +9 -8
  67. package/dist/eth/erc4337/types.cjs.map +1 -1
  68. package/dist/eth/erc4337/types.d.cts +4 -4
  69. package/dist/eth/erc4337/types.d.cts.map +1 -1
  70. package/dist/eth/erc4337/types.d.mts +4 -4
  71. package/dist/eth/erc4337/types.d.mts.map +1 -1
  72. package/dist/eth/erc4337/types.mjs +2 -1
  73. package/dist/eth/erc4337/types.mjs.map +1 -1
  74. package/dist/eth/rpc/params.cjs +4 -5
  75. package/dist/eth/rpc/params.cjs.map +1 -1
  76. package/dist/eth/rpc/params.d.cts.map +1 -1
  77. package/dist/eth/rpc/params.d.mts.map +1 -1
  78. package/dist/eth/rpc/params.mjs +1 -2
  79. package/dist/eth/rpc/params.mjs.map +1 -1
  80. package/dist/eth/types.cjs +4 -5
  81. package/dist/eth/types.cjs.map +1 -1
  82. package/dist/eth/types.d.cts +1 -1
  83. package/dist/eth/types.d.cts.map +1 -1
  84. package/dist/eth/types.d.mts +1 -1
  85. package/dist/eth/types.d.mts.map +1 -1
  86. package/dist/eth/types.mjs +2 -3
  87. package/dist/eth/types.mjs.map +1 -1
  88. package/dist/events.cjs +20 -20
  89. package/dist/events.cjs.map +1 -1
  90. package/dist/events.d.cts +4 -4
  91. package/dist/events.d.cts.map +1 -1
  92. package/dist/events.d.mts +4 -4
  93. package/dist/events.d.mts.map +1 -1
  94. package/dist/events.mjs +2 -2
  95. package/dist/events.mjs.map +1 -1
  96. package/dist/rpc.cjs +36 -36
  97. package/dist/rpc.cjs.map +1 -1
  98. package/dist/rpc.d.cts +9 -9
  99. package/dist/rpc.d.cts.map +1 -1
  100. package/dist/rpc.d.mts +9 -9
  101. package/dist/rpc.d.mts.map +1 -1
  102. package/dist/rpc.mjs +2 -2
  103. package/dist/rpc.mjs.map +1 -1
  104. package/dist/sol/types.cjs +1 -2
  105. package/dist/sol/types.cjs.map +1 -1
  106. package/dist/sol/types.d.cts.map +1 -1
  107. package/dist/sol/types.d.mts.map +1 -1
  108. package/dist/sol/types.mjs +1 -2
  109. package/dist/sol/types.mjs.map +1 -1
  110. package/dist/trx/types.cjs +1 -2
  111. package/dist/trx/types.cjs.map +1 -1
  112. package/dist/trx/types.d.cts.map +1 -1
  113. package/dist/trx/types.d.mts.map +1 -1
  114. package/dist/trx/types.mjs +1 -2
  115. package/dist/trx/types.mjs.map +1 -1
  116. package/dist/v2/api/keyring-capabilities.cjs +5 -0
  117. package/dist/v2/api/keyring-capabilities.cjs.map +1 -1
  118. package/dist/v2/api/keyring-capabilities.d.cts +7 -0
  119. package/dist/v2/api/keyring-capabilities.d.cts.map +1 -1
  120. package/dist/v2/api/keyring-capabilities.d.mts +7 -0
  121. package/dist/v2/api/keyring-capabilities.d.mts.map +1 -1
  122. package/dist/v2/api/keyring-capabilities.mjs +5 -0
  123. package/dist/v2/api/keyring-capabilities.mjs.map +1 -1
  124. package/dist/v2/api/keyring-rpc.cjs +10 -10
  125. package/dist/v2/api/keyring-rpc.cjs.map +1 -1
  126. package/dist/v2/api/keyring-rpc.d.cts +2 -2
  127. package/dist/v2/api/keyring-rpc.d.cts.map +1 -1
  128. package/dist/v2/api/keyring-rpc.d.mts +2 -2
  129. package/dist/v2/api/keyring-rpc.d.mts.map +1 -1
  130. package/dist/v2/api/keyring-rpc.mjs +2 -2
  131. package/dist/v2/api/keyring-rpc.mjs.map +1 -1
  132. package/dist/v2/api/keyring-snap-rpc.cjs +14 -1
  133. package/dist/v2/api/keyring-snap-rpc.cjs.map +1 -1
  134. package/dist/v2/api/keyring-snap-rpc.d.cts +62 -8
  135. package/dist/v2/api/keyring-snap-rpc.d.cts.map +1 -1
  136. package/dist/v2/api/keyring-snap-rpc.d.mts +62 -8
  137. package/dist/v2/api/keyring-snap-rpc.d.mts.map +1 -1
  138. package/dist/v2/api/keyring-snap-rpc.mjs +16 -3
  139. package/dist/v2/api/keyring-snap-rpc.mjs.map +1 -1
  140. package/dist/xlm/types.cjs +1 -2
  141. package/dist/xlm/types.cjs.map +1 -1
  142. package/dist/xlm/types.d.cts.map +1 -1
  143. package/dist/xlm/types.d.mts.map +1 -1
  144. package/dist/xlm/types.mjs +1 -2
  145. package/dist/xlm/types.mjs.map +1 -1
  146. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-capabilities.cjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":";;;AAAA,uDAO+B;AAG/B,6CAAmD;AACnD,mDAGuB;AAEvB;;GAEG;AACU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,wBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,IAAA,2BAAa,EAClB,IAAA,oBAAM,EAAC;QACL;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n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\n\nimport { CaipChainIdStruct } from '../../api/caip';\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a range of BIP-44 account indices.\n */\n deriveIndexRange: exactOptional(boolean()),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: exactOptional(boolean()),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n /**\n * Indicates which Keyring methods accept non-standard options.\n *\n * When a method is set to `true`, it signals that the keyring implementation\n * accepts custom options for that method, different from the standard API.\n * This is a workaround for keyrings with very specific requirements.\n */\n custom: exactOptional(\n partial(\n object({\n createAccounts: boolean(),\n }),\n ),\n ),\n /**\n * Snap-specific capabilities supported by this keyring.\n *\n * Each flag maps to a Snap keyring RPC method that the Snap implements.\n */\n snap: exactOptional(\n object({\n /**\n * Asset-related capabilities.\n */\n assets: exactOptional(\n object({\n /**\n * Whether the keyring supports getting account assets\n * (`keyring_getAccountAssets`).\n */\n metadata: exactOptional(boolean()),\n /**\n * Whether the keyring supports getting account balances\n * (`keyring_getAccountBalances`).\n */\n balances: exactOptional(boolean()),\n }),\n ),\n /**\n * Whether the keyring supports getting account transactions\n * (`keyring_getAccountTransactions`).\n */\n transactions: exactOptional(boolean()),\n /**\n * Whether the keyring supports receiving selected accounts notifications\n * (`keyring_setSelectedAccounts`).\n */\n selectedAccounts: exactOptional(boolean()),\n }),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * deriveIndexRange: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
1
+ {"version":3,"file":"keyring-capabilities.cjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":";;;AAAA,uDAO+B;AAG/B,6CAAmD;AACnD,mDAGuB;AAEvB;;GAEG;AACU,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,wBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,IAAA,2BAAa,EAClB,IAAA,oBAAM,EAAC;QACL;;WAEG;QACH,UAAU,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QACpC;;WAEG;QACH,WAAW,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QACrC;;WAEG;QACH,gBAAgB,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QAC1C;;WAEG;QACH,QAAQ,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KACnC,CAAC,CACH;IACD;;OAEG;IACH,UAAU,EAAE,IAAA,2BAAa,EACvB,IAAA,oBAAM,EAAC;QACL;;WAEG;QACH,aAAa,EAAE,IAAA,2BAAa,EAAC,IAAA,mBAAK,EAAC,0CAA4B,CAAC,CAAC;QACjE;;WAEG;QACH,aAAa,EAAE,IAAA,2BAAa,EAAC,IAAA,mBAAK,EAAC,0CAA4B,CAAC,CAAC;KAClE,CAAC,CACH;IACD;;;;;;OAMG;IACH,MAAM,EAAE,IAAA,2BAAa,EACnB,IAAA,qBAAO,EACL,IAAA,oBAAM,EAAC;QACL,cAAc,EAAE,IAAA,qBAAO,GAAE;KAC1B,CAAC,CACH,CACF;IACD;;;;OAIG;IACH,IAAI,EAAE,IAAA,2BAAa,EACjB,IAAA,oBAAM,EAAC;QACL;;WAEG;QACH,MAAM,EAAE,IAAA,2BAAa,EACnB,IAAA,oBAAM,EAAC;YACL;;;eAGG;YACH,QAAQ,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;YAClC;;;eAGG;YACH,QAAQ,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;SACnC,CAAC,CACH;QACD;;;WAGG;QACH,YAAY,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QACtC;;;WAGG;QACH,gBAAgB,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;QAC1C;;;WAGG;QACH,qBAAqB,EAAE,IAAA,2BAAa,EAAC,IAAA,qBAAO,GAAE,CAAC;KAChD,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\n\nimport { CaipChainIdStruct } from '../../api/caip';\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a range of BIP-44 account indices.\n */\n deriveIndexRange: exactOptional(boolean()),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: exactOptional(boolean()),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n /**\n * Indicates which Keyring methods accept non-standard options.\n *\n * When a method is set to `true`, it signals that the keyring implementation\n * accepts custom options for that method, different from the standard API.\n * This is a workaround for keyrings with very specific requirements.\n */\n custom: exactOptional(\n partial(\n object({\n createAccounts: boolean(),\n }),\n ),\n ),\n /**\n * Snap-specific capabilities supported by this keyring.\n *\n * Each flag maps to a Snap keyring RPC method that the Snap implements.\n */\n snap: exactOptional(\n object({\n /**\n * Asset-related capabilities.\n */\n assets: exactOptional(\n object({\n /**\n * Whether the keyring supports getting account assets\n * (`keyring_getAccountAssets`).\n */\n metadata: exactOptional(boolean()),\n /**\n * Whether the keyring supports getting account balances\n * (`keyring_getAccountBalances`).\n */\n balances: exactOptional(boolean()),\n }),\n ),\n /**\n * Whether the keyring supports getting account transactions\n * (`keyring_getAccountTransactions`).\n */\n transactions: exactOptional(boolean()),\n /**\n * Whether the keyring supports receiving selected accounts notifications\n * (`keyring_setSelectedAccounts`).\n */\n selectedAccounts: exactOptional(boolean()),\n /**\n * Whether the keyring supports resolving the account address to use for\n * routing a signing request (`keyring_resolveAccountAddress`).\n */\n resolveAccountAddress: exactOptional(boolean()),\n }),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * deriveIndexRange: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
@@ -29,6 +29,7 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
29
29
  };
30
30
  transactions?: boolean;
31
31
  selectedAccounts?: boolean;
32
+ resolveAccountAddress?: boolean;
32
33
  };
33
34
  }, {
34
35
  /**
@@ -138,6 +139,7 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
138
139
  };
139
140
  transactions?: boolean;
140
141
  selectedAccounts?: boolean;
142
+ resolveAccountAddress?: boolean;
141
143
  }, {
142
144
  /**
143
145
  * Asset-related capabilities.
@@ -167,6 +169,11 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
167
169
  * (`keyring_setSelectedAccounts`).
168
170
  */
169
171
  selectedAccounts: import("@metamask/superstruct").ExactOptionalStruct<boolean, null>;
172
+ /**
173
+ * Whether the keyring supports resolving the account address to use for
174
+ * routing a signing request (`keyring_resolveAccountAddress`).
175
+ */
176
+ resolveAccountAddress: import("@metamask/superstruct").ExactOptionalStruct<boolean, null>;
170
177
  }>;
171
178
  }>;
172
179
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-capabilities.d.cts","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAQnD;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACpC;;OAEG;;IAEH;;OAEG;;;;;;;QAGC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;IAIP;;OAEG;;;;;;;;;;QAGC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;QAEH;;WAEG;;;;;;;;;;;;IAIP;;;;;;OAMG;;;;;;IAQH;;;;OAIG;;;;;;;;;QAGC;;WAEG;;;;;YAGC;;;eAGG;;YAEH;;;eAGG;;;QAIP;;;WAGG;;QAEH;;;WAGG;;;EAIP,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
1
+ {"version":3,"file":"keyring-capabilities.d.cts","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAQnD;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACpC;;OAEG;;IAEH;;OAEG;;;;;;;QAGC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;IAIP;;OAEG;;;;;;;;;;QAGC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;QAEH;;WAEG;;;;;;;;;;;;IAIP;;;;;;OAMG;;;;;;IAQH;;;;OAIG;;;;;;;;;;QAGC;;WAEG;;;;;YAGC;;;eAGG;;YAEH;;;eAGG;;;QAIP;;;WAGG;;QAEH;;;WAGG;;QAEH;;;WAGG;;;EAIP,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -29,6 +29,7 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
29
29
  };
30
30
  transactions?: boolean;
31
31
  selectedAccounts?: boolean;
32
+ resolveAccountAddress?: boolean;
32
33
  };
33
34
  }, {
34
35
  /**
@@ -138,6 +139,7 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
138
139
  };
139
140
  transactions?: boolean;
140
141
  selectedAccounts?: boolean;
142
+ resolveAccountAddress?: boolean;
141
143
  }, {
142
144
  /**
143
145
  * Asset-related capabilities.
@@ -167,6 +169,11 @@ export declare const KeyringCapabilitiesStruct: import("@metamask/superstruct").
167
169
  * (`keyring_setSelectedAccounts`).
168
170
  */
169
171
  selectedAccounts: import("@metamask/superstruct").ExactOptionalStruct<boolean, null>;
172
+ /**
173
+ * Whether the keyring supports resolving the account address to use for
174
+ * routing a signing request (`keyring_resolveAccountAddress`).
175
+ */
176
+ resolveAccountAddress: import("@metamask/superstruct").ExactOptionalStruct<boolean, null>;
170
177
  }>;
171
178
  }>;
172
179
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-capabilities.d.mts","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAQnD;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACpC;;OAEG;;IAEH;;OAEG;;;;;;;QAGC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;IAIP;;OAEG;;;;;;;;;;QAGC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;QAEH;;WAEG;;;;;;;;;;;;IAIP;;;;;;OAMG;;;;;;IAQH;;;;OAIG;;;;;;;;;QAGC;;WAEG;;;;;YAGC;;;eAGG;;YAEH;;;eAGG;;;QAIP;;;WAGG;;QAEH;;;WAGG;;;EAIP,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
1
+ {"version":3,"file":"keyring-capabilities.d.mts","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAQnD;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACpC;;OAEG;;IAEH;;OAEG;;;;;;;QAGC;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;IAIP;;OAEG;;;;;;;;;;QAGC;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;QAEH;;WAEG;;;;;;;;;;;;IAIP;;;;;;OAMG;;;;;;IAQH;;;;OAIG;;;;;;;;;;QAGC;;WAEG;;;;;YAGC;;;eAGG;;YAEH;;;eAGG;;;QAIP;;;WAGG;;QAEH;;;WAGG;;QAEH;;;WAGG;;;EAIP,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -84,6 +84,11 @@ export const KeyringCapabilitiesStruct = object({
84
84
  * (`keyring_setSelectedAccounts`).
85
85
  */
86
86
  selectedAccounts: exactOptional(boolean()),
87
+ /**
88
+ * Whether the keyring supports resolving the account address to use for
89
+ * routing a signing request (`keyring_resolveAccountAddress`).
90
+ */
91
+ resolveAccountAddress: exactOptional(boolean()),
87
92
  })),
88
93
  });
89
94
  //# sourceMappingURL=keyring-capabilities.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-capabilities.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,EACN,OAAO,EACR,8BAA8B;AAG/B,OAAO,EAAE,iBAAiB,EAAE,2BAAuB;AACnD,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,0BAAsB;AAEvB;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,aAAa,CAClB,MAAM,CAAC;QACL;;WAEG;QACH,UAAU,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACpC;;WAEG;QACH,WAAW,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACrC;;WAEG;QACH,gBAAgB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1C;;WAEG;QACH,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KACnC,CAAC,CACH;IACD;;OAEG;IACH,UAAU,EAAE,aAAa,CACvB,MAAM,CAAC;QACL;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACjE;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAClE,CAAC,CACH;IACD;;;;;;OAMG;IACH,MAAM,EAAE,aAAa,CACnB,OAAO,CACL,MAAM,CAAC;QACL,cAAc,EAAE,OAAO,EAAE;KAC1B,CAAC,CACH,CACF;IACD;;;;OAIG;IACH,IAAI,EAAE,aAAa,CACjB,MAAM,CAAC;QACL;;WAEG;QACH,MAAM,EAAE,aAAa,CACnB,MAAM,CAAC;YACL;;;eAGG;YACH,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;YAClC;;;eAGG;YACH,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;SACnC,CAAC,CACH;QACD;;;WAGG;QACH,YAAY,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACtC;;;WAGG;QACH,gBAAgB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KAC3C,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\n\nimport { CaipChainIdStruct } from '../../api/caip';\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a range of BIP-44 account indices.\n */\n deriveIndexRange: exactOptional(boolean()),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: exactOptional(boolean()),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n /**\n * Indicates which Keyring methods accept non-standard options.\n *\n * When a method is set to `true`, it signals that the keyring implementation\n * accepts custom options for that method, different from the standard API.\n * This is a workaround for keyrings with very specific requirements.\n */\n custom: exactOptional(\n partial(\n object({\n createAccounts: boolean(),\n }),\n ),\n ),\n /**\n * Snap-specific capabilities supported by this keyring.\n *\n * Each flag maps to a Snap keyring RPC method that the Snap implements.\n */\n snap: exactOptional(\n object({\n /**\n * Asset-related capabilities.\n */\n assets: exactOptional(\n object({\n /**\n * Whether the keyring supports getting account assets\n * (`keyring_getAccountAssets`).\n */\n metadata: exactOptional(boolean()),\n /**\n * Whether the keyring supports getting account balances\n * (`keyring_getAccountBalances`).\n */\n balances: exactOptional(boolean()),\n }),\n ),\n /**\n * Whether the keyring supports getting account transactions\n * (`keyring_getAccountTransactions`).\n */\n transactions: exactOptional(boolean()),\n /**\n * Whether the keyring supports receiving selected accounts notifications\n * (`keyring_setSelectedAccounts`).\n */\n selectedAccounts: exactOptional(boolean()),\n }),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * deriveIndexRange: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
1
+ {"version":3,"file":"keyring-capabilities.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,EACN,OAAO,EACR,8BAA8B;AAG/B,OAAO,EAAE,iBAAiB,EAAE,2BAAuB;AACnD,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,0BAAsB;AAEvB;;GAEG;AACH,MAAM,CAAC,MAA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sourcesContent":["import {\n array,\n boolean,\n exactOptional,\n nonempty,\n object,\n partial,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\n\nimport { CaipChainIdStruct } from '../../api/caip';\nimport {\n ExportPrivateKeyFormatStruct,\n ImportPrivateKeyFormatStruct,\n} from './private-key';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n /**\n * List of CAIP-2 chain IDs that this keyring supports.\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n /**\n * BIP-44 capabilities supported by this keyring.\n */\n bip44: exactOptional(\n object({\n /**\n * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n */\n derivePath: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a BIP-44 account index.\n */\n deriveIndex: exactOptional(boolean()),\n /**\n * Whether the keyring supports deriving accounts from a range of BIP-44 account indices.\n */\n deriveIndexRange: exactOptional(boolean()),\n /**\n * Whether the keyring supports BIP-44 account discovery.\n */\n discover: exactOptional(boolean()),\n }),\n ),\n /**\n * Private key capabilities supported by this keyring.\n */\n privateKey: exactOptional(\n object({\n /**\n * List of supported formats for importing private keys.\n */\n importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n /**\n * List of supported formats for exporting private keys.\n */\n exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n }),\n ),\n /**\n * Indicates which Keyring methods accept non-standard options.\n *\n * When a method is set to `true`, it signals that the keyring implementation\n * accepts custom options for that method, different from the standard API.\n * This is a workaround for keyrings with very specific requirements.\n */\n custom: exactOptional(\n partial(\n object({\n createAccounts: boolean(),\n }),\n ),\n ),\n /**\n * Snap-specific capabilities supported by this keyring.\n *\n * Each flag maps to a Snap keyring RPC method that the Snap implements.\n */\n snap: exactOptional(\n object({\n /**\n * Asset-related capabilities.\n */\n assets: exactOptional(\n object({\n /**\n * Whether the keyring supports getting account assets\n * (`keyring_getAccountAssets`).\n */\n metadata: exactOptional(boolean()),\n /**\n * Whether the keyring supports getting account balances\n * (`keyring_getAccountBalances`).\n */\n balances: exactOptional(boolean()),\n }),\n ),\n /**\n * Whether the keyring supports getting account transactions\n * (`keyring_getAccountTransactions`).\n */\n transactions: exactOptional(boolean()),\n /**\n * Whether the keyring supports receiving selected accounts notifications\n * (`keyring_setSelectedAccounts`).\n */\n selectedAccounts: exactOptional(boolean()),\n /**\n * Whether the keyring supports resolving the account address to use for\n * routing a signing request (`keyring_resolveAccountAddress`).\n */\n resolveAccountAddress: exactOptional(boolean()),\n }),\n ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n * scopes: ['bip122:_'],\n * bip44: {\n * derivePath: true,\n * deriveIndex: true,\n * deriveIndexRange: true,\n * discover: true,\n * },\n * privateKey: {\n * importFormats: [\n * { encoding: 'base58', type: 'bip122:p2sh' },\n * { encoding: 'base58', type: 'bip122:p2tr' },\n * { encoding: 'base58', type: 'bip122:p2pkh' },\n * { encoding: 'base58', type: 'bip122:p2wpkh' },\n * ],\n * exportFormats: [\n * { encoding: 'base58' },\n * { encoding: 'base58' },\n * ],\n * },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}
@@ -38,24 +38,24 @@ const CommonHeader = {
38
38
  };
39
39
  // ----------------------------------------------------------------------------
40
40
  // Get accounts
41
- exports.GetAccountsRequestStruct = (0, keyring_utils_1.object)({
41
+ exports.GetAccountsRequestStruct = (0, superstruct_1.object)({
42
42
  ...CommonHeader,
43
43
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.GetAccounts}`),
44
44
  });
45
45
  exports.GetAccountsResponseStruct = (0, superstruct_1.array)(account_1.KeyringAccountStruct);
46
46
  // ----------------------------------------------------------------------------
47
47
  // Get account
48
- exports.GetAccountRequestStruct = (0, keyring_utils_1.object)({
48
+ exports.GetAccountRequestStruct = (0, superstruct_1.object)({
49
49
  ...CommonHeader,
50
50
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.GetAccount}`),
51
- params: (0, keyring_utils_1.object)({
51
+ params: (0, superstruct_1.object)({
52
52
  id: keyring_utils_1.UuidStruct,
53
53
  }),
54
54
  });
55
55
  exports.GetAccountResponseStruct = account_1.KeyringAccountStruct;
56
56
  // ----------------------------------------------------------------------------
57
57
  // Create accounts
58
- exports.CreateAccountsRequestStruct = (0, keyring_utils_1.object)({
58
+ exports.CreateAccountsRequestStruct = (0, superstruct_1.object)({
59
59
  ...CommonHeader,
60
60
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.CreateAccounts}`),
61
61
  params: create_account_1.CreateAccountOptionsStruct,
@@ -63,28 +63,28 @@ exports.CreateAccountsRequestStruct = (0, keyring_utils_1.object)({
63
63
  exports.CreateAccountsResponseStruct = (0, superstruct_1.array)(account_1.KeyringAccountStruct);
64
64
  // ----------------------------------------------------------------------------
65
65
  // Delete account
66
- exports.DeleteAccountRequestStruct = (0, keyring_utils_1.object)({
66
+ exports.DeleteAccountRequestStruct = (0, superstruct_1.object)({
67
67
  ...CommonHeader,
68
68
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.DeleteAccount}`),
69
- params: (0, keyring_utils_1.object)({
69
+ params: (0, superstruct_1.object)({
70
70
  id: keyring_utils_1.UuidStruct,
71
71
  }),
72
72
  });
73
73
  exports.DeleteAccountResponseStruct = (0, superstruct_1.literal)(null);
74
74
  // ----------------------------------------------------------------------------
75
75
  // Export account
76
- exports.ExportAccountRequestStruct = (0, keyring_utils_1.object)({
76
+ exports.ExportAccountRequestStruct = (0, superstruct_1.object)({
77
77
  ...CommonHeader,
78
78
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.ExportAccount}`),
79
- params: (0, keyring_utils_1.object)({
79
+ params: (0, superstruct_1.object)({
80
80
  id: keyring_utils_1.UuidStruct,
81
- options: (0, keyring_utils_1.exactOptional)(export_account_1.ExportAccountOptionsStruct),
81
+ options: (0, superstruct_1.exactOptional)(export_account_1.ExportAccountOptionsStruct),
82
82
  }),
83
83
  });
84
84
  exports.ExportAccountResponseStruct = export_account_1.PrivateKeyExportedAccountStruct;
85
85
  // ----------------------------------------------------------------------------
86
86
  // Submit request
87
- exports.SubmitRequestRequestStruct = (0, keyring_utils_1.object)({
87
+ exports.SubmitRequestRequestStruct = (0, superstruct_1.object)({
88
88
  ...CommonHeader,
89
89
  method: (0, superstruct_1.literal)(`${exports.KeyringRpcMethod.SubmitRequest}`),
90
90
  params: request_1.KeyringRequestStruct,
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-rpc.cjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-rpc.ts"],"names":[],"mappings":";;;AAAA,2DAA4E;AAE5E,uDAA8E;AAC9E,2CAA6C;AAE7C,mDAAyD;AACzD,mDAAyD;AACzD,+DAA8D;AAC9D,+DAG0B;AAgB1B;;GAEG;AACU,QAAA,gBAAgB,GAAG;IAC9B,WAAW,EAAE,qBAAqB;IAClC,cAAc,EAAE,wBAAwB;IACxC,2DAA2D;IAC3D,6DAA6D;IAC7D,UAAU,EAAE,oBAAoB;IAChC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;CAC9B,CAAC;AAQX;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,wBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC;AAFD,gDAEC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,eAAe;AAEF,QAAA,wBAAw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AO,EAAC,GAAG,wBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,OAAO,EAAE,IAAA,6BAAa,EAAC,2CAA0B,CAAC;KACnD,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,gDAA+B,CAAC;AAI3E,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,wBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,8BAAoB;CAC7B,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,kBAAU,CAAC","sourcesContent":["import { object, exactOptional, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, literal, number, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../../api/account';\nimport { KeyringRequestStruct } from '../../api/request';\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { Keyring } from './keyring';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpc = {\n getAccount: Keyring['getAccount'];\n getAccounts: Keyring['getAccounts'];\n createAccounts: Keyring['createAccounts'];\n deleteAccount: Keyring['deleteAccount'];\n submitRequest: Keyring['submitRequest'];\n exportAccount?: Keyring['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcMethod = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcMethod =\n (typeof KeyringRpcMethod)[keyof typeof KeyringRpcMethod];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcMethod(method: string): method is KeyringRpcMethod {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccounts}`),\n});\n\nexport type GetAccountsRequest = Infer<typeof GetAccountsRequestStruct>;\n\nexport const GetAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsResponse = Infer<typeof GetAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsRequest = Infer<typeof CreateAccountsRequestStruct>;\n\nexport const CreateAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsResponse = Infer<typeof CreateAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = JsonStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcRequests =\n | GetAccountsRequest\n | GetAccountRequest\n | CreateAccountsRequest\n | DeleteAccountRequest\n | ExportAccountRequest\n | SubmitRequestRequest;\n\n/**\n * Extract the proper request type for a given `KeyringRpcMethod`.\n */\nexport type KeyringRpcRequest<RpcMethod extends KeyringRpcMethod> = Extract<\n KeyringRpcRequests,\n { method: `${RpcMethod}` }\n>;\n"]}
1
+ {"version":3,"file":"keyring-rpc.cjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-rpc.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAErD,uDAQ+B;AAC/B,2CAA6C;AAE7C,mDAAyD;AACzD,mDAAyD;AACzD,+DAA8D;AAC9D,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port type { Infer } from '@metamask/superstruct';\nimport {\n array,\n exactOptional,\n literal,\n number,\n object,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../../api/account';\nimport { KeyringRequestStruct } from '../../api/request';\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { Keyring } from './keyring';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpc = {\n getAccount: Keyring['getAccount'];\n getAccounts: Keyring['getAccounts'];\n createAccounts: Keyring['createAccounts'];\n deleteAccount: Keyring['deleteAccount'];\n submitRequest: Keyring['submitRequest'];\n exportAccount?: Keyring['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcMethod = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcMethod =\n (typeof KeyringRpcMethod)[keyof typeof KeyringRpcMethod];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcMethod(method: string): method is KeyringRpcMethod {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccounts}`),\n});\n\nexport type GetAccountsRequest = Infer<typeof GetAccountsRequestStruct>;\n\nexport const GetAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsResponse = Infer<typeof GetAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsRequest = Infer<typeof CreateAccountsRequestStruct>;\n\nexport const CreateAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsResponse = Infer<typeof CreateAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = JsonStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcRequests =\n | GetAccountsRequest\n | GetAccountRequest\n | CreateAccountsRequest\n | DeleteAccountRequest\n | ExportAccountRequest\n | SubmitRequestRequest;\n\n/**\n * Extract the proper request type for a given `KeyringRpcMethod`.\n */\nexport type KeyringRpcRequest<RpcMethod extends KeyringRpcMethod> = Extract<\n KeyringRpcRequests,\n { method: `${RpcMethod}` }\n>;\n"]}
@@ -358,7 +358,7 @@ export declare const ExportAccountRequestStruct: import("@metamask/superstruct")
358
358
  };
359
359
  }, {
360
360
  id: import("@metamask/superstruct").Struct<string, null>;
361
- options: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
361
+ options: import("@metamask/superstruct").ExactOptionalStruct<{
362
362
  type: "private-key";
363
363
  encoding: "hexadecimal" | "base58";
364
364
  }, {
@@ -421,7 +421,7 @@ export declare const SubmitRequestRequestStruct: import("@metamask/superstruct")
421
421
  params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
422
422
  }, {
423
423
  method: import("@metamask/superstruct").Struct<string, null>;
424
- params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
424
+ params: import("@metamask/superstruct").ExactOptionalStruct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[], null>;
425
425
  }>;
426
426
  }>;
427
427
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-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;;;;;;;;;;;;;;;;;;;;;EAOrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B;;;;;;;;;;;EAAkC,CAAC;AAE3E,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAK9E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,iFAAa,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAI9E;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,kBAAkB,GAClB,iBAAiB,GACjB,qBAAqB,GACrB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,SAAS,SAAS,gBAAgB,IAAI,OAAO,CACzE,kBAAkB,EAClB;IAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAA;CAAE,CAC3B,CAAC"}
@@ -358,7 +358,7 @@ export declare const ExportAccountRequestStruct: import("@metamask/superstruct")
358
358
  };
359
359
  }, {
360
360
  id: import("@metamask/superstruct").Struct<string, null>;
361
- options: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
361
+ options: import("@metamask/superstruct").ExactOptionalStruct<{
362
362
  type: "private-key";
363
363
  encoding: "hexadecimal" | "base58";
364
364
  }, {
@@ -421,7 +421,7 @@ export declare const SubmitRequestRequestStruct: import("@metamask/superstruct")
421
421
  params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
422
422
  }, {
423
423
  method: import("@metamask/superstruct").Struct<string, null>;
424
- params: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[] | import("@metamask/keyring-utils").ExactOptionalTag, null>;
424
+ params: import("@metamask/superstruct").ExactOptionalStruct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[], null>;
425
425
  }>;
426
426
  }>;
427
427
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-rpc.d.mts","sourceRoot":"","sources":["../../../src/v2/api/keyring-rpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAWnD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AAEzC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACpC,cAAc,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC1C,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACxC,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;CASnB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,gBAAgB,CAE7E;AAYD,eAAO,MAAM,wBAAwB;;;;;;;;EAGnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAExE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA0B;;;;;;;;;;;;;;;;EAMrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,oDAAgB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAK9E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B;;;;;;;;;;;EAAkC,CAAC;AAE3E,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAK9E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,iFAAa,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAI9E;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,kBAAkB,GAClB,iBAAiB,GACjB,qBAAqB,GACrB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,SAAS,SAAS,gBAAgB,IAAI,OAAO,CACzE,kBAAkB,EAClB;IAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAA;CAAE,CAC3B,CAAC"}
@@ -1,5 +1,5 @@
1
- import { object, exactOptional, UuidStruct } from "@metamask/keyring-utils";
2
- import { array, literal, number, string, union } from "@metamask/superstruct";
1
+ import { UuidStruct } from "@metamask/keyring-utils";
2
+ import { array, exactOptional, literal, number, object, string, union } from "@metamask/superstruct";
3
3
  import { JsonStruct } from "@metamask/utils";
4
4
  import { KeyringAccountStruct } from "../../api/account.mjs";
5
5
  import { KeyringRequestStruct } from "../../api/request.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-rpc.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,gCAAgC;AAE5E,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AAC9E,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,oBAAoB,EAAE,8BAA0B;AACzD,OAAO,EAAE,oBAAoB,EAAE,8BAA0B;AACzD,OAAO,EAAE,0BAA0B,EAAE,mCAAyB;AAC9D,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAChC,mCAAyB;AAgB1B;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,WAAW,EAAE,qBAAqB;IAClC,cAAc,EAAE,wBAAwB;IACxC,2DAA2D;IAC3D,6DAA6D;IAC7D,UAAU,EAAE,oBAAoB;IAChC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;IACtC,aAAa,EAAE,uBAAuB;CAC9B,CAAC;AAQX;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;IACvB,EAAE,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,eAAe;A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,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;QACd,OAAO,EAAE,aAAa,CAAC,0BAA0B,CAAC;KACnD,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,+BAA+B,CAAC;AAI3E,+EAA+E;AAC/E,iBAAiB;AAEjB,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAC","sourcesContent":["import { object, exactOptional, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, literal, number, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../../api/account';\nimport { KeyringRequestStruct } from '../../api/request';\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { Keyring } from './keyring';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpc = {\n getAccount: Keyring['getAccount'];\n getAccounts: Keyring['getAccounts'];\n createAccounts: Keyring['createAccounts'];\n deleteAccount: Keyring['deleteAccount'];\n submitRequest: Keyring['submitRequest'];\n exportAccount?: Keyring['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcMethod = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcMethod =\n (typeof KeyringRpcMethod)[keyof typeof KeyringRpcMethod];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcMethod(method: string): method is KeyringRpcMethod {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccounts}`),\n});\n\nexport type GetAccountsRequest = Infer<typeof GetAccountsRequestStruct>;\n\nexport const GetAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsResponse = Infer<typeof GetAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsRequest = Infer<typeof CreateAccountsRequestStruct>;\n\nexport const CreateAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsResponse = Infer<typeof CreateAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = JsonStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcRequests =\n | GetAccountsRequest\n | GetAccountRequest\n | CreateAccountsRequest\n | DeleteAccountRequest\n | ExportAccountRequest\n | SubmitRequestRequest;\n\n/**\n * Extract the proper request type for a given `KeyringRpcMethod`.\n */\nexport type KeyringRpcRequest<RpcMethod extends KeyringRpcMethod> = Extract<\n KeyringRpcRequests,\n { method: `${RpcMethod}` }\n>;\n"]}
1
+ {"version":3,"file":"keyring-rpc.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gCAAgC;AAErD,OAAO,EACL,KAAK,EACL,aAAa,EACb,OA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,GAAG,MAAM,CAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAC","sourcesContent":["import { UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n exactOptional,\n literal,\n number,\n object,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../../api/account';\nimport { KeyringRequestStruct } from '../../api/request';\nimport { CreateAccountOptionsStruct } from './create-account';\nimport {\n ExportAccountOptionsStruct,\n PrivateKeyExportedAccountStruct,\n} from './export-account';\nimport type { Keyring } from './keyring';\n\n/**\n * Keyring interface for keyring methods that can be invoked through\n * RPC calls.\n */\nexport type KeyringRpc = {\n getAccount: Keyring['getAccount'];\n getAccounts: Keyring['getAccounts'];\n createAccounts: Keyring['createAccounts'];\n deleteAccount: Keyring['deleteAccount'];\n submitRequest: Keyring['submitRequest'];\n exportAccount?: Keyring['exportAccount'];\n};\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport const KeyringRpcMethod = {\n GetAccounts: 'keyring_getAccounts',\n CreateAccounts: 'keyring_createAccounts',\n // Inherited from v1 (but method signatures may differ...):\n // NOTE: We use literals here to avoid circular dependencies.\n GetAccount: 'keyring_getAccount',\n DeleteAccount: 'keyring_deleteAccount',\n ExportAccount: 'keyring_exportAccount',\n SubmitRequest: 'keyring_submitRequest',\n} as const;\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport type KeyringRpcMethod =\n (typeof KeyringRpcMethod)[keyof typeof KeyringRpcMethod];\n\n/**\n * Check if a method is a keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method (v2).\n */\nexport function isKeyringRpcMethod(method: string): method is KeyringRpcMethod {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Get accounts\n\nexport const GetAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccounts}`),\n});\n\nexport type GetAccountsRequest = Infer<typeof GetAccountsRequestStruct>;\n\nexport const GetAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type GetAccountsResponse = Infer<typeof GetAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create accounts\n\nexport const CreateAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.CreateAccounts}`),\n params: CreateAccountOptionsStruct,\n});\n\nexport type CreateAccountsRequest = Infer<typeof CreateAccountsRequestStruct>;\n\nexport const CreateAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type CreateAccountsResponse = Infer<typeof CreateAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.DeleteAccount}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.ExportAccount}`),\n params: object({\n id: UuidStruct,\n options: exactOptional(ExportAccountOptionsStruct),\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = PrivateKeyExportedAccountStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.SubmitRequest}`),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = JsonStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Keyring RPC requests.\n */\nexport type KeyringRpcRequests =\n | GetAccountsRequest\n | GetAccountRequest\n | CreateAccountsRequest\n | DeleteAccountRequest\n | ExportAccountRequest\n | SubmitRequestRequest;\n\n/**\n * Extract the proper request type for a given `KeyringRpcMethod`.\n */\nexport type KeyringRpcRequest<RpcMethod extends KeyringRpcMethod> = Extract<\n KeyringRpcRequests,\n { method: `${RpcMethod}` }\n>;\n"]}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.GetAccountAssetsResponseStruct = exports.GetAccountAssetsRequestStruct = exports.GetAccountTransactionsResponseStruct = exports.GetAccountTransactionsRequestStruct = exports.SetSelectedAccountsResponseStruct = exports.SetSelectedAccountsRequestStruct = exports.isKeyringSnapRpcMethod = exports.KeyringSnapRpcMethod = void 0;
3
+ exports.ResolveAccountAddressResponseStruct = exports.ResolveAccountAddressRequestStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.GetAccountAssetsResponseStruct = exports.GetAccountAssetsRequestStruct = exports.GetAccountTransactionsResponseStruct = exports.GetAccountTransactionsRequestStruct = exports.SetSelectedAccountsResponseStruct = exports.SetSelectedAccountsRequestStruct = exports.isKeyringSnapRpcMethod = exports.KeyringSnapRpcMethod = void 0;
4
4
  const keyring_utils_1 = require("@metamask/keyring-utils");
5
5
  const superstruct_1 = require("@metamask/superstruct");
6
+ const address_1 = require("../../api/address.cjs");
6
7
  const balance_1 = require("../../api/balance.cjs");
7
8
  const caip_1 = require("../../api/caip.cjs");
8
9
  const pagination_1 = require("../../api/pagination.cjs");
@@ -18,6 +19,7 @@ exports.KeyringSnapRpcMethod = {
18
19
  GetAccountTransactions: 'keyring_getAccountTransactions',
19
20
  GetAccountAssets: 'keyring_getAccountAssets',
20
21
  GetAccountBalances: 'keyring_getAccountBalances',
22
+ ResolveAccountAddress: 'keyring_resolveAccountAddress',
21
23
  };
22
24
  /**
23
25
  * Check if a method is a Snap keyring RPC method (v2).
@@ -76,4 +78,15 @@ exports.GetAccountBalancesRequestStruct = (0, superstruct_1.object)({
76
78
  }),
77
79
  });
78
80
  exports.GetAccountBalancesResponseStruct = (0, superstruct_1.record)(caip_1.CaipAssetTypeStruct, balance_1.BalanceStruct);
81
+ // ----------------------------------------------------------------------------
82
+ // Resolve account address
83
+ exports.ResolveAccountAddressRequestStruct = (0, superstruct_1.object)({
84
+ ...CommonHeader,
85
+ method: (0, superstruct_1.literal)(`${exports.KeyringSnapRpcMethod.ResolveAccountAddress}`),
86
+ params: (0, superstruct_1.object)({
87
+ scope: caip_1.CaipChainIdStruct,
88
+ request: keyring_utils_1.JsonRpcRequestStruct,
89
+ }),
90
+ });
91
+ exports.ResolveAccountAddressResponseStruct = (0, superstruct_1.nullable)(address_1.ResolvedAccountAddressStruct);
79
92
  //# sourceMappingURL=keyring-snap-rpc.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-snap-rpc.cjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-snap-rpc.ts"],"names":[],"mappings":";;;AACA,2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E,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,UAAU,EAAE,6BAAgB;KAC7B,CAAC;CACH,CAAC,CAAC;AAMU,QAAA,oCAAoC,GAAG,oCAAsB,CAAC;AAM3E,+EAA+E;AAC/E,qBAAqB;AAER,QAAA,6BAA6B,GAAG,IAAA,oBAAM,EAAC;IAClD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,4BAAoB,CAAC,gBAAgB,EAAE,CAAC;IAC3D,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAMU,QAAA,8BAA8B,GAAG,IAAA,mBAAK,EAAC,8BAAuB,CAAC,CAAC;AAM7E,+EAA+E;AAC/E,uBAAuB;AAEV,QAAA,+BAA+B,GAAG,IAAA,oBAAM,EAAC;IACpD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,4BAAoB,CAAC,kBAAkB,EAAE,CAAC;IAC7D,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,MAAM,EAAE,IAAA,mBAAK,EAAC,0BAAmB,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAMU,QAAA,gCAAgC,GAAG,IAAA,oBAAM,EACpD,0BAAmB,EACnB,uBAAa,CACd,CAAC","sourcesContent":["import type { AccountId } from '@metamask/keyring-utils';\nimport { UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n object,\n record,\n string,\n union,\n} from '@metamask/superstruct';\n\nimport { BalanceStruct } from '../../api/balance';\nimport type { Balance } from '../../api/balance';\nimport { CaipAssetTypeOrIdStruct, CaipAssetTypeStruct } from '../../api/caip';\nimport type { CaipAssetType, CaipAssetTypeOrId } from '../../api/caip';\nimport { PaginationStruct } from '../../api/pagination';\nimport type { Pagination } from '../../api/pagination';\nimport { TransactionsPageStruct } from '../../api/transaction';\nimport type { TransactionsPage } from '../../api/transaction';\nimport { KeyringRpcMethod } from './keyring-rpc';\nimport type { KeyringRpc, KeyringRpcRequests } from './keyring-rpc';\n\n/**\n * All keyring RPC methods available to a Snap - includes the base\n * {@link KeyringRpcMethod} set plus snap-specific extensions.\n */\nexport const KeyringSnapRpcMethod = {\n ...KeyringRpcMethod,\n SetSelectedAccounts: 'keyring_setSelectedAccounts',\n GetAccountTransactions: 'keyring_getAccountTransactions',\n GetAccountAssets: 'keyring_getAccountAssets',\n GetAccountBalances: 'keyring_getAccountBalances',\n} as const;\n\n/**\n * All keyring RPC methods available to a Snap.\n */\nexport type KeyringSnapRpcMethod =\n (typeof KeyringSnapRpcMethod)[keyof typeof KeyringSnapRpcMethod];\n\n/**\n * Check if a method is a Snap keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a Snap keyring RPC method (v2).\n */\nexport function isKeyringSnapRpcMethod(\n method: string,\n): method is KeyringSnapRpcMethod {\n return Object.values(KeyringSnapRpcMethod).includes(\n method as KeyringSnapRpcMethod,\n );\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Set selected accounts\n\nexport const SetSelectedAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.SetSelectedAccounts}`),\n params: object({\n accounts: array(string()),\n }),\n});\n\nexport type SetSelectedAccountsRequest = Infer<\n typeof SetSelectedAccountsRequestStruct\n>;\n\nexport const SetSelectedAccountsResponseStruct = literal(null);\n\nexport type SetSelectedAccountsResponse = Infer<\n typeof SetSelectedAccountsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account transactions\n\nexport const GetAccountTransactionsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountTransactions}`),\n params: object({\n id: UuidStruct,\n pagination: PaginationStruct,\n }),\n});\n\nexport type GetAccountTransactionsRequest = Infer<\n typeof GetAccountTransactionsRequestStruct\n>;\n\nexport const GetAccountTransactionsResponseStruct = TransactionsPageStruct;\n\nexport type GetAccountTransactionsResponse = Infer<\n typeof GetAccountTransactionsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account assets\n\nexport const GetAccountAssetsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountAssets}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountAssetsRequest = Infer<\n typeof GetAccountAssetsRequestStruct\n>;\n\nexport const GetAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);\n\nexport type GetAccountAssetsResponse = Infer<\n typeof GetAccountAssetsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * All keyring RPC requests available to a Snap - includes base\n * {@link KeyringRpcRequests} plus snap-specific request types.\n */\nexport type KeyringSnapRpcRequests =\n | KeyringRpcRequests\n | SetSelectedAccountsRequest\n | GetAccountTransactionsRequest\n | GetAccountAssetsRequest\n | GetAccountBalancesRequest;\n\n/**\n * Extract the proper request type for a given {@link KeyringSnapRpcMethod}.\n */\nexport type KeyringSnapRpcRequest<RpcMethod extends KeyringSnapRpcMethod> =\n Extract<KeyringSnapRpcRequests, { method: `${RpcMethod}` }>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Snap keyring RPC interface - extends the base {@link KeyringRpc} with\n * optional snap-specific methods that a Snap may expose.\n */\nexport type KeyringSnapRpc = KeyringRpc & {\n /**\n * Notify the Snap of the currently selected accounts.\n * Maps to `keyring_setSelectedAccounts`.\n */\n setSelectedAccounts?: (accounts: AccountId[]) => Promise<void>;\n\n /**\n * Get transactions for an account with pagination.\n * Maps to `keyring_getAccountTransactions`.\n */\n getAccountTransactions?: (\n id: AccountId,\n pagination: Pagination,\n ) => Promise<TransactionsPage>;\n\n /**\n * Get the asset types supported by an account.\n * Maps to `keyring_getAccountAssets`.\n */\n getAccountAssets?: (id: AccountId) => Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Get balances for an account for the requested asset types.\n * Maps to `keyring_getAccountBalances`.\n */\n getAccountBalances?: (\n id: AccountId,\n assets: CaipAssetType[],\n ) => Promise<Record<CaipAssetType, Balance>>;\n};\n"]}
1
+ {"version":3,"file":"keyring-snap-rpc.cjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-snap-rpc.ts"],"names":[],"mappings":";;;AACA,2DAA2E;AAE3E,uDAS+B;AAE/B,mDAAiE;AAEjE,mDAAkD;AAElD,6CAIwB;AAMxB,yDAAwD;AAExD,2DAA+D;AAE/D,mDAAiD;AAGjD;;;GAGG;AACU,QAAA,oBAAoB,GAAG;IAClC,GAAG,8BAAgB;IACnB,mBAAmB,EAAE,6BAA6B;IAClD,sBAAsB,EAAE,gCAAgC;IACxD,gBAAgB,EAAE,0BAA0B;IAC5C,kBAAkB,EAAE,4BAA4B;IAChD,qBAAqB,EAAE,+BAA+B;CAC9C,CAAC;AAQX;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,MAAc;IAEd,OAAO,MAAM,CAAC,MAAM,CAAC,4BAAoB,CAAC,CAAC,QAAQ,CACjD,MAA8B,CAC/B,CAAC;AACJ,CAAC;AAND,wDAMC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC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IAAA,oBAAM,EAAC;IACpD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,4BAAoB,CAAC,kBAAkB,EAAE,CAAC;IAC7D,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,MAAM,EAAE,IAAA,mBAAK,EAAC,0BAAmB,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAMU,QAAA,gCAAgC,GAAG,IAAA,oBAAM,EACpD,0BAAmB,EACnB,uBAAa,CACd,CAAC;AAMF,+EAA+E;AAC/E,0BAA0B;AAEb,QAAA,kCAAkC,GAAG,IAAA,oBAAM,EAAC;IACvD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,4BAAoB,CAAC,qBAAqB,EAAE,CAAC;IAChE,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,KAAK,EAAE,wBAAiB;QACxB,OAAO,EAAE,oCAAoB;KAC9B,CAAC;CACH,CAAC,CAAC;AAMU,QAAA,mCAAmC,GAAG,IAAA,sBAAQ,EACzD,sCAA4B,CAC7B,CAAC","sourcesContent":["import type { AccountId, JsonRpcRequest } from '@metamask/keyring-utils';\nimport { UuidStruct, JsonRpcRequestStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n nullable,\n number,\n object,\n record,\n string,\n union,\n} from '@metamask/superstruct';\n\nimport { ResolvedAccountAddressStruct } from '../../api/address';\nimport type { ResolvedAccountAddress } from '../../api/address';\nimport { BalanceStruct } from '../../api/balance';\nimport type { Balance } from '../../api/balance';\nimport {\n CaipAssetTypeOrIdStruct,\n CaipAssetTypeStruct,\n CaipChainIdStruct,\n} from '../../api/caip';\nimport type {\n CaipAssetType,\n CaipAssetTypeOrId,\n CaipChainId,\n} from '../../api/caip';\nimport { PaginationStruct } from '../../api/pagination';\nimport type { Pagination } from '../../api/pagination';\nimport { TransactionsPageStruct } from '../../api/transaction';\nimport type { TransactionsPage } from '../../api/transaction';\nimport { KeyringRpcMethod } from './keyring-rpc';\nimport type { KeyringRpc, KeyringRpcRequests } from './keyring-rpc';\n\n/**\n * All keyring RPC methods available to a Snap - includes the base\n * {@link KeyringRpcMethod} set plus snap-specific extensions.\n */\nexport const KeyringSnapRpcMethod = {\n ...KeyringRpcMethod,\n SetSelectedAccounts: 'keyring_setSelectedAccounts',\n GetAccountTransactions: 'keyring_getAccountTransactions',\n GetAccountAssets: 'keyring_getAccountAssets',\n GetAccountBalances: 'keyring_getAccountBalances',\n ResolveAccountAddress: 'keyring_resolveAccountAddress',\n} as const;\n\n/**\n * All keyring RPC methods available to a Snap.\n */\nexport type KeyringSnapRpcMethod =\n (typeof KeyringSnapRpcMethod)[keyof typeof KeyringSnapRpcMethod];\n\n/**\n * Check if a method is a Snap keyring RPC method (v2).\n *\n * @param method - Method to check.\n * @returns Whether the method is a Snap keyring RPC method (v2).\n */\nexport function isKeyringSnapRpcMethod(\n method: string,\n): method is KeyringSnapRpcMethod {\n return Object.values(KeyringSnapRpcMethod).includes(\n method as KeyringSnapRpcMethod,\n );\n}\n\n// ----------------------------------------------------------------------------\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// Set selected accounts\n\nexport const SetSelectedAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.SetSelectedAccounts}`),\n params: object({\n accounts: array(string()),\n }),\n});\n\nexport type SetSelectedAccountsRequest = Infer<\n typeof SetSelectedAccountsRequestStruct\n>;\n\nexport const SetSelectedAccountsResponseStruct = literal(null);\n\nexport type SetSelectedAccountsResponse = Infer<\n typeof SetSelectedAccountsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account transactions\n\nexport const GetAccountTransactionsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountTransactions}`),\n params: object({\n id: UuidStruct,\n pagination: PaginationStruct,\n }),\n});\n\nexport type GetAccountTransactionsRequest = Infer<\n typeof GetAccountTransactionsRequestStruct\n>;\n\nexport const GetAccountTransactionsResponseStruct = TransactionsPageStruct;\n\nexport type GetAccountTransactionsResponse = Infer<\n typeof GetAccountTransactionsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account assets\n\nexport const GetAccountAssetsRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountAssets}`),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountAssetsRequest = Infer<\n typeof GetAccountAssetsRequestStruct\n>;\n\nexport const GetAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);\n\nexport type GetAccountAssetsResponse = Infer<\n typeof GetAccountAssetsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Resolve account address\n\nexport const ResolveAccountAddressRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringSnapRpcMethod.ResolveAccountAddress}`),\n params: object({\n scope: CaipChainIdStruct,\n request: JsonRpcRequestStruct,\n }),\n});\n\nexport type ResolveAccountAddressRequest = Infer<\n typeof ResolveAccountAddressRequestStruct\n>;\n\nexport const ResolveAccountAddressResponseStruct = nullable(\n ResolvedAccountAddressStruct,\n);\n\nexport type ResolveAccountAddressResponse = Infer<\n typeof ResolveAccountAddressResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * All keyring RPC requests available to a Snap - includes base\n * {@link KeyringRpcRequests} plus snap-specific request types.\n */\nexport type KeyringSnapRpcRequests =\n | KeyringRpcRequests\n | SetSelectedAccountsRequest\n | GetAccountTransactionsRequest\n | GetAccountAssetsRequest\n | GetAccountBalancesRequest\n | ResolveAccountAddressRequest;\n\n/**\n * Extract the proper request type for a given {@link KeyringSnapRpcMethod}.\n */\nexport type KeyringSnapRpcRequest<RpcMethod extends KeyringSnapRpcMethod> =\n Extract<KeyringSnapRpcRequests, { method: `${RpcMethod}` }>;\n\n// ----------------------------------------------------------------------------\n\n/**\n * Snap keyring RPC interface - extends the base {@link KeyringRpc} with\n * optional snap-specific methods that a Snap may expose.\n */\nexport type KeyringSnapRpc = KeyringRpc & {\n /**\n * Notify the Snap of the currently selected accounts.\n * Maps to `keyring_setSelectedAccounts`.\n */\n setSelectedAccounts?: (accounts: AccountId[]) => Promise<void>;\n\n /**\n * Get transactions for an account with pagination.\n * Maps to `keyring_getAccountTransactions`.\n */\n getAccountTransactions?: (\n id: AccountId,\n pagination: Pagination,\n ) => Promise<TransactionsPage>;\n\n /**\n * Get the asset types supported by an account.\n * Maps to `keyring_getAccountAssets`.\n */\n getAccountAssets?: (id: AccountId) => Promise<CaipAssetTypeOrId[]>;\n\n /**\n * Get balances for an account for the requested asset types.\n * Maps to `keyring_getAccountBalances`.\n */\n getAccountBalances?: (\n id: AccountId,\n assets: CaipAssetType[],\n ) => Promise<Record<CaipAssetType, Balance>>;\n\n /**\n * Resolve the account address to use for routing a signing request.\n * Maps to `keyring_resolveAccountAddress`.\n */\n resolveAccountAddress?: (\n scope: CaipChainId,\n request: JsonRpcRequest,\n ) => Promise<ResolvedAccountAddress | null>;\n};\n"]}
@@ -1,7 +1,8 @@
1
- import type { AccountId } from "@metamask/keyring-utils";
1
+ import type { AccountId, JsonRpcRequest } from "@metamask/keyring-utils";
2
2
  import type { Infer } from "@metamask/superstruct";
3
+ import type { ResolvedAccountAddress } from "../../api/address.cjs";
3
4
  import type { Balance } from "../../api/balance.cjs";
4
- import type { CaipAssetType, CaipAssetTypeOrId } from "../../api/caip.cjs";
5
+ import type { CaipAssetType, CaipAssetTypeOrId, CaipChainId } from "../../api/caip.cjs";
5
6
  import type { Pagination } from "../../api/pagination.cjs";
6
7
  import type { TransactionsPage } from "../../api/transaction.cjs";
7
8
  import type { KeyringRpc, KeyringRpcRequests } from "./keyring-rpc.cjs";
@@ -14,6 +15,7 @@ export declare const KeyringSnapRpcMethod: {
14
15
  readonly GetAccountTransactions: "keyring_getAccountTransactions";
15
16
  readonly GetAccountAssets: "keyring_getAccountAssets";
16
17
  readonly GetAccountBalances: "keyring_getAccountBalances";
18
+ readonly ResolveAccountAddress: "keyring_resolveAccountAddress";
17
19
  readonly GetAccounts: "keyring_getAccounts";
18
20
  readonly CreateAccounts: "keyring_createAccounts";
19
21
  readonly GetAccount: "keyring_getAccount";
@@ -78,7 +80,7 @@ export declare const GetAccountTransactionsRequestStruct: import("@metamask/supe
78
80
  next?: string | null;
79
81
  }, {
80
82
  limit: import("@metamask/superstruct").Struct<number, null>;
81
- next: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag | null, null>;
83
+ next: import("@metamask/superstruct").ExactOptionalStruct<string | null, null>;
82
84
  }>;
83
85
  }>;
84
86
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
@@ -388,18 +390,18 @@ export declare const GetAccountTransactionsResponseStruct: import("@metamask/sup
388
390
  }>;
389
391
  timestamp: import("@metamask/superstruct").Struct<number | null, null>;
390
392
  }>>;
391
- details: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
393
+ details: import("@metamask/superstruct").ExactOptionalStruct<{
392
394
  origin?: string;
393
395
  securityAlertResponse?: "Benign" | "Warning" | "Malicious";
394
396
  typeLabel?: string;
395
397
  }, {
396
- origin: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
397
- securityAlertResponse: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | "Benign" | "Warning" | "Malicious", {
398
+ origin: import("@metamask/superstruct").ExactOptionalStruct<string, null>;
399
+ securityAlertResponse: import("@metamask/superstruct").ExactOptionalStruct<"Benign" | "Warning" | "Malicious", {
398
400
  Benign: "Benign";
399
401
  Warning: "Warning";
400
402
  Malicious: "Malicious";
401
403
  }>;
402
- typeLabel: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
404
+ typeLabel: import("@metamask/superstruct").ExactOptionalStruct<string, null>;
403
405
  }>;
404
406
  }>>;
405
407
  next: import("@metamask/superstruct").Struct<string | null, null>;
@@ -451,11 +453,58 @@ export declare const GetAccountBalancesResponseStruct: import("@metamask/superst
451
453
  amount: string;
452
454
  }>, null>;
453
455
  export type GetAccountBalancesResponse = Infer<typeof GetAccountBalancesResponseStruct>;
456
+ export declare const ResolveAccountAddressRequestStruct: import("@metamask/superstruct").Struct<{
457
+ method: "keyring_resolveAccountAddress";
458
+ id: string | number | null;
459
+ jsonrpc: "2.0";
460
+ params: {
461
+ request: {
462
+ method: string;
463
+ id: string | number | null;
464
+ jsonrpc: "2.0";
465
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
466
+ };
467
+ scope: `${string}:${string}`;
468
+ };
469
+ }, {
470
+ method: import("@metamask/superstruct").Struct<"keyring_resolveAccountAddress", "keyring_resolveAccountAddress">;
471
+ params: import("@metamask/superstruct").Struct<{
472
+ request: {
473
+ method: string;
474
+ id: string | number | null;
475
+ jsonrpc: "2.0";
476
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
477
+ };
478
+ scope: `${string}:${string}`;
479
+ }, {
480
+ scope: import("@metamask/superstruct").Struct<`${string}:${string}`, null>;
481
+ request: import("@metamask/superstruct").Struct<{
482
+ method: string;
483
+ id: string | number | null;
484
+ jsonrpc: "2.0";
485
+ params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
486
+ }, {
487
+ jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
488
+ id: import("@metamask/superstruct").Struct<string | number | null, null>;
489
+ method: import("@metamask/superstruct").Struct<string, null>;
490
+ params: import("@metamask/superstruct").ExactOptionalStruct<Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[], null>;
491
+ }>;
492
+ }>;
493
+ jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
494
+ id: import("@metamask/superstruct").Struct<string | number | null, null>;
495
+ }>;
496
+ export type ResolveAccountAddressRequest = Infer<typeof ResolveAccountAddressRequestStruct>;
497
+ export declare const ResolveAccountAddressResponseStruct: import("@metamask/superstruct").Struct<{
498
+ address: `${string}:${string}:${string}`;
499
+ } | null, {
500
+ address: import("@metamask/superstruct").Struct<`${string}:${string}:${string}`, null>;
501
+ }>;
502
+ export type ResolveAccountAddressResponse = Infer<typeof ResolveAccountAddressResponseStruct>;
454
503
  /**
455
504
  * All keyring RPC requests available to a Snap - includes base
456
505
  * {@link KeyringRpcRequests} plus snap-specific request types.
457
506
  */
458
- export type KeyringSnapRpcRequests = KeyringRpcRequests | SetSelectedAccountsRequest | GetAccountTransactionsRequest | GetAccountAssetsRequest | GetAccountBalancesRequest;
507
+ export type KeyringSnapRpcRequests = KeyringRpcRequests | SetSelectedAccountsRequest | GetAccountTransactionsRequest | GetAccountAssetsRequest | GetAccountBalancesRequest | ResolveAccountAddressRequest;
459
508
  /**
460
509
  * Extract the proper request type for a given {@link KeyringSnapRpcMethod}.
461
510
  */
@@ -487,5 +536,10 @@ export type KeyringSnapRpc = KeyringRpc & {
487
536
  * Maps to `keyring_getAccountBalances`.
488
537
  */
489
538
  getAccountBalances?: (id: AccountId, assets: CaipAssetType[]) => Promise<Record<CaipAssetType, Balance>>;
539
+ /**
540
+ * Resolve the account address to use for routing a signing request.
541
+ * Maps to `keyring_resolveAccountAddress`.
542
+ */
543
+ resolveAccountAddress?: (scope: CaipChainId, request: JsonRpcRequest) => Promise<ResolvedAccountAddress | null>;
490
544
  };
491
545
  //# sourceMappingURL=keyring-snap-rpc.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyring-snap-rpc.d.cts","sourceRoot":"","sources":["../../../src/v2/api/keyring-snap-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gCAAgC;AAEzD,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAYnD,OAAO,KAAK,EAAE,OAAO,EAAE,8BAA0B;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,2BAAuB;AAEvE,OAAO,KAAK,EAAE,UAAU,EAAE,iCAA6B;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,kCAA8B;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,0BAAsB;AAEpE;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;CAMvB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC9B,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAEnE;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,GACb,MAAM,IAAI,oBAAoB,CAIhC;AAYD,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;EAM3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAC5C,OAAO,gCAAgC,CACxC,CAAC;AAEF,eAAO,MAAM,iCAAiC,oDAAgB,CAAC;AAE/D,MAAM,MAAM,2BAA2B,GAAG,KAAK,CAC7C,OAAO,iCAAiC,CACzC,CAAC;AAKF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO9C,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,KAAK,CAC/C,OAAO,mCAAmC,CAC3C,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;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