@metamask/keyring-api 17.2.1 → 17.4.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 +18 -1
- package/dist/api/derivation.cjs +6 -0
- package/dist/api/derivation.cjs.map +1 -0
- package/dist/api/derivation.d.cts +4 -0
- package/dist/api/derivation.d.cts.map +1 -0
- package/dist/api/derivation.d.mts +4 -0
- package/dist/api/derivation.d.mts.map +1 -0
- package/dist/api/derivation.mjs +3 -0
- package/dist/api/derivation.mjs.map +1 -0
- package/dist/api/discovery.cjs +40 -0
- package/dist/api/discovery.cjs.map +1 -0
- package/dist/api/discovery.d.cts +65 -0
- package/dist/api/discovery.d.cts.map +1 -0
- package/dist/api/discovery.d.mts +65 -0
- package/dist/api/discovery.d.mts.map +1 -0
- package/dist/api/discovery.mjs +37 -0
- package/dist/api/discovery.mjs.map +1 -0
- package/dist/api/entropy.cjs +3 -0
- package/dist/api/entropy.cjs.map +1 -0
- package/dist/api/entropy.d.cts +5 -0
- package/dist/api/entropy.d.cts.map +1 -0
- package/dist/api/entropy.d.mts +5 -0
- package/dist/api/entropy.d.mts.map +1 -0
- package/dist/api/entropy.mjs +2 -0
- package/dist/api/entropy.mjs.map +1 -0
- package/dist/api/index.cjs +2 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.cts +3 -0
- package/dist/api/index.d.cts.map +1 -1
- package/dist/api/index.d.mts +3 -0
- package/dist/api/index.d.mts.map +1 -1
- package/dist/api/index.mjs +2 -0
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/keyring.cjs.map +1 -1
- package/dist/api/keyring.d.cts +25 -2
- package/dist/api/keyring.d.cts.map +1 -1
- package/dist/api/keyring.d.mts +25 -2
- package/dist/api/keyring.d.mts.map +1 -1
- package/dist/api/keyring.mjs.map +1 -1
- package/dist/api/options.cjs +17 -0
- package/dist/api/options.cjs.map +1 -0
- package/dist/api/options.d.cts +21 -0
- package/dist/api/options.d.cts.map +1 -0
- package/dist/api/options.d.mts +21 -0
- package/dist/api/options.d.mts.map +1 -0
- package/dist/api/options.mjs +14 -0
- package/dist/api/options.mjs.map +1 -0
- package/dist/api/transaction.d.cts +4 -4
- package/dist/api/transaction.d.mts +4 -4
- package/dist/eth/erc4337/types.d.cts +1 -1
- package/dist/eth/erc4337/types.d.mts +1 -1
- package/dist/events.cjs +29 -0
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +50 -17
- package/dist/events.d.cts.map +1 -1
- package/dist/events.d.mts +50 -17
- package/dist/events.d.mts.map +1 -1
- package/dist/events.mjs +30 -1
- package/dist/events.mjs.map +1 -1
- package/dist/rpc.cjs +14 -1
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.cts +42 -3
- package/dist/rpc.d.cts.map +1 -1
- package/dist/rpc.d.mts +42 -3
- package/dist/rpc.d.mts.map +1 -1
- package/dist/rpc.mjs +14 -1
- package/dist/rpc.mjs.map +1 -1
- package/package.json +3 -3
package/dist/events.d.mts
CHANGED
@@ -23,6 +23,9 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
23
23
|
scopes: `${string}:${string}`[];
|
24
24
|
methods: string[];
|
25
25
|
};
|
26
|
+
metamask?: {
|
27
|
+
correlationId: string;
|
28
|
+
};
|
26
29
|
accountNameSuggestion?: string;
|
27
30
|
displayConfirmation?: boolean;
|
28
31
|
displayAccountNameSuggestion?: boolean;
|
@@ -38,10 +41,18 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
38
41
|
scopes: `${string}:${string}`[];
|
39
42
|
methods: string[];
|
40
43
|
};
|
44
|
+
metamask?: {
|
45
|
+
correlationId: string;
|
46
|
+
};
|
41
47
|
accountNameSuggestion?: string;
|
42
48
|
displayConfirmation?: boolean;
|
43
49
|
displayAccountNameSuggestion?: boolean;
|
44
50
|
}, {
|
51
|
+
metamask: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | {
|
52
|
+
correlationId: string;
|
53
|
+
}, {
|
54
|
+
correlationId: import("@metamask/superstruct").Struct<string, null>;
|
55
|
+
}>;
|
45
56
|
/**
|
46
57
|
* New account object.
|
47
58
|
*/
|
@@ -75,6 +86,7 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
75
86
|
accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
76
87
|
/**
|
77
88
|
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
89
|
+
*
|
78
90
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
79
91
|
*/
|
80
92
|
displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
@@ -89,6 +101,8 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
|
|
89
101
|
displayAccountNameSuggestion: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
|
90
102
|
}>;
|
91
103
|
}>;
|
104
|
+
export type AccountCreatedEvent = Infer<typeof AccountCreatedEventStruct>;
|
105
|
+
export type AccountCreatedEventPayload = AccountCreatedEvent['params'];
|
92
106
|
export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
93
107
|
method: "notify:accountUpdated";
|
94
108
|
params: {
|
@@ -138,6 +152,8 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
|
|
138
152
|
}>;
|
139
153
|
}>;
|
140
154
|
}>;
|
155
|
+
export type AccountUpdatedEvent = Infer<typeof AccountUpdatedEventStruct>;
|
156
|
+
export type AccountUpdatedEventPayload = AccountUpdatedEvent['params'];
|
141
157
|
export declare const AccountDeletedEventStruct: import("@metamask/superstruct").Struct<{
|
142
158
|
method: "notify:accountDeleted";
|
143
159
|
params: {
|
@@ -154,6 +170,8 @@ export declare const AccountDeletedEventStruct: import("@metamask/superstruct").
|
|
154
170
|
id: import("@metamask/superstruct").Struct<string, null>;
|
155
171
|
}>;
|
156
172
|
}>;
|
173
|
+
export type AccountDeletedEvent = Infer<typeof AccountDeletedEventStruct>;
|
174
|
+
export type AccountDeletedEventPayload = AccountDeletedEvent['params'];
|
157
175
|
export declare const RequestApprovedEventStruct: import("@metamask/superstruct").Struct<{
|
158
176
|
method: "notify:requestApproved";
|
159
177
|
params: {
|
@@ -176,6 +194,8 @@ export declare const RequestApprovedEventStruct: import("@metamask/superstruct")
|
|
176
194
|
result: import("@metamask/superstruct").Struct<import("@metamask/utils").Json, unknown>;
|
177
195
|
}>;
|
178
196
|
}>;
|
197
|
+
export type RequestApprovedEvent = Infer<typeof RequestApprovedEventStruct>;
|
198
|
+
export type RequestApprovedEventPayload = RequestApprovedEvent['params'];
|
179
199
|
export declare const RequestRejectedEventStruct: import("@metamask/superstruct").Struct<{
|
180
200
|
method: "notify:requestRejected";
|
181
201
|
params: {
|
@@ -192,6 +212,15 @@ export declare const RequestRejectedEventStruct: import("@metamask/superstruct")
|
|
192
212
|
id: import("@metamask/superstruct").Struct<string, null>;
|
193
213
|
}>;
|
194
214
|
}>;
|
215
|
+
export type RequestRejectedEvent = Infer<typeof RequestRejectedEventStruct>;
|
216
|
+
export type RequestRejectedEventPayload = RequestRejectedEvent['params'];
|
217
|
+
/**
|
218
|
+
* Event emitted when the balances of an account are updated.
|
219
|
+
*
|
220
|
+
* Only changes are reported.
|
221
|
+
*
|
222
|
+
* The Snap can choose to emit this event for multiple accounts at once.
|
223
|
+
*/
|
195
224
|
export declare const AccountBalancesUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
196
225
|
method: "notify:accountBalancesUpdated";
|
197
226
|
params: {
|
@@ -217,15 +246,16 @@ export declare const AccountBalancesUpdatedEventStruct: import("@metamask/supers
|
|
217
246
|
}>>, null>;
|
218
247
|
}>;
|
219
248
|
}>;
|
249
|
+
export type AccountBalancesUpdatedEvent = Infer<typeof AccountBalancesUpdatedEventStruct>;
|
250
|
+
export type AccountBalancesUpdatedEventPayload = AccountBalancesUpdatedEvent['params'];
|
220
251
|
/**
|
221
|
-
* Event emitted when the
|
252
|
+
* Event emitted when the transactions of an account are updated (added or
|
253
|
+
* changed).
|
222
254
|
*
|
223
255
|
* Only changes are reported.
|
224
256
|
*
|
225
257
|
* The Snap can choose to emit this event for multiple accounts at once.
|
226
258
|
*/
|
227
|
-
export type AccountBalancesUpdatedEvent = Infer<typeof AccountBalancesUpdatedEventStruct>;
|
228
|
-
export type AccountBalancesUpdatedEventPayload = AccountBalancesUpdatedEvent['params'];
|
229
259
|
export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
230
260
|
method: "notify:accountTransactionsUpdated";
|
231
261
|
params: {
|
@@ -249,8 +279,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
249
279
|
timestamp: number | null;
|
250
280
|
}[];
|
251
281
|
chain: `${string}:${string}`;
|
252
|
-
account: string;
|
253
282
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
283
|
+
account: string;
|
254
284
|
timestamp: number | null;
|
255
285
|
to: {
|
256
286
|
address: string;
|
@@ -301,8 +331,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
301
331
|
timestamp: number | null;
|
302
332
|
}[];
|
303
333
|
chain: `${string}:${string}`;
|
304
|
-
account: string;
|
305
334
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
335
|
+
account: string;
|
306
336
|
timestamp: number | null;
|
307
337
|
to: {
|
308
338
|
address: string;
|
@@ -353,8 +383,8 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
353
383
|
timestamp: number | null;
|
354
384
|
}[];
|
355
385
|
chain: `${string}:${string}`;
|
356
|
-
account: string;
|
357
386
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
387
|
+
account: string;
|
358
388
|
timestamp: number | null;
|
359
389
|
to: {
|
360
390
|
address: string;
|
@@ -383,16 +413,15 @@ export declare const AccountTransactionsUpdatedEventStruct: import("@metamask/su
|
|
383
413
|
}[]>, null>;
|
384
414
|
}>;
|
385
415
|
}>;
|
416
|
+
export type AccountTransactionsUpdatedEvent = Infer<typeof AccountTransactionsUpdatedEventStruct>;
|
417
|
+
export type AccountTransactionsUpdatedEventPayload = AccountTransactionsUpdatedEvent['params'];
|
386
418
|
/**
|
387
|
-
* Event emitted when the
|
388
|
-
* changed).
|
419
|
+
* Event emitted when the assets of an account are updated.
|
389
420
|
*
|
390
421
|
* Only changes are reported.
|
391
422
|
*
|
392
423
|
* The Snap can choose to emit this event for multiple accounts at once.
|
393
424
|
*/
|
394
|
-
export type AccountTransactionsUpdatedEvent = Infer<typeof AccountTransactionsUpdatedEventStruct>;
|
395
|
-
export type AccountTransactionsUpdatedEventPayload = AccountTransactionsUpdatedEvent['params'];
|
396
425
|
export declare const AccountAssetListUpdatedEventStruct: import("@metamask/superstruct").Struct<{
|
397
426
|
method: "notify:accountAssetListUpdated";
|
398
427
|
params: {
|
@@ -418,13 +447,17 @@ export declare const AccountAssetListUpdatedEventStruct: import("@metamask/super
|
|
418
447
|
}>, null>;
|
419
448
|
}>;
|
420
449
|
}>;
|
421
|
-
/**
|
422
|
-
* Event emitted when the assets of an account are updated.
|
423
|
-
*
|
424
|
-
* Only changes are reported.
|
425
|
-
*
|
426
|
-
* The Snap can choose to emit this event for multiple accounts at once.
|
427
|
-
*/
|
428
450
|
export type AccountAssetListUpdatedEvent = Infer<typeof AccountAssetListUpdatedEventStruct>;
|
429
451
|
export type AccountAssetListUpdatedEventPayload = AccountAssetListUpdatedEvent['params'];
|
452
|
+
/**
|
453
|
+
* Keyring events.
|
454
|
+
*/
|
455
|
+
type KeyringEvents = AccountCreatedEvent | AccountUpdatedEvent | AccountDeletedEvent | AccountAssetListUpdatedEvent | AccountBalancesUpdatedEvent | AccountTransactionsUpdatedEvent | RequestApprovedEvent | RequestRejectedEvent;
|
456
|
+
/**
|
457
|
+
* Extract the payload for a given `KeyringEvent` event.
|
458
|
+
*/
|
459
|
+
export type KeyringEventPayload<Event extends KeyringEvent> = Extract<KeyringEvents, {
|
460
|
+
method: `${Event}`;
|
461
|
+
}>['params'];
|
462
|
+
export {};
|
430
463
|
//# sourceMappingURL=events.d.mts.map
|
package/dist/events.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"events.d.mts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAenD;;GAEG;AACH,oBAAY,YAAY;IAEtB,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IACxC,cAAc,0BAA0B;IAGxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;IAG1C,sBAAsB,kCAAkC;IACxD,uBAAuB,mCAAmC;IAC1D,0BAA0B,sCAAsC;CACjE;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;QAGH;;;;;;WAMG;;QAGH;;;;WAIG;;QAGH;;;;;;;WAOG;;;EAQL,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC1E,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAEvE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;QAGlC;;WAEG;;;;;;;;;;;;;;;;;;;;;;EAGL,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC1E,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAEvE,eAAO,MAAM,yBAAyB;;;;;;;;;;QAGlC;;WAEG;;;EAGL,CAAC;AACH,MAAM,MAAM,mBAAm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;;WAEG;;;;;;EAuBL,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,KAAK,CAC9C,OAAO,kCAAkC,CAC1C,CAAC;AACF,MAAM,MAAM,mCAAmC,GAC7C,4BAA4B,CAAC,QAAQ,CAAC,CAAC;AAEzC;;GAEG;AAEH,KAAK,aAAa,GACd,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,4BAA4B,GAC5B,2BAA2B,GAC3B,+BAA+B,GAC/B,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,KAAK,SAAS,YAAY,IAAI,OAAO,CACnE,aAAa,EAGb;IAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAA;CAAE,CACvB,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/events.mjs
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
|
2
|
+
// FIXME: This rule seems to be triggering a false positive on the `KeyringEvents`.
|
1
3
|
import { exactOptional, object, UuidStruct, AccountIdStruct } from "@metamask/keyring-utils";
|
2
4
|
import { array, boolean, literal, record, string } from "@metamask/superstruct";
|
3
5
|
import { CaipAssetTypeStruct, CaipAssetTypeOrIdStruct, JsonStruct } from "@metamask/utils";
|
4
|
-
import { FungibleAssetAmountStruct, KeyringAccountStruct, TransactionStruct } from "./api/index.mjs";
|
6
|
+
import { FungibleAssetAmountStruct, KeyringAccountStruct, TransactionStruct, MetaMaskOptionsStruct } from "./api/index.mjs";
|
5
7
|
/**
|
6
8
|
* Supported keyring events.
|
7
9
|
*/
|
@@ -36,6 +38,7 @@ export const AccountCreatedEventStruct = object({
|
|
36
38
|
accountNameSuggestion: exactOptional(string()),
|
37
39
|
/**
|
38
40
|
* Instructs MetaMask to display the add account confirmation dialog in the UI.
|
41
|
+
*
|
39
42
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
40
43
|
*/
|
41
44
|
displayConfirmation: exactOptional(boolean()),
|
@@ -48,6 +51,10 @@ export const AccountCreatedEventStruct = object({
|
|
48
51
|
* **Note:** This is not guaranteed to be honored by the MetaMask client.
|
49
52
|
*/
|
50
53
|
displayAccountNameSuggestion: exactOptional(boolean()),
|
54
|
+
/**
|
55
|
+
* Metamask internal options.
|
56
|
+
*/
|
57
|
+
...MetaMaskOptionsStruct.schema,
|
51
58
|
}),
|
52
59
|
});
|
53
60
|
export const AccountUpdatedEventStruct = object({
|
@@ -92,6 +99,13 @@ export const RequestRejectedEventStruct = object({
|
|
92
99
|
});
|
93
100
|
// Assets related events:
|
94
101
|
// -----------------------------------------------------------------------------------------------
|
102
|
+
/**
|
103
|
+
* Event emitted when the balances of an account are updated.
|
104
|
+
*
|
105
|
+
* Only changes are reported.
|
106
|
+
*
|
107
|
+
* The Snap can choose to emit this event for multiple accounts at once.
|
108
|
+
*/
|
95
109
|
export const AccountBalancesUpdatedEventStruct = object({
|
96
110
|
method: literal(`${KeyringEvent.AccountBalancesUpdated}`),
|
97
111
|
params: object({
|
@@ -117,6 +131,14 @@ export const AccountBalancesUpdatedEventStruct = object({
|
|
117
131
|
FungibleAssetAmountStruct)),
|
118
132
|
}),
|
119
133
|
});
|
134
|
+
/**
|
135
|
+
* Event emitted when the transactions of an account are updated (added or
|
136
|
+
* changed).
|
137
|
+
*
|
138
|
+
* Only changes are reported.
|
139
|
+
*
|
140
|
+
* The Snap can choose to emit this event for multiple accounts at once.
|
141
|
+
*/
|
120
142
|
export const AccountTransactionsUpdatedEventStruct = object({
|
121
143
|
method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),
|
122
144
|
params: object({
|
@@ -134,6 +156,13 @@ export const AccountTransactionsUpdatedEventStruct = object({
|
|
134
156
|
array(TransactionStruct)),
|
135
157
|
}),
|
136
158
|
});
|
159
|
+
/**
|
160
|
+
* Event emitted when the assets of an account are updated.
|
161
|
+
*
|
162
|
+
* Only changes are reported.
|
163
|
+
*
|
164
|
+
* The Snap can choose to emit this event for multiple accounts at once.
|
165
|
+
*/
|
137
166
|
export const AccountAssetListUpdatedEventStruct = object({
|
138
167
|
method: literal(`${KeyringEvent.AccountAssetListUpdated}`),
|
139
168
|
params: object({
|
package/dist/events.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,MAAM,EACN,UAAU,EACV,eAAe,EAChB,gCAAgC;AAEjC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAChF,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACX,wBAAwB;AAEzB,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EAClB,wBAAc;AAEf;;GAEG;AACH,MAAM,CAAN,IAAY,YAcX;AAdD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;IAE1C,wBAAwB;IACxB,wEAAwD,CAAA;IACxD,0EAA0D,CAAA;IAC1D,gFAAgE,CAAA;AAClE,CAAC,EAdW,YAAY,KAAZ,YAAY,QAcvB;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,oBAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;QAE9C;;;WAGG;QACH,mBAAmB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QAE7C;;;;;;;WAOG;QACH,4BAA4B,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KACvD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ACF;KACF,CAAC;CACH,CAAC,CAAC;AAeH,MAAM,CAAC,MAAM,qCAAqC,GAAG,MAAM,CAAC;IAC1D,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,0BAA0B,EAAE,CAAC;IAC7D,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,YAAY,EAAE,MAAM;QAClB;;WAEG;QACH,eAAe;QAEf;;WAEG;QACH,KAAK,CAAC,iBAAiB,CAAC,CACzB;KACF,CAAC;CACH,CAAC,CAAC;AAgBH,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC;IACvD,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAC1D,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,MAAM,EAAE,MAAM;QACZ;;WAEG;QACH,eAAe;QAEf;;WAEG;QACH,MAAM,CAAC;YACL;;eAEG;YACH,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC;YAErC;;eAEG;YACH,OAAO,EAAE,KAAK,CAAC,uBAAuB,CAAC;SACxC,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n exactOptional,\n object,\n UuidStruct,\n AccountIdStruct,\n} from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, literal, record, string } from '@metamask/superstruct';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nimport {\n FungibleAssetAmountStruct,\n KeyringAccountStruct,\n TransactionStruct,\n} from './api';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n\n // Assets related events\n AccountBalancesUpdated = 'notify:accountBalancesUpdated',\n AccountAssetListUpdated = 'notify:accountAssetListUpdated',\n AccountTransactionsUpdated = 'notify:accountTransactionsUpdated',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n\n /**\n * Instructs MetaMask to display the name confirmation dialog in the UI.\n * Otherwise, the account will be added with the suggested name, if it's not\n * already in use; if it is, a suffix will be appended to the name to make it\n * unique.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayAccountNameSuggestion: exactOptional(boolean()),\n }),\n});\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\n\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n"]}
|
1
|
+
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,mFAAmF;AAEnF,OAAO,EACL,aAAa,EACb,MAAM,EACN,UAAU,EACV,eAAe,EAChB,gCAAgC;AAEjC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAChF,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACX,wBAAwB;AAEzB,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACtB,wBAAc;AAEf;;GAEG;AACH,MAAM,CAAN,IAAY,YAcX;AAdD,WAAY,YAAY;IACtB,iBAAiB;IACjB,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IACxC,wDAAwC,CAAA;IAExC,iBAAiB;IACjB,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;IAE1C,wBAAwB;IACxB,wEAAwD,CAAA;IACxD,0EAA0D,CAAA;IAC1D,gFAAgE,CAAA;AAClE,CAAC,EAdW,YAAY,KAAZ,YAAY,QAcvB;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,oBAAoB;QAE7B;;;;;;WAMG;QACH,qBAAqB,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;QAE9C;;;;WAIG;QACH,mBAAmB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QAE7C;;;;;;;WAOG;QACH,4BAA4B,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QAEtD;;WAEG;QACH,GAAG,qBAAqB,CAAC,MAAM;KAChC,CAAC;C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CAC1B,CACF;KACF,CAAC;CACH,CAAC,CAAC;AAOH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,MAAM,CAAC;IAC1D,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,0BAA0B,EAAE,CAAC;IAC7D,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,YAAY,EAAE,MAAM;QAClB;;WAEG;QACH,eAAe;QAEf;;WAEG;QACH,KAAK,CAAC,iBAAiB,CAAC,CACzB;KACF,CAAC;CACH,CAAC,CAAC;AAOH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC;IACvD,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;IAC1D,MAAM,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,MAAM,EAAE,MAAM;QACZ;;WAEG;QACH,eAAe;QAEf;;WAEG;QACH,MAAM,CAAC;YACL;;eAEG;YACH,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC;YAErC;;eAEG;YACH,OAAO,EAAE,KAAK,CAAC,uBAAuB,CAAC;SACxC,CAAC,CACH;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n// FIXME: This rule seems to be triggering a false positive on the `KeyringEvents`.\n\nimport {\n exactOptional,\n object,\n UuidStruct,\n AccountIdStruct,\n} from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { array, boolean, literal, record, string } from '@metamask/superstruct';\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n JsonStruct,\n} from '@metamask/utils';\n\nimport {\n FungibleAssetAmountStruct,\n KeyringAccountStruct,\n TransactionStruct,\n MetaMaskOptionsStruct,\n} from './api';\n\n/**\n * Supported keyring events.\n */\nexport enum KeyringEvent {\n // Account events\n AccountCreated = 'notify:accountCreated',\n AccountUpdated = 'notify:accountUpdated',\n AccountDeleted = 'notify:accountDeleted',\n\n // Request events\n RequestApproved = 'notify:requestApproved',\n RequestRejected = 'notify:requestRejected',\n\n // Assets related events\n AccountBalancesUpdated = 'notify:accountBalancesUpdated',\n AccountAssetListUpdated = 'notify:accountAssetListUpdated',\n AccountTransactionsUpdated = 'notify:accountTransactionsUpdated',\n}\n\nexport const AccountCreatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountCreated}`),\n params: object({\n /**\n * New account object.\n */\n account: KeyringAccountStruct,\n\n /**\n * Account name suggestion provided to the MetaMask client.\n *\n * The keyring can suggest a name for the account, but it's up to the\n * client to decide whether to use it. The keyring won't be informed if the\n * client decides to use a different name.\n */\n accountNameSuggestion: exactOptional(string()),\n\n /**\n * Instructs MetaMask to display the add account confirmation dialog in the UI.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayConfirmation: exactOptional(boolean()),\n\n /**\n * Instructs MetaMask to display the name confirmation dialog in the UI.\n * Otherwise, the account will be added with the suggested name, if it's not\n * already in use; if it is, a suffix will be appended to the name to make it\n * unique.\n *\n * **Note:** This is not guaranteed to be honored by the MetaMask client.\n */\n displayAccountNameSuggestion: exactOptional(boolean()),\n\n /**\n * Metamask internal options.\n */\n ...MetaMaskOptionsStruct.schema,\n }),\n});\nexport type AccountCreatedEvent = Infer<typeof AccountCreatedEventStruct>;\nexport type AccountCreatedEventPayload = AccountCreatedEvent['params'];\n\nexport const AccountUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountUpdated}`),\n params: object({\n /**\n * Updated account object.\n */\n account: KeyringAccountStruct,\n }),\n});\nexport type AccountUpdatedEvent = Infer<typeof AccountUpdatedEventStruct>;\nexport type AccountUpdatedEventPayload = AccountUpdatedEvent['params'];\n\nexport const AccountDeletedEventStruct = object({\n method: literal(`${KeyringEvent.AccountDeleted}`),\n params: object({\n /**\n * Deleted account ID.\n */\n id: UuidStruct,\n }),\n});\nexport type AccountDeletedEvent = Infer<typeof AccountDeletedEventStruct>;\nexport type AccountDeletedEventPayload = AccountDeletedEvent['params'];\n\nexport const RequestApprovedEventStruct = object({\n method: literal(`${KeyringEvent.RequestApproved}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n\n /**\n * Request result.\n */\n result: JsonStruct,\n }),\n});\nexport type RequestApprovedEvent = Infer<typeof RequestApprovedEventStruct>;\nexport type RequestApprovedEventPayload = RequestApprovedEvent['params'];\n\nexport const RequestRejectedEventStruct = object({\n method: literal(`${KeyringEvent.RequestRejected}`),\n params: object({\n /**\n * Request ID.\n */\n id: UuidStruct,\n }),\n});\nexport type RequestRejectedEvent = Infer<typeof RequestRejectedEventStruct>;\nexport type RequestRejectedEventPayload = RequestRejectedEvent['params'];\n\n// Assets related events:\n// -----------------------------------------------------------------------------------------------\n\n/**\n * Event emitted when the balances of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountBalancesUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountBalancesUpdated}`),\n params: object({\n /**\n * Balances updates of accounts owned by the Snap.\n */\n balances: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Mapping of each owned assets and their respective balances for that account.\n */\n record(\n /**\n * Asset type (CAIP-19).\n */\n CaipAssetTypeStruct,\n\n /**\n * Balance information for a given asset.\n */\n FungibleAssetAmountStruct,\n ),\n ),\n }),\n});\nexport type AccountBalancesUpdatedEvent = Infer<\n typeof AccountBalancesUpdatedEventStruct\n>;\nexport type AccountBalancesUpdatedEventPayload =\n AccountBalancesUpdatedEvent['params'];\n\n/**\n * Event emitted when the transactions of an account are updated (added or\n * changed).\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountTransactionsUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountTransactionsUpdated}`),\n params: object({\n /**\n * Transactions updates of accounts owned by the Snap.\n */\n transactions: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * List of updated transactions for that account.\n */\n array(TransactionStruct),\n ),\n }),\n});\nexport type AccountTransactionsUpdatedEvent = Infer<\n typeof AccountTransactionsUpdatedEventStruct\n>;\nexport type AccountTransactionsUpdatedEventPayload =\n AccountTransactionsUpdatedEvent['params'];\n\n/**\n * Event emitted when the assets of an account are updated.\n *\n * Only changes are reported.\n *\n * The Snap can choose to emit this event for multiple accounts at once.\n */\nexport const AccountAssetListUpdatedEventStruct = object({\n method: literal(`${KeyringEvent.AccountAssetListUpdated}`),\n params: object({\n /**\n * Asset list update of accounts owned by the Snap.\n */\n assets: record(\n /**\n * Account ID.\n */\n AccountIdStruct,\n\n /**\n * Asset list changes for that account.\n */\n object({\n /**\n * New assets detected.\n */\n added: array(CaipAssetTypeOrIdStruct),\n\n /**\n * Assets no longer available on that account.\n */\n removed: array(CaipAssetTypeOrIdStruct),\n }),\n ),\n }),\n});\nexport type AccountAssetListUpdatedEvent = Infer<\n typeof AccountAssetListUpdatedEventStruct\n>;\nexport type AccountAssetListUpdatedEventPayload =\n AccountAssetListUpdatedEvent['params'];\n\n/**\n * Keyring events.\n */\n// For some reason, eslint sometimes infer one of those members as `any`...\ntype KeyringEvents =\n | AccountCreatedEvent\n | AccountUpdatedEvent\n | AccountDeletedEvent\n | AccountAssetListUpdatedEvent\n | AccountBalancesUpdatedEvent\n | AccountTransactionsUpdatedEvent\n | RequestApprovedEvent\n | RequestRejectedEvent;\n\n/**\n * Extract the payload for a given `KeyringEvent` event.\n */\nexport type KeyringEventPayload<Event extends KeyringEvent> = Extract<\n KeyringEvents,\n // We need to use a literal string here, since that is what `KeyringEvents`\n // is using (probably because of `superstruct`.\n { method: `${Event}` }\n>['params'];\n"]}
|
package/dist/rpc.cjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsStruct = exports.ResolveAccountAddressResponseStruct = exports.ResolveAccountAddressRequestStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.ListAccountAssetsResponseStruct = exports.ListAccountAssetsRequestStruct = exports.ListAccountTransactionsResponseStruct = exports.ListAccountTransactionsRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = exports.KeyringRpcMethod = void 0;
|
3
|
+
exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = exports.ApproveRequestResponseStruct = exports.ApproveRequestRequestStruct = exports.SubmitRequestResponseStruct = exports.SubmitRequestRequestStruct = exports.GetRequestResponseStruct = exports.GetRequestRequestStruct = exports.ListRequestsResponseStruct = exports.ListRequestsRequestStruct = exports.ExportAccountResponseStruct = exports.ExportAccountRequestStruct = exports.DeleteAccountResponseStruct = exports.DeleteAccountRequestStruct = exports.UpdateAccountResponseStruct = exports.UpdateAccountRequestStruct = exports.FilterAccountChainsResponseStruct = exports.FilterAccountChainsStruct = exports.ResolveAccountAddressResponseStruct = exports.ResolveAccountAddressRequestStruct = exports.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.ListAccountAssetsResponseStruct = exports.ListAccountAssetsRequestStruct = exports.ListAccountTransactionsResponseStruct = exports.ListAccountTransactionsRequestStruct = exports.DiscoverAccountsResponseStruct = exports.DiscoverAccountsRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = exports.KeyringRpcMethod = void 0;
|
4
4
|
exports.isKeyringRpcMethod = isKeyringRpcMethod;
|
5
5
|
const keyring_utils_1 = require("@metamask/keyring-utils");
|
6
6
|
const superstruct_1 = require("@metamask/superstruct");
|
@@ -14,6 +14,7 @@ var KeyringRpcMethod;
|
|
14
14
|
KeyringRpcMethod["ListAccounts"] = "keyring_listAccounts";
|
15
15
|
KeyringRpcMethod["GetAccount"] = "keyring_getAccount";
|
16
16
|
KeyringRpcMethod["CreateAccount"] = "keyring_createAccount";
|
17
|
+
KeyringRpcMethod["DiscoverAccounts"] = "keyring_discoverAccounts";
|
17
18
|
KeyringRpcMethod["ListAccountAssets"] = "keyring_listAccountAssets";
|
18
19
|
KeyringRpcMethod["ListAccountTransactions"] = "keyring_listAccountTransactions";
|
19
20
|
KeyringRpcMethod["GetAccountBalances"] = "keyring_getAccountBalances";
|
@@ -70,6 +71,18 @@ exports.CreateAccountRequestStruct = (0, keyring_utils_1.object)({
|
|
70
71
|
});
|
71
72
|
exports.CreateAccountResponseStruct = api_1.KeyringAccountStruct;
|
72
73
|
// ----------------------------------------------------------------------------
|
74
|
+
// Discover accounts
|
75
|
+
exports.DiscoverAccountsRequestStruct = (0, keyring_utils_1.object)({
|
76
|
+
...CommonHeader,
|
77
|
+
method: (0, superstruct_1.literal)('keyring_discoverAccounts'),
|
78
|
+
params: (0, keyring_utils_1.object)({
|
79
|
+
scopes: (0, superstruct_1.array)(api_1.CaipChainIdStruct),
|
80
|
+
entropySource: (0, superstruct_1.string)(),
|
81
|
+
groupIndex: (0, superstruct_1.number)(),
|
82
|
+
}),
|
83
|
+
});
|
84
|
+
exports.DiscoverAccountsResponseStruct = (0, superstruct_1.array)(api_1.DiscoveredAccountStruct);
|
85
|
+
// ----------------------------------------------------------------------------
|
73
86
|
// List account transactions
|
74
87
|
exports.ListAccountTransactionsRequestStruct = (0, keyring_utils_1.object)({
|
75
88
|
...CommonHeader,
|
package/dist/rpc.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rpc.cjs","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":";;;AA2DA,gDAEC;AA7DD,2DAIiC;AAEjC,uDAQ+B;AAC/B,2CAA6C;AAE7C,yCAYe;AAEf;;GAEG;AACH,IAAY,gBAiBX;AAjBD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,mEAA+C,CAAA;IAC/C,+EAA2D,CAAA;IAC3D,qEAAiD,CAAA;IACjD,2EAAuD,CAAA;IACvD,uEAAmD,CAAA;IACnD,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,6DAAyC,CAAA;IACzC,2DAAuC,CAAA;AACzC,CAAC,EAjBW,gBAAgB,gCAAhB,gBAAgB,QAiB3B;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,gBAAgB;AAEH,QAAA,yBAAyB,GAAG,IAAA,sBAAM,EAAC;IAC9C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,sBAAsB,CAAC;CACxC,C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EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,wBAAwB,GAAG,0BAAoB,CAAC;AAI7D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,0BAAoB;CAC7B,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,2BAAqB,CAAC;AAIjE,+EAA+E;AAC/E,kBAAkB;AAEL,QAAA,2BAA2B,GAAG,IAAA,sBAAM,EAAC;IAChD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,wBAAwB,CAAC;IACzC,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;QACd,IAAI,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;KACnC,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,4BAA4B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import {\n object,\n UuidStruct,\n JsonRpcRequestStruct,\n} from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n nullable,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n CaipChainIdStruct,\n BalanceStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n TransactionsPageStruct,\n PaginationStruct,\n CaipAccountIdStruct,\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 ResolveAccountAddress = 'keyring_resolveAccountAddress',\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// Resolve account address\n\nexport const ResolveAccountAddressRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_resolveAccountAddress'),\n params: object({\n scope: CaipChainIdStruct,\n request: JsonRpcRequestStruct,\n }),\n});\n\nexport type ResolveAccountAddressRequest = Infer<\n typeof ResolveAccountAddressRequestStruct\n>;\n\nexport const ResolveAccountAddressResponseStruct = nullable(\n object({\n address: CaipAccountIdStruct,\n }),\n);\n\nexport type ResolveAccountAddressResponse = Infer<\n typeof ResolveAccountAddressResponseStruct\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.cjs","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":";;;AA6DA,gDAEC;AA/DD,2DAIiC;AAEjC,uDAQ+B;AAC/B,2CAA6C;AAE7C,yCAae;AAEf;;GAEG;AACH,IAAY,gBAkBX;AAlBD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,iEAA6C,CAAA;IAC7C,mEAA+C,CAAA;IAC/C,+EAA2D,CAAA;IAC3D,qEAAiD,CAAA;IACjD,2EAAuD,CAAA;IACvD,uEAAmD,CAAA;IACnD,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,2DAAuC,CAAA;IACvC,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,6DAAyC,CAAA;IACzC,2DAAuC,CAAA;AACzC,CAAC,EAlBW,gBAAgB,gCAAhB,gBAAgB,QAkB3B;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC;AAED,+EAA+E;AAE/E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAA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AAC;CACH,CAAC,CAAC;AAIU,QAAA,4BAA4B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC;AAI1D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import {\n object,\n UuidStruct,\n JsonRpcRequestStruct,\n} from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n nullable,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport {\n CaipAssetTypeStruct,\n CaipAssetTypeOrIdStruct,\n CaipChainIdStruct,\n BalanceStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n TransactionsPageStruct,\n PaginationStruct,\n CaipAccountIdStruct,\n DiscoveredAccountStruct,\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 DiscoverAccounts = 'keyring_discoverAccounts',\n ListAccountAssets = 'keyring_listAccountAssets',\n ListAccountTransactions = 'keyring_listAccountTransactions',\n GetAccountBalances = 'keyring_getAccountBalances',\n ResolveAccountAddress = 'keyring_resolveAccountAddress',\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// Discover accounts\n\nexport const DiscoverAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_discoverAccounts'),\n params: object({\n scopes: array(CaipChainIdStruct),\n entropySource: string(),\n groupIndex: number(),\n }),\n});\n\nexport type DiscoverAccountsRequest = Infer<\n typeof DiscoverAccountsRequestStruct\n>;\n\nexport const DiscoverAccountsResponseStruct = array(DiscoveredAccountStruct);\n\nexport type DiscoverAccountsResponse = Infer<\n typeof DiscoverAccountsResponseStruct\n>;\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// Resolve account address\n\nexport const ResolveAccountAddressRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_resolveAccountAddress'),\n params: object({\n scope: CaipChainIdStruct,\n request: JsonRpcRequestStruct,\n }),\n});\n\nexport type ResolveAccountAddressRequest = Infer<\n typeof ResolveAccountAddressRequestStruct\n>;\n\nexport const ResolveAccountAddressResponseStruct = nullable(\n object({\n address: CaipAccountIdStruct,\n }),\n);\n\nexport type ResolveAccountAddressResponse = Infer<\n typeof ResolveAccountAddressResponseStruct\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/rpc.d.cts
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
|
+
DiscoverAccounts = "keyring_discoverAccounts",
|
9
10
|
ListAccountAssets = "keyring_listAccountAssets",
|
10
11
|
ListAccountTransactions = "keyring_listAccountTransactions",
|
11
12
|
GetAccountBalances = "keyring_getAccountBalances",
|
@@ -143,6 +144,44 @@ export declare const CreateAccountResponseStruct: import("@metamask/superstruct"
|
|
143
144
|
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
144
145
|
}>;
|
145
146
|
export type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;
|
147
|
+
export declare const DiscoverAccountsRequestStruct: import("@metamask/superstruct").Struct<{
|
148
|
+
method: "keyring_discoverAccounts";
|
149
|
+
id: string | number | null;
|
150
|
+
jsonrpc: "2.0";
|
151
|
+
params: {
|
152
|
+
scopes: `${string}:${string}`[];
|
153
|
+
entropySource: string;
|
154
|
+
groupIndex: number;
|
155
|
+
};
|
156
|
+
}, {
|
157
|
+
method: import("@metamask/superstruct").Struct<"keyring_discoverAccounts", "keyring_discoverAccounts">;
|
158
|
+
params: import("@metamask/superstruct").Struct<{
|
159
|
+
scopes: `${string}:${string}`[];
|
160
|
+
entropySource: string;
|
161
|
+
groupIndex: number;
|
162
|
+
}, {
|
163
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
164
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
165
|
+
groupIndex: import("@metamask/superstruct").Struct<number, null>;
|
166
|
+
}>;
|
167
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
168
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
169
|
+
}>;
|
170
|
+
export type DiscoverAccountsRequest = Infer<typeof DiscoverAccountsRequestStruct>;
|
171
|
+
export declare const DiscoverAccountsResponseStruct: import("@metamask/superstruct").Struct<{
|
172
|
+
type: "bip44";
|
173
|
+
scopes: `${string}:${string}`[];
|
174
|
+
derivationPath: `m/${string}`;
|
175
|
+
}[], import("@metamask/superstruct").Struct<{
|
176
|
+
type: "bip44";
|
177
|
+
scopes: `${string}:${string}`[];
|
178
|
+
derivationPath: `m/${string}`;
|
179
|
+
}, {
|
180
|
+
type: import("@metamask/superstruct").Struct<"bip44", "bip44">;
|
181
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
182
|
+
derivationPath: import("@metamask/superstruct").Struct<`m/${string}`, null>;
|
183
|
+
}>>;
|
184
|
+
export type DiscoverAccountsResponse = Infer<typeof DiscoverAccountsResponseStruct>;
|
146
185
|
export declare const ListAccountTransactionsRequestStruct: import("@metamask/superstruct").Struct<{
|
147
186
|
method: "keyring_listAccountTransactions";
|
148
187
|
id: string | number | null;
|
@@ -197,8 +236,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
197
236
|
timestamp: number | null;
|
198
237
|
}[];
|
199
238
|
chain: `${string}:${string}`;
|
200
|
-
account: string;
|
201
239
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
240
|
+
account: string;
|
202
241
|
timestamp: number | null;
|
203
242
|
to: {
|
204
243
|
address: string;
|
@@ -247,8 +286,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
247
286
|
timestamp: number | null;
|
248
287
|
}[];
|
249
288
|
chain: `${string}:${string}`;
|
250
|
-
account: string;
|
251
289
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
290
|
+
account: string;
|
252
291
|
timestamp: number | null;
|
253
292
|
to: {
|
254
293
|
address: string;
|
@@ -294,8 +333,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
294
333
|
timestamp: number | null;
|
295
334
|
}[];
|
296
335
|
chain: `${string}:${string}`;
|
297
|
-
account: string;
|
298
336
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
337
|
+
account: string;
|
299
338
|
timestamp: number | null;
|
300
339
|
to: {
|
301
340
|
address: string;
|
package/dist/rpc.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rpc.d.cts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
1
|
+
{"version":3,"file":"rpc.d.cts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AA2BnD;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,YAAY,yBAAyB;IACrC,UAAU,uBAAuB;IACjC,aAAa,0BAA0B;IACvC,gBAAgB,6BAA6B;IAC7C,iBAAiB,8BAA8B;IAC/C,uBAAuB,oCAAoC;IAC3D,kBAAkB,+BAA+B;IACjD,qBAAqB,kCAAkC;IACvD,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;;;;;;;;;;;;;;;;;;;;;;;;;;GAA8B,CAAC;AAEtE,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAK5E,eAAO,MA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KxE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B;;;;;;;;;QAAwB,CAAC;AAEjE,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAK9E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;EAOtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAE9E,eAAO,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.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
|
+
DiscoverAccounts = "keyring_discoverAccounts",
|
9
10
|
ListAccountAssets = "keyring_listAccountAssets",
|
10
11
|
ListAccountTransactions = "keyring_listAccountTransactions",
|
11
12
|
GetAccountBalances = "keyring_getAccountBalances",
|
@@ -143,6 +144,44 @@ export declare const CreateAccountResponseStruct: import("@metamask/superstruct"
|
|
143
144
|
methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
144
145
|
}>;
|
145
146
|
export type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;
|
147
|
+
export declare const DiscoverAccountsRequestStruct: import("@metamask/superstruct").Struct<{
|
148
|
+
method: "keyring_discoverAccounts";
|
149
|
+
id: string | number | null;
|
150
|
+
jsonrpc: "2.0";
|
151
|
+
params: {
|
152
|
+
scopes: `${string}:${string}`[];
|
153
|
+
entropySource: string;
|
154
|
+
groupIndex: number;
|
155
|
+
};
|
156
|
+
}, {
|
157
|
+
method: import("@metamask/superstruct").Struct<"keyring_discoverAccounts", "keyring_discoverAccounts">;
|
158
|
+
params: import("@metamask/superstruct").Struct<{
|
159
|
+
scopes: `${string}:${string}`[];
|
160
|
+
entropySource: string;
|
161
|
+
groupIndex: number;
|
162
|
+
}, {
|
163
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
164
|
+
entropySource: import("@metamask/superstruct").Struct<string, null>;
|
165
|
+
groupIndex: import("@metamask/superstruct").Struct<number, null>;
|
166
|
+
}>;
|
167
|
+
jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
|
168
|
+
id: import("@metamask/superstruct").Struct<string | number | null, null>;
|
169
|
+
}>;
|
170
|
+
export type DiscoverAccountsRequest = Infer<typeof DiscoverAccountsRequestStruct>;
|
171
|
+
export declare const DiscoverAccountsResponseStruct: import("@metamask/superstruct").Struct<{
|
172
|
+
type: "bip44";
|
173
|
+
scopes: `${string}:${string}`[];
|
174
|
+
derivationPath: `m/${string}`;
|
175
|
+
}[], import("@metamask/superstruct").Struct<{
|
176
|
+
type: "bip44";
|
177
|
+
scopes: `${string}:${string}`[];
|
178
|
+
derivationPath: `m/${string}`;
|
179
|
+
}, {
|
180
|
+
type: import("@metamask/superstruct").Struct<"bip44", "bip44">;
|
181
|
+
scopes: import("@metamask/superstruct").Struct<`${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}`, null>>;
|
182
|
+
derivationPath: import("@metamask/superstruct").Struct<`m/${string}`, null>;
|
183
|
+
}>>;
|
184
|
+
export type DiscoverAccountsResponse = Infer<typeof DiscoverAccountsResponseStruct>;
|
146
185
|
export declare const ListAccountTransactionsRequestStruct: import("@metamask/superstruct").Struct<{
|
147
186
|
method: "keyring_listAccountTransactions";
|
148
187
|
id: string | number | null;
|
@@ -197,8 +236,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
197
236
|
timestamp: number | null;
|
198
237
|
}[];
|
199
238
|
chain: `${string}:${string}`;
|
200
|
-
account: string;
|
201
239
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
240
|
+
account: string;
|
202
241
|
timestamp: number | null;
|
203
242
|
to: {
|
204
243
|
address: string;
|
@@ -247,8 +286,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
247
286
|
timestamp: number | null;
|
248
287
|
}[];
|
249
288
|
chain: `${string}:${string}`;
|
250
|
-
account: string;
|
251
289
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
290
|
+
account: string;
|
252
291
|
timestamp: number | null;
|
253
292
|
to: {
|
254
293
|
address: string;
|
@@ -294,8 +333,8 @@ export declare const ListAccountTransactionsResponseStruct: import("@metamask/su
|
|
294
333
|
timestamp: number | null;
|
295
334
|
}[];
|
296
335
|
chain: `${string}:${string}`;
|
297
|
-
account: string;
|
298
336
|
status: "submitted" | "unconfirmed" | "confirmed" | "failed";
|
337
|
+
account: string;
|
299
338
|
timestamp: number | null;
|
300
339
|
to: {
|
301
340
|
address: string;
|