refactor: simplify trading parameters API and nonce handling
- Change recent_blockhash from required to optional parameter - Replace separate nonce_account and current_nonce with unified durable_nonce - Update all examples and documentation to reflect API changes - Improve nonce cache usage pattern for better developer experience BREAKING CHANGE: TradeBuyParams and TradeSellParams API has changed - recent_blockhash is now Option<Hash> instead of Hash - nonce_account and current_nonce fields replaced with durable_nonce: Option<DurableNonceInfo>
This commit is contained in:
@@ -28,7 +28,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_amount,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
extension_params: Box::new(
|
||||
PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?,
|
||||
),
|
||||
@@ -38,8 +38,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: true, // ❗️❗️❗️❗️ open seed optimize
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
@@ -65,7 +64,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
with_tip: false,
|
||||
extension_params: Box::new(
|
||||
PumpSwapParams::from_pool_address_by_rpc(&client.rpc, &pool).await?,
|
||||
@@ -75,8 +74,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: true, // ❗️❗️❗️❗️ open seed optimize
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user