feat: add display trait to mnemonic
This commit is contained in:
parent
84f1329e84
commit
94d31ff7ed
@ -454,6 +454,7 @@ interface BumpFeeTxBuilder {
|
||||
// bdk crate - descriptor module
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
[Traits=(Display)]
|
||||
interface Mnemonic {
|
||||
constructor(WordCount word_count);
|
||||
|
||||
@ -462,8 +463,6 @@ interface Mnemonic {
|
||||
|
||||
[Name=from_entropy, Throws=Bip39Error]
|
||||
constructor(sequence<u8> entropy);
|
||||
|
||||
string as_string();
|
||||
};
|
||||
|
||||
interface DerivationPath {
|
||||
|
@ -1,4 +1,5 @@
|
||||
use crate::error::{Bip32Error, Bip39Error, DescriptorKeyError};
|
||||
use std::fmt::Display;
|
||||
|
||||
use bdk_wallet::bitcoin::bip32::DerivationPath as BdkDerivationPath;
|
||||
use bdk_wallet::bitcoin::key::Secp256k1;
|
||||
@ -44,9 +45,11 @@ impl Mnemonic {
|
||||
.map(Mnemonic)
|
||||
.map_err(Bip39Error::from)
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn as_string(&self) -> String {
|
||||
self.0.to_string()
|
||||
impl Display for Mnemonic {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user