Component
signers
Describe the feature you would like
As rand is not exported by Alloy - nor do I think it should - users are now required to import it themselves to use as source of randomness for build_random(&mut rng) as there is no default implementation.
|
// NOTE: `rand` is not exported anymore, now private. |
|
use rand; |
|
// Generate a random wallet (24 word phrase) at custom derivation path |
|
let mut rng = rand::thread_rng(); |
|
let wallet = MnemonicBuilder::<English>::default() |
|
.word_count(24) |
|
.derivation_path("m/44'/60'/0'/2/1")? |
|
// Optionally add this if you want the generated mnemonic to be written |
|
// to a file |
|
// .write_to(path) |
|
.build_random(&mut rng)?; |
Preferable would be a syntax like:
|
/// Creates a new random keypair seeded with [`rand::thread_rng()`]. |
|
#[inline] |
|
pub fn random() -> Self { |
|
Self::random_with(&mut rand::thread_rng()) |
|
} |
|
|
|
/// Creates a new random keypair seeded with the provided RNG. |
|
#[inline] |
|
pub fn random_with<R: Rng + CryptoRng>(rng: &mut R) -> Self { |
|
Self::from_signing_key(SigningKey::random(rng)) |
|
} |
With rand being the default.
Additional context
No response
Component
signers
Describe the feature you would like
As
randis not exported by Alloy - nor do I think it should - users are now required to import it themselves to use as source of randomness forbuild_random(&mut rng)as there is no default implementation.alloy/examples/wallets/examples/mnemonic.rs
Lines 5 to 6 in f9a7c2a
alloy/examples/wallets/examples/mnemonic.rs
Lines 25 to 33 in f9a7c2a
Preferable would be a syntax like:
alloy/crates/signer/src/wallet/private_key.rs
Lines 52 to 62 in 09e90e8
With
randbeing the default.Additional context
No response