@metamask/keyring-api 11.0.0 → 11.1.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 (96) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/dist/KeyringClient.cjs +6 -0
  3. package/dist/KeyringClient.cjs.map +1 -1
  4. package/dist/KeyringClient.d.cts +3 -1
  5. package/dist/KeyringClient.d.cts.map +1 -1
  6. package/dist/KeyringClient.d.mts +3 -1
  7. package/dist/KeyringClient.d.mts.map +1 -1
  8. package/dist/KeyringClient.mjs +7 -1
  9. package/dist/KeyringClient.mjs.map +1 -1
  10. package/dist/api/asset.cjs +83 -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 +80 -0
  17. package/dist/api/asset.mjs.map +1 -0
  18. package/dist/api/balance.d.cts +1 -1
  19. package/dist/api/balance.d.mts +1 -1
  20. package/dist/api/index.cjs +2 -0
  21. package/dist/api/index.cjs.map +1 -1
  22. package/dist/api/index.d.cts +3 -1
  23. package/dist/api/index.d.cts.map +1 -1
  24. package/dist/api/index.d.mts +3 -1
  25. package/dist/api/index.d.mts.map +1 -1
  26. package/dist/api/index.mjs +2 -0
  27. package/dist/api/index.mjs.map +1 -1
  28. package/dist/api/keyring.cjs.map +1 -1
  29. package/dist/api/keyring.d.cts +14 -0
  30. package/dist/api/keyring.d.cts.map +1 -1
  31. package/dist/api/keyring.d.mts +14 -0
  32. package/dist/api/keyring.d.mts.map +1 -1
  33. package/dist/api/keyring.mjs.map +1 -1
  34. package/dist/api/transaction.cjs +295 -0
  35. package/dist/api/transaction.cjs.map +1 -0
  36. package/dist/api/transaction.d.cts +773 -0
  37. package/dist/api/transaction.d.cts.map +1 -0
  38. package/dist/api/transaction.d.mts +773 -0
  39. package/dist/api/transaction.d.mts.map +1 -0
  40. package/dist/api/transaction.mjs +292 -0
  41. package/dist/api/transaction.mjs.map +1 -0
  42. package/dist/eth/erc4337/types.d.cts +1 -1
  43. package/dist/eth/erc4337/types.d.mts +1 -1
  44. package/dist/internal/api.cjs +12 -1
  45. package/dist/internal/api.cjs.map +1 -1
  46. package/dist/internal/api.d.cts +318 -1
  47. package/dist/internal/api.d.cts.map +1 -1
  48. package/dist/internal/api.d.mts +318 -1
  49. package/dist/internal/api.d.mts.map +1 -1
  50. package/dist/internal/api.mjs +13 -2
  51. package/dist/internal/api.mjs.map +1 -1
  52. package/dist/internal/rpc.cjs +1 -0
  53. package/dist/internal/rpc.cjs.map +1 -1
  54. package/dist/internal/rpc.d.cts +1 -0
  55. package/dist/internal/rpc.d.cts.map +1 -1
  56. package/dist/internal/rpc.d.mts +1 -0
  57. package/dist/internal/rpc.d.mts.map +1 -1
  58. package/dist/internal/rpc.mjs +1 -0
  59. package/dist/internal/rpc.mjs.map +1 -1
  60. package/dist/rpc-handler.cjs +7 -0
  61. package/dist/rpc-handler.cjs.map +1 -1
  62. package/dist/rpc-handler.d.cts.map +1 -1
  63. package/dist/rpc-handler.d.mts.map +1 -1
  64. package/dist/rpc-handler.mjs +8 -1
  65. package/dist/rpc-handler.mjs.map +1 -1
  66. package/dist/superstruct.cjs +29 -0
  67. package/dist/superstruct.cjs.map +1 -1
  68. package/dist/superstruct.d.cts +19 -1
  69. package/dist/superstruct.d.cts.map +1 -1
  70. package/dist/superstruct.d.mts +19 -1
  71. package/dist/superstruct.d.mts.map +1 -1
  72. package/dist/superstruct.mjs +28 -0
  73. package/dist/superstruct.mjs.map +1 -1
  74. package/dist/utils/index.cjs +1 -0
  75. package/dist/utils/index.cjs.map +1 -1
  76. package/dist/utils/index.d.cts +1 -0
  77. package/dist/utils/index.d.cts.map +1 -1
  78. package/dist/utils/index.d.mts +1 -0
  79. package/dist/utils/index.d.mts.map +1 -1
  80. package/dist/utils/index.mjs +1 -0
  81. package/dist/utils/index.mjs.map +1 -1
  82. package/dist/utils/pagination.cjs +28 -0
  83. package/dist/utils/pagination.cjs.map +1 -0
  84. package/dist/utils/pagination.d.cts +59 -0
  85. package/dist/utils/pagination.d.cts.map +1 -0
  86. package/dist/utils/pagination.d.mts +59 -0
  87. package/dist/utils/pagination.d.mts.map +1 -0
  88. package/dist/utils/pagination.mjs +25 -0
  89. package/dist/utils/pagination.mjs.map +1 -0
  90. package/dist/utils/types.cjs.map +1 -1
  91. package/dist/utils/types.d.cts +24 -0
  92. package/dist/utils/types.d.cts.map +1 -1
  93. package/dist/utils/types.d.mts +24 -0
  94. package/dist/utils/types.d.mts.map +1 -1
  95. package/dist/utils/types.mjs.map +1 -1
  96. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.mts","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,KAAK,EAAE,WAAW,EAAE,2BAAuB;AAElD,OAAO,KAAK,EAAE,SAAS,EAAE,2BAAiB;AAkD1C;;GAEG;AACH,oBAAY,OAAO;IACjB;;;;;;OAMG;IACH,IAAI,SAAS;IAEb;;;;;OAKG;IACH,QAAQ,aAAa;CACtB;AAiBD;;GAEG;AACH,oBAAY,iBAAiB;IAC3B;;;OAGG;IACH,SAAS,cAAc;IAEvB;;;OAGG;IACH,WAAW,gBAAgB;IAE3B;;OAEG;IACH,SAAS,cAAc;IAEvB;;OAEG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,oBAAY,eAAe;IACzB;;;;OAIG;IACH,IAAI,SAAS;IAEb;;;OAGG;IACH,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;IACjC;;OAEG;;;;;;;IAQH;;OAEG;;EAEH,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;A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H;;eAEG;;;;;;;YAQH;;eAEG;;;;IAoKH;;;OAGG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CACxC,OAAO,sBAAsB,EAC7B,SAAS,CAAC,WAAW,CAAC,CACvB,CAAC"}
@@ -0,0 +1,292 @@
1
+ import { array, enums, nullable, number, string } from "@metamask/superstruct";
2
+ import { CaipChainIdStruct } from "@metamask/utils";
3
+ import { AssetStruct } from "./asset.mjs";
4
+ import { object } from "../superstruct.mjs";
5
+ import { UuidStruct } from "../utils/index.mjs";
6
+ /**
7
+ * This struct represents a participant in a transaction.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * {
12
+ * address: '0x1234...',
13
+ * asset: {
14
+ * fungible: true,
15
+ * type: 'eip155:1/slip44:60',
16
+ * unit: 'ETH',
17
+ * amount: '0.01',
18
+ * },
19
+ * },
20
+ * ```
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * {
25
+ * address: '0x1234...',
26
+ * asset: {
27
+ * fungible: false,
28
+ * id: 'eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769',
29
+ * },
30
+ * },
31
+ * ```
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * {
36
+ * address: '0x1234...',
37
+ * asset: null,
38
+ * },
39
+ * ```
40
+ */
41
+ const ParticipantStruct = object({
42
+ /**
43
+ * Participant address.
44
+ */
45
+ address: string(),
46
+ /**
47
+ * Asset being transferred.
48
+ */
49
+ asset: nullable(AssetStruct),
50
+ });
51
+ /**
52
+ * Fee types.
53
+ */
54
+ export var FeeType;
55
+ (function (FeeType) {
56
+ /**
57
+ * Base fee. It is the minimum fee required to include a transaction in the
58
+ * blockchain.
59
+ *
60
+ * For non-confirmed transactions, it must be the maximum base fee. For
61
+ * confirmed transactions, it must be the actual base fee paid.
62
+ */
63
+ FeeType["Base"] = "base";
64
+ /**
65
+ * Priority fee. It is an optional fee used to prioritize the transaction.
66
+ *
67
+ * For non-confirmed transactions, it must be the maximum priority fee. For
68
+ * confirmed transactions, it must be the actual priority fee paid.
69
+ */
70
+ FeeType["Priority"] = "priority";
71
+ })(FeeType || (FeeType = {}));
72
+ /**
73
+ * This struct represents a transaction fee.
74
+ */
75
+ const FeeStruct = object({
76
+ /**
77
+ * Fee type {@see FeeType}.
78
+ */
79
+ type: enums([`${FeeType.Base}`, `${FeeType.Priority}`]),
80
+ /**
81
+ * Asset used to pay for the fee.
82
+ */
83
+ asset: AssetStruct,
84
+ });
85
+ /**
86
+ * Transaction statuses.
87
+ */
88
+ export var TransactionStatus;
89
+ (function (TransactionStatus) {
90
+ /**
91
+ * The transaction has been submitted but is not yet in the
92
+ * blockchain. For example, it can be in the mempool.
93
+ */
94
+ TransactionStatus["Submitted"] = "submitted";
95
+ /**
96
+ * The transaction is in the blockchain but has not been
97
+ * confirmed yet.
98
+ */
99
+ TransactionStatus["Unconfirmed"] = "unconfirmed";
100
+ /**
101
+ * The transaction has been confirmed.
102
+ */
103
+ TransactionStatus["Confirmed"] = "confirmed";
104
+ /**
105
+ * The transaction has failed. For example, it has been reverted.
106
+ */
107
+ TransactionStatus["Failed"] = "failed";
108
+ })(TransactionStatus || (TransactionStatus = {}));
109
+ /**
110
+ * Transaction types.
111
+ */
112
+ export var TransactionType;
113
+ (function (TransactionType) {
114
+ /**
115
+ * The transaction was originated by the account. If the transaction
116
+ * has a change output that goes back to the same account, it must be tagged
117
+ * as a send transaction.
118
+ */
119
+ TransactionType["Send"] = "send";
120
+ /**
121
+ * The transaction was received by the account, but originated by
122
+ * another account.
123
+ */
124
+ TransactionType["Receive"] = "receive";
125
+ })(TransactionType || (TransactionType = {}));
126
+ /**
127
+ * This struct represents a transaction event.
128
+ */
129
+ export const TransactionEventStruct = object({
130
+ /**
131
+ * New status of the transaction.
132
+ */
133
+ status: enums([
134
+ `${TransactionStatus.Submitted}`,
135
+ `${TransactionStatus.Unconfirmed}`,
136
+ `${TransactionStatus.Confirmed}`,
137
+ `${TransactionStatus.Failed}`,
138
+ ]),
139
+ /**
140
+ * UNIX timestamp of when the event occurred.
141
+ */
142
+ timestamp: nullable(number()),
143
+ });
144
+ /**
145
+ * This struct represents a blockchain transaction.
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * const tx = {
150
+ * id: 'f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6',
151
+ * chain: 'bip122:000000000019d6689c085ae165831e93',
152
+ * account: 'b9beb861-9761-4b97-89ce-d992be5f34da',
153
+ * status: 'confirmed',
154
+ * timestamp: 1716367781,
155
+ * type: 'send',
156
+ * from: [
157
+ * {
158
+ * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',
159
+ * asset: {
160
+ * fungible: true,
161
+ * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
162
+ * unit: 'BTC',
163
+ * amount: '0.1',
164
+ * },
165
+ * },
166
+ * ],
167
+ * to: [
168
+ * {
169
+ * address: 'bc1qrp0yzgkf8rawkuvdlhnjfj2fnjwm0m8727kgah',
170
+ * asset: {
171
+ * fungible: true,
172
+ * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
173
+ * unit: 'BTC',
174
+ * amount: '0.1',
175
+ * },
176
+ * },
177
+ * {
178
+ * address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',
179
+ * asset: {
180
+ * fungible: true,
181
+ * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
182
+ * unit: 'BTC',
183
+ * amount: '0.1',
184
+ * },
185
+ * },
186
+ * ],
187
+ * fees: [
188
+ * {
189
+ * type: 'priority',
190
+ * asset: {
191
+ * fungible: true,
192
+ * type: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
193
+ * unit: 'BTC',
194
+ * amount: '0.1',
195
+ * },
196
+ * },
197
+ * ],
198
+ * };
199
+ * ```
200
+ */
201
+ export const TransactionStruct = object({
202
+ /**
203
+ * Chain-specific transaction ID.
204
+ */
205
+ id: string(),
206
+ /**
207
+ * Chain ID (CAIP-2).
208
+ */
209
+ chain: CaipChainIdStruct,
210
+ /**
211
+ * Account ID (UUIDv4).
212
+ */
213
+ account: UuidStruct,
214
+ /**
215
+ * Transaction status {@see TransactionStatus}.
216
+ */
217
+ status: enums([
218
+ `${TransactionStatus.Submitted}`,
219
+ `${TransactionStatus.Unconfirmed}`,
220
+ `${TransactionStatus.Confirmed}`,
221
+ `${TransactionStatus.Failed}`,
222
+ ]),
223
+ /**
224
+ * UNIX timestamp of when the transaction was added to the blockchain. The
225
+ * timestamp can be null if the transaction has not been included in the
226
+ * blockchain yet.
227
+ */
228
+ timestamp: nullable(number()),
229
+ /**
230
+ * Transaction type {@see TransactionType}. This will be used by MetaMask to enrich the transaction
231
+ * details on the UI.
232
+ */
233
+ type: enums([`${TransactionType.Send}`, `${TransactionType.Receive}`]),
234
+ /**
235
+ * Transaction sender addresses and amounts.
236
+ */
237
+ from: array(ParticipantStruct),
238
+ /**
239
+ * Transaction receiver addresses and amounts.
240
+ */
241
+ to: array(ParticipantStruct),
242
+ /**
243
+ * Total transaction fee.
244
+ */
245
+ fees: array(FeeStruct),
246
+ /**
247
+ * List of events related to the transaction {@see TransactionEventStruct}.
248
+ *
249
+ * The events are tracked in a best-effort basis and may not be available for
250
+ * all transactions.
251
+ */
252
+ events: array(TransactionEventStruct),
253
+ });
254
+ /**
255
+ * This struct represents a page of transactions.
256
+ *
257
+ * @example
258
+ * ```ts
259
+ * {
260
+ * data: [
261
+ * {
262
+ * // Transaction object
263
+ * }
264
+ * ],
265
+ * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',
266
+ * }
267
+ * ```
268
+ *
269
+ * @example
270
+ * ```ts
271
+ * {
272
+ * data: [
273
+ * {
274
+ * // Transaction object
275
+ * }
276
+ * ],
277
+ * next: null, // No more results
278
+ * }**
279
+ * ```
280
+ */
281
+ export const TransactionsPageStruct = object({
282
+ /**
283
+ * List of transactions.
284
+ */
285
+ data: array(TransactionStruct),
286
+ /**
287
+ * Next cursor to iterate over the results. If null, there are no more
288
+ * results.
289
+ */
290
+ next: nullable(string()),
291
+ });
292
+ //# sourceMappingURL=transaction.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.mjs","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAC/E,OAAO,EAAE,iBAAiB,EAAE,wBAAwB;AAEpD,OAAO,EAAE,WAAW,EAAE,oBAAgB;AAEtC,OAAO,EAAE,MAAM,EAAE,2BAAuB;AAExC,OAAO,EAAE,UAAU,EAAE,2BAAiB;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC;IAC/B;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE;IAEjB;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC;CAC7B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,OAiBX;AAjBD,WAAY,OAAO;IACjB;;;;;;OAMG;IACH,wBAAa,CAAA;IAEb;;;;;OAKG;IACH,gCAAqB,CAAA;AACvB,CAAC,EAjBW,OAAO,KAAP,OAAO,QAiBlB;AAED;;GAEG;AACH,MAAM,SAAS,GAAG,MAAM,CAAC;IACvB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEvD;;OAEG;IACH,KAAK,EAAE,WAAW;CACnB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,iBAsBX;AAtBD,WAAY,iBAAiB;IAC3B;;;OAGG;IACH,4CAAuB,CAAA;IAEvB;;;OAGG;IACH,gDAA2B,CAAA;IAE3B;;OAEG;IACH,4CAAuB,CAAA;IAE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AO,EAAE,CAAC,CAAC;IAEtE;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE9B;;OAEG;IACH,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE5B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IAEtB;;;;;OAKG;IACH,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC;CACtC,CAAC,CAAC;AASH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;IAC3C;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAE9B;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CAAC","sourcesContent":["import type { 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"]}
@@ -36,8 +36,8 @@ export type EthUserOperation = Infer<typeof EthUserOperationStruct>;
36
36
  */
37
37
  export declare const EthBaseTransactionStruct: import("@metamask/superstruct").Struct<{
38
38
  value: string;
39
- data: string;
40
39
  to: string;
40
+ data: string;
41
41
  }, {
42
42
  /**
43
43
  * Address of the transaction recipient.
@@ -36,8 +36,8 @@ export type EthUserOperation = Infer<typeof EthUserOperationStruct>;
36
36
  */
37
37
  export declare const EthBaseTransactionStruct: import("@metamask/superstruct").Struct<{
38
38
  value: string;
39
- data: string;
40
39
  to: string;
40
+ data: string;
41
41
  }, {
42
42
  /**
43
43
  * Address of the transaction recipient.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = void 0;
3
+ exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.ListAccountTransactionsResponseStruct = exports.ListAccountTransactionsRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = void 0;
4
4
  const superstruct_1 = require("@metamask/superstruct");
5
5
  const utils_1 = require("@metamask/utils");
6
6
  const rpc_1 = require("./rpc.cjs");
@@ -39,6 +39,17 @@ exports.CreateAccountRequestStruct = (0, superstruct_2.object)({
39
39
  });
40
40
  exports.CreateAccountResponseStruct = api_1.KeyringAccountStruct;
41
41
  // ----------------------------------------------------------------------------
42
+ // List account transactions
43
+ exports.ListAccountTransactionsRequestStruct = (0, superstruct_2.object)({
44
+ ...CommonHeader,
45
+ method: (0, superstruct_1.literal)('keyring_listAccountTransactions'),
46
+ params: (0, superstruct_2.object)({
47
+ id: utils_2.UuidStruct,
48
+ pagination: utils_2.PaginationStruct,
49
+ }),
50
+ });
51
+ exports.ListAccountTransactionsResponseStruct = api_1.TransactionsPageStruct;
52
+ // ----------------------------------------------------------------------------
42
53
  // Get account balances
43
54
  exports.GetAccountBalancesRequestStruct = (0, superstruct_2.object)({
44
55
  ...CommonHeader,
@@ -1 +1 @@
1
- {"version":3,"file":"api.cjs","sourceRoot":"","sources":["../../src/internal/api.ts"],"names":[],"mappings":";;;AACA,uDAO+B;AAC/B,2CAA6C;AAE7C,mCAAyC;AACzC,0CAOgB;AAChB,oDAAwC;AACxC,8CAAsC;AAEtC,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,gBAAgB;AAEH,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,sBAAsB,CAAC;CACxC,CAAC,CAAC;AAIU,QAAA,0BAA0B,GAAG,IAAA,mBAAK,EAAC,0BAAoB,CAAC,CAAC;AAItE,+EAA+E;AAC/E,cAAc;AAED,QAAA,uBAAuB,GAAG,IAAA,oBAAM,EAAC;IAC5C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACrC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;KACf,CAAC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,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,wBAAwB,GAAG,0BAAoB,CAAC;AAI7D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,0BAAoB;CAC7B,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,2BAAqB,CAAC;AAIjE,+EAA+E;AAC/E,kBAAkB;AAEL,QAAA,2BAA2B,GAAG,IAAA,oBAAM,EAAC;IAChD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,wBAAwB,CAAC;IACzC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;QACd,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,4BAA4B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import 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 { KeyringRpcMethod } from './rpc';\nimport {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n} from '../api';\nimport { object } from '../superstruct';\nimport { UuidStruct } from '../utils';\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// 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
+ {"version":3,"file":"api.cjs","sourceRoot":"","sources":["../../src/internal/api.ts"],"names":[],"mappings":";;;AACA,uDAO+B;AAC/B,2CAA6C;AAE7C,mCAAyC;AACzC,0CAQgB;AAChB,oDAAwC;AACxC,8CAAwD;AAExD,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAA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EL,QAAA,2BAA2B,GAAG,IAAA,oBAAM,EAAC;IAChD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,wBAAwB,CAAC;IACzC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;QACd,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,4BAA4B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import 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 { KeyringRpcMethod } from './rpc';\nimport {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n TransactionsPageStruct,\n} from '../api';\nimport { object } from '../superstruct';\nimport { PaginationStruct, UuidStruct } from '../utils';\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"]}