Commit Graph

551 Commits

Author SHA1 Message Date
0xfnzero 9c9ecf3e5b fix(pumpfun): prefer event creator_vault; align fees with pump-sdk
- Use protocol_params.creator_vault for buy/sell when non-default to avoid
  ConstraintSeeds (2006) when gRPC/event creator drifts from on-chain bonding curve
- Preserve event creator_vault in PumpFunParams::from_trade/from_dev_trade instead
  of always overwriting with PDA(creator)
- Fee recipient: prefer gRPC fee_recipient; else random from CURRENT_FEE_RECIPIENTS
  pool (standard) or MAYHEM pool, matching @pump-fun/pump-sdk fees.ts
- Add cold-path helpers: extend_bonding_curve_account_instruction, PUMP_BONDING_CURVE_MIN_DATA_LEN

Made-with: Cursor
2026-04-11 19:13:12 +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 8f2f99f3d9 chore: remove duplicate nodejs and python SDK subdirectories
These incomplete SDK implementations in the Rust repository were outdated
and redundant. The complete versions are maintained in separate repositories:
- sol-trade-sdk-ts (Node.js)
- sol-trade-sdk-python (Python)

🤖 Generated with [Qoder](https://qoder.com)
2026-04-10 15:37:53 +08:00
0xfnzero 971ef41fad feat: add global MEV protection and refactor TradeConfig to builder pattern
- Add `mev_protection: bool` to `TradeConfig` and `InfrastructureConfig` (default: false)
  - Astralane QUIC: switches to port 9000 (MEV-protected endpoint) when enabled
  - BlockRazor HTTP: uses `mode=sandwichMitigation` query param when enabled
  - BlockRazor gRPC: uses `mode=sandwichMitigation` when enabled
- Add `SWQOS_ENDPOINTS_ASTRALANE_QUIC_MEV` constants (port 9000) to `constants/swqos.rs`
- Fix `astralane_quic.rs` IP candidates to use the actual port from the address (supports both 7000 and 9000)
- Refactor `TradeConfig` to builder pattern via `TradeConfig::builder()`
  - Introduce `TradeConfigBuilder` with all optional fields and clear defaults
  - `TradeConfig::new()` kept as a shortcut (calls `builder().build()`) for backward compatibility
  - Remove old `with_wsol_ata_config` / `with_check_min_tip` / `with_swqos_cores_from_end` / `with_mev_protection` chain methods
- Update all 16 examples to use `TradeConfig::builder()` with commented-out options so users can discover all available settings at a glance
- Update README.md and README_CN.md code snippets to use builder pattern

🤖 Generated with [Qoder][https://qoder.com]
2026-04-08 02:13:37 +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
0xfnzero c8f9f9f6aa docs: add SDK Versions section with multi-language navigation
Add a dedicated section showing all available SDK language versions
with links to their repositories.

🤖 Generated with [Qoder](https://qoder.com)
2026-04-06 02:37:18 +08:00
0xfnzero 99846a21c2 fix(blockrazor): wrap ArcSwap in Arc for Clone and static ping task
- Store gRPC client as Arc<ArcSwap<BlockRazorGrpcClient>> so BlockRazorBackend
  can derive Clone (ArcSwap does not implement Clone).
- Cloning the outer Arc gives owned handles for tokio::spawn in start_ping_task,
  fixing E0521 (borrowed self escaping to 'static future).

Made-with: Cursor
2026-04-03 10:54:33 +08:00
Wood 062c5415c3 Merge pull request #97 from 520goodyear/main
#让SDK中打印 submit_timing 的数据( SwqosType和 提交耗时)返回给buy 和 sell 方法。
2026-04-02 20:59:31 +08:00
Admin eaa3214e4d #让SDK中打印 submit_timing 的数据( SwqosType和 提交耗时)返回给buy 和 sell 方法。
主要解决问题:
当 wait_tx_confirmed 参数为 false 时,SUBMIT_TIMEOUT_SECS 等待改为2秒,要么全部提交完成返回,要么不等待提交未返回的交易,方便快速创建交易订单。

#Let the SDK print submit_timing data (SwqosType and submission time) and return it to the buy and sell methods.

Main problems solved:

When the wait_tx_confirmed parameter is false, the SUBMIT_TIMEOUT_SECS wait is changed to 2 seconds. Either all submissions are completed and returned, or the unreturned transactions are not waited for submission, which facilitates the rapid creation of transaction orders.
2026-04-01 15:46:01 +08:00
0xfnzero ae890ad976 Add automatic gRPC reconnection for BlockRazor with zero-overhead
Implement lock-free reconnection mechanism using ArcSwap to maintain high
performance for transaction sending while providing automatic recovery
from connection failures.

Key improvements:
- Add automatic reconnection with exponential backoff (1s -> 60s max)
- Use ArcSwap for lock-free atomic reference swapping
- Zero overhead for send_transaction path: only atomic load operation
- Background health check every 30s triggers reconnection on failure
- Reconnection success resets backoff delay to 1s

This ensures transaction sending remains fast (no lock contention) while
providing automatic recovery from network issues or server restarts.

Inspired by the proven reconnection pattern in sol-parser-sdk.
2026-03-30 01:17:33 +08:00
Wood e10ee0de3b Merge pull request #94 from matt-soyas/main
Add soyas tip accounts
2026-03-26 01:00:03 +08:00
Wood 5e1fb1a66b Merge pull request #93 from HelvetiCrypt/feat/pumpswap-from-pool-data
Add PumpSwapParams::from_pool_data() to reuse decoded Pool
2026-03-26 00:59:49 +08:00
matt-soyas a5ea26afaf Add soyas tip accounts 2026-03-25 21:53:07 +08:00
vibes ee4a8f685b Fix slow getProgramAccounts: restore DataSize for both pool sizes, add 3s timeout
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 12:42:45 +00:00
vibes 322acf8baf Fix getProgramAccounts missing Token2022 pools (643 bytes vs 252)
DataSize(252) filter rejects Token2022 PumpSwap pools which are 643 bytes.
This causes find_by_mint to miss pools that already exist on-chain, leading
to unnecessary 45s+ wait loops during migration detection.

Remove the DataSize filter from find_by_base_mint and find_by_quote_mint —
the Memcmp filter on program-owned accounts is specific enough.

Also add diagnostic logging on find_by_mint failure for debugging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 12:28:23 +00:00
vibes 378b8fc324 Add PumpSwapParams::from_pool_data() to avoid redundant pool fetch
When using find_by_mint() followed by from_pool_address_by_rpc(), the pool
account is fetched twice via getAccount — once in find_by_mint (which returns
the decoded Pool) and again in from_pool_address_by_rpc.

from_pool_data() accepts a pre-decoded Pool reference and only fetches the
2 token balance RPC calls, saving 1 getAccount per trade.

from_pool_address_by_rpc() now delegates to from_pool_data() internally,
so existing callers are unaffected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:05:41 +00:00
Wood 19f11aa620 Release v4.0.2 with Astralane QUIC reliability updates.
Bump crate/docs version to 4.0.2 and add release notes covering IPv4/IPv6 address-family handling, direct-IP candidate preference, and endpoint failover rotation for more stable low-latency QUIC submission.

Made-with: Cursor
v4.0.2
2026-03-24 18:48:44 +08:00
Wood 61cea7546c Fix Astralane QUIC address-family mismatch and add endpoint failover.
Prefer IPv4 candidates (including official Astralane direct IPs), bind local QUIC socket by remote address family, and rotate reconnect attempts across candidates for higher reliability under DNS/Cloudflare variance.

Made-with: Cursor
2026-03-24 18:28:41 +08:00
Wood d52503b8de Release v4.0.1: Fix BlockRazor gRPC endpoints and set gRPC as default transport
## Changes since v4.0.0

### Bug Fixes
- Fixed BlockRazor gRPC endpoints to use correct gRPC service URLs
- Set gRPC as the default transport layer for BlockRazor with HTTP fallback

This release improves the reliability and performance of BlockRazor integration by prioritizing gRPC communication while maintaining HTTP fallback compatibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v4.0.1
2026-03-23 01:34:48 +08:00
Wood 9e53b7694c Fix BlockRazor gRPC endpoints and set gRPC as default transport
- Add SWQOS_ENDPOINTS_BLOCKRAZOR_GRPC with correct gRPC endpoints
- Add Grpc variant to SwqosTransport enum
- Add get_endpoint_with_transport() method for transport-aware endpoint selection
- Change BlockRazor default: transport=None now uses gRPC (was HTTP)
- Require explicit Some(SwqosTransport::Http) for HTTP fallback

This fixes the issue where BlockRazor was incorrectly using HTTP endpoints
when gRPC was intended. Users can now use gRPC by default or explicitly
specify HTTP transport when needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-20 01:17:06 +08:00
Wood 07e45d136f Release v4.0.0: SWQoS transport improvements and Binary-Tx response handling
Major changes:
- Switch BlockRazor default transport from gRPC to HTTP to avoid FRAME_SIZE_ERROR
  - gRPC mode still available via explicit SwqosTransport configuration
- Fix ZeroSlot Binary-Tx JSON-RPC 2.0 response parsing
  - Properly handle success responses with "result" field
  - Properly handle error responses with "error" field containing code and message
- Update version to 4.0.0
- Update README files to reflect new version

Technical details:
- BlockRazor: HTTP mode is now the default (SwqosTransport::Http or None)
- ZeroSlot: Parse JSON-RPC 2.0 format responses instead of plain text
- Proto code: Pre-generated gRPC code for BlockRazor (no protoc required)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v4.0.0
2026-03-18 21:32:23 +08:00
Wood 20d053bab3 Add gRPC support for BlockRazor with HTTP fallback (gRPC by default)
- Add BlockRazorBackend enum to support both gRPC and HTTP transport
- Default to gRPC for better performance, HTTP available via explicit selection
- Update SwqosConfig::BlockRazor to accept optional SwqosTransport parameter
- Implement keep-alive ping task for both gRPC and HTTP backends
- Follow same backend pattern as Astralane (Quic/Http) and Node1 (Quic/Http)
- Manual gRPC client implementation to avoid proto compilation issues

Usage:
- Default: BlockRazorClient::new() uses gRPC
- HTTP: BlockRazorClient::new_http() for HTTP transport
- Config: SwqosConfig::BlockRazor(token, region, url, None) for gRPC
- Config: SwqosConfig::BlockRazor(token, region, url, Some(Http)) for HTTP

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 18:01:50 +08:00
Wood 5d921f23ff Improve ZeroSlot client: add HTTP keep-alive ping and switch to Binary-Tx
- Add HTTP keep-alive ping task (30s interval) using free getHealth method
- Switch from JSON-RPC to faster Binary-Tx endpoint (/txb) for transaction submission
- Send raw binary transaction bytes directly to avoid encoding/decoding overhead
- Update response handling for Binary-Tx plain text status codes (200/403/419/500)
- Follow same keep-alive pattern as BlockRazor, Stellium, and Astralane clients

These changes reduce first-submit cold start latency and overall transaction submission time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 17:29:14 +08:00
Wood a187126554 Add 9 new Astralane tip wallets for improved routing and reduced write-lock contention
Made-with: Cursor
2026-03-18 14:40:06 +08:00
Wood 6ea8c27824 docs: sync README and README_CN version to 3.6.5
Made-with: Cursor
2026-03-17 17:51:09 +08:00
Wood 8c4e3ee0c5 Release v3.6.5: SWQOS core affinity and recommended sender thread indices
- Add TradeConfig::with_swqos_cores_from_end(bool) to use last N CPU cores for SWQOS, reducing contention with main thread and default tokio workers.
- Add recommended_sender_thread_core_indices(swqos_count) to get the same last-N core indices for with_dedicated_sender_threads (recommended combo for lower latency).
- Document core affinity and latency in async_executor and with_dedicated_sender_threads.

Made-with: Cursor
v3.6.5
2026-03-17 17:19:04 +08:00
Wood 624b1843a2 Improve SDK and SWQOS logging: alignment, errors, duration format
- Rename wait_transaction_confirmed to wait_tx_confirmed (params, lib, docs, examples)
- SDK timing: use [SDK][provider] style with fixed-width labels; add newline before block
- Move print_sdk_timing_block to common::sdk_log; unify SWQOS_LABEL_WIDTH
- SWQOS submitted/failed: aligned [Provider] labels via log_swqos_submitted/submission_failed
- Extract short error message from JSON (message/data) or quoted string; prefix with 'error: '
- Format elapsed as 'X.XXXX ms' or 'X.XXXX µs' (4 decimals, space before unit); use comma before error
- Add SwqosType::as_str() for zero-allocation log labels; only parse JSON when input starts with '{'

Made-with: Cursor
2026-03-17 13:11:33 +08:00
Wood 7d2ecd57e9 Release v3.6.4: bump version, update README (EN/CN), ensure all examples build
- Bump version to 3.6.4 in Cargo.toml
- Update version references in README.md and README_CN.md
- Add RELEASE_v3.6.4.md with English release notes
- All workspace examples verified to compile (cargo build --workspace)
- Remove RELEASE_v3.6.3.md and docs/ASYNC_EXECUTOR_REVIEW.md
- Minor updates in types, lib, transaction_builder, async_executor, executor, params

Made-with: Cursor
v3.6.4
2026-03-17 04:52:27 +08:00
Wood 667d6d2c5b Release v3.6.3: bump version, update README and add release notes
Made-with: Cursor
v3.6.3
2026-03-17 03:44:42 +08:00
Wood e957bc4bee Parallel multi-SWQoS submit: builder pool and executor tweaks
- transaction_pool: add PARALLEL_SENDER_COUNT (18), ensure prefill >= 18 so
  multi-channel build never serializes; prefill 64 with max(PREFILL, 18)
- async_executor: document that pool prefill must match sender thread count
- executor: do not sort submit_timings (avoids any extra work); comment that
  log order is completion order
- docs: add ASYNC_EXECUTOR_REVIEW.md
- remove RELEASE_NOTES_v3.6.2.md; minor example/types/lib/params updates

Made-with: Cursor
2026-03-17 03:32:59 +08:00
Wood 274636abc5 Merge pull request #91 from hookenful/style/rust-fmt
style/run rustfmt
2026-03-15 22:25:00 +08:00
hookenful 2abcf3839e style: run rustfmt 2026-03-14 18:16:55 +02:00
Wood 0ec826fcbd Merge pull request #90 from HelvetiCrypt/fix/swqos-worker-busy-spin
Fix SWQOS worker pool busy-spin causing high CPU at idle
2026-03-13 13:10:48 +08:00
vibes 6607d276db Fix SWQOS worker pool busy-spin causing 300%+ CPU at idle
The 32 worker tasks in swqos_worker_loop use yield_now().await when
the queue is empty, which busy-spins across all tokio threads. Replace
with tokio::sync::Notify so workers sleep until jobs are enqueued.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 00:37:14 +00:00
Wood d7b0985844 Release v3.6.2: Node1 QUIC, Speedlanding reliability, version bump
- Add Node1 QUIC transport (UUID auth, bincode tx, region endpoints)
- Speedlanding: ensure_connected, connect/send timeouts, lock on reconnect, SNI from endpoint host
- Bump version to 3.6.2; update README(s) and add release notes

Made-with: Cursor
v3.6.2
2026-03-12 15:40:56 +08:00
Wood 2e39649ebc chore: release v3.6.1
Made-with: Cursor
v3.6.1
2026-03-10 01:44:03 +08:00
Wood 0201d3443a chore: remove obsolete release notes (v3.4.1, v3.5.0)
Made-with: Cursor
2026-03-10 01:42:43 +08:00
Wood 9872b1b4a7 feat(swqos): Astralane QUIC region-based endpoints and endpoint selection
- Add SWQOS_ENDPOINTS_ASTRALANE_QUIC array (8 regions: ny, fr, ams, lim, sg, ams, la, lim)
- Select QUIC endpoint by region and optional custom URL in get_swqos_client (was hardcoded)
- Use primary endpoints only; avoid ams2/fr2 for lower latency
- Align with Astralane QUIC docs (port 7000, gateway.astralane.io)

Made-with: Cursor
2026-03-10 01:40:25 +08:00
Wood e16cd6620f chore: release v3.6.0
Made-with: Cursor
v3.6.0
2026-03-09 00:40:59 +08:00
Wood 9f79e865ab perf: P0/P1/P2 low-latency and maintainability improvements
P0:
- blockhash/nonce: get_transaction_blockhash returns Result; buy/sell entry validation
- Bonk sell: remove RPC get_token_balance from build path; require caller to pass input_amount
- Hot path: drop redundant dex_type/protocol_params clone; tip via sol_f64_to_lamports (no String)
- compute_budget cache uses Arc; extend_compute_budget_instructions avoids SmallVec clone

P1:
- middleware protocol_name takes &str; executor destructures result once to avoid signatures/submit_timings clone
- Error messages include dex context; params use Copy for Pubkey; pumpswap utils clone only Pool for pools[0]

P2:
- transaction_pool capacity constants; TIP_ACCOUNT_CACHE marked allow(dead_code)
- Fix error copy in raydium_amm_v4 / meteora_damm_v2 to correct protocol names

Made-with: Cursor
2026-03-08 01:05:27 +08:00
Wood e32e7ee6ab docs: creator_vault/coin_creator from events; CODE_REVIEW three-repo check
Made-with: Cursor
2026-03-07 11:45:33 +08:00
Wood 30c91a74af docs: wrap Astralane QUIC line in README for readability
Made-with: Cursor
2026-03-07 10:54:35 +08:00
Wood 6c41e1cfe6 docs: README Astralane HTTP+QUIC example, sync README_CN
Made-with: Cursor
2026-03-07 10:52:42 +08:00
Wood a003fd4d2f feat: Astralane QUIC, code review fixes, README & example updates
- Add Astralane QUIC client (astralane_quic.rs) and SwqosTransport::Quic
- README: Astralane QUIC usage, remove third-party doc links, add QUIC to examples
- Code review: API key not in logs, PumpSwap no clone, PDA Result, SELL_DISCRIMINATOR, ensure_wsol_ata refactor, tracing in astralane, only supports fix
- instruction/utils: pumpfun/pumpswap PDA & discriminator unit tests
- trading_client example: SwqosTransport, Astralane QUIC in config
- cli_trading: fix all unused variable warnings (_prefix)
- Add docs/CODE_REVIEW_REPORT.md

Made-with: Cursor
2026-03-07 10:47:31 +08:00
Wood fd5af3ab61 feat: track_volume only when cashback; PumpSwap sell cashback use quote_mint ATA; sync IDL
- Pump/PumpSwap buy: track_volume OptionBool = Some(true) only when is_cashback_coin, else Some(false)
- PumpSwap sell cashback: use get_user_volume_accumulator_quote_ata(quote_mint) instead of WSOL-only ATA
- Sync idl/pump_amm.json, idl/pump_fees.json from pump-public-docs

Made-with: Cursor
2026-03-06 16:41:29 +08: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
Wood d2ce193e2c Merge pull request #85 from hookenful/perf/serializer-coldstart-main
Perf/serializer coldstart main
2026-03-01 14:15:35 +08:00
Hookie 46564f1bb5 test(swqos): add serializer cold-start perf tests
Add manual ignored performance tests for SWQOS serializer cold start:\n- compare legacy eager zero-fill preallocation vs bounded prewarm\n- measure lazy growth amortization (first vs reused serialize)\n\nAlso fix PumpFun test fixture to include newly required SwapParams\nfields so lib tests compile when running targeted perf tests.\n\nValidation:\n- cargo test --release perf_serializer_ -- --ignored --nocapture
2026-02-28 22:58:27 +02:00