@metamask-previews/keyring-api 11.1.0-72196d6 → 11.1.0-e345222

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 (251) hide show
  1. package/dist/JsonRpcRequest.cjs +13 -0
  2. package/dist/JsonRpcRequest.cjs.map +1 -0
  3. package/dist/JsonRpcRequest.d.cts +17 -0
  4. package/dist/JsonRpcRequest.d.cts.map +1 -0
  5. package/dist/JsonRpcRequest.d.mts +17 -0
  6. package/dist/JsonRpcRequest.d.mts.map +1 -0
  7. package/dist/JsonRpcRequest.mjs +10 -0
  8. package/dist/JsonRpcRequest.mjs.map +1 -0
  9. package/dist/KeyringClient.cjs +130 -0
  10. package/dist/KeyringClient.cjs.map +1 -0
  11. package/dist/KeyringClient.d.cts +31 -0
  12. package/dist/KeyringClient.d.cts.map +1 -0
  13. package/dist/KeyringClient.d.mts +31 -0
  14. package/dist/KeyringClient.d.mts.map +1 -0
  15. package/dist/KeyringClient.mjs +126 -0
  16. package/dist/KeyringClient.mjs.map +1 -0
  17. package/dist/KeyringSnapRpcClient.cjs +68 -0
  18. package/dist/KeyringSnapRpcClient.cjs.map +1 -0
  19. package/dist/KeyringSnapRpcClient.d.cts +40 -0
  20. package/dist/KeyringSnapRpcClient.d.cts.map +1 -0
  21. package/dist/KeyringSnapRpcClient.d.mts +40 -0
  22. package/dist/KeyringSnapRpcClient.d.mts.map +1 -0
  23. package/dist/KeyringSnapRpcClient.mjs +63 -0
  24. package/dist/KeyringSnapRpcClient.mjs.map +1 -0
  25. package/dist/api/account.cjs +4 -3
  26. package/dist/api/account.cjs.map +1 -1
  27. package/dist/api/account.d.cts +1 -1
  28. package/dist/api/account.d.cts.map +1 -1
  29. package/dist/api/account.d.mts +1 -1
  30. package/dist/api/account.d.mts.map +1 -1
  31. package/dist/api/account.mjs +2 -1
  32. package/dist/api/account.mjs.map +1 -1
  33. package/dist/api/asset.cjs +6 -5
  34. package/dist/api/asset.cjs.map +1 -1
  35. package/dist/api/asset.d.cts +2 -2
  36. package/dist/api/asset.d.cts.map +1 -1
  37. package/dist/api/asset.d.mts +2 -2
  38. package/dist/api/asset.d.mts.map +1 -1
  39. package/dist/api/asset.mjs +2 -1
  40. package/dist/api/asset.mjs.map +1 -1
  41. package/dist/api/balance.cjs +4 -3
  42. package/dist/api/balance.cjs.map +1 -1
  43. package/dist/api/balance.d.cts.map +1 -1
  44. package/dist/api/balance.d.mts.map +1 -1
  45. package/dist/api/balance.mjs +2 -1
  46. package/dist/api/balance.mjs.map +1 -1
  47. package/dist/api/caip.cjs +3 -3
  48. package/dist/api/caip.cjs.map +1 -1
  49. package/dist/api/caip.d.cts.map +1 -1
  50. package/dist/api/caip.d.mts.map +1 -1
  51. package/dist/api/caip.mjs +1 -1
  52. package/dist/api/caip.mjs.map +1 -1
  53. package/dist/api/keyring.cjs +0 -2
  54. package/dist/api/keyring.cjs.map +1 -1
  55. package/dist/api/keyring.d.cts.map +1 -1
  56. package/dist/api/keyring.d.mts.map +1 -1
  57. package/dist/api/keyring.mjs +0 -2
  58. package/dist/api/keyring.mjs.map +1 -1
  59. package/dist/api/request.cjs +7 -6
  60. package/dist/api/request.cjs.map +1 -1
  61. package/dist/api/request.d.cts +5 -5
  62. package/dist/api/request.d.cts.map +1 -1
  63. package/dist/api/request.d.mts +5 -5
  64. package/dist/api/request.d.mts.map +1 -1
  65. package/dist/api/request.mjs +2 -1
  66. package/dist/api/request.mjs.map +1 -1
  67. package/dist/api/response.cjs +6 -6
  68. package/dist/api/response.cjs.map +1 -1
  69. package/dist/api/response.d.cts +1 -1
  70. package/dist/api/response.d.cts.map +1 -1
  71. package/dist/api/response.d.mts +1 -1
  72. package/dist/api/response.d.mts.map +1 -1
  73. package/dist/api/response.mjs +1 -1
  74. package/dist/api/response.mjs.map +1 -1
  75. package/dist/api/transaction.cjs +8 -7
  76. package/dist/api/transaction.cjs.map +1 -1
  77. package/dist/api/transaction.d.cts +64 -64
  78. package/dist/api/transaction.d.cts.map +1 -1
  79. package/dist/api/transaction.d.mts +64 -64
  80. package/dist/api/transaction.d.mts.map +1 -1
  81. package/dist/api/transaction.mjs +2 -1
  82. package/dist/api/transaction.mjs.map +1 -1
  83. package/dist/btc/types.cjs +2 -2
  84. package/dist/btc/types.cjs.map +1 -1
  85. package/dist/btc/types.d.cts +1 -1
  86. package/dist/btc/types.d.cts.map +1 -1
  87. package/dist/btc/types.d.mts +1 -1
  88. package/dist/btc/types.d.mts.map +1 -1
  89. package/dist/btc/types.mjs +2 -2
  90. package/dist/btc/types.mjs.map +1 -1
  91. package/dist/eth/erc4337/types.cjs +11 -10
  92. package/dist/eth/erc4337/types.cjs.map +1 -1
  93. package/dist/eth/erc4337/types.d.cts +5 -5
  94. package/dist/eth/erc4337/types.d.cts.map +1 -1
  95. package/dist/eth/erc4337/types.d.mts +5 -5
  96. package/dist/eth/erc4337/types.d.mts.map +1 -1
  97. package/dist/eth/erc4337/types.mjs +2 -1
  98. package/dist/eth/erc4337/types.mjs.map +1 -1
  99. package/dist/eth/types.cjs +6 -6
  100. package/dist/eth/types.cjs.map +1 -1
  101. package/dist/eth/types.d.cts +2 -2
  102. package/dist/eth/types.d.cts.map +1 -1
  103. package/dist/eth/types.d.mts +2 -2
  104. package/dist/eth/types.d.mts.map +1 -1
  105. package/dist/eth/types.mjs +1 -1
  106. package/dist/eth/types.mjs.map +1 -1
  107. package/dist/eth/utils.cjs.map +1 -1
  108. package/dist/eth/utils.d.cts.map +1 -1
  109. package/dist/eth/utils.d.mts.map +1 -1
  110. package/dist/eth/utils.mjs.map +1 -1
  111. package/dist/events.cjs +1 -67
  112. package/dist/events.cjs.map +1 -1
  113. package/dist/events.d.cts +0 -161
  114. package/dist/events.d.cts.map +1 -1
  115. package/dist/events.d.mts +0 -161
  116. package/dist/events.d.mts.map +1 -1
  117. package/dist/events.mjs +0 -66
  118. package/dist/events.mjs.map +1 -1
  119. package/dist/index.cjs +8 -3
  120. package/dist/index.cjs.map +1 -1
  121. package/dist/index.d.cts +9 -4
  122. package/dist/index.d.cts.map +1 -1
  123. package/dist/index.d.mts +9 -4
  124. package/dist/index.d.mts.map +1 -1
  125. package/dist/index.mjs +8 -3
  126. package/dist/index.mjs.map +1 -1
  127. package/dist/internal/api.cjs +150 -0
  128. package/dist/internal/api.cjs.map +1 -0
  129. package/dist/internal/api.d.cts +737 -0
  130. package/dist/internal/api.d.cts.map +1 -0
  131. package/dist/internal/api.d.mts +737 -0
  132. package/dist/internal/api.d.mts.map +1 -0
  133. package/dist/internal/api.mjs +147 -0
  134. package/dist/internal/api.mjs.map +1 -0
  135. package/dist/internal/eth/EthKeyring.cjs +3 -0
  136. package/dist/internal/eth/EthKeyring.cjs.map +1 -0
  137. package/dist/internal/eth/EthKeyring.d.cts +34 -0
  138. package/dist/internal/eth/EthKeyring.d.cts.map +1 -0
  139. package/dist/internal/eth/EthKeyring.d.mts +34 -0
  140. package/dist/internal/eth/EthKeyring.d.mts.map +1 -0
  141. package/dist/internal/eth/EthKeyring.mjs +2 -0
  142. package/dist/internal/eth/EthKeyring.mjs.map +1 -0
  143. package/dist/internal/eth/index.cjs +3 -0
  144. package/dist/internal/eth/index.cjs.map +1 -0
  145. package/dist/internal/eth/index.d.cts +2 -0
  146. package/dist/internal/eth/index.d.cts.map +1 -0
  147. package/dist/internal/eth/index.d.mts +2 -0
  148. package/dist/internal/eth/index.d.mts.map +1 -0
  149. package/dist/internal/eth/index.mjs +2 -0
  150. package/dist/internal/eth/index.mjs.map +1 -0
  151. package/dist/internal/events.cjs +72 -0
  152. package/dist/internal/events.cjs.map +1 -0
  153. package/dist/internal/events.d.cts +162 -0
  154. package/dist/internal/events.d.cts.map +1 -0
  155. package/dist/internal/events.d.mts +162 -0
  156. package/dist/internal/events.d.mts.map +1 -0
  157. package/dist/internal/events.mjs +69 -0
  158. package/dist/internal/events.mjs.map +1 -0
  159. package/dist/internal/index.cjs +21 -0
  160. package/dist/internal/index.cjs.map +1 -0
  161. package/dist/internal/index.d.cts +6 -0
  162. package/dist/internal/index.d.cts.map +1 -0
  163. package/dist/internal/index.d.mts +6 -0
  164. package/dist/internal/index.d.mts.map +1 -0
  165. package/dist/internal/index.mjs +5 -0
  166. package/dist/internal/index.mjs.map +1 -0
  167. package/dist/internal/rpc.cjs.map +1 -0
  168. package/dist/internal/rpc.d.cts.map +1 -0
  169. package/dist/internal/rpc.d.mts.map +1 -0
  170. package/dist/internal/rpc.mjs.map +1 -0
  171. package/dist/internal/types.cjs +52 -0
  172. package/dist/internal/types.cjs.map +1 -0
  173. package/dist/internal/types.d.cts +392 -0
  174. package/dist/internal/types.d.cts.map +1 -0
  175. package/dist/internal/types.d.mts +392 -0
  176. package/dist/internal/types.d.mts.map +1 -0
  177. package/dist/internal/types.mjs +49 -0
  178. package/dist/internal/types.mjs.map +1 -0
  179. package/dist/rpc-handler.cjs +143 -0
  180. package/dist/rpc-handler.cjs.map +1 -0
  181. package/dist/rpc-handler.d.cts +30 -0
  182. package/dist/rpc-handler.d.cts.map +1 -0
  183. package/dist/rpc-handler.d.mts +30 -0
  184. package/dist/rpc-handler.d.mts.map +1 -0
  185. package/dist/rpc-handler.mjs +138 -0
  186. package/dist/rpc-handler.mjs.map +1 -0
  187. package/dist/snap-utils.cjs +20 -0
  188. package/dist/snap-utils.cjs.map +1 -0
  189. package/dist/snap-utils.d.cts +12 -0
  190. package/dist/snap-utils.d.cts.map +1 -0
  191. package/dist/snap-utils.d.mts +12 -0
  192. package/dist/snap-utils.d.mts.map +1 -0
  193. package/dist/snap-utils.mjs +17 -0
  194. package/dist/snap-utils.mjs.map +1 -0
  195. package/dist/sol/types.cjs +3 -3
  196. package/dist/sol/types.cjs.map +1 -1
  197. package/dist/sol/types.d.cts +1 -1
  198. package/dist/sol/types.d.cts.map +1 -1
  199. package/dist/sol/types.d.mts +1 -1
  200. package/dist/sol/types.d.mts.map +1 -1
  201. package/dist/sol/types.mjs +1 -1
  202. package/dist/sol/types.mjs.map +1 -1
  203. package/dist/superstruct.cjs +109 -0
  204. package/dist/superstruct.cjs.map +1 -0
  205. package/dist/superstruct.d.cts +102 -0
  206. package/dist/superstruct.d.cts.map +1 -0
  207. package/dist/superstruct.d.mts +102 -0
  208. package/dist/superstruct.d.mts.map +1 -0
  209. package/dist/superstruct.mjs +102 -0
  210. package/dist/superstruct.mjs.map +1 -0
  211. package/dist/utils/index.cjs +2 -0
  212. package/dist/utils/index.cjs.map +1 -1
  213. package/dist/utils/index.d.cts +2 -0
  214. package/dist/utils/index.d.cts.map +1 -1
  215. package/dist/utils/index.d.mts +2 -0
  216. package/dist/utils/index.d.mts.map +1 -1
  217. package/dist/utils/index.mjs +2 -0
  218. package/dist/utils/index.mjs.map +1 -1
  219. package/dist/utils/pagination.cjs +3 -3
  220. package/dist/utils/pagination.cjs.map +1 -1
  221. package/dist/utils/pagination.d.cts +1 -1
  222. package/dist/utils/pagination.d.cts.map +1 -1
  223. package/dist/utils/pagination.d.mts +1 -1
  224. package/dist/utils/pagination.d.mts.map +1 -1
  225. package/dist/utils/pagination.mjs +1 -1
  226. package/dist/utils/pagination.mjs.map +1 -1
  227. package/dist/utils/types.cjs +29 -0
  228. package/dist/utils/types.cjs.map +1 -0
  229. package/dist/utils/types.d.cts +42 -0
  230. package/dist/utils/types.d.cts.map +1 -0
  231. package/dist/utils/types.d.mts +42 -0
  232. package/dist/utils/types.d.mts.map +1 -0
  233. package/dist/utils/types.mjs +26 -0
  234. package/dist/utils/types.mjs.map +1 -0
  235. package/dist/utils/typing.cjs +20 -0
  236. package/dist/utils/typing.cjs.map +1 -0
  237. package/dist/utils/typing.d.cts +33 -0
  238. package/dist/utils/typing.d.cts.map +1 -0
  239. package/dist/utils/typing.d.mts +33 -0
  240. package/dist/utils/typing.d.mts.map +1 -0
  241. package/dist/utils/typing.mjs +17 -0
  242. package/dist/utils/typing.mjs.map +1 -0
  243. package/package.json +12 -9
  244. package/dist/rpc.cjs.map +0 -1
  245. package/dist/rpc.d.cts.map +0 -1
  246. package/dist/rpc.d.mts.map +0 -1
  247. package/dist/rpc.mjs.map +0 -1
  248. /package/dist/{rpc.cjs → internal/rpc.cjs} +0 -0
  249. /package/dist/{rpc.d.cts → internal/rpc.d.cts} +0 -0
  250. /package/dist/{rpc.d.mts → internal/rpc.d.mts} +0 -0
  251. /package/dist/{rpc.mjs → internal/rpc.mjs} +0 -0
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KeyringRequestStruct = void 0;
4
- const keyring_utils_1 = require("@metamask/keyring-utils");
5
4
  const superstruct_1 = require("@metamask/superstruct");
6
5
  const utils_1 = require("@metamask/utils");
7
- exports.KeyringRequestStruct = (0, keyring_utils_1.object)({
6
+ const superstruct_2 = require("../superstruct.cjs");
7
+ const utils_2 = require("../utils/index.cjs");
8
+ exports.KeyringRequestStruct = (0, superstruct_2.object)({
8
9
  /**
9
10
  * Keyring request ID (UUIDv4).
10
11
  */
11
- id: keyring_utils_1.UuidStruct,
12
+ id: utils_2.UuidStruct,
12
13
  /**
13
14
  * Request's scope (CAIP-2 chain ID).
14
15
  */
@@ -16,13 +17,13 @@ exports.KeyringRequestStruct = (0, keyring_utils_1.object)({
16
17
  /**
17
18
  * Account ID (UUIDv4).
18
19
  */
19
- account: keyring_utils_1.UuidStruct,
20
+ account: utils_2.UuidStruct,
20
21
  /**
21
22
  * Inner request sent by the client application.
22
23
  */
23
- request: (0, keyring_utils_1.object)({
24
+ request: (0, superstruct_2.object)({
24
25
  method: (0, superstruct_1.string)(),
25
- params: (0, keyring_utils_1.exactOptional)((0, superstruct_1.union)([(0, superstruct_1.array)(utils_1.JsonStruct), (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct)])),
26
+ params: (0, superstruct_2.exactOptional)((0, superstruct_1.union)([(0, superstruct_1.array)(utils_1.JsonStruct), (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct)])),
26
27
  }),
27
28
  });
28
29
  //# sourceMappingURL=request.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.cjs","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":";;;AAAA,2DAA4E;AAE5E,uDAAqE;AACrE,2CAA6C;AAEhC,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,0BAAU;IAEd;;OAEG;IACH,KAAK,EAAE,IAAA,oBAAM,GAAE;IAEf;;OAEG;IACH,OAAO,EAAE,0BAAU;IAEnB;;OAEG;IACH,OAAO,EAAE,IAAA,sBAAM,EAAC;QACd,MAAM,EAAE,IAAA,oBAAM,GAAE;QAChB,MAAM,EAAE,IAAA,6BAAa,EACnB,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,kBAAU,CAAC,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,CACzD;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, record, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringRequestStruct = object({\n /**\n * Keyring request ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Request's scope (CAIP-2 chain ID).\n */\n scope: string(),\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Inner request sent by the client application.\n */\n request: object({\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n }),\n});\n\n/**\n * Keyring request.\n *\n * Represents a request made to the keyring for account-related operations.\n */\nexport type KeyringRequest = Infer<typeof KeyringRequestStruct>;\n"]}
1
+ {"version":3,"file":"request.cjs","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":";;;AACA,uDAAqE;AACrE,2CAA6C;AAE7C,oDAAuD;AACvD,8CAAsC;AAEzB,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC;;OAEG;IACH,EAAE,EAAE,kBAAU;IAEd;;OAEG;IACH,KAAK,EAAE,IAAA,oBAAM,GAAE;IAEf;;OAEG;IACH,OAAO,EAAE,kBAAU;IAEnB;;OAEG;IACH,OAAO,EAAE,IAAA,oBAAM,EAAC;QACd,MAAM,EAAE,IAAA,oBAAM,GAAE;QAChB,MAAM,EAAE,IAAA,2BAAa,EACnB,IAAA,mBAAK,EAAC,CAAC,IAAA,mBAAK,EAAC,kBAAU,CAAC,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC,CAAC,CAAC,CACzD;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, record, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\nexport const KeyringRequestStruct = object({\n /**\n * Keyring request ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Request's scope (CAIP-2 chain ID).\n */\n scope: string(),\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Inner request sent by the client application.\n */\n request: object({\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n }),\n});\n\n/**\n * Keyring request.\n *\n * Represents a request made to the keyring for account-related operations.\n */\nexport type KeyringRequest = Infer<typeof KeyringRequestStruct>;\n"]}
@@ -1,12 +1,12 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  export declare const KeyringRequestStruct: import("@metamask/superstruct").Struct<{
3
3
  id: string;
4
+ scope: string;
5
+ account: string;
4
6
  request: {
5
7
  method: string;
6
- params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
8
+ params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
7
9
  };
8
- scope: string;
9
- account: string;
10
10
  }, {
11
11
  /**
12
12
  * Keyring request ID (UUIDv4).
@@ -25,10 +25,10 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
25
25
  */
26
26
  request: import("@metamask/superstruct").Struct<{
27
27
  method: string;
28
- params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
28
+ params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
29
29
  }, {
30
30
  method: import("@metamask/superstruct").Struct<string, null>;
31
- params: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[], null>;
31
+ params: import("@metamask/superstruct").Struct<import("../superstruct.cjs").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
32
32
  }>;
33
33
  }>;
34
34
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.cts","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,oBAAoB;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;EAOH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"request.d.cts","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAOnD,eAAO,MAAM,oBAAoB;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;EAOH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  export declare const KeyringRequestStruct: import("@metamask/superstruct").Struct<{
3
3
  id: string;
4
+ scope: string;
5
+ account: string;
4
6
  request: {
5
7
  method: string;
6
- params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
8
+ params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
7
9
  };
8
- scope: string;
9
- account: string;
10
10
  }, {
11
11
  /**
12
12
  * Keyring request ID (UUIDv4).
@@ -25,10 +25,10 @@ export declare const KeyringRequestStruct: import("@metamask/superstruct").Struc
25
25
  */
26
26
  request: import("@metamask/superstruct").Struct<{
27
27
  method: string;
28
- params?: Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[];
28
+ params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
29
29
  }, {
30
30
  method: import("@metamask/superstruct").Struct<string, null>;
31
- params: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | Record<string, import("@metamask/utils").Json> | import("@metamask/utils").Json[], null>;
31
+ params: import("@metamask/superstruct").Struct<import("../superstruct.mjs").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
32
32
  }>;
33
33
  }>;
34
34
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.mts","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,oBAAoB;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;EAOH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"request.d.mts","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAOnD,eAAO,MAAM,oBAAoB;;;;;;;;;IAC/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;EAOH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
- import { exactOptional, object, UuidStruct } from "@metamask/keyring-utils";
2
1
  import { array, record, string, union } from "@metamask/superstruct";
3
2
  import { JsonStruct } from "@metamask/utils";
3
+ import { exactOptional, object } from "../superstruct.mjs";
4
+ import { UuidStruct } from "../utils/index.mjs";
4
5
  export const KeyringRequestStruct = object({
5
6
  /**
6
7
  * Keyring request ID (UUIDv4).
@@ -1 +1 @@
1
- {"version":3,"file":"request.mjs","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAE5E,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AACrE,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,EAAE,EAAE,UAAU;IAEd;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE;IAEf;;OAEG;IACH,OAAO,EAAE,UAAU;IAEnB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,EAAE;QAChB,MAAM,EAAE,aAAa,CACnB,KAAK,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CACzD;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, record, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringRequestStruct = object({\n /**\n * Keyring request ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Request's scope (CAIP-2 chain ID).\n */\n scope: string(),\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Inner request sent by the client application.\n */\n request: object({\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n }),\n});\n\n/**\n * Keyring request.\n *\n * Represents a request made to the keyring for account-related operations.\n */\nexport type KeyringRequest = Infer<typeof KeyringRequestStruct>;\n"]}
1
+ {"version":3,"file":"request.mjs","sourceRoot":"","sources":["../../src/api/request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AACrE,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,2BAAuB;AACvD,OAAO,EAAE,UAAU,EAAE,2BAAiB;AAEtC,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,EAAE,EAAE,UAAU;IAEd;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE;IAEf;;OAEG;IACH,OAAO,EAAE,UAAU;IAEnB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,EAAE;QAChB,MAAM,EAAE,aAAa,CACnB,KAAK,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CACzD;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, record, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from '../superstruct';\nimport { UuidStruct } from '../utils';\n\nexport const KeyringRequestStruct = object({\n /**\n * Keyring request ID (UUIDv4).\n */\n id: UuidStruct,\n\n /**\n * Request's scope (CAIP-2 chain ID).\n */\n scope: string(),\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Inner request sent by the client application.\n */\n request: object({\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n }),\n});\n\n/**\n * Keyring request.\n *\n * Represents a request made to the keyring for account-related operations.\n */\nexport type KeyringRequest = Infer<typeof KeyringRequestStruct>;\n"]}
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KeyringResponseStruct = void 0;
4
- const keyring_utils_1 = require("@metamask/keyring-utils");
5
4
  const superstruct_1 = require("@metamask/superstruct");
6
5
  const utils_1 = require("@metamask/utils");
6
+ const superstruct_2 = require("../superstruct.cjs");
7
7
  exports.KeyringResponseStruct = (0, superstruct_1.union)([
8
- (0, keyring_utils_1.object)({
8
+ (0, superstruct_2.object)({
9
9
  /**
10
10
  * Pending flag.
11
11
  *
@@ -21,12 +21,12 @@ exports.KeyringResponseStruct = (0, superstruct_1.union)([
21
21
  * with a link to the redirect URL. The user can choose to follow the link
22
22
  * or cancel the request.
23
23
  */
24
- redirect: (0, keyring_utils_1.exactOptional)((0, keyring_utils_1.object)({
25
- message: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
26
- url: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
24
+ redirect: (0, superstruct_2.exactOptional)((0, superstruct_2.object)({
25
+ message: (0, superstruct_2.exactOptional)((0, superstruct_1.string)()),
26
+ url: (0, superstruct_2.exactOptional)((0, superstruct_1.string)()),
27
27
  })),
28
28
  }),
29
- (0, keyring_utils_1.object)({
29
+ (0, superstruct_2.object)({
30
30
  /**
31
31
  * Pending flag.
32
32
  *
@@ -1 +1 @@
1
- {"version":3,"file":"response.cjs","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAA+D;AAC/D,2CAA6C;AAEhC,QAAA,qBAAqB,GAAG,IAAA,mBAAK,EAAC;IACzC,IAAA,sBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC;QAEtB;;;;;;WAMG;QACH,QAAQ,EAAE,IAAA,6BAAa,EACrB,IAAA,sBAAM,EAAC;YACL,OAAO,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;YAChC,GAAG,EAAE,IAAA,6BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;SAC7B,CAAC,CACH;KACF,CAAC;IACF,IAAA,sBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;QAEvB;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { literal, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringResponseStruct = union([\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to true indicates that the request will be\n * handled asynchronously. The keyring must be called with `approveRequest`\n * or `rejectRequest` to resolve the request.\n */\n pending: literal(true),\n\n /**\n * Redirect URL.\n *\n * If present in the response, MetaMask will display a confirmation dialog\n * with a link to the redirect URL. The user can choose to follow the link\n * or cancel the request.\n */\n redirect: exactOptional(\n object({\n message: exactOptional(string()),\n url: exactOptional(string()),\n }),\n ),\n }),\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to false indicates that the request will be\n * handled synchronously. The keyring must return the result of the\n * request execution.\n */\n pending: literal(false),\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n]);\n\n/**\n * Response to a call to `submitRequest`.\n *\n * Keyring implementations must return a response with `pending: true` if the\n * request will be handled asynchronously. Otherwise, the response must contain\n * the result of the request and `pending: false`.\n *\n * In the asynchronous case, the keyring can return a redirect URL and message\n * to be shown to the user. The user can choose to follow the link or cancel\n * the request. The main use case for this is to redirect the user to the snap\n * dapp to review the request.\n */\nexport type KeyringResponse = Infer<typeof KeyringResponseStruct>;\n"]}
1
+ {"version":3,"file":"response.cjs","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":";;;AACA,uDAA+D;AAC/D,2CAA6C;AAE7C,oDAAuD;AAE1C,QAAA,qBAAqB,GAAG,IAAA,mBAAK,EAAC;IACzC,IAAA,oBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC;QAEtB;;;;;;WAMG;QACH,QAAQ,EAAE,IAAA,2BAAa,EACrB,IAAA,oBAAM,EAAC;YACL,OAAO,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;YAChC,GAAG,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;SAC7B,CAAC,CACH;KACF,CAAC;IACF,IAAA,oBAAM,EAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;QAEvB;;WAEG;QACH,MAAM,EAAE,kBAAU;KACnB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { literal, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from '../superstruct';\n\nexport const KeyringResponseStruct = union([\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to true indicates that the request will be\n * handled asynchronously. The keyring must be called with `approveRequest`\n * or `rejectRequest` to resolve the request.\n */\n pending: literal(true),\n\n /**\n * Redirect URL.\n *\n * If present in the response, MetaMask will display a confirmation dialog\n * with a link to the redirect URL. The user can choose to follow the link\n * or cancel the request.\n */\n redirect: exactOptional(\n object({\n message: exactOptional(string()),\n url: exactOptional(string()),\n }),\n ),\n }),\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to false indicates that the request will be\n * handled synchronously. The keyring must return the result of the\n * request execution.\n */\n pending: literal(false),\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n]);\n\n/**\n * Response to a call to `submitRequest`.\n *\n * Keyring implementations must return a response with `pending: true` if the\n * request will be handled asynchronously. Otherwise, the response must contain\n * the result of the request and `pending: false`.\n *\n * In the asynchronous case, the keyring can return a redirect URL and message\n * to be shown to the user. The user can choose to follow the link or cancel\n * the request. The main use case for this is to redirect the user to the snap\n * dapp to review the request.\n */\nexport type KeyringResponse = Infer<typeof KeyringResponseStruct>;\n"]}
@@ -6,8 +6,8 @@ export declare const KeyringResponseStruct: import("@metamask/superstruct").Stru
6
6
  url?: string;
7
7
  };
8
8
  } | {
9
- result: import("@metamask/utils").Json;
10
9
  pending: false;
10
+ result: import("@metamask/utils").Json;
11
11
  }, null>;
12
12
  /**
13
13
  * Response to a call to `submitRequest`.
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.cts","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,qBAAqB;;;;;;;;;QAwChC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"response.d.cts","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD,eAAO,MAAM,qBAAqB;;;;;;;;;QAwChC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -6,8 +6,8 @@ export declare const KeyringResponseStruct: import("@metamask/superstruct").Stru
6
6
  url?: string;
7
7
  };
8
8
  } | {
9
- result: import("@metamask/utils").Json;
10
9
  pending: false;
10
+ result: import("@metamask/utils").Json;
11
11
  }, null>;
12
12
  /**
13
13
  * Response to a call to `submitRequest`.
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.mts","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,eAAO,MAAM,qBAAqB;;;;;;;;;QAwChC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"response.d.mts","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD,eAAO,MAAM,qBAAqB;;;;;;;;;QAwChC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
- import { exactOptional, object } from "@metamask/keyring-utils";
2
1
  import { literal, string, union } from "@metamask/superstruct";
3
2
  import { JsonStruct } from "@metamask/utils";
3
+ import { exactOptional, object } from "../superstruct.mjs";
4
4
  export const KeyringResponseStruct = union([
5
5
  object({
6
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"response.mjs","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,gCAAgC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AAC/D,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;IACzC,MAAM,CAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC;QAEtB;;;;;;WAMG;QACH,QAAQ,EAAE,aAAa,CACrB,MAAM,CAAC;YACL,OAAO,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;YAChC,GAAG,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;SAC7B,CAAC,CACH;KACF,CAAC;IACF,MAAM,CAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;QAEvB;;WAEG;QACH,MAAM,EAAE,UAAU;KACnB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { exactOptional, object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { literal, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nexport const KeyringResponseStruct = union([\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to true indicates that the request will be\n * handled asynchronously. The keyring must be called with `approveRequest`\n * or `rejectRequest` to resolve the request.\n */\n pending: literal(true),\n\n /**\n * Redirect URL.\n *\n * If present in the response, MetaMask will display a confirmation dialog\n * with a link to the redirect URL. The user can choose to follow the link\n * or cancel the request.\n */\n redirect: exactOptional(\n object({\n message: exactOptional(string()),\n url: exactOptional(string()),\n }),\n ),\n }),\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to false indicates that the request will be\n * handled synchronously. The keyring must return the result of the\n * request execution.\n */\n pending: literal(false),\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n]);\n\n/**\n * Response to a call to `submitRequest`.\n *\n * Keyring implementations must return a response with `pending: true` if the\n * request will be handled asynchronously. Otherwise, the response must contain\n * the result of the request and `pending: false`.\n *\n * In the asynchronous case, the keyring can return a redirect URL and message\n * to be shown to the user. The user can choose to follow the link or cancel\n * the request. The main use case for this is to redirect the user to the snap\n * dapp to review the request.\n */\nexport type KeyringResponse = Infer<typeof KeyringResponseStruct>;\n"]}
1
+ {"version":3,"file":"response.mjs","sourceRoot":"","sources":["../../src/api/response.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AAC/D,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,2BAAuB;AAEvD,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;IACzC,MAAM,CAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC;QAEtB;;;;;;WAMG;QACH,QAAQ,EAAE,aAAa,CACrB,MAAM,CAAC;YACL,OAAO,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;YAChC,GAAG,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;SAC7B,CAAC,CACH;KACF,CAAC;IACF,MAAM,CAAC;QACL;;;;;;WAMG;QACH,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;QAEvB;;WAEG;QACH,MAAM,EAAE,UAAU;KACnB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { literal, string, union } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from '../superstruct';\n\nexport const KeyringResponseStruct = union([\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to true indicates that the request will be\n * handled asynchronously. The keyring must be called with `approveRequest`\n * or `rejectRequest` to resolve the request.\n */\n pending: literal(true),\n\n /**\n * Redirect URL.\n *\n * If present in the response, MetaMask will display a confirmation dialog\n * with a link to the redirect URL. The user can choose to follow the link\n * or cancel the request.\n */\n redirect: exactOptional(\n object({\n message: exactOptional(string()),\n url: exactOptional(string()),\n }),\n ),\n }),\n object({\n /**\n * Pending flag.\n *\n * Setting the pending flag to false indicates that the request will be\n * handled synchronously. The keyring must return the result of the\n * request execution.\n */\n pending: literal(false),\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n]);\n\n/**\n * Response to a call to `submitRequest`.\n *\n * Keyring implementations must return a response with `pending: true` if the\n * request will be handled asynchronously. Otherwise, the response must contain\n * the result of the request and `pending: false`.\n *\n * In the asynchronous case, the keyring can return a redirect URL and message\n * to be shown to the user. The user can choose to follow the link or cancel\n * the request. The main use case for this is to redirect the user to the snap\n * dapp to review the request.\n */\nexport type KeyringResponse = Infer<typeof KeyringResponseStruct>;\n"]}
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TransactionsPageStruct = exports.TransactionStruct = exports.TransactionEventStruct = exports.TransactionType = exports.TransactionStatus = exports.FeeType = void 0;
4
- const keyring_utils_1 = require("@metamask/keyring-utils");
5
4
  const superstruct_1 = require("@metamask/superstruct");
6
5
  const utils_1 = require("@metamask/utils");
7
6
  const asset_1 = require("./asset.cjs");
7
+ const superstruct_2 = require("../superstruct.cjs");
8
+ const utils_2 = require("../utils/index.cjs");
8
9
  /**
9
10
  * This struct represents a participant in a transaction.
10
11
  *
@@ -40,7 +41,7 @@ const asset_1 = require("./asset.cjs");
40
41
  * },
41
42
  * ```
42
43
  */
43
- const ParticipantStruct = (0, keyring_utils_1.object)({
44
+ const ParticipantStruct = (0, superstruct_2.object)({
44
45
  /**
45
46
  * Participant address.
46
47
  */
@@ -74,7 +75,7 @@ var FeeType;
74
75
  /**
75
76
  * This struct represents a transaction fee.
76
77
  */
77
- const FeeStruct = (0, keyring_utils_1.object)({
78
+ const FeeStruct = (0, superstruct_2.object)({
78
79
  /**
79
80
  * Fee type {@see FeeType}.
80
81
  */
@@ -128,7 +129,7 @@ var TransactionType;
128
129
  /**
129
130
  * This struct represents a transaction event.
130
131
  */
131
- exports.TransactionEventStruct = (0, keyring_utils_1.object)({
132
+ exports.TransactionEventStruct = (0, superstruct_2.object)({
132
133
  /**
133
134
  * New status of the transaction.
134
135
  */
@@ -200,7 +201,7 @@ exports.TransactionEventStruct = (0, keyring_utils_1.object)({
200
201
  * };
201
202
  * ```
202
203
  */
203
- exports.TransactionStruct = (0, keyring_utils_1.object)({
204
+ exports.TransactionStruct = (0, superstruct_2.object)({
204
205
  /**
205
206
  * Chain-specific transaction ID.
206
207
  */
@@ -212,7 +213,7 @@ exports.TransactionStruct = (0, keyring_utils_1.object)({
212
213
  /**
213
214
  * Account ID (UUIDv4).
214
215
  */
215
- account: keyring_utils_1.UuidStruct,
216
+ account: utils_2.UuidStruct,
216
217
  /**
217
218
  * Transaction status {@see TransactionStatus}.
218
219
  */
@@ -280,7 +281,7 @@ exports.TransactionStruct = (0, keyring_utils_1.object)({
280
281
  * }**
281
282
  * ```
282
283
  */
283
- exports.TransactionsPageStruct = (0, keyring_utils_1.object)({
284
+ exports.TransactionsPageStruct = (0, superstruct_2.object)({
284
285
  /**
285
286
  * List of transactions.
286
287
  */
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.cjs","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"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","sourcesContent":["import type { InferEquals } from '@metamask/keyring-utils';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, nullable, number, string } from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\n\nimport { AssetStruct } from './asset';\nimport type { Paginated } from '../utils';\n\n/**\n * This struct represents a participant in a transaction.\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: true,\n * type: 'eip155:1/slip44:60',\n * unit: 'ETH',\n * amount: '0.01',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: false,\n * id: 'eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: null,\n * },\n * ```\n */\nconst ParticipantStruct = object({\n /**\n * Participant address.\n */\n address: string(),\n\n /**\n * Asset being transferred.\n */\n asset: nullable(AssetStruct),\n});\n\n/**\n * Fee types.\n */\nexport enum FeeType {\n /**\n * Base fee. It is the minimum fee required to include a transaction in the\n * blockchain.\n *\n * For non-confirmed transactions, it must be the maximum base fee. For\n * confirmed transactions, it must be the actual base fee paid.\n */\n Base = 'base',\n\n /**\n * Priority fee. It is an optional fee used to prioritize the transaction.\n *\n * For non-confirmed transactions, it must be the maximum priority fee. For\n * confirmed transactions, it must be the actual priority fee paid.\n */\n Priority = 'priority',\n}\n\n/**\n * This struct represents a transaction fee.\n */\nconst FeeStruct = object({\n /**\n * Fee type {@see FeeType}.\n */\n type: enums([`${FeeType.Base}`, `${FeeType.Priority}`]),\n\n /**\n * Asset used to pay for the fee.\n */\n asset: AssetStruct,\n});\n\n/**\n * Transaction statuses.\n */\nexport enum TransactionStatus {\n /**\n * The transaction has been submitted but is not yet in the\n * blockchain. For example, it can be in the mempool.\n */\n Submitted = 'submitted',\n\n /**\n * The transaction is in the blockchain but has not been\n * confirmed yet.\n */\n Unconfirmed = 'unconfirmed',\n\n /**\n * The transaction has been confirmed.\n */\n Confirmed = 'confirmed',\n\n /**\n * The transaction has failed. For example, it has been reverted.\n */\n Failed = 'failed',\n}\n\n/**\n * Transaction types.\n */\nexport enum TransactionType {\n /**\n * The transaction was originated by the account. If the transaction\n * has a change output that goes back to the same account, it must be tagged\n * as a send transaction.\n */\n Send = 'send',\n\n /**\n * The transaction was received by the account, but originated by\n * another account.\n */\n Receive = 'receive',\n}\n\n/**\n * This struct represents a transaction event.\n */\nexport const TransactionEventStruct = object({\n /**\n * New status of the transaction.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the event occurred.\n */\n timestamp: nullable(number()),\n});\n\n/**\n * This struct represents a blockchain transaction.\n *\n * @example\n * ```ts\n * const tx = {\n * id: 'f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6',\n * chain: 'bip122:000000000019d6689c085ae165831e93',\n * account: 'b9beb861-9761-4b97-89ce-d992be5f34da',\n * status: 'confirmed',\n * timestamp: 1716367781,\n * type: 'send',\n * from: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * to: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * {\n * address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * fees: [\n * {\n * type: 'priority',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * };\n * ```\n */\nexport const TransactionStruct = object({\n /**\n * Chain-specific transaction ID.\n */\n id: string(),\n\n /**\n * Chain ID (CAIP-2).\n */\n chain: CaipChainIdStruct,\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Transaction status {@see TransactionStatus}.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the transaction was added to the blockchain. The\n * timestamp can be null if the transaction has not been included in the\n * blockchain yet.\n */\n timestamp: nullable(number()),\n\n /**\n * Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction\n * details on the UI.\n */\n type: enums([`${TransactionType.Send}`, `${TransactionType.Receive}`]),\n\n /**\n * Transaction sender addresses and amounts.\n */\n from: array(ParticipantStruct),\n\n /**\n * Transaction receiver addresses and amounts.\n */\n to: array(ParticipantStruct),\n\n /**\n * Total transaction fee.\n */\n fees: array(FeeStruct),\n\n /**\n * List of events related to the transaction {@see TransactionEventStruct}.\n *\n * The events are tracked in a best-effort basis and may not be available for\n * all transactions.\n */\n events: array(TransactionEventStruct),\n});\n\n/**\n * Transaction object.\n *\n * See {@link TransactionStruct}.\n */\nexport type Transaction = Infer<typeof TransactionStruct>;\n\n/**\n * This struct represents a page of transactions.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: null, // No more results\n * }**\n * ```\n */\nexport const TransactionsPageStruct = object({\n /**\n * List of transactions.\n */\n data: array(TransactionStruct),\n\n /**\n * Next cursor to iterate over the results. If null, there are no more\n * results.\n */\n next: nullable(string()),\n});\n\n/**\n * Transactions page object.\n *\n * See {@link TransactionsPageStruct}.\n */\nexport type TransactionsPage = InferEquals<\n typeof TransactionsPageStruct,\n Paginated<Transaction>\n>;\n"]}
1
+ {"version":3,"file":"transaction.cjs","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, nullable, number, string } from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\n\nimport { AssetStruct } from './asset';\nimport type { InferEquals } from '../superstruct';\nimport { object } from '../superstruct';\nimport type { Paginated } from '../utils';\nimport { UuidStruct } from '../utils';\n\n/**\n * This struct represents a participant in a transaction.\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: true,\n * type: 'eip155:1/slip44:60',\n * unit: 'ETH',\n * amount: '0.01',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: {\n * fungible: false,\n * id: 'eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769',\n * },\n * },\n * ```\n *\n * @example\n * ```ts\n * {\n * address: '0x1234...',\n * asset: null,\n * },\n * ```\n */\nconst ParticipantStruct = object({\n /**\n * Participant address.\n */\n address: string(),\n\n /**\n * Asset being transferred.\n */\n asset: nullable(AssetStruct),\n});\n\n/**\n * Fee types.\n */\nexport enum FeeType {\n /**\n * Base fee. It is the minimum fee required to include a transaction in the\n * blockchain.\n *\n * For non-confirmed transactions, it must be the maximum base fee. For\n * confirmed transactions, it must be the actual base fee paid.\n */\n Base = 'base',\n\n /**\n * Priority fee. It is an optional fee used to prioritize the transaction.\n *\n * For non-confirmed transactions, it must be the maximum priority fee. For\n * confirmed transactions, it must be the actual priority fee paid.\n */\n Priority = 'priority',\n}\n\n/**\n * This struct represents a transaction fee.\n */\nconst FeeStruct = object({\n /**\n * Fee type {@see FeeType}.\n */\n type: enums([`${FeeType.Base}`, `${FeeType.Priority}`]),\n\n /**\n * Asset used to pay for the fee.\n */\n asset: AssetStruct,\n});\n\n/**\n * Transaction statuses.\n */\nexport enum TransactionStatus {\n /**\n * The transaction has been submitted but is not yet in the\n * blockchain. For example, it can be in the mempool.\n */\n Submitted = 'submitted',\n\n /**\n * The transaction is in the blockchain but has not been\n * confirmed yet.\n */\n Unconfirmed = 'unconfirmed',\n\n /**\n * The transaction has been confirmed.\n */\n Confirmed = 'confirmed',\n\n /**\n * The transaction has failed. For example, it has been reverted.\n */\n Failed = 'failed',\n}\n\n/**\n * Transaction types.\n */\nexport enum TransactionType {\n /**\n * The transaction was originated by the account. If the transaction\n * has a change output that goes back to the same account, it must be tagged\n * as a send transaction.\n */\n Send = 'send',\n\n /**\n * The transaction was received by the account, but originated by\n * another account.\n */\n Receive = 'receive',\n}\n\n/**\n * This struct represents a transaction event.\n */\nexport const TransactionEventStruct = object({\n /**\n * New status of the transaction.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the event occurred.\n */\n timestamp: nullable(number()),\n});\n\n/**\n * This struct represents a blockchain transaction.\n *\n * @example\n * ```ts\n * const tx = {\n * id: 'f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6',\n * chain: 'bip122:000000000019d6689c085ae165831e93',\n * account: 'b9beb861-9761-4b97-89ce-d992be5f34da',\n * status: 'confirmed',\n * timestamp: 1716367781,\n * type: 'send',\n * from: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * to: [\n * {\n * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * {\n * address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * fees: [\n * {\n * type: 'priority',\n * asset: {\n * fungible: true,\n * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',\n * unit: 'BTC',\n * amount: '0.1',\n * },\n * },\n * ],\n * };\n * ```\n */\nexport const TransactionStruct = object({\n /**\n * Chain-specific transaction ID.\n */\n id: string(),\n\n /**\n * Chain ID (CAIP-2).\n */\n chain: CaipChainIdStruct,\n\n /**\n * Account ID (UUIDv4).\n */\n account: UuidStruct,\n\n /**\n * Transaction status {@see TransactionStatus}.\n */\n status: enums([\n `${TransactionStatus.Submitted}`,\n `${TransactionStatus.Unconfirmed}`,\n `${TransactionStatus.Confirmed}`,\n `${TransactionStatus.Failed}`,\n ]),\n\n /**\n * UNIX timestamp of when the transaction was added to the blockchain. The\n * timestamp can be null if the transaction has not been included in the\n * blockchain yet.\n */\n timestamp: nullable(number()),\n\n /**\n * Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction\n * details on the UI.\n */\n type: enums([`${TransactionType.Send}`, `${TransactionType.Receive}`]),\n\n /**\n * Transaction sender addresses and amounts.\n */\n from: array(ParticipantStruct),\n\n /**\n * Transaction receiver addresses and amounts.\n */\n to: array(ParticipantStruct),\n\n /**\n * Total transaction fee.\n */\n fees: array(FeeStruct),\n\n /**\n * List of events related to the transaction {@see TransactionEventStruct}.\n *\n * The events are tracked in a best-effort basis and may not be available for\n * all transactions.\n */\n events: array(TransactionEventStruct),\n});\n\n/**\n * Transaction object.\n *\n * See {@link TransactionStruct}.\n */\nexport type Transaction = Infer<typeof TransactionStruct>;\n\n/**\n * This struct represents a page of transactions.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: null, // No more results\n * }**\n * ```\n */\nexport const TransactionsPageStruct = object({\n /**\n * List of transactions.\n */\n data: array(TransactionStruct),\n\n /**\n * Next cursor to iterate over the results. If null, there are no more\n * results.\n */\n next: nullable(string()),\n});\n\n/**\n * Transactions page object.\n *\n * See {@link TransactionsPageStruct}.\n */\nexport type TransactionsPage = InferEquals<\n typeof TransactionsPageStruct,\n Paginated<Transaction>\n>;\n"]}