Skip to content

Commit

Permalink
Reapply "[token-2022] Add support for reading proofs from record acco… (
Browse files Browse the repository at this point in the history
solana-labs#7086)

Reapply "[token-2022] Add support for reading proofs from record accou… (solana-labs#7084)

This reverts commit e99e313.
  • Loading branch information
joncinque authored Jul 31, 2024
1 parent d181f74 commit 1244657
Show file tree
Hide file tree
Showing 14 changed files with 1,032 additions and 146 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion token/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ use {
},
spl_token_client::{
client::{ProgramRpcClientSendTransaction, RpcClientResponse},
proof_generation::ProofAccount,
token::{ComputeUnitLimit, ExtensionInitializationParams, Token},
},
spl_token_group_interface::state::TokenGroup,
Expand Down Expand Up @@ -3348,7 +3349,7 @@ async fn command_deposit_withdraw_confidential_tokens(
.confidential_transfer_withdraw(
&token_account_address,
&owner,
Some(&context_state_pubkey),
Some(&ProofAccount::ContextAccount(context_state_pubkey)),
amount,
decimals,
Some(withdraw_account_info),
Expand Down
3 changes: 3 additions & 0 deletions token/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ version = "0.11.0"

[dependencies]
async-trait = "0.1"
bincode = "1.3.2"
bytemuck = "1.16.3"
curve25519-dalek = "3.2.1"
futures = "0.3.30"
futures-util = "0.3"
Expand All @@ -26,6 +28,7 @@ spl-associated-token-account = { version = "4.0.0", path = "../../associated-tok
spl-memo = { version = "5.0", path = "../../memo/program", features = [
"no-entrypoint",
] }
spl-record = { version = "0.2.0", path = "../../record/program", features = ["no-entrypoint"] }
spl-token = { version = "6.0", path = "../program", features = [
"no-entrypoint",
] }
Expand Down
6 changes: 6 additions & 0 deletions token/client/src/proof_generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use {
curve25519_dalek::scalar::Scalar,
solana_sdk::pubkey::Pubkey,
spl_token_2022::{
error::TokenError,
extension::confidential_transfer::{
Expand All @@ -32,6 +33,11 @@ use {
},
};

pub enum ProofAccount {
ContextAccount(Pubkey),
RecordAccount(Pubkey, u32),
}

/// The main logic to create the five split proof data for a transfer with fee.
#[allow(clippy::too_many_arguments)]
pub fn transfer_with_fee_split_proof_data(
Expand Down
Loading

0 comments on commit 1244657

Please sign in to comment.