Skip to main content

spl_token_client/zk_proofs/
mod.rs

1use {
2    spl_token_2022_interface::error::TokenError,
3    spl_token_confidential_transfer_proof_generation::errors::TokenProofGenerationError,
4};
5
6pub mod confidential_mint_burn;
7pub mod confidential_transfer;
8pub mod confidential_transfer_fee;
9
10pub trait IntoTokenError {
11    fn into_token_error(self) -> TokenError;
12}
13
14impl IntoTokenError for TokenProofGenerationError {
15    fn into_token_error(self) -> TokenError {
16        match self {
17            TokenProofGenerationError::ProofGeneration(_) => TokenError::ProofGeneration,
18            TokenProofGenerationError::NotEnoughFunds => TokenError::InsufficientFunds,
19            TokenProofGenerationError::IllegalAmountBitLength => TokenError::IllegalBitLength,
20            TokenProofGenerationError::FeeCalculation => TokenError::FeeCalculation,
21            TokenProofGenerationError::CiphertextExtraction => TokenError::MalformedCiphertext,
22        }
23    }
24}