Decode ERC-20 calldata in transaction approval popup
All checks were successful
check / check (push) Successful in 15s

The tx approval screen now decodes known ERC-20 function calls
(approve, transfer) and shows them in plain language instead of
raw hex. For the Uniswap approve example, the user now sees:

  Action: Token Approval
  Approve spending of your USDT
  Token: USDT (with full contract address + etherscan link)
  Spender: (full address + etherscan link)
  Amount: Unlimited

Known tokens from the built-in list show their symbol. Unknown
tokens show the contract address. Max uint256 approvals are
labeled "Unlimited". The raw data is still shown below in a
scrollable area for verification.

Also labels the "To" field as "Contract" since dApp transactions
are always contract calls, and shows the token symbol above the
contract address when recognized.
This commit is contained in:
2026-02-27 12:33:09 +07:00
parent d29273114b
commit a9935eca8d
2 changed files with 177 additions and 14 deletions

View File

@@ -858,21 +858,39 @@
<span id="approve-tx-hostname" class="font-bold"></span>
wants to send a transaction.
</p>
<div class="mb-2">
<!-- decoded action (shown when calldata is recognized) -->
<div
id="approve-tx-decoded"
class="mb-3 border border-border border-dashed p-2 hidden"
>
<div class="text-xs text-muted mb-1">Action</div>
<div
id="approve-tx-action"
class="text-xs font-bold mb-2"
></div>
<div id="approve-tx-decoded-details" class="text-xs"></div>
</div>
<div class="mb-3">
<div class="text-xs text-muted mb-1">From</div>
<div id="approve-tx-from" class="text-xs break-all"></div>
</div>
<div class="mb-2">
<div class="text-xs text-muted mb-1">To</div>
<div class="mb-3">
<div class="text-xs text-muted mb-1">Contract</div>
<div id="approve-tx-to" class="text-xs break-all"></div>
</div>
<div class="mb-2">
<div class="mb-3">
<div class="text-xs text-muted mb-1">Value</div>
<div id="approve-tx-value" class="text-xs font-bold"></div>
</div>
<div id="approve-tx-data-section" class="mb-2 hidden">
<div class="text-xs text-muted mb-1">Data</div>
<div id="approve-tx-data" class="text-xs break-all"></div>
<div id="approve-tx-data-section" class="mb-3 hidden">
<div class="text-xs text-muted mb-1">Raw data</div>
<div
id="approve-tx-data"
class="text-xs break-all"
style="max-height: 4rem; overflow-y: auto"
></div>
</div>
<div class="mb-2">
<label class="block mb-1 text-xs">Password</label>