@metamask-previews/keyring-utils 2.0.0-d9aa015 → 2.1.1-41bce29
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 +17 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +1 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.1.1]
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Export `Keyring` and `KeyringClass` types from package root ([#208](https://github.com/MetaMask/accounts/pull/208))
|
|
15
|
+
|
|
16
|
+
## [2.1.0]
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Add `Keyring` and `KeyringClass` types ([#201](https://github.com/MetaMask/accounts/pull/201)), ([#205](https://github.com/MetaMask/accounts/pull/205))
|
|
21
|
+
- The two types have been migrated from `@metamask/utils`.
|
|
22
|
+
- The `State` generic accepted by the two types was removed, and the `deserialize` and `serialize` signatures were updated to use `Json` instead of `State` as argument and return types.
|
|
23
|
+
|
|
10
24
|
## [2.0.0]
|
|
11
25
|
|
|
12
26
|
### Changed
|
|
@@ -51,7 +65,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
51
65
|
- This new version fixes a bug with CJS re-exports.
|
|
52
66
|
- Initial release ([#24](https://github.com/MetaMask/accounts/pull/24))
|
|
53
67
|
|
|
54
|
-
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-utils@2.
|
|
68
|
+
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-utils@2.1.1...HEAD
|
|
69
|
+
[2.1.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-utils@2.1.0...@metamask/keyring-utils@2.1.1
|
|
70
|
+
[2.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-utils@2.0.0...@metamask/keyring-utils@2.1.0
|
|
55
71
|
[2.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-utils@1.3.1...@metamask/keyring-utils@2.0.0
|
|
56
72
|
[1.3.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-utils@1.3.0...@metamask/keyring-utils@1.3.1
|
|
57
73
|
[1.3.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-utils@1.2.0...@metamask/keyring-utils@1.3.0
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAsB;AACtB,8CAAwB;AACxB,+CAAyB;AACzB,oDAA8B;AAC9B,uDAAiC","sourcesContent":["export * from './btc';\nexport * from './types';\nexport * from './typing';\nexport * from './superstruct';\nexport * from './JsonRpcRequest';\n"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAsB;AACtB,8CAAwB;AACxB,+CAAyB;AACzB,oDAA8B;AAC9B,uDAAiC","sourcesContent":["export * from './btc';\nexport * from './types';\nexport * from './typing';\nexport * from './superstruct';\nexport * from './JsonRpcRequest';\nexport type * from './keyring';\n"]}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,4BAAwB;AACxB,6BAAyB;AACzB,kCAA8B;AAC9B,qCAAiC"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,4BAAwB;AACxB,6BAAyB;AACzB,kCAA8B;AAC9B,qCAAiC;AACjC,mCAA+B"}
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,4BAAwB;AACxB,6BAAyB;AACzB,kCAA8B;AAC9B,qCAAiC"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,4BAAwB;AACxB,6BAAyB;AACzB,kCAA8B;AAC9B,qCAAiC;AACjC,mCAA+B"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,4BAAwB;AACxB,6BAAyB;AACzB,kCAA8B;AAC9B,qCAAiC","sourcesContent":["export * from './btc';\nexport * from './types';\nexport * from './typing';\nexport * from './superstruct';\nexport * from './JsonRpcRequest';\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gCAAsB;AACtB,4BAAwB;AACxB,6BAAyB;AACzB,kCAA8B;AAC9B,qCAAiC","sourcesContent":["export * from './btc';\nexport * from './types';\nexport * from './typing';\nexport * from './superstruct';\nexport * from './JsonRpcRequest';\nexport type * from './keyring';\n"]}
|
package/dist/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAAA,uDAA2D;AAC3D,2CAAgD;AAEhD;;GAEG;AACU,QAAA,UAAU,GAAG,IAAA,qBAAa,EACrC,QAAQ,EACR,yEAAyE,CAC1E,CAAC;AACF;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAU,CAAC,CAAC,oCAAoC;
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAAA,uDAA2D;AAC3D,2CAAgD;AAEhD;;GAEG;AACU,QAAA,UAAU,GAAG,IAAA,qBAAa,EACrC,QAAQ,EACR,yEAAyE,CAC1E,CAAC;AACF;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAU,CAAC,CAAC,oCAAoC;AAG/E;;;;;GAKG;AACU,QAAA,SAAS,GAAG,IAAA,oBAAM,EAAS,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAe,CAAC,CAAC;QACrC,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,kBAAkB,GAAG,IAAA,qBAAa,EAC7C,cAAc,EACd,gBAAgB,CACjB,CAAC","sourcesContent":["import { define, type Infer } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\n\n/**\n * UUIDv4 struct.\n */\nexport const UuidStruct = definePattern(\n 'UuidV4',\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu,\n);\n/**\n * Account ID (UUIDv4).\n */\nexport const AccountIdStruct = UuidStruct; // Alias for better naming purposes.\nexport type AccountId = Infer<typeof AccountIdStruct>; // Alias for better naming purposes.\n\n/**\n * Validates if a given value is a valid URL.\n *\n * @param value - The value to be validated.\n * @returns A boolean indicating if the value is a valid URL.\n */\nexport const UrlStruct = define<string>('Url', (value: unknown) => {\n try {\n const url = new URL(value as string);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n return false;\n }\n});\n\n/**\n * A string which contains a positive float number.\n */\nexport const StringNumberStruct = definePattern(\n 'StringNumber',\n /^\\d+(\\.\\d+)?$/u,\n);\nexport type StringNumber = Infer<typeof StringNumberStruct>;\n\n/**\n * This is a helper type used by the {@link Equals} type.\n */\ntype EqualsHelper<Type> = <Dummy>() => Dummy extends Type ? 1 : 2;\n\n/**\n * A utility type that checks whether two types are exactly the same.\n *\n * This type evaluates to `true` if `TypeA` and `TypeB` are identical,\n * otherwise it evaluates to `false`.\n *\n * @template TypeA - The first type to compare.\n * @template TypeB - The second type to compare.\n *\n * @example\n * ```ts\n * // Example usage:\n * type Test1 = Equals<number, number>; // true\n * type Test2 = Equals<number, string>; // false\n * type Test3 = Equals<{ a: string }, { a: string }>; // true\n * type Test4 = Equals<{ a: string }, { a: number }>; // false\n * ```\n */\nexport type Equals<TypeA, TypeB> =\n EqualsHelper<TypeA> extends EqualsHelper<TypeB> ? true : false;\n"]}
|
package/dist/types.d.cts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const UuidStruct: import("@metamask/superstruct").Struct<string,
|
|
|
7
7
|
* Account ID (UUIDv4).
|
|
8
8
|
*/
|
|
9
9
|
export declare const AccountIdStruct: import("@metamask/superstruct").Struct<string, null>;
|
|
10
|
+
export type AccountId = Infer<typeof AccountIdStruct>;
|
|
10
11
|
/**
|
|
11
12
|
* Validates if a given value is a valid URL.
|
|
12
13
|
*
|
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,KAAK,EAAE,8BAA8B;AAG3D;;GAEG;AACH,eAAO,MAAM,UAAU,sDAGtB,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,sDAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,KAAK,EAAE,8BAA8B;AAG3D;;GAEG;AACH,eAAO,MAAM,UAAU,sDAGtB,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,sDAAa,CAAC;AAC1C,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,sDAOpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAG9B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE5D;;GAEG;AACH,KAAK,YAAY,CAAC,IAAI,IAAI,CAAC,KAAK,OAAO,KAAK,SAAS,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,MAAM,CAAC,KAAK,EAAE,KAAK,IAC7B,YAAY,CAAC,KAAK,CAAC,SAAS,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
|
package/dist/types.d.mts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const UuidStruct: import("@metamask/superstruct").Struct<string,
|
|
|
7
7
|
* Account ID (UUIDv4).
|
|
8
8
|
*/
|
|
9
9
|
export declare const AccountIdStruct: import("@metamask/superstruct").Struct<string, null>;
|
|
10
|
+
export type AccountId = Infer<typeof AccountIdStruct>;
|
|
10
11
|
/**
|
|
11
12
|
* Validates if a given value is a valid URL.
|
|
12
13
|
*
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,KAAK,EAAE,8BAA8B;AAG3D;;GAEG;AACH,eAAO,MAAM,UAAU,sDAGtB,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,sDAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,KAAK,EAAE,8BAA8B;AAG3D;;GAEG;AACH,eAAO,MAAM,UAAU,sDAGtB,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,sDAAa,CAAC;AAC1C,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,sDAOpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAG9B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE5D;;GAEG;AACH,KAAK,YAAY,CAAC,IAAI,IAAI,CAAC,KAAK,OAAO,KAAK,SAAS,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,MAAM,CAAC,KAAK,EAAE,KAAK,IAC7B,YAAY,CAAC,KAAK,CAAC,SAAS,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
|
package/dist/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,8BAA8B;AAC3D,OAAO,EAAE,aAAa,EAAE,wBAAwB;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CACrC,QAAQ,EACR,yEAAyE,CAC1E,CAAC;AACF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC,CAAC,oCAAoC;
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,8BAA8B;AAC3D,OAAO,EAAE,aAAa,EAAE,wBAAwB;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CACrC,QAAQ,EACR,yEAAyE,CAC1E,CAAC;AACF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC,CAAC,oCAAoC;AAG/E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAS,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAe,CAAC,CAAC;QACrC,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAC7C,cAAc,EACd,gBAAgB,CACjB,CAAC","sourcesContent":["import { define, type Infer } from '@metamask/superstruct';\nimport { definePattern } from '@metamask/utils';\n\n/**\n * UUIDv4 struct.\n */\nexport const UuidStruct = definePattern(\n 'UuidV4',\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu,\n);\n/**\n * Account ID (UUIDv4).\n */\nexport const AccountIdStruct = UuidStruct; // Alias for better naming purposes.\nexport type AccountId = Infer<typeof AccountIdStruct>; // Alias for better naming purposes.\n\n/**\n * Validates if a given value is a valid URL.\n *\n * @param value - The value to be validated.\n * @returns A boolean indicating if the value is a valid URL.\n */\nexport const UrlStruct = define<string>('Url', (value: unknown) => {\n try {\n const url = new URL(value as string);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n return false;\n }\n});\n\n/**\n * A string which contains a positive float number.\n */\nexport const StringNumberStruct = definePattern(\n 'StringNumber',\n /^\\d+(\\.\\d+)?$/u,\n);\nexport type StringNumber = Infer<typeof StringNumberStruct>;\n\n/**\n * This is a helper type used by the {@link Equals} type.\n */\ntype EqualsHelper<Type> = <Dummy>() => Dummy extends Type ? 1 : 2;\n\n/**\n * A utility type that checks whether two types are exactly the same.\n *\n * This type evaluates to `true` if `TypeA` and `TypeB` are identical,\n * otherwise it evaluates to `false`.\n *\n * @template TypeA - The first type to compare.\n * @template TypeB - The second type to compare.\n *\n * @example\n * ```ts\n * // Example usage:\n * type Test1 = Equals<number, number>; // true\n * type Test2 = Equals<number, string>; // false\n * type Test3 = Equals<{ a: string }, { a: string }>; // true\n * type Test4 = Equals<{ a: string }, { a: number }>; // false\n * ```\n */\nexport type Equals<TypeA, TypeB> =\n EqualsHelper<TypeA> extends EqualsHelper<TypeB> ? true : false;\n"]}
|