Commit Graph

27 Commits

Author SHA1 Message Date
0xfnzero 47cef59d15 fix: align PumpSwap dynamic fee parameters 2026-06-30 21:40:44 +08:00
0xfnzero 8ed2aef931 Fix trade execution correctness and release 4.0.11 2026-05-21 17:50:06 +08:00
0xfnzero f6db55c874 release: update Pump program metadata for v4.0.8 2026-05-15 01:08:33 +08:00
0xfnzero 85d2c602f3 fix(calc): return 0 for zero sell amount in slippage helper
calculate_with_slippage_sell previously fell through to the branch that
returned 1 when amount <= basis_points/10_000, which is true for amount=0
and typical bps values—yielding a bogus minimum of 1. Short-circuit on
zero input so sell quotes stay correct.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-03 17:30:09 +08:00
0xfnzero 02d939b3cf fix(pumpswap): align remaining accounts with official SDK for buyback
- Append pool-v2 in buy/sell remaining accounts only when pool coin_creator
  is not default, matching @pump-fun/pump-swap-sdk. Always appending pool-v2
  shifted buyback pubkey/ATA and caused BuybackFeeRecipientNotAuthorized (6053).

- Add coin_creator to PumpSwapParams (filled from decoded Pool / from_trade).
  Update pumpswap_trading example to pass pool_data.coin_creator.

- Document buyback fee recipient constants against GlobalConfig.buyback_fee_recipients.

- Extend PumpSwap quote math to include cashback_fee_basis_points in creator-side fees.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-03 14:50:26 +08:00
0xfnzero 4b451af5ff feat: Pump.fun mayhem_mode, Solana 3.1.12, TradeConfig builder alignment
- PumpFunParams::from_trade/from_dev_trade: add mayhem_mode Option; infer Mayhem
  via is_mayhem_fee_recipient when None (fixes fee recipient / NotAuthorized 6000
  when AMM protocol fee pubkey is used).
- Add is_mayhem_fee_recipient and is_amm_fee_recipient helpers in pumpfun utils.
- Bump solana-* crates to 3.1.12; align tonic/prost; use solana-message for
  AddressLookupTableAccount; add solana-system-interface 3.0.
- Update examples and latency script for new PumpFunParams signature.
- SWQoS and transaction builder adjustments for dependency changes.

Made-with: Cursor
2026-04-11 18:43:18 +08:00
0xfnzero 35bfa93516 fix: add slippage clamping and improve WSOL wrap logic
Changes to src/utils/calc/common.rs:
- Add MAX_SLIPPAGE_BASIS_POINTS constant (9999 = 99.99%)
- Clamp basis_points in calculate_with_slippage_buy to prevent amount doubling

Changes to src/instruction/pumpswap.rs:
- Fix WSOL wrap amount calculation for exact vs non-exact input modes
- Use input_amount for exact mode, sol_amount for non-exact mode

🤖 Generated with [Qoder][https://qoder.com]
2026-04-06 16:53:36 +08:00
hookenful 2abcf3839e style: run rustfmt 2026-03-14 18:16:55 +02:00
Wood 7e2860d8de feat: PumpSwap/PumpFun improvements, align with pump-public-docs, sync IDL
- Re-apply PumpSwap pool lookup, lib/utils/seed changes (no Fastlane)
- pump-public-docs: Mayhem fee recipient at index 11 use WSOL ATA; random mayhem fee recipients (PumpSwap + PumpFun); Pool decode 244 bytes
- Sync idl (pump.json, pump_amm.json, pump_fees.json) from pump-fun/pump-public-docs

Made-with: Cursor
2026-03-06 15:18:04 +08:00
Wood 07487c06cb Revert "feat: Fastlane SWQoS, PumpSwap pool lookup and init robustness"
This reverts commit 1142829394.
2026-03-06 11:03:49 +08:00
Wood 1142829394 feat: Fastlane SWQoS, PumpSwap pool lookup and init robustness
- swqos: add Fastlane client and endpoint/tip constants
- pumpswap: pool 244-byte DataSize, canonical PDA lookup, find_by_mint diagnostics
- lib: find_pool_by_mint generic entry; rent/SWQoS init timeouts and default rent fallback
- lib: create WSOL ATA only when SOL balance is sufficient
- utils: get_token_balance_with_options and get_payer_token_balance_with_program (seed ATA aligned)

Made-with: Cursor
2026-03-05 23:45:42 +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 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 ffc71cc1d8 performance optimization 2025-10-07 00:08:41 +08:00
ysq 30a7d570fa refactor: remove solana-streamer-sdk dependency and migrate type definitions locally
This refactoring migrates protocol-related type definitions from solana-streamer-sdk to local modules:

- Add local type files: bonk_types.rs, pumpswap_types.rs, raydium_amm_v4_types.rs, raydium_cpmm_types.rs
- Add BorshDeserialize support for all types
- Refactor BondingCurveAccount to support Borsh deserialization
- Update import paths across all protocol utility modules (bonk, pumpfun, pumpswap, raydium)
- Refactor trade parameter construction methods from event objects to individual parameters for better flexibility
- Fix nonce_cache import path to use local SolanaRpcClient
2025-10-03 17:02:37 +08:00
ysq 006686e8a3 feat: major gas fee strategy and documentation overhaul
- feat(gas): add comprehensive gas fee strategy management system
  * Implement GasFeeStrategyType with Default/LowTipHighCuPrice/HighTipLowCuPrice strategies
  * Add dynamic gas fee configuration per SWQOS service and trade type
  * Integrate arc-swap for thread-safe strategy updates

- docs: restructure documentation with dedicated guides
  * Add ADDRESS_LOOKUP_TABLE.md/CN.md for lookup table configuration
  * Add NONCE_CACHE.md/CN.md for nonce management documentation
  * Add TRADING_PARAMETERS.md/CN.md for comprehensive parameter guides
  * Simplify main README.md with focused overview

- refactor: update all examples with new gas fee strategy integration
  * Modernize 14 trading examples with consistent parameter handling
  * Improve error handling and configuration management
  * Enhance parallel trading implementation
2025-09-19 00:49:45 +08:00
ysq fad343ffbf Rollback 2025-09-17 11:14:15 +08:00
ysq c5ff7c1cbb refactor: Refactor SDK core architecture and trading parameter system
- Refactor SolanaTrade main class structure with improved modular design
- Refactor trading parameter system: BuyParams/SellParams -> InternalBuyParams/InternalSellParams
- Remove deprecated PriorityFee and related utility functions
- Add SwqosSettings to replace legacy SwqosConfig
- Add comprehensive technical documentation:
  • Address Lookup Table usage guide (EN/CN)
  • Nonce Cache mechanism documentation (EN/CN)
  • Trading Parameters documentation (EN/CN)
- Refactor all example code to adapt to new API interfaces
- Optimize public API design and code comments
- Clean up redundant utility functions and type definitions

Impact: 43 files changed, 2013 insertions(+), 1735 deletions(-)
2025-09-17 00:10:33 +08:00
ysq 40b4541036 feat: deprecate legacy utility functions and bump version to 0.6.7
- Add deprecation warnings to PumpFun and PumpSwap utility functions
- Update version from 0.6.6 to 0.6.7 in Cargo.toml and documentation
- Add .claude/ directory to .gitignore
- Mark legacy price calculation and data retrieval functions as deprecated
2025-09-11 17:17:58 +08:00
ysq 544e65318d refactor: optimize AccountMeta creation with lazy static constants
- Consolidate protocol constants to unified module
- Pre-build AccountMeta objects using once_cell::Lazy
- Reduce instruction building overhead across all DEX protocols
- Improve code maintainability and performance
2025-09-07 21:36:57 +08:00
ysq 21d6714c25 refactor: reorganize code structure and optimize modular design
- Remove src/common/address_lookup.rs and tip_cache.rs to simplify common modules
- Move protocol-specific utility functions from trading/ to instruction/utils/
- Refactor utility functions for PumpFun, PumpSwap, Raydium AMM V4, and Raydium CPMM
- Consolidate constant definitions by inlining seeds and accounts modules into respective utility files
- Update all import paths to ensure code consistency
- Optimize trading parameter construction and executor logic
- Improve address lookup cache and nonce management mechanisms
2025-09-07 19:00:08 +08:00
ysq d27a44735a feat: Add Raydium AMM V4 support and middleware system
- Add Raydium AMM V4 trading protocol support
- Implement instruction middleware system for dynamic processing
- Refactor trade executors to support middleware parameters
- Add fee calculation and slippage protection mechanisms
- Maintain backward compatibility with optional middleware
2025-08-19 18:07:21 +08:00
ysq d02d734026 refactor: improve trading params API and fix bonk calculation bug
- Bump version to 0.4.0 with breaking API changes
- Standardize dex params to Box<T> instead of Option<Box<T>>
- Add convenient factory methods for all trading params
- Fix critical bug in bonk sell calculation (virtual_base logic)
- Update documentation and examples with new API usage
- Improve ergonomics by removing manual params construction
2025-08-18 20:41:01 +08:00
ysq 57474bfa6e feat: major refactor with calculation utilities and instruction optimization
- Add comprehensive calculation utilities for all protocols (bonk, pumpfun, pumpswap, raydium)
- Refactor instruction modules to reduce code complexity and improve maintainability
- Optimize trading parameters structure and enhance common utilities
- Separate calculation logic from trading modules for better code organization
- Update dependencies and module exports
2025-08-18 18:00:14 +08:00
ysq 63244f4073 refactor: restructure trading modules and add price calculation utilities
- Remove redundant pool.rs files from trading protocols
- Consolidate protocol logic into common.rs files
- Add comprehensive price calculation utilities for all protocols
- Add decimals constants module
- Restructure utils module for better organization
- Update documentation with price utilities information

Breaking changes:
- Removed bonding_curve.rs from pumpfun module
- Consolidated trading logic across protocols
- Refactored utils module structure
2025-08-14 22:45:33 +08:00
William f4f3c0fb37 rebuild code 2025-02-21 20:47:28 +08:00
William 42b7267c2c add yellowstone grpc 2025-01-23 17:48:10 +08:00