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:
@@ -152,7 +152,7 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
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(PumpFunParams::from_trade(&trade_info, None)),
|
||||
lookup_table_key: Some(lookup_table_key), // you still need to update the AddressLookupTableCache
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -160,8 +160,7 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()>
|
||||
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(BonkParams::from_trade(trade_info.clone())),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -148,8 +148,7 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()>
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
@@ -169,7 +168,7 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()>
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
extension_params: Box::new(BonkParams::from_trade(trade_info.clone())),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -177,8 +176,7 @@ async fn bonk_copy_trade_with_grpc(trade_info: BonkTradeEvent) -> AnyResult<()>
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
with_tip: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult<
|
||||
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(BonkParams::from_dev_trade(trade_info.clone())),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -111,8 +111,7 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult<
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
@@ -132,7 +131,7 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult<
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount_token,
|
||||
slippage_basis_points: slippage_basis_points,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
extension_params: Box::new(BonkParams::immediate_sell(
|
||||
trade_info.base_token_program,
|
||||
trade_info.platform_config,
|
||||
@@ -145,8 +144,7 @@ async fn bonk_sniper_trade_with_shreds(trade_info: BonkTradeEvent) -> AnyResult<
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
with_tip: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
|
||||
@@ -608,7 +608,7 @@ async fn handle_buy_pumpfun(
|
||||
mint: mint_pubkey,
|
||||
sol_amount: sol_lamports,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -616,8 +616,7 @@ async fn handle_buy_pumpfun(
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: create_mint_ata,
|
||||
open_seed_optimize: use_seed,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
match client.buy(buy_params).await {
|
||||
Ok(signature) => {
|
||||
@@ -657,7 +656,7 @@ async fn handle_buy_pumpswap(
|
||||
mint: mint_pubkey,
|
||||
sol_amount: sol_lamports,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -665,8 +664,7 @@ async fn handle_buy_pumpswap(
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: create_mint_ata,
|
||||
open_seed_optimize: use_seed,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
match client.buy(buy_params).await {
|
||||
Ok(signature) => {
|
||||
@@ -705,7 +703,7 @@ async fn handle_buy_bonk(
|
||||
mint: mint_pubkey,
|
||||
sol_amount: sol_lamports,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -713,8 +711,7 @@ async fn handle_buy_bonk(
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: create_mint_ata,
|
||||
open_seed_optimize: use_seed,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
match client.buy(buy_params).await {
|
||||
Ok(signature) => {
|
||||
@@ -757,7 +754,7 @@ async fn handle_buy_raydium_v4(
|
||||
mint: mint_pubkey,
|
||||
sol_amount: sol_lamports,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -765,8 +762,7 @@ async fn handle_buy_raydium_v4(
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: create_mint_ata,
|
||||
open_seed_optimize: use_seed,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
match client.buy(buy_params).await {
|
||||
Ok(signature) => {
|
||||
@@ -809,7 +805,7 @@ async fn handle_buy_raydium_cpmm(
|
||||
mint: mint_pubkey,
|
||||
sol_amount: sol_lamports,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -817,8 +813,7 @@ async fn handle_buy_raydium_cpmm(
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: create_mint_ata,
|
||||
open_seed_optimize: use_seed,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
match client.buy(buy_params).await {
|
||||
Ok(signature) => {
|
||||
@@ -971,7 +966,7 @@ async fn handle_sell_pumpfun(
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount as u64,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
with_tip: false,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
@@ -979,8 +974,7 @@ async fn handle_sell_pumpfun(
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: use_seed,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
|
||||
match client.sell(sell_params).await {
|
||||
@@ -1023,7 +1017,7 @@ async fn handle_sell_pumpswap(
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount as u64,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
with_tip: false,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
@@ -1031,8 +1025,7 @@ async fn handle_sell_pumpswap(
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: use_seed,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
match client.sell(sell_params).await {
|
||||
Ok(signature) => {
|
||||
@@ -1074,7 +1067,7 @@ async fn handle_sell_bonk(
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount as u64,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
with_tip: false,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
@@ -1082,8 +1075,7 @@ async fn handle_sell_bonk(
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: use_seed,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
match client.sell(sell_params).await {
|
||||
Ok(signature) => {
|
||||
@@ -1128,7 +1120,7 @@ async fn handle_sell_raydium_v4(
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount as u64,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
with_tip: false,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
@@ -1136,8 +1128,7 @@ async fn handle_sell_raydium_v4(
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: use_seed,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
match client.sell(sell_params).await {
|
||||
Ok(signature) => {
|
||||
@@ -1182,7 +1173,7 @@ async fn handle_sell_raydium_cpmm(
|
||||
mint: mint_pubkey,
|
||||
token_amount: amount as u64,
|
||||
slippage_basis_points: slippage,
|
||||
recent_blockhash: recent_blockhash,
|
||||
recent_blockhash: Some(recent_blockhash),
|
||||
with_tip: false,
|
||||
extension_params: Box::new(param),
|
||||
lookup_table_key: None,
|
||||
@@ -1190,8 +1181,7 @@ async fn handle_sell_raydium_cpmm(
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: use_seed,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
match client.sell(sell_params).await {
|
||||
Ok(signature) => {
|
||||
|
||||
@@ -89,7 +89,7 @@ async fn test_middleware() -> AnyResult<()> {
|
||||
mint: mint_pubkey,
|
||||
sol_amount: buy_sol_cost,
|
||||
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_address).await?,
|
||||
),
|
||||
@@ -99,8 +99,7 @@ async fn test_middleware() -> AnyResult<()> {
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
println!("tip: This transaction will not succeed because we're using a test account. You can modify the code to initialize the payer with your own private key");
|
||||
|
||||
@@ -125,9 +125,7 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
let nonce_account_str = "use_your_nonce_account_here";
|
||||
NonceCache::get_instance().init(Some(nonce_account_str.to_string()));
|
||||
NonceCache::get_instance().fetch_nonce_info_use_rpc(&client.rpc).await?;
|
||||
let current_nonce = NonceCache::get_instance().get_nonce_info().current_nonce;
|
||||
let nonce_account = NonceCache::get_instance().get_nonce_info().nonce_account;
|
||||
println!("current_nonce: {}", current_nonce);
|
||||
let durable_nonce = NonceCache::get_durable_nonce_info();
|
||||
|
||||
// Buy tokens
|
||||
println!("Buying tokens from PumpFun...");
|
||||
@@ -137,7 +135,7 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
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(PumpFunParams::from_trade(&trade_info, None)),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -145,8 +143,7 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: nonce_account,
|
||||
current_nonce: Some(current_nonce),
|
||||
durable_nonce: Some(durable_nonce),
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
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(PumpFunParams::from_trade(&trade_info, None)),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -136,8 +136,7 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
close_wsol_ata: false,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
@@ -157,7 +156,7 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
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(PumpFunParams::from_trade(&trade_info, Some(true))),
|
||||
lookup_table_key: None,
|
||||
@@ -165,8 +164,7 @@ async fn pumpfun_copy_trade_with_grpc(trade_info: PumpFunTradeEvent) -> AnyResul
|
||||
create_wsol_ata: false,
|
||||
close_wsol_ata: false,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR
|
||||
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(PumpFunParams::from_dev_trade(&trade_info, None)),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -105,8 +105,7 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
@@ -126,7 +125,7 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR
|
||||
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(PumpFunParams::immediate_sell(trade_info.creator_vault, true)),
|
||||
lookup_table_key: None,
|
||||
@@ -134,8 +133,7 @@ async fn pumpfun_sniper_trade_with_shreds(trade_info: PumpFunTradeEvent) -> AnyR
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
|
||||
@@ -27,7 +27,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?,
|
||||
),
|
||||
@@ -37,8 +37,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
@@ -56,7 +55,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?,
|
||||
@@ -66,8 +65,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) -
|
||||
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(params.clone()),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -181,8 +181,7 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) -
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
@@ -204,7 +203,7 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) -
|
||||
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(params.clone()),
|
||||
lookup_table_key: None,
|
||||
@@ -212,8 +211,7 @@ async fn pumpswap_trade_with_grpc(mint_pubkey: Pubkey, params: PumpSwapParams) -
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent)
|
||||
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(params),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -149,8 +149,7 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent)
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
@@ -171,7 +170,7 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent)
|
||||
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(params),
|
||||
lookup_table_key: None,
|
||||
@@ -179,8 +178,7 @@ async fn raydium_amm_v4_copy_trade_with_grpc(trade_info: RaydiumAmmV4SwapEvent)
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) ->
|
||||
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(buy_params),
|
||||
lookup_table_key: None,
|
||||
wait_transaction_confirmed: true,
|
||||
@@ -165,8 +165,7 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) ->
|
||||
close_wsol_ata: true,
|
||||
create_mint_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.buy(buy_params).await?;
|
||||
|
||||
@@ -189,7 +188,7 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) ->
|
||||
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(sell_params),
|
||||
lookup_table_key: None,
|
||||
@@ -197,8 +196,7 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) ->
|
||||
create_wsol_ata: true,
|
||||
close_wsol_ata: true,
|
||||
open_seed_optimize: false,
|
||||
nonce_account: None,
|
||||
current_nonce: None,
|
||||
durable_nonce: None,
|
||||
};
|
||||
client.sell(sell_params).await?;
|
||||
|
||||
|
||||
@@ -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