mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
fix cached detected token results (#16866)
This commit is contained in:
parent
c76453d6cb
commit
5d285f7be5
@ -459,6 +459,53 @@ const state = {
|
|||||||
decimals: 18,
|
decimals: 18,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
allDetectedTokens: {
|
||||||
|
'0x5' : {
|
||||||
|
'0x9d0ba4ddac06032527b140912ec808ab9451b788': [
|
||||||
|
{
|
||||||
|
address: '0x514910771AF9Ca656af840dff83E8264EcF986CA',
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'LINK',
|
||||||
|
image: 'https://crypto.com/price/coin-data/icon/LINK/color_icon.png',
|
||||||
|
aggregators: ['coinGecko', 'oneInch', 'paraswap', 'zapper', 'zerion'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
address: '0xc00e94Cb662C3520282E6f5717214004A7f26888',
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'COMP',
|
||||||
|
image: 'https://crypto.com/price/coin-data/icon/COMP/color_icon.png',
|
||||||
|
aggregators: [
|
||||||
|
'bancor',
|
||||||
|
'cmc',
|
||||||
|
'cryptocom',
|
||||||
|
'coinGecko',
|
||||||
|
'oneInch',
|
||||||
|
'paraswap',
|
||||||
|
'pmm',
|
||||||
|
'zapper',
|
||||||
|
'zerion',
|
||||||
|
'zeroEx',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
address: '0xfffffffFf15AbF397dA76f1dcc1A1604F45126DB',
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'FSW',
|
||||||
|
image:
|
||||||
|
'https://assets.coingecko.com/coins/images/12256/thumb/falconswap.png?1598534184',
|
||||||
|
aggregators: [
|
||||||
|
'aave',
|
||||||
|
'cmc',
|
||||||
|
'coinGecko',
|
||||||
|
'oneInch',
|
||||||
|
'paraswap',
|
||||||
|
'zapper',
|
||||||
|
'zerion',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
detectedTokens: [
|
detectedTokens: [
|
||||||
{
|
{
|
||||||
address: '0x514910771AF9Ca656af840dff83E8264EcF986CA',
|
address: '0x514910771AF9Ca656af840dff83E8264EcF986CA',
|
||||||
|
@ -66,7 +66,7 @@ export default class DetectTokensController {
|
|||||||
) {
|
) {
|
||||||
this.selectedAddress = selectedAddress;
|
this.selectedAddress = selectedAddress;
|
||||||
this.useTokenDetection = useTokenDetection;
|
this.useTokenDetection = useTokenDetection;
|
||||||
this.restartTokenDetection();
|
this.restartTokenDetection({ selectedAddress });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tokensController?.subscribe(
|
tokensController?.subscribe(
|
||||||
@ -82,28 +82,31 @@ export default class DetectTokensController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* For each token in the tokenlist provided by the TokenListController, check selectedAddress balance.
|
* For each token in the tokenlist provided by the TokenListController, check selectedAddress balance.
|
||||||
|
*
|
||||||
|
* @param options
|
||||||
|
* @param options.selectedAddress - the selectedAddress against which to detect for token balances
|
||||||
|
* @param options.chainId - the chainId against which to detect for token balances
|
||||||
*/
|
*/
|
||||||
async detectNewTokens() {
|
async detectNewTokens({ selectedAddress, chainId } = {}) {
|
||||||
|
const addressAgainstWhichToDetect = selectedAddress ?? this.selectedAddress;
|
||||||
|
const chainIdAgainstWhichToDetect =
|
||||||
|
chainId ?? this.getChainIdFromNetworkStore(this._network);
|
||||||
if (!this.isActive) {
|
if (!this.isActive) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (!isTokenDetectionEnabledForNetwork(chainIdAgainstWhichToDetect)) {
|
||||||
!isTokenDetectionEnabledForNetwork(
|
|
||||||
this.getChainIdFromNetworkStore(this._network),
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
!this.useTokenDetection &&
|
!this.useTokenDetection &&
|
||||||
this.getChainIdFromNetworkStore(this._network) !== CHAIN_IDS.MAINNET
|
chainIdAgainstWhichToDetect !== CHAIN_IDS.MAINNET
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isTokenDetectionInactiveInMainnet =
|
const isTokenDetectionInactiveInMainnet =
|
||||||
!this.useTokenDetection &&
|
!this.useTokenDetection &&
|
||||||
this.getChainIdFromNetworkStore(this._network) === CHAIN_IDS.MAINNET;
|
chainIdAgainstWhichToDetect === CHAIN_IDS.MAINNET;
|
||||||
const { tokenList } = this._tokenList.state;
|
const { tokenList } = this._tokenList.state;
|
||||||
|
|
||||||
const tokenListUsed = isTokenDetectionInactiveInMainnet
|
const tokenListUsed = isTokenDetectionInactiveInMainnet
|
||||||
@ -134,7 +137,7 @@ export default class DetectTokensController {
|
|||||||
let result;
|
let result;
|
||||||
try {
|
try {
|
||||||
result = await this.assetsContractController.getBalancesInSingleCall(
|
result = await this.assetsContractController.getBalancesInSingleCall(
|
||||||
this.selectedAddress,
|
addressAgainstWhichToDetect,
|
||||||
tokensSlice,
|
tokensSlice,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -172,7 +175,10 @@ export default class DetectTokensController {
|
|||||||
asset_type: ASSET_TYPES.TOKEN,
|
asset_type: ASSET_TYPES.TOKEN,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await this.tokensController.addDetectedTokens(tokensWithBalance);
|
await this.tokensController.addDetectedTokens(tokensWithBalance, {
|
||||||
|
selectedAddress: addressAgainstWhichToDetect,
|
||||||
|
chainId: chainIdAgainstWhichToDetect,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,12 +188,20 @@ export default class DetectTokensController {
|
|||||||
* Restart token detection polling period and call detectNewTokens
|
* Restart token detection polling period and call detectNewTokens
|
||||||
* in case of address change or user session initialization.
|
* in case of address change or user session initialization.
|
||||||
*
|
*
|
||||||
|
* @param options
|
||||||
|
* @param options.selectedAddress - the selectedAddress against which to detect for token balances
|
||||||
|
* @param options.chainId - the chainId against which to detect for token balances
|
||||||
*/
|
*/
|
||||||
restartTokenDetection() {
|
restartTokenDetection({ selectedAddress, chainId } = {}) {
|
||||||
if (!(this.isActive && this.selectedAddress)) {
|
const addressAgainstWhichToDetect = selectedAddress ?? this.selectedAddress;
|
||||||
|
const chainIdAgainstWhichToDetect = chainId ?? this.chainId;
|
||||||
|
if (!(this.isActive && addressAgainstWhichToDetect)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.detectNewTokens();
|
this.detectNewTokens({
|
||||||
|
selectedAddress: addressAgainstWhichToDetect,
|
||||||
|
chainId: chainIdAgainstWhichToDetect,
|
||||||
|
});
|
||||||
this.interval = DEFAULT_INTERVAL;
|
this.interval = DEFAULT_INTERVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,8 +233,9 @@ export default class DetectTokensController {
|
|||||||
this._network = network;
|
this._network = network;
|
||||||
this._network.store.subscribe(() => {
|
this._network.store.subscribe(() => {
|
||||||
if (this.chainId !== this.getChainIdFromNetworkStore(network)) {
|
if (this.chainId !== this.getChainIdFromNetworkStore(network)) {
|
||||||
this.restartTokenDetection();
|
const chainId = this.getChainIdFromNetworkStore(network);
|
||||||
this.chainId = this.getChainIdFromNetworkStore(network);
|
this.chainId = chainId;
|
||||||
|
this.restartTokenDetection({ chainId: this.chainId });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -526,10 +526,10 @@
|
|||||||
"@eth-optimism/contracts>@ethersproject/contracts": true,
|
"@eth-optimism/contracts>@ethersproject/contracts": true,
|
||||||
"@metamask/assets-controllers>@ethersproject/abi": true,
|
"@metamask/assets-controllers>@ethersproject/abi": true,
|
||||||
"@metamask/assets-controllers>@ethersproject/providers": true,
|
"@metamask/assets-controllers>@ethersproject/providers": true,
|
||||||
"@metamask/assets-controllers>@metamask/base-controller": true,
|
|
||||||
"@metamask/assets-controllers>abort-controller": true,
|
"@metamask/assets-controllers>abort-controller": true,
|
||||||
"@metamask/assets-controllers>async-mutex": true,
|
"@metamask/assets-controllers>async-mutex": true,
|
||||||
"@metamask/assets-controllers>multiformats": true,
|
"@metamask/assets-controllers>multiformats": true,
|
||||||
|
"@metamask/base-controller": true,
|
||||||
"@metamask/contract-metadata": true,
|
"@metamask/contract-metadata": true,
|
||||||
"@metamask/controller-utils": true,
|
"@metamask/controller-utils": true,
|
||||||
"@metamask/metamask-eth-abis": true,
|
"@metamask/metamask-eth-abis": true,
|
||||||
@ -603,11 +603,6 @@
|
|||||||
"@ethersproject/bignumber>@ethersproject/logger": true
|
"@ethersproject/bignumber>@ethersproject/logger": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@metamask/assets-controllers>@metamask/base-controller": {
|
|
||||||
"packages": {
|
|
||||||
"immer": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@metamask/assets-controllers>abort-controller": {
|
"@metamask/assets-controllers>abort-controller": {
|
||||||
"globals": {
|
"globals": {
|
||||||
"AbortController": true
|
"AbortController": true
|
||||||
|
@ -526,10 +526,10 @@
|
|||||||
"@eth-optimism/contracts>@ethersproject/contracts": true,
|
"@eth-optimism/contracts>@ethersproject/contracts": true,
|
||||||
"@metamask/assets-controllers>@ethersproject/abi": true,
|
"@metamask/assets-controllers>@ethersproject/abi": true,
|
||||||
"@metamask/assets-controllers>@ethersproject/providers": true,
|
"@metamask/assets-controllers>@ethersproject/providers": true,
|
||||||
"@metamask/assets-controllers>@metamask/base-controller": true,
|
|
||||||
"@metamask/assets-controllers>abort-controller": true,
|
"@metamask/assets-controllers>abort-controller": true,
|
||||||
"@metamask/assets-controllers>async-mutex": true,
|
"@metamask/assets-controllers>async-mutex": true,
|
||||||
"@metamask/assets-controllers>multiformats": true,
|
"@metamask/assets-controllers>multiformats": true,
|
||||||
|
"@metamask/base-controller": true,
|
||||||
"@metamask/contract-metadata": true,
|
"@metamask/contract-metadata": true,
|
||||||
"@metamask/controller-utils": true,
|
"@metamask/controller-utils": true,
|
||||||
"@metamask/metamask-eth-abis": true,
|
"@metamask/metamask-eth-abis": true,
|
||||||
@ -603,11 +603,6 @@
|
|||||||
"@ethersproject/bignumber>@ethersproject/logger": true
|
"@ethersproject/bignumber>@ethersproject/logger": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@metamask/assets-controllers>@metamask/base-controller": {
|
|
||||||
"packages": {
|
|
||||||
"immer": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@metamask/assets-controllers>abort-controller": {
|
"@metamask/assets-controllers>abort-controller": {
|
||||||
"globals": {
|
"globals": {
|
||||||
"AbortController": true
|
"AbortController": true
|
||||||
|
@ -526,10 +526,10 @@
|
|||||||
"@eth-optimism/contracts>@ethersproject/contracts": true,
|
"@eth-optimism/contracts>@ethersproject/contracts": true,
|
||||||
"@metamask/assets-controllers>@ethersproject/abi": true,
|
"@metamask/assets-controllers>@ethersproject/abi": true,
|
||||||
"@metamask/assets-controllers>@ethersproject/providers": true,
|
"@metamask/assets-controllers>@ethersproject/providers": true,
|
||||||
"@metamask/assets-controllers>@metamask/base-controller": true,
|
|
||||||
"@metamask/assets-controllers>abort-controller": true,
|
"@metamask/assets-controllers>abort-controller": true,
|
||||||
"@metamask/assets-controllers>async-mutex": true,
|
"@metamask/assets-controllers>async-mutex": true,
|
||||||
"@metamask/assets-controllers>multiformats": true,
|
"@metamask/assets-controllers>multiformats": true,
|
||||||
|
"@metamask/base-controller": true,
|
||||||
"@metamask/contract-metadata": true,
|
"@metamask/contract-metadata": true,
|
||||||
"@metamask/controller-utils": true,
|
"@metamask/controller-utils": true,
|
||||||
"@metamask/metamask-eth-abis": true,
|
"@metamask/metamask-eth-abis": true,
|
||||||
@ -603,11 +603,6 @@
|
|||||||
"@ethersproject/bignumber>@ethersproject/logger": true
|
"@ethersproject/bignumber>@ethersproject/logger": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@metamask/assets-controllers>@metamask/base-controller": {
|
|
||||||
"packages": {
|
|
||||||
"immer": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@metamask/assets-controllers>abort-controller": {
|
"@metamask/assets-controllers>abort-controller": {
|
||||||
"globals": {
|
"globals": {
|
||||||
"AbortController": true
|
"AbortController": true
|
||||||
|
@ -957,6 +957,70 @@
|
|||||||
"gulp>gulp-cli>isobject": true
|
"gulp>gulp-cli>isobject": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog": {
|
||||||
|
"builtin": {
|
||||||
|
"events.EventEmitter": true,
|
||||||
|
"util": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"process.nextTick": true,
|
||||||
|
"process.stderr": true
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>are-we-there-yet": true,
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge": true,
|
||||||
|
"@storybook/react>@storybook/node-logger>npmlog>console-control-strings": true,
|
||||||
|
"nyc>yargs>set-blocking": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>are-we-there-yet": {
|
||||||
|
"builtin": {
|
||||||
|
"events.EventEmitter": true,
|
||||||
|
"util.inherits": true
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"koa>delegates": true,
|
||||||
|
"readable-stream": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge": {
|
||||||
|
"builtin": {
|
||||||
|
"util.format": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"clearInterval": true,
|
||||||
|
"process": true,
|
||||||
|
"setImmediate": true,
|
||||||
|
"setInterval": true
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>aproba": true,
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>string-width": true,
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>strip-ansi": true,
|
||||||
|
"@storybook/react>@storybook/node-logger>npmlog>console-control-strings": true,
|
||||||
|
"@storybook/react>@storybook/node-logger>npmlog>gauge>has-unicode": true,
|
||||||
|
"@storybook/react>@storybook/node-logger>npmlog>gauge>wide-align": true,
|
||||||
|
"nyc>signal-exit": true,
|
||||||
|
"react>object-assign": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>string-width": {
|
||||||
|
"packages": {
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": true,
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>strip-ansi": true,
|
||||||
|
"gulp>gulp-cli>yargs>string-width>code-point-at": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": {
|
||||||
|
"packages": {
|
||||||
|
"gulp>gulp-cli>yargs>string-width>is-fullwidth-code-point>number-is-nan": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>strip-ansi": {
|
||||||
|
"packages": {
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>strip-ansi>ansi-regex": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"@lavamoat/lavapack": {
|
"@lavamoat/lavapack": {
|
||||||
"builtin": {
|
"builtin": {
|
||||||
"assert": true,
|
"assert": true,
|
||||||
@ -1048,6 +1112,31 @@
|
|||||||
"string.prototype.matchall>side-channel": true
|
"string.prototype.matchall>side-channel": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": {
|
||||||
|
"builtin": {
|
||||||
|
"os.homedir": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"process.env": true,
|
||||||
|
"process.getuid": true,
|
||||||
|
"process.platform": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@storybook/react>@storybook/node-logger>npmlog>gauge>has-unicode": {
|
||||||
|
"builtin": {
|
||||||
|
"os.type": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"process.env.LANG": true,
|
||||||
|
"process.env.LC_ALL": true,
|
||||||
|
"process.env.LC_CTYPE": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@storybook/react>@storybook/node-logger>npmlog>gauge>wide-align": {
|
||||||
|
"packages": {
|
||||||
|
"yargs>string-width": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"@storybook/react>acorn-walk": {
|
"@storybook/react>acorn-walk": {
|
||||||
"globals": {
|
"globals": {
|
||||||
"define": true
|
"define": true
|
||||||
@ -1799,6 +1888,7 @@
|
|||||||
},
|
},
|
||||||
"packages": {
|
"packages": {
|
||||||
"chokidar>braces": true,
|
"chokidar>braces": true,
|
||||||
|
"chokidar>fsevents": true,
|
||||||
"chokidar>glob-parent": true,
|
"chokidar>glob-parent": true,
|
||||||
"chokidar>is-binary-path": true,
|
"chokidar>is-binary-path": true,
|
||||||
"chokidar>normalize-path": true,
|
"chokidar>normalize-path": true,
|
||||||
@ -1825,6 +1915,13 @@
|
|||||||
"chokidar>braces>fill-range>to-regex-range>is-number": true
|
"chokidar>braces>fill-range>to-regex-range>is-number": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"chokidar>fsevents": {
|
||||||
|
"globals": {
|
||||||
|
"console.assert": true,
|
||||||
|
"process.platform": true
|
||||||
|
},
|
||||||
|
"native": true
|
||||||
|
},
|
||||||
"chokidar>glob-parent": {
|
"chokidar>glob-parent": {
|
||||||
"builtin": {
|
"builtin": {
|
||||||
"os.platform": true,
|
"os.platform": true,
|
||||||
@ -4176,6 +4273,7 @@
|
|||||||
"gulp-watch>chokidar>anymatch": true,
|
"gulp-watch>chokidar>anymatch": true,
|
||||||
"gulp-watch>chokidar>async-each": true,
|
"gulp-watch>chokidar>async-each": true,
|
||||||
"gulp-watch>chokidar>braces": true,
|
"gulp-watch>chokidar>braces": true,
|
||||||
|
"gulp-watch>chokidar>fsevents": true,
|
||||||
"gulp-watch>chokidar>is-binary-path": true,
|
"gulp-watch>chokidar>is-binary-path": true,
|
||||||
"gulp-watch>chokidar>readdirp": true,
|
"gulp-watch>chokidar>readdirp": true,
|
||||||
"gulp-watch>chokidar>upath": true,
|
"gulp-watch>chokidar>upath": true,
|
||||||
@ -4548,6 +4646,142 @@
|
|||||||
"enzyme>rst-selector-parser>nearley>randexp>ret": true
|
"enzyme>rst-selector-parser>nearley>randexp>ret": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"gulp-watch>chokidar>fsevents": {
|
||||||
|
"builtin": {
|
||||||
|
"events.EventEmitter": true,
|
||||||
|
"fs.stat": true,
|
||||||
|
"path.join": true,
|
||||||
|
"util.inherits": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"__dirname": true,
|
||||||
|
"console.assert": true,
|
||||||
|
"process.nextTick": true,
|
||||||
|
"process.platform": true,
|
||||||
|
"setImmediate": true
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp": {
|
||||||
|
"builtin": {
|
||||||
|
"events.EventEmitter": true,
|
||||||
|
"fs.existsSync": true,
|
||||||
|
"fs.readFileSync": true,
|
||||||
|
"fs.renameSync": true,
|
||||||
|
"path.dirname": true,
|
||||||
|
"path.existsSync": true,
|
||||||
|
"path.join": true,
|
||||||
|
"path.resolve": true,
|
||||||
|
"url.parse": true,
|
||||||
|
"url.resolve": true,
|
||||||
|
"util.inherits": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"__dirname": true,
|
||||||
|
"console.log": true,
|
||||||
|
"process.arch": true,
|
||||||
|
"process.cwd": true,
|
||||||
|
"process.env": true,
|
||||||
|
"process.platform": true,
|
||||||
|
"process.version.substr": true,
|
||||||
|
"process.versions": true
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog": true,
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>detect-libc": true,
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt": true,
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": true,
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>semver": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>detect-libc": {
|
||||||
|
"builtin": {
|
||||||
|
"child_process.spawnSync": true,
|
||||||
|
"fs.readdirSync": true,
|
||||||
|
"os.platform": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"process.env": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt": {
|
||||||
|
"builtin": {
|
||||||
|
"path": true,
|
||||||
|
"stream.Stream": true,
|
||||||
|
"url": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"console": true,
|
||||||
|
"process.argv": true,
|
||||||
|
"process.env.DEBUG_NOPT": true,
|
||||||
|
"process.env.NOPT_DEBUG": true,
|
||||||
|
"process.platform": true
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>nopt>abbrev": true,
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv": {
|
||||||
|
"builtin": {
|
||||||
|
"child_process.exec": true,
|
||||||
|
"path": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"process.env.COMPUTERNAME": true,
|
||||||
|
"process.env.ComSpec": true,
|
||||||
|
"process.env.EDITOR": true,
|
||||||
|
"process.env.HOSTNAME": true,
|
||||||
|
"process.env.PATH": true,
|
||||||
|
"process.env.PROMPT": true,
|
||||||
|
"process.env.PS1": true,
|
||||||
|
"process.env.Path": true,
|
||||||
|
"process.env.SHELL": true,
|
||||||
|
"process.env.USER": true,
|
||||||
|
"process.env.USERDOMAIN": true,
|
||||||
|
"process.env.USERNAME": true,
|
||||||
|
"process.env.VISUAL": true,
|
||||||
|
"process.env.path": true,
|
||||||
|
"process.nextTick": true,
|
||||||
|
"process.platform": true
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": true,
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": {
|
||||||
|
"globals": {
|
||||||
|
"process.env.SystemRoot": true,
|
||||||
|
"process.env.TEMP": true,
|
||||||
|
"process.env.TMP": true,
|
||||||
|
"process.env.TMPDIR": true,
|
||||||
|
"process.env.windir": true,
|
||||||
|
"process.platform": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": {
|
||||||
|
"builtin": {
|
||||||
|
"assert": true,
|
||||||
|
"fs": true,
|
||||||
|
"path.join": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"process.platform": true,
|
||||||
|
"setTimeout": true
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"nyc>glob": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp>semver": {
|
||||||
|
"globals": {
|
||||||
|
"console": true,
|
||||||
|
"process": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"gulp-watch>chokidar>is-binary-path": {
|
"gulp-watch>chokidar>is-binary-path": {
|
||||||
"builtin": {
|
"builtin": {
|
||||||
"path.extname": true
|
"path.extname": true
|
||||||
@ -5124,6 +5358,7 @@
|
|||||||
"gulp-watch>path-is-absolute": true,
|
"gulp-watch>path-is-absolute": true,
|
||||||
"gulp>glob-watcher>anymatch": true,
|
"gulp>glob-watcher>anymatch": true,
|
||||||
"gulp>glob-watcher>chokidar>braces": true,
|
"gulp>glob-watcher>chokidar>braces": true,
|
||||||
|
"gulp>glob-watcher>chokidar>fsevents": true,
|
||||||
"gulp>glob-watcher>chokidar>glob-parent": true,
|
"gulp>glob-watcher>chokidar>glob-parent": true,
|
||||||
"gulp>glob-watcher>chokidar>is-binary-path": true,
|
"gulp>glob-watcher>chokidar>is-binary-path": true,
|
||||||
"gulp>glob-watcher>chokidar>readdirp": true,
|
"gulp>glob-watcher>chokidar>readdirp": true,
|
||||||
@ -5182,6 +5417,24 @@
|
|||||||
"stylelint>@stylelint/postcss-markdown>remark>remark-parse>repeat-string": true
|
"stylelint>@stylelint/postcss-markdown>remark>remark-parse>repeat-string": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"gulp>glob-watcher>chokidar>fsevents": {
|
||||||
|
"builtin": {
|
||||||
|
"events.EventEmitter": true,
|
||||||
|
"fs.stat": true,
|
||||||
|
"path.join": true,
|
||||||
|
"util.inherits": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"__dirname": true,
|
||||||
|
"console.assert": true,
|
||||||
|
"process.nextTick": true,
|
||||||
|
"process.platform": true,
|
||||||
|
"setImmediate": true
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"gulp-watch>chokidar>fsevents>node-pre-gyp": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"gulp>glob-watcher>chokidar>glob-parent": {
|
"gulp>glob-watcher>chokidar>glob-parent": {
|
||||||
"builtin": {
|
"builtin": {
|
||||||
"os.platform": true,
|
"os.platform": true,
|
||||||
@ -6255,6 +6508,12 @@
|
|||||||
"process": true
|
"process": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nyc>yargs>set-blocking": {
|
||||||
|
"globals": {
|
||||||
|
"process.stderr": true,
|
||||||
|
"process.stdout": true
|
||||||
|
}
|
||||||
|
},
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"builtin": {
|
"builtin": {
|
||||||
"assert": true,
|
"assert": true,
|
||||||
|
@ -203,7 +203,7 @@
|
|||||||
"@metamask/address-book-controller": "^1.0.0",
|
"@metamask/address-book-controller": "^1.0.0",
|
||||||
"@metamask/announcement-controller": "^1.0.0",
|
"@metamask/announcement-controller": "^1.0.0",
|
||||||
"@metamask/approval-controller": "^1.0.0",
|
"@metamask/approval-controller": "^1.0.0",
|
||||||
"@metamask/assets-controllers": "^1.0.0",
|
"@metamask/assets-controllers": "^1.0.1",
|
||||||
"@metamask/base-controller": "^1.0.0",
|
"@metamask/base-controller": "^1.0.0",
|
||||||
"@metamask/contract-metadata": "^1.31.0",
|
"@metamask/contract-metadata": "^1.31.0",
|
||||||
"@metamask/controller-utils": "^1.0.0",
|
"@metamask/controller-utils": "^1.0.0",
|
||||||
|
@ -1218,7 +1218,9 @@ export function getIsDynamicTokenListAvailable(state) {
|
|||||||
* @returns list of token objects
|
* @returns list of token objects
|
||||||
*/
|
*/
|
||||||
export function getDetectedTokensInCurrentNetwork(state) {
|
export function getDetectedTokensInCurrentNetwork(state) {
|
||||||
return state.metamask.detectedTokens;
|
const currentChainId = getCurrentChainId(state);
|
||||||
|
const selectedAddress = getSelectedAddress(state);
|
||||||
|
return state.metamask.allDetectedTokens?.[currentChainId]?.[selectedAddress];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
14
yarn.lock
14
yarn.lock
@ -3723,15 +3723,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@metamask/assets-controllers@npm:^1.0.0":
|
"@metamask/assets-controllers@npm:^1.0.1":
|
||||||
version: 1.0.0
|
version: 1.0.1
|
||||||
resolution: "@metamask/assets-controllers@npm:1.0.0"
|
resolution: "@metamask/assets-controllers@npm:1.0.1"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ethersproject/abi": ^5.7.0
|
"@ethersproject/abi": ^5.7.0
|
||||||
"@ethersproject/bignumber": ^5.7.0
|
"@ethersproject/bignumber": ^5.7.0
|
||||||
"@ethersproject/contracts": ^5.7.0
|
"@ethersproject/contracts": ^5.7.0
|
||||||
"@ethersproject/providers": ^5.7.0
|
"@ethersproject/providers": ^5.7.0
|
||||||
"@metamask/base-controller": ~1.0.0
|
"@metamask/base-controller": ~1.1.0
|
||||||
"@metamask/contract-metadata": ^1.35.0
|
"@metamask/contract-metadata": ^1.35.0
|
||||||
"@metamask/controller-utils": ~1.0.0
|
"@metamask/controller-utils": ~1.0.0
|
||||||
"@metamask/metamask-eth-abis": 3.0.0
|
"@metamask/metamask-eth-abis": 3.0.0
|
||||||
@ -3748,7 +3748,7 @@ __metadata:
|
|||||||
multiformats: ^9.5.2
|
multiformats: ^9.5.2
|
||||||
single-call-balance-checker-abi: ^1.0.0
|
single-call-balance-checker-abi: ^1.0.0
|
||||||
uuid: ^8.3.2
|
uuid: ^8.3.2
|
||||||
checksum: ac9bc8730abf1403ce3344e7c49f43b5ad1ec1fe472d291bf727f1bcab3a59c5d6ed81a946b26dfc22b29db17e5f2bf72b247a438395ed2499877c844a8a32f5
|
checksum: 678f32126aa84de769065581661218a247166ef2e4918290a8e082dd9c7b175d84c5a4d4f431c884dc83201b183f324c2b5047bc69a2ea7825d710470cae5f87
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@ -3766,7 +3766,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@metamask/base-controller@npm:^1.0.0, @metamask/base-controller@npm:^1.1.1":
|
"@metamask/base-controller@npm:^1.0.0, @metamask/base-controller@npm:^1.1.1, @metamask/base-controller@npm:~1.1.0":
|
||||||
version: 1.1.1
|
version: 1.1.1
|
||||||
resolution: "@metamask/base-controller@npm:1.1.1"
|
resolution: "@metamask/base-controller@npm:1.1.1"
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -23368,7 +23368,7 @@ __metadata:
|
|||||||
"@metamask/address-book-controller": ^1.0.0
|
"@metamask/address-book-controller": ^1.0.0
|
||||||
"@metamask/announcement-controller": ^1.0.0
|
"@metamask/announcement-controller": ^1.0.0
|
||||||
"@metamask/approval-controller": ^1.0.0
|
"@metamask/approval-controller": ^1.0.0
|
||||||
"@metamask/assets-controllers": ^1.0.0
|
"@metamask/assets-controllers": ^1.0.1
|
||||||
"@metamask/auto-changelog": ^2.1.0
|
"@metamask/auto-changelog": ^2.1.0
|
||||||
"@metamask/base-controller": ^1.0.0
|
"@metamask/base-controller": ^1.0.0
|
||||||
"@metamask/contract-metadata": ^1.31.0
|
"@metamask/contract-metadata": ^1.31.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user