diff --git a/README.md b/README.md index b637a89..b774840 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ let trade_config = TradeConfig::builder(rpc_url, swqos_configs, commitment) // .check_min_tip(false) // default: false - filter SWQOS below min tip // .swqos_cores_from_end(false) // default: false - bind SWQOS to last N CPU cores // .mev_protection(false) // default: false - MEV (Astralane QUIC :9000 or HTTP mev-protect / BlockRazor) - // .use_pumpfun_v2(false) // default: false - V1 (18 accounts); set true for V2 (27 accounts, quote_mint) when PumpFun deploys V2 + // .use_pumpfun_v2(true) // PumpFun V2 (27 accounts, quote_mint); required for USDC-paired PumpFun coins .build(); // Create TradingClient @@ -376,7 +376,7 @@ PumpFun has two instruction sets for bonding-curve trading: **How to enable V2:** -**Method 1 — Global runtime flag** (recommended when PumpFun officially deploys V2 on mainnet): +**Method 1 — Global runtime flag** (recommended for `TradingClient`; required for USDC-paired coins): ```rust let trade_config = TradeConfig::builder(rpc_url, swqos_configs, commitment) @@ -384,7 +384,9 @@ let trade_config = TradeConfig::builder(rpc_url, swqos_configs, commitment) .build(); ``` -**Method 2 — Per-trade via `quote_mint`** (for USDC-paired coins or mixed V1/V2 scenarios): +**Method 2 — Set the quote mint on `PumpFunParams`**: + +When using the high-level `TradingClient`, keep `.use_pumpfun_v2(true)` enabled in `TradeConfig` and set `quote_mint` on the PumpFun params to select the pair: ```rust use sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT; @@ -399,6 +401,8 @@ let params = PumpFunParams::from_trade(/* ... */) .with_quote_mint(USDC_TOKEN_ACCOUNT); ``` +`with_quote_mint(...)` also marks the params as V2-capable for lower-level instruction builders, but the high-level `TradingClient` uses the client-level `use_pumpfun_v2` runtime flag when choosing V1 vs V2. + > **Note**: V2 transactions with ATA creation + durable nonce may exceed `PACKET_DATA_SIZE`. Enable an Address Lookup Table (`address_lookup_table_account`) when using V2. #### PumpSwap: coin_creator_vault from events (no RPC) diff --git a/README_CN.md b/README_CN.md index a8797e1..b9333a7 100755 --- a/README_CN.md +++ b/README_CN.md @@ -152,6 +152,7 @@ let trade_config = TradeConfig::builder(rpc_url, swqos_configs, commitment) // .check_min_tip(false) // 默认: false - 过滤低于最低小费的 SWQOS // .swqos_cores_from_end(false) // 默认: false - 将 SWQOS 绑定到末尾 N 个 CPU 核心 // .mev_protection(false) // 默认: false - MEV(Astralane QUIC :9000 或 HTTP mev-protect / BlockRazor) + // .use_pumpfun_v2(true) // PumpFun V2(27 个账户,quote_mint);USDC 配对 PumpFun 币必须开启 .build(); // 创建 TradingClient @@ -372,7 +373,15 @@ Pump.fun 已升级 Bonding Curve 合约,推出**统一化 v2 指令**,通过 **使用方式:** -设置 `PumpFunParams` 的 `quote_mint` 即可,SDK 会自动切换到 v2 discriminator 和新账户布局: +高层 `TradingClient` 需要先在 `TradeConfig` 开启 PumpFun V2;USDC 配对币必须开启: + +```rust +let trade_config = TradeConfig::builder(rpc_url, swqos_configs, commitment) + .use_pumpfun_v2(true) + .build(); +``` + +然后在 `PumpFunParams` 设置 `quote_mint` 来选择 SOL/USDC 配对: ```rust use sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT; @@ -391,6 +400,8 @@ client.buy(buy_params).await?; client.sell(sell_params).await?; ``` +`with_quote_mint(...)` 会把参数标记为可使用 V2,底层 instruction builder 可据此走 V2;但高层 `TradingClient` 选择 V1/V2 时使用的是 client 级别的 `use_pumpfun_v2` 运行时开关。 + | quote_mint | use_v2_ix | 实际使用的指令 | 说明 | |-----------|-------------|---------|------| | 未设置(默认) | `false` | 旧版 `buy`/`sell`/`buy_exact_sol_in` | 向后兼容,仅 SOL |