欢迎集成GMGN的Solana交易API进行快速量化交易。

另外也可以:

集成GMGN实时价格图表

如何快速搭建GMGN Bot自动交易脚本

如何配置群Bot自动赚交易返佣

🌐 Language: English | 中文


查询路由接入点:

<https://gmgn.ai/defi/router/v1/sol/tx/get_swap_route?token_in_address=${inputToken}&token_out_address=${outputToken}&in_amount=${amount}&from_address=${fromAddress}&slippage=${slippage}>

请求方式: GET

API Key: 免费使用,不需要申请API Key

输入参数:

参数名 类型 说明
token_in_address string 兑换要花的币,输入代币地址,例如:So11111111111111111111111111111111111111112
token_out_address string 兑换目标币地址,例如:7EYnhQoR9YM3N7UoaKRoA44Uy8JeaZV3qyouov87awMs
in_amount string 最小单位lamports, 100000000=0.1SOL
from_address string 发起交易钱包地址,例如2kpJ5QRh16aRQ4oLZ5LnucHFDAZtEFz6omqWWMzDSNrx
slippage float 滑点,%之上的数值,比如10表示10%
swap_mode string ExactIn或者ExactOut,默认不传则是ExactIn
fee float 0.001, 单位SOL

返回参数:

参数名 类型 说明
code int 错误码,0
msg string 结果描述,success
data Object {
quote: {
inputMint: 'So11111111111111111111111111111111111111112',
inAmount: '50000000',
outputMint: '7EYnhQoR9YM3N7UoaKRoA44Uy8JeaZV3qyouov87awMs',
outAmount: '77920478752',
otherAmountThreshold: '77530876359',
swapMode: 'ExactIn',
slippageBps: 50,
platformFee: null,
priceImpactPct: '0',
routePlan: [Array],
contextSlot: 240893434,
timeTaken: 0.04250061
},
raw_tx: {
swapTransaction: 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAIDxoVIz70VFGJdL5OoCKmFca4NP2MXOcNEiFO6y6JoFUNGWxA6mmc96B1sKHdcYHTM1M1QYNOOSahRPMddzM8XdRsp8RcOMdvjkujt1otIW/R6tIhAHlyC8kUDXj133RK+Ye1I/p3Gy551653GdDPX3KX0D4dWPXyZvsBemb3XlwHyQ+0ezK8pEPmQbXwZ8Tz3O52/YACoT20v0iE4A7D1bTgIWD7ScmJ4Koq6/mSOQVxqfFkoUZ5qTF4TbXDFfH1U+qMakgEp96ZVF6SJaXlGdV6w0mXkHJVedqOxh5rfjqMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADBkZv5SEXMv/srbpyw5vnvIzlu8X3EmssQ5s6QAAAAAR51VvyMcBu7nTFbs5oFQf9sbLeo/SOUQKxzaJWvBOPBt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKlcnp1fowmGSs19gRjTJjE83nuG3xjhl5JKAxhv/p89eoKX5UT/REBqE7f6ZMLP+j7G4V34k14Ax0Fw3q7wE/N9jJclj04kifG7PRApFI4NgwtaE5na/xCEBI572Nvp+Fm0P/on9df2SnTAmx8pWHneSwmrNt/J3VFLMhqns4zl6PSRqslFk9OGKukg94vbePj7SOGor/mX5COZhlMmlOYbCAgABQI6UwcACAAJAyBOAAAAAAAADQYABQAnBwoBAQcCAAUMAgAAAIDw+gIAAAAACgEFARENBgACAAsHCgEBCTMKDAAFAwYCJwsJCQ4JIAoMHAMdAR4aHxsoIiMYDAEEFxkWFQokJiUgCgwSBhMEFBAPESEuwSCbM0HWnIEGAwAAABEBZAABGWQBAhEAZAIDgPD6AgAAAAAgJmwkEgAAADIAAAoDBQAAAQkDegmW2ZAMszm+4Eneq5orFPHiSoriEDigyGyG9FUTd+oGpqilp6GiAp+jq4YFkrWa2UlUnmJKVsvmeovDYVI3GhRB1TB5/repN9MFSEVDREcFQkxGSUuC/JDNwibla4b9UHQsSYKI/HmR9edfsxbKg36RCgUpKAaNi5CGiogCkY4=',
lastValidBlockHeight: 221852977,
prioritizationFeeLamports: 9601,
recentBlockhash: 'HThJomQ74BKBYYfFewg9m5MrRwAsHjrpuTwEcohxpAEW'
}
}

返回data.quote字段说明: