@metamask-previews/keyring-api 23.1.0-bc99865 → 23.2.0-023fc63

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 (42) hide show
  1. package/CHANGELOG.md +8 -4
  2. package/dist/api/account.d.cts +2 -2
  3. package/dist/api/account.d.mts +2 -2
  4. package/dist/api/asset.d.cts +2 -2
  5. package/dist/api/asset.d.mts +2 -2
  6. package/dist/api/request.d.cts +3 -3
  7. package/dist/api/request.d.mts +3 -3
  8. package/dist/api/response.d.cts +1 -1
  9. package/dist/api/response.d.mts +1 -1
  10. package/dist/api/transaction.d.cts +71 -71
  11. package/dist/api/transaction.d.mts +71 -71
  12. package/dist/btc/types.d.cts +8 -8
  13. package/dist/btc/types.d.mts +8 -8
  14. package/dist/eth/erc4337/types.d.cts +3 -3
  15. package/dist/eth/erc4337/types.d.mts +3 -3
  16. package/dist/eth/rpc/params.d.cts +29 -29
  17. package/dist/eth/rpc/params.d.mts +29 -29
  18. package/dist/eth/types.cjs +5 -2
  19. package/dist/eth/types.cjs.map +1 -1
  20. package/dist/eth/types.d.cts +5 -4
  21. package/dist/eth/types.d.cts.map +1 -1
  22. package/dist/eth/types.d.mts +5 -4
  23. package/dist/eth/types.d.mts.map +1 -1
  24. package/dist/eth/types.mjs +4 -1
  25. package/dist/eth/types.mjs.map +1 -1
  26. package/dist/events.d.cts +56 -56
  27. package/dist/events.d.mts +56 -56
  28. package/dist/rpc.d.cts +131 -131
  29. package/dist/rpc.d.mts +131 -131
  30. package/dist/sol/types.d.cts +2 -2
  31. package/dist/sol/types.d.mts +2 -2
  32. package/dist/trx/types.d.cts +2 -2
  33. package/dist/trx/types.d.mts +2 -2
  34. package/dist/v2/api/create-account/bip44.d.cts +1 -1
  35. package/dist/v2/api/create-account/bip44.d.mts +1 -1
  36. package/dist/v2/api/create-account/index.d.cts +1 -1
  37. package/dist/v2/api/create-account/index.d.mts +1 -1
  38. package/dist/v2/api/keyring-rpc.d.cts +28 -28
  39. package/dist/v2/api/keyring-rpc.d.mts +28 -28
  40. package/dist/xlm/types.d.cts +2 -2
  41. package/dist/xlm/types.d.mts +2 -2
  42. package/package.json +1 -1
@@ -14,22 +14,22 @@ import type { Infer } from "@metamask/superstruct";
14
14
  * The actual transaction validation is performed by the transaction library.
15
15
  */
16
16
  export declare const EthTransactionDataStruct: import("@metamask/superstruct").Struct<{
17
- value?: string | number | undefined;
18
17
  type?: string | number | undefined;
19
- data?: string | undefined;
20
18
  from?: string | undefined;
21
- chainId?: string | number | undefined;
22
- accessList?: {
23
- address: string;
24
- storageKeys: string[];
25
- }[] | undefined;
26
- nonce?: string | number | undefined;
27
19
  to?: string | null | undefined;
20
+ data?: string | undefined;
21
+ value?: string | number | undefined;
22
+ nonce?: string | number | undefined;
28
23
  maxFeePerGas?: string | number | undefined;
29
24
  maxPriorityFeePerGas?: string | number | undefined;
30
25
  gas?: string | number | undefined;
31
26
  gasLimit?: string | number | undefined;
32
27
  gasPrice?: string | number | undefined;
28
+ accessList?: {
29
+ address: string;
30
+ storageKeys: string[];
31
+ }[] | undefined;
32
+ chainId?: string | number | undefined;
33
33
  }, {
34
34
  to: import("@metamask/superstruct").Struct<string | null | undefined, null>;
35
35
  from: import("@metamask/superstruct").Struct<string | undefined, null>;
@@ -60,13 +60,13 @@ export type EthTransactionData = Infer<typeof EthTransactionDataStruct>;
60
60
  * This is an array of { type, name, value } objects.
61
61
  */
62
62
  export declare const EthTypedDataV1Struct: import("@metamask/superstruct").Struct<{
63
- name: string;
64
- value: unknown;
65
63
  type: string;
66
- }[], import("@metamask/superstruct").Struct<{
67
- name: string;
68
64
  value: unknown;
65
+ name: string;
66
+ }[], import("@metamask/superstruct").Struct<{
69
67
  type: string;
68
+ value: unknown;
69
+ name: string;
70
70
  }, {
71
71
  type: import("@metamask/superstruct").Struct<string, null>;
72
72
  name: import("@metamask/superstruct").Struct<string, null>;
@@ -78,8 +78,8 @@ export type EthTypedDataV1 = Infer<typeof EthTypedDataV1Struct>;
78
78
  * Maps type names to arrays of { name, type } definitions.
79
79
  */
80
80
  export declare const EthTypedDataTypesStruct: import("@metamask/superstruct").Struct<Record<string, {
81
- name: string;
82
81
  type: string;
82
+ name: string;
83
83
  }[]>, null>;
84
84
  export type EthTypedDataTypes = Infer<typeof EthTypedDataTypesStruct>;
85
85
  /**
@@ -88,16 +88,16 @@ export type EthTypedDataTypes = Infer<typeof EthTypedDataTypesStruct>;
88
88
  */
89
89
  export declare const EthTypedMessageStruct: import("@metamask/superstruct").Struct<{
90
90
  message: Record<string, any>;
91
- domain: Record<string, any>;
92
91
  types: Record<string, {
93
- name: string;
94
92
  type: string;
93
+ name: string;
95
94
  }[]>;
96
95
  primaryType: string;
96
+ domain: Record<string, any>;
97
97
  }, {
98
98
  types: import("@metamask/superstruct").Struct<Record<string, {
99
- name: string;
100
99
  type: string;
100
+ name: string;
101
101
  }[]>, null>;
102
102
  primaryType: import("@metamask/superstruct").Struct<string, null>;
103
103
  domain: import("@metamask/superstruct").Struct<Record<string, any>, null>;
@@ -133,22 +133,22 @@ export declare const EthGetEncryptionPublicKeyOptionsStruct: import("@metamask/s
133
133
  * Parameters for `eth_signTransaction`.
134
134
  */
135
135
  export declare const EthSignTransactionParamsStruct: import("@metamask/superstruct").Struct<[{
136
- value?: string | number | undefined;
137
136
  type?: string | number | undefined;
138
- data?: string | undefined;
139
137
  from?: string | undefined;
140
- chainId?: string | number | undefined;
141
- accessList?: {
142
- address: string;
143
- storageKeys: string[];
144
- }[] | undefined;
145
- nonce?: string | number | undefined;
146
138
  to?: string | null | undefined;
139
+ data?: string | undefined;
140
+ value?: string | number | undefined;
141
+ nonce?: string | number | undefined;
147
142
  maxFeePerGas?: string | number | undefined;
148
143
  maxPriorityFeePerGas?: string | number | undefined;
149
144
  gas?: string | number | undefined;
150
145
  gasLimit?: string | number | undefined;
151
146
  gasPrice?: string | number | undefined;
147
+ accessList?: {
148
+ address: string;
149
+ storageKeys: string[];
150
+ }[] | undefined;
151
+ chainId?: string | number | undefined;
152
152
  }], null>;
153
153
  export type EthSignTransactionParams = Infer<typeof EthSignTransactionParamsStruct>;
154
154
  /**
@@ -159,15 +159,15 @@ export type EthSignParams = Infer<typeof EthSignParamsStruct>;
159
159
  /**
160
160
  * Parameters for `personal_sign`.
161
161
  */
162
- export declare const EthPersonalSignParamsStruct: import("@metamask/superstruct").Struct<[string, string] | [string], null>;
162
+ export declare const EthPersonalSignParamsStruct: import("@metamask/superstruct").Struct<[string] | [string, string], null>;
163
163
  export type EthPersonalSignParams = Infer<typeof EthPersonalSignParamsStruct>;
164
164
  /**
165
165
  * Parameters for `eth_signTypedData_v1`.
166
166
  */
167
167
  export declare const EthSignTypedDataV1ParamsStruct: import("@metamask/superstruct").Struct<[string, {
168
- name: string;
169
- value: unknown;
170
168
  type: string;
169
+ value: unknown;
170
+ name: string;
171
171
  }[]], null>;
172
172
  export type EthSignTypedDataV1Params = Infer<typeof EthSignTypedDataV1ParamsStruct>;
173
173
  /**
@@ -175,12 +175,12 @@ export type EthSignTypedDataV1Params = Infer<typeof EthSignTypedDataV1ParamsStru
175
175
  */
176
176
  export declare const EthSignTypedDataParamsStruct: import("@metamask/superstruct").Struct<[string, {
177
177
  message: Record<string, any>;
178
- domain: Record<string, any>;
179
178
  types: Record<string, {
180
- name: string;
181
179
  type: string;
180
+ name: string;
182
181
  }[]>;
183
182
  primaryType: string;
183
+ domain: Record<string, any>;
184
184
  }], null>;
185
185
  export type EthSignTypedDataParams = Infer<typeof EthSignTypedDataParamsStruct>;
186
186
  /**
@@ -14,22 +14,22 @@ import type { Infer } from "@metamask/superstruct";
14
14
  * The actual transaction validation is performed by the transaction library.
15
15
  */
16
16
  export declare const EthTransactionDataStruct: import("@metamask/superstruct").Struct<{
17
- value?: string | number | undefined;
18
17
  type?: string | number | undefined;
19
- data?: string | undefined;
20
18
  from?: string | undefined;
21
- chainId?: string | number | undefined;
22
- accessList?: {
23
- address: string;
24
- storageKeys: string[];
25
- }[] | undefined;
26
- nonce?: string | number | undefined;
27
19
  to?: string | null | undefined;
20
+ data?: string | undefined;
21
+ value?: string | number | undefined;
22
+ nonce?: string | number | undefined;
28
23
  maxFeePerGas?: string | number | undefined;
29
24
  maxPriorityFeePerGas?: string | number | undefined;
30
25
  gas?: string | number | undefined;
31
26
  gasLimit?: string | number | undefined;
32
27
  gasPrice?: string | number | undefined;
28
+ accessList?: {
29
+ address: string;
30
+ storageKeys: string[];
31
+ }[] | undefined;
32
+ chainId?: string | number | undefined;
33
33
  }, {
34
34
  to: import("@metamask/superstruct").Struct<string | null | undefined, null>;
35
35
  from: import("@metamask/superstruct").Struct<string | undefined, null>;
@@ -60,13 +60,13 @@ export type EthTransactionData = Infer<typeof EthTransactionDataStruct>;
60
60
  * This is an array of { type, name, value } objects.
61
61
  */
62
62
  export declare const EthTypedDataV1Struct: import("@metamask/superstruct").Struct<{
63
- name: string;
64
- value: unknown;
65
63
  type: string;
66
- }[], import("@metamask/superstruct").Struct<{
67
- name: string;
68
64
  value: unknown;
65
+ name: string;
66
+ }[], import("@metamask/superstruct").Struct<{
69
67
  type: string;
68
+ value: unknown;
69
+ name: string;
70
70
  }, {
71
71
  type: import("@metamask/superstruct").Struct<string, null>;
72
72
  name: import("@metamask/superstruct").Struct<string, null>;
@@ -78,8 +78,8 @@ export type EthTypedDataV1 = Infer<typeof EthTypedDataV1Struct>;
78
78
  * Maps type names to arrays of { name, type } definitions.
79
79
  */
80
80
  export declare const EthTypedDataTypesStruct: import("@metamask/superstruct").Struct<Record<string, {
81
- name: string;
82
81
  type: string;
82
+ name: string;
83
83
  }[]>, null>;
84
84
  export type EthTypedDataTypes = Infer<typeof EthTypedDataTypesStruct>;
85
85
  /**
@@ -88,16 +88,16 @@ export type EthTypedDataTypes = Infer<typeof EthTypedDataTypesStruct>;
88
88
  */
89
89
  export declare const EthTypedMessageStruct: import("@metamask/superstruct").Struct<{
90
90
  message: Record<string, any>;
91
- domain: Record<string, any>;
92
91
  types: Record<string, {
93
- name: string;
94
92
  type: string;
93
+ name: string;
95
94
  }[]>;
96
95
  primaryType: string;
96
+ domain: Record<string, any>;
97
97
  }, {
98
98
  types: import("@metamask/superstruct").Struct<Record<string, {
99
- name: string;
100
99
  type: string;
100
+ name: string;
101
101
  }[]>, null>;
102
102
  primaryType: import("@metamask/superstruct").Struct<string, null>;
103
103
  domain: import("@metamask/superstruct").Struct<Record<string, any>, null>;
@@ -133,22 +133,22 @@ export declare const EthGetEncryptionPublicKeyOptionsStruct: import("@metamask/s
133
133
  * Parameters for `eth_signTransaction`.
134
134
  */
135
135
  export declare const EthSignTransactionParamsStruct: import("@metamask/superstruct").Struct<[{
136
- value?: string | number | undefined;
137
136
  type?: string | number | undefined;
138
- data?: string | undefined;
139
137
  from?: string | undefined;
140
- chainId?: string | number | undefined;
141
- accessList?: {
142
- address: string;
143
- storageKeys: string[];
144
- }[] | undefined;
145
- nonce?: string | number | undefined;
146
138
  to?: string | null | undefined;
139
+ data?: string | undefined;
140
+ value?: string | number | undefined;
141
+ nonce?: string | number | undefined;
147
142
  maxFeePerGas?: string | number | undefined;
148
143
  maxPriorityFeePerGas?: string | number | undefined;
149
144
  gas?: string | number | undefined;
150
145
  gasLimit?: string | number | undefined;
151
146
  gasPrice?: string | number | undefined;
147
+ accessList?: {
148
+ address: string;
149
+ storageKeys: string[];
150
+ }[] | undefined;
151
+ chainId?: string | number | undefined;
152
152
  }], null>;
153
153
  export type EthSignTransactionParams = Infer<typeof EthSignTransactionParamsStruct>;
154
154
  /**
@@ -159,15 +159,15 @@ export type EthSignParams = Infer<typeof EthSignParamsStruct>;
159
159
  /**
160
160
  * Parameters for `personal_sign`.
161
161
  */
162
- export declare const EthPersonalSignParamsStruct: import("@metamask/superstruct").Struct<[string, string] | [string], null>;
162
+ export declare const EthPersonalSignParamsStruct: import("@metamask/superstruct").Struct<[string] | [string, string], null>;
163
163
  export type EthPersonalSignParams = Infer<typeof EthPersonalSignParamsStruct>;
164
164
  /**
165
165
  * Parameters for `eth_signTypedData_v1`.
166
166
  */
167
167
  export declare const EthSignTypedDataV1ParamsStruct: import("@metamask/superstruct").Struct<[string, {
168
- name: string;
169
- value: unknown;
170
168
  type: string;
169
+ value: unknown;
170
+ name: string;
171
171
  }[]], null>;
172
172
  export type EthSignTypedDataV1Params = Infer<typeof EthSignTypedDataV1ParamsStruct>;
173
173
  /**
@@ -175,12 +175,12 @@ export type EthSignTypedDataV1Params = Infer<typeof EthSignTypedDataV1ParamsStru
175
175
  */
176
176
  export declare const EthSignTypedDataParamsStruct: import("@metamask/superstruct").Struct<[string, {
177
177
  message: Record<string, any>;
178
- domain: Record<string, any>;
179
178
  types: Record<string, {
180
- name: string;
181
179
  type: string;
180
+ name: string;
182
181
  }[]>;
183
182
  primaryType: string;
183
+ domain: Record<string, any>;
184
184
  }], null>;
185
185
  export type EthSignTypedDataParams = Infer<typeof EthSignTypedDataParamsStruct>;
186
186
  /**
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EthErc4337AccountStruct = exports.EthEoaAccountStruct = exports.EthMethod = exports.EthUint256Struct = exports.EthAddressStrictStruct = exports.EthAddressStruct = exports.EthBytesStruct = void 0;
3
+ exports.EthErc4337AccountStruct = exports.EthEoaAccountStruct = exports.EthMethod = exports.EthUint256Struct = exports.EthAddressStrictStruct = exports.EthAddressStruct = exports.EthBytesStrictStruct = exports.EthBytesStruct = void 0;
4
4
  const keyring_utils_1 = require("@metamask/keyring-utils");
5
5
  const superstruct_1 = require("@metamask/superstruct");
6
6
  const utils_1 = require("@metamask/utils");
7
7
  const _1 = require("./index.cjs");
8
8
  const api_1 = require("../api/index.cjs");
9
- exports.EthBytesStruct = (0, utils_1.definePattern)('EthBytes', /^0x[0-9a-f]*$/iu);
9
+ const ETH_BYTES_REGEX = /^0x[0-9a-f]*$/iu;
10
+ exports.EthBytesStruct = (0, utils_1.definePattern)('EthBytes', ETH_BYTES_REGEX);
11
+ // Stricter struct that uses `Hex` as final type.
12
+ exports.EthBytesStrictStruct = (0, utils_1.definePattern)('EthBytesStrict', ETH_BYTES_REGEX);
10
13
  const ETH_ADDRESS_REGEX = /^0x[0-9a-f]{40}$/iu;
11
14
  exports.EthAddressStruct = (0, utils_1.definePattern)('EthAddress', ETH_ADDRESS_REGEX);
12
15
  // Stricter struct that uses `Hex` as final type.
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":";;;AAAA,2DAAiD;AAEjD,uDAAwE;AACxE,2CAAgD;AAGhD,kCAA6B;AAC7B,0CAIgB;AAEH,QAAA,cAAc,GAAG,IAAA,qBAAa,EAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAE3E,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAClC,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;AAC/E,iDAAiD;AACpC,QAAA,sBAAsB,GAAG,IAAA,qBAAa,EACjD,kBAAkB,EAClB,iBAAiB,CAClB,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,0BAA0B;IAC1B,2CAA8B,CAAA;IAC9B,8BAAiB,CAAA;IACjB,oDAAuC,CAAA;IACvC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,mBAAmB;IACnB,8DAAiD,CAAA;IACjD,0DAA6C,CAAA;IAC7C,wDAA2C,CAAA;AAC7C,CAAC,EAZW,SAAS,yBAAT,SAAS,QAYpB;AAEY,QAAA,mBAAmB,GAAG,IAAA,sBAAM,EAAC;IACxC,GAAG,0BAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,wBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,IAAA,qBAAO,EA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port type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, literal } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\nimport type { Hex } from '@metamask/utils';\n\nimport { EthScope } from '.';\nimport {\n CaipChainIdStruct,\n EthAccountType,\n KeyringAccountStruct,\n} from '../api';\n\nexport const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);\n\nconst ETH_ADDRESS_REGEX = /^0x[0-9a-f]{40}$/iu;\nexport const EthAddressStruct = definePattern('EthAddress', ETH_ADDRESS_REGEX);\n// Stricter struct that uses `Hex` as final type.\nexport const EthAddressStrictStruct = definePattern<Hex>(\n 'EthAddressStrict',\n ETH_ADDRESS_REGEX,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account scopes (must be ['eip155:0']).\n */\n scopes: nonempty(array(literal(EthScope.Eoa))),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":";;;AAAA,2DAAiD;AAEjD,uDAAwE;AACxE,2CAAgD;AAGhD,kCAA6B;AAC7B,0CAIgB;AAEhB,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC7B,QAAA,cAAc,GAAG,IAAA,qBAAa,EAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AACzE,iDAAiD;AACpC,QAAA,oBAAoB,GAAG,IAAA,qBAAa,EAC/C,gBAAgB,EAChB,eAAe,CAChB,CAAC;AAEF,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAClC,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;AAC/E,iDAAiD;AACpC,QAAA,sBAAsB,GAAG,IAAA,qBAAa,EACjD,kBAAkB,EAClB,iBAAiB,CAClB,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,IAAY,SAYX;AAZD,WAAY,SAAS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EG;IACH,OAAO,EAAE,IAAA,mBAAK,EACZ,IAAA,mBAAK,EAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,oBAAoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, literal } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\nimport type { Hex } from '@metamask/utils';\n\nimport { EthScope } from '.';\nimport {\n CaipChainIdStruct,\n EthAccountType,\n KeyringAccountStruct,\n} from '../api';\n\nconst ETH_BYTES_REGEX = /^0x[0-9a-f]*$/iu;\nexport const EthBytesStruct = definePattern('EthBytes', ETH_BYTES_REGEX);\n// Stricter struct that uses `Hex` as final type.\nexport const EthBytesStrictStruct = definePattern<Hex>(\n 'EthBytesStrict',\n ETH_BYTES_REGEX,\n);\n\nconst ETH_ADDRESS_REGEX = /^0x[0-9a-f]{40}$/iu;\nexport const EthAddressStruct = definePattern('EthAddress', ETH_ADDRESS_REGEX);\n// Stricter struct that uses `Hex` as final type.\nexport const EthAddressStrictStruct = definePattern<Hex>(\n 'EthAddressStrict',\n ETH_ADDRESS_REGEX,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account scopes (must be ['eip155:0']).\n */\n scopes: nonempty(array(literal(EthScope.Eoa))),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  import { EthScope } from "./index.cjs";
3
3
  export declare const EthBytesStruct: import("@metamask/superstruct").Struct<string, null>;
4
+ export declare const EthBytesStrictStruct: import("@metamask/superstruct").Struct<`0x${string}`, null>;
4
5
  export declare const EthAddressStruct: import("@metamask/superstruct").Struct<string, null>;
5
6
  export declare const EthAddressStrictStruct: import("@metamask/superstruct").Struct<`0x${string}`, null>;
6
7
  export declare const EthUint256Struct: import("@metamask/superstruct").Struct<string, null>;
@@ -21,6 +22,8 @@ export declare enum EthMethod {
21
22
  export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct<{
22
23
  type: "eip155:eoa";
23
24
  id: string;
25
+ address: string;
26
+ scopes: EthScope.Eoa[];
24
27
  options: Record<string, import("@metamask/utils").Json> & {
25
28
  entropy?: {
26
29
  type: "mnemonic";
@@ -34,8 +37,6 @@ export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct
34
37
  };
35
38
  exportable?: boolean;
36
39
  };
37
- address: string;
38
- scopes: EthScope.Eoa[];
39
40
  methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
40
41
  }, {
41
42
  /**
@@ -80,6 +81,8 @@ export type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;
80
81
  export declare const EthErc4337AccountStruct: import("@metamask/superstruct").Struct<{
81
82
  type: "eip155:erc4337";
82
83
  id: string;
84
+ address: string;
85
+ scopes: `${string}:${string}`[];
83
86
  options: Record<string, import("@metamask/utils").Json> & {
84
87
  entropy?: {
85
88
  type: "mnemonic";
@@ -93,8 +96,6 @@ export declare const EthErc4337AccountStruct: import("@metamask/superstruct").St
93
96
  };
94
97
  exportable?: boolean;
95
98
  };
96
- address: string;
97
- scopes: `${string}:${string}`[];
98
99
  methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
99
100
  }, {
100
101
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/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M,sBAAsB,6DAGlC,CAAC;AAEF,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,YAAY,kBAAkB;IAC9B,IAAI,aAAa;IACjB,eAAe,wBAAwB;IACvC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IACxC,eAAe,yBAAyB;IAExC,oBAAoB,6BAA6B;IACjD,kBAAkB,2BAA2B;IAC7C,iBAAiB,0BAA0B;CAC5C;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;IAG9B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;EAWH,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;IAGlC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;EAaH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  import { EthScope } from "./index.mjs";
3
3
  export declare const EthBytesStruct: import("@metamask/superstruct").Struct<string, null>;
4
+ export declare const EthBytesStrictStruct: import("@metamask/superstruct").Struct<`0x${string}`, null>;
4
5
  export declare const EthAddressStruct: import("@metamask/superstruct").Struct<string, null>;
5
6
  export declare const EthAddressStrictStruct: import("@metamask/superstruct").Struct<`0x${string}`, null>;
6
7
  export declare const EthUint256Struct: import("@metamask/superstruct").Struct<string, null>;
@@ -21,6 +22,8 @@ export declare enum EthMethod {
21
22
  export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct<{
22
23
  type: "eip155:eoa";
23
24
  id: string;
25
+ address: string;
26
+ scopes: EthScope.Eoa[];
24
27
  options: Record<string, import("@metamask/utils").Json> & {
25
28
  entropy?: {
26
29
  type: "mnemonic";
@@ -34,8 +37,6 @@ export declare const EthEoaAccountStruct: import("@metamask/superstruct").Struct
34
37
  };
35
38
  exportable?: boolean;
36
39
  };
37
- address: string;
38
- scopes: EthScope.Eoa[];
39
40
  methods: ("personal_sign" | "eth_sign" | "eth_signTransaction" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4")[];
40
41
  }, {
41
42
  /**
@@ -80,6 +81,8 @@ export type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;
80
81
  export declare const EthErc4337AccountStruct: import("@metamask/superstruct").Struct<{
81
82
  type: "eip155:erc4337";
82
83
  id: string;
84
+ address: string;
85
+ scopes: `${string}:${string}`[];
83
86
  options: Record<string, import("@metamask/utils").Json> & {
84
87
  entropy?: {
85
88
  type: "mnemonic";
@@ -93,8 +96,6 @@ export declare const EthErc4337AccountStruct: import("@metamask/superstruct").St
93
96
  };
94
97
  exportable?: boolean;
95
98
  };
96
- address: string;
97
- scopes: `${string}:${string}`[];
98
99
  methods: ("personal_sign" | "eth_sign" | "eth_signTypedData_v1" | "eth_signTypedData_v3" | "eth_signTypedData_v4" | "eth_prepareUserOperation" | "eth_patchUserOperation" | "eth_signUserOperation")[];
99
100
  }, {
100
101
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,EAAE,QAAQ,EAAE,oBAAU;AAO7B,eAAO,MAAM,cAAc,sDAA+C,CAAC;AAG3E,eAAO,MAAM,gBAAgB,sDAAiD,CAAC;AAE/E,eAAO,MAAM,sBAAsB,6DAGlC,CAAC;AAEF,eAAO,MAAM,gBAAgB,sDAG5B,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS;IAEnB,YAAY,kBAAkB;IAC9B,IAAI,aAAa;IACjB,eAAe,wBAAwB;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H;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;EAWH,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;IAGlC;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;EAaH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -3,7 +3,10 @@ import { nonempty, array, enums, literal } from "@metamask/superstruct";
3
3
  import { definePattern } from "@metamask/utils";
4
4
  import { EthScope } from "./index.mjs";
5
5
  import { CaipChainIdStruct, EthAccountType, KeyringAccountStruct } from "../api/index.mjs";
6
- export const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);
6
+ const ETH_BYTES_REGEX = /^0x[0-9a-f]*$/iu;
7
+ export const EthBytesStruct = definePattern('EthBytes', ETH_BYTES_REGEX);
8
+ // Stricter struct that uses `Hex` as final type.
9
+ export const EthBytesStrictStruct = definePattern('EthBytesStrict', ETH_BYTES_REGEX);
7
10
  const ETH_ADDRESS_REGEX = /^0x[0-9a-f]{40}$/iu;
8
11
  export const EthAddressStruct = definePattern('EthAddress', ETH_ADDRESS_REGEX);
9
12
  // Stricter struct that uses `Hex` as final type.
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gCAAgC;AAEjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AACxE,OAAO,EAAE,aAAa,EAAE,wBAAwB;AAGhD,OAAO,EAAE,QAAQ,EAAE,oBAAU;AAC7B,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACr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E;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;KAC/B,CAAC,CACH;CACF,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;IAC5C,GAAG,oBAAoB,CAAC,MAAM;IAE9B;;OAEG;IACH,OAAO,EAAE,gBAAgB;IAEzB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;IAE1C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE1C;;OAEG;IACH,OAAO,EAAE,KAAK,CACZ,KAAK,CAAC;QACJ,GAAG,SAAS,CAAC,YAAY,EAAE;QAC3B,GAAG,SAAS,CAAC,IAAI,EAAE;QACnB,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,eAAe,EAAE;QAC9B,GAAG,SAAS,CAAC,oBAAoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, literal } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\nimport type { Hex } from '@metamask/utils';\n\nimport { EthScope } from '.';\nimport {\n CaipChainIdStruct,\n EthAccountType,\n KeyringAccountStruct,\n} from '../api';\n\nexport const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);\n\nconst ETH_ADDRESS_REGEX = /^0x[0-9a-f]{40}$/iu;\nexport const EthAddressStruct = definePattern('EthAddress', ETH_ADDRESS_REGEX);\n// Stricter struct that uses `Hex` as final type.\nexport const EthAddressStrictStruct = definePattern<Hex>(\n 'EthAddressStrict',\n ETH_ADDRESS_REGEX,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account scopes (must be ['eip155:0']).\n */\n scopes: nonempty(array(literal(EthScope.Eoa))),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gCAAgC;AAEjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B;AACxE,OAAO,EAAE,aAAa,EAAE,wBAAwB;AAGhD,OAAO,EAAE,QAAQ,EAAE,oBAAU;AAC7B,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACrB,yBAAe;AAEhB,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AACzE,iDAAiD;AACjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAC/C,gBAAgB,EAChB,eAAe,CAChB,CAAC;AAEF,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;AAC/E,iDAAiD;AACjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CACjD,kBAAkB,EAClB,iBAAiB,CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,YAAY,EACZ,6BAA6B,CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,0BAA0B;IAC1B,2CAA8B,CAAA;IAC9B,8BAAiB,CAAA;IACjB,oDAAuC,CAAA;IACvC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,mBAAmB;IACnB,8DAAiD,CAAA;IACjD,0DAA6C,CAAA;I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AoB,EAAE;QACnC,GAAG,SAAS,CAAC,kBAAkB,EAAE;QACjC,GAAG,SAAS,CAAC,iBAAiB,EAAE;KACjC,CAAC,CACH;CACF,CAAC,CAAC","sourcesContent":["import { object } from '@metamask/keyring-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport { nonempty, array, enums, literal } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\nimport type { Hex } from '@metamask/utils';\n\nimport { EthScope } from '.';\nimport {\n CaipChainIdStruct,\n EthAccountType,\n KeyringAccountStruct,\n} from '../api';\n\nconst ETH_BYTES_REGEX = /^0x[0-9a-f]*$/iu;\nexport const EthBytesStruct = definePattern('EthBytes', ETH_BYTES_REGEX);\n// Stricter struct that uses `Hex` as final type.\nexport const EthBytesStrictStruct = definePattern<Hex>(\n 'EthBytesStrict',\n ETH_BYTES_REGEX,\n);\n\nconst ETH_ADDRESS_REGEX = /^0x[0-9a-f]{40}$/iu;\nexport const EthAddressStruct = definePattern('EthAddress', ETH_ADDRESS_REGEX);\n// Stricter struct that uses `Hex` as final type.\nexport const EthAddressStrictStruct = definePattern<Hex>(\n 'EthAddressStrict',\n ETH_ADDRESS_REGEX,\n);\n\nexport const EthUint256Struct = definePattern(\n 'EthUint256',\n /^0x([1-9a-f][0-9a-f]*|0)$/iu,\n);\n\n/**\n * Supported Ethereum methods.\n */\nexport enum EthMethod {\n // General signing methods\n PersonalSign = 'personal_sign',\n Sign = 'eth_sign',\n SignTransaction = 'eth_signTransaction',\n SignTypedDataV1 = 'eth_signTypedData_v1',\n SignTypedDataV3 = 'eth_signTypedData_v3',\n SignTypedDataV4 = 'eth_signTypedData_v4',\n // ERC-4337 methods\n PrepareUserOperation = 'eth_prepareUserOperation',\n PatchUserOperation = 'eth_patchUserOperation',\n SignUserOperation = 'eth_signUserOperation',\n}\n\nexport const EthEoaAccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Eoa}`),\n\n /**\n * Account scopes (must be ['eip155:0']).\n */\n scopes: nonempty(array(literal(EthScope.Eoa))),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTransaction}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n ]),\n ),\n});\n\nexport type EthEoaAccount = Infer<typeof EthEoaAccountStruct>;\n\nexport const EthErc4337AccountStruct = object({\n ...KeyringAccountStruct.schema,\n\n /**\n * Account address.\n */\n address: EthAddressStruct,\n\n /**\n * Account type.\n */\n type: literal(`${EthAccountType.Erc4337}`),\n\n /**\n * Account supported scopes (CAIP-2 chain IDs).\n */\n scopes: nonempty(array(CaipChainIdStruct)),\n\n /**\n * Account supported methods.\n */\n methods: array(\n enums([\n `${EthMethod.PersonalSign}`,\n `${EthMethod.Sign}`,\n `${EthMethod.SignTypedDataV1}`,\n `${EthMethod.SignTypedDataV3}`,\n `${EthMethod.SignTypedDataV4}`,\n `${EthMethod.PrepareUserOperation}`,\n `${EthMethod.PatchUserOperation}`,\n `${EthMethod.SignUserOperation}`,\n ]),\n ),\n});\n\nexport type EthErc4337Account = Infer<typeof EthErc4337AccountStruct>;\n"]}