@metamask/keyring-api 11.0.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/dist/api/account.cjs +3 -4
  3. package/dist/api/account.cjs.map +1 -1
  4. package/dist/api/account.d.cts +1 -1
  5. package/dist/api/account.d.cts.map +1 -1
  6. package/dist/api/account.d.mts +1 -1
  7. package/dist/api/account.d.mts.map +1 -1
  8. package/dist/api/account.mjs +1 -2
  9. package/dist/api/account.mjs.map +1 -1
  10. package/dist/api/asset.cjs +82 -0
  11. package/dist/api/asset.cjs.map +1 -0
  12. package/dist/api/asset.d.cts +93 -0
  13. package/dist/api/asset.d.cts.map +1 -0
  14. package/dist/api/asset.d.mts +93 -0
  15. package/dist/api/asset.d.mts.map +1 -0
  16. package/dist/api/asset.mjs +79 -0
  17. package/dist/api/asset.mjs.map +1 -0
  18. package/dist/api/balance.cjs +3 -4
  19. package/dist/api/balance.cjs.map +1 -1
  20. package/dist/api/balance.d.cts +1 -1
  21. package/dist/api/balance.d.cts.map +1 -1
  22. package/dist/api/balance.d.mts +1 -1
  23. package/dist/api/balance.d.mts.map +1 -1
  24. package/dist/api/balance.mjs +1 -2
  25. package/dist/api/balance.mjs.map +1 -1
  26. package/dist/api/caip.cjs +3 -3
  27. package/dist/api/caip.cjs.map +1 -1
  28. package/dist/api/caip.d.cts.map +1 -1
  29. package/dist/api/caip.d.mts.map +1 -1
  30. package/dist/api/caip.mjs +1 -1
  31. package/dist/api/caip.mjs.map +1 -1
  32. package/dist/api/index.cjs +3 -0
  33. package/dist/api/index.cjs.map +1 -1
  34. package/dist/api/index.d.cts +4 -1
  35. package/dist/api/index.d.cts.map +1 -1
  36. package/dist/api/index.d.mts +4 -1
  37. package/dist/api/index.d.mts.map +1 -1
  38. package/dist/api/index.mjs +3 -0
  39. package/dist/api/index.mjs.map +1 -1
  40. package/dist/api/keyring.cjs +2 -0
  41. package/dist/api/keyring.cjs.map +1 -1
  42. package/dist/api/keyring.d.cts +14 -0
  43. package/dist/api/keyring.d.cts.map +1 -1
  44. package/dist/api/keyring.d.mts +14 -0
  45. package/dist/api/keyring.d.mts.map +1 -1
  46. package/dist/api/keyring.mjs +2 -0
  47. package/dist/api/keyring.mjs.map +1 -1
  48. package/dist/api/pagination.cjs +28 -0
  49. package/dist/api/pagination.cjs.map +1 -0
  50. package/dist/api/pagination.d.cts +59 -0
  51. package/dist/api/pagination.d.cts.map +1 -0
  52. package/dist/api/pagination.d.mts +59 -0
  53. package/dist/api/pagination.d.mts.map +1 -0
  54. package/dist/api/pagination.mjs +25 -0
  55. package/dist/api/pagination.mjs.map +1 -0
  56. package/dist/api/request.cjs +6 -7
  57. package/dist/api/request.cjs.map +1 -1
  58. package/dist/api/request.d.cts +5 -5
  59. package/dist/api/request.d.cts.map +1 -1
  60. package/dist/api/request.d.mts +5 -5
  61. package/dist/api/request.d.mts.map +1 -1
  62. package/dist/api/request.mjs +1 -2
  63. package/dist/api/request.mjs.map +1 -1
  64. package/dist/api/response.cjs +6 -6
  65. package/dist/api/response.cjs.map +1 -1
  66. package/dist/api/response.d.cts +1 -1
  67. package/dist/api/response.d.cts.map +1 -1
  68. package/dist/api/response.d.mts +1 -1
  69. package/dist/api/response.d.mts.map +1 -1
  70. package/dist/api/response.mjs +1 -1
  71. package/dist/api/response.mjs.map +1 -1
  72. package/dist/api/transaction.cjs +294 -0
  73. package/dist/api/transaction.cjs.map +1 -0
  74. package/dist/api/transaction.d.cts +773 -0
  75. package/dist/api/transaction.d.cts.map +1 -0
  76. package/dist/api/transaction.d.mts +773 -0
  77. package/dist/api/transaction.d.mts.map +1 -0
  78. package/dist/api/transaction.mjs +291 -0
  79. package/dist/api/transaction.mjs.map +1 -0
  80. package/dist/btc/types.cjs +2 -2
  81. package/dist/btc/types.cjs.map +1 -1
  82. package/dist/btc/types.d.cts +1 -1
  83. package/dist/btc/types.d.cts.map +1 -1
  84. package/dist/btc/types.d.mts +1 -1
  85. package/dist/btc/types.d.mts.map +1 -1
  86. package/dist/btc/types.mjs +2 -2
  87. package/dist/btc/types.mjs.map +1 -1
  88. package/dist/eth/erc4337/types.cjs +10 -11
  89. package/dist/eth/erc4337/types.cjs.map +1 -1
  90. package/dist/eth/erc4337/types.d.cts +4 -4
  91. package/dist/eth/erc4337/types.d.cts.map +1 -1
  92. package/dist/eth/erc4337/types.d.mts +4 -4
  93. package/dist/eth/erc4337/types.d.mts.map +1 -1
  94. package/dist/eth/erc4337/types.mjs +1 -2
  95. package/dist/eth/erc4337/types.mjs.map +1 -1
  96. package/dist/eth/types.cjs +6 -6
  97. package/dist/eth/types.cjs.map +1 -1
  98. package/dist/eth/types.d.cts +2 -2
  99. package/dist/eth/types.d.cts.map +1 -1
  100. package/dist/eth/types.d.mts +2 -2
  101. package/dist/eth/types.d.mts.map +1 -1
  102. package/dist/eth/types.mjs +1 -1
  103. package/dist/eth/types.mjs.map +1 -1
  104. package/dist/eth/utils.cjs.map +1 -1
  105. package/dist/eth/utils.d.cts.map +1 -1
  106. package/dist/eth/utils.d.mts.map +1 -1
  107. package/dist/eth/utils.mjs.map +1 -1
  108. package/dist/events.cjs +67 -1
  109. package/dist/events.cjs.map +1 -1
  110. package/dist/events.d.cts +161 -0
  111. package/dist/events.d.cts.map +1 -1
  112. package/dist/events.d.mts +161 -0
  113. package/dist/events.d.mts.map +1 -1
  114. package/dist/events.mjs +66 -0
  115. package/dist/events.mjs.map +1 -1
  116. package/dist/index.cjs +2 -8
  117. package/dist/index.cjs.map +1 -1
  118. package/dist/index.d.cts +3 -9
  119. package/dist/index.d.cts.map +1 -1
  120. package/dist/index.d.mts +3 -9
  121. package/dist/index.d.mts.map +1 -1
  122. package/dist/index.mjs +2 -8
  123. package/dist/index.mjs.map +1 -1
  124. package/dist/{internal/api.cjs → rpc.cjs} +78 -38
  125. package/dist/rpc.cjs.map +1 -0
  126. package/dist/{internal/api.d.cts → rpc.d.cts} +402 -59
  127. package/dist/rpc.d.cts.map +1 -0
  128. package/dist/{internal/api.d.mts → rpc.d.mts} +402 -59
  129. package/dist/rpc.d.mts.map +1 -0
  130. package/dist/{internal/api.mjs → rpc.mjs} +44 -5
  131. package/dist/rpc.mjs.map +1 -0
  132. package/dist/sol/types.cjs +3 -3
  133. package/dist/sol/types.cjs.map +1 -1
  134. package/dist/sol/types.d.cts +1 -1
  135. package/dist/sol/types.d.cts.map +1 -1
  136. package/dist/sol/types.d.mts +1 -1
  137. package/dist/sol/types.d.mts.map +1 -1
  138. package/dist/sol/types.mjs +1 -1
  139. package/dist/sol/types.mjs.map +1 -1
  140. package/package.json +11 -14
  141. package/dist/JsonRpcRequest.cjs +0 -13
  142. package/dist/JsonRpcRequest.cjs.map +0 -1
  143. package/dist/JsonRpcRequest.d.cts +0 -17
  144. package/dist/JsonRpcRequest.d.cts.map +0 -1
  145. package/dist/JsonRpcRequest.d.mts +0 -17
  146. package/dist/JsonRpcRequest.d.mts.map +0 -1
  147. package/dist/JsonRpcRequest.mjs +0 -10
  148. package/dist/JsonRpcRequest.mjs.map +0 -1
  149. package/dist/KeyringClient.cjs +0 -124
  150. package/dist/KeyringClient.cjs.map +0 -1
  151. package/dist/KeyringClient.d.cts +0 -29
  152. package/dist/KeyringClient.d.cts.map +0 -1
  153. package/dist/KeyringClient.d.mts +0 -29
  154. package/dist/KeyringClient.d.mts.map +0 -1
  155. package/dist/KeyringClient.mjs +0 -120
  156. package/dist/KeyringClient.mjs.map +0 -1
  157. package/dist/KeyringSnapRpcClient.cjs +0 -68
  158. package/dist/KeyringSnapRpcClient.cjs.map +0 -1
  159. package/dist/KeyringSnapRpcClient.d.cts +0 -40
  160. package/dist/KeyringSnapRpcClient.d.cts.map +0 -1
  161. package/dist/KeyringSnapRpcClient.d.mts +0 -40
  162. package/dist/KeyringSnapRpcClient.d.mts.map +0 -1
  163. package/dist/KeyringSnapRpcClient.mjs +0 -63
  164. package/dist/KeyringSnapRpcClient.mjs.map +0 -1
  165. package/dist/internal/api.cjs.map +0 -1
  166. package/dist/internal/api.d.cts.map +0 -1
  167. package/dist/internal/api.d.mts.map +0 -1
  168. package/dist/internal/api.mjs.map +0 -1
  169. package/dist/internal/eth/EthKeyring.cjs +0 -3
  170. package/dist/internal/eth/EthKeyring.cjs.map +0 -1
  171. package/dist/internal/eth/EthKeyring.d.cts +0 -34
  172. package/dist/internal/eth/EthKeyring.d.cts.map +0 -1
  173. package/dist/internal/eth/EthKeyring.d.mts +0 -34
  174. package/dist/internal/eth/EthKeyring.d.mts.map +0 -1
  175. package/dist/internal/eth/EthKeyring.mjs +0 -2
  176. package/dist/internal/eth/EthKeyring.mjs.map +0 -1
  177. package/dist/internal/eth/index.cjs +0 -3
  178. package/dist/internal/eth/index.cjs.map +0 -1
  179. package/dist/internal/eth/index.d.cts +0 -2
  180. package/dist/internal/eth/index.d.cts.map +0 -1
  181. package/dist/internal/eth/index.d.mts +0 -2
  182. package/dist/internal/eth/index.d.mts.map +0 -1
  183. package/dist/internal/eth/index.mjs +0 -2
  184. package/dist/internal/eth/index.mjs.map +0 -1
  185. package/dist/internal/events.cjs +0 -72
  186. package/dist/internal/events.cjs.map +0 -1
  187. package/dist/internal/events.d.cts +0 -162
  188. package/dist/internal/events.d.cts.map +0 -1
  189. package/dist/internal/events.d.mts +0 -162
  190. package/dist/internal/events.d.mts.map +0 -1
  191. package/dist/internal/events.mjs +0 -69
  192. package/dist/internal/events.mjs.map +0 -1
  193. package/dist/internal/index.cjs +0 -21
  194. package/dist/internal/index.cjs.map +0 -1
  195. package/dist/internal/index.d.cts +0 -6
  196. package/dist/internal/index.d.cts.map +0 -1
  197. package/dist/internal/index.d.mts +0 -6
  198. package/dist/internal/index.d.mts.map +0 -1
  199. package/dist/internal/index.mjs +0 -5
  200. package/dist/internal/index.mjs.map +0 -1
  201. package/dist/internal/rpc.cjs +0 -33
  202. package/dist/internal/rpc.cjs.map +0 -1
  203. package/dist/internal/rpc.d.cts +0 -26
  204. package/dist/internal/rpc.d.cts.map +0 -1
  205. package/dist/internal/rpc.d.mts +0 -26
  206. package/dist/internal/rpc.d.mts.map +0 -1
  207. package/dist/internal/rpc.mjs +0 -29
  208. package/dist/internal/rpc.mjs.map +0 -1
  209. package/dist/internal/types.cjs +0 -52
  210. package/dist/internal/types.cjs.map +0 -1
  211. package/dist/internal/types.d.cts +0 -392
  212. package/dist/internal/types.d.cts.map +0 -1
  213. package/dist/internal/types.d.mts +0 -392
  214. package/dist/internal/types.d.mts.map +0 -1
  215. package/dist/internal/types.mjs +0 -49
  216. package/dist/internal/types.mjs.map +0 -1
  217. package/dist/rpc-handler.cjs +0 -136
  218. package/dist/rpc-handler.cjs.map +0 -1
  219. package/dist/rpc-handler.d.cts +0 -30
  220. package/dist/rpc-handler.d.cts.map +0 -1
  221. package/dist/rpc-handler.d.mts +0 -30
  222. package/dist/rpc-handler.d.mts.map +0 -1
  223. package/dist/rpc-handler.mjs +0 -131
  224. package/dist/rpc-handler.mjs.map +0 -1
  225. package/dist/snap-utils.cjs +0 -20
  226. package/dist/snap-utils.cjs.map +0 -1
  227. package/dist/snap-utils.d.cts +0 -12
  228. package/dist/snap-utils.d.cts.map +0 -1
  229. package/dist/snap-utils.d.mts +0 -12
  230. package/dist/snap-utils.d.mts.map +0 -1
  231. package/dist/snap-utils.mjs +0 -17
  232. package/dist/snap-utils.mjs.map +0 -1
  233. package/dist/superstruct.cjs +0 -80
  234. package/dist/superstruct.cjs.map +0 -1
  235. package/dist/superstruct.d.cts +0 -84
  236. package/dist/superstruct.d.cts.map +0 -1
  237. package/dist/superstruct.d.mts +0 -84
  238. package/dist/superstruct.d.mts.map +0 -1
  239. package/dist/superstruct.mjs +0 -74
  240. package/dist/superstruct.mjs.map +0 -1
  241. package/dist/utils/index.cjs +0 -19
  242. package/dist/utils/index.cjs.map +0 -1
  243. package/dist/utils/index.d.cts +0 -3
  244. package/dist/utils/index.d.cts.map +0 -1
  245. package/dist/utils/index.d.mts +0 -3
  246. package/dist/utils/index.d.mts.map +0 -1
  247. package/dist/utils/index.mjs +0 -3
  248. package/dist/utils/index.mjs.map +0 -1
  249. package/dist/utils/types.cjs +0 -29
  250. package/dist/utils/types.cjs.map +0 -1
  251. package/dist/utils/types.d.cts +0 -18
  252. package/dist/utils/types.d.cts.map +0 -1
  253. package/dist/utils/types.d.mts +0 -18
  254. package/dist/utils/types.d.mts.map +0 -1
  255. package/dist/utils/types.mjs +0 -26
  256. package/dist/utils/types.mjs.map +0 -1
  257. package/dist/utils/typing.cjs +0 -20
  258. package/dist/utils/typing.cjs.map +0 -1
  259. package/dist/utils/typing.d.cts +0 -33
  260. package/dist/utils/typing.d.cts.map +0 -1
  261. package/dist/utils/typing.d.mts +0 -33
  262. package/dist/utils/typing.d.mts.map +0 -1
  263. package/dist/utils/typing.mjs +0 -17
  264. package/dist/utils/typing.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.d.mts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAsBnD;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,uBAAuB,oCAAoC;IAC3D,kBAAkB,+BAA+B;IACjD,mBAAmB,gCAAgC;IACnD,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,aAAa,0BAA0B;IACvC,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,cAAc,2BAA2B;IACzC,aAAa,0BAA0B;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D;AAYD,eAAO,MAAM,yBAAyB;;;;;;;;EAGpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE1E,eAAO,MAAM,0BAA0B;;;;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AM,2BAA2B,oDAAgB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -1,9 +1,37 @@
1
+ import { object, UuidStruct } from "@metamask/keyring-utils";
1
2
  import { array, literal, number, record, string, union } from "@metamask/superstruct";
2
3
  import { JsonStruct } from "@metamask/utils";
3
- import { KeyringRpcMethod } from "./rpc.mjs";
4
- import { BalanceStruct, CaipAssetTypeStruct, KeyringAccountDataStruct, KeyringAccountStruct, KeyringRequestStruct, KeyringResponseStruct } from "../api/index.mjs";
5
- import { object } from "../superstruct.mjs";
6
- import { UuidStruct } from "../utils/index.mjs";
4
+ import { BalanceStruct, CaipAssetTypeStruct, KeyringAccountDataStruct, KeyringAccountStruct, KeyringRequestStruct, KeyringResponseStruct, TransactionsPageStruct, PaginationStruct } from "./api/index.mjs";
5
+ /**
6
+ * Keyring RPC methods used by the API.
7
+ */
8
+ export var KeyringRpcMethod;
9
+ (function (KeyringRpcMethod) {
10
+ KeyringRpcMethod["ListAccounts"] = "keyring_listAccounts";
11
+ KeyringRpcMethod["GetAccount"] = "keyring_getAccount";
12
+ KeyringRpcMethod["CreateAccount"] = "keyring_createAccount";
13
+ KeyringRpcMethod["ListAccountTransactions"] = "keyring_listAccountTransactions";
14
+ KeyringRpcMethod["GetAccountBalances"] = "keyring_getAccountBalances";
15
+ KeyringRpcMethod["FilterAccountChains"] = "keyring_filterAccountChains";
16
+ KeyringRpcMethod["UpdateAccount"] = "keyring_updateAccount";
17
+ KeyringRpcMethod["DeleteAccount"] = "keyring_deleteAccount";
18
+ KeyringRpcMethod["ExportAccount"] = "keyring_exportAccount";
19
+ KeyringRpcMethod["ListRequests"] = "keyring_listRequests";
20
+ KeyringRpcMethod["GetRequest"] = "keyring_getRequest";
21
+ KeyringRpcMethod["SubmitRequest"] = "keyring_submitRequest";
22
+ KeyringRpcMethod["ApproveRequest"] = "keyring_approveRequest";
23
+ KeyringRpcMethod["RejectRequest"] = "keyring_rejectRequest";
24
+ })(KeyringRpcMethod || (KeyringRpcMethod = {}));
25
+ /**
26
+ * Check if a method is a keyring RPC method.
27
+ *
28
+ * @param method - Method to check.
29
+ * @returns Whether the method is a keyring RPC method.
30
+ */
31
+ export function isKeyringRpcMethod(method) {
32
+ return Object.values(KeyringRpcMethod).includes(method);
33
+ }
34
+ // ----------------------------------------------------------------------------
7
35
  const CommonHeader = {
8
36
  jsonrpc: literal('2.0'),
9
37
  id: union([string(), number(), literal(null)]),
@@ -36,6 +64,17 @@ export const CreateAccountRequestStruct = object({
36
64
  });
37
65
  export const CreateAccountResponseStruct = KeyringAccountStruct;
38
66
  // ----------------------------------------------------------------------------
67
+ // List account transactions
68
+ export const ListAccountTransactionsRequestStruct = object({
69
+ ...CommonHeader,
70
+ method: literal('keyring_listAccountTransactions'),
71
+ params: object({
72
+ id: UuidStruct,
73
+ pagination: PaginationStruct,
74
+ }),
75
+ });
76
+ export const ListAccountTransactionsResponseStruct = TransactionsPageStruct;
77
+ // ----------------------------------------------------------------------------
39
78
  // Get account balances
40
79
  export const GetAccountBalancesRequestStruct = object({
41
80
  ...CommonHeader,
@@ -133,4 +172,4 @@ export const RejectRequestRequestStruct = object({
133
172
  }),
134
173
  });
135
174
  export const RejectRequestResponseStruct = literal(null);
136
- //# sourceMappingURL=api.mjs.map
175
+ //# sourceMappingURL=rpc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.mjs","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAE7D,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAC/B,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,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{ object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n TransactionsPageStruct,\n PaginationStruct,\n} from './api';\n\n/**\n * Keyring RPC methods used by the API.\n */\nexport enum KeyringRpcMethod {\n ListAccounts = 'keyring_listAccounts',\n GetAccount = 'keyring_getAccount',\n CreateAccount = 'keyring_createAccount',\n ListAccountTransactions = 'keyring_listAccountTransactions',\n GetAccountBalances = 'keyring_getAccountBalances',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\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// List accounts\n\nexport const ListAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccounts'),\n});\n\nexport type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;\n\nexport const ListAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_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 account\n\nexport const CreateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_createAccount'),\n params: object({\n options: record(string(), JsonStruct),\n }),\n});\n\nexport type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;\n\nexport const CreateAccountResponseStruct = KeyringAccountStruct;\n\nexport type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List account transactions\n\nexport const ListAccountTransactionsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccountTransactions'),\n params: object({\n id: UuidStruct,\n pagination: PaginationStruct,\n }),\n});\n\nexport type ListAccountTransactionsRequest = Infer<\n typeof ListAccountTransactionsRequestStruct\n>;\n\nexport const ListAccountTransactionsResponseStruct = TransactionsPageStruct;\n\nexport type ListAccountTransactionsResponse = Infer<\n typeof ListAccountTransactionsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.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// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\n chains: array(string()),\n }),\n});\n\nexport type FilterAccountChainsRequest = Infer<\n typeof FilterAccountChainsStruct\n>;\n\nexport const FilterAccountChainsResponseStruct = array(string());\n\nexport type FilterAccountChainsResponse = Infer<\n typeof FilterAccountChainsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Update account\n\nexport const UpdateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_updateAccount'),\n params: object({\n account: KeyringAccountStruct,\n }),\n});\n\nexport type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;\n\nexport const UpdateAccountResponseStruct = literal(null);\n\nexport type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_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('keyring_exportAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = KeyringAccountDataStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List requests\n\nexport const ListRequestsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listRequests'),\n});\n\nexport type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;\n\nexport const ListRequestsResponseStruct = array(KeyringRequestStruct);\n\nexport type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get request\n\nexport const GetRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;\n\nexport const GetRequestResponseStruct = KeyringRequestStruct;\n\nexport type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_submitRequest'),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = KeyringResponseStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Approve request\n\nexport const ApproveRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_approveRequest'),\n params: object({\n id: UuidStruct,\n data: record(string(), JsonStruct),\n }),\n});\n\nexport type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;\n\nexport const ApproveRequestResponseStruct = literal(null);\n\nexport type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Reject request\n\nexport const RejectRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_rejectRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SolDataAccountStruct = exports.SolMethod = exports.SolAddressStruct = void 0;
4
+ const keyring_utils_1 = require("@metamask/keyring-utils");
4
5
  const superstruct_1 = require("@metamask/superstruct");
5
6
  const api_1 = require("../api/index.cjs");
6
- const superstruct_2 = require("../superstruct.cjs");
7
7
  /**
8
8
  * Solana addresses are represented in the format of a 256-bit ed25519 public key and
9
9
  * are encoded using base58.
10
10
  * They are usually 32 to 44 characters long.
11
11
  */
12
- exports.SolAddressStruct = (0, superstruct_2.definePattern)('SolAddress', /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);
12
+ exports.SolAddressStruct = (0, keyring_utils_1.definePattern)('SolAddress', /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);
13
13
  /**
14
14
  * Supported Solana methods.
15
15
  */
@@ -18,7 +18,7 @@ var SolMethod;
18
18
  // General transaction methods
19
19
  SolMethod["SendAndConfirmTransaction"] = "sendAndConfirmTransaction";
20
20
  })(SolMethod || (exports.SolMethod = SolMethod = {}));
21
- exports.SolDataAccountStruct = (0, superstruct_2.object)({
21
+ exports.SolDataAccountStruct = (0, keyring_utils_1.object)({
22
22
  ...api_1.KeyringAccountStruct.schema,
23
23
  /**
24
24
  * Account address.
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":";;;AACA,uDAA8D;AAE9D,0CAA8D;AAC9D,oDAAuD;AAEvD;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,IAAA,2BAAa,EAC3C,YAAY,EACZ,iCAAiC,CAClC,CAAC;AAEF;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,oEAAuD,CAAA;AACzD,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAEY,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,wBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,WAAW,EAAE,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { KeyringAccountStruct, SolAccountType } from '../api';\nimport { object, definePattern } from '../superstruct';\n\n/**\n * Solana addresses are represented in the format of a 256-bit ed25519 public key and\n * are encoded using base58.\n * They are usually 32 to 44 characters long.\n */\nexport const SolAddressStruct = definePattern(\n 'SolAddress',\n /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu,\n);\n\n/**\n * Supported Solana methods.\n */\nexport enum SolMethod {\n // General transaction methods\n SendAndConfirmTransaction = 'sendAndConfirmTransaction',\n}\n\nexport const SolDataAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: SolAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${SolAccountType.DataAccount}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAA8D;AAE9D,0CAA8D;AAE9D;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,IAAA,6BAAa,EAC3C,YAAY,EACZ,iCAAiC,CAClC,CAAC;AAEF;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,oEAAuD,CAAA;AACzD,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAEY,QAAA,oBAAoB,GAAG,IAAA,sBAAM,EAAC;IACzC,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,wBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,GAAG,oBAAc,CAAC,WAAW,EAAE,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { KeyringAccountStruct, SolAccountType } from '../api';\n\n/**\n * Solana addresses are represented in the format of a 256-bit ed25519 public key and\n * are encoded using base58.\n * They are usually 32 to 44 characters long.\n */\nexport const SolAddressStruct = definePattern(\n 'SolAddress',\n /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu,\n);\n\n/**\n * Supported Solana methods.\n */\nexport enum SolMethod {\n // General transaction methods\n SendAndConfirmTransaction = 'sendAndConfirmTransaction',\n}\n\nexport const SolDataAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: SolAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${SolAccountType.DataAccount}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
@@ -14,8 +14,8 @@ export declare enum SolMethod {
14
14
  export declare const SolDataAccountStruct: import("@metamask/superstruct").Struct<{
15
15
  type: "solana:data-account";
16
16
  id: string;
17
- address: string;
18
17
  options: Record<string, import("@metamask/utils").Json>;
18
+ address: string;
19
19
  methods: "sendAndConfirmTransaction"[];
20
20
  }, {
21
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,yBAAyB,8BAA8B;CACxD;AAED,eAAO,MAAM,oBAAoB;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,yBAAyB,8BAA8B;CACxD;AAED,eAAO,MAAM,oBAAoB;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -14,8 +14,8 @@ export declare enum SolMethod {
14
14
  export declare const SolDataAccountStruct: import("@metamask/superstruct").Struct<{
15
15
  type: "solana:data-account";
16
16
  id: string;
17
- address: string;
18
17
  options: Record<string, import("@metamask/utils").Json>;
18
+ address: string;
19
19
  methods: "sendAndConfirmTransaction"[];
20
20
  }, {
21
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,yBAAyB,8BAA8B;CACxD;AAED,eAAO,MAAM,oBAAoB;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,yBAAyB,8BAA8B;CACxD;AAED,eAAO,MAAM,oBAAoB;;;;;;;IAG/B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
+ import { object, definePattern } from "@metamask/keyring-utils";
1
2
  import { array, enums, literal } from "@metamask/superstruct";
2
3
  import { KeyringAccountStruct, SolAccountType } from "../api/index.mjs";
3
- import { object, definePattern } from "../superstruct.mjs";
4
4
  /**
5
5
  * Solana addresses are represented in the format of a 256-bit ed25519 public key and
6
6
  * are encoded using base58.
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AAE9D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,yBAAe;AAC9D,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,2BAAuB;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,iCAAiC,CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,oEAAuD,CAAA;AACzD,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { KeyringAccountStruct, SolAccountType } from '../api';\nimport { object, definePattern } from '../superstruct';\n\n/**\n * Solana addresses are represented in the format of a 256-bit ed25519 public key and\n * are encoded using base58.\n * They are usually 32 to 44 characters long.\n */\nexport const SolAddressStruct = definePattern(\n 'SolAddress',\n /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu,\n);\n\n/**\n * Supported Solana methods.\n */\nexport enum SolMethod {\n // General transaction methods\n SendAndConfirmTransaction = 'sendAndConfirmTransaction',\n}\n\nexport const SolDataAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: SolAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${SolAccountType.DataAccount}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gCAAgC;AAEhE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AAE9D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,yBAAe;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,iCAAiC,CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,oEAAuD,CAAA;AACzD,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import { object, definePattern } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, literal } from '@metamask/superstruct';\n\nimport { KeyringAccountStruct, SolAccountType } from '../api';\n\n/**\n * Solana addresses are represented in the format of a 256-bit ed25519 public key and\n * are encoded using base58.\n * They are usually 32 to 44 characters long.\n */\nexport const SolAddressStruct = definePattern(\n 'SolAddress',\n /^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu,\n);\n\n/**\n * Supported Solana methods.\n */\nexport enum SolMethod {\n // General transaction methods\n SendAndConfirmTransaction = 'sendAndConfirmTransaction',\n}\n\nexport const SolDataAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: SolAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${SolAccountType.DataAccount}`),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/keyring-api",
3
- "version": "11.0.0",
3
+ "version": "12.0.0",
4
4
  "description": "MetaMask Keyring API",
5
5
  "keywords": [
6
6
  "metamask",
@@ -42,24 +42,21 @@
42
42
  "test": "yarn test:source && yarn test:types",
43
43
  "test:clean": "jest --clearCache",
44
44
  "test:source": "jest && jest-it-up",
45
- "test:types": "tsd",
45
+ "test:types": "../../scripts/tsd-test.sh ./src",
46
46
  "test:watch": "jest --watch"
47
47
  },
48
48
  "dependencies": {
49
- "@metamask/snaps-sdk": "^6.7.0",
49
+ "@metamask/keyring-utils": "^1.0.0",
50
50
  "@metamask/superstruct": "^3.1.0",
51
- "@metamask/utils": "^9.2.1",
52
- "@types/uuid": "^9.0.8",
53
- "bech32": "^2.0.0",
54
- "uuid": "^9.0.1",
55
- "webextension-polyfill": "^0.12.0"
51
+ "@metamask/utils": "^9.3.0",
52
+ "bech32": "^2.0.0"
56
53
  },
57
54
  "devDependencies": {
58
55
  "@lavamoat/allow-scripts": "^3.2.1",
59
56
  "@lavamoat/preinstall-always-fail": "^2.1.0",
60
57
  "@metamask/auto-changelog": "^3.4.4",
61
- "@metamask/providers": "^18.1.0",
62
- "@ts-bridge/cli": "^0.6.0",
58
+ "@metamask/keyring-utils": "^1.0.0",
59
+ "@ts-bridge/cli": "^0.6.1",
63
60
  "@types/jest": "^29.5.12",
64
61
  "@types/node": "^20.12.12",
65
62
  "@types/webextension-polyfill": "^0.12.1",
@@ -73,9 +70,6 @@
73
70
  "typedoc": "^0.25.13",
74
71
  "typescript": "~5.6.3"
75
72
  },
76
- "peerDependencies": {
77
- "@metamask/providers": "^18.1.0"
78
- },
79
73
  "engines": {
80
74
  "node": "^18.18 || >=20"
81
75
  },
@@ -91,6 +85,9 @@
91
85
  }
92
86
  },
93
87
  "tsd": {
94
- "directory": "src"
88
+ "directory": "src",
89
+ "compilerOptions": {
90
+ "composite": "false"
91
+ }
95
92
  }
96
93
  }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JsonRpcRequestStruct = void 0;
4
- const superstruct_1 = require("@metamask/superstruct");
5
- const utils_1 = require("@metamask/utils");
6
- const superstruct_2 = require("./superstruct.cjs");
7
- exports.JsonRpcRequestStruct = (0, superstruct_2.object)({
8
- jsonrpc: (0, superstruct_1.literal)('2.0'),
9
- id: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (0, superstruct_1.literal)(null)]),
10
- method: (0, superstruct_1.string)(),
11
- 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)])),
12
- });
13
- //# sourceMappingURL=JsonRpcRequest.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JsonRpcRequest.cjs","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":";;;AAAA,uDAO+B;AAE/B,2CAA6C;AAE7C,mDAAsD;AAEzC,QAAA,oBAAoB,GAAG,IAAA,oBAAM,EAAC;IACzC,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;IAC9C,MAAM,EAAE,IAAA,oBAAM,GAAE;IAChB,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;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from './superstruct';\n\nexport const JsonRpcRequestStruct = object({\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n});\n\n/**\n * JSON-RPC request type.\n */\nexport type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;\n"]}
@@ -1,17 +0,0 @@
1
- import type { Infer } from "@metamask/superstruct";
2
- export declare const JsonRpcRequestStruct: import("@metamask/superstruct").Struct<{
3
- jsonrpc: "2.0";
4
- id: string | number | null;
5
- method: string;
6
- params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
7
- }, {
8
- jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
9
- id: import("@metamask/superstruct").Struct<string | number | null, null>;
10
- method: import("@metamask/superstruct").Struct<string, null>;
11
- params: import("@metamask/superstruct").Struct<import("./superstruct.cjs").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
12
- }>;
13
- /**
14
- * JSON-RPC request type.
15
- */
16
- export type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;
17
- //# sourceMappingURL=JsonRpcRequest.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JsonRpcRequest.d.cts","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,eAAO,MAAM,oBAAoB;;;;;;;;;;EAO/B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import type { Infer } from "@metamask/superstruct";
2
- export declare const JsonRpcRequestStruct: import("@metamask/superstruct").Struct<{
3
- jsonrpc: "2.0";
4
- id: string | number | null;
5
- method: string;
6
- params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
7
- }, {
8
- jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
9
- id: import("@metamask/superstruct").Struct<string | number | null, null>;
10
- method: import("@metamask/superstruct").Struct<string, null>;
11
- params: import("@metamask/superstruct").Struct<import("./superstruct.mjs").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
12
- }>;
13
- /**
14
- * JSON-RPC request type.
15
- */
16
- export type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;
17
- //# sourceMappingURL=JsonRpcRequest.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JsonRpcRequest.d.mts","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,eAAO,MAAM,oBAAoB;;;;;;;;;;EAO/B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- import { array, literal, number, record, string, union } from "@metamask/superstruct";
2
- import { JsonStruct } from "@metamask/utils";
3
- import { exactOptional, object } from "./superstruct.mjs";
4
- export const JsonRpcRequestStruct = object({
5
- jsonrpc: literal('2.0'),
6
- id: union([string(), number(), literal(null)]),
7
- method: string(),
8
- params: exactOptional(union([array(JsonStruct), record(string(), JsonStruct)])),
9
- });
10
- //# sourceMappingURL=JsonRpcRequest.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JsonRpcRequest.mjs","sourceRoot":"","sources":["../src/JsonRpcRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAE/B,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,0BAAsB;AAEtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;IACvB,EAAE,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,MAAM,EAAE,MAAM,EAAE;IAChB,MAAM,EAAE,aAAa,CACnB,KAAK,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CACzD;CACF,CAAC,CAAC","sourcesContent":["import {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { exactOptional, object } from './superstruct';\n\nexport const JsonRpcRequestStruct = object({\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n method: string(),\n params: exactOptional(\n union([array(JsonStruct), record(string(), JsonStruct)]),\n ),\n});\n\n/**\n * JSON-RPC request type.\n */\nexport type JsonRpcRequest = Infer<typeof JsonRpcRequestStruct>;\n"]}
@@ -1,124 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _KeyringClient_instances, _KeyringClient_sender, _KeyringClient_send;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.KeyringClient = void 0;
16
- const superstruct_1 = require("@metamask/superstruct");
17
- const uuid_1 = require("uuid");
18
- const api_1 = require("./internal/api.cjs");
19
- const rpc_1 = require("./internal/rpc.cjs");
20
- const superstruct_2 = require("./superstruct.cjs");
21
- class KeyringClient {
22
- /**
23
- * Create a new instance of `KeyringClient`.
24
- *
25
- * @param sender - The `Sender` instance to use to send requests to the snap.
26
- */
27
- constructor(sender) {
28
- _KeyringClient_instances.add(this);
29
- _KeyringClient_sender.set(this, void 0);
30
- __classPrivateFieldSet(this, _KeyringClient_sender, sender, "f");
31
- }
32
- async listAccounts() {
33
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
34
- method: rpc_1.KeyringRpcMethod.ListAccounts,
35
- }), api_1.ListAccountsResponseStruct);
36
- }
37
- async getAccount(id) {
38
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
39
- method: rpc_1.KeyringRpcMethod.GetAccount,
40
- params: { id },
41
- }), api_1.GetAccountResponseStruct);
42
- }
43
- async getAccountBalances(id, assets) {
44
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
45
- method: rpc_1.KeyringRpcMethod.GetAccountBalances,
46
- params: { id, assets },
47
- }), api_1.GetAccountBalancesResponseStruct);
48
- }
49
- async createAccount(options = {}) {
50
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
51
- method: rpc_1.KeyringRpcMethod.CreateAccount,
52
- params: { options },
53
- }), api_1.CreateAccountResponseStruct);
54
- }
55
- async filterAccountChains(id, chains) {
56
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
57
- method: rpc_1.KeyringRpcMethod.FilterAccountChains,
58
- params: { id, chains },
59
- }), api_1.FilterAccountChainsResponseStruct);
60
- }
61
- async updateAccount(account) {
62
- (0, superstruct_1.assert)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
63
- method: rpc_1.KeyringRpcMethod.UpdateAccount,
64
- params: { account },
65
- }), api_1.UpdateAccountResponseStruct);
66
- }
67
- async deleteAccount(id) {
68
- (0, superstruct_1.assert)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
69
- method: rpc_1.KeyringRpcMethod.DeleteAccount,
70
- params: { id },
71
- }), api_1.DeleteAccountResponseStruct);
72
- }
73
- async exportAccount(id) {
74
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
75
- method: rpc_1.KeyringRpcMethod.ExportAccount,
76
- params: { id },
77
- }), api_1.ExportAccountResponseStruct);
78
- }
79
- async listRequests() {
80
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
81
- method: rpc_1.KeyringRpcMethod.ListRequests,
82
- }), api_1.ListRequestsResponseStruct);
83
- }
84
- async getRequest(id) {
85
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
86
- method: rpc_1.KeyringRpcMethod.GetRequest,
87
- params: { id },
88
- }), api_1.GetRequestResponseStruct);
89
- }
90
- async submitRequest(request) {
91
- return (0, superstruct_2.strictMask)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
92
- method: rpc_1.KeyringRpcMethod.SubmitRequest,
93
- params: request,
94
- }), api_1.SubmitRequestResponseStruct);
95
- }
96
- async approveRequest(id, data = {}) {
97
- (0, superstruct_1.assert)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
98
- method: rpc_1.KeyringRpcMethod.ApproveRequest,
99
- params: { id, data },
100
- }), api_1.ApproveRequestResponseStruct);
101
- }
102
- async rejectRequest(id) {
103
- (0, superstruct_1.assert)(await __classPrivateFieldGet(this, _KeyringClient_instances, "m", _KeyringClient_send).call(this, {
104
- method: rpc_1.KeyringRpcMethod.RejectRequest,
105
- params: { id },
106
- }), api_1.RejectRequestResponseStruct);
107
- }
108
- }
109
- exports.KeyringClient = KeyringClient;
110
- _KeyringClient_sender = new WeakMap(), _KeyringClient_instances = new WeakSet(), _KeyringClient_send =
111
- /**
112
- * Send a request to the snap and return the response.
113
- *
114
- * @param partial - A partial JSON-RPC request (method and params).
115
- * @returns A promise that resolves to the response to the request.
116
- */
117
- async function _KeyringClient_send(partial) {
118
- return __classPrivateFieldGet(this, _KeyringClient_sender, "f").send({
119
- jsonrpc: '2.0',
120
- id: (0, uuid_1.v4)(),
121
- ...partial,
122
- });
123
- };
124
- //# sourceMappingURL=KeyringClient.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeyringClient.cjs","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAA+C;AAE/C,+BAAkC;AAWlC,4CAcwB;AACxB,4CAAkD;AAElD,mDAA2C;AAM3C,MAAa,aAAa;IAGxB;;;;OAIG;IACH,YAAY,MAAc;;QAPjB,wCAAgB;QAQvB,uBAAA,IAAI,yBAAW,MAAM,MAAA,CAAC;IACxB,CAAC;IAgBD,KAAK,CAAC,YAAY;QAChB,OAAO,IAAA,wBAAU,EACf,MAAM,uBAAA,IAAI,qDAAM,MAAV,IAAI,EAAO;YACf,MAAM,EAAE,sBAAgB,CAAC,YAAY;SACtC,CAAC,EACF,gCAA0B,CAC3B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU;QACzB,OAAO,IAAA,wBAAU,EACf,MAAM,uBAAA,IAAI,qDAAM,MAAV,IAAI,EAAO;YACf,MAAM,EAAE,sBAAgB,CAAC,UAAU;YACnC,MAAM,EAAE,EAAE,EAAE,EAAE;SACf,CAAC,EACF,8BAAwB,CACzB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,EAAU,EACV,MAAuB;QAEvB,OAAO,IAAA,wBAAU,EACf,MAAM,uBAAA,IAAI,qDAAM,MAAV,IAAI,EAAO;YACf,MAAM,EAAE,sBAAgB,CAAC,kBAAkB;YAC3C,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,EAA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6BAAQ,CAAC,IAAI,CAAC;QACvB,OAAO,EAAE,KAAK;QACd,EAAE,EAAE,IAAA,SAAI,GAAE;QACV,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { assert } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport type {\n Keyring,\n KeyringAccount,\n KeyringRequest,\n KeyringAccountData,\n KeyringResponse,\n CaipAssetType,\n Balance,\n} from './api';\nimport {\n ApproveRequestResponseStruct,\n CreateAccountResponseStruct,\n DeleteAccountResponseStruct,\n ExportAccountResponseStruct,\n FilterAccountChainsResponseStruct,\n GetAccountBalancesResponseStruct,\n GetAccountResponseStruct,\n GetRequestResponseStruct,\n ListAccountsResponseStruct,\n ListRequestsResponseStruct,\n RejectRequestResponseStruct,\n SubmitRequestResponseStruct,\n UpdateAccountResponseStruct,\n} from './internal/api';\nimport { KeyringRpcMethod } from './internal/rpc';\nimport type { JsonRpcRequest } from './JsonRpcRequest';\nimport { strictMask } from './superstruct';\n\nexport type Sender = {\n send(request: JsonRpcRequest): Promise<Json>;\n};\n\nexport class KeyringClient implements Keyring {\n readonly #sender: Sender;\n\n /**\n * Create a new instance of `KeyringClient`.\n *\n * @param sender - The `Sender` instance to use to send requests to the snap.\n */\n constructor(sender: Sender) {\n this.#sender = sender;\n }\n\n /**\n * Send a request to the snap and return the response.\n *\n * @param partial - A partial JSON-RPC request (method and params).\n * @returns A promise that resolves to the response to the request.\n */\n async #send(partial: Omit<JsonRpcRequest, 'jsonrpc' | 'id'>): Promise<Json> {\n return this.#sender.send({\n jsonrpc: '2.0',\n id: uuid(),\n ...partial,\n });\n }\n\n async listAccounts(): Promise<KeyringAccount[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListAccounts,\n }),\n ListAccountsResponseStruct,\n );\n }\n\n async getAccount(id: string): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccount,\n params: { id },\n }),\n GetAccountResponseStruct,\n );\n }\n\n async getAccountBalances(\n id: string,\n assets: CaipAssetType[],\n ): Promise<Record<CaipAssetType, Balance>> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetAccountBalances,\n params: { id, assets },\n }),\n GetAccountBalancesResponseStruct,\n );\n }\n\n async createAccount(\n options: Record<string, Json> = {},\n ): Promise<KeyringAccount> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.CreateAccount,\n params: { options },\n }),\n CreateAccountResponseStruct,\n );\n }\n\n async filterAccountChains(id: string, chains: string[]): Promise<string[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.FilterAccountChains,\n params: { id, chains },\n }),\n FilterAccountChainsResponseStruct,\n );\n }\n\n async updateAccount(account: KeyringAccount): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.UpdateAccount,\n params: { account },\n }),\n UpdateAccountResponseStruct,\n );\n }\n\n async deleteAccount(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.DeleteAccount,\n params: { id },\n }),\n DeleteAccountResponseStruct,\n );\n }\n\n async exportAccount(id: string): Promise<KeyringAccountData> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ExportAccount,\n params: { id },\n }),\n ExportAccountResponseStruct,\n );\n }\n\n async listRequests(): Promise<KeyringRequest[]> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.ListRequests,\n }),\n ListRequestsResponseStruct,\n );\n }\n\n async getRequest(id: string): Promise<KeyringRequest> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.GetRequest,\n params: { id },\n }),\n GetRequestResponseStruct,\n );\n }\n\n async submitRequest(request: KeyringRequest): Promise<KeyringResponse> {\n return strictMask(\n await this.#send({\n method: KeyringRpcMethod.SubmitRequest,\n params: request,\n }),\n SubmitRequestResponseStruct,\n );\n }\n\n async approveRequest(\n id: string,\n data: Record<string, Json> = {},\n ): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.ApproveRequest,\n params: { id, data },\n }),\n ApproveRequestResponseStruct,\n );\n }\n\n async rejectRequest(id: string): Promise<void> {\n assert(\n await this.#send({\n method: KeyringRpcMethod.RejectRequest,\n params: { id },\n }),\n RejectRequestResponseStruct,\n );\n }\n}\n"]}
@@ -1,29 +0,0 @@
1
- import type { Json } from "@metamask/utils";
2
- import type { Keyring, KeyringAccount, KeyringRequest, KeyringAccountData, KeyringResponse, CaipAssetType, Balance } from "./api/index.cjs";
3
- import type { JsonRpcRequest } from "./JsonRpcRequest.cjs";
4
- export type Sender = {
5
- send(request: JsonRpcRequest): Promise<Json>;
6
- };
7
- export declare class KeyringClient implements Keyring {
8
- #private;
9
- /**
10
- * Create a new instance of `KeyringClient`.
11
- *
12
- * @param sender - The `Sender` instance to use to send requests to the snap.
13
- */
14
- constructor(sender: Sender);
15
- listAccounts(): Promise<KeyringAccount[]>;
16
- getAccount(id: string): Promise<KeyringAccount>;
17
- getAccountBalances(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
18
- createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
19
- filterAccountChains(id: string, chains: string[]): Promise<string[]>;
20
- updateAccount(account: KeyringAccount): Promise<void>;
21
- deleteAccount(id: string): Promise<void>;
22
- exportAccount(id: string): Promise<KeyringAccountData>;
23
- listRequests(): Promise<KeyringRequest[]>;
24
- getRequest(id: string): Promise<KeyringRequest>;
25
- submitRequest(request: KeyringRequest): Promise<KeyringResponse>;
26
- approveRequest(id: string, data?: Record<string, Json>): Promise<void>;
27
- rejectRequest(id: string): Promise<void>;
28
- }
29
- //# sourceMappingURL=KeyringClient.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeyringClient.d.cts","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAG5C,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACd,kBAAkB,EACl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AC;IAUV,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAS/C"}
@@ -1,29 +0,0 @@
1
- import type { Json } from "@metamask/utils";
2
- import type { Keyring, KeyringAccount, KeyringRequest, KeyringAccountData, KeyringResponse, CaipAssetType, Balance } from "./api/index.mjs";
3
- import type { JsonRpcRequest } from "./JsonRpcRequest.mjs";
4
- export type Sender = {
5
- send(request: JsonRpcRequest): Promise<Json>;
6
- };
7
- export declare class KeyringClient implements Keyring {
8
- #private;
9
- /**
10
- * Create a new instance of `KeyringClient`.
11
- *
12
- * @param sender - The `Sender` instance to use to send requests to the snap.
13
- */
14
- constructor(sender: Sender);
15
- listAccounts(): Promise<KeyringAccount[]>;
16
- getAccount(id: string): Promise<KeyringAccount>;
17
- getAccountBalances(id: string, assets: CaipAssetType[]): Promise<Record<CaipAssetType, Balance>>;
18
- createAccount(options?: Record<string, Json>): Promise<KeyringAccount>;
19
- filterAccountChains(id: string, chains: string[]): Promise<string[]>;
20
- updateAccount(account: KeyringAccount): Promise<void>;
21
- deleteAccount(id: string): Promise<void>;
22
- exportAccount(id: string): Promise<KeyringAccountData>;
23
- listRequests(): Promise<KeyringRequest[]>;
24
- getRequest(id: string): Promise<KeyringRequest>;
25
- submitRequest(request: KeyringRequest): Promise<KeyringResponse>;
26
- approveRequest(id: string, data?: Record<string, Json>): Promise<void>;
27
- rejectRequest(id: string): Promise<void>;
28
- }
29
- //# sourceMappingURL=KeyringClient.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeyringClient.d.mts","sourceRoot":"","sources":["../src/KeyringClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAG5C,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,OAAO,EACR,wBAAc;AAiBf,OAAO,KAAK,EAAE,cAAc,EAAE,6BAAyB;AAGvD,MAA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