Replace old 150-token list with 511-token tokenList.js
All checks were successful
check / check (push) Successful in 14s
All checks were successful
check / check (push) Successful in 14s
Delete src/shared/tokens.js and migrate all consumers to src/shared/tokenList.js which has 511 tokens (vs ~150) sourced from CoinGecko with on-chain verified decimals. - prices.js: getTopTokenPrices now from tokenList - transactions.js: KNOWN_SYMBOLS now from tokenList (3.4x more symbols for spoof detection) - send.js: KNOWN_SYMBOLS for token dropdown filtering - approval.js: uses pre-built TOKEN_BY_ADDRESS map instead of constructing its own from TOKENS array - addToken.js: uses getTopTokens(25) for quick-pick buttons (only top 25 shown, not all 511)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const { $, showView, showFlash } = require("./helpers");
|
||||
const { TOKENS } = require("../../shared/tokens");
|
||||
const { getTopTokens } = require("../../shared/tokenList");
|
||||
const { state, saveState } = require("../../shared/state");
|
||||
const { lookupTokenInfo } = require("../../shared/balances");
|
||||
const { isScamAddress } = require("../../shared/scamlist");
|
||||
@@ -9,7 +9,7 @@ function show() {
|
||||
$("add-token-address").value = "";
|
||||
$("add-token-info").classList.add("hidden");
|
||||
const list = $("common-token-list");
|
||||
list.innerHTML = TOKENS.slice(0, 25)
|
||||
list.innerHTML = getTopTokens(25)
|
||||
.map(
|
||||
(t) =>
|
||||
`<button class="common-token border border-border px-1 hover:bg-fg hover:text-bg cursor-pointer text-xs" data-address="${t.address}" data-symbol="${t.symbol}" data-decimals="${t.decimals}">${t.symbol}</button>`,
|
||||
|
||||
@@ -2,7 +2,7 @@ const { $, addressDotHtml, escapeHtml, showView } = require("./helpers");
|
||||
const { state, saveState } = require("../../shared/state");
|
||||
const { formatEther, formatUnits, Interface } = require("ethers");
|
||||
const { ERC20_ABI } = require("../../shared/constants");
|
||||
const { TOKENS } = require("../../shared/tokens");
|
||||
const { TOKEN_BY_ADDRESS } = require("../../shared/tokenList");
|
||||
|
||||
const runtime =
|
||||
typeof browser !== "undefined" ? browser.runtime : chrome.runtime;
|
||||
@@ -16,12 +16,6 @@ const EXT_ICON =
|
||||
|
||||
const erc20Iface = new Interface(ERC20_ABI);
|
||||
|
||||
// Build address→token lookup from known token list
|
||||
const TOKEN_BY_ADDRESS = new Map();
|
||||
for (const t of TOKENS) {
|
||||
TOKEN_BY_ADDRESS.set(t.address.toLowerCase(), t);
|
||||
}
|
||||
|
||||
function approvalAddressHtml(address) {
|
||||
const dot = addressDotHtml(address);
|
||||
const link = `https://etherscan.io/address/${address}`;
|
||||
|
||||
@@ -4,7 +4,7 @@ const { $, showFlash, addressDotHtml, escapeHtml } = require("./helpers");
|
||||
const { state, currentAddress } = require("../../shared/state");
|
||||
let ctx;
|
||||
const { getProvider } = require("../../shared/balances");
|
||||
const { KNOWN_SYMBOLS } = require("../../shared/tokens");
|
||||
const { KNOWN_SYMBOLS } = require("../../shared/tokenList");
|
||||
|
||||
const EXT_ICON =
|
||||
`<span style="display:inline-block;width:10px;height:10px;margin-left:4px;vertical-align:middle">` +
|
||||
|
||||
Reference in New Issue
Block a user