Loading...
Loading...
Submit a GMGN token swap or query order status. Requires private key configured. Supports sol / bsc / base.
npx skill4agent add gmgnai/gmgn-skills gmgn-swapgmgn-cliGMGN_PRIVATE_KEY.env| Sub-command | Description |
|---|---|
| Submit a token swap |
| Query order status |
solbscbase--percent| Chain | Currency tokens |
|---|---|
| SOL (native, So11111111111111111111111111111111111111112), USDC ( |
| BNB (native, 0x0000000000000000000000000000000000000000), USDC ( |
| ETH (native, 0x0000000000000000000000000000000000000000), USDC ( |
GMGN_API_KEYGMGN_PRIVATE_KEY.env# Basic swap
npx gmgn-cli swap \
--chain sol \
--from <wallet_address> \
--input-token <input_token_address> \
--output-token <output_token_address> \
--amount <input_amount_smallest_unit>
# With slippage
npx gmgn-cli swap \
--chain sol \
--from <wallet_address> \
--input-token <input_token_address> \
--output-token <output_token_address> \
--amount 1000000 \
--slippage 0.01
# With anti-MEV (SOL)
npx gmgn-cli swap \
--chain sol \
--from <wallet_address> \
--input-token <input_token_address> \
--output-token <output_token_address> \
--amount 1000000 \
--anti-mev
# Sell 50% of a token (input_token must NOT be a currency)
npx gmgn-cli swap \
--chain sol \
--from <wallet_address> \
--input-token <token_address> \
--output-token <sol_or_usdc_address> \
--percent 50npx gmgn-cli order get --chain sol --order-id <order_id>| Parameter | Required | Description |
|---|---|---|
| Yes | |
| Yes | Wallet address (must match API Key binding) |
| Yes | Input token contract address |
| Yes | Output token contract address |
| No* | Input amount in smallest unit. Required unless |
| No* | Sell percentage of |
| No | Slippage tolerance, e.g. |
| No | Minimum output amount |
| No | Enable anti-MEV protection (default true) |
| No | Priority fee in SOL (≥ 0.00001, SOL only) |
| No | Tip fee (SOL ≥ 0.00001 / BSC ≥ 0.000001 BNB) |
| No | Max automatic fee cap |
| No | Gas price in gwei (BSC ≥ 0.05 / BASE/ETH ≥ 0.01) |
| No | EIP-1559 max fee per gas (Base only) |
| No | EIP-1559 max priority fee per gas (Base only) |
| Field | Type | Description |
|---|---|---|
| string | Order ID for follow-up queries |
| string | Transaction hash |
| int | Order state code |
| string | |
| string | Confirmation detail message |
| string | Error code on failure |
| string | Error description on failure |
| number | Block height of the transaction |
| number | Block height when the order was placed |
| string | Input token contract address |
| string | Output token contract address |
| string | Actual input consumed (smallest unit); empty if not filled |
| string | Actual output received (smallest unit); empty if not filled |
order get--amount--raw--input-token--output-tokenswap--percentinput_token--percentinput_tokenGMGN_API_KEYGMGN_PRIVATE_KEYconfirmation.stateconfirmedfailedexpiredorder getfilled_input_amountfilled_output_amounthash| Chain | Explorer |
|---|---|
| sol | |
| bsc | |
| base | |
| eth | |