Skip to content

Commit

Permalink
token 2022: add support for additional signers in test init functions
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Nov 16, 2023
1 parent 64d6919 commit 6320eb8
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion token/program-2022-test/tests/program_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ impl TestContext {
mint_account: Keypair,
extension_init_params: Vec<ExtensionInitializationParams>,
freeze_authority: Option<Keypair>,
) -> TokenResult<()> {
self.init_token_with_mint_keypair_and_freeze_authority_and_additional_signers(
mint_account,
extension_init_params,
freeze_authority,
&[],
)
.await
}

pub async fn init_token_with_mint_keypair_and_freeze_authority_and_additional_signers(
&mut self,
mint_account: Keypair,
extension_init_params: Vec<ExtensionInitializationParams>,
freeze_authority: Option<Keypair>,
additional_signers: &[&Keypair],
) -> TokenResult<()> {
let payer = keypair_clone(&self.context.lock().await.payer);
let client: Arc<dyn ProgramClient<ProgramBanksClientProcessTransaction>> =
Expand Down Expand Up @@ -109,12 +125,15 @@ impl TestContext {
Arc::new(payer),
);

let mut signing_keypairs = vec![&mint_account];
signing_keypairs.extend_from_slice(additional_signers);

token
.create_mint(
&mint_authority_pubkey,
freeze_authority_pubkey.as_ref(),
extension_init_params,
&[&mint_account],
&signing_keypairs,
)
.await?;

Expand Down

0 comments on commit 6320eb8

Please sign in to comment.