fix: WaitTx and TransactionDetail use the network the transaction was sent on (closes #584)
WaitTx asked the active network's node for the receipt, so after a network switch a transaction sent on the other network was never found and was reported as timed out. It now asks the node of the network its chain id names, through reviewedNetworkProvider(), moved from ConfirmTx into the shared view helpers so both screens use one function. WaitTx and TransactionDetail build their explorer links for that network too. A stored wait or transaction whose chain id names no network is refused on restore, as a stored ConfirmTx transaction already is. Model: opus-5-5
This commit was merged in pull request #621.
This commit is contained in:
@@ -19,6 +19,7 @@ const {
|
||||
isBelowOneMillionth,
|
||||
} = require("../../shared/amountDisplay");
|
||||
const { resolveTokenSymbol } = require("../../shared/approvalAmount");
|
||||
const { getProvider } = require("../../shared/balances");
|
||||
const { DEBUG } = require("../../shared/constants");
|
||||
const { escapeHtml } = require("../../shared/html");
|
||||
const { isDebug } = require("../../shared/log");
|
||||
@@ -607,6 +608,20 @@ const EXT_ICON =
|
||||
`<path d="M7 1.5h3.5V5M7 5.5L10.5 1.5"/>` +
|
||||
`</svg></span>`;
|
||||
|
||||
// The node of the network a transaction was reviewed for, the one its chain id
|
||||
// names, which need not be the active one: the popup can reopen onto ConfirmTx
|
||||
// or WaitTx after Settings switched the network. Its RPC URL is the one
|
||||
// Settings has for that network: the active network's is state.rpcUrl, any
|
||||
// other's the one remembered for it (see applyChainSwitchFields()).
|
||||
function reviewedNetworkProvider(txInfo) {
|
||||
const net = networkByChainId(txInfo.chainId);
|
||||
if (net.id === state.networkId) {
|
||||
return getProvider(state.rpcUrl, net.id);
|
||||
}
|
||||
const remembered = state.networkEndpoints[net.id] || {};
|
||||
return getProvider(remembered.rpcUrl || net.defaultRpcUrl, net.id);
|
||||
}
|
||||
|
||||
// Block-explorer URLs. The origin is a per-network constant from
|
||||
// src/shared/networks.js, the explorer of the network with `chainId`, or of
|
||||
// the active network when no chain id is given; only the path segment is
|
||||
@@ -762,6 +777,7 @@ module.exports = {
|
||||
attachCopyHandlers,
|
||||
etherscanLinkHtml,
|
||||
explorerUrl,
|
||||
reviewedNetworkProvider,
|
||||
EXT_ICON,
|
||||
truncateMiddle,
|
||||
isoDate,
|
||||
|
||||
Reference in New Issue
Block a user