Added generate_mnemonic method

This commit is contained in:
dhruvbaliyan committed 2022-08-18 04:24:02 +05:30
1 parent 973013cbdf
commit 930a1f1eb4
2 files changed
+10 -1

No files matched your search

+4 -1
View File
@@ -1,4 +1,7 @@
namespace bdk {};
namespace bdk {
[Throws=BdkError]
string generate_mnemonic(WordCount word_count);
};
[Error]
enum BdkError {
+6
View File
@@ -627,6 +627,12 @@ impl BumpFeeTxBuilder {
}
}
fn generate_mnemonic(word_count: WordCount) -> Result<String, BdkError> {
let mnemonic: GeneratedKey<_, BareCtx> =
Mnemonic::generate((word_count, Language::English)).unwrap();
Ok(mnemonic.to_string())
}
uniffi::deps::static_assertions::assert_impl_all!(Wallet: Sync, Send);
// The goal of these tests to to ensure `bdk-ffi` intermediate code correctly calls `bdk` APIs.