Skip to content

Commit

Permalink
[token-client] Make close_context_state_account and `close_record_a…
Browse files Browse the repository at this point in the history
…ccount` variable order consistent (#7174)

* rename `confidential_transfer_close_context_state` to `confidential_transfer_close_context_state_account`

* shift order of `lamport_destination_account` and `record_account_authority` in `confidential_transfer_close_record_account`
  • Loading branch information
samkim-crypto authored Aug 21, 2024
1 parent 7440e4b commit 69257a6
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
10 changes: 5 additions & 5 deletions token/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1662,19 +1662,19 @@ async fn command_transfer(
// close context state accounts
let close_context_state_signer = &[&context_state_authority];
let _ = try_join!(
token.confidential_transfer_close_context_state(
token.confidential_transfer_close_context_state_account(
&equality_proof_pubkey,
&sender,
&context_state_authority_pubkey,
close_context_state_signer
),
token.confidential_transfer_close_context_state(
token.confidential_transfer_close_context_state_account(
&ciphertext_validity_proof_pubkey,
&sender,
&context_state_authority_pubkey,
close_context_state_signer
),
token.confidential_transfer_close_context_state(
token.confidential_transfer_close_context_state_account(
&range_proof_pubkey,
&sender,
&context_state_authority_pubkey,
Expand Down Expand Up @@ -3402,13 +3402,13 @@ async fn command_deposit_withdraw_confidential_tokens(
// close context state account
let close_context_state_signer = &[&context_state_authority];
let _ = try_join!(
token.confidential_transfer_close_context_state(
token.confidential_transfer_close_context_state_account(
&equality_proof_context_state_pubkey,
&token_account_address,
&context_state_authority_pubkey,
close_context_state_signer
),
token.confidential_transfer_close_context_state(
token.confidential_transfer_close_context_state_account(
&range_proof_context_state_pubkey,
&token_account_address,
&context_state_authority_pubkey,
Expand Down
10 changes: 5 additions & 5 deletions token/client/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2355,15 +2355,15 @@ where
pub async fn confidential_transfer_close_record_account<S: Signers>(
&self,
record_account: &Pubkey,
record_authority: &Pubkey,
receiver: &Pubkey,
lamport_destination_account: &Pubkey,
record_account_authority: &Pubkey,
signing_keypairs: &S,
) -> TokenResult<T::Output> {
self.process_ixs(
&[spl_record::instruction::close_account(
record_account,
record_authority,
receiver,
record_account_authority,
lamport_destination_account,
)],
signing_keypairs,
)
Expand Down Expand Up @@ -2448,7 +2448,7 @@ where
}

/// Close a ZK Token proof program context state
pub async fn confidential_transfer_close_context_state<S: Signers>(
pub async fn confidential_transfer_close_context_state_account<S: Signers>(
&self,
context_state_account: &Pubkey,
lamport_destination_account: &Pubkey,
Expand Down
48 changes: 24 additions & 24 deletions token/program-2022-test/tests/confidential_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ async fn configure_account_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&pubkey_validity_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand Down Expand Up @@ -152,7 +152,7 @@ async fn configure_account_with_option<S: Signers>(
.await;

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&pubkey_validity_proof_context_account.pubkey(),
account,
&context_account_authority.pubkey(),
Expand Down Expand Up @@ -637,8 +637,8 @@ async fn empty_account_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&zero_ciphertext_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand Down Expand Up @@ -685,7 +685,7 @@ async fn empty_account_with_option<S: Signers>(
.await;

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&zero_ciphertext_proof_context_account.pubkey(),
account,
&context_account_authority.pubkey(),
Expand Down Expand Up @@ -1054,8 +1054,8 @@ async fn withdraw_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&equality_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
source_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand All @@ -1064,8 +1064,8 @@ async fn withdraw_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&range_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
source_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand Down Expand Up @@ -1135,7 +1135,7 @@ async fn withdraw_with_option<S: Signers>(
.await;

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&equality_proof_context_account.pubkey(),
source_account,
&context_account_authority.pubkey(),
Expand All @@ -1145,7 +1145,7 @@ async fn withdraw_with_option<S: Signers>(
.unwrap();

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&range_proof_context_account.pubkey(),
source_account,
&context_account_authority.pubkey(),
Expand Down Expand Up @@ -1426,8 +1426,8 @@ async fn confidential_transfer_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&equality_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
source_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand All @@ -1436,8 +1436,8 @@ async fn confidential_transfer_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&ciphertext_validity_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
source_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand All @@ -1446,8 +1446,8 @@ async fn confidential_transfer_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&range_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
source_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand Down Expand Up @@ -1548,7 +1548,7 @@ async fn confidential_transfer_with_option<S: Signers>(
.await;

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&equality_proof_context_account.pubkey(),
source_account,
&context_account_authority.pubkey(),
Expand All @@ -1558,7 +1558,7 @@ async fn confidential_transfer_with_option<S: Signers>(
.unwrap();

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&ciphertext_validity_proof_context_account.pubkey(),
source_account,
&context_account_authority.pubkey(),
Expand All @@ -1568,7 +1568,7 @@ async fn confidential_transfer_with_option<S: Signers>(
.unwrap();

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&range_proof_context_account.pubkey(),
source_account,
&context_account_authority.pubkey(),
Expand Down Expand Up @@ -2024,8 +2024,8 @@ async fn confidential_transfer_with_fee_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&equality_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
source_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand All @@ -2034,8 +2034,8 @@ async fn confidential_transfer_with_fee_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&transfer_amount_ciphertext_validity_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
source_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand All @@ -2044,8 +2044,8 @@ async fn confidential_transfer_with_fee_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&fee_sigma_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
source_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand All @@ -2054,8 +2054,8 @@ async fn confidential_transfer_with_fee_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&fee_ciphertext_validity_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
source_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand All @@ -2064,8 +2064,8 @@ async fn confidential_transfer_with_fee_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&range_proof_record_account.pubkey(),
&record_account_authority.pubkey(),
source_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand Down Expand Up @@ -2209,7 +2209,7 @@ async fn confidential_transfer_with_fee_with_option<S: Signers>(
.await;

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&equality_proof_context_account.pubkey(),
source_account,
&context_account_authority.pubkey(),
Expand All @@ -2219,7 +2219,7 @@ async fn confidential_transfer_with_fee_with_option<S: Signers>(
.unwrap();

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&transfer_amount_ciphertext_validity_proof_context_account.pubkey(),
source_account,
&context_account_authority.pubkey(),
Expand All @@ -2229,7 +2229,7 @@ async fn confidential_transfer_with_fee_with_option<S: Signers>(
.unwrap();

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&percentage_with_cap_proof_context_account.pubkey(),
source_account,
&context_account_authority.pubkey(),
Expand All @@ -2239,7 +2239,7 @@ async fn confidential_transfer_with_fee_with_option<S: Signers>(
.unwrap();

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&fee_ciphertext_validity_proof_context_account.pubkey(),
source_account,
&context_account_authority.pubkey(),
Expand All @@ -2249,7 +2249,7 @@ async fn confidential_transfer_with_fee_with_option<S: Signers>(
.unwrap();

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&range_proof_context_account.pubkey(),
source_account,
&context_account_authority.pubkey(),
Expand Down
8 changes: 4 additions & 4 deletions token/program-2022-test/tests/confidential_transfer_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@ async fn withdraw_withheld_tokens_from_mint_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&record_account.pubkey(),
&record_account_authority.pubkey(),
destination_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand Down Expand Up @@ -587,7 +587,7 @@ async fn withdraw_withheld_tokens_from_mint_with_option<S: Signers>(
.await;

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&context_account.pubkey(),
destination_account,
&context_account_authority.pubkey(),
Expand Down Expand Up @@ -859,8 +859,8 @@ async fn withdraw_withheld_tokens_from_accounts_with_option<S: Signers>(
token
.confidential_transfer_close_record_account(
&record_account.pubkey(),
&record_account_authority.pubkey(),
destination_account,
&record_account_authority.pubkey(),
&[&record_account_authority],
)
.await
Expand Down Expand Up @@ -913,7 +913,7 @@ async fn withdraw_withheld_tokens_from_accounts_with_option<S: Signers>(
.await;

token
.confidential_transfer_close_context_state(
.confidential_transfer_close_context_state_account(
&context_account.pubkey(),
destination_account,
&context_account_authority.pubkey(),
Expand Down

0 comments on commit 69257a6

Please sign in to comment.