usdc_buy
Buy tokens with USDC on supported chains, with automatic USDC bridging and gas top-up when funds are short. Follow pending request IDs to track trades.
Instructions
Buy a token paying with USDC. Automatic funding is on by default: GDEX bridges USDC and tops up gas from the user's other chains when this chain is short, capped by the signed maxSourceSpendRaw. A pending result returns a requestId: follow it with usdc_wait_for_trade.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiKey | No | GDEX API key for AES encryption | |
| chainId | Yes | Chain ID: 1, 10, 56, 146, 8453, 42161 or 622112261 (Solana). No USDC on Robinhood 4663 or Fraxtal 252 | |
| accountRef | No | Connected account from gdex_connect. Supplies session key, wallet address, API key and session data so no secret is passed in chat | |
| autoBridge | No | Automatic funding (default true, as on gdex.pro): bridge USDC and top up native gas from the user's other chains, within maxSourceSpendRaw | |
| tokenAddress | Yes | Token to buy | |
| usdcAmountRaw | Yes | USDC to spend (6 decimals; 18 on BSC), raw integer units | |
| walletAddress | No | Control wallet address | |
| minTokenOutRaw | Yes | Minimum token out (from usdc_get_trade_quote minus slippage), raw integer units | |
| maxSourceSpendRaw | No | Signed cap on total source spend for auto-funding (default ceil(amount x 1.2)), raw integer units | |
| sessionPrivateKey | No | Session private key from sign-in |