Commit Graph

299 Commits

Author SHA1 Message Date
Wood b552973779 Merge remote changes with DexParamEnum API update 2025-12-08 01:42:54 +08:00
Wood 80ad2e052e refactor: update API with DexParamEnum and simplify TradeConfig
- Introduce DexParamEnum to replace Dex enum for protocol parameters
- Simplify TradeConfig::new() to accept only 3 essential parameters
- Update all examples to use new DexParamEnum API
- Optimize executor and params modules
- Remove deprecated wsol_use_seed and mint_use_seed parameters
- Fix fast_fn module exports
2025-12-08 01:35:40 +08:00
VariantConst 70d79ff993 Modify SWQoS endpoints
Updated SWQoS endpoints for 0slot and node1.
2025-12-05 19:37:45 +08:00
HelvetiCrypt 7d313dbfd0 feat(swqos): add Lightspeed (Solana Vibe Station) support
- Add LightspeedClient using standard JSON-RPC sendTransaction
- Add tip accounts (53PhM..., 9tYF5...)
- Add minimum tip constant (0.001 SOL)
- Endpoint format: https://<tier>.rpc.solanavibestation.com/lightspeed?api_key=<key>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 17:43:43 +00:00
ysq 1762b7739d Merge commit 'de8c55e599fa58e35e3f3dc68437f8ae4712d4ba' 2025-12-01 00:14:40 +08:00
ysq 353c814697 feat(swqos): add Stellium support and update minimum tip requirements 2025-12-01 00:13:34 +08:00
Wood de8c55e599 feat: add dynamic compute unit price update methods
添加动态优先费更新方法

## 新增方法
- update_buy_cu_price(): 动态更新买入优先费
- update_sell_cu_price(): 动态更新卖出优先费

## 功能
- 保持其他策略参数不变,仅更新 cu_price
- 使用 RCU 模式确保线程安全
- 支持所有 SwqosType 和 GasFeeStrategyType

## 应用场景
- 根据交易金额动态调整优先费
- 实时优化 gas 费用策略

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 00:11:38 +08:00
Wood 26311e9796 feat: return native Solana InstructionError code in TradeError
- Simplify error code handling by directly returning Solana's native InstructionError codes
- Custom errors return their embedded code directly
- Standard InstructionError variants map to fixed codes (1-10, 999)
- Remove nested match pattern for better code readability
- Error format: buy_failed|sig={signature}|code={error_code}|msg={message}

Benefits:
- More accurate error identification using native Solana error codes
- Simpler and cleaner code structure
- Easier to maintain and extend
- Consistent with Solana ecosystem standards
2025-11-28 06:40:05 +08:00
ysq 25fa295994 feat(swqos): enhance error message collection from transaction logs
Improve error message extraction in poll_transaction_confirmation to:
- Collect multiple error messages instead of stopping at the first one
- Add support for "Program log: Error: " format in addition to "Error Message: "
- Concatenate multiple errors with semicolon separator for comprehensive error reporting
2025-11-27 22:13:35 +08:00
ysq 0e491a8b80 Merge commit 'd0ae515af1c57db680794d65456d997844180a58' 2025-11-25 22:19:22 +08:00
yangdongcheng 9b9cb7e73a Merge branch '0xfnzero:main' into main 2025-11-25 09:28:28 +08:00
ysq 277c99a937 Merge commit '5358d9ea281fafde7fd526b62d9cc57dad0e0abd' 2025-11-24 22:59:47 +08:00
ysq c3630e4c99 feat: upgrade to v3.3.4 with improved error handling and transaction details
- Add TradeError struct with code, message, and instruction fields
- Enhance poll_transaction_confirmation to extract detailed error info from logs
- Change buy/sell return type from Option<anyhow::Error> to Option<TradeError>
- Add solana-transaction-status-client-types dependency
- Remove unused parallel.rs module
2025-11-24 22:52:56 +08:00
Wood 5358d9ea28 feat(swqos): add minimum tip constants and conditional transaction building
- Define minimum tip constants for each SWQOS provider (JITO, NextBlock, Node1, etc.)
- Add dynamic filtering in execute_parallel to skip transaction building when tip is below provider's minimum
- Add missing SWQOS_ENDPOINTS_ASTRALANE constant
- Ensure SWQOS clients are always initialized but transactions are conditionally built based on current tip amount
2025-11-24 06:03:31 +08:00
Wood 3132981f85 feat: add dynamic tip update methods to GasFeeStrategy
- Add update_buy_tip() method to dynamically update buy tip while keeping other parameters unchanged
- Add update_sell_tip() method to dynamically update sell tip while keeping other parameters unchanged
- Enable simple one-line tip updates for all configured SWQOS providers
- Support percentage-based dynamic tip calculation in trading bots
2025-11-23 21:02:55 +08:00
Wood 26cee93fb1 feat: optimize WSOL wrap/unwrap with seed account reuse check
- Add account existence check before creating seed account
- Implement wrap_wsol_to_sol_without_create for reusing existing seed accounts
- Prevent transaction failures when temporary seed account already exists
- Improve WSOL conversion efficiency by avoiding redundant account creation
2025-11-23 20:18:01 +08:00
Wood ce83b5ae68 Revert "refactor: split seed optimization config into wsol_use_seed and mint_use_seed"
This reverts commit eb8de36f50.
2025-11-22 01:41:06 +08:00
Wood eb8de36f50 refactor: split seed optimization config into wsol_use_seed and mint_use_seed
- Split use_seed_optimize parameter into two independent configs:
  * wsol_use_seed: controls seed optimization for WSOL ATA operations (default: false)
  * mint_use_seed: controls seed optimization for other mint ATA operations (default: true)

- Refactor TradeConfig to accept all parameters in new() constructor
- Remove deprecated builder methods (with_seed_config, with_wsol_ata_config)

- Add wsol_use_seed and mint_use_seed fields to SwapParams
- Remove open_seed_optimize field from SwapParams

- Update all instruction builders to use correct seed parameter:
  * Use params.wsol_use_seed for WSOL token operations
  * Use params.mint_use_seed for other token operations
  * Fix token type detection in bonk.rs, raydium_cpmm.rs, and raydium_amm_v4.rs
    to properly select wsol_use_seed when dealing with WSOL tokens

- Update wsol_manager functions to accept is_use_seed parameter:
  * handle_wsol()
  * close_wsol()
  * create_wsol_ata()
  * wrap_sol_only()
  * wrap_wsol_to_sol()

- Add wrap_wsol_to_sol() function with smart temporary account selection:
  * If source is seed-created, use normal ATA for temp account
  * If source is normal ATA, use seed ATA for temp account
  * Prevents address conflicts while optimizing performance

This provides fine-grained control over seed optimization strategies,
allowing different configurations for WSOL and other tokens.
2025-11-21 13:05:39 +08:00
home 042f7dcaad feat:优化判断买卖方向;直接用SwapParams里的参数 2025-11-20 21:21:28 +08:00
ysq c0e026a88a feat: add wrap_wsol_to_sol function with seed account optimization 2025-11-20 11:21:27 +08:00
ysq f06d6b4eee Merge commit '7fb4fd35d18bb0ec9c87d893958d4ac0c506b39e' 2025-11-18 10:08:37 +08:00
ysq b04ca6c27a feat: upgrade to v3.3.2 with explicit token_program parameter support
Major changes:
- Bump version from 3.3.1 to 3.3.2
- Add token_program field to PumpFun trading parameters
- Support explicit token_program passing for better TOKEN_PROGRAM_2022 compatibility
- Update all example code to pass token_program parameter
- Optimize token program determination logic from auto-inference to explicit parameter
2025-11-18 10:04:46 +08:00
Wood 7fb4fd35d1 feat: add Node1 minimum tip amount validation (0.002 SOL)
- Add intelligent tip amount detection for Node1
- Implement MIN_TIP_AMOUNT check in transaction builder
- Add MIN_TIP_AMOUNT.md documentation
- Optimize pumpswap instruction handling
- Update common utility functions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 23:34:28 +08:00
ysq bee7f5b78c feat: upgrade to v3.3.1 with enhanced error handling
Major changes:
- Bump version from 3.3.0 to 3.3.1
- Update GasFeeStrategy API with min/max data size parameters
- Enhance trade return values with Optional<anyhow::Error> in buy/sell/sell_percent methods
- Fix PumpFun Mayhem mode fee recipient constant bug
- Standardize gas fee strategy parameters across all examples
- Update all examples to handle new triple return value (bool, Signature, Option<Error>)
2025-11-16 23:46:58 +08:00
ysq 5c99a31179 feat: add TOKEN_PROGRAM_2022 support 2025-11-14 00:04:44 +08:00
Wood 71964eeced Merge branch 'main' of github.com:0xfnzero/sol-trade-sdk 2025-11-12 22:00:53 +08:00
Wood 0f87db6e8c update fee strategy 2025-11-12 22:00:13 +08:00
ysq bfb2a3e35a Merge commit '1be1674bf3d1ca4e1e77a7879f2991aeae53b009' 2025-11-10 16:38:29 +08:00
ysq 4cee5e6a06 feat: add support for pump mayhem mode 2025-11-10 15:30:24 +08:00
Wood 1be1674bf3 update gas fee strategy support data size limit settings 2025-11-09 21:20:55 +08:00
ysq 4f315187f3 feat: upgrade to v3.2.1 2025-11-07 17:04:36 +08:00
ysq c5a55b1c14 feat: refactor seed optimization to global configuration in v3.2.0
- Remove open_seed_optimize parameter from TradeBuyParams and TradeSellParams structs
- Add global use_seed_optimize configuration in TradeConfig with default value true
- Add create_wsol_ata_on_startup configuration in TradeConfig with default value true
- Implement automatic WSOL ATA creation and verification on SDK initialization
- Add with_wsol_ata_config() builder method to TradeConfig for custom WSOL settings
- Update all examples to remove open_seed_optimize parameter usage
- Update documentation (README, TRADING_PARAMETERS) to reflect new configuration approach
- Upgrade package version from 3.1.7 to 3.2.0

Breaking Changes:
- open_seed_optimize parameter removed from trade parameters (now global setting)
- Seed optimization is now enabled by default for all operations
2025-11-07 16:57:28 +08:00
ysq 9824576164 feat: upgrade to v3.1.6 2025-11-06 10:02:17 +08:00
ysq 06e36584f7 chore: update LP fee basis points from 20 to 25 2025-10-30 22:29:06 +08:00
ysq d5834e056f feat: add transaction simulation support and close_mint_token_ata parameter
- Add `simulate` parameter to TradeBuyParams and TradeSellParams for transaction simulation
- Add `close_mint_token_ata` parameter to TradeSellParams for closing mint token ATA
- Implement simulate_transaction function to validate transactions without blockchain submission
- Update all examples to include new parameters (simulate: false, close_mint_token_ata: false)
- Add comprehensive documentation for transaction simulation feature
- Show detailed simulation output including logs, compute units, and errors
- Print timing metrics in English for better international compatibility
2025-10-30 22:11:55 +08:00
ysq 11383a0492 feat: add close_mint_token_ata support for sell transactions 2025-10-26 23:55:28 +08:00
ysq d843f978af feat: upgrade to v3.1.3 2025-10-23 00:32:21 +08:00
Wood 9aaf52b22f Merge branch 'main' of github.com:0xfnzero/sol-trade-sdk 2025-10-14 17:33:41 +08:00
Wood 2eea6d25e1 fix build errors for syscall_bypass.rs 2025-10-14 17:33:13 +08:00
ysq 86d64811ad feat: require durable_nonce for multiple swqos transactions 2025-10-12 20:30:33 +08:00
tommggo c3852ccb7a Merge branch 'main' into feat/support-usdc-quote
# Conflicts:
#	examples/pumpswap_trading/src/main.rs
#	examples/raydium_cpmm_trading/src/main.rs
#	src/trading/core/executor.rs
2025-10-12 15:39:43 +08:00
tommggo 163882c7f3 feat: add USDC quote support for swap protocols 2025-10-12 12:01:21 +08:00
tommggo d567477bdb Revert "feat: swap support usdc quote"
This reverts commit 9bb08bd567.
2025-10-08 21:04:50 +08:00
tommggo 9bb08bd567 feat: swap support usdc quote 2025-10-08 20:08:19 +08:00
ysq 85154f6c01 refactor: Update GasFeeStrategy to instance-based API and update docs 2025-10-07 23:12:37 +08:00
ysq e13c891cc9 refactor: Simplify nonce management by replacing global cache with direct fetch
Remove NonceCache singleton pattern and replace with fetch_nonce_info function
that directly fetches nonce information from RPC. This simplifies the API by
eliminating cache initialization and state management, making it easier for
users to manage durable nonces.
2025-10-07 21:20:00 +08:00
ysq 2d9976368b refactor: Replace global address lookup table cache with direct fetch approach
Replace the global AddressLookupTableCache with a direct fetch function to simplify address lookup table management. This change improves code maintainability by removing global state and makes the API more explicit.

Key changes:
- Remove AddressLookupTableCache and AddressLookupManager
- Add new fetch_address_lookup_table_account function
- Update TradeBuyParams and TradeSellParams to use AddressLookupTableAccount instead of Pubkey
- Update all examples to use the new direct fetch approach
- Update documentation to reflect the simplified workflow
2025-10-07 20:56:02 +08:00
ysq 2e7b9819d3 perf: Add cross-platform architecture support and remove test code 2025-10-07 13:27:08 +08:00
Wood 657d6bc83e Fix concurrency-related memory safety issues. 2025-10-07 00:48:33 +08:00
Wood ffc71cc1d8 performance optimization 2025-10-07 00:08:41 +08:00