Skip to content

Commit

Permalink
add support for ConfigureAccountWithRegistry in the token-client
Browse files Browse the repository at this point in the history
  • Loading branch information
samkim-crypto committed Oct 17, 2024
1 parent 3104459 commit 1a8dc29
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions token/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ solana-rpc-client = "2.0.3"
solana-rpc-client-api = "2.0.3"
solana-sdk = "2.0.3"
spl-associated-token-account-client = { version = "1.0.0", path = "../../associated-token-account/client" }
spl-elgamal-registry = { version = "0.1.0", path = "../confidential-transfer/elgamal-registry"}
spl-memo = { version = "5.0", path = "../../memo/program", features = [
"no-entrypoint",
] }
spl-record = { version = "0.2.1", path = "../../record/program", features = ["no-entrypoint"] }
spl-token = { version = "6.0", path = "../program", features = [
"no-entrypoint",
] }
spl-token-confidential-transfer-proof-extraction = { version = "0.1.0", path = "../confidential-transfer/proof-extraction" }
spl-token-confidential-transfer-proof-generation = { version = "0.1.0", path = "../confidential-transfer/proof-generation" }
spl-token-2022 = { version = "5.0.2", path = "../program-2022" }
spl-token-group-interface = { version = "0.4.2", path = "../../token-group/interface" }
Expand Down
27 changes: 26 additions & 1 deletion token/client/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ use {
BaseStateWithExtensions, Extension, ExtensionType, StateWithExtensionsOwned,
},
instruction, offchain,
proof::{zk_proof_type_to_instruction, ProofData, ProofLocation},
solana_zk_sdk::{
encryption::{
auth_encryption::AeKey,
Expand All @@ -63,6 +62,9 @@ use {
},
state::{Account, AccountState, Mint, Multisig},
},
spl_token_confidential_transfer_proof_extraction::{
zk_proof_type_to_instruction, ProofData, ProofLocation,
},
spl_token_confidential_transfer_proof_generation::{
transfer::TransferProofData, transfer_with_fee::TransferWithFeeProofData,
withdraw::WithdrawProofData,
Expand Down Expand Up @@ -1972,6 +1974,29 @@ where
.await
}

/// Configures confidential transfers for a token account using an ElGamal
/// registry account
pub async fn confidential_transfer_configure_token_account_with_registry(
&self,
account: &Pubkey,
elgamal_registry_account: &Pubkey,
authority: &Pubkey,
) -> TokenResult<T::Output> {
self.process_ixs::<[&dyn Signer; 0]>(
&[
confidential_transfer::instruction::configure_account_with_registry(
&self.program_id,
account,
&self.pubkey,
elgamal_registry_account,
authority,
)?,
],
&[],
)
.await
}

/// Approves a token account for confidential transfers
pub async fn confidential_transfer_approve_account<S: Signers>(
&self,
Expand Down

0 comments on commit 1a8dc29

Please sign in to comment.