Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.trustware.io/llms.txt

Use this file to discover all available pages before exploring further.

GET https://api.trustware.io/api/v1/sdk/rpc/evm/allowance Returns the ERC-20 allowance an ownerAddress has granted to a spenderAddress on a specific EVM chain. Trustware proxies the underlying call so you don’t have to manage public RPC endpoints or rate limits per chain. Use this before broadcasting a route transaction whose source token is an ERC-20. If allowance is below fromAmount, prompt the user to approve the spender first.
The spender is the active route’s provider contract (Squid, LiFi, etc.) — not a Trustware contract. Re-quoting can change the selected provider, which changes the spender; always check allowance against the to address from the latest POST /route response.

Query parameters

ParameterRequiredDescription
chainIdYesEVM chain ID as a string (e.g. "8453" for Base, "1" for Ethereum).
tokenAddressYesERC-20 token contract address.
ownerAddressYesWallet address whose allowance you are reading.
spenderAddressYesThe spender to check allowance against. For Trustware integrations this is route.execution.transaction.to from the latest POST /route response.

Request

curl -G "https://api.trustware.io/api/v1/sdk/rpc/evm/allowance" \
  -H "X-API-Key: $TW_KEY" \
  --data-urlencode "chainId=8453" \
  --data-urlencode "tokenAddress=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" \
  --data-urlencode "ownerAddress=0xeb212fe20f26243ec4d4df2dd49c8aa9fa75a201" \
  --data-urlencode "spenderAddress=0xce16F69375520ab01377ce7B88f5BA8C48F8D666"

Response

{
  "success": true,
  "data": {
    "chainId": "8453",
    "tokenAddress": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "ownerAddress": "0xeb212fe20f26243ec4d4df2dd49c8aa9fa75a201",
    "spenderAddress": "0xce16f69375520ab01377ce7b88f5ba8c48f8d666",
    "allowance": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
    "rpcHost": "base-mainnet.example"
  }
}
FieldDescription
successtrue if the call resolved against the chain.
data.chainIdChain ID the call was made against.
data.tokenAddressLowercased token contract address.
data.ownerAddressLowercased owner address.
data.spenderAddressLowercased spender address.
data.allowanceAllowance as a string-encoded uint256 in the token’s smallest unit. The value 2^256 - 1 indicates an “unlimited” approval.
data.rpcHostThe upstream RPC host Trustware used. Useful for debugging.

Errors

The endpoint returns { "success": false, "error": "...", ... } for validation failures (invalid address, unsupported chain) or upstream RPC failures. Inspect the HTTP status code alongside the error payload:
  • 400 — Malformed address, unsupported chain, or missing query parameter.
  • 429 — Rate limit hit; honor the Retry-After header.
  • 500 / 502 — Upstream RPC failed after retries.
Compare allowance to your route’s fromAmount (both in the token’s smallest unit). If allowance < fromAmount, prompt the user to approve the spender before broadcasting.