@metamask-previews/assets-controllers 39.0.0-preview-5c534570 → 39.0.0-preview-e7f13cec
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/dist/AccountTrackerController.d.cts +4 -4
- package/dist/AccountTrackerController.d.mts +4 -4
- package/dist/CurrencyRateController.d.cts +4 -4
- package/dist/CurrencyRateController.d.mts +4 -4
- package/dist/TokenBalancesController.cjs +87 -36
- package/dist/TokenBalancesController.cjs.map +1 -1
- package/dist/TokenBalancesController.d.cts +34 -36
- package/dist/TokenBalancesController.d.cts.map +1 -1
- package/dist/TokenBalancesController.d.mts +34 -36
- package/dist/TokenBalancesController.d.mts.map +1 -1
- package/dist/TokenBalancesController.mjs +88 -37
- package/dist/TokenBalancesController.mjs.map +1 -1
- package/dist/TokenDetectionController.d.cts +4 -4
- package/dist/TokenDetectionController.d.mts +4 -4
- package/dist/TokenListController.d.cts +4 -4
- package/dist/TokenListController.d.mts +4 -4
- package/dist/TokenRatesController.d.cts +4 -4
- package/dist/TokenRatesController.d.mts +4 -4
- package/dist/assetsUtil.cjs +2 -2
- package/dist/assetsUtil.cjs.map +1 -1
- package/dist/assetsUtil.d.cts +3 -3
- package/dist/assetsUtil.d.cts.map +1 -1
- package/dist/assetsUtil.d.mts +3 -3
- package/dist/assetsUtil.d.mts.map +1 -1
- package/dist/assetsUtil.mjs +2 -2
- package/dist/assetsUtil.mjs.map +1 -1
- package/package.json +1 -2
- package/dist/multicall.cjs +0 -350
- package/dist/multicall.cjs.map +0 -1
- package/dist/multicall.d.cts +0 -26
- package/dist/multicall.d.cts.map +0 -1
- package/dist/multicall.d.mts +0 -26
- package/dist/multicall.d.mts.map +0 -1
- package/dist/multicall.mjs +0 -346
- package/dist/multicall.mjs.map +0 -1
|
@@ -62,14 +62,14 @@ type AccountTrackerPollingInput = {
|
|
|
62
62
|
networkClientId: NetworkClientId;
|
|
63
63
|
};
|
|
64
64
|
declare const AccountTrackerController_base: (abstract new (...args: any[]) => {
|
|
65
|
-
readonly "__#
|
|
66
|
-
"__#
|
|
65
|
+
readonly "__#787870@#intervalIds": Record<string, NodeJS.Timeout>;
|
|
66
|
+
"__#787870@#intervalLength": number | undefined;
|
|
67
67
|
setIntervalLength(intervalLength: number): void;
|
|
68
68
|
getIntervalLength(): number | undefined;
|
|
69
69
|
_startPolling(input: AccountTrackerPollingInput): void;
|
|
70
70
|
_stopPollingByPollingTokenSetId(key: string): void;
|
|
71
|
-
readonly "__#
|
|
72
|
-
"__#
|
|
71
|
+
readonly "__#787862@#pollingTokenSets": Map<string, Set<string>>;
|
|
72
|
+
"__#787862@#callbacks": Map<string, Set<(input: AccountTrackerPollingInput) => void>>;
|
|
73
73
|
_executePoll(input: AccountTrackerPollingInput): Promise<void>;
|
|
74
74
|
/**
|
|
75
75
|
* The action that can be performed to get the state of the {@link AccountTrackerController}.
|
|
@@ -62,14 +62,14 @@ type AccountTrackerPollingInput = {
|
|
|
62
62
|
networkClientId: NetworkClientId;
|
|
63
63
|
};
|
|
64
64
|
declare const AccountTrackerController_base: (abstract new (...args: any[]) => {
|
|
65
|
-
readonly "__#
|
|
66
|
-
"__#
|
|
65
|
+
readonly "__#787870@#intervalIds": Record<string, NodeJS.Timeout>;
|
|
66
|
+
"__#787870@#intervalLength": number | undefined;
|
|
67
67
|
setIntervalLength(intervalLength: number): void;
|
|
68
68
|
getIntervalLength(): number | undefined;
|
|
69
69
|
_startPolling(input: AccountTrackerPollingInput): void;
|
|
70
70
|
_stopPollingByPollingTokenSetId(key: string): void;
|
|
71
|
-
readonly "__#
|
|
72
|
-
"__#
|
|
71
|
+
readonly "__#787862@#pollingTokenSets": Map<string, Set<string>>;
|
|
72
|
+
"__#787862@#callbacks": Map<string, Set<(input: AccountTrackerPollingInput) => void>>;
|
|
73
73
|
_executePoll(input: AccountTrackerPollingInput): Promise<void>;
|
|
74
74
|
/**
|
|
75
75
|
* The action that can be performed to get the state of the {@link AccountTrackerController}.
|
|
@@ -29,14 +29,14 @@ type CurrencyRatePollingInput = {
|
|
|
29
29
|
nativeCurrency: string;
|
|
30
30
|
};
|
|
31
31
|
declare const CurrencyRateController_base: (abstract new (...args: any[]) => {
|
|
32
|
-
readonly "__#
|
|
33
|
-
"__#
|
|
32
|
+
readonly "__#787870@#intervalIds": Record<string, NodeJS.Timeout>;
|
|
33
|
+
"__#787870@#intervalLength": number | undefined;
|
|
34
34
|
setIntervalLength(intervalLength: number): void;
|
|
35
35
|
getIntervalLength(): number | undefined;
|
|
36
36
|
_startPolling(input: CurrencyRatePollingInput): void;
|
|
37
37
|
_stopPollingByPollingTokenSetId(key: string): void;
|
|
38
|
-
readonly "__#
|
|
39
|
-
"__#
|
|
38
|
+
readonly "__#787862@#pollingTokenSets": Map<string, Set<string>>;
|
|
39
|
+
"__#787862@#callbacks": Map<string, Set<(input: CurrencyRatePollingInput) => void>>;
|
|
40
40
|
_executePoll(input: CurrencyRatePollingInput): Promise<void>;
|
|
41
41
|
startPolling(input: CurrencyRatePollingInput): string;
|
|
42
42
|
stopAllPolling(): void;
|
|
@@ -29,14 +29,14 @@ type CurrencyRatePollingInput = {
|
|
|
29
29
|
nativeCurrency: string;
|
|
30
30
|
};
|
|
31
31
|
declare const CurrencyRateController_base: (abstract new (...args: any[]) => {
|
|
32
|
-
readonly "__#
|
|
33
|
-
"__#
|
|
32
|
+
readonly "__#787870@#intervalIds": Record<string, NodeJS.Timeout>;
|
|
33
|
+
"__#787870@#intervalLength": number | undefined;
|
|
34
34
|
setIntervalLength(intervalLength: number): void;
|
|
35
35
|
getIntervalLength(): number | undefined;
|
|
36
36
|
_startPolling(input: CurrencyRatePollingInput): void;
|
|
37
37
|
_stopPollingByPollingTokenSetId(key: string): void;
|
|
38
|
-
readonly "__#
|
|
39
|
-
"__#
|
|
38
|
+
readonly "__#787862@#pollingTokenSets": Map<string, Set<string>>;
|
|
39
|
+
"__#787862@#callbacks": Map<string, Set<(input: CurrencyRatePollingInput) => void>>;
|
|
40
40
|
_executePoll(input: CurrencyRatePollingInput): Promise<void>;
|
|
41
41
|
startPolling(input: CurrencyRatePollingInput): string;
|
|
42
42
|
stopAllPolling(): void;
|
|
@@ -1,16 +1,24 @@
|
|
|
1
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 _TokenBalancesController_handle, _TokenBalancesController_interval, _TokenBalancesController_tokens, _TokenBalancesController_disabled;
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
15
|
exports.TokenBalancesController = exports.getDefaultTokenBalancesState = void 0;
|
|
4
|
-
const
|
|
5
|
-
const providers_1 = require("@ethersproject/providers");
|
|
16
|
+
const base_controller_1 = require("@metamask/base-controller");
|
|
6
17
|
const controller_utils_1 = require("@metamask/controller-utils");
|
|
7
|
-
const metamask_eth_abis_1 = require("@metamask/metamask-eth-abis");
|
|
8
|
-
const polling_controller_1 = require("@metamask/polling-controller");
|
|
9
|
-
const multicall_1 = require("./multicall.cjs");
|
|
10
18
|
const DEFAULT_INTERVAL = 180000;
|
|
11
19
|
const controllerName = 'TokenBalancesController';
|
|
12
20
|
const metadata = {
|
|
13
|
-
|
|
21
|
+
contractBalances: { persist: true, anonymous: false },
|
|
14
22
|
};
|
|
15
23
|
/**
|
|
16
24
|
* Get the default TokenBalancesController state.
|
|
@@ -19,7 +27,7 @@ const metadata = {
|
|
|
19
27
|
*/
|
|
20
28
|
function getDefaultTokenBalancesState() {
|
|
21
29
|
return {
|
|
22
|
-
|
|
30
|
+
contractBalances: {},
|
|
23
31
|
};
|
|
24
32
|
}
|
|
25
33
|
exports.getDefaultTokenBalancesState = getDefaultTokenBalancesState;
|
|
@@ -27,16 +35,18 @@ exports.getDefaultTokenBalancesState = getDefaultTokenBalancesState;
|
|
|
27
35
|
* Controller that passively polls on a set interval token balances
|
|
28
36
|
* for tokens stored in the TokensController
|
|
29
37
|
*/
|
|
30
|
-
class TokenBalancesController extends
|
|
38
|
+
class TokenBalancesController extends base_controller_1.BaseController {
|
|
31
39
|
/**
|
|
32
40
|
* Construct a Token Balances Controller.
|
|
33
41
|
*
|
|
34
42
|
* @param options - The controller options.
|
|
35
43
|
* @param options.interval - Polling interval used to fetch new token balances.
|
|
44
|
+
* @param options.tokens - List of tokens to track balances for.
|
|
45
|
+
* @param options.disabled - If set to true, all tracked tokens contract balances updates are blocked.
|
|
36
46
|
* @param options.state - Initial state to set on this controller.
|
|
37
47
|
* @param options.messenger - The controller restricted messenger.
|
|
38
48
|
*/
|
|
39
|
-
constructor({ interval = DEFAULT_INTERVAL, messenger, state = {}, }) {
|
|
49
|
+
constructor({ interval = DEFAULT_INTERVAL, tokens = [], disabled = false, messenger, state = {}, }) {
|
|
40
50
|
super({
|
|
41
51
|
name: controllerName,
|
|
42
52
|
metadata,
|
|
@@ -46,40 +56,81 @@ class TokenBalancesController extends (0, polling_controller_1.StaticIntervalPol
|
|
|
46
56
|
...state,
|
|
47
57
|
},
|
|
48
58
|
});
|
|
49
|
-
|
|
59
|
+
_TokenBalancesController_handle.set(this, void 0);
|
|
60
|
+
_TokenBalancesController_interval.set(this, void 0);
|
|
61
|
+
_TokenBalancesController_tokens.set(this, void 0);
|
|
62
|
+
_TokenBalancesController_disabled.set(this, void 0);
|
|
63
|
+
__classPrivateFieldSet(this, _TokenBalancesController_disabled, disabled, "f");
|
|
64
|
+
__classPrivateFieldSet(this, _TokenBalancesController_interval, interval, "f");
|
|
65
|
+
__classPrivateFieldSet(this, _TokenBalancesController_tokens, tokens, "f");
|
|
66
|
+
this.messagingSystem.subscribe('TokensController:stateChange', ({ tokens: newTokens, detectedTokens }) => {
|
|
67
|
+
__classPrivateFieldSet(this, _TokenBalancesController_tokens, [...newTokens, ...detectedTokens], "f");
|
|
68
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
70
|
+
this.updateBalances();
|
|
71
|
+
});
|
|
72
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
74
|
+
this.poll();
|
|
50
75
|
}
|
|
51
76
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @param input - The input for the poll.
|
|
54
|
-
* @param input.networkClientId - The network client id to poll with.
|
|
55
|
-
* @param input.tokensPerAccount - A mapping from account addresses to token addresses to poll.
|
|
77
|
+
* Allows controller to update tracked tokens contract balances.
|
|
56
78
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
enable() {
|
|
80
|
+
__classPrivateFieldSet(this, _TokenBalancesController_disabled, false, "f");
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Blocks controller from updating tracked tokens contract balances.
|
|
84
|
+
*/
|
|
85
|
+
disable() {
|
|
86
|
+
__classPrivateFieldSet(this, _TokenBalancesController_disabled, true, "f");
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Starts a new polling interval.
|
|
90
|
+
*
|
|
91
|
+
* @param interval - Polling interval used to fetch new token balances.
|
|
92
|
+
*/
|
|
93
|
+
async poll(interval) {
|
|
94
|
+
if (interval) {
|
|
95
|
+
__classPrivateFieldSet(this, _TokenBalancesController_interval, interval, "f");
|
|
96
|
+
}
|
|
97
|
+
if (__classPrivateFieldGet(this, _TokenBalancesController_handle, "f")) {
|
|
98
|
+
clearTimeout(__classPrivateFieldGet(this, _TokenBalancesController_handle, "f"));
|
|
99
|
+
}
|
|
100
|
+
await (0, controller_utils_1.safelyExecute)(() => this.updateBalances());
|
|
101
|
+
__classPrivateFieldSet(this, _TokenBalancesController_handle, setTimeout(() => {
|
|
102
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
104
|
+
this.poll(__classPrivateFieldGet(this, _TokenBalancesController_interval, "f"));
|
|
105
|
+
}, __classPrivateFieldGet(this, _TokenBalancesController_interval, "f")), "f");
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Updates balances for all tokens.
|
|
109
|
+
*/
|
|
110
|
+
async updateBalances() {
|
|
111
|
+
if (__classPrivateFieldGet(this, _TokenBalancesController_disabled, "f")) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const selectedInternalAccount = this.messagingSystem.call('AccountsController:getSelectedAccount');
|
|
115
|
+
const newContractBalances = {};
|
|
116
|
+
for (const token of __classPrivateFieldGet(this, _TokenBalancesController_tokens, "f")) {
|
|
117
|
+
const { address } = token;
|
|
118
|
+
try {
|
|
119
|
+
const balance = await this.messagingSystem.call('AssetsContractController:getERC20BalanceOf', address, selectedInternalAccount.address);
|
|
120
|
+
newContractBalances[address] = (0, controller_utils_1.toHex)(balance);
|
|
121
|
+
token.hasBalanceError = false;
|
|
79
122
|
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
newContractBalances[address] = (0, controller_utils_1.toHex)(0);
|
|
125
|
+
token.hasBalanceError = true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
this.update((state) => {
|
|
129
|
+
state.contractBalances = newContractBalances;
|
|
80
130
|
});
|
|
81
131
|
}
|
|
82
132
|
}
|
|
83
133
|
exports.TokenBalancesController = TokenBalancesController;
|
|
134
|
+
_TokenBalancesController_handle = new WeakMap(), _TokenBalancesController_interval = new WeakMap(), _TokenBalancesController_tokens = new WeakMap(), _TokenBalancesController_disabled = new WeakMap();
|
|
84
135
|
exports.default = TokenBalancesController;
|
|
85
136
|
//# sourceMappingURL=TokenBalancesController.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenBalancesController.cjs","sourceRoot":"","sources":["../src/TokenBalancesController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TokenBalancesController.cjs","sourceRoot":"","sources":["../src/TokenBalancesController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMA,+DAA2D;AAC3D,iEAAkE;AAMlE,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAEjD,MAAM,QAAQ,GAAG;IACf,gBAAgB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE;CACtD,CAAC;AA4DF;;;;GAIG;AACH,SAAgB,4BAA4B;IAC1C,OAAO;QACL,gBAAgB,EAAE,EAAE;KACrB,CAAC;AACJ,CAAC;AAJD,oEAIC;AAED;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,gCAI5C;IASC;;;;;;;;;OASG;IACH,YAAY,EACV,QAAQ,GAAG,gBAAgB,EAC3B,MAAM,GAAG,EAAE,EACX,QAAQ,G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CAAC;QAEjD,uBAAA,IAAI,mCAAW,UAAU,CAAC,GAAG,EAAE;YAC7B,gFAAgF;YAChF,mEAAmE;YACnE,IAAI,CAAC,IAAI,CAAC,uBAAA,IAAI,yCAAU,CAAC,CAAC;QAC5B,CAAC,EAAE,uBAAA,IAAI,yCAAU,CAAC,MAAA,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc;QAClB,IAAI,uBAAA,IAAI,yCAAU,EAAE;YAClB,OAAO;SACR;QACD,MAAM,uBAAuB,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CACvD,uCAAuC,CACxC,CAAC;QAEF,MAAM,mBAAmB,GAAqB,EAAE,CAAC;QACjD,KAAK,MAAM,KAAK,IAAI,uBAAA,IAAI,uCAAQ,EAAE;YAChC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;YAC1B,IAAI;gBACF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAC7C,4CAA4C,EAC5C,OAAO,EACP,uBAAuB,CAAC,OAAO,CAChC,CAAC;gBACF,mBAAmB,CAAC,OAAO,CAAC,GAAG,IAAA,wBAAK,EAAC,OAAO,CAAC,CAAC;gBAC9C,KAAK,CAAC,eAAe,GAAG,KAAK,CAAC;aAC/B;YAAC,OAAO,KAAK,EAAE;gBACd,mBAAmB,CAAC,OAAO,CAAC,GAAG,IAAA,wBAAK,EAAC,CAAC,CAAC,CAAC;gBACxC,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;aAC9B;SACF;QAED,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhID,0DAgIC;;AAED,kBAAe,uBAAuB,CAAC","sourcesContent":["import type { AccountsControllerGetSelectedAccountAction } from '@metamask/accounts-controller';\nimport type {\n RestrictedControllerMessenger,\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport { safelyExecute, toHex } from '@metamask/controller-utils';\n\nimport type { AssetsContractControllerGetERC20BalanceOfAction } from './AssetsContractController';\nimport type { Token } from './TokenRatesController';\nimport type { TokensControllerStateChangeEvent } from './TokensController';\n\nconst DEFAULT_INTERVAL = 180000;\n\nconst controllerName = 'TokenBalancesController';\n\nconst metadata = {\n contractBalances: { persist: true, anonymous: false },\n};\n\n/**\n * Token balances controller options\n * @property interval - Polling interval used to fetch new token balances.\n * @property tokens - List of tokens to track balances for.\n * @property disabled - If set to true, all tracked tokens contract balances updates are blocked.\n */\ntype TokenBalancesControllerOptions = {\n interval?: number;\n tokens?: Token[];\n disabled?: boolean;\n messenger: TokenBalancesControllerMessenger;\n state?: Partial<TokenBalancesControllerState>;\n};\n\n/**\n * Represents a mapping of hash token contract addresses to their balances.\n */\ntype ContractBalances = Record<string, string>;\n\n/**\n * Token balances controller state\n * @property contractBalances - Hash of token contract addresses to balances\n */\nexport type TokenBalancesControllerState = {\n contractBalances: ContractBalances;\n};\n\nexport type TokenBalancesControllerGetStateAction = ControllerGetStateAction<\n typeof controllerName,\n TokenBalancesControllerState\n>;\n\nexport type TokenBalancesControllerActions =\n TokenBalancesControllerGetStateAction;\n\nexport type AllowedActions =\n | AccountsControllerGetSelectedAccountAction\n | AssetsContractControllerGetERC20BalanceOfAction;\n\nexport type TokenBalancesControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n TokenBalancesControllerState\n >;\n\nexport type TokenBalancesControllerEvents =\n TokenBalancesControllerStateChangeEvent;\n\nexport type AllowedEvents = TokensControllerStateChangeEvent;\n\nexport type TokenBalancesControllerMessenger = RestrictedControllerMessenger<\n typeof controllerName,\n TokenBalancesControllerActions | AllowedActions,\n TokenBalancesControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n\n/**\n * Get the default TokenBalancesController state.\n *\n * @returns The default TokenBalancesController state.\n */\nexport function getDefaultTokenBalancesState(): TokenBalancesControllerState {\n return {\n contractBalances: {},\n };\n}\n\n/**\n * Controller that passively polls on a set interval token balances\n * for tokens stored in the TokensController\n */\nexport class TokenBalancesController extends BaseController<\n typeof controllerName,\n TokenBalancesControllerState,\n TokenBalancesControllerMessenger\n> {\n #handle?: ReturnType<typeof setTimeout>;\n\n #interval: number;\n\n #tokens: Token[];\n\n #disabled: boolean;\n\n /**\n * Construct a Token Balances Controller.\n *\n * @param options - The controller options.\n * @param options.interval - Polling interval used to fetch new token balances.\n * @param options.tokens - List of tokens to track balances for.\n * @param options.disabled - If set to true, all tracked tokens contract balances updates are blocked.\n * @param options.state - Initial state to set on this controller.\n * @param options.messenger - The controller restricted messenger.\n */\n constructor({\n interval = DEFAULT_INTERVAL,\n tokens = [],\n disabled = false,\n messenger,\n state = {},\n }: TokenBalancesControllerOptions) {\n super({\n name: controllerName,\n metadata,\n messenger,\n state: {\n ...getDefaultTokenBalancesState(),\n ...state,\n },\n });\n\n this.#disabled = disabled;\n this.#interval = interval;\n this.#tokens = tokens;\n\n this.messagingSystem.subscribe(\n 'TokensController:stateChange',\n ({ tokens: newTokens, detectedTokens }) => {\n this.#tokens = [...newTokens, ...detectedTokens];\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.updateBalances();\n },\n );\n\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.poll();\n }\n\n /**\n * Allows controller to update tracked tokens contract balances.\n */\n enable() {\n this.#disabled = false;\n }\n\n /**\n * Blocks controller from updating tracked tokens contract balances.\n */\n disable() {\n this.#disabled = true;\n }\n\n /**\n * Starts a new polling interval.\n *\n * @param interval - Polling interval used to fetch new token balances.\n */\n async poll(interval?: number): Promise<void> {\n if (interval) {\n this.#interval = interval;\n }\n\n if (this.#handle) {\n clearTimeout(this.#handle);\n }\n\n await safelyExecute(() => this.updateBalances());\n\n this.#handle = setTimeout(() => {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.poll(this.#interval);\n }, this.#interval);\n }\n\n /**\n * Updates balances for all tokens.\n */\n async updateBalances() {\n if (this.#disabled) {\n return;\n }\n const selectedInternalAccount = this.messagingSystem.call(\n 'AccountsController:getSelectedAccount',\n );\n\n const newContractBalances: ContractBalances = {};\n for (const token of this.#tokens) {\n const { address } = token;\n try {\n const balance = await this.messagingSystem.call(\n 'AssetsContractController:getERC20BalanceOf',\n address,\n selectedInternalAccount.address,\n );\n newContractBalances[address] = toHex(balance);\n token.hasBalanceError = false;\n } catch (error) {\n newContractBalances[address] = toHex(0);\n token.hasBalanceError = true;\n }\n }\n\n this.update((state) => {\n state.contractBalances = newContractBalances;\n });\n }\n}\n\nexport default TokenBalancesController;\n"]}
|
|
@@ -1,33 +1,37 @@
|
|
|
1
|
+
import type { AccountsControllerGetSelectedAccountAction } from "@metamask/accounts-controller";
|
|
1
2
|
import type { RestrictedControllerMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
3
|
+
import { BaseController } from "@metamask/base-controller";
|
|
4
|
+
import type { AssetsContractControllerGetERC20BalanceOfAction } from "./AssetsContractController.cjs";
|
|
5
|
+
import type { Token } from "./TokenRatesController.cjs";
|
|
4
6
|
import type { TokensControllerStateChangeEvent } from "./TokensController.cjs";
|
|
5
7
|
declare const controllerName = "TokenBalancesController";
|
|
6
8
|
/**
|
|
7
9
|
* Token balances controller options
|
|
8
10
|
* @property interval - Polling interval used to fetch new token balances.
|
|
9
|
-
* @property
|
|
10
|
-
* @property
|
|
11
|
+
* @property tokens - List of tokens to track balances for.
|
|
12
|
+
* @property disabled - If set to true, all tracked tokens contract balances updates are blocked.
|
|
11
13
|
*/
|
|
12
14
|
type TokenBalancesControllerOptions = {
|
|
13
15
|
interval?: number;
|
|
16
|
+
tokens?: Token[];
|
|
17
|
+
disabled?: boolean;
|
|
14
18
|
messenger: TokenBalancesControllerMessenger;
|
|
15
19
|
state?: Partial<TokenBalancesControllerState>;
|
|
16
20
|
};
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
22
|
+
* Represents a mapping of hash token contract addresses to their balances.
|
|
19
23
|
*/
|
|
20
|
-
type
|
|
24
|
+
type ContractBalances = Record<string, string>;
|
|
21
25
|
/**
|
|
22
26
|
* Token balances controller state
|
|
23
|
-
* @property
|
|
27
|
+
* @property contractBalances - Hash of token contract addresses to balances
|
|
24
28
|
*/
|
|
25
29
|
export type TokenBalancesControllerState = {
|
|
26
|
-
|
|
30
|
+
contractBalances: ContractBalances;
|
|
27
31
|
};
|
|
28
32
|
export type TokenBalancesControllerGetStateAction = ControllerGetStateAction<typeof controllerName, TokenBalancesControllerState>;
|
|
29
33
|
export type TokenBalancesControllerActions = TokenBalancesControllerGetStateAction;
|
|
30
|
-
export type AllowedActions =
|
|
34
|
+
export type AllowedActions = AccountsControllerGetSelectedAccountAction | AssetsContractControllerGetERC20BalanceOfAction;
|
|
31
35
|
export type TokenBalancesControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, TokenBalancesControllerState>;
|
|
32
36
|
export type TokenBalancesControllerEvents = TokenBalancesControllerStateChangeEvent;
|
|
33
37
|
export type AllowedEvents = TokensControllerStateChangeEvent;
|
|
@@ -38,47 +42,41 @@ export type TokenBalancesControllerMessenger = RestrictedControllerMessenger<typ
|
|
|
38
42
|
* @returns The default TokenBalancesController state.
|
|
39
43
|
*/
|
|
40
44
|
export declare function getDefaultTokenBalancesState(): TokenBalancesControllerState;
|
|
41
|
-
/** The input to start polling for the {@link TokenBalancesController} */
|
|
42
|
-
export type TokenBalancesPollingInput = {
|
|
43
|
-
networkClientId: NetworkClientId;
|
|
44
|
-
tokensPerAccount: Record<Hex, Hex[]>;
|
|
45
|
-
};
|
|
46
|
-
declare const TokenBalancesController_base: (abstract new (...args: any[]) => {
|
|
47
|
-
readonly "__#787826@#intervalIds": Record<string, NodeJS.Timeout>;
|
|
48
|
-
"__#787826@#intervalLength": number | undefined;
|
|
49
|
-
setIntervalLength(intervalLength: number): void;
|
|
50
|
-
getIntervalLength(): number | undefined;
|
|
51
|
-
_startPolling(input: TokenBalancesPollingInput): void;
|
|
52
|
-
_stopPollingByPollingTokenSetId(key: string): void;
|
|
53
|
-
readonly "__#787818@#pollingTokenSets": Map<string, Set<string>>;
|
|
54
|
-
"__#787818@#callbacks": Map<string, Set<(input: TokenBalancesPollingInput) => void>>;
|
|
55
|
-
_executePoll(input: TokenBalancesPollingInput): Promise<void>;
|
|
56
|
-
startPolling(input: TokenBalancesPollingInput): string;
|
|
57
|
-
stopAllPolling(): void;
|
|
58
|
-
stopPollingByPollingToken(pollingToken: string): void;
|
|
59
|
-
onPollingComplete(input: TokenBalancesPollingInput, callback: (input: TokenBalancesPollingInput) => void): void;
|
|
60
|
-
}) & typeof import("@metamask/base-controller").BaseController;
|
|
61
45
|
/**
|
|
62
46
|
* Controller that passively polls on a set interval token balances
|
|
63
47
|
* for tokens stored in the TokensController
|
|
64
48
|
*/
|
|
65
|
-
export declare class TokenBalancesController extends
|
|
49
|
+
export declare class TokenBalancesController extends BaseController<typeof controllerName, TokenBalancesControllerState, TokenBalancesControllerMessenger> {
|
|
50
|
+
#private;
|
|
66
51
|
/**
|
|
67
52
|
* Construct a Token Balances Controller.
|
|
68
53
|
*
|
|
69
54
|
* @param options - The controller options.
|
|
70
55
|
* @param options.interval - Polling interval used to fetch new token balances.
|
|
56
|
+
* @param options.tokens - List of tokens to track balances for.
|
|
57
|
+
* @param options.disabled - If set to true, all tracked tokens contract balances updates are blocked.
|
|
71
58
|
* @param options.state - Initial state to set on this controller.
|
|
72
59
|
* @param options.messenger - The controller restricted messenger.
|
|
73
60
|
*/
|
|
74
|
-
constructor({ interval, messenger, state, }: TokenBalancesControllerOptions);
|
|
61
|
+
constructor({ interval, tokens, disabled, messenger, state, }: TokenBalancesControllerOptions);
|
|
62
|
+
/**
|
|
63
|
+
* Allows controller to update tracked tokens contract balances.
|
|
64
|
+
*/
|
|
65
|
+
enable(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Blocks controller from updating tracked tokens contract balances.
|
|
68
|
+
*/
|
|
69
|
+
disable(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Starts a new polling interval.
|
|
72
|
+
*
|
|
73
|
+
* @param interval - Polling interval used to fetch new token balances.
|
|
74
|
+
*/
|
|
75
|
+
poll(interval?: number): Promise<void>;
|
|
75
76
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @param input - The input for the poll.
|
|
78
|
-
* @param input.networkClientId - The network client id to poll with.
|
|
79
|
-
* @param input.tokensPerAccount - A mapping from account addresses to token addresses to poll.
|
|
77
|
+
* Updates balances for all tokens.
|
|
80
78
|
*/
|
|
81
|
-
|
|
79
|
+
updateBalances(): Promise<void>;
|
|
82
80
|
}
|
|
83
81
|
export default TokenBalancesController;
|
|
84
82
|
//# sourceMappingURL=TokenBalancesController.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenBalancesController.d.cts","sourceRoot":"","sources":["../src/TokenBalancesController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TokenBalancesController.d.cts","sourceRoot":"","sources":["../src/TokenBalancesController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0CAA0C,EAAE,sCAAsC;AAChG,OAAO,KAAK,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,EAC3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAG3D,OAAO,KAAK,EAAE,+CAA+C,EAAE,uCAAmC;AAClG,OAAO,KAAK,EAAE,KAAK,EAAE,mCAA+B;AACpD,OAAO,KAAK,EAAE,gCAAgC,EAAE,+BAA2B;AAI3E,QAAA,MAAM,cAAc,4BAA4B,CAAC;AAMjD;;;;;GAKG;AACH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,EAAE,8BAA8B;IA8BjC;;OAEG;IACH,MAAM;IAIN;;OAEG;IACH,OAAO;IAIP;;;;OAIG;IACG,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB5C;;OAEG;IACG,cAAc;CA6BrB;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,33 +1,37 @@
|
|
|
1
|
+
import type { AccountsControllerGetSelectedAccountAction } from "@metamask/accounts-controller";
|
|
1
2
|
import type { RestrictedControllerMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
3
|
+
import { BaseController } from "@metamask/base-controller";
|
|
4
|
+
import type { AssetsContractControllerGetERC20BalanceOfAction } from "./AssetsContractController.mjs";
|
|
5
|
+
import type { Token } from "./TokenRatesController.mjs";
|
|
4
6
|
import type { TokensControllerStateChangeEvent } from "./TokensController.mjs";
|
|
5
7
|
declare const controllerName = "TokenBalancesController";
|
|
6
8
|
/**
|
|
7
9
|
* Token balances controller options
|
|
8
10
|
* @property interval - Polling interval used to fetch new token balances.
|
|
9
|
-
* @property
|
|
10
|
-
* @property
|
|
11
|
+
* @property tokens - List of tokens to track balances for.
|
|
12
|
+
* @property disabled - If set to true, all tracked tokens contract balances updates are blocked.
|
|
11
13
|
*/
|
|
12
14
|
type TokenBalancesControllerOptions = {
|
|
13
15
|
interval?: number;
|
|
16
|
+
tokens?: Token[];
|
|
17
|
+
disabled?: boolean;
|
|
14
18
|
messenger: TokenBalancesControllerMessenger;
|
|
15
19
|
state?: Partial<TokenBalancesControllerState>;
|
|
16
20
|
};
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
22
|
+
* Represents a mapping of hash token contract addresses to their balances.
|
|
19
23
|
*/
|
|
20
|
-
type
|
|
24
|
+
type ContractBalances = Record<string, string>;
|
|
21
25
|
/**
|
|
22
26
|
* Token balances controller state
|
|
23
|
-
* @property
|
|
27
|
+
* @property contractBalances - Hash of token contract addresses to balances
|
|
24
28
|
*/
|
|
25
29
|
export type TokenBalancesControllerState = {
|
|
26
|
-
|
|
30
|
+
contractBalances: ContractBalances;
|
|
27
31
|
};
|
|
28
32
|
export type TokenBalancesControllerGetStateAction = ControllerGetStateAction<typeof controllerName, TokenBalancesControllerState>;
|
|
29
33
|
export type TokenBalancesControllerActions = TokenBalancesControllerGetStateAction;
|
|
30
|
-
export type AllowedActions =
|
|
34
|
+
export type AllowedActions = AccountsControllerGetSelectedAccountAction | AssetsContractControllerGetERC20BalanceOfAction;
|
|
31
35
|
export type TokenBalancesControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, TokenBalancesControllerState>;
|
|
32
36
|
export type TokenBalancesControllerEvents = TokenBalancesControllerStateChangeEvent;
|
|
33
37
|
export type AllowedEvents = TokensControllerStateChangeEvent;
|
|
@@ -38,47 +42,41 @@ export type TokenBalancesControllerMessenger = RestrictedControllerMessenger<typ
|
|
|
38
42
|
* @returns The default TokenBalancesController state.
|
|
39
43
|
*/
|
|
40
44
|
export declare function getDefaultTokenBalancesState(): TokenBalancesControllerState;
|
|
41
|
-
/** The input to start polling for the {@link TokenBalancesController} */
|
|
42
|
-
export type TokenBalancesPollingInput = {
|
|
43
|
-
networkClientId: NetworkClientId;
|
|
44
|
-
tokensPerAccount: Record<Hex, Hex[]>;
|
|
45
|
-
};
|
|
46
|
-
declare const TokenBalancesController_base: (abstract new (...args: any[]) => {
|
|
47
|
-
readonly "__#787826@#intervalIds": Record<string, NodeJS.Timeout>;
|
|
48
|
-
"__#787826@#intervalLength": number | undefined;
|
|
49
|
-
setIntervalLength(intervalLength: number): void;
|
|
50
|
-
getIntervalLength(): number | undefined;
|
|
51
|
-
_startPolling(input: TokenBalancesPollingInput): void;
|
|
52
|
-
_stopPollingByPollingTokenSetId(key: string): void;
|
|
53
|
-
readonly "__#787818@#pollingTokenSets": Map<string, Set<string>>;
|
|
54
|
-
"__#787818@#callbacks": Map<string, Set<(input: TokenBalancesPollingInput) => void>>;
|
|
55
|
-
_executePoll(input: TokenBalancesPollingInput): Promise<void>;
|
|
56
|
-
startPolling(input: TokenBalancesPollingInput): string;
|
|
57
|
-
stopAllPolling(): void;
|
|
58
|
-
stopPollingByPollingToken(pollingToken: string): void;
|
|
59
|
-
onPollingComplete(input: TokenBalancesPollingInput, callback: (input: TokenBalancesPollingInput) => void): void;
|
|
60
|
-
}) & typeof import("@metamask/base-controller").BaseController;
|
|
61
45
|
/**
|
|
62
46
|
* Controller that passively polls on a set interval token balances
|
|
63
47
|
* for tokens stored in the TokensController
|
|
64
48
|
*/
|
|
65
|
-
export declare class TokenBalancesController extends
|
|
49
|
+
export declare class TokenBalancesController extends BaseController<typeof controllerName, TokenBalancesControllerState, TokenBalancesControllerMessenger> {
|
|
50
|
+
#private;
|
|
66
51
|
/**
|
|
67
52
|
* Construct a Token Balances Controller.
|
|
68
53
|
*
|
|
69
54
|
* @param options - The controller options.
|
|
70
55
|
* @param options.interval - Polling interval used to fetch new token balances.
|
|
56
|
+
* @param options.tokens - List of tokens to track balances for.
|
|
57
|
+
* @param options.disabled - If set to true, all tracked tokens contract balances updates are blocked.
|
|
71
58
|
* @param options.state - Initial state to set on this controller.
|
|
72
59
|
* @param options.messenger - The controller restricted messenger.
|
|
73
60
|
*/
|
|
74
|
-
constructor({ interval, messenger, state, }: TokenBalancesControllerOptions);
|
|
61
|
+
constructor({ interval, tokens, disabled, messenger, state, }: TokenBalancesControllerOptions);
|
|
62
|
+
/**
|
|
63
|
+
* Allows controller to update tracked tokens contract balances.
|
|
64
|
+
*/
|
|
65
|
+
enable(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Blocks controller from updating tracked tokens contract balances.
|
|
68
|
+
*/
|
|
69
|
+
disable(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Starts a new polling interval.
|
|
72
|
+
*
|
|
73
|
+
* @param interval - Polling interval used to fetch new token balances.
|
|
74
|
+
*/
|
|
75
|
+
poll(interval?: number): Promise<void>;
|
|
75
76
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @param input - The input for the poll.
|
|
78
|
-
* @param input.networkClientId - The network client id to poll with.
|
|
79
|
-
* @param input.tokensPerAccount - A mapping from account addresses to token addresses to poll.
|
|
77
|
+
* Updates balances for all tokens.
|
|
80
78
|
*/
|
|
81
|
-
|
|
79
|
+
updateBalances(): Promise<void>;
|
|
82
80
|
}
|
|
83
81
|
export default TokenBalancesController;
|
|
84
82
|
//# sourceMappingURL=TokenBalancesController.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenBalancesController.d.mts","sourceRoot":"","sources":["../src/TokenBalancesController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TokenBalancesController.d.mts","sourceRoot":"","sources":["../src/TokenBalancesController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0CAA0C,EAAE,sCAAsC;AAChG,OAAO,KAAK,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,EAC3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAG3D,OAAO,KAAK,EAAE,+CAA+C,EAAE,uCAAmC;AAClG,OAAO,KAAK,EAAE,KAAK,EAAE,mCAA+B;AACpD,OAAO,KAAK,EAAE,gCAAgC,EAAE,+BAA2B;AAI3E,QAAA,MAAM,cAAc,4BAA4B,CAAC;AAMjD;;;;;GAKG;AACH,KAAK,8BAA8B,GAAG;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,gCAAgC,CAAC;IAC5C,KAAK,CAAC,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,KAAK,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C;;;GAGG;AACH,MAAM,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