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:
@@ -1495,6 +1495,41 @@ describe("fetchRecentTransactions merge and dedup", () => {
|
||||
expect(mainnet[0].chainId).toBe("0x1");
|
||||
});
|
||||
|
||||
// https://git.eeqj.de/sneak/AutistMask/issues/632: the bundled token list
|
||||
// names a contract only on Ethereum Mainnet. On Sepolia, a call to the
|
||||
// contract at USDC's mainnet address is labelled with the network's native
|
||||
// currency. A call to any contract the wallet does not name gets that label.
|
||||
test("a contract call on Sepolia is not named by the bundled list", async () => {
|
||||
respondWith(
|
||||
[
|
||||
{
|
||||
hash: "0x" + "b".repeat(64),
|
||||
block_number: 21000095,
|
||||
timestamp: TS,
|
||||
from: { hash: VICTIM },
|
||||
to: { hash: USDC_CONTRACT, is_contract: true },
|
||||
value: "0",
|
||||
method: "approve",
|
||||
status: "ok",
|
||||
},
|
||||
],
|
||||
[],
|
||||
);
|
||||
const sepolia = await fetchRecentTransactions(
|
||||
VICTIM,
|
||||
BLOCKSCOUT,
|
||||
"0xaa36a7",
|
||||
);
|
||||
expect(sepolia[0].directionLabel).toBe("Approve");
|
||||
expect(sepolia[0].symbol).toBe("SepoliaETH");
|
||||
const mainnet = await fetchRecentTransactions(
|
||||
VICTIM,
|
||||
BLOCKSCOUT,
|
||||
"0x1",
|
||||
);
|
||||
expect(mainnet[0].symbol).toBe("USDC");
|
||||
});
|
||||
|
||||
test("the fake token transfer survives fetching and is then filtered", async () => {
|
||||
respondWith(
|
||||
[],
|
||||
|
||||
Reference in New Issue
Block a user