getQuoteRaw
Installation
Usage
Initialization
First, initialize the 'Spiderswap'
class with your API key.
Method: getQuoteRaw
Description
The 'getQuoteRaw'
method retrieves a quote for a token swap by fetching raw quote data from the SpiderSwap API.
Parameters
'fromMint'
(string): The mint address of the token being swapped from.'toMint'
(string): The mint address of the token being swapped to.'amount'
(number): The amount of the'fromMint'
token to swap, in lamports.'slippage'
(number): The acceptable slippage percentage for the swap, in basis points (bps).'provider'
(string): The liquidity provider.
Returns
'Promise<quoteMap>'
: A promise that resolves to a 'quoteMap'
object containing the quote data.
'quoteMap'
Type
'quoteMap'
TypeExample
Implementation Details
This method constructs a request body with the provided parameters and makes an API call to fetch the quote data. If the API call fails, it logs the error and throws an exception.
Last updated