pub struct Psbt {
pub version: PsbtVer,
pub tx_version: TxVer,
pub fallback_locktime: Option<LockTime>,
pub xpubs: IndexMap<Xpub, XkeyOrigin>,
pub proprietary: IndexMap<PropKey, ValueData>,
pub unknown: IndexMap<u8, IndexMap<ByteStr, ValueData>>,
/* private fields */
}
Fields§
§version: PsbtVer
PSBT version
tx_version: TxVer
Transaction version.
fallback_locktime: Option<LockTime>
Fallback locktime (used if none of the inputs specifies their locktime).
xpubs: IndexMap<Xpub, XkeyOrigin>
A global map from extended public keys to the used key fingerprint and derivation path as defined by BIP 32
proprietary: IndexMap<PropKey, ValueData>
Proprietary keys
unknown: IndexMap<u8, IndexMap<ByteStr, ValueData>>
Unknown keys
Implementations§
Source§impl Psbt
impl Psbt
pub fn create(version: PsbtVer) -> Psbt
pub fn from_tx(tx: impl Into<UnsignedTx>) -> Psbt
pub fn to_unsigned_tx(&self) -> UnsignedTx
pub fn txid(&self) -> Txid
pub fn input(&self, index: usize) -> Option<&Input>
pub fn input_mut(&mut self, index: usize) -> Option<&mut Input>
pub fn inputs(&self) -> impl Iterator<Item = &Input>
pub fn inputs_mut(&mut self) -> impl Iterator<Item = &mut Input>
pub fn output(&self, index: usize) -> Option<&Output>
pub fn output_mut(&mut self, index: usize) -> Option<&mut Output>
pub fn outputs(&self) -> impl Iterator<Item = &Output>
pub fn outputs_mut(&mut self) -> impl Iterator<Item = &mut Output>
pub fn lock_time(&self) -> LockTime
pub fn input_sum(&self) -> Sats
pub fn output_sum(&self) -> Sats
pub fn fee(&self) -> Option<Sats>
pub fn xpubs(&self) -> impl Iterator<Item = (&Xpub, &XkeyOrigin)>
pub fn is_modifiable(&self) -> bool
pub fn are_inputs_modifiable(&self) -> bool
pub fn are_outputs_modifiable(&self) -> bool
pub fn construct_input<K, D>(
&mut self,
prevout: Prevout,
descriptor: &D,
terminal: Terminal,
sequence: SeqNo,
) -> Result<&mut Input, Unmodifiable>where
D: Descriptor<K>,
pub fn construct_input_expect<K, D>(
&mut self,
prevout: Prevout,
descriptor: &D,
terminal: Terminal,
sequence: SeqNo,
) -> &mut Inputwhere
D: Descriptor<K>,
pub fn construct_output( &mut self, script_pubkey: ScriptPubkey, value: Sats, ) -> Result<&mut Output, Unmodifiable>
pub fn construct_output_expect( &mut self, script_pubkey: ScriptPubkey, value: Sats, ) -> &mut Output
pub fn construct_change<K, D>(
&mut self,
descriptor: &D,
change_terminal: Terminal,
value: Sats,
) -> Result<&mut Output, Unmodifiable>where
D: Descriptor<K>,
pub fn construct_change_expect<K, D>(
&mut self,
descriptor: &D,
change_terminal: Terminal,
value: Sats,
) -> &mut Outputwhere
D: Descriptor<K>,
pub fn sort_outputs_by<K>(
&mut self,
f: impl FnMut(&Output) -> K,
) -> Result<(), Unmodifiable>where
K: Ord,
pub fn complete_construction(&mut self)
pub fn is_finalized(&self) -> bool
pub fn finalize<D, K, V>(&mut self, descriptor: &D) -> usizewhere
D: Descriptor<K, V>,
pub fn extract(&self) -> Result<Tx, UnfinalizedInputs>
Source§impl Psbt
impl Psbt
pub fn from_base64(s: &str) -> Result<Psbt, PsbtParseError>
pub fn from_base16(s: &str) -> Result<Psbt, PsbtParseError>
pub fn to_base64(&self) -> String
pub fn to_base64_ver(&self, version: PsbtVer) -> String
pub fn to_base16(&self) -> String
pub fn to_base16_ver(&self, version: PsbtVer) -> String
Source§impl Psbt
impl Psbt
pub fn encode( &self, ver: PsbtVer, writer: &mut dyn Write, ) -> Result<usize, IoError>
pub fn encode_vec(&self, ver: PsbtVer, writer: &mut Vec<u8>) -> usize
pub fn serialize(&self, ver: PsbtVer) -> Vec<u8> ⓘ
pub fn decode(reader: &mut impl Read) -> Result<Psbt, DecodeError>
pub fn deserialize(data: impl AsRef<[u8]>) -> Result<Psbt, PsbtError>
Source§impl Psbt
impl Psbt
pub fn dbc_output<D>(&mut self) -> Option<&Output>where
D: DbcPsbtProof,
pub fn dbc_output_mut<D>(&mut self) -> Option<&mut Output>where
D: DbcPsbtProof,
pub fn dbc_commit<D>(&mut self) -> Result<Anchor<MerkleBlock, D>, DbcPsbtError>where
D: DbcPsbtProof,
Source§impl Psbt
impl Psbt
pub fn opret_hosts(&self) -> impl Iterator<Item = &Output>
pub fn opret_hosts_mut(&mut self) -> impl Iterator<Item = &mut Output>
Source§impl Psbt
impl Psbt
pub fn tapret_hosts(&self) -> impl Iterator<Item = &Output>
pub fn tapret_hosts_mut(&mut self) -> impl Iterator<Item = &mut Output>
Trait Implementations§
Source§impl Display for Psbt
impl Display for Psbt
PSBT displays Base64-encoded string. The selection of the version if the following:
- by default, it uses version specified in the PSBT itself;
- if zero
{:0}
is given and no width ({:0}
) or a zero width ({:00}
) is provided, than the PSBT is encoded as V0 even if the structure itself uses V2; - if a width equal to one is given like in
{:1}
, than zero flag is ignored (so{:01}
also works that way) and PSBT is encoded as V0 even if the structure itself uses V2; - if a width equal to two is given like in
{:2}
, than zero flag is ignored (so{:02}
also works that way) and PSBT is encoded as V2 even if the structure itself uses V1; - all other flags has no effect on the display.
Source§impl KeyMap for Psbt
impl KeyMap for Psbt
const PROPRIETARY_TYPE: <Psbt as KeyMap>::Keys = GlobalKey::Proprietary
type Keys = GlobalKey
fn retrieve_key_pair<'enc>( &'enc self, version: PsbtVer, key_type: <Psbt as KeyMap>::Keys, ) -> Vec<KeyPair<<Psbt as KeyMap>::Keys, Box<dyn Encode + 'enc>, Box<dyn Encode + 'enc>>>
fn insert_singular( &mut self, key_type: <Psbt as KeyMap>::Keys, value_data: ValueData, ) -> Result<(), PsbtError>
fn insert_plural( &mut self, key_type: <Psbt as KeyMap>::Keys, key_data: ByteStr, value_data: ValueData, ) -> Result<(), PsbtError>
fn encode_map( &self, version: PsbtVer, writer: &mut dyn Write, ) -> Result<usize, IoError>
fn parse_map( &mut self, version: PsbtVer, map: Map<Self::Keys>, ) -> Result<(), PsbtError>
fn has_proprietary(&self, key: &PropKey) -> bool
fn proprietary(&self, key: &PropKey) -> Option<&ValueData>
fn proprietary_mut(&mut self, key: &PropKey) -> Option<&mut ValueData>
fn push_proprietary( &mut self, key: PropKey, value: impl Into<ValueData>, ) -> Result<(), KeyAlreadyPresent>
fn remove_proprietary(&mut self, key: &PropKey) -> Option<ValueData>
fn insert_proprietary(&mut self, prop_key: PropKey, value_data: ValueData)
fn insert_unknown( &mut self, key_type: u8, key_data: ByteStr, value_data: ValueData, )
Source§impl LowerHex for Psbt
impl LowerHex for Psbt
PSBT is formatted like hex-encoded string. The selection of the version if the following:
- by default, it uses version specified in the PSBT itself;
- if zero
{:0}
is given and no width ({:0}
) or a zero width ({:00}
) is provided, than the PSBT is encoded as V0 even if the structure itself uses V2; - if a width equal to one is given like in
{:1}
, than zero flag is ignored (so{:01}
also works that way) and PSBT is encoded as V0 even if the structure itself uses V2; - if a width equal to two is given like in
{:2}
, than zero flag is ignored (so{:02}
also works that way) and PSBT is encoded as V2 even if the structure itself uses V1; - all other flags has no effect on the display.
Source§impl RgbExt for Psbt
impl RgbExt for Psbt
fn rgb_contract_ids(&self) -> Result<BTreeSet<ContractId>, FromSliceError>
fn rgb_contract_consumers( &self, contract_id: ContractId, ) -> Result<BTreeSet<(OpId, Vin)>, FromSliceError>
fn rgb_op_ids( &self, contract_id: ContractId, ) -> Result<BTreeSet<OpId>, FromSliceError>
fn rgb_transition(&self, opid: OpId) -> Result<Option<Transition>, RgbPsbtError>
fn rgb_close_method( &self, opid: OpId, ) -> Result<Option<CloseMethod>, RgbPsbtError>
fn push_rgb_transition( &mut self, transition: Transition, method: CloseMethod, ) -> Result<bool, RgbPsbtError>
fn rgb_bundles_to_mpc( &mut self, ) -> Result<Confined<BTreeMap<ContractId, BundleDichotomy>, 1, U24>, RgbPsbtError>
fn rgb_bundles( &self, ) -> Result<BTreeMap<ContractId, BundleDichotomy>, RgbPsbtError>
Source§impl RgbPsbt for Psbt
impl RgbPsbt for Psbt
fn rgb_embed(&mut self, batch: Batch) -> Result<(), EmbedError>
fn rgb_commit(&mut self) -> Result<Fascia, CommitError>
fn rgb_extract(&self) -> Result<Fascia, ExtractError>
Source§impl Serialize for Psbt
impl Serialize for Psbt
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for Psbt
impl StructuralPartialEq for Psbt
Auto Trait Implementations§
impl Freeze for Psbt
impl RefUnwindSafe for Psbt
impl Send for Psbt
impl Sync for Psbt
impl Unpin for Psbt
impl UnwindSafe for Psbt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.