Swap Overview
The '@karrotcapital/spiderswap'
package offers a suite of functions to facilitate token swaps and transaction management on the Solana blockchain. Here is an overview of the four main functions provided by the package:
Functions
1. 'getSwapRaw'
'getSwapRaw'
Fetches raw swap data from the SpiderSwap API. This function is essential for retrieving detailed swap information required for executing token swaps.
2. 'getSwap'
'getSwap'
Simplifies the process of fetching swap data by converting the amount to lamports and slippage to basis points before making the API call. This function provides an easy-to-use interface for obtaining swap data.
3. 'createTransaction'
'createTransaction'
Creates a Solana transaction from a base64-encoded string containing the swap transaction data. This function is used to prepare transactions for submission to the blockchain.
Learn more about 'createTransaction'
4. 'sendTransaction'
'sendTransaction'
Sends a Solana transaction to the blockchain, handling retries and confirmation. This function is crucial for ensuring that transactions are successfully broadcasted and confirmed on the network.
Learn more about 'sendTransaction'
These functions provide a comprehensive toolkit for developers to interact with the SpiderSwap API and manage token swaps efficiently. For detailed documentation and examples, refer to the respective function pages linked above.
Last updated