pub struct Psbt {
pub psbt_version: PsbtVersion,
pub tx_version: u32,
pub fallback_locktime: Option<LockTime>,
pub inputs: Vec<Input>,
pub outputs: Vec<Output>,
pub xpub: BTreeMap<ExtendedPubKey, KeySource>,
pub proprietary: BTreeMap<ProprietaryKey, Vec<u8>>,
pub unknown: BTreeMap<Key, Vec<u8>>,
}
Fields§
§psbt_version: PsbtVersion
The version number of this PSBT. If omitted, the version number is 0.
tx_version: u32
Transaction version.
fallback_locktime: Option<LockTime>
Fallback locktime (used if none of the inputs specifies their locktime).
inputs: Vec<Input>
The corresponding key-value map for each input.
outputs: Vec<Output>
The corresponding key-value map for each output.
xpub: BTreeMap<ExtendedPubKey, KeySource>
A global map from extended public keys to the used key fingerprint and derivation path as defined by BIP 32
proprietary: BTreeMap<ProprietaryKey, Vec<u8>>
Global proprietary key-value pairs.
unknown: BTreeMap<Key, Vec<u8>>
Unknown global key-value pairs.
Implementations§
source§impl Psbt
impl Psbt
sourcepub fn with(tx: Transaction, psbt_version: PsbtVersion) -> Result<Self, TxError>
pub fn with(tx: Transaction, psbt_version: PsbtVersion) -> Result<Self, TxError>
Checks that unsigned transaction does not have scriptSig’s or witness data
pub fn lock_time(&self) -> LockTime
sourcepub fn fee(&self) -> Result<u64, FeeError>
pub fn fee(&self) -> Result<u64, FeeError>
Returns fee for a transaction, or returns error reporting resolver problem or wrong transaction structure
sourcepub fn to_txid(&self) -> Txid
pub fn to_txid(&self) -> Txid
Returns transaction ID for an unsigned transaction. For SegWit transactions this is equal to the signed transaction id.
sourcepub fn to_unsigned_tx(&self) -> Transaction
pub fn to_unsigned_tx(&self) -> Transaction
Constructs transaction with empty scriptSig
and witness
sourcepub fn into_unsigned_tx(self) -> Transaction
pub fn into_unsigned_tx(self) -> Transaction
Returns transaction with empty scriptSig
and witness
sourcepub fn extract_signed_tx(&self) -> Transaction
pub fn extract_signed_tx(&self) -> Transaction
Extract the (partially) signed transaction from this PSBT by filling in the available signature information in place.
source§impl Psbt
impl Psbt
Extension trait for Psbt
for working with proprietary LNPBP4 keys.
sourcepub fn lnpbp4_protocol_info(
&self,
protocol_id: ProtocolId
) -> Result<Lnpbp4Info, Lnpbp4KeyError>
pub fn lnpbp4_protocol_info(
&self,
protocol_id: ProtocolId
) -> Result<Lnpbp4Info, Lnpbp4KeyError>
Returns an information about the given LNPBP4 ProtocolId
, if any.
Errors
If the key is present, but it’s value can’t be deserialized as a valid protocol information block.
sourcepub fn set_lnpbp4_protocol_info(
&mut self,
protocol_id: ProtocolId,
hash_tag: Option<String>,
inner_id: Option<Slice32>
) -> Result<bool, Lnpbp4KeyError>
pub fn set_lnpbp4_protocol_info(
&mut self,
protocol_id: ProtocolId,
hash_tag: Option<String>,
inner_id: Option<Slice32>
) -> Result<bool, Lnpbp4KeyError>
Adds LNPBP4 protocol information.
Returns
true
, if the protocol information was successfully added, false
if
it was already present.
Errors
If the key for the given ProtocolId
is already present and the
information was different.
Trait Implementations§
source§impl Deserialize for Psbt
impl Deserialize for Psbt
source§impl From<PartiallySignedTransaction> for Psbt
impl From<PartiallySignedTransaction> for Psbt
source§impl PartialEq<Psbt> for Psbt
impl PartialEq<Psbt> for Psbt
source§impl StrictDecode for Psbt
impl StrictDecode for Psbt
source§fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
std::io::Read
instance; must either
construct an instance or return implementation-specific error type.source§fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
StrictDecode::strict_decode
. If there are some data remains in the
buffer once deserialization is completed, fails with
Error::DataNotEntirelyConsumed
. Use io::Cursor
over the buffer and
StrictDecode::strict_decode
to avoid such failures.source§fn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
fn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
path
and reconstructs object from it. Fails
with Error::DataNotEntirelyConsumed
if file contains remaining
data after the object reconstruction.source§impl StrictEncode for Psbt
impl StrictEncode for Psbt
source§fn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
fn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
std::io::Write
instance; must return result
with either amount of bytes encoded – or implementation-specific
error type.source§fn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
fn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
StrictEncode::strict_encode
function