跳转到主要内容
GET
/
v1
/
swap
/
quote
Swap Quote
curl --request GET \
  --url https://payments.magicblock.app/v1/swap/quote
{
  "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "inAmount": "1000000",
  "outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
  "outAmount": "999519",
  "otherAmountThreshold": "994522",
  "swapMode": "ExactIn",
  "slippageBps": 50,
  "priceImpactPct": "0",
  "routePlan": [
    {
      "swapInfo": {
        "ammKey": "DB3sUCP2H4icbeKmK6yb6nUxU5ogbcRHtGuq7W2RoRwW",
        "label": "HumidiFi",
        "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "outputMint": "So11111111111111111111111111111111111111112",
        "inAmount": "1000000",
        "outAmount": "11687625"
      },
      "percent": 100,
      "bps": null
    },
    {
      "swapInfo": {
        "ammKey": "4rJggoVMajEUtipev1XhSMjESYk8Zibz6CDHPtUe1mem",
        "label": "GoonFi V2",
        "inputMint": "So11111111111111111111111111111111111111112",
        "outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
        "inAmount": "11687625",
        "outAmount": "999519"
      },
      "percent": 100,
      "bps": null
    }
  ],
  "contextSlot": 414697033,
  "timeTaken": 0.001218
}

查询参数

inputMint
string
必填

Input token mint address.

示例:

"So11111111111111111111111111111111111111112"

outputMint
string
必填

Output token mint address.

示例:

"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"

amount
string
必填

Raw amount to swap before decimals are applied, as an unsigned integer string.

Pattern: ^\d+$
示例:

"1000000"

slippageBps
integer

Slippage threshold in basis points.

必填范围: x >= 0
示例:

50

swapMode
enum<string>

Use ExactIn for fixed input amount or ExactOut for fixed output amount.

可用选项:
ExactIn,
ExactOut
示例:

"ExactIn"

dexes
string

Optional comma-separated list of DEX labels to include.

示例:

"Raydium,Orca+V2"

excludeDexes
string

Optional comma-separated list of DEX labels to exclude.

示例:

"Meteora+DLMM"

restrictIntermediateTokens
boolean

Restrict intermediate tokens to a more stable set.

示例:

true

onlyDirectRoutes
boolean

Limit routing to a single hop.

示例:

false

asLegacyTransaction
boolean

Request a legacy transaction-compatible route.

示例:

false

platformFeeBps
integer

Optional platform fee in basis points.

必填范围: x >= 0
示例:

20

maxAccounts
integer

Approximate maximum account budget for the route.

必填范围: x >= 0
示例:

64

instructionVersion
enum<string>

Instruction format to target.

可用选项:
V1,
V2
示例:

"V1"

dynamicSlippage
boolean

Keep for compatibility with upstream quote parameters.

示例:

false

forJitoBundle
boolean

Exclude routes that are incompatible with Jito bundles.

示例:

false

supportDynamicIntermediateTokens
boolean

Allow dynamic selection of intermediate tokens.

示例:

false

响应

Swap quote

inputMint
string
必填
inAmount
string
必填
outputMint
string
必填
outAmount
string
必填
otherAmountThreshold
string
必填
swapMode
enum<string>
必填
可用选项:
ExactIn,
ExactOut
slippageBps
integer
必填
必填范围: x >= 0
priceImpactPct
string
必填
routePlan
object[]
必填
instructionVersion
enum<string> | null
可用选项:
V1,
V2,
null
platformFee
object
contextSlot
integer
必填范围: x >= 0
timeTaken
number