Код: Выделить всё
import requests
import json
url = "https://quote-api.jup.ag/v6/swap"
payload = json.dumps({
"userPublicKey": "My-wallet-key",
"wrapAndUnwrapSol": True,
"useSharedAccounts": True,
"feeAccount": "My-wallet-key",
"trackingAccount": "My-wallet-key",
"computeUnitPriceMicroLamports": 0,
"prioritizationFeeLamports": 0,
"asLegacyTransaction": False,
"useTokenLedger": False,
"destinationTokenAccount": "My-wallet-key",
"dynamicComputeUnitLimit": True,
"skipUserAccountsRpcCalls": True,
"quoteResponse": {
"inputMint": "So11111111111111111111111111111111111111112",
"inAmount": "2000000",
"outputMint": "LzgtUEUEfSFSycua5BAsooY3iwKLR2cfzVd7oVLpump",
"outAmount": "4690527798311",
"otherAmountThreshold": "4667075159320",
"swapMode": "ExactIn",
"slippageBps": 50,
"platformFee": None, # Explicitly setting to None
"priceImpactPct": "0.0033106284921812213000767428",
"routePlan": [
{
"swapInfo": {
"ammKey": "6sRHZZ2tgYMBDG7oi8eG8oauMHeAYi7GGZTZaCYnqw5e",
"label": "Raydium",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "LzgtUEUEfSFSycua5BAsooY3iwKLR2cfzVd7oVLpump",
"inAmount": "2000000",
"outAmount": "4690527798311",
"feeAmount": "5000",
"feeMint": "So11111111111111111111111111111111111111112"
},
"percent": 100
}
],
"contextSlot": 281213564,
"timeTaken": 0.478512348
}
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.post(url, headers=headers, data=payload)
print(response.text)
Подробнее здесь: https://stackoverflow.com/questions/788 ... -swap-post