get_swap_raw
Installation
Usage
Initialization
First, initialize the 'Spiderswap'
class with your API key.
Method: get_swap_raw
Description
The 'get_swap_raw
' method facilitates token swaps by fetching raw swap data from the SpiderSwap API.
Parameters
'owner'
(str): The wallet address of the owner initiating the swap.'from_mint'
(str): The mint address of the token being swapped from.'to_mint'
(str): The mint address of the token being swapped to.'amount'
(float): The amount of the'from_mint'
token to swap, in lamports.'slippage'
(float): The acceptable slippage percentage for the swap, in bps.'provider'
(str): The liquidity provider.'pool'
(str | None, optional): The specific pool for the swap (default isNone
).
Returns
'SwapResponse'
: A promise that resolves to a base64-encoded string containing the raw swap data.
'SwapResponse'
Class
'SwapResponse'
ClassExample
Error Handling
The method throws an error if the swap data cannot be fetched, logging the error details for debugging.
Last updated