docs: Update Readme
This commit is contained in:
@@ -24,3 +24,6 @@ Cargo.lock
|
||||
|
||||
tmp_*.rs
|
||||
tmp_*.log
|
||||
|
||||
|
||||
.serena/
|
||||
@@ -1,9 +1,41 @@
|
||||
# Sol Trade SDK
|
||||
[中文](https://github.com/0xfnzero/sol-trade-sdk/blob/main/README_CN.md) | [English](https://github.com/0xfnzero/sol-trade-sdk/blob/main/README.md) | [Website](https://fnzero.dev/) | [Telegram](https://t.me/fnzero_group)
|
||||
<div align="center">
|
||||
<h1>🚀 Sol Trade SDK</h1>
|
||||
<h3><em>A comprehensive Rust SDK for seamless Solana DEX trading</em></h3>
|
||||
</div>
|
||||
|
||||
A comprehensive Rust SDK for seamless interaction with Solana DEX trading programs. This SDK provides a robust set of tools and interfaces to integrate PumpFun, PumpSwap, and Bonk functionality into your applications.
|
||||
<p align="center">
|
||||
<strong>Integrate PumpFun, PumpSwap, Bonk, and Raydium trading functionality into your applications with powerful tools and unified interfaces.</strong>
|
||||
</p>
|
||||
|
||||
## Project Features
|
||||
<p align="center">
|
||||
<a href="https://github.com/0xfnzero/sol-trade-sdk/blob/main/README_CN.md">中文</a> |
|
||||
<a href="https://github.com/0xfnzero/sol-trade-sdk/blob/main/README.md">English</a> |
|
||||
<a href="https://fnzero.dev/">Website</a> |
|
||||
<a href="https://t.me/fnzero_group">Telegram</a>
|
||||
</p>
|
||||
|
||||
## 📋 Table of Contents
|
||||
|
||||
- [✨ Features](#-features)
|
||||
- [📦 Installation](#-installation)
|
||||
- [🛠️ Usage Examples](#️-usage-examples)
|
||||
- [📋 Important Parameter Description](#-important-parameter-description)
|
||||
- [📊 Usage Examples Summary Table](#-usage-examples-summary-table)
|
||||
- [⚙️ SWQOS Service Configuration](#️-swqos-service-configuration)
|
||||
- [🔧 Middleware System](#-middleware-system)
|
||||
- [⚡ Custom Priority Fee Configuration](#-custom-priority-fee-configuration)
|
||||
- [🏪 Supported Trading Platforms](#-supported-trading-platforms)
|
||||
- [🛡️ MEV Protection Services](#️-mev-protection-services)
|
||||
- [💰 Price Calculation Utilities](#-price-calculation-utilities)
|
||||
- [🧮 Amount Calculation Utilities](#-amount-calculation-utilities)
|
||||
- [📁 Project Structure](#-project-structure)
|
||||
- [📄 License](#-license)
|
||||
- [💬 Contact](#-contact)
|
||||
- [⚠️ Important Notes](#️-important-notes)
|
||||
|
||||
---
|
||||
|
||||
## ✨ Features
|
||||
|
||||
1. **PumpFun Trading**: Support for `buy` and `sell` operations
|
||||
2. **PumpSwap Trading**: Support for PumpSwap pool trading operations
|
||||
@@ -18,7 +50,7 @@ A comprehensive Rust SDK for seamless interaction with Solana DEX trading progra
|
||||
11. **Unified Trading Interface**: Use unified trading protocol enums for trading operations
|
||||
12. **Middleware System**: Support for custom instruction middleware to modify, add, or remove instructions before transaction execution
|
||||
|
||||
## Installation
|
||||
## 📦 Installation
|
||||
|
||||
### Direct Clone
|
||||
|
||||
@@ -43,9 +75,10 @@ sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.6.4" }
|
||||
sol-trade-sdk = "0.6.4"
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
## 🛠️ Usage Examples
|
||||
|
||||
### 📋 Important Parameter Description
|
||||
|
||||
### Important Parameter Description
|
||||
#### 🌱 open_seed_optimize Parameter
|
||||
|
||||
`open_seed_optimize` is used to specify whether to use seed optimization to reduce transaction CU consumption.
|
||||
@@ -80,7 +113,6 @@ The `lookup_table_key` parameter is an optional `Pubkey` that specifies an addre
|
||||
|
||||
- **Purpose**: Address lookup tables can reduce transaction size and improve execution speed by storing frequently used addresses
|
||||
- **Usage**:
|
||||
- Can be set globally in `TradeConfig` for all transactions
|
||||
- Can be overridden per transaction in `buy()` and `sell()` methods
|
||||
- If not provided, defaults to `None`
|
||||
- **Benefits**:
|
||||
@@ -107,7 +139,7 @@ The `priority_fee` parameter is an optional `PriorityFee` that allows you to ove
|
||||
When using shred to subscribe to events, due to the nature of shreds, you cannot get complete information about transaction events.
|
||||
Please ensure that the parameters your trading logic depends on are available in shreds when using them.
|
||||
|
||||
### Usage Examples Summary Table
|
||||
### 📊 Usage Examples Summary Table
|
||||
|
||||
| Feature Type | Package Name | Description | Run Command | Source Code |
|
||||
|-------------|--------------|-------------|-------------|-------------|
|
||||
@@ -126,19 +158,12 @@ Please ensure that the parameters your trading logic depends on are available in
|
||||
| WSOL Wrapper | `wsol_wrapper` | Wrap/unwrap SOL to/from WSOL example | `cargo run --package wsol_wrapper` | [examples/wsol_wrapper](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/wsol_wrapper/src/main.rs) |
|
||||
| Seed Trading | `seed_trading` | Seed trading example | `cargo run --package seed_trading` | [examples/seed_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/seed_trading/src/main.rs) |
|
||||
|
||||
### SWQOS Service Configuration
|
||||
### ⚙️ SWQOS Service Configuration
|
||||
|
||||
When configuring SWQOS services, note the different parameter requirements for each service:
|
||||
|
||||
- **Jito**: The first parameter is UUID, if you don't have a UUID, pass an empty string `""`
|
||||
- **NextBlock**: The first parameter is API Token
|
||||
- **Bloxroute**: The first parameter is API Token
|
||||
- **ZeroSlot**: The first parameter is API Token
|
||||
- **Temporal**: The first parameter is API Token
|
||||
- **FlashBlock**: The first parameter is API Token, Add community TG admin [xyz_0xfnzero](https://t.me/xyz_0xfnzero) to get a free key and instantly speed up your trading (with tip refunds available)!
|
||||
- **BlockRazor**: The first parameter is API Token, Add official TG support to get a free key and instantly accelerate your trades!
|
||||
- **Node1**: The first parameter is API Token, Add the official TG support at https://t.me/node1_me to get a free key and instantly accelerate your trades!
|
||||
- **Astralane**: The first parameter is API Token
|
||||
- **Jito**: The first parameter is UUID (if no UUID, pass an empty string `""`)
|
||||
- **Other MEV services**: The first parameter is the API Token
|
||||
|
||||
#### Custom URL Support
|
||||
|
||||
@@ -167,7 +192,9 @@ let nextblock_config = SwqosConfig::NextBlock(
|
||||
|
||||
When using multiple MEV services, you need to use `Durable Nonce`. You need to initialize a `NonceCache` class (or write your own nonce management class), get the latest `nonce` value, and use it as the `blockhash` when trading.
|
||||
|
||||
### Middleware System Explanation
|
||||
---
|
||||
|
||||
### 🔧 Middleware System
|
||||
|
||||
The SDK provides a powerful middleware system that allows you to modify, add, or remove instructions before transaction execution. Middleware executes in the order they are added:
|
||||
|
||||
@@ -178,7 +205,7 @@ let middleware_manager = MiddlewareManager::new()
|
||||
.add_middleware(Box::new(ThirdMiddleware)); // Executes last
|
||||
```
|
||||
|
||||
### 9. Custom Priority Fee Configuration
|
||||
### ⚡ Custom Priority Fee Configuration
|
||||
|
||||
```rust
|
||||
use sol_trade_sdk::common::PriorityFee;
|
||||
@@ -203,7 +230,7 @@ let trade_config = TradeConfig {
|
||||
};
|
||||
```
|
||||
|
||||
## Supported Trading Platforms
|
||||
## 🏪 Supported Trading Platforms
|
||||
|
||||
- **PumpFun**: Primary meme coin trading platform
|
||||
- **PumpSwap**: PumpFun's swap protocol
|
||||
@@ -211,7 +238,7 @@ let trade_config = TradeConfig {
|
||||
- **Raydium CPMM**: Raydium's Concentrated Pool Market Maker protocol
|
||||
- **Raydium AMM V4**: Raydium's Automated Market Maker V4 protocol
|
||||
|
||||
## MEV Protection Services
|
||||
## 🛡️ MEV Protection Services
|
||||
|
||||
- **Jito**: High-performance block space
|
||||
- **NextBlock**: Fast transaction execution
|
||||
@@ -223,31 +250,11 @@ let trade_config = TradeConfig {
|
||||
- **Node1**: High-speed transaction execution with API key authentication - [Official Documentation](https://node1.me/docs.html)
|
||||
- **Astralane**: Blockchain network acceleration
|
||||
|
||||
## New Architecture Features
|
||||
|
||||
### Unified Trading Interface
|
||||
|
||||
- **TradingProtocol Enum**: Use unified protocol enums (PumpFun, PumpSwap, Bonk, RaydiumCpmm, RaydiumAmmV4)
|
||||
- **Unified buy/sell Methods**: All protocols use the same trading method signatures
|
||||
- **Protocol-specific Parameters**: Each protocol has its own parameter structure (PumpFunParams, RaydiumCpmmParams, RaydiumAmmV4Params, etc.)
|
||||
|
||||
### Event Parsing System
|
||||
|
||||
- **Unified Event Interface**: All protocol events implement the UnifiedEvent trait
|
||||
- **Protocol-specific Events**: Each protocol has its own event types
|
||||
- **Event Factory**: Automatically identifies and parses events from different protocols
|
||||
|
||||
### Trading Engine
|
||||
|
||||
- **Unified Trading Interface**: All trading operations use the same methods
|
||||
- **Protocol Abstraction**: Supports trading operations across multiple protocols
|
||||
- **Concurrent Execution**: Supports sending transactions to multiple MEV services simultaneously
|
||||
|
||||
## Price Calculation Utilities
|
||||
## 💰 Price Calculation Utilities
|
||||
|
||||
The SDK includes price calculation utilities for all supported protocols in `src/utils/price/`.
|
||||
|
||||
## Amount Calculation Utilities
|
||||
## 🧮 Amount Calculation Utilities
|
||||
|
||||
The SDK provides trading amount calculation functionality for various protocols, located in `src/utils/calc/`:
|
||||
|
||||
@@ -265,7 +272,7 @@ Key features include:
|
||||
- Slippage protection calculations
|
||||
- Liquidity pool state calculations
|
||||
|
||||
## Project Structure
|
||||
## 📁 Project Structure
|
||||
|
||||
```
|
||||
src/
|
||||
@@ -306,25 +313,20 @@ src/
|
||||
└── main.rs # Example program
|
||||
```
|
||||
|
||||
## License
|
||||
## 📄 License
|
||||
|
||||
MIT License
|
||||
|
||||
## Contact
|
||||
## 💬 Contact
|
||||
|
||||
- Official Website: https://fnzero.dev/
|
||||
- Project Repository: https://github.com/0xfnzero/sol-trade-sdk
|
||||
- Telegram Group: https://t.me/fnzero_group
|
||||
|
||||
## Important Notes
|
||||
## ⚠️ Important Notes
|
||||
|
||||
1. Test thoroughly before using on mainnet
|
||||
2. Properly configure private keys and API tokens
|
||||
3. Pay attention to slippage settings to avoid transaction failures
|
||||
4. Monitor balances and transaction fees
|
||||
5. Comply with relevant laws and regulations
|
||||
|
||||
## Language Versions
|
||||
|
||||
- [English](README.md)
|
||||
- [中文](README_CN.md)
|
||||
|
||||
+55
-52
@@ -1,9 +1,41 @@
|
||||
# Sol Trade SDK
|
||||
[中文](https://github.com/0xfnzero/sol-trade-sdk/blob/main/README_CN.md) | [English](https://github.com/0xfnzero/sol-trade-sdk/blob/main/README.md) | [Website](https://fnzero.dev/) | [Telegram](https://t.me/fnzero_group)
|
||||
<div align="center">
|
||||
<h1>🚀 Sol Trade SDK</h1>
|
||||
<h3><em>全面的 Rust SDK,用于无缝 Solana DEX 交易</em></h3>
|
||||
</div>
|
||||
|
||||
一个全面的 Rust SDK,用于与 Solana DEX 交易程序进行无缝交互。此 SDK 提供强大的工具和接口集,将 PumpFun、PumpSwap 和 Bonk 功能集成到您的应用程序中。
|
||||
<p align="center">
|
||||
<strong>将 PumpFun、PumpSwap、Bonk 和 Raydium 交易功能集成到您的应用程序中,提供强大的工具和统一的接口。</strong>
|
||||
</p>
|
||||
|
||||
## 项目特性
|
||||
<p align="center">
|
||||
<a href="https://github.com/0xfnzero/sol-trade-sdk/blob/main/README_CN.md">中文</a> |
|
||||
<a href="https://github.com/0xfnzero/sol-trade-sdk/blob/main/README.md">English</a> |
|
||||
<a href="https://fnzero.dev/">Website</a> |
|
||||
<a href="https://t.me/fnzero_group">Telegram</a>
|
||||
</p>
|
||||
|
||||
## 📋 目录
|
||||
|
||||
- [✨ 项目特性](#-项目特性)
|
||||
- [📦 安装](#-安装)
|
||||
- [🛠️ 使用示例](#️-使用示例)
|
||||
- [📋 重要说明](#-重要说明)
|
||||
- [📊 使用示例汇总表格](#-使用示例汇总表格)
|
||||
- [⚙️ SWQOS 服务配置说明](#️-swqos-服务配置说明)
|
||||
- [🔧 中间件系统说明](#-中间件系统说明)
|
||||
- [⚡ 自定义优先费用配置](#-自定义优先费用配置)
|
||||
- [🏪 支持的交易平台](#-支持的交易平台)
|
||||
- [🛡️ MEV 保护服务](#️-mev-保护服务)
|
||||
- [💰 价格计算工具](#-价格计算工具)
|
||||
- [🧮 数量计算工具](#-数量计算工具)
|
||||
- [📁 项目结构](#-项目结构)
|
||||
- [📄 许可证](#-许可证)
|
||||
- [💬 联系方式](#-联系方式)
|
||||
- [⚠️ 重要注意事项](#️-重要注意事项)
|
||||
|
||||
---
|
||||
|
||||
## ✨ 项目特性
|
||||
|
||||
1. **PumpFun 交易**: 支持`购买`、`卖出`功能
|
||||
2. **PumpSwap 交易**: 支持 PumpSwap 池的交易操作
|
||||
@@ -18,7 +50,7 @@
|
||||
11. **统一交易接口**: 使用统一的交易协议枚举进行交易操作
|
||||
12. **中间件系统**: 支持自定义指令中间件,可在交易执行前对指令进行修改、添加或移除
|
||||
|
||||
## 安装
|
||||
## 📦 安装
|
||||
|
||||
### 直接克隆
|
||||
|
||||
@@ -43,9 +75,9 @@ sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.6.4" }
|
||||
sol-trade-sdk = "0.6.4"
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
## 🛠️ 使用示例
|
||||
|
||||
### 重要说明
|
||||
### 📋 重要说明
|
||||
|
||||
#### 🌱 open_seed_optimize 参数
|
||||
|
||||
@@ -81,7 +113,6 @@ sol-trade-sdk = "0.6.4"
|
||||
|
||||
- **用途**:地址查找表可以通过存储常用地址来减少交易大小并提高执行速度
|
||||
- **使用方法**:
|
||||
- 可以在 `TradeConfig` 中全局设置,用于所有交易
|
||||
- 可以在 `buy()` 和 `sell()` 方法中按交易覆盖
|
||||
- 如果不提供,默认为 `None`
|
||||
- **优势**:
|
||||
@@ -108,7 +139,7 @@ sol-trade-sdk = "0.6.4"
|
||||
当你使用 shred 订阅事件时,由于 shred 的特性,你无法获取到交易事件的完整信息。
|
||||
请你在使用时,确保你的交易逻辑依赖的参数,在shred中都能获取到。
|
||||
|
||||
### 使用示例汇总表格
|
||||
### 📊 使用示例汇总表格
|
||||
|
||||
| 功能类型 | 示例包名 | 描述 | 运行命令 | 源码路径 |
|
||||
|---------|---------|------|---------|----------|
|
||||
@@ -127,19 +158,12 @@ sol-trade-sdk = "0.6.4"
|
||||
| WSOL 包装器 | `wsol_wrapper` | SOL与WSOL相互转换示例 | `cargo run --package wsol_wrapper` | [examples/wsol_wrapper](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/wsol_wrapper/src/main.rs) |
|
||||
| Seed 优化 | `seed_trading` | Seed 优化交易示例 | `cargo run --package seed_trading` | [examples/seed_trading](https://github.com/0xfnzero/sol-trade-sdk/tree/main/examples/seed_trading/src/main.rs) |
|
||||
|
||||
### SWQOS 服务配置说明
|
||||
### ⚙️ SWQOS 服务配置说明
|
||||
|
||||
在配置 SWQOS 服务时,需要注意不同服务的参数要求:
|
||||
|
||||
- **Jito**: 第一个参数是 UUID,如果没有 UUID 则传空字符串 `""`
|
||||
- **NextBlock**: 第一个参数是 API Token
|
||||
- **Bloxroute**: 第一个参数是 API Token
|
||||
- **ZeroSlot**: 第一个参数是 API Token
|
||||
- **Temporal**: 第一个参数是 API Token
|
||||
- **FlashBlock**: 第一个参数是 API Token, 添加社区tg管理员[xyz_0xfnzero](https://t.me/xyz_0xfnzero)获取免费key立即加速你的交易(可获得小费返还)!
|
||||
- **BlockRazor**: 第一个参数是 API Token, 添加tg官方客服获取免费key立即加速你的交易!
|
||||
- **Node1**: 第一个参数是 API Token, 添加tg官方客服https://t.me/node1_me 获取免费key立即加速你的交易!
|
||||
- **Astralane**: 第一个参数是 API Token
|
||||
- **Jito**: 第一个参数为 UUID(如无 UUID 请传入空字符串 `""`)
|
||||
- 其他的MEV服务,第一个参数为 API Token
|
||||
|
||||
#### 自定义 URL 支持
|
||||
|
||||
@@ -168,7 +192,9 @@ let nextblock_config = SwqosConfig::NextBlock(
|
||||
|
||||
当使用多个MEV服务时,需要使用`Durable Nonce`。你需要初始化`NonceCache`类(或者自行写一个管理nonce的类),获取最新的`nonce`值,并在交易的时候作为`blockhash`使用。
|
||||
|
||||
### 中间件系统说明
|
||||
---
|
||||
|
||||
### 🔧 中间件系统说明
|
||||
|
||||
SDK 提供了强大的中间件系统,允许您在交易执行前对指令进行修改、添加或移除。中间件按照添加顺序依次执行:
|
||||
|
||||
@@ -179,7 +205,7 @@ let middleware_manager = MiddlewareManager::new()
|
||||
.add_middleware(Box::new(ThirdMiddleware)); // 最后执行
|
||||
```
|
||||
|
||||
### 9. 自定义优先费用配置
|
||||
### ⚡ 自定义优先费用配置
|
||||
|
||||
```rust
|
||||
use sol_trade_sdk::common::PriorityFee;
|
||||
@@ -204,7 +230,7 @@ let trade_config = TradeConfig {
|
||||
};
|
||||
```
|
||||
|
||||
## 支持的交易平台
|
||||
## 🏪 支持的交易平台
|
||||
|
||||
- **PumpFun**: 主要的 meme 币交易平台
|
||||
- **PumpSwap**: PumpFun 的交换协议
|
||||
@@ -212,7 +238,7 @@ let trade_config = TradeConfig {
|
||||
- **Raydium CPMM**: Raydium 的集中流动性做市商协议
|
||||
- **Raydium AMM V4**: Raydium 的自动做市商 V4 协议
|
||||
|
||||
## MEV 保护服务
|
||||
## 🛡️ MEV 保护服务
|
||||
|
||||
- **Jito**: 高性能区块空间
|
||||
- **NextBlock**: 快速交易执行
|
||||
@@ -224,31 +250,12 @@ let trade_config = TradeConfig {
|
||||
- **Node1**: 高速交易执行,支持 API 密钥认证 - [官方文档](https://node1.me/docs.html)
|
||||
- **Astralane**: 高速交易执行,支持 API 密钥认证
|
||||
|
||||
## 新架构特性
|
||||
|
||||
### 统一交易接口
|
||||
|
||||
- **TradingProtocol 枚举**: 使用统一的协议枚举(PumpFun、PumpSwap、Bonk、RaydiumCpmm、RaydiumAmmV4)
|
||||
- **统一的 buy/sell 方法**: 所有协议都使用相同的交易方法签名
|
||||
- **协议特定参数**: 每个协议都有自己的参数结构(PumpFunParams、RaydiumCpmmParams、RaydiumAmmV4Params 等)
|
||||
|
||||
### 事件解析系统
|
||||
|
||||
- **统一事件接口**: 所有协议事件都实现 UnifiedEvent 特征
|
||||
- **协议特定事件**: 每个协议都有自己的事件类型
|
||||
- **事件工厂**: 自动识别和解析不同协议的事件
|
||||
|
||||
### 交易引擎
|
||||
|
||||
- **统一交易接口**: 所有交易操作都使用相同的方法
|
||||
- **协议抽象**: 支持多个协议的交易操作
|
||||
- **并发执行**: 支持同时向多个 MEV 服务发送交易
|
||||
|
||||
## 价格计算工具
|
||||
## 💰 价格计算工具
|
||||
|
||||
SDK 包含所有支持协议的价格计算工具,位于 `src/utils/price/` 目录。
|
||||
|
||||
## 数量计算工具
|
||||
## 🧮 数量计算工具
|
||||
|
||||
SDK 提供各种协议的交易数量计算功能,位于 `src/utils/calc/` 目录:
|
||||
|
||||
@@ -266,7 +273,7 @@ SDK 提供各种协议的交易数量计算功能,位于 `src/utils/calc/` 目
|
||||
- 滑点保护计算
|
||||
- 流动性池状态计算
|
||||
|
||||
## 项目结构
|
||||
## 📁 项目结构
|
||||
|
||||
```
|
||||
src/
|
||||
@@ -307,17 +314,17 @@ src/
|
||||
└── main.rs # 示例程序
|
||||
```
|
||||
|
||||
## 许可证
|
||||
## 📄 许可证
|
||||
|
||||
MIT 许可证
|
||||
|
||||
## 联系方式
|
||||
## 💬 联系方式
|
||||
|
||||
- 官方网站: https://fnzero.dev/
|
||||
- 项目仓库: https://github.com/0xfnzero/sol-trade-sdk
|
||||
- Telegram 群组: https://t.me/fnzero_group
|
||||
|
||||
## 重要注意事项
|
||||
## ⚠️ 重要注意事项
|
||||
|
||||
1. 在主网使用前请充分测试
|
||||
2. 正确设置私钥和 API 令牌
|
||||
@@ -325,7 +332,3 @@ MIT 许可证
|
||||
4. 监控余额和交易费用
|
||||
5. 遵循相关法律法规
|
||||
|
||||
## 语言版本
|
||||
|
||||
- [English](README.md)
|
||||
- [中文](README_CN.md)
|
||||
|
||||
Reference in New Issue
Block a user