feat(wallet)!: add new_or_load methods

These methods try to load wallet from persistence and initializes the
wallet instead if non-existant.

An internal helper method `create_signers` is added to reuse code.
Documentation is also improved.
This commit is contained in:
志宇
2023-10-27 14:14:25 +08:00
parent 7c6cbc4d9f
commit d294e2e318
3 changed files with 190 additions and 51 deletions

View File

@@ -2,6 +2,7 @@ use std::{io::Write, str::FromStr};
use bdk::{
bitcoin::{Address, Network},
chain::PersistBackend,
wallet::{AddressIndex, Update},
SignOptions, Wallet,
};

View File

@@ -7,6 +7,7 @@ use std::{io::Write, str::FromStr};
use bdk::{
bitcoin::{Address, Network},
chain::PersistBackend,
wallet::{AddressIndex, Update},
SignOptions, Wallet,
};