#swap #aggregator #dex #api-integration #spdr

spiderswap

Spiderswap is a cutting-edge decentralized exchange aggregator on Solana, providing fast, efficient, and cost-effective token swaps. Our platform integrates with multiple liquidity providers to ensure users get the best rates with minimal slippage. With no monthly fees and easy API integration through our Spiderswap V1 program, Spiderswap is perfect for developers, market makers, and individual traders.

2 releases

new 0.1.1 Nov 8, 2024
0.1.0 Nov 8, 2024

#235 in Magic Beans

Download history 179/week @ 2024-11-04

179 downloads per month

Custom license

21KB
441 lines

Overview

This crate is organized into three main modules:

  • Routes: Manages API routes for swaps, fees, and quotes.
  • Utils: Contains helper functions and utilities used across modules.

Installation

Add this crate to your Cargo.toml dependencies:

[dependencies]
spiderswap = "x.x.x"

Modules

Routes Module

The routes module provides functionality for performing swap operations, retrieving fees, and fetching quotes. This module is suitable for use in financial applications or trading platforms where these actions are core operations.

  • swap: Handles swaps based on given input data.

  • fee: Retrieves or calculates fees associated with transactions.

  • quote: Provides quote information for assets or trades.

Utils Module

The utils module contains helper functions that support the main operations in routes. These may include string manipulations, error handling utilities, or any other common helper functions.

Examples

Below are some examples of how to use the main functionality of this crate.

Executing a Swap

async fn main() -> Result<(), Box<dyn Error>> {
  let spiderswap = Spiderswap::new("your_api_key")?;
  let response =spiderswap.get_swap("swap_params").await?;
  println!("Swap response: {}", response);
  Ok(())
}

Fetching a Quote

async fn main() -> Result<(), Box<dyn Error>> {
  let spiderswap = Spiderswap::new("your_api_key")?;
  let response = spiderswap.get_quote("quote_params").await?;
  println!("Quote response: {}", response);
  Ok(())
}

Fetching all Quotes

async fn main() -> Result<(), Box<dyn Error>> {
  let spiderswap = Spiderswap::new("your_api_key")?;
  let response = spiderswap.get_all_quotes("all_quote_params").await?;
  println!("All quotes response: {}", response);
  Ok(())
}

Dependencies

~17–30MB
~475K SLoC