Forráskód Böngészése

[clap-v3-utils] Update dependency from zk-token-sdk to zk-sdk (#6985)

samkim-crypto 4 hónapja
szülő
commit
aefebdfc95
4 módosított fájl, 15 hozzáadás és 4 törlés
  1. 1 1
      Cargo.lock
  2. 5 1
      clap-v3-utils/Cargo.toml
  3. 8 1
      clap-v3-utils/src/keypair.rs
  4. 1 1
      zk-keygen/Cargo.toml

+ 1 - 1
Cargo.lock

@@ -7462,7 +7462,7 @@ dependencies = [
  "solana-signature",
  "solana-signer",
  "solana-system-interface",
- "solana-zk-token-sdk",
+ "solana-zk-sdk 3.0.0",
  "tempfile",
  "thiserror 2.0.12",
  "tiny-bip39",

+ 5 - 1
clap-v3-utils/Cargo.toml

@@ -15,6 +15,10 @@ targets = ["x86_64-unknown-linux-gnu"]
 [lib]
 name = "solana_clap_v3_utils"
 
+[features]
+default = []
+elgamal = ["dep:solana-zk-sdk"]
+
 [dependencies]
 chrono = { workspace = true, features = ["default"] }
 clap = { version = "3.2.23", features = ["cargo"] }
@@ -35,7 +39,7 @@ solana-seed-derivable = { workspace = true }
 solana-seed-phrase = { workspace = true }
 solana-signature = { workspace = true }
 solana-signer = { workspace = true }
-solana-zk-token-sdk = { workspace = true }
+solana-zk-sdk = { workspace = true, optional = true }
 thiserror = { workspace = true }
 tiny-bip39 = { workspace = true }
 uriparse = { workspace = true }

+ 8 - 1
clap-v3-utils/src/keypair.rs

@@ -9,6 +9,8 @@
 //! sources supported by the Solana CLI. Many other functions here are
 //! variations on, or delegate to, `signer_from_path`.
 
+#[cfg(feature = "elgamal")]
+use solana_zk_sdk::encryption::{auth_encryption::AeKey, elgamal::ElGamalKeypair};
 use {
     crate::{
         input_parsers::signer::{try_pubkeys_sigs_of, SignerSource, SignerSourceKind},
@@ -32,7 +34,6 @@ use {
     solana_seed_phrase::generate_seed_from_seed_phrase_and_passphrase,
     solana_signature::Signature,
     solana_signer::{null_signer::NullSigner, EncodableKey, EncodableKeypair, Signer},
-    solana_zk_token_sdk::encryption::{auth_encryption::AeKey, elgamal::ElGamalKeypair},
     std::{
         cell::RefCell,
         error,
@@ -950,6 +951,7 @@ pub fn keypair_from_source(
 /// )?;
 /// # Ok::<(), Box<dyn std::error::Error>>(())
 /// ```
+#[cfg(feature = "elgamal")]
 pub fn elgamal_keypair_from_path(
     matches: &ArgMatches,
     path: &str,
@@ -964,6 +966,7 @@ pub fn elgamal_keypair_from_path(
     Ok(elgamal_keypair)
 }
 
+#[cfg(feature = "elgamal")]
 pub fn elgamal_keypair_from_source(
     matches: &ArgMatches,
     source: &SignerSource,
@@ -1020,6 +1023,7 @@ fn confirm_encodable_keypair_pubkey<K: EncodableKeypair>(keypair: &K, pubkey_lab
 /// )?;
 /// # Ok::<(), Box<dyn std::error::Error>>(())
 /// ```
+#[cfg(feature = "elgamal")]
 pub fn ae_key_from_path(
     matches: &ArgMatches,
     path: &str,
@@ -1029,6 +1033,7 @@ pub fn ae_key_from_path(
     encodable_key_from_path(path, key_name, skip_validation)
 }
 
+#[cfg(feature = "elgamal")]
 pub fn ae_key_from_source(
     matches: &ArgMatches,
     source: &SignerSource,
@@ -1106,6 +1111,7 @@ pub fn keypair_from_seed_phrase(
 /// derivation.
 ///
 /// Optionally skips validation of seed phrase. Optionally confirms recovered public key.
+#[cfg(feature = "elgamal")]
 pub fn elgamal_keypair_from_seed_phrase(
     elgamal_keypair_name: &str,
     skip_validation: bool,
@@ -1127,6 +1133,7 @@ pub fn elgamal_keypair_from_seed_phrase(
 
 /// Reads user input from stdin to retrieve a seed phrase and passphrase for an authenticated
 /// encryption keypair derivation.
+#[cfg(feature = "elgamal")]
 pub fn ae_key_from_seed_phrase(
     keypair_name: &str,
     skip_validation: bool,

+ 1 - 1
zk-keygen/Cargo.toml

@@ -26,7 +26,7 @@ path = "src/main.rs"
 bs58 = { workspace = true }
 clap = { version = "3.1.5", features = ["cargo", "derive"] }
 dirs-next = { workspace = true }
-solana-clap-v3-utils = { workspace = true }
+solana-clap-v3-utils = { workspace = true, features = ["elgamal"] }
 solana-remote-wallet = { workspace = true, features = ["default"] }
 solana-seed-derivable = "=2.2.1"
 solana-signer = "=2.2.1"