mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
6e5c2f03bf
* addding the legacy tokenlist, tuning token detection OFF by default, adding new message while importing tokens updating the controller version and calling detectNewToken on network change fixing rebase error Run yarn lavamoat:auto for updating policies updating lavamoat Deleted node modules and run again lavamoat auto fixing rebase issues updating lavamoat policies updating lavamoat after rebasing policies updating custom token warning and blocking detectedtoken link when tpken detection is off for supported networks to update the token in fetchTosync updating the contract map object Revert build-system lavamoat policy changes Move token list selection logic from components to getTokenList selector updating the tokenList Update lavamoat Fix error updating lavamoat lint fix fix unit test fail fix unit test fail lint fix fixing rebase locale error rebase fix Revert build-system policy changes temp addressing review comments * rebase fix
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
import contractMap from '@metamask/contract-metadata';
|
|
|
|
/**
|
|
* A normalized list of addresses exported as part of the contractMap in
|
|
* `@metamask/contract-metadata`. Used primarily to validate if manually entered
|
|
* contract addresses do not match one of our listed tokens
|
|
*/
|
|
export const LISTED_CONTRACT_ADDRESSES = Object.keys(contractMap).map(
|
|
(address) => address.toLowerCase(),
|
|
);
|
|
|
|
/**
|
|
* @typedef {object} TokenDetails
|
|
* @property {string} address - The address of the selected 'TOKEN' or
|
|
* 'COLLECTIBLE' contract.
|
|
* @property {string} [symbol] - The symbol of the token.
|
|
* @property {number} [decimals] - The number of decimals of the selected
|
|
* 'ERC20' asset.
|
|
* @property {number} [tokenId] - The id of the selected 'COLLECTIBLE' asset.
|
|
* @property {TokenStandardStrings} [standard] - The standard of the selected
|
|
* asset.
|
|
* @property {boolean} [isERC721] - True when the asset is a ERC721 token.
|
|
*/
|
|
export const STATIC_MAINNET_TOKEN_LIST = Object.keys(contractMap).reduce(
|
|
(acc, base) => {
|
|
const { logo, ...tokenMetadata } = contractMap[base];
|
|
return {
|
|
...acc,
|
|
[base.toLowerCase()]: {
|
|
...tokenMetadata,
|
|
address: base.toLowerCase(),
|
|
iconUrl: `images/contract/${logo}`,
|
|
aggregators: [],
|
|
},
|
|
};
|
|
},
|
|
{},
|
|
);
|