@metamask/name-controller 8.0.0 → 8.0.2
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 +35 -1
- package/dist/NameController.cjs +410 -0
- package/dist/NameController.cjs.map +1 -0
- package/dist/{types/NameController.d.ts → NameController.d.cts} +5 -5
- package/dist/NameController.d.cts.map +1 -0
- package/dist/NameController.d.mts +106 -0
- package/dist/NameController.d.mts.map +1 -0
- package/dist/NameController.mjs +404 -13
- package/dist/NameController.mjs.map +1 -1
- package/dist/constants.cjs +111 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/{types/constants.d.ts → constants.d.cts} +1 -1
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.mts +105 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.mjs +106 -8
- package/dist/constants.mjs.map +1 -1
- package/dist/index.cjs +23 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6 -36
- package/dist/index.mjs.map +1 -1
- package/dist/logger.cjs +7 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/{types/logger.d.ts → logger.d.cts} +2 -2
- package/dist/logger.d.cts.map +1 -0
- package/dist/logger.d.mts +5 -0
- package/dist/logger.d.mts.map +1 -0
- package/dist/logger.mjs +3 -9
- package/dist/logger.mjs.map +1 -1
- package/dist/providers/ens.cjs +65 -0
- package/dist/providers/ens.cjs.map +1 -0
- package/dist/{types/providers/ens.d.ts → providers/ens.d.cts} +2 -2
- package/dist/providers/ens.d.cts.map +1 -0
- package/dist/providers/ens.d.mts +12 -0
- package/dist/providers/ens.d.mts.map +1 -0
- package/dist/providers/ens.mjs +59 -8
- package/dist/providers/ens.mjs.map +1 -1
- package/dist/providers/etherscan.cjs +130 -0
- package/dist/providers/etherscan.cjs.map +1 -0
- package/dist/{types/providers/etherscan.d.ts → providers/etherscan.d.cts} +2 -2
- package/dist/providers/etherscan.d.cts.map +1 -0
- package/dist/providers/etherscan.d.mts +10 -0
- package/dist/providers/etherscan.d.mts.map +1 -0
- package/dist/providers/etherscan.mjs +124 -10
- package/dist/providers/etherscan.mjs.map +1 -1
- package/dist/providers/lens.cjs +77 -0
- package/dist/providers/lens.cjs.map +1 -0
- package/dist/{types/providers/lens.d.ts → providers/lens.d.cts} +2 -2
- package/dist/providers/lens.d.cts.map +1 -0
- package/dist/providers/lens.d.mts +10 -0
- package/dist/providers/lens.d.mts.map +1 -0
- package/dist/providers/lens.mjs +71 -9
- package/dist/providers/lens.mjs.map +1 -1
- package/dist/providers/token.cjs +68 -0
- package/dist/providers/token.cjs.map +1 -0
- package/dist/{types/providers/token.d.ts → providers/token.d.cts} +2 -2
- package/dist/providers/token.d.cts.map +1 -0
- package/dist/providers/token.d.mts +10 -0
- package/dist/providers/token.d.mts.map +1 -0
- package/dist/providers/token.mjs +62 -9
- package/dist/providers/token.mjs.map +1 -1
- package/dist/types.cjs +12 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types/types.d.ts → types.d.cts} +1 -1
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +77 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +8 -7
- package/dist/types.mjs.map +1 -1
- package/dist/util.cjs +76 -0
- package/dist/util.cjs.map +1 -0
- package/dist/{types/util.d.ts → util.d.cts} +1 -1
- package/dist/util.d.cts.map +1 -0
- package/dist/util.d.mts +35 -0
- package/dist/util.d.mts.map +1 -0
- package/dist/util.mjs +68 -13
- package/dist/util.mjs.map +1 -1
- package/package.json +21 -15
- package/dist/NameController.js +0 -15
- package/dist/NameController.js.map +0 -1
- package/dist/chunk-6AVJOVIX.mjs +0 -519
- package/dist/chunk-6AVJOVIX.mjs.map +0 -1
- package/dist/chunk-6W3DEAGA.mjs +0 -10
- package/dist/chunk-6W3DEAGA.mjs.map +0 -1
- package/dist/chunk-BLG7EQAA.mjs +0 -66
- package/dist/chunk-BLG7EQAA.mjs.map +0 -1
- package/dist/chunk-DSVOMJX6.mjs +0 -43
- package/dist/chunk-DSVOMJX6.mjs.map +0 -1
- package/dist/chunk-JHYBLEC5.js +0 -43
- package/dist/chunk-JHYBLEC5.js.map +0 -1
- package/dist/chunk-L244TFFU.mjs +0 -9
- package/dist/chunk-L244TFFU.mjs.map +0 -1
- package/dist/chunk-PL2KMW2Y.js +0 -519
- package/dist/chunk-PL2KMW2Y.js.map +0 -1
- package/dist/chunk-PL7IXD33.js +0 -10
- package/dist/chunk-PL7IXD33.js.map +0 -1
- package/dist/chunk-QBR7BSWB.js +0 -9
- package/dist/chunk-QBR7BSWB.js.map +0 -1
- package/dist/chunk-RYIUDJOI.js +0 -66
- package/dist/chunk-RYIUDJOI.js.map +0 -1
- package/dist/chunk-SHTSUEYM.mjs +0 -113
- package/dist/chunk-SHTSUEYM.mjs.map +0 -1
- package/dist/chunk-ST2ADXPO.js +0 -67
- package/dist/chunk-ST2ADXPO.js.map +0 -1
- package/dist/chunk-UALYD4SG.mjs +0 -138
- package/dist/chunk-UALYD4SG.mjs.map +0 -1
- package/dist/chunk-W64QIPGB.js +0 -80
- package/dist/chunk-W64QIPGB.js.map +0 -1
- package/dist/chunk-WHDNAWDA.mjs +0 -67
- package/dist/chunk-WHDNAWDA.mjs.map +0 -1
- package/dist/chunk-WSOVXHAC.mjs +0 -80
- package/dist/chunk-WSOVXHAC.mjs.map +0 -1
- package/dist/chunk-X55IV67M.js +0 -138
- package/dist/chunk-X55IV67M.js.map +0 -1
- package/dist/chunk-XQXO5QPM.js +0 -113
- package/dist/chunk-XQXO5QPM.js.map +0 -1
- package/dist/chunk-XUI43LEZ.mjs +0 -30
- package/dist/chunk-XUI43LEZ.mjs.map +0 -1
- package/dist/chunk-Z4BLTVTB.js +0 -30
- package/dist/chunk-Z4BLTVTB.js.map +0 -1
- package/dist/constants.js +0 -10
- package/dist/constants.js.map +0 -1
- package/dist/index.js +0 -37
- package/dist/index.js.map +0 -1
- package/dist/logger.js +0 -10
- package/dist/logger.js.map +0 -1
- package/dist/providers/ens.js +0 -10
- package/dist/providers/ens.js.map +0 -1
- package/dist/providers/etherscan.js +0 -12
- package/dist/providers/etherscan.js.map +0 -1
- package/dist/providers/lens.js +0 -11
- package/dist/providers/lens.js.map +0 -1
- package/dist/providers/token.js +0 -11
- package/dist/providers/token.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/NameController.d.ts.map +0 -1
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -7
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/logger.d.ts.map +0 -1
- package/dist/types/providers/ens.d.ts.map +0 -1
- package/dist/types/providers/etherscan.d.ts.map +0 -1
- package/dist/types/providers/lens.d.ts.map +0 -1
- package/dist/types/providers/token.d.ts.map +0 -1
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/util.d.ts.map +0 -1
- package/dist/types.js +0 -8
- package/dist/types.js.map +0 -1
- package/dist/util.js +0 -14
- package/dist/util.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [8.0.2]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Bump `@metamask/controller-utils` from `^11.3.0` to `^11.4.4` ([#4834](https://github.com/MetaMask/core/pull/4834), [#4862](https://github.com/MetaMask/core/pull/4862), [#4870](https://github.com/MetaMask/core/pull/4870), [#4915](https://github.com/MetaMask/core/pull/4915), [#5012](https://github.com/MetaMask/core/pull/5012))
|
|
15
|
+
- Bump `@metamask/utils` from `^9.1.0` to `^10.0.0` ([#4831](https://github.com/MetaMask/core/pull/4831))
|
|
16
|
+
- Bump `@metamask/base-controller` from `^7.0.1` to `^7.0.2` ([#4862](https://github.com/MetaMask/core/pull/4862))
|
|
17
|
+
|
|
18
|
+
## [8.0.1]
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#4516](https://github.com/MetaMask/core/pull/4516), [#4529](https://github.com/MetaMask/core/pull/4529))
|
|
23
|
+
- Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1` ([#4516](https://github.com/MetaMask/core/pull/4516))
|
|
24
|
+
- Bump TypeScript from `~4.9.5` to `~5.2.2` and set `moduleResolution` option to `Node16` ([#3645](https://github.com/MetaMask/core/pull/3645), [#4576](https://github.com/MetaMask/core/pull/4576), [#4584](https://github.com/MetaMask/core/pull/4584))
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Produce and export ESM-compatible TypeScript type declaration files in addition to CommonJS-compatible declaration files ([#4648](https://github.com/MetaMask/core/pull/4648))
|
|
29
|
+
- Previously, this package shipped with only one variant of type declaration
|
|
30
|
+
files, and these files were only CommonJS-compatible, and the `exports`
|
|
31
|
+
field in `package.json` linked to these files. This is an anti-pattern and
|
|
32
|
+
was rightfully flagged by the
|
|
33
|
+
["Are the Types Wrong?"](https://arethetypeswrong.github.io/) tool as
|
|
34
|
+
["masquerading as CJS"](https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md).
|
|
35
|
+
All of the ATTW checks now pass.
|
|
36
|
+
- Remove chunk files ([#4648](https://github.com/MetaMask/core/pull/4648)).
|
|
37
|
+
- Previously, the build tool we used to generate JavaScript files extracted
|
|
38
|
+
common code to "chunk" files. While this was intended to make this package
|
|
39
|
+
more tree-shakeable, it also made debugging more difficult for our
|
|
40
|
+
development teams. These chunk files are no longer present.
|
|
41
|
+
|
|
10
42
|
## [8.0.0]
|
|
11
43
|
|
|
12
44
|
### Changed
|
|
@@ -121,7 +153,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
121
153
|
|
|
122
154
|
- Initial Release ([#1647](https://github.com/MetaMask/core/pull/1647))
|
|
123
155
|
|
|
124
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/name-controller@8.0.
|
|
156
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/name-controller@8.0.2...HEAD
|
|
157
|
+
[8.0.2]: https://github.com/MetaMask/core/compare/@metamask/name-controller@8.0.1...@metamask/name-controller@8.0.2
|
|
158
|
+
[8.0.1]: https://github.com/MetaMask/core/compare/@metamask/name-controller@8.0.0...@metamask/name-controller@8.0.1
|
|
125
159
|
[8.0.0]: https://github.com/MetaMask/core/compare/@metamask/name-controller@7.0.0...@metamask/name-controller@8.0.0
|
|
126
160
|
[7.0.0]: https://github.com/MetaMask/core/compare/@metamask/name-controller@6.0.1...@metamask/name-controller@7.0.0
|
|
127
161
|
[6.0.1]: https://github.com/MetaMask/core/compare/@metamask/name-controller@6.0.0...@metamask/name-controller@6.0.1
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _NameController_instances, _NameController_providers, _NameController_updateDelay, _NameController_updateProposedNameState, _NameController_updateSourceState, _NameController_getUpdateProposedNamesResult, _NameController_getProviderResponse, _NameController_normalizeProviderResult, _NameController_normalizeProviderSourceResult, _NameController_normalizeValue, _NameController_normalizeVariation, _NameController_updateEntry, _NameController_getCurrentTimeSeconds, _NameController_validateSetNameRequest, _NameController_validateUpdateProposedNamesRequest, _NameController_validateValue, _NameController_validateType, _NameController_validateName, _NameController_validateSourceIds, _NameController_validateSourceId, _NameController_validateDuplicateSourceIds, _NameController_validateVariation, _NameController_validateOrigin, _NameController_getAllSourceIds, _NameController_getSourceIds, _NameController_removeDormantProposedNames, _NameController_removeExpiredEntries, _NameController_getEntriesList;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.NameController = exports.NameOrigin = exports.PROPOSED_NAME_EXPIRE_DURATION = exports.FALLBACK_VARIATION = void 0;
|
|
16
|
+
const base_controller_1 = require("@metamask/base-controller");
|
|
17
|
+
const controller_utils_1 = require("@metamask/controller-utils");
|
|
18
|
+
const types_1 = require("./types.cjs");
|
|
19
|
+
exports.FALLBACK_VARIATION = '*';
|
|
20
|
+
exports.PROPOSED_NAME_EXPIRE_DURATION = 60 * 60 * 24; // 24 hours
|
|
21
|
+
/**
|
|
22
|
+
* Enumerates the possible origins responsible for setting a petname.
|
|
23
|
+
*/
|
|
24
|
+
var NameOrigin;
|
|
25
|
+
(function (NameOrigin) {
|
|
26
|
+
// Originated from an account identity.
|
|
27
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
29
|
+
NameOrigin["ACCOUNT_IDENTITY"] = "account-identity";
|
|
30
|
+
// Originated from an address book entry.
|
|
31
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
33
|
+
NameOrigin["ADDRESS_BOOK"] = "address-book";
|
|
34
|
+
// Originated from the API (NameController.setName). This is the default.
|
|
35
|
+
NameOrigin["API"] = "api";
|
|
36
|
+
// Originated from the user taking action in the UI.
|
|
37
|
+
NameOrigin["UI"] = "ui";
|
|
38
|
+
})(NameOrigin || (exports.NameOrigin = NameOrigin = {}));
|
|
39
|
+
const DEFAULT_UPDATE_DELAY = 60 * 2; // 2 Minutes
|
|
40
|
+
const DEFAULT_VARIATION = '';
|
|
41
|
+
const controllerName = 'NameController';
|
|
42
|
+
const stateMetadata = {
|
|
43
|
+
names: { persist: true, anonymous: false },
|
|
44
|
+
nameSources: { persist: true, anonymous: false },
|
|
45
|
+
};
|
|
46
|
+
const getDefaultState = () => ({
|
|
47
|
+
names: {
|
|
48
|
+
[types_1.NameType.ETHEREUM_ADDRESS]: {},
|
|
49
|
+
},
|
|
50
|
+
nameSources: {},
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Controller for storing and deriving names for values such as Ethereum addresses.
|
|
54
|
+
*/
|
|
55
|
+
class NameController extends base_controller_1.BaseController {
|
|
56
|
+
/**
|
|
57
|
+
* Construct a Name controller.
|
|
58
|
+
*
|
|
59
|
+
* @param options - Controller options.
|
|
60
|
+
* @param options.messenger - Restricted controller messenger for the name controller.
|
|
61
|
+
* @param options.providers - Array of name provider instances to propose names.
|
|
62
|
+
* @param options.state - Initial state to set on the controller.
|
|
63
|
+
* @param options.updateDelay - The delay in seconds before a new request to a source should be made.
|
|
64
|
+
*/
|
|
65
|
+
constructor({ messenger, providers, state, updateDelay, }) {
|
|
66
|
+
super({
|
|
67
|
+
name: controllerName,
|
|
68
|
+
metadata: stateMetadata,
|
|
69
|
+
messenger,
|
|
70
|
+
state: { ...getDefaultState(), ...state },
|
|
71
|
+
});
|
|
72
|
+
_NameController_instances.add(this);
|
|
73
|
+
_NameController_providers.set(this, void 0);
|
|
74
|
+
_NameController_updateDelay.set(this, void 0);
|
|
75
|
+
__classPrivateFieldSet(this, _NameController_providers, providers, "f");
|
|
76
|
+
__classPrivateFieldSet(this, _NameController_updateDelay, updateDelay ?? DEFAULT_UPDATE_DELAY, "f");
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Set the user specified name for a value.
|
|
80
|
+
*
|
|
81
|
+
* @param request - Request object.
|
|
82
|
+
* @param request.name - Name to set.
|
|
83
|
+
* @param request.sourceId - Optional ID of the source of the proposed name.
|
|
84
|
+
* @param request.type - Type of value to set the name for.
|
|
85
|
+
* @param request.value - Value to set the name for.
|
|
86
|
+
* @param request.variation - Variation of the raw value to set the name for. The chain ID if the type is Ethereum address.
|
|
87
|
+
*/
|
|
88
|
+
setName(request) {
|
|
89
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateSetNameRequest).call(this, request);
|
|
90
|
+
const { value, type, name, sourceId: requestSourceId, origin: requestOrigin, variation, } = request;
|
|
91
|
+
const sourceId = requestSourceId ?? null;
|
|
92
|
+
// If the name is being cleared, the fallback origin should be cleared as well.
|
|
93
|
+
const fallbackOrigin = name === null ? null : NameOrigin.API;
|
|
94
|
+
const origin = requestOrigin ?? fallbackOrigin;
|
|
95
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_updateEntry).call(this, value, type, variation, (entry) => {
|
|
96
|
+
entry.name = name;
|
|
97
|
+
entry.sourceId = sourceId;
|
|
98
|
+
entry.origin = origin;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Generate the proposed names for a value using the name providers and store them in the state.
|
|
103
|
+
*
|
|
104
|
+
* @param request - Request object.
|
|
105
|
+
* @param request.value - Value to update the proposed names for.
|
|
106
|
+
* @param request.type - Type of value to update the proposed names for.
|
|
107
|
+
* @param request.sourceIds - Optional array of source IDs to limit which sources are used by the providers. If not provided, all sources in all providers will be used.
|
|
108
|
+
* @param request.variation - Variation of the raw value to update proposed names for. The chain ID if the type is Ethereum address.
|
|
109
|
+
* @returns The updated proposed names for the value.
|
|
110
|
+
*/
|
|
111
|
+
async updateProposedNames(request) {
|
|
112
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateUpdateProposedNamesRequest).call(this, request);
|
|
113
|
+
const providerResponses = (await Promise.all(__classPrivateFieldGet(this, _NameController_providers, "f").map((provider) => __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getProviderResponse).call(this, request, provider)))).filter((response) => Boolean(response));
|
|
114
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_updateProposedNameState).call(this, request, providerResponses);
|
|
115
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_updateSourceState).call(this, __classPrivateFieldGet(this, _NameController_providers, "f"));
|
|
116
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_removeExpiredEntries).call(this);
|
|
117
|
+
return __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getUpdateProposedNamesResult).call(this, providerResponses);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.NameController = NameController;
|
|
121
|
+
_NameController_providers = new WeakMap(), _NameController_updateDelay = new WeakMap(), _NameController_instances = new WeakSet(), _NameController_updateProposedNameState = function _NameController_updateProposedNameState(request, providerResponses) {
|
|
122
|
+
const { value, type, variation } = request;
|
|
123
|
+
const currentTime = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getCurrentTimeSeconds).call(this);
|
|
124
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_updateEntry).call(this, value, type, variation, (entry) => {
|
|
125
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_removeDormantProposedNames).call(this, entry.proposedNames, type);
|
|
126
|
+
for (const providerResponse of providerResponses) {
|
|
127
|
+
const { results } = providerResponse;
|
|
128
|
+
for (const sourceId of Object.keys(providerResponse.results)) {
|
|
129
|
+
const result = results[sourceId];
|
|
130
|
+
const { proposedNames, updateDelay } = result;
|
|
131
|
+
const proposedNameEntry = entry.proposedNames[sourceId] ?? {
|
|
132
|
+
proposedNames: [],
|
|
133
|
+
lastRequestTime: null,
|
|
134
|
+
updateDelay: null,
|
|
135
|
+
};
|
|
136
|
+
entry.proposedNames[sourceId] = proposedNameEntry;
|
|
137
|
+
if (proposedNames) {
|
|
138
|
+
proposedNameEntry.proposedNames = proposedNames;
|
|
139
|
+
}
|
|
140
|
+
proposedNameEntry.lastRequestTime = currentTime;
|
|
141
|
+
proposedNameEntry.updateDelay = updateDelay ?? null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}, _NameController_updateSourceState = function _NameController_updateSourceState(providers) {
|
|
146
|
+
const newNameSources = { ...this.state.nameSources };
|
|
147
|
+
for (const provider of providers) {
|
|
148
|
+
const { sourceLabels } = provider.getMetadata();
|
|
149
|
+
for (const sourceId of Object.keys(sourceLabels)) {
|
|
150
|
+
newNameSources[sourceId] = {
|
|
151
|
+
label: sourceLabels[sourceId],
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
this.update((state) => {
|
|
156
|
+
state.nameSources = newNameSources;
|
|
157
|
+
});
|
|
158
|
+
}, _NameController_getUpdateProposedNamesResult = function _NameController_getUpdateProposedNamesResult(providerResponses) {
|
|
159
|
+
return providerResponses.reduce((acc, providerResponse) => {
|
|
160
|
+
const { results } = providerResponse;
|
|
161
|
+
for (const sourceId of Object.keys(results)) {
|
|
162
|
+
const { proposedNames, error } = results[sourceId];
|
|
163
|
+
acc.results[sourceId] = {
|
|
164
|
+
proposedNames,
|
|
165
|
+
error,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return acc;
|
|
169
|
+
}, { results: {} });
|
|
170
|
+
}, _NameController_getProviderResponse = async function _NameController_getProviderResponse(request, provider) {
|
|
171
|
+
const { value, type, sourceIds: requestedSourceIds, onlyUpdateAfterDelay, variation, } = request;
|
|
172
|
+
/* istanbul ignore next */
|
|
173
|
+
const variationKey = variation ?? DEFAULT_VARIATION;
|
|
174
|
+
const supportedSourceIds = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getSourceIds).call(this, provider, type);
|
|
175
|
+
const currentTime = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getCurrentTimeSeconds).call(this);
|
|
176
|
+
const normalizedValue = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_normalizeValue).call(this, value, type);
|
|
177
|
+
const matchingSourceIds = supportedSourceIds.filter((sourceId) => {
|
|
178
|
+
if (requestedSourceIds && !requestedSourceIds.includes(sourceId)) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
if (onlyUpdateAfterDelay) {
|
|
182
|
+
const entry = this.state.names[type]?.[normalizedValue]?.[variationKey] ?? {};
|
|
183
|
+
const proposedNamesEntry = entry.proposedNames?.[sourceId] ?? {};
|
|
184
|
+
const lastRequestTime = proposedNamesEntry.lastRequestTime ?? 0;
|
|
185
|
+
const updateDelay = proposedNamesEntry.updateDelay ?? __classPrivateFieldGet(this, _NameController_updateDelay, "f");
|
|
186
|
+
if (currentTime - lastRequestTime < updateDelay) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return true;
|
|
191
|
+
});
|
|
192
|
+
if (!matchingSourceIds.length) {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
const providerRequest = {
|
|
196
|
+
value: __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_normalizeValue).call(this, value, type),
|
|
197
|
+
type,
|
|
198
|
+
sourceIds: requestedSourceIds ? matchingSourceIds : undefined,
|
|
199
|
+
variation: __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_normalizeVariation).call(this, variationKey, type),
|
|
200
|
+
};
|
|
201
|
+
let responseError;
|
|
202
|
+
let response;
|
|
203
|
+
try {
|
|
204
|
+
response = await provider.getProposedNames(providerRequest);
|
|
205
|
+
responseError = response.error;
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
responseError = error;
|
|
209
|
+
}
|
|
210
|
+
return __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_normalizeProviderResult).call(this, response, responseError, matchingSourceIds);
|
|
211
|
+
}, _NameController_normalizeProviderResult = function _NameController_normalizeProviderResult(result, responseError, matchingSourceIds) {
|
|
212
|
+
const error = responseError ?? undefined;
|
|
213
|
+
const results = matchingSourceIds.reduce((acc, sourceId) => {
|
|
214
|
+
const sourceResult = result?.results?.[sourceId];
|
|
215
|
+
const normalizedSourceResult = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_normalizeProviderSourceResult).call(this, sourceResult, responseError);
|
|
216
|
+
return {
|
|
217
|
+
...acc,
|
|
218
|
+
[sourceId]: normalizedSourceResult,
|
|
219
|
+
};
|
|
220
|
+
}, {});
|
|
221
|
+
return { results, error };
|
|
222
|
+
}, _NameController_normalizeProviderSourceResult = function _NameController_normalizeProviderSourceResult(result, responseError) {
|
|
223
|
+
const error = result?.error ?? responseError ?? undefined;
|
|
224
|
+
const updateDelay = result?.updateDelay ?? undefined;
|
|
225
|
+
let proposedNames = error ? undefined : result?.proposedNames ?? undefined;
|
|
226
|
+
if (proposedNames) {
|
|
227
|
+
proposedNames = proposedNames.filter((proposedName) => proposedName?.length);
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
proposedNames,
|
|
231
|
+
error,
|
|
232
|
+
updateDelay,
|
|
233
|
+
};
|
|
234
|
+
}, _NameController_normalizeValue = function _NameController_normalizeValue(value, type) {
|
|
235
|
+
/* istanbul ignore next */
|
|
236
|
+
switch (type) {
|
|
237
|
+
case types_1.NameType.ETHEREUM_ADDRESS:
|
|
238
|
+
return value.toLowerCase();
|
|
239
|
+
default:
|
|
240
|
+
return value;
|
|
241
|
+
}
|
|
242
|
+
}, _NameController_normalizeVariation = function _NameController_normalizeVariation(variation, type) {
|
|
243
|
+
/* istanbul ignore next */
|
|
244
|
+
switch (type) {
|
|
245
|
+
case types_1.NameType.ETHEREUM_ADDRESS:
|
|
246
|
+
return variation.toLowerCase();
|
|
247
|
+
default:
|
|
248
|
+
return variation;
|
|
249
|
+
}
|
|
250
|
+
}, _NameController_updateEntry = function _NameController_updateEntry(value, type, variation, callback) {
|
|
251
|
+
/* istanbul ignore next */
|
|
252
|
+
const variationKey = variation ?? DEFAULT_VARIATION;
|
|
253
|
+
const normalizedValue = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_normalizeValue).call(this, value, type);
|
|
254
|
+
const normalizedVariation = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_normalizeVariation).call(this, variationKey, type);
|
|
255
|
+
if ([normalizedValue, normalizedVariation].some((key) => !(0, controller_utils_1.isSafeDynamicKey)(key))) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
this.update((state) => {
|
|
259
|
+
const typeEntries = state.names[type] || {};
|
|
260
|
+
state.names[type] = typeEntries;
|
|
261
|
+
const variationEntries = typeEntries[normalizedValue] || {};
|
|
262
|
+
typeEntries[normalizedValue] = variationEntries;
|
|
263
|
+
const entry = variationEntries[normalizedVariation] ?? {
|
|
264
|
+
proposedNames: {},
|
|
265
|
+
name: null,
|
|
266
|
+
sourceId: null,
|
|
267
|
+
origin: null,
|
|
268
|
+
};
|
|
269
|
+
variationEntries[normalizedVariation] = entry;
|
|
270
|
+
callback(entry);
|
|
271
|
+
});
|
|
272
|
+
}, _NameController_getCurrentTimeSeconds = function _NameController_getCurrentTimeSeconds() {
|
|
273
|
+
return Math.round(Date.now() / 1000);
|
|
274
|
+
}, _NameController_validateSetNameRequest = function _NameController_validateSetNameRequest(request) {
|
|
275
|
+
const { name, value, type, sourceId, variation, origin } = request;
|
|
276
|
+
const errorMessages = [];
|
|
277
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateValue).call(this, value, errorMessages);
|
|
278
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateType).call(this, type, errorMessages);
|
|
279
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateName).call(this, name, errorMessages);
|
|
280
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateSourceId).call(this, sourceId, type, name, errorMessages);
|
|
281
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateVariation).call(this, variation, type, errorMessages);
|
|
282
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateOrigin).call(this, origin, name, errorMessages);
|
|
283
|
+
if (errorMessages.length) {
|
|
284
|
+
throw new Error(errorMessages.join(' '));
|
|
285
|
+
}
|
|
286
|
+
}, _NameController_validateUpdateProposedNamesRequest = function _NameController_validateUpdateProposedNamesRequest(request) {
|
|
287
|
+
const { value, type, sourceIds, variation } = request;
|
|
288
|
+
const errorMessages = [];
|
|
289
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateValue).call(this, value, errorMessages);
|
|
290
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateType).call(this, type, errorMessages);
|
|
291
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateSourceIds).call(this, sourceIds, type, errorMessages);
|
|
292
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateDuplicateSourceIds).call(this, type, errorMessages);
|
|
293
|
+
__classPrivateFieldGet(this, _NameController_instances, "m", _NameController_validateVariation).call(this, variation, type, errorMessages);
|
|
294
|
+
if (errorMessages.length) {
|
|
295
|
+
throw new Error(errorMessages.join(' '));
|
|
296
|
+
}
|
|
297
|
+
}, _NameController_validateValue = function _NameController_validateValue(value, errorMessages) {
|
|
298
|
+
if (!value?.length || typeof value !== 'string') {
|
|
299
|
+
errorMessages.push('Must specify a non-empty string for value.');
|
|
300
|
+
}
|
|
301
|
+
}, _NameController_validateType = function _NameController_validateType(type, errorMessages) {
|
|
302
|
+
if (!Object.values(types_1.NameType).includes(type)) {
|
|
303
|
+
errorMessages.push(`Must specify one of the following types: ${Object.values(types_1.NameType).join(', ')}`);
|
|
304
|
+
}
|
|
305
|
+
}, _NameController_validateName = function _NameController_validateName(name, errorMessages) {
|
|
306
|
+
if (name === null) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (!name?.length || typeof name !== 'string') {
|
|
310
|
+
errorMessages.push('Must specify a non-empty string or null for name.');
|
|
311
|
+
}
|
|
312
|
+
}, _NameController_validateSourceIds = function _NameController_validateSourceIds(sourceIds, type, errorMessages) {
|
|
313
|
+
if (!sourceIds) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const allSourceIds = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getAllSourceIds).call(this, type);
|
|
317
|
+
const missingSourceIds = [];
|
|
318
|
+
for (const sourceId of sourceIds) {
|
|
319
|
+
if (!allSourceIds.includes(sourceId)) {
|
|
320
|
+
missingSourceIds.push(sourceId);
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (missingSourceIds.length) {
|
|
325
|
+
errorMessages.push(`Unknown source IDs for type '${type}': ${missingSourceIds.join(', ')}`);
|
|
326
|
+
}
|
|
327
|
+
}, _NameController_validateSourceId = function _NameController_validateSourceId(sourceId, type, name, errorMessages) {
|
|
328
|
+
if (sourceId === null || sourceId === undefined) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (name === null) {
|
|
332
|
+
errorMessages.push(`Cannot specify a source ID when clearing the saved name: ${sourceId}`);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const allSourceIds = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getAllSourceIds).call(this, type);
|
|
336
|
+
if (!sourceId.length || typeof sourceId !== 'string') {
|
|
337
|
+
errorMessages.push('Must specify a non-empty string for sourceId.');
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (!allSourceIds.includes(sourceId)) {
|
|
341
|
+
errorMessages.push(`Unknown source ID for type '${type}': ${sourceId}`);
|
|
342
|
+
}
|
|
343
|
+
}, _NameController_validateDuplicateSourceIds = function _NameController_validateDuplicateSourceIds(type, errorMessages) {
|
|
344
|
+
const allSourceIds = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getAllSourceIds).call(this, type);
|
|
345
|
+
const duplicateSourceIds = allSourceIds.filter((sourceId, index) => allSourceIds.indexOf(sourceId) !== index);
|
|
346
|
+
if (duplicateSourceIds.length) {
|
|
347
|
+
errorMessages.push(`Duplicate source IDs found for type '${type}': ${duplicateSourceIds.join(', ')}`);
|
|
348
|
+
}
|
|
349
|
+
}, _NameController_validateVariation = function _NameController_validateVariation(variation, type, errorMessages) {
|
|
350
|
+
if (type !== types_1.NameType.ETHEREUM_ADDRESS) {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
if (!variation?.length ||
|
|
354
|
+
typeof variation !== 'string' ||
|
|
355
|
+
(!variation.match(/^0x[0-9A-Fa-f]+$/u) &&
|
|
356
|
+
variation !== exports.FALLBACK_VARIATION)) {
|
|
357
|
+
errorMessages.push(`Must specify a chain ID in hexidecimal format or the fallback, "${exports.FALLBACK_VARIATION}", for variation when using '${type}' type.`);
|
|
358
|
+
}
|
|
359
|
+
}, _NameController_validateOrigin = function _NameController_validateOrigin(origin, name, errorMessages) {
|
|
360
|
+
if (!origin) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (name === null) {
|
|
364
|
+
errorMessages.push(`Cannot specify an origin when clearing the saved name: ${origin}`);
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (!Object.values(NameOrigin).includes(origin)) {
|
|
368
|
+
errorMessages.push(`Must specify one of the following origins: ${Object.values(NameOrigin).join(', ')}`);
|
|
369
|
+
}
|
|
370
|
+
}, _NameController_getAllSourceIds = function _NameController_getAllSourceIds(type) {
|
|
371
|
+
return (__classPrivateFieldGet(this, _NameController_providers, "f")
|
|
372
|
+
/* istanbul ignore next */
|
|
373
|
+
.map((provider) => __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getSourceIds).call(this, provider, type))
|
|
374
|
+
.flat());
|
|
375
|
+
}, _NameController_getSourceIds = function _NameController_getSourceIds(provider, type) {
|
|
376
|
+
return provider.getMetadata().sourceIds[type];
|
|
377
|
+
}, _NameController_removeDormantProposedNames = function _NameController_removeDormantProposedNames(proposedNames, type) {
|
|
378
|
+
if (Object.keys(proposedNames).length === 0) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const typeSourceIds = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getAllSourceIds).call(this, type);
|
|
382
|
+
const dormantSourceIds = Object.keys(proposedNames).filter((sourceId) => !typeSourceIds.includes(sourceId));
|
|
383
|
+
for (const dormantSourceId of dormantSourceIds) {
|
|
384
|
+
delete proposedNames[dormantSourceId];
|
|
385
|
+
}
|
|
386
|
+
}, _NameController_removeExpiredEntries = function _NameController_removeExpiredEntries() {
|
|
387
|
+
const currentTime = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getCurrentTimeSeconds).call(this);
|
|
388
|
+
this.update((state) => {
|
|
389
|
+
const entries = __classPrivateFieldGet(this, _NameController_instances, "m", _NameController_getEntriesList).call(this, state);
|
|
390
|
+
for (const { nameType, value, variation, entry } of entries) {
|
|
391
|
+
if (entry.name !== null) {
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
const proposedNames = Object.values(entry.proposedNames);
|
|
395
|
+
const allProposedNamesExpired = proposedNames.every((proposedName) => currentTime - (proposedName.lastRequestTime ?? 0) >=
|
|
396
|
+
exports.PROPOSED_NAME_EXPIRE_DURATION);
|
|
397
|
+
if (allProposedNamesExpired) {
|
|
398
|
+
delete state.names[nameType][value][variation];
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}, _NameController_getEntriesList = function _NameController_getEntriesList(state) {
|
|
403
|
+
return Object.entries(state.names).flatMap(([type, typeEntries]) => Object.entries(typeEntries).flatMap(([value, variationEntries]) => Object.entries(variationEntries).map(([variation, entry]) => ({
|
|
404
|
+
entry,
|
|
405
|
+
nameType: type,
|
|
406
|
+
value,
|
|
407
|
+
variation,
|
|
408
|
+
}))));
|
|
409
|
+
};
|
|
410
|
+
//# sourceMappingURL=NameController.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NameController.cjs","sourceRoot":"","sources":["../src/NameController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,+DAA2D;AAC3D,iEAA8D;AAQ9D,uCAAmC;AAEtB,QAAA,kBAAkB,GAAG,GAAG,CAAC;AACzB,QAAA,6BAA6B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW;AAEtE;;GAEG;AACH,IAAY,UAaX;AAbD,WAAY,UAAU;IACpB,uCAAuC;IACvC,gFAAgF;IAChF,gEAAgE;IAChE,mDAAqC,CAAA;IACrC,yCAAyC;IACzC,gFAAgF;IAChF,gEAAgE;IAChE,2CAA6B,CAAA;IAC7B,yEAAyE;IACzE,yBAAW,CAAA;IACX,oDAAoD;IACpD,uBAAS,CAAA;AACX,CAAC,EAbW,UAAU,0BAAV,UAAU,QAarB;AAED,MAAM,oBAAoB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,YAAY;AACjD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAExC,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE;IAC1C,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE;CACjD,CAAC;AAEF,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,CAAC;IAC7B,KAAK,EAAE;QACL,CAAC,gBAAQ,CAAC,gBAAgB,CAAC,EAAE,EAAE;KAChC;IACD,WAAW,EAAE,EAAE;CAChB,CAAC,CAAC;AA2EH;;GAEG;AACH,MAAa,cAAe,SAAQ,gCAInC;IAKC;;;;;;;;OAQG;IACH,YAAY,EAC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,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,gBAAgB,CAAC,EAAE,EAAE,CAChE,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5D,KAAK;QACL,QAAQ,EAAE,IAAgB;QAC1B,KAAK;QACL,SAAS;KACV,CAAC,CAAC,CACJ,CACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedControllerMessenger,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport { isSafeDynamicKey } from '@metamask/controller-utils';\n\nimport type {\n NameProvider,\n NameProviderRequest,\n NameProviderResult,\n NameProviderSourceResult,\n} from './types';\nimport { NameType } from './types';\n\nexport const FALLBACK_VARIATION = '*';\nexport const PROPOSED_NAME_EXPIRE_DURATION = 60 * 60 * 24; // 24 hours\n\n/**\n * Enumerates the possible origins responsible for setting a petname.\n */\nexport enum NameOrigin {\n // Originated from an account identity.\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ACCOUNT_IDENTITY = 'account-identity',\n // Originated from an address book entry.\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ADDRESS_BOOK = 'address-book',\n // Originated from the API (NameController.setName). This is the default.\n API = 'api',\n // Originated from the user taking action in the UI.\n UI = 'ui',\n}\n\nconst DEFAULT_UPDATE_DELAY = 60 * 2; // 2 Minutes\nconst DEFAULT_VARIATION = '';\n\nconst controllerName = 'NameController';\n\nconst stateMetadata = {\n names: { persist: true, anonymous: false },\n nameSources: { persist: true, anonymous: false },\n};\n\nconst getDefaultState = () => ({\n names: {\n [NameType.ETHEREUM_ADDRESS]: {},\n },\n nameSources: {},\n});\n\nexport type ProposedNamesEntry = {\n proposedNames: string[];\n lastRequestTime: number | null;\n updateDelay: number | null;\n};\n\nexport type NameEntry = {\n name: string | null;\n sourceId: string | null;\n origin: NameOrigin | null;\n proposedNames: Record<string, ProposedNamesEntry>;\n};\n\nexport type SourceEntry = {\n label: string;\n};\n\nexport type NameControllerState = {\n // Type > Value > Variation > Entry\n names: Record<NameType, Record<string, Record<string, NameEntry>>>;\n nameSources: Record<string, SourceEntry>;\n};\n\nexport type GetNameState = ControllerGetStateAction<\n typeof controllerName,\n NameControllerState\n>;\n\nexport type NameStateChange = ControllerStateChangeEvent<\n typeof controllerName,\n NameControllerState\n>;\n\nexport type NameControllerActions = GetNameState;\n\nexport type NameControllerEvents = NameStateChange;\n\nexport type NameControllerMessenger = RestrictedControllerMessenger<\n typeof controllerName,\n NameControllerActions,\n NameControllerEvents,\n never,\n never\n>;\n\nexport type NameControllerOptions = {\n messenger: NameControllerMessenger;\n providers: NameProvider[];\n state?: Partial<NameControllerState>;\n updateDelay?: number;\n};\n\nexport type UpdateProposedNamesRequest = {\n value: string;\n type: NameType;\n sourceIds?: string[];\n onlyUpdateAfterDelay?: boolean;\n variation?: string;\n};\n\nexport type UpdateProposedNamesResult = {\n results: Record<string, { proposedNames?: string[]; error?: unknown }>;\n};\n\nexport type SetNameRequest = {\n value: string;\n type: NameType;\n name: string | null;\n sourceId?: string;\n variation?: string;\n origin?: NameOrigin;\n};\n\n/**\n * Controller for storing and deriving names for values such as Ethereum addresses.\n */\nexport class NameController extends BaseController<\n typeof controllerName,\n NameControllerState,\n NameControllerMessenger\n> {\n #providers: NameProvider[];\n\n #updateDelay: number;\n\n /**\n * Construct a Name controller.\n *\n * @param options - Controller options.\n * @param options.messenger - Restricted controller messenger for the name controller.\n * @param options.providers - Array of name provider instances to propose names.\n * @param options.state - Initial state to set on the controller.\n * @param options.updateDelay - The delay in seconds before a new request to a source should be made.\n */\n constructor({\n messenger,\n providers,\n state,\n updateDelay,\n }: NameControllerOptions) {\n super({\n name: controllerName,\n metadata: stateMetadata,\n messenger,\n state: { ...getDefaultState(), ...state },\n });\n\n this.#providers = providers;\n this.#updateDelay = updateDelay ?? DEFAULT_UPDATE_DELAY;\n }\n\n /**\n * Set the user specified name for a value.\n *\n * @param request - Request object.\n * @param request.name - Name to set.\n * @param request.sourceId - Optional ID of the source of the proposed name.\n * @param request.type - Type of value to set the name for.\n * @param request.value - Value to set the name for.\n * @param request.variation - Variation of the raw value to set the name for. The chain ID if the type is Ethereum address.\n */\n setName(request: SetNameRequest) {\n this.#validateSetNameRequest(request);\n\n const {\n value,\n type,\n name,\n sourceId: requestSourceId,\n origin: requestOrigin,\n variation,\n } = request;\n const sourceId = requestSourceId ?? null;\n // If the name is being cleared, the fallback origin should be cleared as well.\n const fallbackOrigin = name === null ? null : NameOrigin.API;\n const origin = requestOrigin ?? fallbackOrigin;\n\n this.#updateEntry(value, type, variation, (entry: NameEntry) => {\n entry.name = name;\n entry.sourceId = sourceId;\n entry.origin = origin;\n });\n }\n\n /**\n * Generate the proposed names for a value using the name providers and store them in the state.\n *\n * @param request - Request object.\n * @param request.value - Value to update the proposed names for.\n * @param request.type - Type of value to update the proposed names for.\n * @param request.sourceIds - Optional array of source IDs to limit which sources are used by the providers. If not provided, all sources in all providers will be used.\n * @param request.variation - Variation of the raw value to update proposed names for. The chain ID if the type is Ethereum address.\n * @returns The updated proposed names for the value.\n */\n async updateProposedNames(\n request: UpdateProposedNamesRequest,\n ): Promise<UpdateProposedNamesResult> {\n this.#validateUpdateProposedNamesRequest(request);\n\n const providerResponses = (\n await Promise.all(\n this.#providers.map((provider) =>\n this.#getProviderResponse(request, provider),\n ),\n )\n ).filter((response) => Boolean(response)) as NameProviderResult[];\n\n this.#updateProposedNameState(request, providerResponses);\n this.#updateSourceState(this.#providers);\n this.#removeExpiredEntries();\n\n return this.#getUpdateProposedNamesResult(providerResponses);\n }\n\n #updateProposedNameState(\n request: UpdateProposedNamesRequest,\n providerResponses: NameProviderResult[],\n ) {\n const { value, type, variation } = request;\n const currentTime = this.#getCurrentTimeSeconds();\n\n this.#updateEntry(value, type, variation, (entry: NameEntry) => {\n this.#removeDormantProposedNames(entry.proposedNames, type);\n\n for (const providerResponse of providerResponses) {\n const { results } = providerResponse;\n\n for (const sourceId of Object.keys(providerResponse.results)) {\n const result = results[sourceId];\n const { proposedNames, updateDelay } = result;\n\n const proposedNameEntry = entry.proposedNames[sourceId] ?? {\n proposedNames: [],\n lastRequestTime: null,\n updateDelay: null,\n };\n\n entry.proposedNames[sourceId] = proposedNameEntry;\n\n if (proposedNames) {\n proposedNameEntry.proposedNames = proposedNames;\n }\n\n proposedNameEntry.lastRequestTime = currentTime;\n proposedNameEntry.updateDelay = updateDelay ?? null;\n }\n }\n });\n }\n\n #updateSourceState(providers: NameProvider[]) {\n const newNameSources = { ...this.state.nameSources };\n\n for (const provider of providers) {\n const { sourceLabels } = provider.getMetadata();\n\n for (const sourceId of Object.keys(sourceLabels)) {\n newNameSources[sourceId] = {\n label: sourceLabels[sourceId],\n };\n }\n }\n\n this.update((state) => {\n state.nameSources = newNameSources;\n });\n }\n\n #getUpdateProposedNamesResult(\n providerResponses: NameProviderResult[],\n ): UpdateProposedNamesResult {\n return providerResponses.reduce(\n (acc: UpdateProposedNamesResult, providerResponse) => {\n const { results } = providerResponse;\n\n for (const sourceId of Object.keys(results)) {\n const { proposedNames, error } = results[sourceId];\n\n acc.results[sourceId] = {\n proposedNames,\n error,\n };\n }\n\n return acc;\n },\n { results: {} },\n );\n }\n\n async #getProviderResponse(\n request: UpdateProposedNamesRequest,\n provider: NameProvider,\n ): Promise<NameProviderResult | undefined> {\n const {\n value,\n type,\n sourceIds: requestedSourceIds,\n onlyUpdateAfterDelay,\n variation,\n } = request;\n\n /* istanbul ignore next */\n const variationKey = variation ?? DEFAULT_VARIATION;\n const supportedSourceIds = this.#getSourceIds(provider, type);\n const currentTime = this.#getCurrentTimeSeconds();\n const normalizedValue = this.#normalizeValue(value, type);\n\n const matchingSourceIds = supportedSourceIds.filter((sourceId) => {\n if (requestedSourceIds && !requestedSourceIds.includes(sourceId)) {\n return false;\n }\n\n if (onlyUpdateAfterDelay) {\n const entry =\n this.state.names[type]?.[normalizedValue]?.[variationKey] ?? {};\n const proposedNamesEntry = entry.proposedNames?.[sourceId] ?? {};\n const lastRequestTime = proposedNamesEntry.lastRequestTime ?? 0;\n const updateDelay = proposedNamesEntry.updateDelay ?? this.#updateDelay;\n\n if (currentTime - lastRequestTime < updateDelay) {\n return false;\n }\n }\n\n return true;\n });\n\n if (!matchingSourceIds.length) {\n return undefined;\n }\n\n const providerRequest: NameProviderRequest = {\n value: this.#normalizeValue(value, type),\n type,\n sourceIds: requestedSourceIds ? matchingSourceIds : undefined,\n variation: this.#normalizeVariation(variationKey, type),\n };\n\n let responseError: unknown | undefined;\n let response: NameProviderResult | undefined;\n\n try {\n response = await provider.getProposedNames(providerRequest);\n responseError = response.error;\n } catch (error) {\n responseError = error;\n }\n\n return this.#normalizeProviderResult(\n response,\n responseError,\n matchingSourceIds,\n );\n }\n\n #normalizeProviderResult(\n result: NameProviderResult | undefined,\n responseError: unknown,\n matchingSourceIds: string[],\n ): NameProviderResult {\n const error = responseError ?? undefined;\n\n const results = matchingSourceIds.reduce((acc, sourceId) => {\n const sourceResult = result?.results?.[sourceId];\n\n const normalizedSourceResult = this.#normalizeProviderSourceResult(\n sourceResult,\n responseError,\n );\n\n return {\n ...acc,\n [sourceId]: normalizedSourceResult,\n };\n }, {});\n\n return { results, error };\n }\n\n #normalizeProviderSourceResult(\n result: NameProviderSourceResult | undefined,\n responseError: unknown,\n ): NameProviderSourceResult | undefined {\n const error = result?.error ?? responseError ?? undefined;\n const updateDelay = result?.updateDelay ?? undefined;\n let proposedNames = error ? undefined : result?.proposedNames ?? undefined;\n\n if (proposedNames) {\n proposedNames = proposedNames.filter(\n (proposedName) => proposedName?.length,\n );\n }\n\n return {\n proposedNames,\n error,\n updateDelay,\n };\n }\n\n #normalizeValue(value: string, type: NameType): string {\n /* istanbul ignore next */\n switch (type) {\n case NameType.ETHEREUM_ADDRESS:\n return value.toLowerCase();\n\n default:\n return value;\n }\n }\n\n #normalizeVariation(variation: string, type: NameType): string {\n /* istanbul ignore next */\n switch (type) {\n case NameType.ETHEREUM_ADDRESS:\n return variation.toLowerCase();\n\n default:\n return variation;\n }\n }\n\n #updateEntry(\n value: string,\n type: NameType,\n variation: string | undefined,\n callback: (entry: NameEntry) => void,\n ) {\n /* istanbul ignore next */\n const variationKey = variation ?? DEFAULT_VARIATION;\n const normalizedValue = this.#normalizeValue(value, type);\n const normalizedVariation = this.#normalizeVariation(variationKey, type);\n\n if (\n [normalizedValue, normalizedVariation].some(\n (key) => !isSafeDynamicKey(key),\n )\n ) {\n return;\n }\n\n this.update((state) => {\n const typeEntries = state.names[type] || {};\n state.names[type] = typeEntries;\n\n const variationEntries = typeEntries[normalizedValue] || {};\n typeEntries[normalizedValue] = variationEntries;\n\n const entry = variationEntries[normalizedVariation] ?? {\n proposedNames: {},\n name: null,\n sourceId: null,\n origin: null,\n };\n variationEntries[normalizedVariation] = entry;\n\n callback(entry);\n });\n }\n\n #getCurrentTimeSeconds(): number {\n return Math.round(Date.now() / 1000);\n }\n\n #validateSetNameRequest(request: SetNameRequest) {\n const { name, value, type, sourceId, variation, origin } = request;\n const errorMessages: string[] = [];\n\n this.#validateValue(value, errorMessages);\n this.#validateType(type, errorMessages);\n this.#validateName(name, errorMessages);\n this.#validateSourceId(sourceId, type, name, errorMessages);\n this.#validateVariation(variation, type, errorMessages);\n this.#validateOrigin(origin, name, errorMessages);\n\n if (errorMessages.length) {\n throw new Error(errorMessages.join(' '));\n }\n }\n\n #validateUpdateProposedNamesRequest(request: UpdateProposedNamesRequest) {\n const { value, type, sourceIds, variation } = request;\n const errorMessages: string[] = [];\n\n this.#validateValue(value, errorMessages);\n this.#validateType(type, errorMessages);\n this.#validateSourceIds(sourceIds, type, errorMessages);\n this.#validateDuplicateSourceIds(type, errorMessages);\n this.#validateVariation(variation, type, errorMessages);\n\n if (errorMessages.length) {\n throw new Error(errorMessages.join(' '));\n }\n }\n\n #validateValue(value: string, errorMessages: string[]) {\n if (!value?.length || typeof value !== 'string') {\n errorMessages.push('Must specify a non-empty string for value.');\n }\n }\n\n #validateType(type: NameType, errorMessages: string[]) {\n if (!Object.values(NameType).includes(type)) {\n errorMessages.push(\n `Must specify one of the following types: ${Object.values(\n NameType,\n ).join(', ')}`,\n );\n }\n }\n\n #validateName(name: string | null, errorMessages: string[]) {\n if (name === null) {\n return;\n }\n\n if (!name?.length || typeof name !== 'string') {\n errorMessages.push('Must specify a non-empty string or null for name.');\n }\n }\n\n #validateSourceIds(\n sourceIds: string[] | undefined,\n type: NameType,\n errorMessages: string[],\n ) {\n if (!sourceIds) {\n return;\n }\n\n const allSourceIds = this.#getAllSourceIds(type);\n const missingSourceIds = [];\n\n for (const sourceId of sourceIds) {\n if (!allSourceIds.includes(sourceId)) {\n missingSourceIds.push(sourceId);\n continue;\n }\n }\n\n if (missingSourceIds.length) {\n errorMessages.push(\n `Unknown source IDs for type '${type}': ${missingSourceIds.join(', ')}`,\n );\n }\n }\n\n #validateSourceId(\n sourceId: string | undefined,\n type: NameType,\n name: string | null,\n errorMessages: string[],\n ) {\n if (sourceId === null || sourceId === undefined) {\n return;\n }\n\n if (name === null) {\n errorMessages.push(\n `Cannot specify a source ID when clearing the saved name: ${sourceId}`,\n );\n return;\n }\n\n const allSourceIds = this.#getAllSourceIds(type);\n\n if (!sourceId.length || typeof sourceId !== 'string') {\n errorMessages.push('Must specify a non-empty string for sourceId.');\n return;\n }\n\n if (!allSourceIds.includes(sourceId)) {\n errorMessages.push(`Unknown source ID for type '${type}': ${sourceId}`);\n }\n }\n\n #validateDuplicateSourceIds(type: NameType, errorMessages: string[]) {\n const allSourceIds = this.#getAllSourceIds(type);\n\n const duplicateSourceIds = allSourceIds.filter(\n (sourceId, index) => allSourceIds.indexOf(sourceId) !== index,\n );\n\n if (duplicateSourceIds.length) {\n errorMessages.push(\n `Duplicate source IDs found for type '${type}': ${duplicateSourceIds.join(\n ', ',\n )}`,\n );\n }\n }\n\n #validateVariation(\n variation: string | undefined,\n type: string,\n errorMessages: string[],\n ) {\n if (type !== NameType.ETHEREUM_ADDRESS) {\n return;\n }\n\n if (\n !variation?.length ||\n typeof variation !== 'string' ||\n (!variation.match(/^0x[0-9A-Fa-f]+$/u) &&\n variation !== FALLBACK_VARIATION)\n ) {\n errorMessages.push(\n `Must specify a chain ID in hexidecimal format or the fallback, \"${FALLBACK_VARIATION}\", for variation when using '${type}' type.`,\n );\n }\n }\n\n #validateOrigin(\n origin: NameOrigin | null | undefined,\n name: string | null,\n errorMessages: string[],\n ) {\n if (!origin) {\n return;\n }\n\n if (name === null) {\n errorMessages.push(\n `Cannot specify an origin when clearing the saved name: ${origin}`,\n );\n return;\n }\n\n if (!Object.values(NameOrigin).includes(origin)) {\n errorMessages.push(\n `Must specify one of the following origins: ${Object.values(\n NameOrigin,\n ).join(', ')}`,\n );\n }\n }\n\n #getAllSourceIds(type: NameType): string[] {\n return (\n this.#providers\n /* istanbul ignore next */\n .map((provider) => this.#getSourceIds(provider, type))\n .flat()\n );\n }\n\n #getSourceIds(provider: NameProvider, type: NameType): string[] {\n return provider.getMetadata().sourceIds[type];\n }\n\n #removeDormantProposedNames(\n proposedNames: Record<string, ProposedNamesEntry>,\n type: NameType,\n ) {\n if (Object.keys(proposedNames).length === 0) {\n return;\n }\n\n const typeSourceIds = this.#getAllSourceIds(type);\n\n const dormantSourceIds = Object.keys(proposedNames).filter(\n (sourceId) => !typeSourceIds.includes(sourceId),\n );\n\n for (const dormantSourceId of dormantSourceIds) {\n delete proposedNames[dormantSourceId];\n }\n }\n\n #removeExpiredEntries(): void {\n const currentTime = this.#getCurrentTimeSeconds();\n\n this.update((state: NameControllerState) => {\n const entries = this.#getEntriesList(state);\n for (const { nameType, value, variation, entry } of entries) {\n if (entry.name !== null) {\n continue;\n }\n\n const proposedNames = Object.values(entry.proposedNames);\n const allProposedNamesExpired = proposedNames.every(\n (proposedName: ProposedNamesEntry) =>\n currentTime - (proposedName.lastRequestTime ?? 0) >=\n PROPOSED_NAME_EXPIRE_DURATION,\n );\n\n if (allProposedNamesExpired) {\n delete state.names[nameType][value][variation];\n }\n }\n });\n }\n\n #getEntriesList(state: NameControllerState): {\n nameType: NameType;\n value: string;\n variation: string;\n entry: NameEntry;\n }[] {\n return Object.entries(state.names).flatMap(([type, typeEntries]) =>\n Object.entries(typeEntries).flatMap(([value, variationEntries]) =>\n Object.entries(variationEntries).map(([variation, entry]) => ({\n entry,\n nameType: type as NameType,\n value,\n variation,\n })),\n ),\n );\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedControllerMessenger } from
|
|
2
|
-
import { BaseController } from
|
|
3
|
-
import type { NameProvider } from
|
|
4
|
-
import { NameType } from
|
|
1
|
+
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedControllerMessenger } from "@metamask/base-controller";
|
|
2
|
+
import { BaseController } from "@metamask/base-controller";
|
|
3
|
+
import type { NameProvider } from "./types.cjs";
|
|
4
|
+
import { NameType } from "./types.cjs";
|
|
5
5
|
export declare const FALLBACK_VARIATION = "*";
|
|
6
6
|
export declare const PROPOSED_NAME_EXPIRE_DURATION: number;
|
|
7
7
|
/**
|
|
@@ -103,4 +103,4 @@ export declare class NameController extends BaseController<typeof controllerName
|
|
|
103
103
|
updateProposedNames(request: UpdateProposedNamesRequest): Promise<UpdateProposedNamesResult>;
|
|
104
104
|
}
|
|
105
105
|
export {};
|
|
106
|
-
//# sourceMappingURL=NameController.d.
|
|
106
|
+
//# sourceMappingURL=NameController.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NameController.d.cts","sourceRoot":"","sources":["../src/NameController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC9B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,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