Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs-t.aionmarket.com/llms.txt

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

Charge the platform trading fee for a Polymarket order placed by an EOA wallet (signatureType=0) on Polygon.

Overview

This is the EOA-wallet counterpart of POST /aiagent/charge-fee/polymarket/trade-fee. Use it whenever the order was signed with signatureType=0 (a raw externally-owned account, the most common setup for autonomous agents). The backend executes:
pUSD.transferFrom(eoaAddress, platformFeeAddress, amount)
with the platform Fireblocks Vault as msg.sender. For this to succeed, the EOA must have already approved the Vault as a pUSD spender on Polygon:
pUSD.approve(<Fireblocks Vault Polygon address>, allowance)
Query the Vault address via GET /aiagent/charge-fee/polymarket/spender (or client.get_polymarket_eoa_spender()).
Since SDK v0.10.0, client.trade() calls this endpoint automatically after a successful order with signatureType=0, and runs pUSD.approve(...) for you when you pass eoa_private_key= (or set AION_EOA_PRIVATE_KEY). Calling this endpoint directly is only required when you opt out of auto-charging or are not using the Python SDK.
fee = orderSize × price × 0.01
Example: 100 contracts at 0.55notional=0.55 → notional = 55 → fee = $0.55 pUSD

Platform Fee Address (Polygon)

0xeA44cAF1f893729342dC5D8903F658E8D3e2379B

Prerequisites

  1. Agent registered and order placed via POST /markets/trade with signatureType=0
  2. EOA wallet holds enough pUSD to cover the fee
  3. EOA has approved the Fireblocks Vault as pUSD spender on Polygon — i.e. on-chain pUSD.allowance(eoaAddress, <Vault>) >= amount. The endpoint validates this allowance and returns 400 with a clear remediation message if it is insufficient.
Make sure the approve call uses the right token, the right spender, and a large-enough amount. A wrong token (USDC instead of pUSD) or a wrong spender (the fee receiver instead of the Vault) will look successful on-chain but still leave allowance(eoa, vault) = 0, and this endpoint will keep returning 400 授权额度不足.
WhatValueHow to obtain
Token (token_address)pUSD on Polygon0xC011a7E12a19f7B1f670d46F03B03f3342E82DFBclient.get_polymarket_eoa_spender()tokenAddress
Spender (spender)Platform Fireblocks Vault Polygon address (currently 0xeA44cAF1f893729342dC5D8903F658E8D3e2379B). Not the fee receiver.client.get_polymarket_eoa_spender()spender
Allowance amountAt minimum, the largest single-trade fee. Recommended default: 1000 pUSD (= 1_000 * 10**6 raw units), which covers ~100,000 USD of cumulative trade volume at 1% fee. The SDK helper defaults to MAX_UINT256 (unlimited) when amount is omitted.Decide based on your security policy
ChainPolygon mainnet (chainId: 137)constant

Request Body

FieldTypeRequiredDescription
amountstringYesFee amount in pUSD as a decimal string (e.g. "0.55"). Parsed with token decimals on the backend (6).
eoaAddressstringYesUser’s EOA Polygon address (the funder).
{
  "amount": "0.55",
  "eoaAddress": "0xa0179F0E513652D1193e0A493007B277C31e3C37"
}

Response

The response is the raw Fireblocks createTransaction response.
data.id
string
Fireblocks transaction id for tracking.
data.status
string
Fireblocks status, typically SUBMITTED / PENDING_SIGNATURE initially.

Examples

curl -X POST "https://pm-t1.bxingupdate.com/bvapi/aiagent/charge-fee/polymarket/eoa-trade-fee" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "0.55",
    "eoaAddress": "0xa0179F0E513652D1193e0A493007B277C31e3C37"
  }'

Error Responses

StatusDescription
400amount is required / eoaAddress is required
400EOA 钱包对平台 Fireblocks 地址的 pUSD 授权额度不足 — EOA hasn’t run pUSD.approve(<Vault>, allowance), or allowance is below amount. The error message includes spender and the required amount; remediate by re-running approve_pusd_for_fireblocks(...).
400无法解析 Fireblocks Vault (...) 的 Polygon 地址 — operator-side Fireblocks misconfiguration
400BLOCKED_BY_POLICY — Fireblocks TAP rejected the contract call
500Fireblocks SDK call failed

Notes

  • Stateless — the caller decides amount and wallet; the backend does no database lookup of the order.
  • Not idempotent — calling twice will broadcast two transferFrom transactions. If you opt out of auto_charge_fee, implement deduplication on your side.
  • The on-chain spender for pUSD.approve is the Fireblocks Vault address (returned by GET /aiagent/charge-fee/polymarket/spender), not the platform fee receiver 0xeA44.... The fee receiver is the destination inside the transferFrom call, not the spender.