spiderswap

Crates.iospiderswap
lib.rsspiderswap
version0.1.1
sourcesrc
created_at2024-11-08 14:20:39.414181
updated_at2024-11-08 20:17:08.023235
descriptionSpiderswap 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.
homepagehttps://www.spiderswap.io/
repositoryhttps://github.com/dev-spider-web/spiderswap
max_upload_size
id1441239
size25,625
(dev-spider-web)

documentation

README

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(())
}
Commit count: 0

cargo fmt