1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/shared/constants/tokens.js
Mark Stacey 4f66dc948f
Update @metamask/controllers to v33 (#16493)
The controllers package has been updated to v33. The only breaking
change in this release was to rename the term "collectible" to "NFT"
wherever it appeared in the API.

Changes in this PR have been kept minimal; additional renaming can be
done in separate PRs. This PR only updates the controller names,
controller state, controller methods, and any direct references to
these things. NFTs are still called "collectibles" in most places.
2022-11-15 15:19:42 -03:30

42 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
* 'NFT' 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 'NFT' 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: [],
},
};
},
{},
);
export const TOKEN_API_METASWAP_CODEFI_URL =
'https://token-api.metaswap.codefi.network/tokens/';