Commit Graph

319 Commits

Author SHA1 Message Date
speedlanding f10d0309ed feat(swqos): Add Speedlanding 2026-01-17 10:48:19 +08:00
vibes 7b984231a2 Fix Soyas client to match other SWQOS clients
Previously Soyas returned early on successful send without:
- Any logging
- Polling for transaction confirmation

Now aligned with other SWQOS clients (zeroslot, lightspeed, etc.):
- Proper error handling with reconnect retry
- Always poll for transaction confirmation
- Log confirmation success/failure with elapsed time

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 14:52:07 +00:00
vibes c7f694e9a0 Make use_exact_sol_amount optional with true default for PumpFun/PumpSwap
- Change use_exact_sol_amount from bool to Option<bool>
- Default to true (via unwrap_or) for PumpFun and PumpSwap DEXes
- Option is ignored for other DEXes (Raydium, Bonk, Meteora)
- Update all examples to use None (which defaults to true for applicable DEXes)
- Update README documentation

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 11:53:09 +00:00
vibes ea22d48919 Rename use_exact_in_instruction to use_exact_sol_amount
More intuitive name that better describes what the flag does.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 10:36:45 +00:00
vibes 18c769f7e3 Add use_exact_in_instruction to TradeBuyParams
Pass through the new field from TradeBuyParams to SwapParams so users
can opt-in to using buy_exact_sol_in and buy_exact_quote_in instructions.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 10:36:05 +00:00
vibes 16996b24d4 Add buy_exact_sol_in and buy_exact_quote_in instruction support
- Add BUY_EXACT_SOL_IN_DISCRIMINATOR for PumpFun
- Add BUY_EXACT_QUOTE_IN_DISCRIMINATOR for PumpSwap
- Add use_exact_in_instruction field to SwapParams
- When enabled, uses exact input instructions that spend exactly the
  specified SOL/quote amount with slippage applied to output tokens
- Defaults to false for backwards compatibility

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 10:32:56 +00:00
vibes 3146d012c7 feat: add shared infrastructure support for multi-wallet trading
Introduce TradingInfrastructure to allow multiple wallets to share the same
RPC client and SWQOS clients, reducing initialization overhead and memory usage.

Changes:
- Add InfrastructureConfig struct for wallet-independent configuration
- Add TradingInfrastructure struct to hold shared RPC/SWQOS clients
- Refactor TradingClient to use Arc<TradingInfrastructure>
- Add from_infrastructure() for fast client creation from shared infrastructure
- Add from_infrastructure_with_wsol_setup() for async WSOL ATA setup
- Maintain backwards compatibility with existing TradingClient::new() API

Benefits:
- First wallet: Full initialization (~200-500ms)
- Subsequent wallets (same config): Fast creation (~1-2ms)
- Memory: Single set of RPC/SWQOS clients shared across wallets
2026-01-05 19:40:53 +00:00
Wood 321f4c4a25 feat: optimize RPC polling and remove data size limit
Significantly reduce RPC pressure and fix MaxLoadedAccountsDataSizeExceeded errors.

Major improvements:
1. Add wait_confirmation parameter to all swqos clients
   - Skip polling entirely when wait_transaction_confirmed=false (100% RPC reduction)
   - Optimize getTransaction calls to only execute on errors or after 10s (50% reduction)
   - Update all 13 swqos client implementations

2. Remove LoadedAccountsDataSize instruction and data_size_limit parameter
   - Eliminate MaxLoadedAccountsDataSizeExceeded errors reported by users
   - Clean up gas_fee_strategy, params, and transaction builder
   - Simplify compute budget instruction generation

Results:
- Single channel: 30 RPC calls → 0-15 calls (50-100% reduction)
- Multi-channel (3x): 90 RPC calls → 0-45 calls (50-100% reduction)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 13:15:16 +08:00
matt-soyas 72be190f39 [feat: swqos] Add soyas tokyo endpoint 2025-12-26 01:25:22 +08:00
Wood 46512370ff Merge pull request #60 from matt-soyas/main
[feat: swqos] Add soyas london endpoint
2025-12-24 21:08:41 +08:00
VariantConst b57abc1a6c Update Node1's endpoint in Tokyo.
Update Node1's endpoint in Tokyo.
2025-12-24 17:58:48 +08:00
matt-soyas 8337be5a22 [feat: swqos] Add soyas london endpoint 2025-12-23 01:35:52 +08:00
Wood 2c3d617c6e feat(swqos): add SWQOS provider blacklist configuration
- Add SWQOS_BLACKLIST constant for disabling specific providers
- Add SwqosConfig::is_blacklisted() method to check blacklist status
- Skip blacklisted providers during client initialization with warning
- Remove NextBlock references from README, README_CN and examples
- NextBlock is blacklisted by default, can be enabled by removing from SWQOS_BLACKLIST
2025-12-20 16:45:29 +08:00
matt-soyas 413919340c feat(swqos): Add Soyas 2025-12-19 17:48:09 +08:00
Wood 2bd5f4f82c Merge pull request #57 from HelvetiCrypt/fix/early-exit-on-landed-failed-tx
fix: early exit when tx lands but fails on-chain
2025-12-19 17:29:47 +08:00
vibes 4da1a0e468 feat: use global BloxRoute endpoint as default
Change the default BloxRoute endpoint from germany.solana.dex.blxrbdn.com
to global.solana.dex.blxrbdn.com for better routing.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 09:03:34 +00:00
vibes f1434a82c5 fix: early exit when tx lands but fails on-chain
When using multiple SWQOS channels with durable nonce, if one channel's
transaction lands on-chain but fails (e.g., ExceededSlippage), the nonce
is consumed and other channels cannot succeed.

Previously, the SDK would wait for all channels to timeout (~15s) before
returning, and would often return a generic "timeout" error instead of
the actual on-chain error.

This fix:
- Adds `landed_on_chain` field to TaskResult to track if tx landed
- Adds `is_landed_error()` to detect on-chain failures vs timeouts
- Adds `landed_failed_flag` to ResultCollector for early exit signaling
- Returns immediately with the actual error when a tx lands but fails

This makes behavior consistent with the success case - both return
immediately once the nonce is consumed.

Benefits:
1. Get the actual error (e.g., ExceededSlippage) instead of timeout
2. Return in ~1s instead of ~15s
3. Enable faster retry logic for callers

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 08:48:54 +00:00
Wood 29842425e0 fix: 修复最低小费设置BUG 2025-12-18 16:47:59 +08:00
Wood ae2958995f fix: skip 8-byte discriminator when decoding PumpSwap pool data
Fixed a critical bug in find_by_base_mint and find_by_quote_mint functions
where pool data decoding failed because the 8-byte discriminator was not
being skipped. This caused all PumpSwapParams::from_mint_by_rpc calls to
fail with "No valid pool decoded" error.

Changes:
- Modified find_by_base_mint to skip discriminator: pool_decode(&acc.data[8..])
- Modified find_by_quote_mint to skip discriminator: pool_decode(&acc.data[8..])
- Added data length check to prevent out-of-bounds access
- Aligned with fetch_pool function which correctly uses &account.data[8..]

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 15:37:24 +08:00
abc 7c5a8b0f50 fix: correct instruction index in calculate_size function
- Fixed incorrect get() index from total_size + 1 to proper instruction index
- Use enumerate() to get correct instruction index for prefetch optimization
- Prevents array bounds errors and ensures correct next instruction prefetch

Bug: Using total_size (byte count) as array index for instruction lookup
Solution: Use enumerate() iterator index for proper instruction access
2025-12-09 23:58:26 +08:00
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