@metamask-previews/keyring-api 8.1.0-preview-829a643 → 8.1.0-preview-e65b905

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/JsonRpcRequest.d.ts +1 -1
  2. package/dist/JsonRpcRequest.js +3 -3
  3. package/dist/JsonRpcRequest.js.map +1 -1
  4. package/dist/KeyringClient.js +10 -10
  5. package/dist/KeyringClient.js.map +1 -1
  6. package/dist/api/account.d.ts +1 -1
  7. package/dist/api/account.js +3 -4
  8. package/dist/api/account.js.map +1 -1
  9. package/dist/api/balance.js +3 -4
  10. package/dist/api/balance.js.map +1 -1
  11. package/dist/api/caip.js +3 -3
  12. package/dist/api/caip.js.map +1 -1
  13. package/dist/api/request.d.ts +1 -1
  14. package/dist/api/request.js +6 -7
  15. package/dist/api/request.js.map +1 -1
  16. package/dist/api/response.js +6 -6
  17. package/dist/api/response.js.map +1 -1
  18. package/dist/btc/types.d.ts +1 -1
  19. package/dist/btc/types.js +2 -2
  20. package/dist/btc/types.js.map +1 -1
  21. package/dist/eth/erc4337/types.d.ts +5 -5
  22. package/dist/eth/erc4337/types.js +10 -11
  23. package/dist/eth/erc4337/types.js.map +1 -1
  24. package/dist/eth/types.d.ts +2 -2
  25. package/dist/eth/types.js +6 -6
  26. package/dist/eth/types.js.map +1 -1
  27. package/dist/index.d.ts +0 -1
  28. package/dist/index.js +0 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/internal/api.d.ts +10 -10
  31. package/dist/internal/api.js +32 -33
  32. package/dist/internal/api.js.map +1 -1
  33. package/dist/internal/events.d.ts +8 -8
  34. package/dist/internal/events.js +16 -17
  35. package/dist/internal/events.js.map +1 -1
  36. package/dist/internal/types.d.ts +19 -19
  37. package/dist/internal/types.js +9 -9
  38. package/dist/internal/types.js.map +1 -1
  39. package/package.json +2 -2
  40. package/dist/superstruct.d.ts +0 -83
  41. package/dist/superstruct.js +0 -81
  42. package/dist/superstruct.js.map +0 -1
  43. package/dist/utils/index.d.ts +0 -2
  44. package/dist/utils/index.js +0 -19
  45. package/dist/utils/index.js.map +0 -1
  46. package/dist/utils/types.d.ts +0 -17
  47. package/dist/utils/types.js +0 -29
  48. package/dist/utils/types.js.map +0 -1
  49. package/dist/utils/typing.d.ts +0 -32
  50. package/dist/utils/typing.js +0 -21
  51. package/dist/utils/typing.js.map +0 -1
package/dist/index.js CHANGED
@@ -24,5 +24,4 @@ __exportStar(require("./KeyringClient"), exports);
24
24
  __exportStar(require("./KeyringSnapRpcClient"), exports);
25
25
  __exportStar(require("./rpc-handler"), exports);
26
26
  __exportStar(require("./snap-utils"), exports);
27
- __exportStar(require("./superstruct"), exports);
28
27
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,wCAAsB;AACtB,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,6CAA2B;AAC3B,kDAAgC;AAChC,yDAAuC;AACvC,gDAA8B;AAC9B,+CAA6B;AAC7B,gDAA8B","sourcesContent":["export * from './api';\nexport * from './btc';\nexport * from './contexts';\nexport * from './eth';\nexport * from './events';\nexport * from './internal';\nexport * from './KeyringClient';\nexport * from './KeyringSnapRpcClient';\nexport * from './rpc-handler';\nexport * from './snap-utils';\nexport * from './superstruct';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,wCAAsB;AACtB,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,6CAA2B;AAC3B,kDAAgC;AAChC,yDAAuC;AACvC,gDAA8B;AAC9B,+CAA6B","sourcesContent":["export * from './api';\nexport * from './btc';\nexport * from './contexts';\nexport * from './eth';\nexport * from './events';\nexport * from './internal';\nexport * from './KeyringClient';\nexport * from './KeyringSnapRpcClient';\nexport * from './rpc-handler';\nexport * from './snap-utils';\n"]}
@@ -10,14 +10,14 @@ export declare const ListAccountsRequestStruct: import("@metamask/superstruct").
10
10
  }>;
11
11
  export declare type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;
12
12
  export declare const ListAccountsResponseStruct: import("@metamask/superstruct").Struct<{
13
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
14
13
  id: string;
14
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
15
15
  address: string;
16
16
  options: Record<string, import("@metamask/utils").Json>;
17
17
  methods: string[];
18
18
  }[], import("@metamask/superstruct").Struct<{
19
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
20
19
  id: string;
20
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
21
21
  address: string;
22
22
  options: Record<string, import("@metamask/utils").Json>;
23
23
  methods: string[];
@@ -52,8 +52,8 @@ export declare const GetAccountRequestStruct: import("@metamask/superstruct").St
52
52
  }>;
53
53
  export declare type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;
54
54
  export declare const GetAccountResponseStruct: import("@metamask/superstruct").Struct<{
55
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
56
55
  id: string;
56
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
57
57
  address: string;
58
58
  options: Record<string, import("@metamask/utils").Json>;
59
59
  methods: string[];
@@ -88,8 +88,8 @@ export declare const CreateAccountRequestStruct: import("@metamask/superstruct")
88
88
  }>;
89
89
  export declare type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;
90
90
  export declare const CreateAccountResponseStruct: import("@metamask/superstruct").Struct<{
91
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
92
91
  id: string;
92
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
93
93
  address: string;
94
94
  options: Record<string, import("@metamask/utils").Json>;
95
95
  methods: string[];
@@ -160,8 +160,8 @@ export declare const UpdateAccountRequestStruct: import("@metamask/superstruct")
160
160
  method: "keyring_updateAccount";
161
161
  params: {
162
162
  account: {
163
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
164
163
  id: string;
164
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
165
165
  address: string;
166
166
  options: Record<string, import("@metamask/utils").Json>;
167
167
  methods: string[];
@@ -171,16 +171,16 @@ export declare const UpdateAccountRequestStruct: import("@metamask/superstruct")
171
171
  method: import("@metamask/superstruct").Struct<"keyring_updateAccount", "keyring_updateAccount">;
172
172
  params: import("@metamask/superstruct").Struct<{
173
173
  account: {
174
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
175
174
  id: string;
175
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
176
176
  address: string;
177
177
  options: Record<string, import("@metamask/utils").Json>;
178
178
  methods: string[];
179
179
  };
180
180
  }, {
181
181
  account: import("@metamask/superstruct").Struct<{
182
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
183
182
  id: string;
183
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
184
184
  address: string;
185
185
  options: Record<string, import("@metamask/utils").Json>;
186
186
  methods: string[];
@@ -277,7 +277,7 @@ export declare const ListRequestsResponseStruct: import("@metamask/superstruct")
277
277
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
278
278
  }, {
279
279
  method: import("@metamask/superstruct").Struct<string, null>;
280
- params: import("@metamask/superstruct").Struct<import("../superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
280
+ params: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
281
281
  }>;
282
282
  }>>;
283
283
  export declare type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;
@@ -316,7 +316,7 @@ export declare const GetRequestResponseStruct: import("@metamask/superstruct").S
316
316
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
317
317
  }, {
318
318
  method: import("@metamask/superstruct").Struct<string, null>;
319
- params: import("@metamask/superstruct").Struct<import("../superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
319
+ params: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
320
320
  }>;
321
321
  }>;
322
322
  export declare type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;
@@ -352,7 +352,7 @@ export declare const SubmitRequestRequestStruct: import("@metamask/superstruct")
352
352
  params?: import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>;
353
353
  }, {
354
354
  method: import("@metamask/superstruct").Struct<string, null>;
355
- params: import("@metamask/superstruct").Struct<import("../superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
355
+ params: import("@metamask/superstruct").Struct<import("@metamask/keyring-utils").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
356
356
  }>;
357
357
  }>;
358
358
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
@@ -4,8 +4,7 @@ exports.RejectRequestResponseStruct = exports.RejectRequestRequestStruct = expor
4
4
  const superstruct_1 = require("@metamask/superstruct");
5
5
  const utils_1 = require("@metamask/utils");
6
6
  const api_1 = require("../api");
7
- const superstruct_2 = require("../superstruct");
8
- const utils_2 = require("../utils");
7
+ const keyring_utils_1 = require("@metamask/keyring-utils");
9
8
  const rpc_1 = require("./rpc");
10
9
  const CommonHeader = {
11
10
  jsonrpc: (0, superstruct_1.literal)('2.0'),
@@ -13,103 +12,103 @@ const CommonHeader = {
13
12
  };
14
13
  // ----------------------------------------------------------------------------
15
14
  // List accounts
16
- exports.ListAccountsRequestStruct = (0, superstruct_2.object)({
15
+ exports.ListAccountsRequestStruct = (0, keyring_utils_1.object)({
17
16
  ...CommonHeader,
18
17
  method: (0, superstruct_1.literal)('keyring_listAccounts'),
19
18
  });
20
19
  exports.ListAccountsResponseStruct = (0, superstruct_1.array)(api_1.KeyringAccountStruct);
21
20
  // ----------------------------------------------------------------------------
22
21
  // Get account
23
- exports.GetAccountRequestStruct = (0, superstruct_2.object)({
22
+ exports.GetAccountRequestStruct = (0, keyring_utils_1.object)({
24
23
  ...CommonHeader,
25
24
  method: (0, superstruct_1.literal)('keyring_getAccount'),
26
- params: (0, superstruct_2.object)({
27
- id: utils_2.UuidStruct,
25
+ params: (0, keyring_utils_1.object)({
26
+ id: keyring_utils_1.UuidStruct,
28
27
  }),
29
28
  });
30
29
  exports.GetAccountResponseStruct = api_1.KeyringAccountStruct;
31
30
  // ----------------------------------------------------------------------------
32
31
  // Create account
33
- exports.CreateAccountRequestStruct = (0, superstruct_2.object)({
32
+ exports.CreateAccountRequestStruct = (0, keyring_utils_1.object)({
34
33
  ...CommonHeader,
35
34
  method: (0, superstruct_1.literal)('keyring_createAccount'),
36
- params: (0, superstruct_2.object)({
35
+ params: (0, keyring_utils_1.object)({
37
36
  options: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
38
37
  }),
39
38
  });
40
39
  exports.CreateAccountResponseStruct = api_1.KeyringAccountStruct;
41
40
  // ----------------------------------------------------------------------------
42
41
  // Get account balances
43
- exports.GetAccountBalancesRequestStruct = (0, superstruct_2.object)({
42
+ exports.GetAccountBalancesRequestStruct = (0, keyring_utils_1.object)({
44
43
  ...CommonHeader,
45
44
  method: (0, superstruct_1.literal)(`${rpc_1.KeyringRpcMethod.GetAccountBalances}`),
46
- params: (0, superstruct_2.object)({
47
- id: utils_2.UuidStruct,
45
+ params: (0, keyring_utils_1.object)({
46
+ id: keyring_utils_1.UuidStruct,
48
47
  assets: (0, superstruct_1.array)(api_1.CaipAssetTypeStruct),
49
48
  }),
50
49
  });
51
50
  exports.GetAccountBalancesResponseStruct = (0, superstruct_1.record)(api_1.CaipAssetTypeStruct, api_1.BalanceStruct);
52
51
  // ----------------------------------------------------------------------------
53
52
  // Filter account chains
54
- exports.FilterAccountChainsStruct = (0, superstruct_2.object)({
53
+ exports.FilterAccountChainsStruct = (0, keyring_utils_1.object)({
55
54
  ...CommonHeader,
56
55
  method: (0, superstruct_1.literal)('keyring_filterAccountChains'),
57
- params: (0, superstruct_2.object)({
58
- id: utils_2.UuidStruct,
56
+ params: (0, keyring_utils_1.object)({
57
+ id: keyring_utils_1.UuidStruct,
59
58
  chains: (0, superstruct_1.array)((0, superstruct_1.string)()),
60
59
  }),
61
60
  });
62
61
  exports.FilterAccountChainsResponseStruct = (0, superstruct_1.array)((0, superstruct_1.string)());
63
62
  // ----------------------------------------------------------------------------
64
63
  // Update account
65
- exports.UpdateAccountRequestStruct = (0, superstruct_2.object)({
64
+ exports.UpdateAccountRequestStruct = (0, keyring_utils_1.object)({
66
65
  ...CommonHeader,
67
66
  method: (0, superstruct_1.literal)('keyring_updateAccount'),
68
- params: (0, superstruct_2.object)({
67
+ params: (0, keyring_utils_1.object)({
69
68
  account: api_1.KeyringAccountStruct,
70
69
  }),
71
70
  });
72
71
  exports.UpdateAccountResponseStruct = (0, superstruct_1.literal)(null);
73
72
  // ----------------------------------------------------------------------------
74
73
  // Delete account
75
- exports.DeleteAccountRequestStruct = (0, superstruct_2.object)({
74
+ exports.DeleteAccountRequestStruct = (0, keyring_utils_1.object)({
76
75
  ...CommonHeader,
77
76
  method: (0, superstruct_1.literal)('keyring_deleteAccount'),
78
- params: (0, superstruct_2.object)({
79
- id: utils_2.UuidStruct,
77
+ params: (0, keyring_utils_1.object)({
78
+ id: keyring_utils_1.UuidStruct,
80
79
  }),
81
80
  });
82
81
  exports.DeleteAccountResponseStruct = (0, superstruct_1.literal)(null);
83
82
  // ----------------------------------------------------------------------------
84
83
  // Export account
85
- exports.ExportAccountRequestStruct = (0, superstruct_2.object)({
84
+ exports.ExportAccountRequestStruct = (0, keyring_utils_1.object)({
86
85
  ...CommonHeader,
87
86
  method: (0, superstruct_1.literal)('keyring_exportAccount'),
88
- params: (0, superstruct_2.object)({
89
- id: utils_2.UuidStruct,
87
+ params: (0, keyring_utils_1.object)({
88
+ id: keyring_utils_1.UuidStruct,
90
89
  }),
91
90
  });
92
91
  exports.ExportAccountResponseStruct = api_1.KeyringAccountDataStruct;
93
92
  // ----------------------------------------------------------------------------
94
93
  // List requests
95
- exports.ListRequestsRequestStruct = (0, superstruct_2.object)({
94
+ exports.ListRequestsRequestStruct = (0, keyring_utils_1.object)({
96
95
  ...CommonHeader,
97
96
  method: (0, superstruct_1.literal)('keyring_listRequests'),
98
97
  });
99
98
  exports.ListRequestsResponseStruct = (0, superstruct_1.array)(api_1.KeyringRequestStruct);
100
99
  // ----------------------------------------------------------------------------
101
100
  // Get request
102
- exports.GetRequestRequestStruct = (0, superstruct_2.object)({
101
+ exports.GetRequestRequestStruct = (0, keyring_utils_1.object)({
103
102
  ...CommonHeader,
104
103
  method: (0, superstruct_1.literal)('keyring_getRequest'),
105
- params: (0, superstruct_2.object)({
106
- id: utils_2.UuidStruct,
104
+ params: (0, keyring_utils_1.object)({
105
+ id: keyring_utils_1.UuidStruct,
107
106
  }),
108
107
  });
109
108
  exports.GetRequestResponseStruct = api_1.KeyringRequestStruct;
110
109
  // ----------------------------------------------------------------------------
111
110
  // Submit request
112
- exports.SubmitRequestRequestStruct = (0, superstruct_2.object)({
111
+ exports.SubmitRequestRequestStruct = (0, keyring_utils_1.object)({
113
112
  ...CommonHeader,
114
113
  method: (0, superstruct_1.literal)('keyring_submitRequest'),
115
114
  params: api_1.KeyringRequestStruct,
@@ -117,22 +116,22 @@ exports.SubmitRequestRequestStruct = (0, superstruct_2.object)({
117
116
  exports.SubmitRequestResponseStruct = api_1.KeyringResponseStruct;
118
117
  // ----------------------------------------------------------------------------
119
118
  // Approve request
120
- exports.ApproveRequestRequestStruct = (0, superstruct_2.object)({
119
+ exports.ApproveRequestRequestStruct = (0, keyring_utils_1.object)({
121
120
  ...CommonHeader,
122
121
  method: (0, superstruct_1.literal)('keyring_approveRequest'),
123
- params: (0, superstruct_2.object)({
124
- id: utils_2.UuidStruct,
122
+ params: (0, keyring_utils_1.object)({
123
+ id: keyring_utils_1.UuidStruct,
125
124
  data: (0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct),
126
125
  }),
127
126
  });
128
127
  exports.ApproveRequestResponseStruct = (0, superstruct_1.literal)(null);
129
128
  // ----------------------------------------------------------------------------
130
129
  // Reject request
131
- exports.RejectRequestRequestStruct = (0, superstruct_2.object)({
130
+ exports.RejectRequestRequestStruct = (0, keyring_utils_1.object)({
132
131
  ...CommonHeader,
133
132
  method: (0, superstruct_1.literal)('keyring_rejectRequest'),
134
- params: (0, superstruct_2.object)({
135
- id: utils_2.UuidStruct,
133
+ params: (0, keyring_utils_1.object)({
134
+ id: keyring_utils_1.UuidStruct,
136
135
  }),
137
136
  });
138
137
  exports.RejectRequestResponseStruct = (0, superstruct_1.literal)(null);
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/internal/api.ts"],"names":[],"mappings":";;;AACA,uDAO+B;AAC/B,2CAA6C;AAE7C,gCAOgB;AAChB,gDAAwC;AACxC,oCAAsC;AACtC,+BAAyC;AAEzC,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,IAAA,qBAAO,EAAC,KAAK,CAAC;IACvB,EAAE,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,EAAE,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,+EAA+E;AAC/E,gBAAgB;AAEH,QAAA,yBAAyB,GAAG,IAAA,oBAAM,EAAC;IAC9C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,sBAAsB,CAAC;CACx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A2B,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n} from '../api';\nimport { object } from '../superstruct';\nimport { UuidStruct } from '../utils';\nimport { KeyringRpcMethod } from './rpc';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// List accounts\n\nexport const ListAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccounts'),\n});\n\nexport type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;\n\nexport const ListAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create account\n\nexport const CreateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_createAccount'),\n params: object({\n options: record(string(), JsonStruct),\n }),\n});\n\nexport type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;\n\nexport const CreateAccountResponseStruct = KeyringAccountStruct;\n\nexport type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\n chains: array(string()),\n }),\n});\n\nexport type FilterAccountChainsRequest = Infer<\n typeof FilterAccountChainsStruct\n>;\n\nexport const FilterAccountChainsResponseStruct = array(string());\n\nexport type FilterAccountChainsResponse = Infer<\n typeof FilterAccountChainsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Update account\n\nexport const UpdateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_updateAccount'),\n params: object({\n account: KeyringAccountStruct,\n }),\n});\n\nexport type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;\n\nexport const UpdateAccountResponseStruct = literal(null);\n\nexport type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_deleteAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_exportAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = KeyringAccountDataStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List requests\n\nexport const ListRequestsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listRequests'),\n});\n\nexport type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;\n\nexport const ListRequestsResponseStruct = array(KeyringRequestStruct);\n\nexport type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get request\n\nexport const GetRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;\n\nexport const GetRequestResponseStruct = KeyringRequestStruct;\n\nexport type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_submitRequest'),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = KeyringResponseStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Approve request\n\nexport const ApproveRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_approveRequest'),\n params: object({\n id: UuidStruct,\n data: record(string(), JsonStruct),\n }),\n});\n\nexport type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;\n\nexport const ApproveRequestResponseStruct = literal(null);\n\nexport type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Reject request\n\nexport const RejectRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_rejectRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/internal/api.ts"],"names":[],"mappings":";;;AACA,uDAO+B;AAC/B,2CAA6C;AAE7C,gCAOgB;AAChB,2DAA6D;AAC7D,+BAAyC;AAEzC,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,CAAC,CAAC;AAIU,QAAA,0BAA0B,GAAG,IAAA,mBAAK,EAAC,0BAAoB,CAAC,CAAC;AAItE,+EAA+E;AAC/E,cAAc;AAED,QAAA,uBAAuB,GAAG,IAAA,sBAAM,EAAC;IAC5C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACrC,MAAM,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,IAAA,sBAAM,EAAC;QACb,OAAO,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,kBAAU,CAAC;KACtC,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,2BAA2B,G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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 type { Infer } from '@metamask/superstruct';\nimport {\n array,\n literal,\n number,\n record,\n string,\n union,\n} from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n} from '../api';\nimport { object, UuidStruct } from '@metamask/keyring-utils';\nimport { KeyringRpcMethod } from './rpc';\n\nconst CommonHeader = {\n jsonrpc: literal('2.0'),\n id: union([string(), number(), literal(null)]),\n};\n\n// ----------------------------------------------------------------------------\n// List accounts\n\nexport const ListAccountsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listAccounts'),\n});\n\nexport type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;\n\nexport const ListAccountsResponseStruct = array(KeyringAccountStruct);\n\nexport type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account\n\nexport const GetAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;\n\nexport const GetAccountResponseStruct = KeyringAccountStruct;\n\nexport type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Create account\n\nexport const CreateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_createAccount'),\n params: object({\n options: record(string(), JsonStruct),\n }),\n});\n\nexport type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;\n\nexport const CreateAccountResponseStruct = KeyringAccountStruct;\n\nexport type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get account balances\n\nexport const GetAccountBalancesRequestStruct = object({\n ...CommonHeader,\n method: literal(`${KeyringRpcMethod.GetAccountBalances}`),\n params: object({\n id: UuidStruct,\n assets: array(CaipAssetTypeStruct),\n }),\n});\n\nexport type GetAccountBalancesRequest = Infer<\n typeof GetAccountBalancesRequestStruct\n>;\n\nexport const GetAccountBalancesResponseStruct = record(\n CaipAssetTypeStruct,\n BalanceStruct,\n);\n\nexport type GetAccountBalancesResponse = Infer<\n typeof GetAccountBalancesResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Filter account chains\n\nexport const FilterAccountChainsStruct = object({\n ...CommonHeader,\n method: literal('keyring_filterAccountChains'),\n params: object({\n id: UuidStruct,\n chains: array(string()),\n }),\n});\n\nexport type FilterAccountChainsRequest = Infer<\n typeof FilterAccountChainsStruct\n>;\n\nexport const FilterAccountChainsResponseStruct = array(string());\n\nexport type FilterAccountChainsResponse = Infer<\n typeof FilterAccountChainsResponseStruct\n>;\n\n// ----------------------------------------------------------------------------\n// Update account\n\nexport const UpdateAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_updateAccount'),\n params: object({\n account: KeyringAccountStruct,\n }),\n});\n\nexport type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;\n\nexport const UpdateAccountResponseStruct = literal(null);\n\nexport type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Delete account\n\nexport const DeleteAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_deleteAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;\n\nexport const DeleteAccountResponseStruct = literal(null);\n\nexport type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Export account\n\nexport const ExportAccountRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_exportAccount'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;\n\nexport const ExportAccountResponseStruct = KeyringAccountDataStruct;\n\nexport type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// List requests\n\nexport const ListRequestsRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_listRequests'),\n});\n\nexport type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;\n\nexport const ListRequestsResponseStruct = array(KeyringRequestStruct);\n\nexport type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Get request\n\nexport const GetRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_getRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;\n\nexport const GetRequestResponseStruct = KeyringRequestStruct;\n\nexport type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Submit request\n\nexport const SubmitRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_submitRequest'),\n params: KeyringRequestStruct,\n});\n\nexport type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;\n\nexport const SubmitRequestResponseStruct = KeyringResponseStruct;\n\nexport type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Approve request\n\nexport const ApproveRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_approveRequest'),\n params: object({\n id: UuidStruct,\n data: record(string(), JsonStruct),\n }),\n});\n\nexport type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;\n\nexport const ApproveRequestResponseStruct = literal(null);\n\nexport type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;\n\n// ----------------------------------------------------------------------------\n// Reject request\n\nexport const RejectRequestRequestStruct = object({\n ...CommonHeader,\n method: literal('keyring_rejectRequest'),\n params: object({\n id: UuidStruct,\n }),\n});\n\nexport type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;\n\nexport const RejectRequestResponseStruct = literal(null);\n\nexport type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;\n"]}
@@ -2,8 +2,8 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
2
2
  method: "notify:accountCreated";
3
3
  params: {
4
4
  account: {
5
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
6
5
  id: string;
6
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
7
7
  address: string;
8
8
  options: Record<string, import("@metamask/utils").Json>;
9
9
  methods: string[];
@@ -15,8 +15,8 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
15
15
  method: import("@metamask/superstruct").Struct<"notify:accountCreated", "notify:accountCreated">;
16
16
  params: import("@metamask/superstruct").Struct<{
17
17
  account: {
18
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
19
18
  id: string;
19
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
20
20
  address: string;
21
21
  options: Record<string, import("@metamask/utils").Json>;
22
22
  methods: string[];
@@ -28,8 +28,8 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
28
28
  * New account object.
29
29
  */
30
30
  account: import("@metamask/superstruct").Struct<{
31
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
32
31
  id: string;
32
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
33
33
  address: string;
34
34
  options: Record<string, import("@metamask/utils").Json>;
35
35
  methods: string[];
@@ -51,20 +51,20 @@ export declare const AccountCreatedEventStruct: import("@metamask/superstruct").
51
51
  * client to decide whether to use it. The keyring won't be informed if the
52
52
  * client decides to use a different name.
53
53
  */
54
- accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("../superstruct").ExactOptionalTag, null>;
54
+ accountNameSuggestion: import("@metamask/superstruct").Struct<string | import("@metamask/keyring-utils").ExactOptionalTag, null>;
55
55
  /**
56
56
  * Instructs MetaMask to display the add account confirmation dialog in the UI.
57
57
  * **Note:** This is not guaranteed to be honored by the MetaMask client.
58
58
  */
59
- displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("../superstruct").ExactOptionalTag, null>;
59
+ displayConfirmation: import("@metamask/superstruct").Struct<boolean | import("@metamask/keyring-utils").ExactOptionalTag, null>;
60
60
  }>;
61
61
  }>;
62
62
  export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").Struct<{
63
63
  method: "notify:accountUpdated";
64
64
  params: {
65
65
  account: {
66
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
67
66
  id: string;
67
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
68
68
  address: string;
69
69
  options: Record<string, import("@metamask/utils").Json>;
70
70
  methods: string[];
@@ -74,8 +74,8 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
74
74
  method: import("@metamask/superstruct").Struct<"notify:accountUpdated", "notify:accountUpdated">;
75
75
  params: import("@metamask/superstruct").Struct<{
76
76
  account: {
77
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
78
77
  id: string;
78
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
79
79
  address: string;
80
80
  options: Record<string, import("@metamask/utils").Json>;
81
81
  methods: string[];
@@ -85,8 +85,8 @@ export declare const AccountUpdatedEventStruct: import("@metamask/superstruct").
85
85
  * Updated account object.
86
86
  */
87
87
  account: import("@metamask/superstruct").Struct<{
88
- type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
89
88
  id: string;
89
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
90
90
  address: string;
91
91
  options: Record<string, import("@metamask/utils").Json>;
92
92
  methods: string[];
@@ -5,11 +5,10 @@ const superstruct_1 = require("@metamask/superstruct");
5
5
  const utils_1 = require("@metamask/utils");
6
6
  const api_1 = require("../api");
7
7
  const events_1 = require("../events");
8
- const superstruct_2 = require("../superstruct");
9
- const utils_2 = require("../utils");
10
- exports.AccountCreatedEventStruct = (0, superstruct_2.object)({
8
+ const keyring_utils_1 = require("@metamask/keyring-utils");
9
+ exports.AccountCreatedEventStruct = (0, keyring_utils_1.object)({
11
10
  method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountCreated}`),
12
- params: (0, superstruct_2.object)({
11
+ params: (0, keyring_utils_1.object)({
13
12
  /**
14
13
  * New account object.
15
14
  */
@@ -21,52 +20,52 @@ exports.AccountCreatedEventStruct = (0, superstruct_2.object)({
21
20
  * client to decide whether to use it. The keyring won't be informed if the
22
21
  * client decides to use a different name.
23
22
  */
24
- accountNameSuggestion: (0, superstruct_2.exactOptional)((0, superstruct_1.string)()),
23
+ accountNameSuggestion: (0, keyring_utils_1.exactOptional)((0, superstruct_1.string)()),
25
24
  /**
26
25
  * Instructs MetaMask to display the add account confirmation dialog in the UI.
27
26
  * **Note:** This is not guaranteed to be honored by the MetaMask client.
28
27
  */
29
- displayConfirmation: (0, superstruct_2.exactOptional)((0, superstruct_1.boolean)()),
28
+ displayConfirmation: (0, keyring_utils_1.exactOptional)((0, superstruct_1.boolean)()),
30
29
  }),
31
30
  });
32
- exports.AccountUpdatedEventStruct = (0, superstruct_2.object)({
31
+ exports.AccountUpdatedEventStruct = (0, keyring_utils_1.object)({
33
32
  method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountUpdated}`),
34
- params: (0, superstruct_2.object)({
33
+ params: (0, keyring_utils_1.object)({
35
34
  /**
36
35
  * Updated account object.
37
36
  */
38
37
  account: api_1.KeyringAccountStruct,
39
38
  }),
40
39
  });
41
- exports.AccountDeletedEventStruct = (0, superstruct_2.object)({
40
+ exports.AccountDeletedEventStruct = (0, keyring_utils_1.object)({
42
41
  method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.AccountDeleted}`),
43
- params: (0, superstruct_2.object)({
42
+ params: (0, keyring_utils_1.object)({
44
43
  /**
45
44
  * Deleted account ID.
46
45
  */
47
- id: utils_2.UuidStruct,
46
+ id: keyring_utils_1.UuidStruct,
48
47
  }),
49
48
  });
50
- exports.RequestApprovedEventStruct = (0, superstruct_2.object)({
49
+ exports.RequestApprovedEventStruct = (0, keyring_utils_1.object)({
51
50
  method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.RequestApproved}`),
52
- params: (0, superstruct_2.object)({
51
+ params: (0, keyring_utils_1.object)({
53
52
  /**
54
53
  * Request ID.
55
54
  */
56
- id: utils_2.UuidStruct,
55
+ id: keyring_utils_1.UuidStruct,
57
56
  /**
58
57
  * Request result.
59
58
  */
60
59
  result: utils_1.JsonStruct,
61
60
  }),
62
61
  });
63
- exports.RequestRejectedEventStruct = (0, superstruct_2.object)({
62
+ exports.RequestRejectedEventStruct = (0, keyring_utils_1.object)({
64
63
  method: (0, superstruct_1.literal)(`${events_1.KeyringEvent.RequestRejected}`),
65
- params: (0, superstruct_2.object)({
64
+ params: (0, keyring_utils_1.object)({
66
65
  /**
67
66
  * Request ID.
68
67
  */
69
- id: utils_2.UuidStruct,
68
+ id: keyring_utils_1.UuidStruct,
70
69
  }),
71
70
  });
72
71
  //# sourceMappingURL=events.js.map
@@ -1 +1 @@
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,CAAC;CACH,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { boolean, literal, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../api';\nimport { KeyringEvent } from '../events';\nimport { exactOptional, object } from '../superstruct';\nimport { UuidStruct } from '../utils';\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\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"]}
1
+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,CAAC;AAEU,QAAA,0BAA0B,GAAG,IAAA,sBAAM,EAAC;IAC/C,MAAM,EAAE,IAAA,qBAAO,EAAC,GAAG,qBAAY,CAAC,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,IAAA,sBAAM,EAAC;QACb;;WAEG;QACH,EAAE,EAAE,0BAAU;KACf,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { boolean, literal, string } from '@metamask/superstruct';\nimport { JsonStruct } from '@metamask/utils';\n\nimport { KeyringAccountStruct } from '../api';\nimport { KeyringEvent } from '../events';\nimport { exactOptional, object, UuidStruct } from '@metamask/keyring-utils';\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\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"]}