Compare commits
1 Commits
c8d1f96770
...
fix/59-tra
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1df770d3b6 |
@@ -167,9 +167,11 @@ function showTxApproval(details) {
|
|||||||
tokenSymbol: token ? token.symbol : null,
|
tokenSymbol: token ? token.symbol : null,
|
||||||
};
|
};
|
||||||
|
|
||||||
// If this is an ERC-20 call, try to extract the real recipient and amount
|
// If this is an ERC-20 call or a swap, extract the real recipient, amount, and token info
|
||||||
const decoded = decodeCalldata(details.txParams.data, toAddr || "");
|
const decoded = decodeCalldata(details.txParams.data, toAddr || "");
|
||||||
if (decoded && decoded.details) {
|
if (decoded && decoded.details) {
|
||||||
|
let decodedTokenSymbol = null;
|
||||||
|
let decodedTokenAddress = null;
|
||||||
for (const d of decoded.details) {
|
for (const d of decoded.details) {
|
||||||
if (d.label === "Recipient" && d.address) {
|
if (d.label === "Recipient" && d.address) {
|
||||||
pendingTxDetails.to = d.address;
|
pendingTxDetails.to = d.address;
|
||||||
@@ -177,10 +179,19 @@ function showTxApproval(details) {
|
|||||||
if (d.label === "Amount") {
|
if (d.label === "Amount") {
|
||||||
pendingTxDetails.amount = d.rawValue || d.value;
|
pendingTxDetails.amount = d.rawValue || d.value;
|
||||||
}
|
}
|
||||||
|
if (d.label === "Token In" && !decodedTokenSymbol) {
|
||||||
|
// Extract token symbol and address from decoded details
|
||||||
|
decodedTokenSymbol = d.value;
|
||||||
|
if (d.address) decodedTokenAddress = d.address;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (token) {
|
if (token) {
|
||||||
pendingTxDetails.token = toAddr;
|
pendingTxDetails.token = toAddr;
|
||||||
pendingTxDetails.tokenSymbol = token.symbol;
|
pendingTxDetails.tokenSymbol = token.symbol;
|
||||||
|
} else if (decodedTokenAddress) {
|
||||||
|
// For swaps through routers: use the input token info
|
||||||
|
pendingTxDetails.token = decodedTokenAddress;
|
||||||
|
pendingTxDetails.tokenSymbol = decodedTokenSymbol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -445,12 +445,19 @@ function decode(data, toAddress) {
|
|||||||
const maxUint160 = BigInt(
|
const maxUint160 = BigInt(
|
||||||
"0xffffffffffffffffffffffffffffffffffffffff",
|
"0xffffffffffffffffffffffffffffffffffffffff",
|
||||||
);
|
);
|
||||||
|
const rawAmount =
|
||||||
|
inputAmount >= maxUint160
|
||||||
|
? "Unlimited"
|
||||||
|
: formatAmount(inputAmount, inInfo.decimals);
|
||||||
const amountStr =
|
const amountStr =
|
||||||
inputAmount >= maxUint160
|
inputAmount >= maxUint160
|
||||||
? "Unlimited"
|
? "Unlimited"
|
||||||
: formatAmount(inputAmount, inInfo.decimals) +
|
: rawAmount + (inSymbol ? " " + inSymbol : "");
|
||||||
(inSymbol ? " " + inSymbol : "");
|
details.push({
|
||||||
details.push({ label: "Amount", value: amountStr });
|
label: "Amount",
|
||||||
|
value: amountStr,
|
||||||
|
rawValue: rawAmount,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outSymbol) {
|
if (outSymbol) {
|
||||||
|
|||||||
Reference in New Issue
Block a user