Skip to content

Commit 3a94b55

Browse files
author
tilo-14
committed
fix(tests): update pinocchio-swap tests for light-client 0.23.0 API
1 parent 40615a8 commit 3a94b55

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

pinocchio/swap/tests/test_lifecycle.rs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ mod sdk;
1414
mod shared;
1515

1616
use light_client::interface::{
17-
create_load_instructions, get_create_accounts_proof, AccountInterfaceExt,
17+
create_load_instructions, get_create_accounts_proof, AccountInterface, AccountSpec,
1818
CreateAccountsProofInput, LightProgramInterface,
1919
};
20-
use light_program_test::program_test::LightProgramTest;
2120
use light_program_test::{program_test::TestRpc, Rpc};
2221
use light_token::LIGHT_TOKEN_PROGRAM_ID;
2322

@@ -368,9 +367,11 @@ async fn test_full_lifecycle() {
368367

369368
// ==================== PHASE 9: Create SDK from Compressed State ====================
370369
let pool_interface = rpc
371-
.get_account_interface(&pool_state, &program_id)
370+
.get_account_interface(&pool_state, None)
372371
.await
373-
.expect("pool should be compressed");
372+
.expect("pool should be compressed")
373+
.value
374+
.expect("pool interface should exist");
374375
assert!(
375376
pool_interface.is_cold(),
376377
"pool_state should be cold after warp"
@@ -381,38 +382,40 @@ async fn test_full_lifecycle() {
381382

382383
// ==================== PHASE 10: Fetch and Update SDK ====================
383384
let accounts_to_fetch = swap_sdk.get_accounts_to_update(&SwapInstruction::Swap);
385+
let pubkeys: Vec<Pubkey> = accounts_to_fetch.iter().map(|a| a.pubkey()).collect();
384386
let keyed_accounts = rpc
385-
.get_multiple_account_interfaces(&accounts_to_fetch)
387+
.get_multiple_account_interfaces(pubkeys.iter().collect(), None)
386388
.await
387389
.expect("get_multiple_account_interfaces should succeed");
388390

391+
let accounts: Vec<AccountInterface> = keyed_accounts.value.into_iter().flatten().collect();
389392
swap_sdk
390-
.update(&keyed_accounts)
393+
.update(&accounts)
391394
.expect("sdk.update should succeed");
392395

393396
// ==================== PHASE 11: Build Load Instructions ====================
394397
let all_specs = swap_sdk.get_specs_for_instruction(&SwapInstruction::Swap);
395398

396399
// Also need to decompress user ATAs
397400
let user_ata_a_interface = rpc
398-
.get_ata_interface(&user.pubkey(), &mint_a)
401+
.get_associated_token_account_interface(&user.pubkey(), &mint_a, None)
399402
.await
400-
.expect("get_ata_interface for user_token_a should succeed");
403+
.expect("get_ata for user_token_a should succeed")
404+
.value
405+
.expect("user_token_a interface should exist");
401406

402407
let user_ata_b_interface = rpc
403-
.get_ata_interface(&user.pubkey(), &mint_b)
408+
.get_associated_token_account_interface(&user.pubkey(), &mint_b, None)
404409
.await
405-
.expect("get_ata_interface for user_token_b should succeed");
410+
.expect("get_ata for user_token_b should succeed")
411+
.value
412+
.expect("user_token_b interface should exist");
406413

407414
let mut all_specs_with_atas = all_specs;
408-
all_specs_with_atas.push(light_client::interface::AccountSpec::Ata(
409-
user_ata_a_interface,
410-
));
411-
all_specs_with_atas.push(light_client::interface::AccountSpec::Ata(
412-
user_ata_b_interface,
413-
));
414-
415-
let load_ixs = create_load_instructions::<LightAccountVariant, LightProgramTest>(
415+
all_specs_with_atas.push(AccountSpec::Ata(Box::new(user_ata_a_interface)));
416+
all_specs_with_atas.push(AccountSpec::Ata(Box::new(user_ata_b_interface)));
417+
418+
let load_ixs = create_load_instructions::<LightAccountVariant, _>(
416419
&all_specs_with_atas,
417420
payer.pubkey(),
418421
env.config_pda,

0 commit comments

Comments
 (0)