@metamask-previews/keyring-api 23.1.0-de887b2 → 23.2.0-7540e4c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -4
- package/dist/eth/types.cjs +5 -2
- package/dist/eth/types.cjs.map +1 -1
- package/dist/eth/types.d.cts +1 -0
- package/dist/eth/types.d.cts.map +1 -1
- package/dist/eth/types.d.mts +1 -0
- package/dist/eth/types.d.mts.map +1 -1
- package/dist/eth/types.mjs +4 -1
- package/dist/eth/types.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,9 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [23.2.0]
|
|
11
|
+
|
|
10
12
|
### Added
|
|
11
13
|
|
|
12
14
|
- Add Stellar method `signAuthEntry` to `XlmMethod` ([#548](https://github.com/MetaMask/accounts/pull/548))
|
|
15
|
+
- Add `EthBytesStrictStruct` ([#555](https://github.com/MetaMask/accounts/pull/555))
|
|
13
16
|
|
|
14
17
|
### Changed
|
|
15
18
|
|
|
@@ -44,7 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
44
47
|
- `KeyringCapabilities`, `KeyringType`, account creation options (except `CreateAccountOptions`), and account export options are now exclusively available from `@metamask/keyring-api/v2`.
|
|
45
48
|
- `CreateAccountOptions` and its subtypes (`Bip44CreateAccountOptions`, `PrivateKeyCreateAccountOptions`, `CustomCreateAccountOptions`) remain available from both `@metamask/keyring-api` and `@metamask/keyring-api/v2`.
|
|
46
49
|
- Improve return type of `isKeyringRpcMethod` to use type predicate `method is KeyringRpcMethod` ([#408](https://github.com/MetaMask/accounts/pull/408))
|
|
47
|
-
- Bump `@metamask/utils` from `^11.1.0` to `^11.11.0` ([#489](https://github.com/MetaMask/accounts/pull/489)
|
|
50
|
+
- Bump `@metamask/utils` from `^11.1.0` to `^11.11.0` ([#489](https://github.com/MetaMask/accounts/pull/489), [#483](https://github.com/MetaMask/accounts/pull/483))
|
|
48
51
|
|
|
49
52
|
## [22.0.0]
|
|
50
53
|
|
|
@@ -97,7 +100,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
97
100
|
- Add `AccountCreationType.Custom` and `CreateAccountCustomOptions` for custom account creation flows.
|
|
98
101
|
- Add `EthKeyringWrapper` abstract class for Ethereum-based `KeyringV2` implementations ([#404](https://github.com/MetaMask/accounts/pull/404))
|
|
99
102
|
- Provides common Ethereum signing method routing (`submitRequest`) for all Ethereum-based keyrings.
|
|
100
|
-
- Add `KeyringWrapper` base class to adapt legacy keyrings to `KeyringV2` ([#398](https://github.com/MetaMask/accounts/pull/398)
|
|
103
|
+
- Add `KeyringWrapper` base class to adapt legacy keyrings to `KeyringV2` ([#398](https://github.com/MetaMask/accounts/pull/398), [#402](https://github.com/MetaMask/accounts/pull/402), [#409](https://github.com/MetaMask/accounts/pull/409), [#410](https://github.com/MetaMask/accounts/pull/410))
|
|
101
104
|
|
|
102
105
|
### Changed
|
|
103
106
|
|
|
@@ -138,7 +141,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
138
141
|
|
|
139
142
|
### Added
|
|
140
143
|
|
|
141
|
-
- **BREAKING:** Add new bitcoin methods to `BtcMethod` enum ([#355](https://github.com/MetaMask/accounts/pull/355)
|
|
144
|
+
- **BREAKING:** Add new bitcoin methods to `BtcMethod` enum ([#355](https://github.com/MetaMask/accounts/pull/355), [#356](https://github.com/MetaMask/accounts/pull/356))
|
|
142
145
|
- This change was not properly reported as breaking on the `20.1.1`.
|
|
143
146
|
|
|
144
147
|
### Removed
|
|
@@ -757,7 +760,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
757
760
|
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
|
|
758
761
|
- Helper functions to create keyring handler in the snap.
|
|
759
762
|
|
|
760
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@23.
|
|
763
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@23.2.0...HEAD
|
|
764
|
+
[23.2.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@23.1.0...@metamask/keyring-api@23.2.0
|
|
761
765
|
[23.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@23.0.1...@metamask/keyring-api@23.1.0
|
|
762
766
|
[23.0.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@23.0.0...@metamask/keyring-api@23.0.1
|
|
763
767
|
[23.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@22.0.0...@metamask/keyring-api@23.0.0
|
package/dist/eth/types.cjs
CHANGED
|
@@ -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
|
-
|
|
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.
|
package/dist/eth/types.cjs.map
CHANGED
|
@@ -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;
|
|
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;IACnB,0BAA0B;IAC1B,2CAA8B,CAAA;IAC9B,8BAAiB,CAAA;IACjB,oDAA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,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"]}
|
package/dist/eth/types.d.cts
CHANGED
|
@@ -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>;
|
package/dist/eth/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,EAAE,QAAQ,EAAE,oBAAU;
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/eth/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,EAAE,QAAQ,EAAE,oBAAU;AAQ7B,eAAO,MAAM,cAAc,sDAA6C,CAAC;AAEzE,eAAO,MAAM,oBAAoB,6DAGhC,CAAC;AAGF,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;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"}
|
package/dist/eth/types.d.mts
CHANGED
|
@@ -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>;
|
package/dist/eth/types.d.mts.map
CHANGED
|
@@ -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;
|
|
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;AAQ7B,eAAO,MAAM,cAAc,sDAA6C,CAAC;AAEzE,eAAO,MAAM,oBAAoB,6DAGhC,CAAC;AAGF,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;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"}
|
package/dist/eth/types.mjs
CHANGED
|
@@ -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
|
-
|
|
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.
|
package/dist/eth/types.mjs.map
CHANGED
|
@@ -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,EACrB,yBAAe;AAEhB,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,EAAE,
|
|
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,M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EG;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\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"]}
|