pumpswap
Version:
SDK for PumpSwap DEX
125 lines (92 loc) • 2.82 kB
Markdown
A powerful and user-friendly SDK for interacting with the PumpSwap Decentralized Exchange (DEX). This SDK provides essential functionality for trading, liquidity provision, and price checking on the PumpSwap protocol.
## Features
### Current Features
- **Token Swapping**:
- [ ] Easily swap between different tokens with optimal routing
- **Liquidity Management**:
- [ ] Add liquidity to trading pairs
- [ ] Remove liquidity from pools
- [ ] View current liquidity positions
- **Price Checking**:
- [ ] Real-time price feeds
- [ ] Price impact calculations
## Installation
```bash
npm install pumpswap-sdk
# or
yarn add pumpswap-sdk
```
## Quick Start
### 1. Set up your Client
First, set up your client with a desired RPC endpoint and network cluster.
```typescript
import { createPumpSwapClient, rpcConnection } from 'pumpswap'
import { mainnet } from 'pumpswap/networks'
const client = createPumpSwapClient({
network: mainnet,
transport: rpcConnection('https://api.mainnet-beta.solana.com'),
})
```
In a production app, it is highly recommended to use a dedicated RPC provider (Helius, GenesysGo, QuickNode, etc).
### 2. Consume Actions
Now that you have a client set up, you can interact with the PumpSwap protocol and consume actions!
```typescript
// Example: Get token price
const tokenPrice = await client.getTokenPrice({
token: 'SOL'
})
// Example: Perform a token swap
const swapResult = await client.swap({
tokenIn: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
tokenOut: 'So11111111111111111111111111111111111111112', // SOL
amountIn: '10.0',
slippageBps: 50, // 0.5%
})
// Example: Add liquidity
const liquidityResult = await client.addLiquidity({
tokenA: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
tokenB: 'So11111111111111111111111111111111111111112', // SOL
amountA: '100.0',
amountB: '1.0',
})
```
For detailed documentation and examples, please refer to our [documentation](docs/).
- Node.js (v16 or higher)
- Yarn or npm
1. Clone the repository
```bash
git clone https://github.com/yourusername/pumpswap-sdk.git
cd pumpswap-sdk
```
2. Install dependencies
```bash
yarn install
npm install
```
3. Build the project
```bash
yarn build
npm run build
```
```bash
yarn test
npm test
```
We welcome contributions! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
If you discover a security vulnerability, please send an e-mail to security@pumpswap.com.
For support and questions, please join our [Discord community](https://discord.gg/pumpswap) or open an issue on GitHub.
****