@metamask/keyring-api 14.0.0 → 15.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 (60) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/dist/api/account.cjs +2 -2
  3. package/dist/api/account.cjs.map +1 -1
  4. package/dist/api/account.d.cts +1 -1
  5. package/dist/api/account.d.mts +1 -1
  6. package/dist/api/account.mjs +3 -3
  7. package/dist/api/account.mjs.map +1 -1
  8. package/dist/api/asset.cjs +15 -9
  9. package/dist/api/asset.cjs.map +1 -1
  10. package/dist/api/asset.d.cts +25 -9
  11. package/dist/api/asset.d.cts.map +1 -1
  12. package/dist/api/asset.d.mts +25 -9
  13. package/dist/api/asset.d.mts.map +1 -1
  14. package/dist/api/asset.mjs +14 -8
  15. package/dist/api/asset.mjs.map +1 -1
  16. package/dist/api/transaction.d.cts +30 -30
  17. package/dist/api/transaction.d.mts +30 -30
  18. package/dist/btc/types.cjs +7 -0
  19. package/dist/btc/types.cjs.map +1 -1
  20. package/dist/btc/types.d.cts +7 -2
  21. package/dist/btc/types.d.cts.map +1 -1
  22. package/dist/btc/types.d.mts +7 -2
  23. package/dist/btc/types.d.mts.map +1 -1
  24. package/dist/btc/types.mjs +8 -1
  25. package/dist/btc/types.mjs.map +1 -1
  26. package/dist/eth/constants.cjs +1 -0
  27. package/dist/eth/constants.cjs.map +1 -1
  28. package/dist/eth/constants.d.cts +2 -1
  29. package/dist/eth/constants.d.cts.map +1 -1
  30. package/dist/eth/constants.d.mts +2 -1
  31. package/dist/eth/constants.d.mts.map +1 -1
  32. package/dist/eth/constants.mjs +1 -0
  33. package/dist/eth/constants.mjs.map +1 -1
  34. package/dist/eth/types.cjs +5 -0
  35. package/dist/eth/types.cjs.map +1 -1
  36. package/dist/eth/types.d.cts +5 -2
  37. package/dist/eth/types.d.cts.map +1 -1
  38. package/dist/eth/types.d.mts +5 -2
  39. package/dist/eth/types.d.mts.map +1 -1
  40. package/dist/eth/types.mjs +5 -0
  41. package/dist/eth/types.mjs.map +1 -1
  42. package/dist/events.cjs +75 -1
  43. package/dist/events.cjs.map +1 -1
  44. package/dist/events.d.cts +240 -1
  45. package/dist/events.d.cts.map +1 -1
  46. package/dist/events.d.mts +240 -1
  47. package/dist/events.d.mts.map +1 -1
  48. package/dist/events.mjs +78 -4
  49. package/dist/events.mjs.map +1 -1
  50. package/dist/rpc.d.cts +18 -18
  51. package/dist/rpc.d.mts +18 -18
  52. package/dist/sol/types.cjs +5 -0
  53. package/dist/sol/types.cjs.map +1 -1
  54. package/dist/sol/types.d.cts +5 -2
  55. package/dist/sol/types.d.cts.map +1 -1
  56. package/dist/sol/types.d.mts +5 -2
  57. package/dist/sol/types.d.mts.map +1 -1
  58. package/dist/sol/types.mjs +6 -1
  59. package/dist/sol/types.mjs.map +1 -1
  60. package/package.json +3 -3
package/dist/rpc.d.cts CHANGED
@@ -184,8 +184,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
184
184
  asset: {
185
185
  unit: string;
186
186
  type: `${string}:${string}/${string}:${string}`;
187
- fungible: true;
188
187
  amount: string;
188
+ fungible: true;
189
189
  } | {
190
190
  id: `${string}:${string}/${string}:${string}/${string}`;
191
191
  fungible: false;
@@ -204,8 +204,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
204
204
  asset: {
205
205
  unit: string;
206
206
  type: `${string}:${string}/${string}:${string}`;
207
- fungible: true;
208
207
  amount: string;
208
+ fungible: true;
209
209
  } | {
210
210
  id: `${string}:${string}/${string}:${string}/${string}`;
211
211
  fungible: false;
@@ -216,8 +216,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
216
216
  asset: {
217
217
  unit: string;
218
218
  type: `${string}:${string}/${string}:${string}`;
219
- fungible: true;
220
219
  amount: string;
220
+ fungible: true;
221
221
  } | {
222
222
  id: `${string}:${string}/${string}:${string}/${string}`;
223
223
  fungible: false;
@@ -234,8 +234,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
234
234
  asset: {
235
235
  unit: string;
236
236
  type: `${string}:${string}/${string}:${string}`;
237
- fungible: true;
238
237
  amount: string;
238
+ fungible: true;
239
239
  } | {
240
240
  id: `${string}:${string}/${string}:${string}/${string}`;
241
241
  fungible: false;
@@ -254,8 +254,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
254
254
  asset: {
255
255
  unit: string;
256
256
  type: `${string}:${string}/${string}:${string}`;
257
- fungible: true;
258
257
  amount: string;
258
+ fungible: true;
259
259
  } | {
260
260
  id: `${string}:${string}/${string}:${string}/${string}`;
261
261
  fungible: false;
@@ -266,8 +266,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
266
266
  asset: {
267
267
  unit: string;
268
268
  type: `${string}:${string}/${string}:${string}`;
269
- fungible: true;
270
269
  amount: string;
270
+ fungible: true;
271
271
  } | {
272
272
  id: `${string}:${string}/${string}:${string}/${string}`;
273
273
  fungible: false;
@@ -281,8 +281,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
281
281
  asset: {
282
282
  unit: string;
283
283
  type: `${string}:${string}/${string}:${string}`;
284
- fungible: true;
285
284
  amount: string;
285
+ fungible: true;
286
286
  } | {
287
287
  id: `${string}:${string}/${string}:${string}/${string}`;
288
288
  fungible: false;
@@ -301,8 +301,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
301
301
  asset: {
302
302
  unit: string;
303
303
  type: `${string}:${string}/${string}:${string}`;
304
- fungible: true;
305
304
  amount: string;
305
+ fungible: true;
306
306
  } | {
307
307
  id: `${string}:${string}/${string}:${string}/${string}`;
308
308
  fungible: false;
@@ -313,8 +313,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
313
313
  asset: {
314
314
  unit: string;
315
315
  type: `${string}:${string}/${string}:${string}`;
316
- fungible: true;
317
316
  amount: string;
317
+ fungible: true;
318
318
  } | {
319
319
  id: `${string}:${string}/${string}:${string}/${string}`;
320
320
  fungible: false;
@@ -340,8 +340,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
340
340
  asset: {
341
341
  unit: string;
342
342
  type: `${string}:${string}/${string}:${string}`;
343
- fungible: true;
344
343
  amount: string;
344
+ fungible: true;
345
345
  } | {
346
346
  id: `${string}:${string}/${string}:${string}/${string}`;
347
347
  fungible: false;
@@ -351,8 +351,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
351
351
  asset: {
352
352
  unit: string;
353
353
  type: `${string}:${string}/${string}:${string}`;
354
- fungible: true;
355
354
  amount: string;
355
+ fungible: true;
356
356
  } | {
357
357
  id: `${string}:${string}/${string}:${string}/${string}`;
358
358
  fungible: false;
@@ -362,8 +362,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
362
362
  asset: import("@metamask/superstruct").Struct<{
363
363
  unit: string;
364
364
  type: `${string}:${string}/${string}:${string}`;
365
- fungible: true;
366
365
  amount: string;
366
+ fungible: true;
367
367
  } | {
368
368
  id: `${string}:${string}/${string}:${string}/${string}`;
369
369
  fungible: false;
@@ -374,8 +374,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
374
374
  asset: {
375
375
  unit: string;
376
376
  type: `${string}:${string}/${string}:${string}`;
377
- fungible: true;
378
377
  amount: string;
378
+ fungible: true;
379
379
  } | {
380
380
  id: `${string}:${string}/${string}:${string}/${string}`;
381
381
  fungible: false;
@@ -385,8 +385,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
385
385
  asset: {
386
386
  unit: string;
387
387
  type: `${string}:${string}/${string}:${string}`;
388
- fungible: true;
389
388
  amount: string;
389
+ fungible: true;
390
390
  } | {
391
391
  id: `${string}:${string}/${string}:${string}/${string}`;
392
392
  fungible: false;
@@ -396,8 +396,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
396
396
  asset: import("@metamask/superstruct").Struct<{
397
397
  unit: string;
398
398
  type: `${string}:${string}/${string}:${string}`;
399
- fungible: true;
400
399
  amount: string;
400
+ fungible: true;
401
401
  } | {
402
402
  id: `${string}:${string}/${string}:${string}/${string}`;
403
403
  fungible: false;
@@ -408,8 +408,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
408
408
  asset: {
409
409
  unit: string;
410
410
  type: `${string}:${string}/${string}:${string}`;
411
- fungible: true;
412
411
  amount: string;
412
+ fungible: true;
413
413
  } | {
414
414
  id: `${string}:${string}/${string}:${string}/${string}`;
415
415
  fungible: false;
@@ -419,8 +419,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
419
419
  asset: {
420
420
  unit: string;
421
421
  type: `${string}:${string}/${string}:${string}`;
422
- fungible: true;
423
422
  amount: string;
423
+ fungible: true;
424
424
  } | {
425
425
  id: `${string}:${string}/${string}:${string}/${string}`;
426
426
  fungible: false;
@@ -433,8 +433,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
433
433
  asset: import("@metamask/superstruct").Struct<{
434
434
  unit: string;
435
435
  type: `${string}:${string}/${string}:${string}`;
436
- fungible: true;
437
436
  amount: string;
437
+ fungible: true;
438
438
  } | {
439
439
  id: `${string}:${string}/${string}:${string}/${string}`;
440
440
  fungible: false;
package/dist/rpc.d.mts CHANGED
@@ -184,8 +184,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
184
184
  asset: {
185
185
  unit: string;
186
186
  type: `${string}:${string}/${string}:${string}`;
187
- fungible: true;
188
187
  amount: string;
188
+ fungible: true;
189
189
  } | {
190
190
  id: `${string}:${string}/${string}:${string}/${string}`;
191
191
  fungible: false;
@@ -204,8 +204,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
204
204
  asset: {
205
205
  unit: string;
206
206
  type: `${string}:${string}/${string}:${string}`;
207
- fungible: true;
208
207
  amount: string;
208
+ fungible: true;
209
209
  } | {
210
210
  id: `${string}:${string}/${string}:${string}/${string}`;
211
211
  fungible: false;
@@ -216,8 +216,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
216
216
  asset: {
217
217
  unit: string;
218
218
  type: `${string}:${string}/${string}:${string}`;
219
- fungible: true;
220
219
  amount: string;
220
+ fungible: true;
221
221
  } | {
222
222
  id: `${string}:${string}/${string}:${string}/${string}`;
223
223
  fungible: false;
@@ -234,8 +234,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
234
234
  asset: {
235
235
  unit: string;
236
236
  type: `${string}:${string}/${string}:${string}`;
237
- fungible: true;
238
237
  amount: string;
238
+ fungible: true;
239
239
  } | {
240
240
  id: `${string}:${string}/${string}:${string}/${string}`;
241
241
  fungible: false;
@@ -254,8 +254,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
254
254
  asset: {
255
255
  unit: string;
256
256
  type: `${string}:${string}/${string}:${string}`;
257
- fungible: true;
258
257
  amount: string;
258
+ fungible: true;
259
259
  } | {
260
260
  id: `${string}:${string}/${string}:${string}/${string}`;
261
261
  fungible: false;
@@ -266,8 +266,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
266
266
  asset: {
267
267
  unit: string;
268
268
  type: `${string}:${string}/${string}:${string}`;
269
- fungible: true;
270
269
  amount: string;
270
+ fungible: true;
271
271
  } | {
272
272
  id: `${string}:${string}/${string}:${string}/${string}`;
273
273
  fungible: false;
@@ -281,8 +281,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
281
281
  asset: {
282
282
  unit: string;
283
283
  type: `${string}:${string}/${string}:${string}`;
284
- fungible: true;
285
284
  amount: string;
285
+ fungible: true;
286
286
  } | {
287
287
  id: `${string}:${string}/${string}:${string}/${string}`;
288
288
  fungible: false;
@@ -301,8 +301,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
301
301
  asset: {
302
302
  unit: string;
303
303
  type: `${string}:${string}/${string}:${string}`;
304
- fungible: true;
305
304
  amount: string;
305
+ fungible: true;
306
306
  } | {
307
307
  id: `${string}:${string}/${string}:${string}/${string}`;
308
308
  fungible: false;
@@ -313,8 +313,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
313
313
  asset: {
314
314
  unit: string;
315
315
  type: `${string}:${string}/${string}:${string}`;
316
- fungible: true;
317
316
  amount: string;
317
+ fungible: true;
318
318
  } | {
319
319
  id: `${string}:${string}/${string}:${string}/${string}`;
320
320
  fungible: false;
@@ -340,8 +340,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
340
340
  asset: {
341
341
  unit: string;
342
342
  type: `${string}:${string}/${string}:${string}`;
343
- fungible: true;
344
343
  amount: string;
344
+ fungible: true;
345
345
  } | {
346
346
  id: `${string}:${string}/${string}:${string}/${string}`;
347
347
  fungible: false;
@@ -351,8 +351,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
351
351
  asset: {
352
352
  unit: string;
353
353
  type: `${string}:${string}/${string}:${string}`;
354
- fungible: true;
355
354
  amount: string;
355
+ fungible: true;
356
356
  } | {
357
357
  id: `${string}:${string}/${string}:${string}/${string}`;
358
358
  fungible: false;
@@ -362,8 +362,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
362
362
  asset: import("@metamask/superstruct").Struct<{
363
363
  unit: string;
364
364
  type: `${string}:${string}/${string}:${string}`;
365
- fungible: true;
366
365
  amount: string;
366
+ fungible: true;
367
367
  } | {
368
368
  id: `${string}:${string}/${string}:${string}/${string}`;
369
369
  fungible: false;
@@ -374,8 +374,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
374
374
  asset: {
375
375
  unit: string;
376
376
  type: `${string}:${string}/${string}:${string}`;
377
- fungible: true;
378
377
  amount: string;
378
+ fungible: true;
379
379
  } | {
380
380
  id: `${string}:${string}/${string}:${string}/${string}`;
381
381
  fungible: false;
@@ -385,8 +385,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
385
385
  asset: {
386
386
  unit: string;
387
387
  type: `${string}:${string}/${string}:${string}`;
388
- fungible: true;
389
388
  amount: string;
389
+ fungible: true;
390
390
  } | {
391
391
  id: `${string}:${string}/${string}:${string}/${string}`;
392
392
  fungible: false;
@@ -396,8 +396,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
396
396
  asset: import("@metamask/superstruct").Struct<{
397
397
  unit: string;
398
398
  type: `${string}:${string}/${string}:${string}`;
399
- fungible: true;
400
399
  amount: string;
400
+ fungible: true;
401
401
  } | {
402
402
  id: `${string}:${string}/${string}:${string}/${string}`;
403
403
  fungible: false;
@@ -408,8 +408,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
408
408
  asset: {
409
409
  unit: string;
410
410
  type: `${string}:${string}/${string}:${string}`;
411
- fungible: true;
412
411
  amount: string;
412
+ fungible: true;
413
413
  } | {
414
414
  id: `${string}:${string}/${string}:${string}/${string}`;
415
415
  fungible: false;
@@ -419,8 +419,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
419
419
  asset: {
420
420
  unit: string;
421
421
  type: `${string}:${string}/${string}:${string}`;
422
- fungible: true;
423
422
  amount: string;
423
+ fungible: true;
424
424
  } | {
425
425
  id: `${string}:${string}/${string}:${string}/${string}`;
426
426
  fungible: false;
@@ -433,8 +433,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
433
433
  asset: import("@metamask/superstruct").Struct<{
434
434
  unit: string;
435
435
  type: `${string}:${string}/${string}:${string}`;
436
- fungible: true;
437
436
  amount: string;
437
+ fungible: true;
438
438
  } | {
439
439
  id: `${string}:${string}/${string}:${string}/${string}`;
440
440
  fungible: false;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SolDataAccountStruct = exports.SolMethod = exports.SolAddressStruct = void 0;
4
4
  const keyring_utils_1 = require("@metamask/keyring-utils");
5
5
  const superstruct_1 = require("@metamask/superstruct");
6
+ const utils_1 = require("@metamask/utils");
6
7
  const api_1 = require("../api/index.cjs");
7
8
  /**
8
9
  * Solana addresses are represented in the format of a 256-bit ed25519 public key and
@@ -28,6 +29,10 @@ exports.SolDataAccountStruct = (0, keyring_utils_1.object)({
28
29
  * Account type.
29
30
  */
30
31
  type: (0, superstruct_1.literal)(`${api_1.SolAccountType.DataAccount}`),
32
+ /**
33
+ * Account supported scopes (CAIP-2 chain IDs).
34
+ */
35
+ scopes: (0, superstruct_1.nonempty)((0, superstruct_1.array)(utils_1.CaipChainIdStruct)),
31
36
  /**
32
37
  * Account supported methods.
33
38
  */
@@ -1 +1 @@
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"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,uDAAwE;AACxE,2CAAoD;AAEpD,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,MAAM,EAAE,IAAA,sBAAQ,EAAC,IAAA,mBAAK,EAAC,yBAAiB,CAAC,CAAC;IAE1C;;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, nonempty } from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\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 scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(enums([`${SolMethod.SendAndConfirmTransaction}`])),\n});\n\nexport type SolDataAccount = Infer<typeof SolDataAccountStruct>;\n"]}
@@ -16,7 +16,7 @@ export declare const SolDataAccountStruct: import("@metamask/superstruct").Struc
16
16
  id: string;
17
17
  options: Record<string, import("@metamask/utils").Json>;
18
18
  address: string;
19
- scopes: string[];
19
+ scopes: `${string}:${string}`[];
20
20
  methods: "sendAndConfirmTransaction"[];
21
21
  }, {
22
22
  /**
@@ -27,6 +27,10 @@ export declare const SolDataAccountStruct: import("@metamask/superstruct").Struc
27
27
  * Account type.
28
28
  */
29
29
  type: import("@metamask/superstruct").Struct<"solana:data-account", "solana:data-account">;
30
+ /**
31
+ * Account supported scopes (CAIP-2 chain IDs).
32
+ */
33
+ scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
30
34
  /**
31
35
  * Account supported methods.
32
36
  */
@@ -34,7 +38,6 @@ export declare const SolDataAccountStruct: import("@metamask/superstruct").Struc
34
38
  sendAndConfirmTransaction: "sendAndConfirmTransaction";
35
39
  }>>;
36
40
  id: import("@metamask/superstruct").Struct<string, null>;
37
- scopes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
38
41
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
39
42
  }>;
40
43
  export type SolDataAccount = Infer<typeof SolDataAccountStruct>;
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,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;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -16,7 +16,7 @@ export declare const SolDataAccountStruct: import("@metamask/superstruct").Struc
16
16
  id: string;
17
17
  options: Record<string, import("@metamask/utils").Json>;
18
18
  address: string;
19
- scopes: string[];
19
+ scopes: `${string}:${string}`[];
20
20
  methods: "sendAndConfirmTransaction"[];
21
21
  }, {
22
22
  /**
@@ -27,6 +27,10 @@ export declare const SolDataAccountStruct: import("@metamask/superstruct").Struc
27
27
  * Account type.
28
28
  */
29
29
  type: import("@metamask/superstruct").Struct<"solana:data-account", "solana:data-account">;
30
+ /**
31
+ * Account supported scopes (CAIP-2 chain IDs).
32
+ */
33
+ scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
30
34
  /**
31
35
  * Account supported methods.
32
36
  */
@@ -34,7 +38,6 @@ export declare const SolDataAccountStruct: import("@metamask/superstruct").Struc
34
38
  sendAndConfirmTransaction: "sendAndConfirmTransaction";
35
39
  }>>;
36
40
  id: import("@metamask/superstruct").Struct<string, null>;
37
- scopes: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
38
41
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
39
42
  }>;
40
43
  export type SolDataAccount = Infer<typeof SolDataAccountStruct>;
@@ -1 +1 @@
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
+ {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,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;;IAGH;;OAEG;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { object, definePattern } from "@metamask/keyring-utils";
2
- import { array, enums, literal } from "@metamask/superstruct";
2
+ import { array, enums, literal, nonempty } from "@metamask/superstruct";
3
+ import { CaipChainIdStruct } from "@metamask/utils";
3
4
  import { KeyringAccountStruct, SolAccountType } from "../api/index.mjs";
4
5
  /**
5
6
  * Solana addresses are represented in the format of a 256-bit ed25519 public key and
@@ -25,6 +26,10 @@ export const SolDataAccountStruct = object({
25
26
  * Account type.
26
27
  */
27
28
  type: literal(`${SolAccountType.DataAccount}`),
29
+ /**
30
+ * Account supported scopes (CAIP-2 chain IDs).
31
+ */
32
+ scopes: nonempty(array(CaipChainIdStruct)),
28
33
  /**
29
34
  * Account supported methods.
30
35
  */
@@ -1 +1 @@
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"]}
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,QAAQ,EAAE,8BAA8B;AACxE,OAAO,EAAE,iBAAiB,EAAE,wBAAwB;AAEpD,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,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE1C;;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, nonempty } from '@metamask/superstruct';\nimport { CaipChainIdStruct } from '@metamask/utils';\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 scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\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": "14.0.0",
3
+ "version": "15.0.0",
4
4
  "description": "MetaMask Keyring API",
5
5
  "keywords": [
6
6
  "metamask",
@@ -46,7 +46,7 @@
46
46
  "test:watch": "jest --watch"
47
47
  },
48
48
  "dependencies": {
49
- "@metamask/keyring-utils": "^1.2.0",
49
+ "@metamask/keyring-utils": "^1.3.0",
50
50
  "@metamask/superstruct": "^3.1.0",
51
51
  "@metamask/utils": "^11.0.1",
52
52
  "bech32": "^2.0.0"
@@ -55,7 +55,7 @@
55
55
  "@lavamoat/allow-scripts": "^3.2.1",
56
56
  "@lavamoat/preinstall-always-fail": "^2.1.0",
57
57
  "@metamask/auto-changelog": "^3.4.4",
58
- "@metamask/keyring-utils": "^1.2.0",
58
+ "@metamask/keyring-utils": "^1.3.0",
59
59
  "@ts-bridge/cli": "^0.6.1",
60
60
  "@types/jest": "^29.5.12",
61
61
  "@types/node": "^20.12.12",