Untitled
unknown
python
a month ago
771 B
2
Indexable
def get_quote(output_mint): params = { "inputMint": INPUT_MINT, "outputMint": output_mint, "amount": AMOUNT, "slippageBps": SLIPPAGE_BPS } print(params) try: response = requests.get(QUOTE_API_URL, params=params) response.raise_for_status() quote_response = response.json() # Calculate the amount of SOL needed for the swap transaction sol_amount = quote_response['amount'] quote_response['amount'] = sol_amount return quote_response except requests.exceptions.RequestException as e: print(f"Error fetching quote: {e}") return None except KeyError as e: print(f"Invalid quote response: {e}") return None
Editor is loading...
Leave a Comment