跳转到主要内容
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" }
仅 EVM。需要 Idempotency-Key 头。
{ "id": "tx_...", "status": "SUBMITTED", "hash": "0x...", "explorerUrl": "https://basescan.org/tx/0x...", "chainName": "Base" }

授权

x-api-key
string
header
必填

请求头

Idempotency-Key
string<uuid>
必填

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

请求体

application/json
chain
string
必填

EVM chain slug.

token
string
必填

ERC20 token address to approve.

spender
string
必填

Spender (router) address to approve.

amount
string
必填

Allowance amount in token units (uint256 string).

from
string | null

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

响应

Submission accepted

id
string
必填

AFK transaction id for the submitted action.

status
enum<string>
必填

Submission status.

可用选项:
SUBMITTED
hash
string | null
必填

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

explorerUrl
string | null
必填

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

chainName
string
必填

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