feat: use Amount on TxBuilder::add_recipient

This commit is contained in:
Leonardo Lima
2024-04-26 11:41:17 -03:00
parent d5c0e7200c
commit 22aa534d76
9 changed files with 102 additions and 102 deletions

View File

@@ -1,5 +1,5 @@
const DB_MAGIC: &str = "bdk_wallet_electrum_example";
const SEND_AMOUNT: u64 = 5000;
const SEND_AMOUNT: Amount = Amount::from_sat(5000);
const STOP_GAP: usize = 50;
const BATCH_SIZE: usize = 5;
@@ -81,8 +81,7 @@ fn main() -> Result<(), anyhow::Error> {
let balance = wallet.get_balance();
println!("Wallet balance after syncing: {} sats", balance.total());
// TODO: (@leonardo) Should we format here, or update on constant and TxBuilder::add_recipient() instead ?
if balance.total() < Amount::from_sat(SEND_AMOUNT) {
if balance.total() < SEND_AMOUNT {
println!(
"Please send at least {} sats to the receiving address",
SEND_AMOUNT

View File

@@ -8,7 +8,7 @@ use bdk_esplora::{esplora_client, EsploraAsyncExt};
use bdk_file_store::Store;
const DB_MAGIC: &str = "bdk_wallet_esplora_async_example";
const SEND_AMOUNT: u64 = 5000;
const SEND_AMOUNT: Amount = Amount::from_sat(5000);
const STOP_GAP: usize = 50;
const PARALLEL_REQUESTS: usize = 5;
@@ -81,8 +81,7 @@ async fn main() -> Result<(), anyhow::Error> {
let balance = wallet.get_balance();
println!("Wallet balance after syncing: {} sats", balance.total());
// TODO: (@leonardo) Should we format here, or update on constant and TxBuilder::add_recipient() instead ?
if balance.total() < Amount::from_sat(SEND_AMOUNT) {
if balance.total() < SEND_AMOUNT {
println!(
"Please send at least {} sats to the receiving address",
SEND_AMOUNT

View File

@@ -1,5 +1,5 @@
const DB_MAGIC: &str = "bdk_wallet_esplora_example";
const SEND_AMOUNT: u64 = 1000;
const SEND_AMOUNT: Amount = Amount::from_sat(1000);
const STOP_GAP: usize = 5;
const PARALLEL_REQUESTS: usize = 1;
@@ -57,8 +57,7 @@ fn main() -> Result<(), anyhow::Error> {
let balance = wallet.get_balance();
println!("Wallet balance after syncing: {} sats", balance.total());
// TODO: (@leonardo) Should we format here, or update on constant and TxBuilder::add_recipient() instead ?
if balance.total() < Amount::from_sat(SEND_AMOUNT) {
if balance.total() < SEND_AMOUNT {
println!(
"Please send at least {} sats to the receiving address",
SEND_AMOUNT