@metamask/accounts-controller 11.0.0 → 12.0.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAiC7D;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMzE"}
package/dist/utils.js CHANGED
@@ -1,60 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUUIDFromAddressOfNormalAccount = exports.keyringTypeToName = void 0;
4
- const util_1 = require("@ethereumjs/util");
5
- const keyring_controller_1 = require("@metamask/keyring-controller");
6
- const sha256_1 = require("ethereum-cryptography/sha256");
7
- const uuid_1 = require("uuid");
8
- /**
9
- * Returns the name of the keyring type.
10
- *
11
- * @param keyringType - The type of the keyring.
12
- * @returns The name of the keyring type.
13
- */
14
- function keyringTypeToName(keyringType) {
15
- // Custody keyrings are a special case, as they are not a single type
16
- // they just start with the prefix `Custody`
17
- if ((0, keyring_controller_1.isCustodyKeyring)(keyringType)) {
18
- return 'Custody';
19
- }
20
- switch (keyringType) {
21
- case keyring_controller_1.KeyringTypes.simple: {
22
- return 'Account';
23
- }
24
- case keyring_controller_1.KeyringTypes.hd: {
25
- return 'Account';
26
- }
27
- case keyring_controller_1.KeyringTypes.trezor: {
28
- return 'Trezor';
29
- }
30
- case keyring_controller_1.KeyringTypes.ledger: {
31
- return 'Ledger';
32
- }
33
- case keyring_controller_1.KeyringTypes.lattice: {
34
- return 'Lattice';
35
- }
36
- case keyring_controller_1.KeyringTypes.qr: {
37
- return 'QR';
38
- }
39
- case keyring_controller_1.KeyringTypes.snap: {
40
- return 'Snap Account';
41
- }
42
- default: {
43
- throw new Error(`Unknown keyring ${keyringType}`);
44
- }
45
- }
46
- }
47
- exports.keyringTypeToName = keyringTypeToName;
48
- /**
49
- * Generates a UUID from a given Ethereum address.
50
- * @param address - The Ethereum address to generate the UUID from.
51
- * @returns The generated UUID.
52
- */
53
- function getUUIDFromAddressOfNormalAccount(address) {
54
- const v4options = {
55
- random: (0, sha256_1.sha256)((0, util_1.toBuffer)(address)).slice(0, 16),
56
- };
57
- return (0, uuid_1.v4)(v4options);
58
- }
59
- exports.getUUIDFromAddressOfNormalAccount = getUUIDFromAddressOfNormalAccount;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkMF4BFCSUjs = require('./chunk-MF4BFCSU.js');
5
+
6
+
7
+
8
+ exports.getUUIDFromAddressOfNormalAccount = _chunkMF4BFCSUjs.getUUIDFromAddressOfNormalAccount; exports.keyringTypeToName = _chunkMF4BFCSUjs.keyringTypeToName;
60
9
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,qEAA8E;AAC9E,yDAAsD;AACtD,+BAAkC;AAElC;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,WAAmB;IACnD,qEAAqE;IACrE,4CAA4C;IAC5C,IAAI,IAAA,qCAAgB,EAAC,WAAW,CAAC,EAAE;QACjC,OAAO,SAAS,CAAC;KAClB;IAED,QAAQ,WAAW,EAAE;QACnB,KAAK,iCAAY,CAAC,MAAM,CAAC,CAAC;YACxB,OAAO,SAAS,CAAC;SAClB;QACD,KAAK,iCAAY,CAAC,EAAE,CAAC,CAAC;YACpB,OAAO,SAAS,CAAC;SAClB;QACD,KAAK,iCAAY,CAAC,MAAM,CAAC,CAAC;YACxB,OAAO,QAAQ,CAAC;SACjB;QACD,KAAK,iCAAY,CAAC,MAAM,CAAC,CAAC;YACxB,OAAO,QAAQ,CAAC;SACjB;QACD,KAAK,iCAAY,CAAC,OAAO,CAAC,CAAC;YACzB,OAAO,SAAS,CAAC;SAClB;QACD,KAAK,iCAAY,CAAC,EAAE,CAAC,CAAC;YACpB,OAAO,IAAI,CAAC;SACb;QACD,KAAK,iCAAY,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;AAjCD,8CAiCC;AAED;;;;GAIG;AACH,SAAgB,iCAAiC,CAAC,OAAe;IAC/D,MAAM,SAAS,GAAG;QAChB,MAAM,EAAE,IAAA,eAAM,EAAC,IAAA,eAAQ,EAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;KAC/C,CAAC;IAEF,OAAO,IAAA,SAAI,EAAC,SAAS,CAAC,CAAC;AACzB,CAAC;AAND,8EAMC","sourcesContent":["import { toBuffer } from '@ethereumjs/util';\nimport { isCustodyKeyring, KeyringTypes } from '@metamask/keyring-controller';\nimport { sha256 } from 'ethereum-cryptography/sha256';\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.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 from a given Ethereum address.\n * @param address - The Ethereum address to generate the UUID from.\n * @returns The generated UUID.\n */\nexport function getUUIDFromAddressOfNormalAccount(address: string): string {\n const v4options = {\n random: sha256(toBuffer(address)).slice(0, 16),\n };\n\n return uuid(v4options);\n}\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
package/dist/utils.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import {
2
+ getUUIDFromAddressOfNormalAccount,
3
+ keyringTypeToName
4
+ } from "./chunk-HD5HN6GK.mjs";
5
+ export {
6
+ getUUIDFromAddressOfNormalAccount,
7
+ keyringTypeToName
8
+ };
9
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/accounts-controller",
3
- "version": "11.0.0",
3
+ "version": "12.0.1",
4
4
  "description": "Manages internal accounts",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -15,12 +15,22 @@
15
15
  "url": "https://github.com/MetaMask/core.git"
16
16
  },
17
17
  "license": "MIT",
18
+ "sideEffects": false,
19
+ "exports": {
20
+ ".": {
21
+ "import": "./dist/index.mjs",
22
+ "require": "./dist/index.js",
23
+ "types": "./dist/types/index.d.ts"
24
+ },
25
+ "./package.json": "./package.json"
26
+ },
18
27
  "main": "./dist/index.js",
19
- "types": "./dist/index.d.ts",
28
+ "types": "./dist/types/index.d.ts",
20
29
  "files": [
21
30
  "dist/"
22
31
  ],
23
32
  "scripts": {
33
+ "build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
24
34
  "build:docs": "typedoc",
25
35
  "changelog:update": "../../scripts/update-changelog.sh @metamask/accounts-controller",
26
36
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/accounts-controller",
@@ -32,7 +42,7 @@
32
42
  },
33
43
  "dependencies": {
34
44
  "@ethereumjs/util": "^8.1.0",
35
- "@metamask/base-controller": "^4.1.1",
45
+ "@metamask/base-controller": "^5.0.1",
36
46
  "@metamask/eth-snap-keyring": "^2.1.1",
37
47
  "@metamask/keyring-api": "^3.0.0",
38
48
  "@metamask/snaps-sdk": "^1.3.2",
@@ -45,7 +55,7 @@
45
55
  },
46
56
  "devDependencies": {
47
57
  "@metamask/auto-changelog": "^3.4.4",
48
- "@metamask/keyring-controller": "^13.0.0",
58
+ "@metamask/keyring-controller": "^14.0.1",
49
59
  "@metamask/snaps-controllers": "^4.0.0",
50
60
  "@types/jest": "^27.4.1",
51
61
  "@types/readable-stream": "^2.3.0",
@@ -56,7 +66,7 @@
56
66
  "typescript": "~4.8.4"
57
67
  },
58
68
  "peerDependencies": {
59
- "@metamask/keyring-controller": "^13.0.0",
69
+ "@metamask/keyring-controller": "^14.0.0",
60
70
  "@metamask/snaps-controllers": "^4.0.0"
61
71
  },
62
72
  "engines": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"AccountsController.d.ts","sourceRoot":"","sources":["../src/AccountsController.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAEV,uBAAuB,EACvB,2CAA2C,EAC3C,wCAAwC,EACxC,kCAAkC,EACnC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,6BAA6B,CAAC;AAUrC,QAAA,MAAM,cAAc,uBAAuB,CAAC;AAE5C,oBAAY,uBAAuB,GAAG;IACpC,gBAAgB,EAAE;QAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;QAC1C,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH,CAAC;AAE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;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI;CAwalD"}
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './AccountsController';
2
- export * from './utils';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAiC7D;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMzE"}
File without changes