Skip to content

Commit

Permalink
update token-cli for the updated syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
samkim-crypto committed Aug 21, 2024
1 parent ffbaacc commit 0b910c7
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions token/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1604,27 +1604,32 @@ async fn command_transfer(
.unwrap();

// setup proofs
let create_range_proof_context_signer = &[&range_proof_context_state_account];
let create_equality_proof_context_signer = &[&equality_proof_context_state_account];
let create_ciphertext_validity_proof_context_signer =
&[&ciphertext_validity_proof_context_state_account];

let _ = try_join!(
token.confidential_transfer_create_context_state_account(
&range_proof_pubkey,
&context_state_authority_pubkey,
&range_proof_data,
true,
&range_proof_context_state_account,
create_range_proof_context_signer
),
token.confidential_transfer_create_context_state_account(
&equality_proof_pubkey,
&context_state_authority_pubkey,
&equality_proof_data,
false,
&equality_proof_context_state_account,
create_equality_proof_context_signer
),
token.confidential_transfer_create_context_state_account(
&ciphertext_validity_proof_pubkey,
&context_state_authority_pubkey,
&ciphertext_validity_proof_data,
false,
&ciphertext_validity_proof_context_state_account,
create_ciphertext_validity_proof_context_signer
)
)?;

Expand Down Expand Up @@ -1655,24 +1660,25 @@ async fn command_transfer(
.await?;

// close context state accounts
let close_context_state_signer = &[&context_state_authority];
let _ = try_join!(
token.confidential_transfer_close_context_state(
&equality_proof_pubkey,
&sender,
&context_state_authority_pubkey,
&context_state_authority,
close_context_state_signer
),
token.confidential_transfer_close_context_state(
&ciphertext_validity_proof_pubkey,
&sender,
&context_state_authority_pubkey,
&context_state_authority,
close_context_state_signer
),
token.confidential_transfer_close_context_state(
&range_proof_pubkey,
&sender,
&context_state_authority_pubkey,
&context_state_authority,
close_context_state_signer
),
)?;

Expand Down Expand Up @@ -3353,21 +3359,23 @@ async fn command_deposit_withdraw_confidential_tokens(

// set up context state accounts
let context_state_authority_pubkey = context_state_authority.pubkey();
let create_equality_proof_signer = &[&equality_proof_context_state_keypair];
let create_range_proof_signer = &[&range_proof_context_state_keypair];

let _ = try_join!(
token.confidential_transfer_create_context_state_account(
&equality_proof_context_state_pubkey,
&context_state_authority_pubkey,
&equality_proof_data,
false,
&equality_proof_context_state_keypair,
create_equality_proof_signer
),
token.confidential_transfer_create_context_state_account(
&range_proof_context_state_pubkey,
&context_state_authority_pubkey,
&range_proof_data,
true,
&range_proof_context_state_keypair,
create_range_proof_signer,
)
)?;

Expand All @@ -3392,18 +3400,19 @@ async fn command_deposit_withdraw_confidential_tokens(
.await?;

// close context state account
let close_context_state_signer = &[&context_state_authority];
let _ = try_join!(
token.confidential_transfer_close_context_state(
&equality_proof_context_state_pubkey,
&token_account_address,
&context_state_authority_pubkey,
&context_state_authority,
close_context_state_signer
),
token.confidential_transfer_close_context_state(
&range_proof_context_state_pubkey,
&token_account_address,
&context_state_authority_pubkey,
&context_state_authority,
close_context_state_signer
)
)?;

Expand Down

0 comments on commit 0b910c7

Please sign in to comment.