@metamask/keyring-api 8.1.3 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/LICENSE +18 -0
  3. package/dist/JsonRpcRequest.d.ts +1 -1
  4. package/dist/KeyringClient.d.ts +1 -1
  5. package/dist/KeyringClient.js.map +1 -1
  6. package/dist/KeyringSnapRpcClient.js.map +1 -1
  7. package/dist/api/account.d.ts +2 -2
  8. package/dist/api/account.js +2 -2
  9. package/dist/api/account.js.map +1 -1
  10. package/dist/api/balance.d.ts +1 -1
  11. package/dist/api/caip.d.ts +2 -2
  12. package/dist/api/export.d.ts +1 -1
  13. package/dist/api/index.d.ts +1 -1
  14. package/dist/api/index.js +0 -1
  15. package/dist/api/index.js.map +1 -1
  16. package/dist/api/keyring.d.ts +1 -1
  17. package/dist/api/request.d.ts +1 -1
  18. package/dist/api/response.d.ts +1 -1
  19. package/dist/btc/types.d.ts +5 -5
  20. package/dist/btc/types.js +3 -3
  21. package/dist/btc/types.js.map +1 -1
  22. package/dist/contexts.d.ts +1 -1
  23. package/dist/eth/erc4337/types.d.ts +5 -4
  24. package/dist/eth/erc4337/types.js +1 -0
  25. package/dist/eth/erc4337/types.js.map +1 -1
  26. package/dist/eth/types.d.ts +2 -2
  27. package/dist/eth/types.js +1 -1
  28. package/dist/eth/types.js.map +1 -1
  29. package/dist/events.js +1 -1
  30. package/dist/events.js.map +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.js +0 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/internal/api.d.ts +26 -26
  35. package/dist/internal/api.js +1 -1
  36. package/dist/internal/api.js.map +1 -1
  37. package/dist/internal/eth/EthKeyring.d.ts +1 -1
  38. package/dist/internal/eth/index.d.ts +1 -1
  39. package/dist/internal/eth/index.js +0 -15
  40. package/dist/internal/eth/index.js.map +1 -1
  41. package/dist/internal/index.d.ts +1 -1
  42. package/dist/internal/index.js +0 -1
  43. package/dist/internal/index.js.map +1 -1
  44. package/dist/internal/rpc.js +1 -1
  45. package/dist/internal/rpc.js.map +1 -1
  46. package/dist/internal/types.d.ts +40 -43
  47. package/dist/internal/types.js +12 -15
  48. package/dist/internal/types.js.map +1 -1
  49. package/dist/rpc-handler.js +13 -13
  50. package/dist/rpc-handler.js.map +1 -1
  51. package/dist/superstruct.d.ts +4 -4
  52. package/dist/superstruct.js.map +1 -1
  53. package/dist/utils/types.d.ts +1 -1
  54. package/dist/utils/types.js +1 -1
  55. package/dist/utils/types.js.map +1 -1
  56. package/dist/utils/typing.d.ts +2 -2
  57. package/package.json +9 -8
@@ -8,7 +8,7 @@ export declare const ListAccountsRequestStruct: import("@metamask/superstruct").
8
8
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
9
9
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
10
10
  }>;
11
- export declare type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;
11
+ export type ListAccountsRequest = Infer<typeof ListAccountsRequestStruct>;
12
12
  export declare const ListAccountsResponseStruct: import("@metamask/superstruct").Struct<{
13
13
  type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
14
14
  id: string;
@@ -32,7 +32,7 @@ export declare const ListAccountsResponseStruct: import("@metamask/superstruct")
32
32
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
33
33
  methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
34
34
  }>>;
35
- export declare type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;
35
+ export type ListAccountsResponse = Infer<typeof ListAccountsResponseStruct>;
36
36
  export declare const GetAccountRequestStruct: import("@metamask/superstruct").Struct<{
37
37
  jsonrpc: "2.0";
38
38
  id: string | number | null;
@@ -50,7 +50,7 @@ export declare const GetAccountRequestStruct: import("@metamask/superstruct").St
50
50
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
51
51
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
52
52
  }>;
53
- export declare type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;
53
+ export type GetAccountRequest = Infer<typeof GetAccountRequestStruct>;
54
54
  export declare const GetAccountResponseStruct: import("@metamask/superstruct").Struct<{
55
55
  type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
56
56
  id: string;
@@ -68,7 +68,7 @@ export declare const GetAccountResponseStruct: import("@metamask/superstruct").S
68
68
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
69
69
  methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
70
70
  }>;
71
- export declare type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;
71
+ export type GetAccountResponse = Infer<typeof GetAccountResponseStruct>;
72
72
  export declare const CreateAccountRequestStruct: import("@metamask/superstruct").Struct<{
73
73
  jsonrpc: "2.0";
74
74
  id: string | number | null;
@@ -86,7 +86,7 @@ export declare const CreateAccountRequestStruct: import("@metamask/superstruct")
86
86
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
87
87
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
88
88
  }>;
89
- export declare type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;
89
+ export type CreateAccountRequest = Infer<typeof CreateAccountRequestStruct>;
90
90
  export declare const CreateAccountResponseStruct: import("@metamask/superstruct").Struct<{
91
91
  type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
92
92
  id: string;
@@ -104,7 +104,7 @@ export declare const CreateAccountResponseStruct: import("@metamask/superstruct"
104
104
  options: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
105
105
  methods: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
106
106
  }>;
107
- export declare type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;
107
+ export type CreateAccountResponse = Infer<typeof CreateAccountResponseStruct>;
108
108
  export declare const GetAccountBalancesRequestStruct: import("@metamask/superstruct").Struct<{
109
109
  jsonrpc: "2.0";
110
110
  id: string | number | null;
@@ -125,12 +125,12 @@ export declare const GetAccountBalancesRequestStruct: import("@metamask/superstr
125
125
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
126
126
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
127
127
  }>;
128
- export declare type GetAccountBalancesRequest = Infer<typeof GetAccountBalancesRequestStruct>;
128
+ export type GetAccountBalancesRequest = Infer<typeof GetAccountBalancesRequestStruct>;
129
129
  export declare const GetAccountBalancesResponseStruct: import("@metamask/superstruct").Struct<Record<string, {
130
130
  amount: string;
131
131
  unit: string;
132
132
  }>, null>;
133
- export declare type GetAccountBalancesResponse = Infer<typeof GetAccountBalancesResponseStruct>;
133
+ export type GetAccountBalancesResponse = Infer<typeof GetAccountBalancesResponseStruct>;
134
134
  export declare const FilterAccountChainsStruct: import("@metamask/superstruct").Struct<{
135
135
  jsonrpc: "2.0";
136
136
  id: string | number | null;
@@ -151,9 +151,9 @@ export declare const FilterAccountChainsStruct: import("@metamask/superstruct").
151
151
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
152
152
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
153
153
  }>;
154
- export declare type FilterAccountChainsRequest = Infer<typeof FilterAccountChainsStruct>;
154
+ export type FilterAccountChainsRequest = Infer<typeof FilterAccountChainsStruct>;
155
155
  export declare const FilterAccountChainsResponseStruct: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
156
- export declare type FilterAccountChainsResponse = Infer<typeof FilterAccountChainsResponseStruct>;
156
+ export type FilterAccountChainsResponse = Infer<typeof FilterAccountChainsResponseStruct>;
157
157
  export declare const UpdateAccountRequestStruct: import("@metamask/superstruct").Struct<{
158
158
  jsonrpc: "2.0";
159
159
  id: string | number | null;
@@ -199,9 +199,9 @@ export declare const UpdateAccountRequestStruct: import("@metamask/superstruct")
199
199
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
200
200
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
201
201
  }>;
202
- export declare type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;
202
+ export type UpdateAccountRequest = Infer<typeof UpdateAccountRequestStruct>;
203
203
  export declare const UpdateAccountResponseStruct: import("@metamask/superstruct").Struct<null, null>;
204
- export declare type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;
204
+ export type UpdateAccountResponse = Infer<typeof UpdateAccountResponseStruct>;
205
205
  export declare const DeleteAccountRequestStruct: import("@metamask/superstruct").Struct<{
206
206
  jsonrpc: "2.0";
207
207
  id: string | number | null;
@@ -219,9 +219,9 @@ export declare const DeleteAccountRequestStruct: import("@metamask/superstruct")
219
219
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
220
220
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
221
221
  }>;
222
- export declare type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;
222
+ export type DeleteAccountRequest = Infer<typeof DeleteAccountRequestStruct>;
223
223
  export declare const DeleteAccountResponseStruct: import("@metamask/superstruct").Struct<null, null>;
224
- export declare type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;
224
+ export type DeleteAccountResponse = Infer<typeof DeleteAccountResponseStruct>;
225
225
  export declare const ExportAccountRequestStruct: import("@metamask/superstruct").Struct<{
226
226
  jsonrpc: "2.0";
227
227
  id: string | number | null;
@@ -239,9 +239,9 @@ export declare const ExportAccountRequestStruct: import("@metamask/superstruct")
239
239
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
240
240
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
241
241
  }>;
242
- export declare type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;
242
+ export type ExportAccountRequest = Infer<typeof ExportAccountRequestStruct>;
243
243
  export declare const ExportAccountResponseStruct: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
244
- export declare type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;
244
+ export type ExportAccountResponse = Infer<typeof ExportAccountResponseStruct>;
245
245
  export declare const ListRequestsRequestStruct: import("@metamask/superstruct").Struct<{
246
246
  jsonrpc: "2.0";
247
247
  id: string | number | null;
@@ -251,7 +251,7 @@ export declare const ListRequestsRequestStruct: import("@metamask/superstruct").
251
251
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
252
252
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
253
253
  }>;
254
- export declare type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;
254
+ export type ListRequestsRequest = Infer<typeof ListRequestsRequestStruct>;
255
255
  export declare const ListRequestsResponseStruct: import("@metamask/superstruct").Struct<{
256
256
  id: string;
257
257
  scope: string;
@@ -280,7 +280,7 @@ export declare const ListRequestsResponseStruct: import("@metamask/superstruct")
280
280
  params: import("@metamask/superstruct").Struct<import("../superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
281
281
  }>;
282
282
  }>>;
283
- export declare type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;
283
+ export type ListRequestsResponse = Infer<typeof ListRequestsResponseStruct>;
284
284
  export declare const GetRequestRequestStruct: import("@metamask/superstruct").Struct<{
285
285
  jsonrpc: "2.0";
286
286
  id: string | number | null;
@@ -298,7 +298,7 @@ export declare const GetRequestRequestStruct: import("@metamask/superstruct").St
298
298
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
299
299
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
300
300
  }>;
301
- export declare type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;
301
+ export type GetRequestRequest = Infer<typeof GetRequestRequestStruct>;
302
302
  export declare const GetRequestResponseStruct: import("@metamask/superstruct").Struct<{
303
303
  id: string;
304
304
  scope: string;
@@ -319,7 +319,7 @@ export declare const GetRequestResponseStruct: import("@metamask/superstruct").S
319
319
  params: import("@metamask/superstruct").Struct<import("../superstruct").ExactOptionalTag | import("@metamask/utils").Json[] | Record<string, import("@metamask/utils").Json>, null>;
320
320
  }>;
321
321
  }>;
322
- export declare type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;
322
+ export type GetRequestResponse = Infer<typeof GetRequestResponseStruct>;
323
323
  export declare const SubmitRequestRequestStruct: import("@metamask/superstruct").Struct<{
324
324
  jsonrpc: "2.0";
325
325
  id: string | number | null;
@@ -358,7 +358,7 @@ export declare const SubmitRequestRequestStruct: import("@metamask/superstruct")
358
358
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
359
359
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
360
360
  }>;
361
- export declare type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;
361
+ export type SubmitRequestRequest = Infer<typeof SubmitRequestRequestStruct>;
362
362
  export declare const SubmitRequestResponseStruct: import("@metamask/superstruct").Struct<{
363
363
  pending: true;
364
364
  redirect?: {
@@ -369,7 +369,7 @@ export declare const SubmitRequestResponseStruct: import("@metamask/superstruct"
369
369
  pending: false;
370
370
  result: import("@metamask/utils").Json;
371
371
  }, null>;
372
- export declare type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;
372
+ export type SubmitRequestResponse = Infer<typeof SubmitRequestResponseStruct>;
373
373
  export declare const ApproveRequestRequestStruct: import("@metamask/superstruct").Struct<{
374
374
  jsonrpc: "2.0";
375
375
  id: string | number | null;
@@ -390,9 +390,9 @@ export declare const ApproveRequestRequestStruct: import("@metamask/superstruct"
390
390
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
391
391
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
392
392
  }>;
393
- export declare type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;
393
+ export type ApproveRequestRequest = Infer<typeof ApproveRequestRequestStruct>;
394
394
  export declare const ApproveRequestResponseStruct: import("@metamask/superstruct").Struct<null, null>;
395
- export declare type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;
395
+ export type ApproveRequestResponse = Infer<typeof ApproveRequestResponseStruct>;
396
396
  export declare const RejectRequestRequestStruct: import("@metamask/superstruct").Struct<{
397
397
  jsonrpc: "2.0";
398
398
  id: string | number | null;
@@ -410,6 +410,6 @@ export declare const RejectRequestRequestStruct: import("@metamask/superstruct")
410
410
  jsonrpc: import("@metamask/superstruct").Struct<"2.0", "2.0">;
411
411
  id: import("@metamask/superstruct").Struct<string | number | null, null>;
412
412
  }>;
413
- export declare type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;
413
+ export type RejectRequestRequest = Infer<typeof RejectRequestRequestStruct>;
414
414
  export declare const RejectRequestResponseStruct: import("@metamask/superstruct").Struct<null, null>;
415
- export declare type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;
415
+ export type RejectRequestResponse = Infer<typeof RejectRequestResponseStruct>;
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
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.GetAccountBalancesResponseStruct = exports.GetAccountBalancesRequestStruct = exports.CreateAccountResponseStruct = exports.CreateAccountRequestStruct = exports.GetAccountResponseStruct = exports.GetAccountRequestStruct = exports.ListAccountsResponseStruct = exports.ListAccountsRequestStruct = void 0;
4
4
  const superstruct_1 = require("@metamask/superstruct");
5
5
  const utils_1 = require("@metamask/utils");
6
+ const rpc_1 = require("./rpc");
6
7
  const api_1 = require("../api");
7
8
  const superstruct_2 = require("../superstruct");
8
9
  const utils_2 = require("../utils");
9
- const rpc_1 = require("./rpc");
10
10
  const CommonHeader = {
11
11
  jsonrpc: (0, superstruct_1.literal)('2.0'),
12
12
  id: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)(), (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;CACxC,CAAC,CAAC;AAIU,QAAA,0BAA0B,GAAG,IAAA,mBAAK,EAAC,0BAAoB,CAAC,CAAC;AAItE,+EAA+E;AAC/E,cAAc;AAED,QAAA,uBAAuB,GAAG,IAAA,oBAAM,EAAC;IAC5C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,oBAAoB,CAAC;IACrC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;KACf,CAAC;CACH,CAAC,CAAC;AAIU,QAAA,wBAAwB,GAAG,0BAAoB,CAAC;AAI7D,+EAA+E;AAC/E,iBAAiB;AAEJ,QAAA,0BAA0B,GAAG,IAAA,oBAAM,EAAC;IAC/C,GAAG,YAAY;IAC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/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,oBAAM,EAAC;IAChD,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,wBAAwB,CAAC;IACzC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;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,oBAAM,EAAC;IAC/C,GAAG,YAAY;IACf,MAAM,EAAE,IAAA,qBAAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;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 } 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,+BAAyC;AACzC,gCAOgB;AAChB,gDAAwC;AACxC,oCAAsC;AAEtC,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/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AAO,EAAC,uBAAuB,CAAC;IACxC,MAAM,EAAE,IAAA,oBAAM,EAAC;QACb,EAAE,EAAE,kBAAU;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 { KeyringRpcMethod } from './rpc';\nimport {\n BalanceStruct,\n CaipAssetTypeStruct,\n KeyringAccountDataStruct,\n KeyringAccountStruct,\n KeyringRequestStruct,\n KeyringResponseStruct,\n} from '../api';\nimport { object } from '../superstruct';\nimport { UuidStruct } from '../utils';\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,7 +1,7 @@
1
1
  import type { Json, Keyring } from '@metamask/utils';
2
2
  import type { KeyringExecutionContext } from '../../contexts';
3
3
  import type { EthBaseTransaction, EthBaseUserOperation, EthUserOperation, EthUserOperationPatch } from '../../eth';
4
- export declare type EthKeyring<State extends Json> = Keyring<State> & {
4
+ export type EthKeyring<State extends Json> = Keyring<State> & {
5
5
  /**
6
6
  * Convert a base transaction to a base UserOperation.
7
7
  *
@@ -1 +1 @@
1
- export * from './EthKeyring';
1
+ export type * from './EthKeyring';
@@ -1,18 +1,3 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./EthKeyring"), exports);
18
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B","sourcesContent":["export * from './EthKeyring';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/eth/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './EthKeyring';\n"]}
@@ -1,5 +1,5 @@
1
1
  export * from './api';
2
- export * from './eth';
2
+ export type * from './eth';
3
3
  export * from './events';
4
4
  export * from './rpc';
5
5
  export * from './types';
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./api"), exports);
18
- __exportStar(require("./eth"), exports);
19
18
  __exportStar(require("./events"), exports);
20
19
  __exportStar(require("./rpc"), exports);
21
20
  __exportStar(require("./types"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,wCAAsB;AACtB,2CAAyB;AACzB,wCAAsB;AACtB,0CAAwB","sourcesContent":["export * from './api';\nexport * from './eth';\nexport * from './events';\nexport * from './rpc';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AAEtB,2CAAyB;AACzB,wCAAsB;AACtB,0CAAwB","sourcesContent":["export * from './api';\nexport type * from './eth';\nexport * from './events';\nexport * from './rpc';\nexport * from './types';\n"]}
@@ -19,7 +19,7 @@ var KeyringRpcMethod;
19
19
  KeyringRpcMethod["SubmitRequest"] = "keyring_submitRequest";
20
20
  KeyringRpcMethod["ApproveRequest"] = "keyring_approveRequest";
21
21
  KeyringRpcMethod["RejectRequest"] = "keyring_rejectRequest";
22
- })(KeyringRpcMethod = exports.KeyringRpcMethod || (exports.KeyringRpcMethod = {}));
22
+ })(KeyringRpcMethod || (exports.KeyringRpcMethod = KeyringRpcMethod = {}));
23
23
  /**
24
24
  * Check if a method is a keyring RPC method.
25
25
  *
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../src/internal/rpc.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,gBAcX;AAdD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,qEAAiD,CAAA;IACjD,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,EAdW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAc3B;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC;AAFD,gDAEC","sourcesContent":["/**\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 GetAccountBalances = 'keyring_getAccountBalances',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n"]}
1
+ {"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../src/internal/rpc.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,gBAcX;AAdD,WAAY,gBAAgB;IAC1B,yDAAqC,CAAA;IACrC,qDAAiC,CAAA;IACjC,2DAAuC,CAAA;IACvC,qEAAiD,CAAA;IACjD,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,EAdW,gBAAgB,gCAAhB,gBAAgB,QAc3B;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,MAA0B,CAAC,CAAC;AAC9E,CAAC;AAFD,gDAEC","sourcesContent":["/**\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 GetAccountBalances = 'keyring_getAccountBalances',\n FilterAccountChains = 'keyring_filterAccountChains',\n UpdateAccount = 'keyring_updateAccount',\n DeleteAccount = 'keyring_deleteAccount',\n ExportAccount = 'keyring_exportAccount',\n ListRequests = 'keyring_listRequests',\n GetRequest = 'keyring_getRequest',\n SubmitRequest = 'keyring_submitRequest',\n ApproveRequest = 'keyring_approveRequest',\n RejectRequest = 'keyring_rejectRequest',\n}\n\n/**\n * Check if a method is a keyring RPC method.\n *\n * @param method - Method to check.\n * @returns Whether the method is a keyring RPC method.\n */\nexport function isKeyringRpcMethod(method: string): boolean {\n return Object.values(KeyringRpcMethod).includes(method as KeyringRpcMethod);\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { Infer, Struct } from '@metamask/superstruct';
2
2
  import { BtcAccountType, EthAccountType } from '../api';
3
- export declare type InternalAccountType = EthAccountType | BtcAccountType;
3
+ export type InternalAccountType = EthAccountType | BtcAccountType;
4
4
  export declare const InternalAccountMetadataStruct: Struct<{
5
5
  metadata: {
6
6
  name: string;
@@ -72,19 +72,6 @@ export declare const InternalEthEoaAccountStruct: Struct<{
72
72
  lastSelected?: number;
73
73
  };
74
74
  }, {
75
- address: Struct<string, null>;
76
- type: Struct<"eip155:eoa", "eip155:eoa">;
77
- methods: Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
78
- personal_sign: "personal_sign";
79
- eth_sign: "eth_sign";
80
- eth_signTransaction: "eth_signTransaction";
81
- eth_signTypedData_v1: "eth_signTypedData_v1";
82
- eth_signTypedData_v3: "eth_signTypedData_v3";
83
- eth_signTypedData_v4: "eth_signTypedData_v4";
84
- }>>;
85
- id: Struct<string, null>;
86
- options: Struct<Record<string, import("@metamask/utils").Json>, null>;
87
- } & {
88
75
  metadata: Struct<{
89
76
  name: string;
90
77
  importTime: number;
@@ -118,6 +105,18 @@ export declare const InternalEthEoaAccountStruct: Struct<{
118
105
  type: Struct<string, null>;
119
106
  }>;
120
107
  }>;
108
+ address: Struct<string, null>;
109
+ type: Struct<"eip155:eoa", "eip155:eoa">;
110
+ methods: Struct<("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[], Struct<"personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4", {
111
+ personal_sign: "personal_sign";
112
+ eth_sign: "eth_sign";
113
+ eth_signTransaction: "eth_signTransaction";
114
+ eth_signTypedData_v1: "eth_signTypedData_v1";
115
+ eth_signTypedData_v3: "eth_signTypedData_v3";
116
+ eth_signTypedData_v4: "eth_signTypedData_v4";
117
+ }>>;
118
+ id: Struct<string, null>;
119
+ options: Struct<Record<string, import("@metamask/utils").Json>, null>;
121
120
  }>;
122
121
  export declare const InternalEthErc4337AccountStruct: Struct<{
123
122
  type: "eip155:erc4337";
@@ -140,21 +139,6 @@ export declare const InternalEthErc4337AccountStruct: Struct<{
140
139
  lastSelected?: number;
141
140
  };
142
141
  }, {
143
- address: Struct<string, null>;
144
- type: Struct<"eip155:erc4337", "eip155:erc4337">;
145
- methods: Struct<("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[], Struct<"personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation", {
146
- personal_sign: "personal_sign";
147
- eth_sign: "eth_sign";
148
- eth_signTypedData_v1: "eth_signTypedData_v1";
149
- eth_signTypedData_v3: "eth_signTypedData_v3";
150
- eth_signTypedData_v4: "eth_signTypedData_v4";
151
- eth_prepareUserOperation: "eth_prepareUserOperation";
152
- eth_patchUserOperation: "eth_patchUserOperation";
153
- eth_signUserOperation: "eth_signUserOperation";
154
- }>>;
155
- id: Struct<string, null>;
156
- options: Struct<Record<string, import("@metamask/utils").Json>, null>;
157
- } & {
158
142
  metadata: Struct<{
159
143
  name: string;
160
144
  importTime: number;
@@ -188,13 +172,27 @@ export declare const InternalEthErc4337AccountStruct: Struct<{
188
172
  type: Struct<string, null>;
189
173
  }>;
190
174
  }>;
175
+ address: Struct<string, null>;
176
+ type: Struct<"eip155:erc4337", "eip155:erc4337">;
177
+ methods: Struct<("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[], Struct<"personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation", {
178
+ personal_sign: "personal_sign";
179
+ eth_sign: "eth_sign";
180
+ eth_signTypedData_v1: "eth_signTypedData_v1";
181
+ eth_signTypedData_v3: "eth_signTypedData_v3";
182
+ eth_signTypedData_v4: "eth_signTypedData_v4";
183
+ eth_prepareUserOperation: "eth_prepareUserOperation";
184
+ eth_patchUserOperation: "eth_patchUserOperation";
185
+ eth_signUserOperation: "eth_signUserOperation";
186
+ }>>;
187
+ id: Struct<string, null>;
188
+ options: Struct<Record<string, import("@metamask/utils").Json>, null>;
191
189
  }>;
192
190
  export declare const InternalBtcP2wpkhAccountStruct: Struct<{
193
191
  type: "bip122:p2wpkh";
194
192
  id: string;
195
193
  address: string;
196
194
  options: Record<string, import("@metamask/utils").Json>;
197
- methods: "btc_sendmany"[];
195
+ methods: "sendBitcoin"[];
198
196
  metadata: {
199
197
  name: string;
200
198
  importTime: number;
@@ -210,14 +208,6 @@ export declare const InternalBtcP2wpkhAccountStruct: Struct<{
210
208
  lastSelected?: number;
211
209
  };
212
210
  }, {
213
- address: Struct<string, null>;
214
- type: Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
215
- methods: Struct<"btc_sendmany"[], Struct<"btc_sendmany", {
216
- btc_sendmany: "btc_sendmany";
217
- }>>;
218
- id: Struct<string, null>;
219
- options: Struct<Record<string, import("@metamask/utils").Json>, null>;
220
- } & {
221
211
  metadata: Struct<{
222
212
  name: string;
223
213
  importTime: number;
@@ -251,12 +241,19 @@ export declare const InternalBtcP2wpkhAccountStruct: Struct<{
251
241
  type: Struct<string, null>;
252
242
  }>;
253
243
  }>;
244
+ address: Struct<string, null>;
245
+ type: Struct<"bip122:p2wpkh", "bip122:p2wpkh">;
246
+ methods: Struct<"sendBitcoin"[], Struct<"sendBitcoin", {
247
+ sendBitcoin: "sendBitcoin";
248
+ }>>;
249
+ id: Struct<string, null>;
250
+ options: Struct<Record<string, import("@metamask/utils").Json>, null>;
254
251
  }>;
255
- export declare type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;
256
- export declare type InternalEthErc4337Account = Infer<typeof InternalEthErc4337AccountStruct>;
257
- export declare type InternalBtcP2wpkhAccount = Infer<typeof InternalBtcP2wpkhAccountStruct>;
252
+ export type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;
253
+ export type InternalEthErc4337Account = Infer<typeof InternalEthErc4337AccountStruct>;
254
+ export type InternalBtcP2wpkhAccount = Infer<typeof InternalBtcP2wpkhAccountStruct>;
258
255
  export declare const InternalAccountStructs: Record<string, Struct<InternalEthEoaAccount> | Struct<InternalEthErc4337Account> | Struct<InternalBtcP2wpkhAccount>>;
259
- export declare type InternalAccountTypes = InternalEthEoaAccount | InternalEthErc4337Account | InternalBtcP2wpkhAccount;
256
+ export type InternalAccountTypes = InternalEthEoaAccount | InternalEthErc4337Account | InternalBtcP2wpkhAccount;
260
257
  export declare const InternalAccountStruct: Struct<{
261
258
  type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh";
262
259
  id: string;
@@ -327,4 +324,4 @@ export declare const InternalAccountStruct: Struct<{
327
324
  * This type is used internally by MetaMask to add additional metadata to the
328
325
  * account object. It's should not be used by external applications.
329
326
  */
330
- export declare type InternalAccount = Infer<typeof InternalAccountStruct>;
327
+ export type InternalAccount = Infer<typeof InternalAccountStruct>;
@@ -22,21 +22,18 @@ exports.InternalAccountMetadataStruct = (0, superstruct_2.object)({
22
22
  }),
23
23
  }),
24
24
  });
25
- /**
26
- * Creates an `InternalAccount` from an existing account `superstruct` object.
27
- *
28
- * @param accountStruct - An account `superstruct` object.
29
- * @returns The `InternalAccount` associated to `accountStruct`.
30
- */
31
- function asInternalAccountStruct(accountStruct) {
32
- return (0, superstruct_2.object)({
33
- ...accountStruct.schema,
34
- ...exports.InternalAccountMetadataStruct.schema,
35
- });
36
- }
37
- exports.InternalEthEoaAccountStruct = asInternalAccountStruct(types_2.EthEoaAccountStruct);
38
- exports.InternalEthErc4337AccountStruct = asInternalAccountStruct(types_2.EthErc4337AccountStruct);
39
- exports.InternalBtcP2wpkhAccountStruct = asInternalAccountStruct(types_1.BtcP2wpkhAccountStruct);
25
+ exports.InternalEthEoaAccountStruct = (0, superstruct_2.object)({
26
+ ...types_2.EthEoaAccountStruct.schema,
27
+ ...exports.InternalAccountMetadataStruct.schema,
28
+ });
29
+ exports.InternalEthErc4337AccountStruct = (0, superstruct_2.object)({
30
+ ...types_2.EthErc4337AccountStruct.schema,
31
+ ...exports.InternalAccountMetadataStruct.schema,
32
+ });
33
+ exports.InternalBtcP2wpkhAccountStruct = (0, superstruct_2.object)({
34
+ ...types_1.BtcP2wpkhAccountStruct.schema,
35
+ ...exports.InternalAccountMetadataStruct.schema,
36
+ });
40
37
  exports.InternalAccountStructs = {
41
38
  [`${api_1.EthAccountType.Eoa}`]: exports.InternalEthEoaAccountStruct,
42
39
  [`${api_1.EthAccountType.Erc4337}`]: exports.InternalEthErc4337AccountStruct,
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":";;;AACA,uDAAgE;AAEhE,gCAA8E;AAC9E,wCAAsD;AACtD,wCAA4E;AAC5E,gDAAuD;AAI1C,QAAA,6BAA6B,GAAG,IAAA,oBAAM,EAAC;IAClD,QAAQ,EAAE,IAAA,oBAAM,EAAC;QACf,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd,iBAAiB,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QAC1C,IAAI,EAAE,IAAA,2BAAa,EACjB,IAAA,oBAAM,EAAC;YACL,EAAE,EAAE,IAAA,oBAAM,GAAE;YACZ,OAAO,EAAE,IAAA,qBAAO,GAAE;YAClB,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC,CACH;QACD,YAAY,EAAE,IAAA,2BAAa,EAAC,IAAA,oBAAM,GAAE,CAAC;QACrC,UAAU,EAAE,IAAA,oBAAM,GAAE;QACpB,OAAO,EAAE,IAAA,oBAAM,EAAC;YACd,IAAI,EAAE,IAAA,oBAAM,GAAE;SACf,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,uBAAuB,CAC9B,aAA6C;IAE7C,OAAO,IAAA,oBAAM,EAAC;QACZ,GAAG,aAAa,CAAC,MAAM;QACvB,GAAG,qCAA6B,CAAC,MAAM;KACxC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,2BAA2B,GACtC,uBAAuB,CAAC,2BAAmB,CAAC,CAAC;AAElC,QAAA,+BAA+B,GAAG,uBAAuB,CACpE,+BAAuB,CACxB,CAAC;AAEW,QAAA,8BAA8B,GAAG,uBAAuB,CACnE,8BAAsB,CACvB,CAAC;AAYW,QAAA,sBAAsB,GAK/B;IACF,CAAC,GAAG,oBAAc,CAAC,GAAG,EAAE,CAAC,EAAE,mCAA2B;IACtD,CAAC,GAAG,oBAAc,CAAC,OAAO,EAAE,CAAC,EAAE,uCAA+B;IAC9D,CAAC,GAAG,oBAAc,CAAC,MAAM,EAAE,CAAC,EAAE,sCAA8B;CAC7D,CAAC;AAOW,QAAA,qBAAqB,GAAG,IAAA,oBAAM,EAAC;IAC1C,GAAG,0BAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["import type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nimport { BtcAccountType, EthAccountType, KeyringAccountStruct } from '../api';\nimport { BtcP2wpkhAccountStruct } from '../btc/types';\nimport { EthEoaAccountStruct, EthErc4337AccountStruct } from '../eth/types';\nimport { exactOptional, object } from '../superstruct';\n\nexport type InternalAccountType = EthAccountType | BtcAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n nameLastUpdatedAt: exactOptional(number()),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\n/**\n * Creates an `InternalAccount` from an existing account `superstruct` object.\n *\n * @param accountStruct - An account `superstruct` object.\n * @returns The `InternalAccount` associated to `accountStruct`.\n */\nfunction asInternalAccountStruct<Account, AccountSchema>(\n accountStruct: Struct<Account, AccountSchema>,\n) {\n return object({\n ...accountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n });\n}\n\nexport const InternalEthEoaAccountStruct =\n asInternalAccountStruct(EthEoaAccountStruct);\n\nexport const InternalEthErc4337AccountStruct = asInternalAccountStruct(\n EthErc4337AccountStruct,\n);\n\nexport const InternalBtcP2wpkhAccountStruct = asInternalAccountStruct(\n BtcP2wpkhAccountStruct,\n);\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":";;;AACA,uDAAgE;AAEhE,gCAA8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B;CAC7D,CAAC;AAOW,QAAA,qBAAqB,GAAG,IAAA,oBAAM,EAAC;IAC1C,GAAG,0BAAoB,CAAC,MAAM;IAC9B,GAAG,qCAA6B,CAAC,MAAM;CACxC,CAAC,CAAC","sourcesContent":["import type { Infer, Struct } from '@metamask/superstruct';\nimport { boolean, string, number } from '@metamask/superstruct';\n\nimport { BtcAccountType, EthAccountType, KeyringAccountStruct } from '../api';\nimport { BtcP2wpkhAccountStruct } from '../btc/types';\nimport { EthEoaAccountStruct, EthErc4337AccountStruct } from '../eth/types';\nimport { exactOptional, object } from '../superstruct';\n\nexport type InternalAccountType = EthAccountType | BtcAccountType;\n\nexport const InternalAccountMetadataStruct = object({\n metadata: object({\n name: string(),\n nameLastUpdatedAt: exactOptional(number()),\n snap: exactOptional(\n object({\n id: string(),\n enabled: boolean(),\n name: string(),\n }),\n ),\n lastSelected: exactOptional(number()),\n importTime: number(),\n keyring: object({\n type: string(),\n }),\n }),\n});\n\nexport const InternalEthEoaAccountStruct = object({\n ...EthEoaAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalEthErc4337AccountStruct = object({\n ...EthErc4337AccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport const InternalBtcP2wpkhAccountStruct = object({\n ...BtcP2wpkhAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\nexport type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;\n\nexport type InternalEthErc4337Account = Infer<\n typeof InternalEthErc4337AccountStruct\n>;\n\nexport type InternalBtcP2wpkhAccount = Infer<\n typeof InternalBtcP2wpkhAccountStruct\n>;\n\nexport const InternalAccountStructs: Record<\n string,\n | Struct<InternalEthEoaAccount>\n | Struct<InternalEthErc4337Account>\n | Struct<InternalBtcP2wpkhAccount>\n> = {\n [`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,\n [`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,\n [`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,\n};\n\nexport type InternalAccountTypes =\n | InternalEthEoaAccount\n | InternalEthErc4337Account\n | InternalBtcP2wpkhAccount;\n\nexport const InternalAccountStruct = object({\n ...KeyringAccountStruct.schema,\n ...InternalAccountMetadataStruct.schema,\n});\n\n/**\n * Internal account representation.\n *\n * This type is used internally by MetaMask to add additional metadata to the\n * account object. It's should not be used by external applications.\n */\nexport type InternalAccount = Infer<typeof InternalAccountStruct>;\n"]}