T402 API Reference - v2.8.0
    Preparing search index...

    Function decodeApproveCalldata

    • Decodes the approve() calldata from a hex string to extract spender and amount.

      Parameters

      • calldata: string

        Hex-encoded approve() calldata (with or without 0x prefix)

      Returns { spender: string; amount: string }

      Decoded spender and amount, or null if not valid approve() calldata

      const decoded = decodeApproveCalldata("0x095ea7b3...");
      if (decoded) {
      console.log(decoded.spender, decoded.amount);
      }