@metamask-previews/utils 12.0.0-preview-df6c65973 → 12.0.0-preview-3e86f66f7
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 +0 -1
- package/dist/mnemonic.d.ts +0 -1
- package/dist/mnemonic.d.ts.map +1 -1
- package/dist/mnemonic.js +0 -1
- package/dist/mnemonic.js.map +1 -1
- package/dist/promise.d.ts +0 -1
- package/dist/promise.d.ts.map +1 -1
- package/dist/promise.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
|
|
12
12
|
- This package was migrated from `MetaMask/utils` to the `MetaMask/core` monorepo ([#10175](https://github.com/MetaMask/core/pull/10175))
|
|
13
13
|
- See [MetaMask/utils](https://github.com/MetaMask/utils/blob/main/CHANGELOG.md) for the original changelog, which covers every release up to and including `12.0.0`.
|
|
14
|
-
- Bump `uuid` from `^9.0.1` to `^11.1.1` ([#10243](https://github.com/MetaMask/core/pull/10243))
|
|
15
14
|
|
|
16
15
|
[Unreleased]: https://github.com/MetaMask/core/
|
package/dist/mnemonic.d.ts
CHANGED
package/dist/mnemonic.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mnemonic.d.ts","sourceRoot":"","sources":["../src/mnemonic.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"mnemonic.d.ts","sourceRoot":"","sources":["../src/mnemonic.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAYnE;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAG7E"}
|
package/dist/mnemonic.js
CHANGED
|
@@ -2,7 +2,6 @@ import * as englishWordlist from '@metamask/scure-bip39/dist/wordlists/english.j
|
|
|
2
2
|
const { wordlist } = englishWordlist;
|
|
3
3
|
/**
|
|
4
4
|
* Transform a typed array containing mnemonic data to the seed phrase.
|
|
5
|
-
*
|
|
6
5
|
* @param uint8Array - Typed array containing mnemonic data.
|
|
7
6
|
* @returns The seed phrase.
|
|
8
7
|
*/
|
package/dist/mnemonic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mnemonic.js","sourceRoot":"","sources":["../src/mnemonic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,iDAAiD,CAAC;AAEnF,MAAM,EAAE,QAAQ,EAAE,GAAG,eAAe,CAAC;AAErC
|
|
1
|
+
{"version":3,"file":"mnemonic.js","sourceRoot":"","sources":["../src/mnemonic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,iDAAiD,CAAC;AAEnF,MAAM,EAAE,QAAQ,EAAE,GAAG,eAAe,CAAC;AAErC;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAsB;IACzD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IAED,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CACjC,IAAI,WAAW,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CACnD,CAAC;IAEF,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gCAAgC,CAAC,QAAgB;IAC/D,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1E,OAAO,IAAI,UAAU,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC","sourcesContent":["import * as englishWordlist from '@metamask/scure-bip39/dist/wordlists/english.js';\n\nconst { wordlist } = englishWordlist;\n\n/**\n * Transform a typed array containing mnemonic data to the seed phrase.\n * @param uint8Array - Typed array containing mnemonic data.\n * @returns The seed phrase.\n */\nexport function uint8ArrayToMnemonic(uint8Array: Uint8Array): string {\n if (uint8Array.length === 0) {\n throw new Error(\n 'The method uint8ArrayToMnemonic expects a non-empty array',\n );\n }\n\n const recoveredIndices = Array.from(\n new Uint16Array(new Uint8Array(uint8Array).buffer),\n );\n\n return recoveredIndices.map((i) => wordlist[i]).join(' ');\n}\n\n/**\n * Encodes a BIP-39 mnemonic as the indices of words in the English BIP-39 wordlist.\n *\n * @param mnemonic - The BIP-39 mnemonic.\n * @returns The Unicode code points for the seed phrase formed from the words in the wordlist.\n */\nexport function convertMnemonicToWordlistIndices(mnemonic: string): Uint8Array {\n const indices = mnemonic.split(' ').map((word) => wordlist.indexOf(word));\n return new Uint8Array(new Uint16Array(indices).buffer);\n}\n"]}
|
package/dist/promise.d.ts
CHANGED
package/dist/promise.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../src/promise.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../src/promise.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,CAAC,MAAM,GAAG,IAAI,IAAI;IAC3C;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;OAEG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,GAAG,IAAI,EAAE,EACnD,0BAAkC,GACnC,GAAE;IACD,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACjC,GAAG,eAAe,CAAC,MAAM,CAAC,CAyB/B"}
|
package/dist/promise.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise.js","sourceRoot":"","sources":["../src/promise.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"promise.js","sourceRoot":"","sources":["../src/promise.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,qBAAqB,CAAgB,EACnD,0BAA0B,GAAG,KAAK,GACnC,GAEG,EAAE;IACJ,IAAI,OAA2C,CAAC;IAChD,IAAI,MAAyC,CAAC;IAC9C;;qBAEiB;IACjB,MAAM,OAAO,GAAG,IAAI,OAAO,CACzB,CACE,YAAgD,EAChD,WAA8C,EAC9C,EAAE;QACF,OAAO,GAAG,YAAY,CAAC;QACvB,MAAM,GAAG,WAAW,CAAC;IACvB,CAAC,CACF,CAAC;IACF,uCAAuC;IAEvC,IAAI,0BAA0B,EAAE,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;YACvB,uEAAuE;QACzE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,2EAA2E;IAC3E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC","sourcesContent":["/**\n * A deferred Promise.\n *\n * A deferred Promise is one that can be resolved or rejected independently of\n * the Promise construction.\n * @template Result - The result type of the Promise.\n */\nexport type DeferredPromise<Result = void> = {\n /**\n * The Promise that has been deferred.\n */\n promise: Promise<Result>;\n /**\n * A function that resolves the Promise.\n */\n resolve: (result: Result) => void;\n /**\n * A function that rejects the Promise.\n */\n reject: (error: unknown) => void;\n};\n\n/**\n * Create a defered Promise.\n *\n * If the Promise is rejected prior to a handler being added, this can result in an\n * `UnhandledPromiseRejection` error. Optionally this can be suppressed with the\n * `suppressUnhandledRejection` flag, as it's common to belatedly handle deferred Promises, or to\n * ignore them if they're no longer relevant (e.g. related to a cancelled request).\n *\n * However, be very careful that you have handled the Promise if you do this. Suppressing these\n * errors is dangerous, they exist for good reason. An unhandled rejection can hide errors, making\n * debugging extremely difficult. They should only be suppressed if you're confident that the\n * Promise is always handled correctly, in both the success and failure cases.\n *\n * @param args - The arguments.\n * @param args.suppressUnhandledRejection - This option adds an empty error handler\n * to the Promise to suppress the UnhandledPromiseRejection error. This can be\n * useful if the deferred Promise is sometimes intentionally not used.\n * @returns A deferred Promise.\n * @template Result - The result type of the Promise.\n */\nexport function createDeferredPromise<Result = void>({\n suppressUnhandledRejection = false,\n}: {\n suppressUnhandledRejection?: boolean;\n} = {}): DeferredPromise<Result> {\n let resolve: DeferredPromise<Result>['resolve'];\n let reject: DeferredPromise<Result>['reject'];\n /* eslint-disable promise/param-names -- Deliberately not named\n 'resolve'/'reject' so they do not shadow the outer bindings assigned\n just below. */\n const promise = new Promise<Result>(\n (\n innerResolve: DeferredPromise<Result>['resolve'],\n innerReject: DeferredPromise<Result>['reject'],\n ) => {\n resolve = innerResolve;\n reject = innerReject;\n },\n );\n /* eslint-enable promise/param-names */\n\n if (suppressUnhandledRejection) {\n promise.catch((_error) => {\n // This handler is used to suppress the UnhandledPromiseRejection error\n });\n }\n\n // @ts-expect-error We know that these are assigned, but TypeScript doesn't\n return { promise, resolve, reject };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/utils",
|
|
3
|
-
"version": "12.0.0-preview-
|
|
3
|
+
"version": "12.0.0-preview-3e86f66f7",
|
|
4
4
|
"description": "Various JavaScript/TypeScript utilities of wide relevance to the MetaMask codebase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ethereum",
|
|
@@ -68,12 +68,13 @@
|
|
|
68
68
|
"lodash": "^4.17.21",
|
|
69
69
|
"pony-cause": "^2.1.10",
|
|
70
70
|
"semver": "^7.6.3",
|
|
71
|
-
"uuid": "^
|
|
71
|
+
"uuid": "^9.0.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@metamask/auto-changelog": "^6.1.0",
|
|
75
75
|
"@types/jest": "^30.0.0",
|
|
76
76
|
"@types/jest-when": "^3.5.3",
|
|
77
|
+
"@types/uuid": "^9.0.8",
|
|
77
78
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
78
79
|
"deepmerge": "^4.2.2",
|
|
79
80
|
"jest": "^30.4.2",
|