Skip to content

Commit

Permalink
feat: add serialize method on Transaction type
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Apr 18, 2024
1 parent 9002650 commit e8e26c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bdk-ffi/src/bdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ interface Transaction {
boolean is_lock_time_enabled();

i32 version();

sequence<u8> serialize();
};

interface Psbt {
Expand Down
8 changes: 7 additions & 1 deletion bdk-ffi/src/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ 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::psbt::ExtractTxError;
use bdk::bitcoin::consensus::encode::serialize;

use std::io::Cursor;
use std::str::FromStr;
use std::sync::{Arc, Mutex};
use bitcoin_internals::hex::display::DisplayHex;

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Script(pub(crate) BdkScriptBuf);
Expand Down Expand Up @@ -159,6 +161,10 @@ impl Transaction {
self.inner.version.0
}

pub fn serialize(&self) -> Vec<u8> {
serialize(&self.inner)
}

// fn lock_time(&self) -> u32 {
// self.inner.lock_time.0
// }
Expand Down

0 comments on commit e8e26c2

Please sign in to comment.