Karrot - Spiderswap Package
  • Introduction
  • How to Obtain Your API Key
  • NPM
    • Swap Overview
      • getSwapRaw
      • getSwap
      • createTransaction
      • sendTransaction
    • Quote Overview
      • getQuoteRaw
      • getQuote
      • bulkQuote
  • PHP
    • Coming Soon
  • Python
    • Swap Overview
      • get_swap_raw
      • get_swap
      • create_transaction
      • send_transaction
    • Quote Overview
      • get_quote_raw
      • get_quote
      • bulk_quote
Powered by GitBook
On this page
  • Functions
  • 1. 'getSwapRaw'
  • 2. 'getSwap'
  • 3. 'createTransaction'
  • 4. 'sendTransaction'
  1. NPM

Swap Overview

PreviousHow to Obtain Your API KeyNextgetSwapRaw

Last updated 11 months ago

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'

Fetches raw swap data from the SpiderSwap API. This function is essential for retrieving detailed swap information required for executing token swaps.

2. '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'

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.

4. '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.

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.

Learn more about 'getSwapRaw'
Learn more about 'getSwap'
Learn more about 'createTransaction'
Learn more about 'sendTransaction'