Add new utility methods on Transaction type
This PR adds the txid(), is_coin_base(), is_explicitly_rbf(), and is_lock_time_enabled() methods. Fixes #303
This commit is contained in:
@@ -247,13 +247,21 @@ interface Transaction {
|
||||
[Throws=BdkError]
|
||||
constructor(sequence<u8> transaction_bytes);
|
||||
|
||||
sequence<u8> serialize();
|
||||
string txid();
|
||||
|
||||
u64 weight();
|
||||
|
||||
u64 size();
|
||||
|
||||
u64 vsize();
|
||||
|
||||
sequence<u8> serialize();
|
||||
|
||||
boolean is_coin_base();
|
||||
|
||||
boolean is_explicitly_rbf();
|
||||
|
||||
boolean is_lock_time_enabled();
|
||||
};
|
||||
|
||||
interface PartiallySignedTransaction {
|
||||
|
||||
@@ -251,8 +251,8 @@ impl Transaction {
|
||||
Ok(Transaction { internal: tx })
|
||||
}
|
||||
|
||||
fn serialize(&self) -> Vec<u8> {
|
||||
self.internal.serialize()
|
||||
fn txid(&self) -> String {
|
||||
self.internal.txid().to_string()
|
||||
}
|
||||
|
||||
fn weight(&self) -> u64 {
|
||||
@@ -266,6 +266,22 @@ impl Transaction {
|
||||
fn vsize(&self) -> u64 {
|
||||
self.internal.vsize() as u64
|
||||
}
|
||||
|
||||
fn serialize(&self) -> Vec<u8> {
|
||||
self.internal.serialize()
|
||||
}
|
||||
|
||||
fn is_coin_base(&self) -> bool {
|
||||
self.internal.is_coin_base()
|
||||
}
|
||||
|
||||
fn is_explicitly_rbf(&self) -> bool {
|
||||
self.internal.is_explicitly_rbf()
|
||||
}
|
||||
|
||||
fn is_lock_time_enabled(&self) -> bool {
|
||||
self.internal.is_lock_time_enabled()
|
||||
}
|
||||
}
|
||||
|
||||
/// A Bitcoin address.
|
||||
|
||||
Reference in New Issue
Block a user