Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,8 @@ async fn test_compressible_account_with_custom_rent_payer_close_with_compression
token_account_pubkey,
context.mint_pubkey,
context.owner_keypair.pubkey(),
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.unwrap();
// Verify pool PDA balance decreased by only the rent-exempt amount (not the additional rent)
Expand Down
8 changes: 4 additions & 4 deletions program-tests/compressed-token-test/tests/ctoken/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ async fn test_create_compressible_token_account_failing() {
token_account_pubkey.pubkey(),
context.mint_pubkey,
context.owner_keypair.pubkey(),
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.unwrap();

Expand Down Expand Up @@ -380,8 +380,8 @@ async fn test_create_compressible_token_account_failing() {
token_account_pubkey,
context.mint_pubkey,
context.owner_keypair.pubkey(),
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.unwrap();

Expand Down Expand Up @@ -430,8 +430,8 @@ async fn test_create_compressible_token_account_failing() {
context.token_account_keypair.pubkey(),
context.mint_pubkey,
context.owner_keypair.pubkey(),
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.unwrap();

Expand Down Expand Up @@ -501,8 +501,8 @@ async fn test_create_compressible_token_account_failing() {
context.token_account_keypair.pubkey(),
context.mint_pubkey,
context.owner_keypair.pubkey(),
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.unwrap();

Expand Down
30 changes: 15 additions & 15 deletions program-tests/compressed-token-test/tests/ctoken/create_ata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ async fn test_create_ata_failing() {
poor_payer_pubkey,
new_owner.pubkey(),
context.mint_pubkey,
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.unwrap();

Expand Down Expand Up @@ -465,8 +465,8 @@ async fn test_create_ata_failing() {
payer_pubkey,
context.owner_keypair.pubkey(),
context.mint_pubkey,
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.unwrap();

Expand Down Expand Up @@ -534,8 +534,8 @@ async fn test_create_ata_failing() {
payer_pubkey,
context.owner_keypair.pubkey(),
context.mint_pubkey,
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.unwrap();

Expand Down Expand Up @@ -649,10 +649,10 @@ async fn test_ata_multiple_owners_same_mint() {
token_account_version: light_ctoken_types::state::TokenDataVersion::ShaFlat,
};

let create_ata_ix1 =
CreateAssociatedTokenAccount::new(payer_pubkey, owner1, mint, compressible_params.clone())
.instruction()
.unwrap();
let create_ata_ix1 = CreateAssociatedTokenAccount::new(payer_pubkey, owner1, mint)
.with_compressible(compressible_params.clone())
.instruction()
.unwrap();

context
.rpc
Expand All @@ -671,10 +671,10 @@ async fn test_ata_multiple_owners_same_mint() {
)
.await;

let create_ata_ix2 =
CreateAssociatedTokenAccount::new(payer_pubkey, owner2, mint, compressible_params.clone())
.instruction()
.unwrap();
let create_ata_ix2 = CreateAssociatedTokenAccount::new(payer_pubkey, owner2, mint)
.with_compressible(compressible_params.clone())
.instruction()
.unwrap();

context
.rpc
Expand All @@ -693,10 +693,10 @@ async fn test_ata_multiple_owners_same_mint() {
)
.await;

let create_ata_ix3 =
CreateAssociatedTokenAccount::new(payer_pubkey, owner3, mint, compressible_params)
.instruction()
.unwrap();
let create_ata_ix3 = CreateAssociatedTokenAccount::new(payer_pubkey, owner3, mint)
.with_compressible(compressible_params)
.instruction()
.unwrap();

context
.rpc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ async fn create_and_assert_ata2(
token_account_version: compressible.account_version,
};

let mut builder = CreateAssociatedTokenAccount::new(
payer_pubkey,
owner_pubkey,
context.mint_pubkey,
compressible_params,
);
let mut builder =
CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey)
.with_compressible(compressible_params);

if idempotent {
builder = builder.idempotent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ async fn test_compressible_account_with_compression_authority_lifecycle() {
token_account_pubkey,
context.mint_pubkey,
context.owner_keypair.pubkey(),
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.map_err(|e| {
RpcError::AssertRpcError(format!(
Expand Down
28 changes: 10 additions & 18 deletions program-tests/compressed-token-test/tests/ctoken/functional_ata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ async fn test_associated_token_account_operations() {
payer_pubkey,
compressible_owner_pubkey,
context.mint_pubkey,
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.unwrap();

Expand Down Expand Up @@ -182,14 +182,10 @@ async fn test_create_ata_idempotent() {
.await;

// Attempt to create the same ATA again using non-idempotent instruction (should fail)
let instruction = CreateAssociatedTokenAccount::new(
payer_pubkey,
owner_pubkey,
context.mint_pubkey,
CompressibleParams::default(),
)
.instruction()
.unwrap();
let instruction =
CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey)
.instruction()
.unwrap();

let result = context
.rpc
Expand All @@ -203,15 +199,11 @@ async fn test_create_ata_idempotent() {
);

// Now try with idempotent instruction (should succeed)
let instruction = CreateAssociatedTokenAccount::new(
payer_pubkey,
owner_pubkey,
context.mint_pubkey,
CompressibleParams::default(),
)
.idempotent()
.instruction()
.unwrap();
let instruction =
CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey)
.idempotent()
.instruction()
.unwrap();

context
.rpc
Expand Down
22 changes: 8 additions & 14 deletions program-tests/compressed-token-test/tests/ctoken/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ pub async fn create_and_assert_token_account(
token_account_pubkey,
context.mint_pubkey,
context.owner_keypair.pubkey(),
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.unwrap();

Expand Down Expand Up @@ -157,8 +157,8 @@ pub async fn create_and_assert_token_account_fails(
token_account_pubkey,
context.mint_pubkey,
context.owner_keypair.pubkey(),
compressible_params,
)
.with_compressible(compressible_params)
.instruction()
.unwrap();

Expand Down Expand Up @@ -424,12 +424,9 @@ pub async fn create_and_assert_ata(
token_account_version: compressible.account_version,
};

let mut builder = CreateAssociatedTokenAccount::new(
payer_pubkey,
owner_pubkey,
context.mint_pubkey,
compressible_params,
);
let mut builder =
CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey)
.with_compressible(compressible_params);

if idempotent {
builder = builder.idempotent();
Expand Down Expand Up @@ -500,12 +497,9 @@ pub async fn create_and_assert_ata_fails(
CompressibleParams::default()
};

let mut builder = CreateAssociatedTokenAccount::new(
payer_pubkey,
owner_pubkey,
context.mint_pubkey,
compressible_params,
);
let mut builder =
CreateAssociatedTokenAccount::new(payer_pubkey, owner_pubkey, context.mint_pubkey)
.with_compressible(compressible_params);

if idempotent {
builder = builder.idempotent();
Expand Down
13 changes: 5 additions & 8 deletions program-tests/compressed-token-test/tests/mint/edge_cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,11 @@ async fn functional_all_in_one_instruction() {
token_account_version: TokenDataVersion::ShaFlat,
};

let create_compressible_ata_ix = CreateAssociatedTokenAccount::new(
payer.pubkey(),
recipient.pubkey(),
spl_mint_pda,
compressible_params,
)
.instruction()
.unwrap();
let create_compressible_ata_ix =
CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda)
.with_compressible(compressible_params)
.instruction()
.unwrap();

rpc.create_and_send_transaction(&[create_compressible_ata_ix], &payer.pubkey(), &[&payer])
.await
Expand Down
37 changes: 13 additions & 24 deletions program-tests/compressed-token-test/tests/mint/failing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,14 +402,10 @@ async fn functional_and_failing_tests() {
// Create a ctoken account first
let recipient = Keypair::new();

let create_ata_ix = CreateAssociatedTokenAccount::new(
payer.pubkey(),
recipient.pubkey(),
spl_mint_pda,
CompressibleParams::default(),
)
.instruction()
.unwrap();
let create_ata_ix =
CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda)
.instruction()
.unwrap();

rpc.create_and_send_transaction(&[create_ata_ix], &payer.pubkey(), &[&payer])
.await
Expand Down Expand Up @@ -460,14 +456,10 @@ async fn functional_and_failing_tests() {
// Create a new recipient for successful mint
let recipient2 = Keypair::new();

let create_ata_ix2 = CreateAssociatedTokenAccount::new(
payer.pubkey(),
recipient2.pubkey(),
spl_mint_pda,
CompressibleParams::default(),
)
.instruction()
.unwrap();
let create_ata_ix2 =
CreateAssociatedTokenAccount::new(payer.pubkey(), recipient2.pubkey(), spl_mint_pda)
.instruction()
.unwrap();

rpc.create_and_send_transaction(&[create_ata_ix2], &payer.pubkey(), &[&payer])
.await
Expand Down Expand Up @@ -877,14 +869,11 @@ async fn test_mint_to_ctoken_max_top_up_exceeded() {
token_account_version: TokenDataVersion::ShaFlat,
};

let create_ata_ix = CreateAssociatedTokenAccount::new(
payer.pubkey(),
recipient.pubkey(),
spl_mint_pda,
compressible_params,
)
.instruction()
.unwrap();
let create_ata_ix =
CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda)
.with_compressible(compressible_params)
.instruction()
.unwrap();

rpc.create_and_send_transaction(&[create_ata_ix], &payer.pubkey(), &[&payer])
.await
Expand Down
13 changes: 5 additions & 8 deletions program-tests/compressed-token-test/tests/mint/functional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,14 +712,11 @@ async fn test_ctoken_transfer() {
token_account_version: light_ctoken_types::state::TokenDataVersion::ShaFlat,
};

let create_ata_instruction = CreateAssociatedTokenAccount::new(
payer.pubkey(),
recipient_keypair.pubkey(),
spl_mint_pda,
compressible_params,
)
.instruction()
.unwrap();
let create_ata_instruction =
CreateAssociatedTokenAccount::new(payer.pubkey(), recipient_keypair.pubkey(), spl_mint_pda)
.with_compressible(compressible_params)
.instruction()
.unwrap();
rpc.create_and_send_transaction(&[create_ata_instruction], &payer.pubkey(), &[&payer])
.await
.unwrap();
Expand Down
14 changes: 5 additions & 9 deletions program-tests/compressed-token-test/tests/mint/random.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use light_compressed_token_sdk::{
compressed_token::create_compressed_mint::{
derive_compressed_mint_address, find_spl_mint_address,
},
ctoken::{CompressibleParams, CreateAssociatedTokenAccount},
ctoken::CreateAssociatedTokenAccount,
};
use light_ctoken_types::state::{extensions::AdditionalMetadata, CompressedMint};
use light_program_test::{LightProgramTest, ProgramTestConfig};
Expand Down Expand Up @@ -130,14 +130,10 @@ async fn test_random_mint_action() {

for _ in 0..5 {
let recipient = Keypair::new();
let create_ata_ix = CreateAssociatedTokenAccount::new(
payer.pubkey(),
recipient.pubkey(),
spl_mint_pda,
CompressibleParams::default(),
)
.instruction()
.unwrap();
let create_ata_ix =
CreateAssociatedTokenAccount::new(payer.pubkey(), recipient.pubkey(), spl_mint_pda)
.instruction()
.unwrap();

rpc.create_and_send_transaction(&[create_ata_ix], &payer.pubkey(), &[&payer])
.await
Expand Down
Loading