@metamask/keyring-api 13.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.
- package/CHANGELOG.md +24 -1
- package/dist/api/account.cjs +2 -2
- package/dist/api/account.cjs.map +1 -1
- package/dist/api/account.d.cts +1 -1
- package/dist/api/account.d.mts +1 -1
- package/dist/api/account.mjs +3 -3
- package/dist/api/account.mjs.map +1 -1
- package/dist/api/asset.cjs +15 -9
- package/dist/api/asset.cjs.map +1 -1
- package/dist/api/asset.d.cts +25 -9
- package/dist/api/asset.d.cts.map +1 -1
- package/dist/api/asset.d.mts +25 -9
- package/dist/api/asset.d.mts.map +1 -1
- package/dist/api/asset.mjs +14 -8
- package/dist/api/asset.mjs.map +1 -1
- package/dist/api/caip.cjs +9 -36
- package/dist/api/caip.cjs.map +1 -1
- package/dist/api/caip.d.cts +11 -28
- package/dist/api/caip.d.cts.map +1 -1
- package/dist/api/caip.d.mts +11 -28
- package/dist/api/caip.d.mts.map +1 -1
- package/dist/api/caip.mjs +6 -31
- package/dist/api/caip.mjs.map +1 -1
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts +11 -1
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts +11 -1
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/api/transaction.d.cts +30 -30
- package/dist/api/transaction.d.mts +30 -30
- package/dist/btc/types.cjs +7 -0
- package/dist/btc/types.cjs.map +1 -1
- package/dist/btc/types.d.cts +7 -2
- package/dist/btc/types.d.cts.map +1 -1
- package/dist/btc/types.d.mts +7 -2
- package/dist/btc/types.d.mts.map +1 -1
- package/dist/btc/types.mjs +8 -1
- package/dist/btc/types.mjs.map +1 -1
- package/dist/eth/constants.cjs +1 -0
- package/dist/eth/constants.cjs.map +1 -1
- package/dist/eth/constants.d.cts +2 -1
- package/dist/eth/constants.d.cts.map +1 -1
- package/dist/eth/constants.d.mts +2 -1
- package/dist/eth/constants.d.mts.map +1 -1
- package/dist/eth/constants.mjs +1 -0
- package/dist/eth/constants.mjs.map +1 -1
- package/dist/eth/types.cjs +5 -0
- package/dist/eth/types.cjs.map +1 -1
- package/dist/eth/types.d.cts +5 -2
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +5 -2
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/eth/types.mjs +5 -0
- package/dist/eth/types.mjs.map +1 -1
- package/dist/events.cjs +75 -1
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +240 -1
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +240 -1
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +78 -4
- package/dist/events.mjs.map +1 -1
- package/dist/rpc.cjs +12 -1
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.cts +43 -22
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +43 -22
- package/dist/rpc.d.mts.map +1 -1
- package/dist/rpc.mjs +12 -1
- package/dist/rpc.mjs.map +1 -1
- package/dist/sol/types.cjs +5 -0
- package/dist/sol/types.cjs.map +1 -1
- package/dist/sol/types.d.cts +5 -2
- package/dist/sol/types.d.cts.map +1 -1
- package/dist/sol/types.d.mts +5 -2
- package/dist/sol/types.d.mts.map +1 -1
- package/dist/sol/types.mjs +6 -1
- package/dist/sol/types.mjs.map +1 -1
- package/package.json +3 -3
package/dist/rpc.d.mts
CHANGED
@@ -6,6 +6,7 @@ export declare enum KeyringRpcMethod {
|
|
6
6
|
ListAccounts = "keyring_listAccounts",
|
7
7
|
GetAccount = "keyring_getAccount",
|
8
8
|
CreateAccount = "keyring_createAccount",
|
9
|
+
ListAccountAssets = "keyring_listAccountAssets",
|
9
10
|
ListAccountTransactions = "keyring_listAccountTransactions",
|
10
11
|
GetAccountBalances = "keyring_getAccountBalances",
|
11
12
|
FilterAccountChains = "keyring_filterAccountChains",
|
@@ -183,8 +184,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
183
184
|
asset: {
|
184
185
|
unit: string;
|
185
186
|
type: `${string}:${string}/${string}:${string}`;
|
186
|
-
fungible: true;
|
187
187
|
amount: string;
|
188
|
+
fungible: true;
|
188
189
|
} | {
|
189
190
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
190
191
|
fungible: false;
|
@@ -203,8 +204,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
203
204
|
asset: {
|
204
205
|
unit: string;
|
205
206
|
type: `${string}:${string}/${string}:${string}`;
|
206
|
-
fungible: true;
|
207
207
|
amount: string;
|
208
|
+
fungible: true;
|
208
209
|
} | {
|
209
210
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
210
211
|
fungible: false;
|
@@ -215,8 +216,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
215
216
|
asset: {
|
216
217
|
unit: string;
|
217
218
|
type: `${string}:${string}/${string}:${string}`;
|
218
|
-
fungible: true;
|
219
219
|
amount: string;
|
220
|
+
fungible: true;
|
220
221
|
} | {
|
221
222
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
222
223
|
fungible: false;
|
@@ -233,8 +234,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
233
234
|
asset: {
|
234
235
|
unit: string;
|
235
236
|
type: `${string}:${string}/${string}:${string}`;
|
236
|
-
fungible: true;
|
237
237
|
amount: string;
|
238
|
+
fungible: true;
|
238
239
|
} | {
|
239
240
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
240
241
|
fungible: false;
|
@@ -253,8 +254,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
253
254
|
asset: {
|
254
255
|
unit: string;
|
255
256
|
type: `${string}:${string}/${string}:${string}`;
|
256
|
-
fungible: true;
|
257
257
|
amount: string;
|
258
|
+
fungible: true;
|
258
259
|
} | {
|
259
260
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
260
261
|
fungible: false;
|
@@ -265,8 +266,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
265
266
|
asset: {
|
266
267
|
unit: string;
|
267
268
|
type: `${string}:${string}/${string}:${string}`;
|
268
|
-
fungible: true;
|
269
269
|
amount: string;
|
270
|
+
fungible: true;
|
270
271
|
} | {
|
271
272
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
272
273
|
fungible: false;
|
@@ -280,8 +281,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
280
281
|
asset: {
|
281
282
|
unit: string;
|
282
283
|
type: `${string}:${string}/${string}:${string}`;
|
283
|
-
fungible: true;
|
284
284
|
amount: string;
|
285
|
+
fungible: true;
|
285
286
|
} | {
|
286
287
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
287
288
|
fungible: false;
|
@@ -300,8 +301,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
300
301
|
asset: {
|
301
302
|
unit: string;
|
302
303
|
type: `${string}:${string}/${string}:${string}`;
|
303
|
-
fungible: true;
|
304
304
|
amount: string;
|
305
|
+
fungible: true;
|
305
306
|
} | {
|
306
307
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
307
308
|
fungible: false;
|
@@ -312,8 +313,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
312
313
|
asset: {
|
313
314
|
unit: string;
|
314
315
|
type: `${string}:${string}/${string}:${string}`;
|
315
|
-
fungible: true;
|
316
316
|
amount: string;
|
317
|
+
fungible: true;
|
317
318
|
} | {
|
318
319
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
319
320
|
fungible: false;
|
@@ -339,8 +340,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
339
340
|
asset: {
|
340
341
|
unit: string;
|
341
342
|
type: `${string}:${string}/${string}:${string}`;
|
342
|
-
fungible: true;
|
343
343
|
amount: string;
|
344
|
+
fungible: true;
|
344
345
|
} | {
|
345
346
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
346
347
|
fungible: false;
|
@@ -350,8 +351,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
350
351
|
asset: {
|
351
352
|
unit: string;
|
352
353
|
type: `${string}:${string}/${string}:${string}`;
|
353
|
-
fungible: true;
|
354
354
|
amount: string;
|
355
|
+
fungible: true;
|
355
356
|
} | {
|
356
357
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
357
358
|
fungible: false;
|
@@ -361,8 +362,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
361
362
|
asset: import("@metamask/superstruct").Struct<{
|
362
363
|
unit: string;
|
363
364
|
type: `${string}:${string}/${string}:${string}`;
|
364
|
-
fungible: true;
|
365
365
|
amount: string;
|
366
|
+
fungible: true;
|
366
367
|
} | {
|
367
368
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
368
369
|
fungible: false;
|
@@ -373,8 +374,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
373
374
|
asset: {
|
374
375
|
unit: string;
|
375
376
|
type: `${string}:${string}/${string}:${string}`;
|
376
|
-
fungible: true;
|
377
377
|
amount: string;
|
378
|
+
fungible: true;
|
378
379
|
} | {
|
379
380
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
380
381
|
fungible: false;
|
@@ -384,8 +385,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
384
385
|
asset: {
|
385
386
|
unit: string;
|
386
387
|
type: `${string}:${string}/${string}:${string}`;
|
387
|
-
fungible: true;
|
388
388
|
amount: string;
|
389
|
+
fungible: true;
|
389
390
|
} | {
|
390
391
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
391
392
|
fungible: false;
|
@@ -395,8 +396,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
395
396
|
asset: import("@metamask/superstruct").Struct<{
|
396
397
|
unit: string;
|
397
398
|
type: `${string}:${string}/${string}:${string}`;
|
398
|
-
fungible: true;
|
399
399
|
amount: string;
|
400
|
+
fungible: true;
|
400
401
|
} | {
|
401
402
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
402
403
|
fungible: false;
|
@@ -407,8 +408,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
407
408
|
asset: {
|
408
409
|
unit: string;
|
409
410
|
type: `${string}:${string}/${string}:${string}`;
|
410
|
-
fungible: true;
|
411
411
|
amount: string;
|
412
|
+
fungible: true;
|
412
413
|
} | {
|
413
414
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
414
415
|
fungible: false;
|
@@ -418,8 +419,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
418
419
|
asset: {
|
419
420
|
unit: string;
|
420
421
|
type: `${string}:${string}/${string}:${string}`;
|
421
|
-
fungible: true;
|
422
422
|
amount: string;
|
423
|
+
fungible: true;
|
423
424
|
} | {
|
424
425
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
425
426
|
fungible: false;
|
@@ -432,8 +433,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
432
433
|
asset: import("@metamask/superstruct").Struct<{
|
433
434
|
unit: string;
|
434
435
|
type: `${string}:${string}/${string}:${string}`;
|
435
|
-
fungible: true;
|
436
436
|
amount: string;
|
437
|
+
fungible: true;
|
437
438
|
} | {
|
438
439
|
id: `${string}:${string}/${string}:${string}/${string}`;
|
439
440
|
fungible: false;
|
@@ -458,28 +459,48 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
458
459
|
next: import("@metamask/superstruct").Struct<string | null, null>;
|
459
460
|
}>;
|
460
461
|
export type ListAccountTransactionsResponse = Infer<typeof ListAccountTransactionsResponseStruct>;
|
462
|
+
export declare const ListAccountAssetsRequestStruct: import("@metamask/superstruct").Struct<{
|
463
|
+
method: "keyring_listAccountAssets";
|
464
|
+
id: string | number | null;
|
465
|
+
jsonrpc: "2.0";
|
466
|
+
params: {
|
467
|
+
id: string;
|
468
|
+
};
|
469
|
+
}, {
|
470
|
+
method: import("@metamask/superstruct").Struct<"keyring_listAccountAssets", "keyring_listAccountAssets">;
|
471
|
+
params: import("@metamask/superstruct").Struct<{
|
472
|
+
id: string;
|
473
|
+
}, {
|
474
|
+
id: import("@metamask/superstruct").Struct<string, null>;
|
475
|
+
}>;
|
476
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
477
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
478
|
+
}>;
|
479
|
+
export type ListAccountAssetsRequest = Infer<typeof ListAccountAssetsRequestStruct>;
|
480
|
+
export declare const ListAccountAssetsResponseStruct: import("@metamask/superstruct").Struct<(`${string}:${string}/${string}:${string}` | `${string}:${string}/${string}:${string}/${string}`)[], import("@metamask/superstruct").Struct<`${string}:${string}/${string}:${string}` | `${string}:${string}/${string}:${string}/${string}`, null>>;
|
481
|
+
export type ListAccountAssetsResponse = Infer<typeof ListAccountAssetsResponseStruct>;
|
461
482
|
export declare const GetAccountBalancesRequestStruct: import("@metamask/superstruct").Struct<{
|
462
483
|
method: "keyring_getAccountBalances";
|
463
484
|
id: string | number | null;
|
464
485
|
jsonrpc: "2.0";
|
465
486
|
params: {
|
466
487
|
id: string;
|
467
|
-
assets: string[];
|
488
|
+
assets: `${string}:${string}/${string}:${string}`[];
|
468
489
|
};
|
469
490
|
}, {
|
470
491
|
method: import("@metamask/superstruct").Struct<"keyring_getAccountBalances", "keyring_getAccountBalances">;
|
471
492
|
params: import("@metamask/superstruct").Struct<{
|
472
493
|
id: string;
|
473
|
-
assets: string[];
|
494
|
+
assets: `${string}:${string}/${string}:${string}`[];
|
474
495
|
}, {
|
475
496
|
id: import("@metamask/superstruct").Struct<string, null>;
|
476
|
-
assets: import("@metamask/superstruct").Struct
|
497
|
+
assets: import("@metamask/superstruct").Struct<`${string}:${string}/${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}/${string}:${string}`, null>>;
|
477
498
|
}>;
|
478
499
|
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
479
500
|
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
480
501
|
}>;
|
481
502
|
export type GetAccountBalancesRequest = Infer<typeof GetAccountBalancesRequestStruct>;
|
482
|
-
export declare const GetAccountBalancesResponseStruct: import("@metamask/superstruct").Struct<Record
|
503
|
+
export declare const GetAccountBalancesResponseStruct: import("@metamask/superstruct").Struct<Record<`${string}:${string}/${string}:${string}`, {
|
483
504
|
unit: string;
|
484
505
|
amount: string;
|
485
506
|
}>, null>;
|
package/dist/rpc.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rpc.d.mts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
1
|
+
{"version":3,"file":"rpc.d.mts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAuBnD;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,iBAAiB,8BAA8B;IAC/C,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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AO,MAAM,4BAA4B,oDAAgB,CAAC;AAE1D,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAKhF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;EAMrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,oDAAgB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
package/dist/rpc.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { object, UuidStruct } from "@metamask/keyring-utils";
|
2
2
|
import { array, literal, number, record, string, union } from "@metamask/superstruct";
|
3
3
|
import { JsonStruct } from "@metamask/utils";
|
4
|
-
import { BalanceStruct, CaipAssetTypeStruct, KeyringAccountDataStruct, KeyringAccountStruct, KeyringRequestStruct, KeyringResponseStruct, TransactionsPageStruct, PaginationStruct } from "./api/index.mjs";
|
4
|
+
import { BalanceStruct, CaipAssetTypeStruct, KeyringAccountDataStruct, KeyringAccountStruct, KeyringRequestStruct, KeyringResponseStruct, TransactionsPageStruct, PaginationStruct, CaipAssetTypeOrIdStruct } from "./api/index.mjs";
|
5
5
|
/**
|
6
6
|
* Keyring RPC methods used by the API.
|
7
7
|
*/
|
@@ -10,6 +10,7 @@ export var KeyringRpcMethod;
|
|
10
10
|
KeyringRpcMethod["ListAccounts"] = "keyring_listAccounts";
|
11
11
|
KeyringRpcMethod["GetAccount"] = "keyring_getAccount";
|
12
12
|
KeyringRpcMethod["CreateAccount"] = "keyring_createAccount";
|
13
|
+
KeyringRpcMethod["ListAccountAssets"] = "keyring_listAccountAssets";
|
13
14
|
KeyringRpcMethod["ListAccountTransactions"] = "keyring_listAccountTransactions";
|
14
15
|
KeyringRpcMethod["GetAccountBalances"] = "keyring_getAccountBalances";
|
15
16
|
KeyringRpcMethod["FilterAccountChains"] = "keyring_filterAccountChains";
|
@@ -75,6 +76,16 @@ export const ListAccountTransactionsRequestStruct = object({
|
|
75
76
|
});
|
76
77
|
export const ListAccountTransactionsResponseStruct = TransactionsPageStruct;
|
77
78
|
// ----------------------------------------------------------------------------
|
79
|
+
// List account assets
|
80
|
+
export const ListAccountAssetsRequestStruct = object({
|
81
|
+
...CommonHeader,
|
82
|
+
method: literal('keyring_listAccountAssets'),
|
83
|
+
params: object({
|
84
|
+
id: UuidStruct,
|
85
|
+
}),
|
86
|
+
});
|
87
|
+
export const ListAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);
|
88
|
+
// ----------------------------------------------------------------------------
|
78
89
|
// Get account balances
|
79
90
|
export const GetAccountBalancesRequestStruct = object({
|
80
91
|
...CommonHeader,
|
package/dist/rpc.mjs.map
CHANGED
@@ -1 +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,EACtB,gBAAgB,EACjB,wBAAc;AAEf;;GAEG;AACH,MAAM,CAAN,IAAY,gBAeX;AAfD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,+EAA2D,CAAA;IAC3D,qEAAiD,CAAA;IACjD,uEAAmD,CAAA;IACnD,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC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;AAC/E,iBAAiB;AAEjB,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;AAIjE,+EAA+E;AAC/E,kBAAkB;AAElB,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC;IAChD,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,wBAAwB,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEjB,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,OAAO,CAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,UAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { 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
|
+
{"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,EACtB,gBAAgB,EAChB,uBAAuB,EACxB,wBAAc;AAEf;;GAEG;AACH,MAAM,CAAN,IAAY,gBAgBX;AAhBD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,mEAA+C,CAAA;IAC/C,+EAA2D,CAAA;IAC3D,qEAAiD,CAAA;IACjD,uEAAmD,CAAA;IACnD,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,2DAAuC,CAAA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CAAC,CAAC","sourcesContent":["import { 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 CaipAssetTypeOrIdStruct,\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 ListAccountAssets = 'keyring_listAccountAssets',\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// List account assets\n\nexport const ListAccountAssetsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccountAssets'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ListAccountAssetsRequest = Infer<\n typeof ListAccountAssetsRequestStruct\n>;\n\nexport const ListAccountAssetsResponseStruct = array(CaipAssetTypeOrIdStruct);\n\nexport type ListAccountAssetsResponse = Infer<\n typeof ListAccountAssetsResponseStruct\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"]}
|
package/dist/sol/types.cjs
CHANGED
@@ -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
|
*/
|
package/dist/sol/types.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,
|
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"]}
|
package/dist/sol/types.d.cts
CHANGED
@@ -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>;
|
package/dist/sol/types.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
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"}
|
package/dist/sol/types.d.mts
CHANGED
@@ -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>;
|
package/dist/sol/types.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/sol/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
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"}
|
package/dist/sol/types.mjs
CHANGED
@@ -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
|
*/
|
package/dist/sol/types.mjs.map
CHANGED
@@ -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;
|
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": "
|
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.
|
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.
|
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",
|