Compare commits
1 Commits
06e12889dc
...
fix/59-tra
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1df770d3b6 |
@@ -167,9 +167,11 @@ function showTxApproval(details) {
|
||||
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 || "");
|
||||
if (decoded && decoded.details) {
|
||||
let decodedTokenSymbol = null;
|
||||
let decodedTokenAddress = null;
|
||||
for (const d of decoded.details) {
|
||||
if (d.label === "Recipient" && d.address) {
|
||||
pendingTxDetails.to = d.address;
|
||||
@@ -177,10 +179,19 @@ function showTxApproval(details) {
|
||||
if (d.label === "Amount") {
|
||||
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) {
|
||||
pendingTxDetails.token = toAddr;
|
||||
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(
|
||||
"0xffffffffffffffffffffffffffffffffffffffff",
|
||||
);
|
||||
const rawAmount =
|
||||
inputAmount >= maxUint160
|
||||
? "Unlimited"
|
||||
: formatAmount(inputAmount, inInfo.decimals);
|
||||
const amountStr =
|
||||
inputAmount >= maxUint160
|
||||
? "Unlimited"
|
||||
: formatAmount(inputAmount, inInfo.decimals) +
|
||||
(inSymbol ? " " + inSymbol : "");
|
||||
details.push({ label: "Amount", value: amountStr });
|
||||
: rawAmount + (inSymbol ? " " + inSymbol : "");
|
||||
details.push({
|
||||
label: "Amount",
|
||||
value: amountStr,
|
||||
rawValue: rawAmount,
|
||||
});
|
||||
}
|
||||
|
||||
if (outSymbol) {
|
||||
|
||||
Reference in New Issue
Block a user