Commit Graph

460 Commits

Author SHA1 Message Date
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
Wood e12c45cc4c Merge pull request #67 from HelvetiCrypt/feat/shared-infrastructure
Add shared_infrastructure example and update documentation
2026-01-06 15:01:55 +08:00
vibes d78856718e Add shared_infrastructure example and update docs
- Add new `shared_infrastructure` example demonstrating multi-wallet
  resource sharing pattern
- Update `trading_client` example to show both initialization methods
- Update README with:
  - New feature: "Shared Infrastructure" in features list
  - Both methods (simple and shared) in TradingClient creation section
  - New example in examples summary table
- Add `shared_infrastructure` to workspace members

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 21:26:21 +00:00
Wood ab74f05fe9 Merge pull request #66 from HelvetiCrypt/feat/shared-infrastructure
feat: add shared infrastructure support for multi-wallet trading
2026-01-06 05:11:09 +08: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 285a5b5a7b Update README_CN.md 2026-01-05 01:25:18 +08:00
Wood 518b4c706d Update README.md 2026-01-05 01:24:28 +08:00
Wood b17f1157b6 docs: update gas fee strategy examples to remove data_size_limit parameters
Remove obsolete data_size_limit parameters from all gas fee strategy function calls in documentation and examples, following the recent API changes.

Changes:
- Update README.md and README_CN.md gas fee strategy examples
- Update all example files using set_global_fee_strategy (from 8 params to 6 params)
- Update gas_fee_strategy example for set_normal_fee_strategy and set_high_low_fee_strategy
- Remove the last two parameters (256 * 1024, 0) from all calls

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-28 16:16:10 +08: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
Wood 710de8a92a Merge pull request #64 from matt-soyas/main
[feat: swqos] Add soyas tokyo endpoint
2025-12-26 01:45:06 +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
Wood e7fcee9fbb Merge pull request #62 from VariantConst/patch-4
Update Node1's endpoint in Tokyo.
2025-12-24 21:08:12 +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
Wood 1f5a8612cb Merge pull request #59 from matt-soyas/main
feat(swqos): Add Soyas
2025-12-20 13:02:57 +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
Wood 4a6f75e307 Merge pull request #58 from HelvetiCrypt/fix/bloxroute-global-endpoint
feat: use global BloxRoute endpoint as default
2025-12-19 17:19:08 +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
Wood 101c5ec07d Merge pull request #56 from IAliceBobI/main
fix: correct instruction index in calculate_size function
2025-12-11 13:48: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 aa0a452bb2 docs: update README to use TradingClient instead of SolanaTrade
- Replace SolanaTrade with TradingClient in both README.md and README_CN.md
- Update code examples to use TradingClient::new()
- Update usage examples summary table
2025-12-08 03:11:46 +08:00
Wood 5982f51a40 docs: Update README examples to use DexParamEnum API and add new TradeBuyParams fields 2025-12-08 02:12:46 +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
Wood 130cfabe9b Merge pull request #54 from VariantConst/patch-2
Modify SWQoS endpoints
2025-12-05 19:45:24 +08:00
VariantConst 70d79ff993 Modify SWQoS endpoints
Updated SWQoS endpoints for 0slot and node1.
2025-12-05 19:37:45 +08:00
sgxiang 59377aed23 Merge pull request #52 from HelvetiCrypt/main
feat(swqos): add Lightspeed (Solana Vibe Station) support
2025-12-03 23:40:42 +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
ysq 6e5362fdd0 chore: bump version to 3.3.5 and update examples with optimized token address functions 2025-11-25 22:18:57 +08:00
sgxiang d0ae515af1 Merge pull request #51 from yangdc930811/main
feat:优化判断买卖方向;直接用SwapParams里的参数
2025-11-25 21:52:38 +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