@metamask-previews/keyring-api 21.3.0-feb98c5 → 21.5.0-fd40efd
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 +43 -3
- package/dist/api/account-options.cjs +4 -0
- package/dist/api/account-options.cjs.map +1 -1
- package/dist/api/account-options.d.cts +4 -0
- package/dist/api/account-options.d.cts.map +1 -1
- package/dist/api/account-options.d.mts +4 -0
- package/dist/api/account-options.d.mts.map +1 -1
- package/dist/api/account-options.mjs +4 -0
- package/dist/api/account-options.mjs.map +1 -1
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts +13 -0
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts +13 -0
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/api/transaction.cjs +64 -1
- package/dist/api/transaction.cjs.map +1 -1
- package/dist/api/transaction.d.cts +135 -0
- package/dist/api/transaction.d.cts.map +1 -1
- package/dist/api/transaction.d.mts +135 -0
- package/dist/api/transaction.d.mts.map +1 -1
- package/dist/api/transaction.mjs +64 -1
- package/dist/api/transaction.mjs.map +1 -1
- package/dist/api/v2/create-account/bip44.cjs +27 -1
- package/dist/api/v2/create-account/bip44.cjs.map +1 -1
- package/dist/api/v2/create-account/bip44.d.cts +46 -0
- package/dist/api/v2/create-account/bip44.d.cts.map +1 -1
- package/dist/api/v2/create-account/bip44.d.mts +46 -0
- package/dist/api/v2/create-account/bip44.d.mts.map +1 -1
- package/dist/api/v2/create-account/bip44.mjs +26 -0
- package/dist/api/v2/create-account/bip44.mjs.map +1 -1
- package/dist/api/v2/create-account/index.cjs +44 -0
- package/dist/api/v2/create-account/index.cjs.map +1 -1
- package/dist/api/v2/create-account/index.d.cts +44 -0
- package/dist/api/v2/create-account/index.d.cts.map +1 -1
- package/dist/api/v2/create-account/index.d.mts +44 -0
- package/dist/api/v2/create-account/index.d.mts.map +1 -1
- package/dist/api/v2/create-account/index.mjs +44 -1
- package/dist/api/v2/create-account/index.mjs.map +1 -1
- package/dist/api/v2/keyring-capabilities.cjs +7 -3
- package/dist/api/v2/keyring-capabilities.cjs.map +1 -1
- package/dist/api/v2/keyring-capabilities.d.cts +16 -9
- package/dist/api/v2/keyring-capabilities.d.cts.map +1 -1
- package/dist/api/v2/keyring-capabilities.d.mts +16 -9
- package/dist/api/v2/keyring-capabilities.d.mts.map +1 -1
- package/dist/api/v2/keyring-capabilities.mjs +7 -3
- package/dist/api/v2/keyring-capabilities.mjs.map +1 -1
- package/dist/api/v2/wrapper/keyring-wrapper.cjs +21 -3
- package/dist/api/v2/wrapper/keyring-wrapper.cjs.map +1 -1
- package/dist/api/v2/wrapper/keyring-wrapper.d.cts +9 -1
- package/dist/api/v2/wrapper/keyring-wrapper.d.cts.map +1 -1
- package/dist/api/v2/wrapper/keyring-wrapper.d.mts +9 -1
- package/dist/api/v2/wrapper/keyring-wrapper.d.mts.map +1 -1
- package/dist/api/v2/wrapper/keyring-wrapper.mjs +21 -3
- package/dist/api/v2/wrapper/keyring-wrapper.mjs.map +1 -1
- package/dist/eth/erc4337/types.d.cts +4 -4
- package/dist/eth/erc4337/types.d.mts +4 -4
- package/dist/eth/rpc/params.cjs +1 -1
- package/dist/eth/rpc/params.cjs.map +1 -1
- package/dist/eth/rpc/params.d.cts +16 -16
- package/dist/eth/rpc/params.d.cts.map +1 -1
- package/dist/eth/rpc/params.d.mts +16 -16
- package/dist/eth/rpc/params.d.mts.map +1 -1
- package/dist/eth/rpc/params.mjs +2 -2
- package/dist/eth/rpc/params.mjs.map +1 -1
- package/dist/eth/types.cjs +5 -2
- package/dist/eth/types.cjs.map +1 -1
- package/dist/eth/types.d.cts +6 -5
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +6 -5
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/eth/types.mjs +4 -1
- package/dist/eth/types.mjs.map +1 -1
- package/dist/events.d.cts +12 -0
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +12 -0
- package/dist/events.d.mts.map +1 -1
- package/dist/rpc.cjs +12 -1
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.cts +189 -0
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +189 -0
- package/dist/rpc.d.mts.map +1 -1
- package/dist/rpc.mjs +12 -1
- package/dist/rpc.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -90,6 +90,63 @@ export declare enum TransactionType {
|
|
|
90
90
|
*/
|
|
91
91
|
Unknown = "unknown"
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Security alert response values from the Security Alert API.
|
|
95
|
+
*/
|
|
96
|
+
export declare enum SecurityAlertResponse {
|
|
97
|
+
/**
|
|
98
|
+
* The transaction is considered safe with no detected security issues.
|
|
99
|
+
*/
|
|
100
|
+
Benign = "Benign",
|
|
101
|
+
/**
|
|
102
|
+
* The transaction has potential security concerns that warrant user attention.
|
|
103
|
+
*/
|
|
104
|
+
Warning = "Warning",
|
|
105
|
+
/**
|
|
106
|
+
* The transaction has been identified as malicious and should be avoided.
|
|
107
|
+
*/
|
|
108
|
+
Malicious = "Malicious"
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* This struct represents additional transaction details.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* {
|
|
116
|
+
* origin: 'https://dapp.example.com',
|
|
117
|
+
* securityAlertResponse: 'Benign',
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* {
|
|
124
|
+
* origin: 'metamask',
|
|
125
|
+
* securityAlertResponse: 'Warning',
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare const TransactionDetailsStruct: import("@metamask/superstruct").Struct<{
|
|
130
|
+
origin?: string;
|
|
131
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
132
|
+
}, {
|
|
133
|
+
/**
|
|
134
|
+
* Origin of the original transaction request.
|
|
135
|
+
*
|
|
136
|
+
* This can be either 'metamask' for internally initiated transactions, or a URL
|
|
137
|
+
* (e.g., 'https://dapp.example.com') for dapp-initiated transactions.
|
|
138
|
+
*/
|
|
139
|
+
origin: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
140
|
+
/**
|
|
141
|
+
* Response from the Security Alert API indicating the security assessment of the
|
|
142
|
+
* transaction.
|
|
143
|
+
*/
|
|
144
|
+
securityAlertResponse: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | "Benign" | "Warning" | "Malicious", {
|
|
145
|
+
Benign: "Benign";
|
|
146
|
+
Warning: "Warning";
|
|
147
|
+
Malicious: "Malicious";
|
|
148
|
+
}>;
|
|
149
|
+
}>;
|
|
93
150
|
/**
|
|
94
151
|
* This struct represents a transaction event.
|
|
95
152
|
*/
|
|
@@ -215,6 +272,10 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
|
|
215
272
|
fungible: false;
|
|
216
273
|
};
|
|
217
274
|
}[];
|
|
275
|
+
details?: {
|
|
276
|
+
origin?: string;
|
|
277
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
278
|
+
};
|
|
218
279
|
}, {
|
|
219
280
|
/**
|
|
220
281
|
* Chain-specific transaction ID.
|
|
@@ -416,7 +477,41 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
|
|
416
477
|
*/
|
|
417
478
|
timestamp: import("@metamask/superstruct").Struct<number | null, null>;
|
|
418
479
|
}>>;
|
|
480
|
+
/**
|
|
481
|
+
* Additional transaction details {@see TransactionDetailsStruct}.
|
|
482
|
+
*
|
|
483
|
+
* Contains contextual information about the transaction such as its origin and
|
|
484
|
+
* security assessment. This field is optional and may not be present for all
|
|
485
|
+
* transactions.
|
|
486
|
+
*/
|
|
487
|
+
details: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
488
|
+
origin?: string;
|
|
489
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
490
|
+
}, {
|
|
491
|
+
/**
|
|
492
|
+
* Origin of the original transaction request.
|
|
493
|
+
*
|
|
494
|
+
* This can be either 'metamask' for internally initiated transactions, or a URL
|
|
495
|
+
* (e.g., 'https://dapp.example.com') for dapp-initiated transactions.
|
|
496
|
+
*/
|
|
497
|
+
origin: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
498
|
+
/**
|
|
499
|
+
* Response from the Security Alert API indicating the security assessment of the
|
|
500
|
+
* transaction.
|
|
501
|
+
*/
|
|
502
|
+
securityAlertResponse: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | "Benign" | "Warning" | "Malicious", {
|
|
503
|
+
Benign: "Benign";
|
|
504
|
+
Warning: "Warning";
|
|
505
|
+
Malicious: "Malicious";
|
|
506
|
+
}>;
|
|
507
|
+
}>;
|
|
419
508
|
}>;
|
|
509
|
+
/**
|
|
510
|
+
* Transaction details object.
|
|
511
|
+
*
|
|
512
|
+
* See {@link TransactionDetailsStruct}.
|
|
513
|
+
*/
|
|
514
|
+
export type TransactionDetails = Infer<typeof TransactionDetailsStruct>;
|
|
420
515
|
/**
|
|
421
516
|
* Transaction object.
|
|
422
517
|
*
|
|
@@ -498,6 +593,10 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
|
498
593
|
fungible: false;
|
|
499
594
|
};
|
|
500
595
|
}[];
|
|
596
|
+
details?: {
|
|
597
|
+
origin?: string;
|
|
598
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
599
|
+
};
|
|
501
600
|
}[];
|
|
502
601
|
next: string | null;
|
|
503
602
|
}, {
|
|
@@ -551,6 +650,10 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
|
551
650
|
fungible: false;
|
|
552
651
|
};
|
|
553
652
|
}[];
|
|
653
|
+
details?: {
|
|
654
|
+
origin?: string;
|
|
655
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
656
|
+
};
|
|
554
657
|
}[], import("@metamask/superstruct").Struct<{
|
|
555
658
|
type: "unknown" | "send" | "receive" | "swap" | "bridge:send" | "bridge:receive" | "stake:deposit" | "stake:withdraw";
|
|
556
659
|
id: string;
|
|
@@ -598,6 +701,10 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
|
598
701
|
fungible: false;
|
|
599
702
|
};
|
|
600
703
|
}[];
|
|
704
|
+
details?: {
|
|
705
|
+
origin?: string;
|
|
706
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
707
|
+
};
|
|
601
708
|
}, {
|
|
602
709
|
/**
|
|
603
710
|
* Chain-specific transaction ID.
|
|
@@ -799,6 +906,34 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
|
799
906
|
*/
|
|
800
907
|
timestamp: import("@metamask/superstruct").Struct<number | null, null>;
|
|
801
908
|
}>>;
|
|
909
|
+
/**
|
|
910
|
+
* Additional transaction details {@see TransactionDetailsStruct}.
|
|
911
|
+
*
|
|
912
|
+
* Contains contextual information about the transaction such as its origin and
|
|
913
|
+
* security assessment. This field is optional and may not be present for all
|
|
914
|
+
* transactions.
|
|
915
|
+
*/
|
|
916
|
+
details: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
917
|
+
origin?: string;
|
|
918
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
919
|
+
}, {
|
|
920
|
+
/**
|
|
921
|
+
* Origin of the original transaction request.
|
|
922
|
+
*
|
|
923
|
+
* This can be either 'metamask' for internally initiated transactions, or a URL
|
|
924
|
+
* (e.g., 'https://dapp.example.com') for dapp-initiated transactions.
|
|
925
|
+
*/
|
|
926
|
+
origin: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
927
|
+
/**
|
|
928
|
+
* Response from the Security Alert API indicating the security assessment of the
|
|
929
|
+
* transaction.
|
|
930
|
+
*/
|
|
931
|
+
securityAlertResponse: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | "Benign" | "Warning" | "Malicious", {
|
|
932
|
+
Benign: "Benign";
|
|
933
|
+
Warning: "Warning";
|
|
934
|
+
Malicious: "Malicious";
|
|
935
|
+
}>;
|
|
936
|
+
}>;
|
|
802
937
|
}>>;
|
|
803
938
|
/**
|
|
804
939
|
* Next cursor to iterate over the results. If null, there are no more
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.cts","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gCAAgC;AAE3D,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,KAAK,EAAE,SAAS,EAAE,yBAAqB;AAiD9C;;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;IAEnB;;;;;OAKG;IACH,IAAI,SAAS;IAEb;;;OAGG;IACH,UAAU,gBAAgB;IAE1B;;;OAGG;IACH,aAAa,mBAAmB;IAEhC;;OAEG;IACH,YAAY,kBAAkB;IAE9B;;OAEG;IACH,aAAa,mBAAmB;
|
|
1
|
+
{"version":3,"file":"transaction.d.cts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AEG;;;;;;;;;;;QA8TH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;YAlSH;;eAEG;;;;;YAGH;;eAEG;;;;;;;;;;;QA8RH;;;;;WAKG;;;;;;;;YA7IH;;eAEG;;;;;;;YAQH;;eAEG;;;QAoIH;;;;;;WAMG;;;;;YA/KH;;;;;eAKG;;YAGH;;;eAGG;;;;;;;;IAuNH;;;OAGG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CACxC,OAAO,sBAAsB,EAC7B,SAAS,CAAC,WAAW,CAAC,CACvB,CAAC"}
|
|
@@ -90,6 +90,63 @@ export declare enum TransactionType {
|
|
|
90
90
|
*/
|
|
91
91
|
Unknown = "unknown"
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Security alert response values from the Security Alert API.
|
|
95
|
+
*/
|
|
96
|
+
export declare enum SecurityAlertResponse {
|
|
97
|
+
/**
|
|
98
|
+
* The transaction is considered safe with no detected security issues.
|
|
99
|
+
*/
|
|
100
|
+
Benign = "Benign",
|
|
101
|
+
/**
|
|
102
|
+
* The transaction has potential security concerns that warrant user attention.
|
|
103
|
+
*/
|
|
104
|
+
Warning = "Warning",
|
|
105
|
+
/**
|
|
106
|
+
* The transaction has been identified as malicious and should be avoided.
|
|
107
|
+
*/
|
|
108
|
+
Malicious = "Malicious"
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* This struct represents additional transaction details.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* {
|
|
116
|
+
* origin: 'https://dapp.example.com',
|
|
117
|
+
* securityAlertResponse: 'Benign',
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* {
|
|
124
|
+
* origin: 'metamask',
|
|
125
|
+
* securityAlertResponse: 'Warning',
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare const TransactionDetailsStruct: import("@metamask/superstruct").Struct<{
|
|
130
|
+
origin?: string;
|
|
131
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
132
|
+
}, {
|
|
133
|
+
/**
|
|
134
|
+
* Origin of the original transaction request.
|
|
135
|
+
*
|
|
136
|
+
* This can be either 'metamask' for internally initiated transactions, or a URL
|
|
137
|
+
* (e.g., 'https://dapp.example.com') for dapp-initiated transactions.
|
|
138
|
+
*/
|
|
139
|
+
origin: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
140
|
+
/**
|
|
141
|
+
* Response from the Security Alert API indicating the security assessment of the
|
|
142
|
+
* transaction.
|
|
143
|
+
*/
|
|
144
|
+
securityAlertResponse: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | "Benign" | "Warning" | "Malicious", {
|
|
145
|
+
Benign: "Benign";
|
|
146
|
+
Warning: "Warning";
|
|
147
|
+
Malicious: "Malicious";
|
|
148
|
+
}>;
|
|
149
|
+
}>;
|
|
93
150
|
/**
|
|
94
151
|
* This struct represents a transaction event.
|
|
95
152
|
*/
|
|
@@ -215,6 +272,10 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
|
|
215
272
|
fungible: false;
|
|
216
273
|
};
|
|
217
274
|
}[];
|
|
275
|
+
details?: {
|
|
276
|
+
origin?: string;
|
|
277
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
278
|
+
};
|
|
218
279
|
}, {
|
|
219
280
|
/**
|
|
220
281
|
* Chain-specific transaction ID.
|
|
@@ -416,7 +477,41 @@ export declare const TransactionStruct: import("@metamask/superstruct").Struct<{
|
|
|
416
477
|
*/
|
|
417
478
|
timestamp: import("@metamask/superstruct").Struct<number | null, null>;
|
|
418
479
|
}>>;
|
|
480
|
+
/**
|
|
481
|
+
* Additional transaction details {@see TransactionDetailsStruct}.
|
|
482
|
+
*
|
|
483
|
+
* Contains contextual information about the transaction such as its origin and
|
|
484
|
+
* security assessment. This field is optional and may not be present for all
|
|
485
|
+
* transactions.
|
|
486
|
+
*/
|
|
487
|
+
details: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
488
|
+
origin?: string;
|
|
489
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
490
|
+
}, {
|
|
491
|
+
/**
|
|
492
|
+
* Origin of the original transaction request.
|
|
493
|
+
*
|
|
494
|
+
* This can be either 'metamask' for internally initiated transactions, or a URL
|
|
495
|
+
* (e.g., 'https://dapp.example.com') for dapp-initiated transactions.
|
|
496
|
+
*/
|
|
497
|
+
origin: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
498
|
+
/**
|
|
499
|
+
* Response from the Security Alert API indicating the security assessment of the
|
|
500
|
+
* transaction.
|
|
501
|
+
*/
|
|
502
|
+
securityAlertResponse: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | "Benign" | "Warning" | "Malicious", {
|
|
503
|
+
Benign: "Benign";
|
|
504
|
+
Warning: "Warning";
|
|
505
|
+
Malicious: "Malicious";
|
|
506
|
+
}>;
|
|
507
|
+
}>;
|
|
419
508
|
}>;
|
|
509
|
+
/**
|
|
510
|
+
* Transaction details object.
|
|
511
|
+
*
|
|
512
|
+
* See {@link TransactionDetailsStruct}.
|
|
513
|
+
*/
|
|
514
|
+
export type TransactionDetails = Infer<typeof TransactionDetailsStruct>;
|
|
420
515
|
/**
|
|
421
516
|
* Transaction object.
|
|
422
517
|
*
|
|
@@ -498,6 +593,10 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
|
498
593
|
fungible: false;
|
|
499
594
|
};
|
|
500
595
|
}[];
|
|
596
|
+
details?: {
|
|
597
|
+
origin?: string;
|
|
598
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
599
|
+
};
|
|
501
600
|
}[];
|
|
502
601
|
next: string | null;
|
|
503
602
|
}, {
|
|
@@ -551,6 +650,10 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
|
551
650
|
fungible: false;
|
|
552
651
|
};
|
|
553
652
|
}[];
|
|
653
|
+
details?: {
|
|
654
|
+
origin?: string;
|
|
655
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
656
|
+
};
|
|
554
657
|
}[], import("@metamask/superstruct").Struct<{
|
|
555
658
|
type: "unknown" | "send" | "receive" | "swap" | "bridge:send" | "bridge:receive" | "stake:deposit" | "stake:withdraw";
|
|
556
659
|
id: string;
|
|
@@ -598,6 +701,10 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
|
598
701
|
fungible: false;
|
|
599
702
|
};
|
|
600
703
|
}[];
|
|
704
|
+
details?: {
|
|
705
|
+
origin?: string;
|
|
706
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
707
|
+
};
|
|
601
708
|
}, {
|
|
602
709
|
/**
|
|
603
710
|
* Chain-specific transaction ID.
|
|
@@ -799,6 +906,34 @@ export declare const TransactionsPageStruct: import("@metamask/superstruct").Str
|
|
|
799
906
|
*/
|
|
800
907
|
timestamp: import("@metamask/superstruct").Struct<number | null, null>;
|
|
801
908
|
}>>;
|
|
909
|
+
/**
|
|
910
|
+
* Additional transaction details {@see TransactionDetailsStruct}.
|
|
911
|
+
*
|
|
912
|
+
* Contains contextual information about the transaction such as its origin and
|
|
913
|
+
* security assessment. This field is optional and may not be present for all
|
|
914
|
+
* transactions.
|
|
915
|
+
*/
|
|
916
|
+
details: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
|
917
|
+
origin?: string;
|
|
918
|
+
securityAlertResponse?: "Benign" | "Warning" | "Malicious";
|
|
919
|
+
}, {
|
|
920
|
+
/**
|
|
921
|
+
* Origin of the original transaction request.
|
|
922
|
+
*
|
|
923
|
+
* This can be either 'metamask' for internally initiated transactions, or a URL
|
|
924
|
+
* (e.g., 'https://dapp.example.com') for dapp-initiated transactions.
|
|
925
|
+
*/
|
|
926
|
+
origin: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
|
927
|
+
/**
|
|
928
|
+
* Response from the Security Alert API indicating the security assessment of the
|
|
929
|
+
* transaction.
|
|
930
|
+
*/
|
|
931
|
+
securityAlertResponse: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | "Benign" | "Warning" | "Malicious", {
|
|
932
|
+
Benign: "Benign";
|
|
933
|
+
Warning: "Warning";
|
|
934
|
+
Malicious: "Malicious";
|
|
935
|
+
}>;
|
|
936
|
+
}>;
|
|
802
937
|
}>>;
|
|
803
938
|
/**
|
|
804
939
|
* Next cursor to iterate over the results. If null, there are no more
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.mts","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gCAAgC;AAE3D,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,KAAK,EAAE,SAAS,EAAE,yBAAqB;AAiD9C;;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;IAEnB;;;;;OAKG;IACH,IAAI,SAAS;IAEb;;;OAGG;IACH,UAAU,gBAAgB;IAE1B;;;OAGG;IACH,aAAa,mBAAmB;IAEhC;;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;;YAGH;;eAEG;;;;;;;;;;;QAyTH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;YAlUH;;eAEG;;YAGH;;eAEG;;;;;;;;;;;QA8TH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;YAlSH;;eAEG;;;;;YAGH;;eAEG;;;;;;;;;;;QA8RH;;;;;WAKG;;;;;;;;YA7IH;;eAEG;;;;;;;YAQH;;eAEG;;;QAoIH;;;;;;WAMG;;;;;YA/KH;;;;;eAKG;;YAGH;;;eAGG;;;;;;;;IAuNH;;;OAGG;;EAEH,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CACxC,OAAO,sBAAsB,EAC7B,SAAS,CAAC,WAAW,CAAC,CACvB,CAAC"}
|
package/dist/api/transaction.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { object, UuidStruct } from "@metamask/keyring-utils";
|
|
1
|
+
import { exactOptional, object, UuidStruct } from "@metamask/keyring-utils";
|
|
2
2
|
import { array, enums, nullable, number, string } from "@metamask/superstruct";
|
|
3
3
|
import { AssetStruct } from "./asset.mjs";
|
|
4
4
|
import { CaipChainIdStruct } from "./caip.mjs";
|
|
@@ -152,6 +152,61 @@ export var TransactionType;
|
|
|
152
152
|
*/
|
|
153
153
|
TransactionType["Unknown"] = "unknown";
|
|
154
154
|
})(TransactionType || (TransactionType = {}));
|
|
155
|
+
/**
|
|
156
|
+
* Security alert response values from the Security Alert API.
|
|
157
|
+
*/
|
|
158
|
+
export var SecurityAlertResponse;
|
|
159
|
+
(function (SecurityAlertResponse) {
|
|
160
|
+
/**
|
|
161
|
+
* The transaction is considered safe with no detected security issues.
|
|
162
|
+
*/
|
|
163
|
+
SecurityAlertResponse["Benign"] = "Benign";
|
|
164
|
+
/**
|
|
165
|
+
* The transaction has potential security concerns that warrant user attention.
|
|
166
|
+
*/
|
|
167
|
+
SecurityAlertResponse["Warning"] = "Warning";
|
|
168
|
+
/**
|
|
169
|
+
* The transaction has been identified as malicious and should be avoided.
|
|
170
|
+
*/
|
|
171
|
+
SecurityAlertResponse["Malicious"] = "Malicious";
|
|
172
|
+
})(SecurityAlertResponse || (SecurityAlertResponse = {}));
|
|
173
|
+
/**
|
|
174
|
+
* This struct represents additional transaction details.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* {
|
|
179
|
+
* origin: 'https://dapp.example.com',
|
|
180
|
+
* securityAlertResponse: 'Benign',
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* {
|
|
187
|
+
* origin: 'metamask',
|
|
188
|
+
* securityAlertResponse: 'Warning',
|
|
189
|
+
* }
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
export const TransactionDetailsStruct = object({
|
|
193
|
+
/**
|
|
194
|
+
* Origin of the original transaction request.
|
|
195
|
+
*
|
|
196
|
+
* This can be either 'metamask' for internally initiated transactions, or a URL
|
|
197
|
+
* (e.g., 'https://dapp.example.com') for dapp-initiated transactions.
|
|
198
|
+
*/
|
|
199
|
+
origin: exactOptional(string()),
|
|
200
|
+
/**
|
|
201
|
+
* Response from the Security Alert API indicating the security assessment of the
|
|
202
|
+
* transaction.
|
|
203
|
+
*/
|
|
204
|
+
securityAlertResponse: exactOptional(enums([
|
|
205
|
+
`${SecurityAlertResponse.Benign}`,
|
|
206
|
+
`${SecurityAlertResponse.Warning}`,
|
|
207
|
+
`${SecurityAlertResponse.Malicious}`,
|
|
208
|
+
])),
|
|
209
|
+
});
|
|
155
210
|
/**
|
|
156
211
|
* This struct represents a transaction event.
|
|
157
212
|
*/
|
|
@@ -288,6 +343,14 @@ export const TransactionStruct = object({
|
|
|
288
343
|
* all transactions.
|
|
289
344
|
*/
|
|
290
345
|
events: array(TransactionEventStruct),
|
|
346
|
+
/**
|
|
347
|
+
* Additional transaction details {@see TransactionDetailsStruct}.
|
|
348
|
+
*
|
|
349
|
+
* Contains contextual information about the transaction such as its origin and
|
|
350
|
+
* security assessment. This field is optional and may not be present for all
|
|
351
|
+
* transactions.
|
|
352
|
+
*/
|
|
353
|
+
details: exactOptional(TransactionDetailsStruct),
|
|
291
354
|
});
|
|
292
355
|
/**
|
|
293
356
|
* This struct represents a page of transactions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.mjs","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAE7D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAE/E,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,OAAO,EAAE,iBAAiB,EAAE,mBAAe;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;I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;QAChC,GAAG,iBAAiB,CAAC,WAAW,EAAE;QAClC,GAAG,iBAAiB,CAAC,SAAS,EAAE;QAChC,GAAG,iBAAiB,CAAC,MAAM,EAAE;KAC9B,CAAC;IAEF;;;;OAIG;IACH,SAAS,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAE7B;;;OAGG;IACH,IAAI,EAAE,KAAK,CAAC;QACV,GAAG,eAAe,CAAC,IAAI,EAAE;QACzB,GAAG,eAAe,CAAC,OAAO,EAAE;QAC5B,GAAG,eAAe,CAAC,IAAI,EAAE;QACzB,GAAG,eAAe,CAAC,UAAU,EAAE;QAC/B,GAAG,eAAe,CAAC,aAAa,EAAE;QAClC,GAAG,eAAe,CAAC,YAAY,EAAE;QACjC,GAAG,eAAe,CAAC,aAAa,EAAE;QAClC,GAAG,eAAe,CAAC,OAAO,EAAE;KAC7B,CAAC;IAEF;;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 { InferEquals } from '@metamask/keyring-utils';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, nullable, number, string } from '@metamask/superstruct';\n\nimport { AssetStruct } from './asset';\nimport { CaipChainIdStruct } from './caip';\nimport type { Paginated } from './pagination';\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 * The transaction is a swap. It decreases the balance of one asset and\n * increases the balance of another asset in a single transaction.\n *\n * A swap transaction must be originated by the account.\n */\n Swap = 'swap',\n\n /**\n * Represents an outgoing bridge transaction, transferring assets from\n * the account to another blockchain.\n */\n BridgeSend = 'bridge:send',\n\n /**\n * Represents an incoming bridge transaction, transferring assets from\n * another blockchain to the account.\n */\n BridgeReceive = 'bridge:receive',\n\n /**\n * Represents a stake deposit transaction.\n */\n StakeDeposit = 'stake:deposit',\n\n /**\n * Represents a stake withdrawal transaction.\n */\n StakeWithdraw = 'stake:withdraw',\n /**\n * The transaction type is unknown. It's not possible to determine the\n * transaction type based on the information available.\n */\n Unknown = 'unknown',\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([\n `${TransactionType.Send}`,\n `${TransactionType.Receive}`,\n `${TransactionType.Swap}`,\n `${TransactionType.BridgeSend}`,\n `${TransactionType.BridgeReceive}`,\n `${TransactionType.StakeDeposit}`,\n `${TransactionType.StakeWithdraw}`,\n `${TransactionType.Unknown}`,\n ]),\n\n /**\n * Transaction sender addresses and amounts.\n */\n from: array(ParticipantStruct),\n\n /**\n * Transaction receiver addresses and amounts.\n */\n to: array(ParticipantStruct),\n\n /**\n * Total transaction fee.\n */\n fees: array(FeeStruct),\n\n /**\n * List of events related to the transaction {@see TransactionEventStruct}.\n *\n * The events are tracked in a best-effort basis and may not be available for\n * all transactions.\n */\n events: array(TransactionEventStruct),\n});\n\n/**\n * Transaction object.\n *\n * See {@link TransactionStruct}.\n */\nexport type Transaction = Infer<typeof TransactionStruct>;\n\n/**\n * This struct represents a page of transactions.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: null, // No more results\n * }**\n * ```\n */\nexport const TransactionsPageStruct = object({\n /**\n * List of transactions.\n */\n data: array(TransactionStruct),\n\n /**\n * Next cursor to iterate over the results. If null, there are no more\n * results.\n */\n next: nullable(string()),\n});\n\n/**\n * Transactions page object.\n *\n * See {@link TransactionsPageStruct}.\n */\nexport type TransactionsPage = InferEquals<\n typeof TransactionsPageStruct,\n Paginated<Transaction>\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"transaction.mjs","sourceRoot":"","sources":["../../src/api/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,gCAAgC;AAE5E,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAE/E,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,OAAO,EAAE,iBAAiB,EAAE,mBAAe;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,E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AG,eAAe,CAAC,IAAI,EAAE;QACzB,GAAG,eAAe,CAAC,UAAU,EAAE;QAC/B,GAAG,eAAe,CAAC,aAAa,EAAE;QAClC,GAAG,eAAe,CAAC,YAAY,EAAE;QACjC,GAAG,eAAe,CAAC,aAAa,EAAE;QAClC,GAAG,eAAe,CAAC,OAAO,EAAE;KAC7B,CAAC;IAEF;;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;IAErC;;;;;;OAMG;IACH,OAAO,EAAE,aAAa,CAAC,wBAAwB,CAAC;CACjD,CAAC,CAAC;AAgBH;;;;;;;;;;;;;;;;;;;;;;;;;;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 { InferEquals } from '@metamask/keyring-utils';\nimport { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, enums, nullable, number, string } from '@metamask/superstruct';\n\nimport { AssetStruct } from './asset';\nimport { CaipChainIdStruct } from './caip';\nimport type { Paginated } from './pagination';\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 * The transaction is a swap. It decreases the balance of one asset and\n * increases the balance of another asset in a single transaction.\n *\n * A swap transaction must be originated by the account.\n */\n Swap = 'swap',\n\n /**\n * Represents an outgoing bridge transaction, transferring assets from\n * the account to another blockchain.\n */\n BridgeSend = 'bridge:send',\n\n /**\n * Represents an incoming bridge transaction, transferring assets from\n * another blockchain to the account.\n */\n BridgeReceive = 'bridge:receive',\n\n /**\n * Represents a stake deposit transaction.\n */\n StakeDeposit = 'stake:deposit',\n\n /**\n * Represents a stake withdrawal transaction.\n */\n StakeWithdraw = 'stake:withdraw',\n\n /**\n * The transaction type is unknown. It's not possible to determine the\n * transaction type based on the information available.\n */\n Unknown = 'unknown',\n}\n\n/**\n * Security alert response values from the Security Alert API.\n */\nexport enum SecurityAlertResponse {\n /**\n * The transaction is considered safe with no detected security issues.\n */\n Benign = 'Benign',\n\n /**\n * The transaction has potential security concerns that warrant user attention.\n */\n Warning = 'Warning',\n\n /**\n * The transaction has been identified as malicious and should be avoided.\n */\n Malicious = 'Malicious',\n}\n\n/**\n * This struct represents additional transaction details.\n *\n * @example\n * ```ts\n * {\n * origin: 'https://dapp.example.com',\n * securityAlertResponse: 'Benign',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * origin: 'metamask',\n * securityAlertResponse: 'Warning',\n * }\n * ```\n */\nexport const TransactionDetailsStruct = object({\n /**\n * Origin of the original transaction request.\n *\n * This can be either 'metamask' for internally initiated transactions, or a URL\n * (e.g., 'https://dapp.example.com') for dapp-initiated transactions.\n */\n origin: exactOptional(string()),\n\n /**\n * Response from the Security Alert API indicating the security assessment of the\n * transaction.\n */\n securityAlertResponse: exactOptional(\n enums([\n `${SecurityAlertResponse.Benign}`,\n `${SecurityAlertResponse.Warning}`,\n `${SecurityAlertResponse.Malicious}`,\n ]),\n ),\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([\n `${TransactionType.Send}`,\n `${TransactionType.Receive}`,\n `${TransactionType.Swap}`,\n `${TransactionType.BridgeSend}`,\n `${TransactionType.BridgeReceive}`,\n `${TransactionType.StakeDeposit}`,\n `${TransactionType.StakeWithdraw}`,\n `${TransactionType.Unknown}`,\n ]),\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 * Additional transaction details {@see TransactionDetailsStruct}.\n *\n * Contains contextual information about the transaction such as its origin and\n * security assessment. This field is optional and may not be present for all\n * transactions.\n */\n details: exactOptional(TransactionDetailsStruct),\n});\n\n/**\n * Transaction details object.\n *\n * See {@link TransactionDetailsStruct}.\n */\nexport type TransactionDetails = Infer<typeof TransactionDetailsStruct>;\n\n/**\n * Transaction object.\n *\n * See {@link TransactionStruct}.\n */\nexport type Transaction = Infer<typeof TransactionStruct>;\n\n/**\n * This struct represents a page of transactions.\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: 'c3y1Q6QtqtstbxKX+oqVdEW6',\n * }\n * ```\n *\n * @example\n * ```ts\n * {\n * data: [\n * {\n * // Transaction object\n * }\n * ],\n * next: null, // No more results\n * }**\n * ```\n */\nexport const TransactionsPageStruct = object({\n /**\n * List of transactions.\n */\n data: array(TransactionStruct),\n\n /**\n * Next cursor to iterate over the results. If null, there are no more\n * results.\n */\n next: nullable(string()),\n});\n\n/**\n * Transactions page object.\n *\n * See {@link TransactionsPageStruct}.\n */\nexport type TransactionsPage = InferEquals<\n typeof TransactionsPageStruct,\n Paginated<Transaction>\n>;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CreateAccountBip44DiscoverOptionsStruct = exports.CreateAccountBip44DeriveIndexOptionsStruct = exports.CreateAccountBip44DerivePathOptionsStruct = void 0;
|
|
3
|
+
exports.CreateAccountBip44DeriveIndexRangeOptionsStruct = exports.CreateAccountBip44DiscoverOptionsStruct = exports.CreateAccountBip44DeriveIndexOptionsStruct = exports.CreateAccountBip44DerivePathOptionsStruct = void 0;
|
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
5
|
const derivation_1 = require("../../derivation.cjs");
|
|
6
6
|
/**
|
|
@@ -54,4 +54,30 @@ exports.CreateAccountBip44DiscoverOptionsStruct = (0, superstruct_1.object)({
|
|
|
54
54
|
*/
|
|
55
55
|
groupIndex: (0, superstruct_1.number)(),
|
|
56
56
|
});
|
|
57
|
+
/**
|
|
58
|
+
* Struct for {@link CreateAccountBip44DeriveIndexRangeOptions}.
|
|
59
|
+
*/
|
|
60
|
+
exports.CreateAccountBip44DeriveIndexRangeOptionsStruct = (0, superstruct_1.object)({
|
|
61
|
+
/**
|
|
62
|
+
* The type of the options.
|
|
63
|
+
*/
|
|
64
|
+
type: (0, superstruct_1.literal)('bip44:derive-index-range'),
|
|
65
|
+
/**
|
|
66
|
+
* ID of the entropy source to be used to derive the accounts.
|
|
67
|
+
*/
|
|
68
|
+
entropySource: (0, superstruct_1.string)(),
|
|
69
|
+
/**
|
|
70
|
+
* The range of account group indices to derive (inclusive on both ends).
|
|
71
|
+
*/
|
|
72
|
+
range: (0, superstruct_1.object)({
|
|
73
|
+
/**
|
|
74
|
+
* The starting index of the account group range (inclusive).
|
|
75
|
+
*/
|
|
76
|
+
from: (0, superstruct_1.number)(),
|
|
77
|
+
/**
|
|
78
|
+
* The ending index of the account group range (inclusive).
|
|
79
|
+
*/
|
|
80
|
+
to: (0, superstruct_1.number)(),
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
57
83
|
//# sourceMappingURL=bip44.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bip44.cjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/bip44.ts"],"names":[],"mappings":";;;AAAA,uDAM+B;AAE/B,qDAAwD;AAExD;;GAEG;AACU,QAAA,yCAAyC,GAAG,IAAA,oBAAM,EAAC;IAC9D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,mBAAmB,CAAC;IAClC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,cAAc,EAAE,iCAAoB;CACrC,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,0CAA0C,GAAG,IAAA,oBAAM,EAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACnC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC;AAYH;;GAEG;AACU,QAAA,uCAAuC,GAAG,IAAA,oBAAM,EAAC;IAC5D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,gBAAgB,CAAC;IAC/B;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC","sourcesContent":["import {\n literal,\n number,\n object,\n string,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { DerivationPathStruct } from '../../derivation';\n\n/**\n * Struct for {@link CreateAccountBip44DerivePathOptions}.\n */\nexport const CreateAccountBip44DerivePathOptionsStruct = object({\n /**\n * Type of the options.\n */\n type: literal('bip44:derive-path'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * BIP-44 derivation path to be used to derive the account.\n */\n derivationPath: DerivationPathStruct,\n});\n\n/**\n * Options for creating an account using the given BIP-44 derivation path.\n */\nexport type CreateAccountBip44DerivePathOptions = Infer<\n typeof CreateAccountBip44DerivePathOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DeriveIndexOptions}.\n */\nexport const CreateAccountBip44DeriveIndexOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:derive-index'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating an account using the given BIP-44 account group index.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DeriveIndexOptions = Infer<\n typeof CreateAccountBip44DeriveIndexOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DiscoverOptions}.\n */\nexport const CreateAccountBip44DiscoverOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:discover'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating accounts by performing a BIP-44 account discovery.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DiscoverOptions = Infer<\n typeof CreateAccountBip44DiscoverOptionsStruct\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"bip44.cjs","sourceRoot":"","sources":["../../../../src/api/v2/create-account/bip44.ts"],"names":[],"mappings":";;;AAAA,uDAM+B;AAE/B,qDAAwD;AAExD;;GAEG;AACU,QAAA,yCAAyC,GAAG,IAAA,oBAAM,EAAC;IAC9D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,mBAAmB,CAAC;IAClC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,cAAc,EAAE,iCAAoB;CACrC,CAAC,CAAC;AASH;;GAEG;AACU,QAAA,0CAA0C,GAAG,IAAA,oBAAM,EAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACnC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC;AAYH;;GAEG;AACU,QAAA,uCAAuC,GAAG,IAAA,oBAAM,EAAC;IAC5D;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,gBAAgB,CAAC;IAC/B;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,UAAU,EAAE,IAAA,oBAAM,GAAE;CACrB,CAAC,CAAC;AAYH;;GAEG;AACU,QAAA,+CAA+C,GAAG,IAAA,oBAAM,EAAC;IACpE;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EAAC,0BAA0B,CAAC;IACzC;;OAEG;IACH,aAAa,EAAE,IAAA,oBAAM,GAAE;IACvB;;OAEG;IACH,KAAK,EAAE,IAAA,oBAAM,EAAC;QACZ;;WAEG;QACH,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd;;WAEG;QACH,EAAE,EAAE,IAAA,oBAAM,GAAE;KACb,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n literal,\n number,\n object,\n string,\n type Infer,\n} from '@metamask/superstruct';\n\nimport { DerivationPathStruct } from '../../derivation';\n\n/**\n * Struct for {@link CreateAccountBip44DerivePathOptions}.\n */\nexport const CreateAccountBip44DerivePathOptionsStruct = object({\n /**\n * Type of the options.\n */\n type: literal('bip44:derive-path'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * BIP-44 derivation path to be used to derive the account.\n */\n derivationPath: DerivationPathStruct,\n});\n\n/**\n * Options for creating an account using the given BIP-44 derivation path.\n */\nexport type CreateAccountBip44DerivePathOptions = Infer<\n typeof CreateAccountBip44DerivePathOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DeriveIndexOptions}.\n */\nexport const CreateAccountBip44DeriveIndexOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:derive-index'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating an account using the given BIP-44 account group index.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DeriveIndexOptions = Infer<\n typeof CreateAccountBip44DeriveIndexOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DiscoverOptions}.\n */\nexport const CreateAccountBip44DiscoverOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:discover'),\n /**\n * ID of the entropy source to be used to derive the account.\n */\n entropySource: string(),\n /**\n * The index of the account group to be derived.\n */\n groupIndex: number(),\n});\n\n/**\n * Options for creating accounts by performing a BIP-44 account discovery.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DiscoverOptions = Infer<\n typeof CreateAccountBip44DiscoverOptionsStruct\n>;\n\n/**\n * Struct for {@link CreateAccountBip44DeriveIndexRangeOptions}.\n */\nexport const CreateAccountBip44DeriveIndexRangeOptionsStruct = object({\n /**\n * The type of the options.\n */\n type: literal('bip44:derive-index-range'),\n /**\n * ID of the entropy source to be used to derive the accounts.\n */\n entropySource: string(),\n /**\n * The range of account group indices to derive (inclusive on both ends).\n */\n range: object({\n /**\n * The starting index of the account group range (inclusive).\n */\n from: number(),\n /**\n * The ending index of the account group range (inclusive).\n */\n to: number(),\n }),\n});\n\n/**\n * Options for creating accounts by deriving a range of BIP-44 account indices.\n *\n * The range is inclusive on both ends, meaning range.from=0 and range.to=5\n * will create accounts for group indices 0, 1, 2, 3, 4, and 5.\n *\n * Note that the keyring can support non-standard BIP-44 paths for\n * compatibility with other wallets.\n */\nexport type CreateAccountBip44DeriveIndexRangeOptions = Infer<\n typeof CreateAccountBip44DeriveIndexRangeOptionsStruct\n>;\n"]}
|
|
@@ -80,4 +80,50 @@ export declare const CreateAccountBip44DiscoverOptionsStruct: import("@metamask/
|
|
|
80
80
|
* compatibility with other wallets.
|
|
81
81
|
*/
|
|
82
82
|
export type CreateAccountBip44DiscoverOptions = Infer<typeof CreateAccountBip44DiscoverOptionsStruct>;
|
|
83
|
+
/**
|
|
84
|
+
* Struct for {@link CreateAccountBip44DeriveIndexRangeOptions}.
|
|
85
|
+
*/
|
|
86
|
+
export declare const CreateAccountBip44DeriveIndexRangeOptionsStruct: import("@metamask/superstruct").Struct<{
|
|
87
|
+
type: "bip44:derive-index-range";
|
|
88
|
+
range: {
|
|
89
|
+
from: number;
|
|
90
|
+
to: number;
|
|
91
|
+
};
|
|
92
|
+
entropySource: string;
|
|
93
|
+
}, {
|
|
94
|
+
/**
|
|
95
|
+
* The type of the options.
|
|
96
|
+
*/
|
|
97
|
+
type: import("@metamask/superstruct").Struct<"bip44:derive-index-range", "bip44:derive-index-range">;
|
|
98
|
+
/**
|
|
99
|
+
* ID of the entropy source to be used to derive the accounts.
|
|
100
|
+
*/
|
|
101
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
|
102
|
+
/**
|
|
103
|
+
* The range of account group indices to derive (inclusive on both ends).
|
|
104
|
+
*/
|
|
105
|
+
range: import("@metamask/superstruct").Struct<{
|
|
106
|
+
from: number;
|
|
107
|
+
to: number;
|
|
108
|
+
}, {
|
|
109
|
+
/**
|
|
110
|
+
* The starting index of the account group range (inclusive).
|
|
111
|
+
*/
|
|
112
|
+
from: import("@metamask/superstruct").Struct<number, null>;
|
|
113
|
+
/**
|
|
114
|
+
* The ending index of the account group range (inclusive).
|
|
115
|
+
*/
|
|
116
|
+
to: import("@metamask/superstruct").Struct<number, null>;
|
|
117
|
+
}>;
|
|
118
|
+
}>;
|
|
119
|
+
/**
|
|
120
|
+
* Options for creating accounts by deriving a range of BIP-44 account indices.
|
|
121
|
+
*
|
|
122
|
+
* The range is inclusive on both ends, meaning range.from=0 and range.to=5
|
|
123
|
+
* will create accounts for group indices 0, 1, 2, 3, 4, and 5.
|
|
124
|
+
*
|
|
125
|
+
* Note that the keyring can support non-standard BIP-44 paths for
|
|
126
|
+
* compatibility with other wallets.
|
|
127
|
+
*/
|
|
128
|
+
export type CreateAccountBip44DeriveIndexRangeOptions = Infer<typeof CreateAccountBip44DeriveIndexRangeOptionsStruct>;
|
|
83
129
|
//# sourceMappingURL=bip44.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bip44.d.cts","sourceRoot":"","sources":["../../../../src/api/v2/create-account/bip44.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,KAAK,EACX,8BAA8B;AAI/B;;GAEG;AACH,eAAO,MAAM,yCAAyC;;;;;IACpD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG,KAAK,CACrD,OAAO,yCAAyC,CACjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0CAA0C;;;;;IACrD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,oCAAoC,GAAG,KAAK,CACtD,OAAO,0CAA0C,CAClD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uCAAuC;;;;;IAClD;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG,KAAK,CACnD,OAAO,uCAAuC,CAC/C,CAAC"}
|
|
1
|
+
{"version":3,"file":"bip44.d.cts","sourceRoot":"","sources":["../../../../src/api/v2/create-account/bip44.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,KAAK,EACX,8BAA8B;AAI/B;;GAEG;AACH,eAAO,MAAM,yCAAyC;;;;;IACpD;;OAEG;;IAEH;;OAE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