refactor: Replace global address lookup table cache with direct fetch approach

Replace the global AddressLookupTableCache with a direct fetch function to simplify address lookup table management. This change improves code maintainability by removing global state and makes the API more explicit.

Key changes:
- Remove AddressLookupTableCache and AddressLookupManager
- Add new fetch_address_lookup_table_account function
- Update TradeBuyParams and TradeSellParams to use AddressLookupTableAccount instead of Pubkey
- Update all examples to use the new direct fetch approach
- Update documentation to reflect the simplified workflow
This commit is contained in:
ysq
2025-10-07 20:56:02 +08:00
parent 2e7b9819d3
commit 2d9976368b
35 changed files with 168 additions and 308 deletions
+10 -10
View File
@@ -622,7 +622,7 @@ async fn handle_buy_pumpfun(
slippage_basis_points: slippage,
recent_blockhash: Some(recent_blockhash),
extension_params: Box::new(param),
lookup_table_key: None,
address_lookup_table_account: None,
wait_transaction_confirmed: true,
create_input_token_ata: false,
close_input_token_ata: false,
@@ -672,7 +672,7 @@ async fn handle_buy_pumpswap(
slippage_basis_points: slippage,
recent_blockhash: Some(recent_blockhash),
extension_params: Box::new(param),
lookup_table_key: None,
address_lookup_table_account: None,
wait_transaction_confirmed: true,
create_input_token_ata: true,
close_input_token_ata: false,
@@ -721,7 +721,7 @@ async fn handle_buy_bonk(
slippage_basis_points: slippage,
recent_blockhash: Some(recent_blockhash),
extension_params: Box::new(param),
lookup_table_key: None,
address_lookup_table_account: None,
wait_transaction_confirmed: true,
create_input_token_ata: true,
close_input_token_ata: false,
@@ -774,7 +774,7 @@ async fn handle_buy_raydium_v4(
slippage_basis_points: slippage,
recent_blockhash: Some(recent_blockhash),
extension_params: Box::new(param),
lookup_table_key: None,
address_lookup_table_account: None,
wait_transaction_confirmed: true,
create_input_token_ata: true,
close_input_token_ata: false,
@@ -827,7 +827,7 @@ async fn handle_buy_raydium_cpmm(
slippage_basis_points: slippage,
recent_blockhash: Some(recent_blockhash),
extension_params: Box::new(param),
lookup_table_key: None,
address_lookup_table_account: None,
wait_transaction_confirmed: true,
create_input_token_ata: true,
close_input_token_ata: false,
@@ -991,7 +991,7 @@ async fn handle_sell_pumpfun(
recent_blockhash: Some(recent_blockhash),
with_tip: false,
extension_params: Box::new(param),
lookup_table_key: None,
address_lookup_table_account: None,
wait_transaction_confirmed: true,
create_output_token_ata: true,
close_output_token_ata: false,
@@ -1044,7 +1044,7 @@ async fn handle_sell_pumpswap(
recent_blockhash: Some(recent_blockhash),
with_tip: false,
extension_params: Box::new(param),
lookup_table_key: None,
address_lookup_table_account: None,
wait_transaction_confirmed: true,
create_output_token_ata: true,
close_output_token_ata: false,
@@ -1096,7 +1096,7 @@ async fn handle_sell_bonk(
recent_blockhash: Some(recent_blockhash),
with_tip: false,
extension_params: Box::new(param),
lookup_table_key: None,
address_lookup_table_account: None,
wait_transaction_confirmed: true,
create_output_token_ata: true,
close_output_token_ata: false,
@@ -1151,7 +1151,7 @@ async fn handle_sell_raydium_v4(
recent_blockhash: Some(recent_blockhash),
with_tip: false,
extension_params: Box::new(param),
lookup_table_key: None,
address_lookup_table_account: None,
wait_transaction_confirmed: true,
create_output_token_ata: true,
close_output_token_ata: false,
@@ -1206,7 +1206,7 @@ async fn handle_sell_raydium_cpmm(
recent_blockhash: Some(recent_blockhash),
with_tip: false,
extension_params: Box::new(param),
lookup_table_key: None,
address_lookup_table_account: None,
wait_transaction_confirmed: true,
create_output_token_ata: true,
close_output_token_ata: false,