Pular para o conteúdo principal
POST
/
token
/
approve
Approve ERC20 allowance (EVM)
curl --request POST \
  --url https://api.afkcrypto.com/v1/token/approve \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: <idempotency-key>' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "chain": "<string>",
  "token": "<string>",
  "spender": "<string>",
  "amount": "<string>",
  "from": "<string>"
}
'
{ "id": "tx_...", "status": "SUBMITTED", "hash": "0x...", "explorerUrl": "https://basescan.org/tx/0x...", "chainName": "Base" }
Somente EVM. Requer cabeçalho Idempotency-Key.
{ "id": "tx_...", "status": "SUBMITTED", "hash": "0x...", "explorerUrl": "https://basescan.org/tx/0x...", "chainName": "Base" }

Autorizações

x-api-key
string
header
obrigatório

Cabeçalhos

Idempotency-Key
string<uuid>
obrigatório

Provide a unique Idempotency-Key per user to ensure single submission.

Corpo

application/json
chain
string
obrigatório

EVM chain slug.

token
string
obrigatório

ERC20 token address to approve.

spender
string
obrigatório

Spender (router) address to approve.

amount
string
obrigatório

Allowance amount in token units (uint256 string).

from
string | null

Optional sender wallet; defaults to user's default wallet for the chain.

Resposta

Submission accepted

id
string
obrigatório

AFK transaction id for the submitted action.

status
enum<string>
obrigatório

Submission status.

Opções disponíveis:
SUBMITTED
hash
string | null
obrigatório

On-chain transaction hash/signature (may be null at submission time).

explorerUrl
string | null
obrigatório

Direct link to the transaction on a chain explorer. Null until a hash/signature exists.

chainName
string
obrigatório

Human-readable chain name for display (e.g., Base, Ethereum, Solana).