fix: a confirmation screen drawn again keeps the network it was reviewed for (closes #586)
ConfirmTx set the transaction's chain id to the active network's every time it drew the screen, so a popup reopened onto a saved confirmation after a network switch in Settings described the reviewed transfer as the new network's and sent it there. show() now sets the chain id only on a transaction Send hands over, and the screen describes the transaction entirely on that network: native currency, USD values, explorer links, and the node and explorer its checks ask. explorerUrl(), renderAddressHtml(), getPrice(), formatFee() and checkEtherscanLabel() take an optional chain id for this. A saved transaction whose chain id names no network is not restored. Model: opus-5-5
This commit was merged in pull request #587.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
const { getTopTokenPrices } = require("./tokenList");
|
||||
const { isBelowOneMillionth } = require("./amountDisplay");
|
||||
const { networkByChainId } = require("./networks");
|
||||
|
||||
const PRICE_CACHE_TTL = 300000; // 5 minutes
|
||||
|
||||
@@ -36,10 +37,12 @@ function clearPrices() {
|
||||
lastFetchedAt = 0;
|
||||
}
|
||||
|
||||
// Return the USD price for a symbol, or null on testnet / unknown.
|
||||
function getPrice(symbol) {
|
||||
// Return the USD price for a symbol on the network with `chainId`, or on the
|
||||
// active network when no chain id is given; null on testnet / unknown.
|
||||
function getPrice(symbol, chainId) {
|
||||
const { currentNetwork } = require("./state");
|
||||
if (currentNetwork().isTestnet) return null;
|
||||
const network = chainId ? networkByChainId(chainId) : currentNetwork();
|
||||
if (network.isTestnet) return null;
|
||||
return prices[symbol] || null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user