Skip to main content

PumpSwap SDK

A Python SDK for interacting with the PumpSwap decentralized exchange (DEX) on the Solana blockchain. This SDK simplifies buying, selling, token price retrieval, and pool data access on the PumpSwap platform, allowing developers to integrate Solana-based trading into their applications with ease.

Features

  • Buy and Sell Tokens: Easily interact with PumpSwap’s liquidity pools to buy and sell tokens.
  • Pool Analytics: Detailed liquidity pool statistics
  • Price Retrieval: Fetch the current price of a token in the market.
  • Transaction Handling: Handle transactions securely with support for signing and sending transactions.
  • Solana Blockchain Integration: Built specifically for Solana, leveraging libraries like solana and solders.

Installation

You can install the PumpSwap SDK using Poetry or pip.

Using Poetry

poetry add pumpswap-sdk

Using pip

pip install pumpswap-sdk

Setup

Before using the SDK, create a .env file in your project root with the following environment variables:

HTTPS_RPC_ENDPOINT=your_rpc_url_here
BUY_SLIPPAGE=0.3  # Example: 0.3 means 0.3% slippage tolerance
SELL_SLIPPAGE=5   # Example: 5 means 5% slippage tolerance
SWAP_PRIORITY_FEE=1500000

Example .env:

HTTPS_RPC_ENDPOINT=https://api.mainnet-beta.solana.com
BUY_SLIPPAGE=0.3  # Example: 0.3 means 0.3% slippage tolerance
SELL_SLIPPAGE=5   # Example: 5 means 5% slippage tolerance
SWAP_PRIORITY_FEE=1500000

Usage

Here’s how to get started with the PumpSwap SDK in your Python project.

  1. Initialize the SDK
from pumpswap_sdk import PumpSwapSDK
from solders.pubkey import Pubkey

# Initialize the SDK
sdk = PumpSwapSDK()

# Example data
mint = "EiKZAWphC65hFKz9kygWgKGcRZUGgdMmH2zSPtbGpump"
user_private_key = "your_private_key_here"
quote_account_pubkey = Pubkey.from_string("quote_account_public_key")
  1. Buy Tokens
# Buy tokens
sol_amount = 0.0001  # Amount of SOL you want to spend
result = await sdk.buy(mint, sol_amount, user_private_key)

print(result)
  1. Sell Tokens
# Sell tokens
token_amount = 10.0  # Amount of tokens you want to sell
result = await sdk.sell(mint, token_amount, user_private_key)

print(result)
  1. Get Token Price
# Get the price of a token
token_price = await sdk.get_token_price(mint)

print(f"Token Price: {token_price}")

Development

If you want to contribute to the SDK or run tests locally, follow these steps:

  1. Clone the repository:
git clone https://github.com/yourusername/pumpswap-sdk.git
cd pumpswap-sdk
  1. Install dependencies:
poetry install
  1. Run tests:

To run tests with pytest, use the following command:

poetry run pytest
  1. Build the package:

To build the SDK package locally:

poetry build

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For more information, or if you have any questions, feel free to contact the author:

Metadata

Release files for pumpswap-sdk 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pumpswap-sdk 0.1.10
File Size Uploaded
pumpswap_sdk-0.1.10.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pumpswap-sdk 0.1.10
File Interpreter ABI Platform
pumpswap_sdk-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 27.7 kB

Release files / pumpswap_sdk-0.1.10.tar.gz

Download URL pumpswap_sdk-0.1.10.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5b1a9109da60c3c2d0cd5cc7d4eb12170b91a75e54fe6e0fc35704d02d07097e
BLAKE2b-256 checksum
How to use checksums
0b2c40ce1b01a5c70e4401a7ff6eba41b9364620bf33c7f244cace3cddaa7085
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.0 Darwin/24.5.0

Release files / pumpswap_sdk-0.1.10-py3-none-any.whl

Download URL pumpswap_sdk-0.1.10-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41388f6cc66ded71461dc8c4fdeb1a65c5500bcffd42a529356e3c0900d554ec
BLAKE2b-256 checksum
How to use checksums
7c00da6e8f37bba3b376774d6847c210a819e9bc0cd2269ce72a8b0c424077ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.0 Darwin/24.5.0

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page