mirror of
https://github.com/RoboSats/taptrade-core.git
synced 2025-07-18 16:53:22 +00:00
bond
This commit is contained in:
@ -46,6 +46,15 @@ fn bytes_to_base91(input: &[u8; 32]) -> String {
|
|||||||
encoded_robohash
|
encoded_robohash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl OfferType {
|
||||||
|
pub fn value(&self) -> u64 {
|
||||||
|
match self {
|
||||||
|
OfferType::Buy(value) => *value,
|
||||||
|
OfferType::Sell(value) => *value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl CliSettings {
|
impl CliSettings {
|
||||||
fn get_user_input(prompt: &str) -> String {
|
fn get_user_input(prompt: &str) -> String {
|
||||||
let mut buffer = String::new();
|
let mut buffer = String::new();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use bdk::{database::MemoryDatabase, wallet::coin_selection::BranchAndBoundCoinSelection, Wallet};
|
use bdk::{database::MemoryDatabase, wallet::coin_selection::BranchAndBoundCoinSelection, Wallet};
|
||||||
|
use serde::de::value;
|
||||||
|
|
||||||
use crate::communication::api::OfferCreationResponse;
|
use crate::communication::api::OfferCreationResponse;
|
||||||
use crate::wallet::TraderSettings;
|
use crate::wallet::TraderSettings;
|
||||||
@ -23,8 +24,8 @@ impl Bond {
|
|||||||
let (psbt, details) = {
|
let (psbt, details) = {
|
||||||
let mut builder = wallet.build_tx();
|
let mut builder = wallet.build_tx();
|
||||||
builder
|
builder
|
||||||
.coin_selection(BranchAndBoundCoinSelection::new(10000))
|
.coin_selection(BranchAndBoundCoinSelection::new(trader_input.trade_type.value()))
|
||||||
.add_recipient(send_to.script_pubkey(), 50_000)
|
.add_recipient(bond_target.locking_address, bond_target.locking_amount)
|
||||||
.enable_rbf()
|
.enable_rbf()
|
||||||
.do_not_spend_change()
|
.do_not_spend_change()
|
||||||
.fee_rate(FeeRate::from_sat_per_vb(5.0));
|
.fee_rate(FeeRate::from_sat_per_vb(5.0));
|
||||||
|
Reference in New Issue
Block a user