Rust Integration Guide

Learn how to integrate the PumpFun API into your Rust projects.

Setup

  1. Rust Installation

    Ensure you have Rust installed. You can install it from rust-lang.org.

  2. Project Setup

    Create a new Rust project:

    cargo new pumpfun_integration
    cd pumpfun_integration
  3. Dependencies

    Add the following dependencies to your Cargo.toml:

    [dependencies]
    reqwest = { version = "0.11", features = ["json"] }
    tokio = { version = "1", features = ["full"] }
    serde = { version = "1.0", features = ["derive"] }
    serde_json = "1.0"
    dotenv = "0.15"
  4. Environment Setup

    Create a .env file in your project root and add your API key:

    PUMPFUN_API_KEY=your_api_key_here

    Load the API key in your Rust file:

    use dotenv::dotenv;
    use std::env;
    
    dotenv().ok();
    let api_key = env::var("PUMPFUN_API_KEY").expect("PUMPFUN_API_KEY must be set");