fix: the bundled token list names tokens on Ethereum Mainnet only (closes #632)
bundledToken(address, chainId) in tokenList.js answers only for Ethereum Mainnet's chain id. Every reader of the bundled list now goes through it, with the chain id of the transaction, balance or history entry it draws. The token sources the screens build carry that chain id. The Uniswap decoder sets the transaction's chain id on them. fetchTokenBalances() takes the chain id of the network it asks about. Seven existing tests read the bundled list without naming a network. Each now names Ethereum Mainnet. Model: opus-5-5
This commit is contained in:
@@ -67,13 +67,15 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
describe("resolveTokenSymbol", () => {
|
||||
// The bundled list is read only for a token on Ethereum Mainnet.
|
||||
test("reads the bundled list", () => {
|
||||
expect(resolveTokenSymbol(USDC, state)).toBe("USDC");
|
||||
expect(resolveTokenSymbol(USDC, { chainId: "0x1" })).toBe("USDC");
|
||||
});
|
||||
|
||||
test("prefers the bundled list over a tracked entry", () => {
|
||||
state.trackedTokens = [{ address: USDC, symbol: "NOTUSDC" }];
|
||||
expect(resolveTokenSymbol(USDC, state)).toBe("USDC");
|
||||
const sources = { chainId: "0x1", trackedTokens: state.trackedTokens };
|
||||
expect(resolveTokenSymbol(USDC, sources)).toBe("USDC");
|
||||
});
|
||||
|
||||
test("reads a token the user tracks", () => {
|
||||
|
||||
Reference in New Issue
Block a user