@metamask-previews/accounts-controller 23.0.1-preview-f51ef7f8 → 23.1.0-preview-cb58d7d1
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 -1
- package/dist/AccountsController.cjs +40 -8
- package/dist/AccountsController.cjs.map +1 -1
- package/dist/AccountsController.d.cts +6 -6
- package/dist/AccountsController.d.cts.map +1 -1
- package/dist/AccountsController.d.mts +6 -6
- package/dist/AccountsController.d.mts.map +1 -1
- package/dist/AccountsController.mjs +40 -8
- package/dist/AccountsController.mjs.map +1 -1
- package/dist/tests/mocks.cjs.map +1 -1
- package/dist/tests/mocks.d.cts +3 -2
- package/dist/tests/mocks.d.cts.map +1 -1
- package/dist/tests/mocks.d.mts +3 -2
- package/dist/tests/mocks.d.mts.map +1 -1
- package/dist/tests/mocks.mjs.map +1 -1
- package/dist/types.cjs +5 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +7 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +7 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +4 -0
- package/dist/types.mjs.map +1 -0
- package/dist/utils.cjs +6 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +3 -0
- package/dist/utils.d.cts.map +1 -1
- package/dist/utils.d.mts +3 -0
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +6 -0
- package/dist/utils.mjs.map +1 -1
- package/package.json +5 -3
package/dist/utils.d.mts
CHANGED
@@ -9,18 +9,21 @@ import type { V4Options } from "uuid";
|
|
9
9
|
export declare function keyringTypeToName(keyringType: string): string;
|
10
10
|
/**
|
11
11
|
* Generates a UUID v4 options from a given Ethereum address.
|
12
|
+
*
|
12
13
|
* @param address - The Ethereum address to generate the UUID from.
|
13
14
|
* @returns The UUID v4 options.
|
14
15
|
*/
|
15
16
|
export declare function getUUIDOptionsFromAddressOfNormalAccount(address: string): V4Options;
|
16
17
|
/**
|
17
18
|
* Generates a UUID from a given Ethereum address.
|
19
|
+
*
|
18
20
|
* @param address - The Ethereum address to generate the UUID from.
|
19
21
|
* @returns The generated UUID.
|
20
22
|
*/
|
21
23
|
export declare function getUUIDFromAddressOfNormalAccount(address: string): string;
|
22
24
|
/**
|
23
25
|
* Check if a keyring type is considered a "normal" keyring.
|
26
|
+
*
|
24
27
|
* @param keyringType - The account's keyring type.
|
25
28
|
* @returns True if the keyring type is considered a "normal" keyring, false otherwise.
|
26
29
|
*/
|
package/dist/utils.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,YAAY,EAAE,qCAAqC;AAE9E,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa;AAGtC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,
|
1
|
+
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,YAAY,EAAE,qCAAqC;AAE9E,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa;AAGtC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAoC7D;AAED;;;;;GAKG;AACH,wBAAgB,wCAAwC,CACtD,OAAO,EAAE,MAAM,GACd,SAAS,CAMX;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,YAAY,GAAG,OAAO,CAItE"}
|
package/dist/utils.mjs
CHANGED
@@ -24,6 +24,9 @@ export function keyringTypeToName(keyringType) {
|
|
24
24
|
case KeyringTypes.trezor: {
|
25
25
|
return 'Trezor';
|
26
26
|
}
|
27
|
+
case KeyringTypes.oneKey: {
|
28
|
+
return 'OneKey';
|
29
|
+
}
|
27
30
|
case KeyringTypes.ledger: {
|
28
31
|
return 'Ledger';
|
29
32
|
}
|
@@ -43,6 +46,7 @@ export function keyringTypeToName(keyringType) {
|
|
43
46
|
}
|
44
47
|
/**
|
45
48
|
* Generates a UUID v4 options from a given Ethereum address.
|
49
|
+
*
|
46
50
|
* @param address - The Ethereum address to generate the UUID from.
|
47
51
|
* @returns The UUID v4 options.
|
48
52
|
*/
|
@@ -54,6 +58,7 @@ export function getUUIDOptionsFromAddressOfNormalAccount(address) {
|
|
54
58
|
}
|
55
59
|
/**
|
56
60
|
* Generates a UUID from a given Ethereum address.
|
61
|
+
*
|
57
62
|
* @param address - The Ethereum address to generate the UUID from.
|
58
63
|
* @returns The generated UUID.
|
59
64
|
*/
|
@@ -62,6 +67,7 @@ export function getUUIDFromAddressOfNormalAccount(address) {
|
|
62
67
|
}
|
63
68
|
/**
|
64
69
|
* Check if a keyring type is considered a "normal" keyring.
|
70
|
+
*
|
65
71
|
* @param keyringType - The account's keyring type.
|
66
72
|
* @returns True if the keyring type is considered a "normal" keyring, false otherwise.
|
67
73
|
*/
|
package/dist/utils.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,yBAAyB;AAC5C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,qCAAqC;AAC9E,OAAO,EAAE,MAAM,EAAE,qCAAqC;AAEtD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,aAAa;AAElC;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,qEAAqE;IACrE,4CAA4C;IAC5C,IAAI,gBAAgB,CAAC,WAAW,CAAC,EAAE;QACjC,OAAO,SAAS,CAAC;KAClB;IAED,QAAQ,WAAW,EAAE;QACnB,KAAK,YAAY,CAAC,MAAM,CAAC,CAAC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,YAAY,CAAC,MAAM,CAAC,CAAC;YACxB,OAAO,QAAQ,CAAC;SACjB;QACD,KAAK,YAAY,CAAC,MAAM,CAAC,CAAC;YACxB,OAAO,QAAQ,CAAC;SACjB;QACD,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC;YACzB,OAAO,SAAS,CAAC;SAClB;QACD,KAAK,YAAY,CAAC,EAAE,CAAC,CAAC;YACpB,OAAO,IAAI,CAAC;SACb;QACD,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;YACtB,OAAO,cAAc,CAAC;SACvB;QACD,OAAO,CAAC,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,mBAAmB,WAAW,EAAE,CAAC,CAAC;SACnD;KACF;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wCAAwC,CACtD,OAAe;IAEf,MAAM,SAAS,GAAG;QAChB,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;KAC/C,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAAC,OAAe;IAC/D,OAAO,IAAI,CAAC,wCAAwC,CAAC,OAAO,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAyB;IAC3D,gFAAgF;IAChF,oDAAoD;IACpD,OAAO,WAAW,KAAK,YAAY,CAAC,IAAI,CAAC;AAC3C,CAAC","sourcesContent":["import { toBuffer } from '@ethereumjs/util';\nimport { isCustodyKeyring, KeyringTypes } from '@metamask/keyring-controller';\nimport { sha256 } from 'ethereum-cryptography/sha256';\nimport type { V4Options } from 'uuid';\nimport { v4 as uuid } from 'uuid';\n\n/**\n * Returns the name of the keyring type.\n *\n * @param keyringType - The type of the keyring.\n * @returns The name of the keyring type.\n */\nexport function keyringTypeToName(keyringType: string): string {\n // Custody keyrings are a special case, as they are not a single type\n // they just start with the prefix `Custody`\n if (isCustodyKeyring(keyringType)) {\n return 'Custody';\n }\n\n switch (keyringType) {\n case KeyringTypes.simple: {\n return 'Account';\n }\n case KeyringTypes.hd: {\n return 'Account';\n }\n case KeyringTypes.trezor: {\n return 'Trezor';\n }\n case KeyringTypes.oneKey: {\n return 'OneKey';\n }\n case KeyringTypes.ledger: {\n return 'Ledger';\n }\n case KeyringTypes.lattice: {\n return 'Lattice';\n }\n case KeyringTypes.qr: {\n return 'QR';\n }\n case KeyringTypes.snap: {\n return 'Snap Account';\n }\n default: {\n throw new Error(`Unknown keyring ${keyringType}`);\n }\n }\n}\n\n/**\n * Generates a UUID v4 options from a given Ethereum address.\n *\n * @param address - The Ethereum address to generate the UUID from.\n * @returns The UUID v4 options.\n */\nexport function getUUIDOptionsFromAddressOfNormalAccount(\n address: string,\n): V4Options {\n const v4options = {\n random: sha256(toBuffer(address)).slice(0, 16),\n };\n\n return v4options;\n}\n\n/**\n * Generates a UUID from a given Ethereum address.\n *\n * @param address - The Ethereum address to generate the UUID from.\n * @returns The generated UUID.\n */\nexport function getUUIDFromAddressOfNormalAccount(address: string): string {\n return uuid(getUUIDOptionsFromAddressOfNormalAccount(address));\n}\n\n/**\n * Check if a keyring type is considered a \"normal\" keyring.\n *\n * @param keyringType - The account's keyring type.\n * @returns True if the keyring type is considered a \"normal\" keyring, false otherwise.\n */\nexport function isNormalKeyringType(keyringType: KeyringTypes): boolean {\n // Right now, we only have to \"exclude\" Snap accounts, but this might need to be\n // adapted later on if we have new kind of keyrings!\n return keyringType !== KeyringTypes.snap;\n}\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@metamask-previews/accounts-controller",
|
3
|
-
"version": "23.0
|
3
|
+
"version": "23.1.0-preview-cb58d7d1",
|
4
4
|
"description": "Manages internal accounts",
|
5
5
|
"keywords": [
|
6
6
|
"MetaMask",
|
@@ -62,7 +62,8 @@
|
|
62
62
|
},
|
63
63
|
"devDependencies": {
|
64
64
|
"@metamask/auto-changelog": "^3.4.4",
|
65
|
-
"@metamask/keyring-controller": "^19.0
|
65
|
+
"@metamask/keyring-controller": "^19.1.0",
|
66
|
+
"@metamask/network-controller": "^22.2.1",
|
66
67
|
"@metamask/providers": "^18.1.1",
|
67
68
|
"@metamask/snaps-controllers": "^9.19.0",
|
68
69
|
"@types/jest": "^27.4.1",
|
@@ -75,7 +76,8 @@
|
|
75
76
|
"webextension-polyfill": "^0.12.0"
|
76
77
|
},
|
77
78
|
"peerDependencies": {
|
78
|
-
"@metamask/keyring-controller": "^19.
|
79
|
+
"@metamask/keyring-controller": "^19.1.0",
|
80
|
+
"@metamask/network-controller": "^22.2.1",
|
79
81
|
"@metamask/providers": "^18.1.0",
|
80
82
|
"@metamask/snaps-controllers": "^9.19.0",
|
81
83
|
"webextension-polyfill": "^0.10.0 || ^0.11.0 || ^0.12.0"
|