From a96f16fe807a3b1481753a531d87d7dc7081a38b Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Fri, 1 Nov 2024 14:10:27 +0400 Subject: [PATCH] fix feature-gated imports --- Cargo.lock | 1 + sdk/seed-phrase/Cargo.toml | 2 ++ sdk/seed-phrase/src/lib.rs | 10 ++++------ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 608d76e7813375..694d238ba4966a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8173,6 +8173,7 @@ dependencies = [ "hmac 0.12.1", "pbkdf2 0.11.0", "sha2 0.10.8", + "solana-seed-phrase", "solana-signer", "tiny-bip39", ] diff --git a/sdk/seed-phrase/Cargo.toml b/sdk/seed-phrase/Cargo.toml index 5d25042c33a7f2..31ae3cb8a10a93 100644 --- a/sdk/seed-phrase/Cargo.toml +++ b/sdk/seed-phrase/Cargo.toml @@ -16,9 +16,11 @@ sha2 = { workspace = true } solana-signer = { workspace = true } [dev-dependencies] +solana-seed-phrase = { path = ".", features = ["dev-context-only-utils"] } tiny-bip39 = { workspace = true } [features] +dev-context-only-utils = ["keypair"] keypair = ["solana-signer/keypair"] [package.metadata.docs.rs] diff --git a/sdk/seed-phrase/src/lib.rs b/sdk/seed-phrase/src/lib.rs index bc446c8ecee6a0..0766035e38e73b 100644 --- a/sdk/seed-phrase/src/lib.rs +++ b/sdk/seed-phrase/src/lib.rs @@ -1,9 +1,7 @@ //! Functions for generating keypairs from seed phrases. -use { - hmac::Hmac, - solana_signer::keypair::{keypair_from_seed, Keypair}, - std::error, -}; +use hmac::Hmac; +#[cfg(feature = "keypair")] +use solana_signer::keypair::{keypair_from_seed, Keypair}; pub fn generate_seed_from_seed_phrase_and_passphrase( seed_phrase: &str, @@ -28,7 +26,7 @@ pub fn generate_seed_from_seed_phrase_and_passphrase( pub fn keypair_from_seed_phrase_and_passphrase( seed_phrase: &str, passphrase: &str, -) -> Result> { +) -> Result> { keypair_from_seed(&generate_seed_from_seed_phrase_and_passphrase( seed_phrase, passphrase,