Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit f2da427

Browse files
mvinesmergify[bot]
authored andcommitted
Revert "Adapt to solana-labs/solana#13355"
This reverts commit 9a383e2.
1 parent 20551f9 commit f2da427

File tree

1 file changed

+14
-29
lines changed

1 file changed

+14
-29
lines changed

associated-token-account/program/tests/functional.rs

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use solana_program::{instruction::*, program_pack::Pack, pubkey::Pubkey, system_instruction};
1+
use solana_program::{
2+
instruction::*, program_pack::Pack, pubkey::Pubkey, system_instruction, sysvar::rent::Rent,
3+
};
24
use solana_program_test::*;
35
use solana_sdk::{
46
signature::Signer,
@@ -47,13 +49,9 @@ async fn test_associated_token_address() {
4749
let associated_token_address =
4850
get_associated_token_address(&wallet_address, &token_mint_address);
4951

50-
let StartOutputs {
51-
mut banks_client,
52-
payer,
53-
recent_blockhash,
54-
rent,
55-
..
56-
} = program_test().start().await;
52+
let (mut banks_client, payer, recent_blockhash) =
53+
program_test(token_mint_address).start().await;
54+
let rent = Rent::default(); // <-- TODO: get Rent from `ProgramTest`
5755
let expected_token_account_balance = rent.minimum_balance(spl_token::state::Account::LEN);
5856

5957
// Associated account does not exist
@@ -97,13 +95,9 @@ async fn test_create_with_a_lamport() {
9795
let associated_token_address =
9896
get_associated_token_address(&wallet_address, &token_mint_address);
9997

100-
let StartOutputs {
101-
mut banks_client,
102-
payer,
103-
recent_blockhash,
104-
rent,
105-
..
106-
} = program_test().start().await;
98+
let (mut banks_client, payer, recent_blockhash) =
99+
program_test(token_mint_address).start().await;
100+
let rent = Rent::default(); // <-- TOOD: get Rent from `ProgramTest`
107101
let expected_token_account_balance = rent.minimum_balance(spl_token::state::Account::LEN);
108102

109103
// Transfer 1 lamport into `associated_token_address` before creating it
@@ -154,13 +148,9 @@ async fn test_create_with_excess_lamports() {
154148
let associated_token_address =
155149
get_associated_token_address(&wallet_address, &token_mint_address);
156150

157-
let StartOutputs {
158-
mut banks_client,
159-
payer,
160-
recent_blockhash,
161-
rent,
162-
..
163-
} = program_test().start().await;
151+
let (mut banks_client, payer, recent_blockhash) =
152+
program_test(token_mint_address).start().await;
153+
let rent = Rent::default(); // <-- TOOD: get Rent from `ProgramTest`
164154
let expected_token_account_balance = rent.minimum_balance(spl_token::state::Account::LEN);
165155

166156
// Transfer 1 lamport into `associated_token_address` before creating it
@@ -211,13 +201,8 @@ async fn test_create_account_mismatch() {
211201
let _associated_token_address =
212202
get_associated_token_address(&wallet_address, &token_mint_address);
213203

214-
let StartOutputs {
215-
mut banks_client,
216-
payer,
217-
recent_blockhash,
218-
..
219-
} = program_test().start().await;
220-
let expected_token_account_balance = rent.minimum_balance(spl_token::state::Account::LEN);
204+
let (mut banks_client, payer, recent_blockhash) =
205+
program_test(token_mint_address).start().await;
221206

222207
let mut instruction =
223208
create_associated_token_account(&payer.pubkey(), &wallet_address, &token_mint_address);

0 commit comments

Comments
 (0)