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:
@@ -1,9 +1,9 @@
|
||||
// The USD total of an address that holds something this build cannot price
|
||||
// (issue #261).
|
||||
//
|
||||
// Prices exist for the top 25 tokens only, so an address can hold real assets
|
||||
// with no price attached. Summing what is priced and printing the result as
|
||||
// the total says "$0.00" for an address holding nothing but unpriced tokens —
|
||||
// Only a token with a price feed has a price, so an address can hold real
|
||||
// assets with no price attached. Summing what is priced and printing the result
|
||||
// as the total says "$0.00" for an address holding nothing but unpriced tokens —
|
||||
// worth-nothing and worth-an-unknown-amount collapsed into one number, in the
|
||||
// direction that matters. The two are separate facts here, the same way an
|
||||
// absent holders_count is not a count of zero.
|
||||
@@ -63,7 +63,7 @@ const PARTLY_PRICED = {
|
||||
beforeEach(() => {
|
||||
clearPrices();
|
||||
prices.ETH = 2000;
|
||||
prices.USDC = 1;
|
||||
prices[USDC] = 1;
|
||||
state.wallets = [];
|
||||
state.trackedTokens = [];
|
||||
state.showZeroBalanceTokens = false;
|
||||
|
||||
Reference in New Issue
Block a user