fix: read USD prices from Chainlink price feeds through the RPC endpoint (closes #525)
CoinDesk now refuses every request without an API key, so mainnet showed no USD prices. On mainnet the wallet now reads latestRoundData() from Chainlink's USD price feeds through the configured RPC endpoint. ETH and the held or tracked tokens with a feed are read as one batched request, at most every 5 minutes. src/shared/tokenList.js lists the feeds of 53 bundled tokens, keyed by contract address, and the ETH/USD feed. A reading older than its feed's heartbeat plus 30 minutes, or not positive, is no price. A failed read leaves no price and is logged. getPrice() takes a contract address instead of a symbol. The CoinDesk request is removed. Model: opus-5-5
This commit is contained in:
@@ -153,7 +153,7 @@ describe("the balance warning on the removal confirmation", () => {
|
||||
|
||||
test("the USD total is shown when prices are known", () => {
|
||||
prices.ETH = 2000;
|
||||
prices.USDC = 1;
|
||||
prices[USDC] = 1;
|
||||
expect(balanceWarningHtml(TOKEN_ONLY)).toContain("Total: $2,500.00");
|
||||
expect(balanceWarningHtml(ETH_ONLY)).toContain("Total: $3,000.00");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user