feat: add output method on transaction type
This commit is contained in:
@@ -584,6 +584,8 @@ interface Transaction {
|
||||
u64 weight();
|
||||
|
||||
sequence<TxIn> input();
|
||||
|
||||
sequence<TxOut> output();
|
||||
};
|
||||
|
||||
interface Psbt {
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
use crate::error::{AddressError, FeeRateError, PsbtParseError, TransactionError};
|
||||
|
||||
use bdk::bitcoin::address::{NetworkChecked, NetworkUnchecked};
|
||||
use bdk::bitcoin::amount::ParseAmountError;
|
||||
use bdk::bitcoin::blockdata::script::ScriptBuf as BdkScriptBuf;
|
||||
use bdk::bitcoin::blockdata::transaction::TxOut as BdkTxOut;
|
||||
use bdk::bitcoin::consensus::encode::serialize;
|
||||
use bdk::bitcoin::consensus::Decodable;
|
||||
use bdk::bitcoin::psbt::ExtractTxError;
|
||||
use bdk::bitcoin::Address as BdkAddress;
|
||||
use bdk::bitcoin::Amount as BdkAmount;
|
||||
use bdk::bitcoin::FeeRate as BdkFeeRate;
|
||||
use bdk::bitcoin::Network;
|
||||
use bdk::bitcoin::OutPoint as BdkOutPoint;
|
||||
use bdk::bitcoin::Psbt as BdkPsbt;
|
||||
use bdk::bitcoin::Transaction as BdkTransaction;
|
||||
use bdk::bitcoin::Txid;
|
||||
use bdk::bitcoin::TxIn as BdkTxIn;
|
||||
use bdk::bitcoin::amount::ParseAmountError;
|
||||
use bdk::bitcoin::Amount as BdkAmount;
|
||||
use bdk::bitcoin::Txid;
|
||||
|
||||
use std::io::Cursor;
|
||||
use std::str::FromStr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Amount(pub(crate) BdkAmount);
|
||||
|
||||
@@ -174,6 +173,10 @@ impl Transaction {
|
||||
pub fn input(&self) -> Vec<TxIn> {
|
||||
self.0.input.iter().map(|tx_in| tx_in.into()).collect()
|
||||
}
|
||||
|
||||
pub fn output(&self) -> Vec<TxOut> {
|
||||
self.0.output.iter().map(|tx_out| tx_out.into()).collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BdkTransaction> for Transaction {
|
||||
|
||||
@@ -14,6 +14,7 @@ use crate::bitcoin::OutPoint;
|
||||
use crate::bitcoin::Psbt;
|
||||
use crate::bitcoin::Script;
|
||||
use crate::bitcoin::Transaction;
|
||||
use crate::bitcoin::TxIn;
|
||||
use crate::bitcoin::TxOut;
|
||||
use crate::descriptor::Descriptor;
|
||||
use crate::electrum::ElectrumClient;
|
||||
@@ -53,7 +54,6 @@ use crate::wallet::BumpFeeTxBuilder;
|
||||
use crate::wallet::SentAndReceivedValues;
|
||||
use crate::wallet::TxBuilder;
|
||||
use crate::wallet::Update;
|
||||
use crate::bitcoin::TxIn;
|
||||
use crate::wallet::Wallet;
|
||||
|
||||
use bdk::bitcoin::Network;
|
||||
|
||||
Reference in New Issue
Block a user