pub struct Creator(/* private fields */);Expand description
Implements the BIP-370 Creator role.
The Creator type is only directly needed if one of the following holds:
- The creator and constructor are separate entities.
- You need to set the fallback lock time.
- You need to set the sighash single flag.
If not use the Constructor to carry out both roles e.g., Constructor::<Modifiable>::default().
See examples/v2-separate-creator-constructor.rs.
Implementations§
Source§impl Creator
impl Creator
Sourcepub fn fallback_lock_time(self, fallback: LockTime) -> Self
pub fn fallback_lock_time(self, fallback: LockTime) -> Self
Sets the fallback lock time.
Sourcepub fn sighash_single(self) -> Self
pub fn sighash_single(self) -> Self
Sets the “has sighash single” flag in then transaction modifiable flags.
Sourcepub fn inputs_modifiable(self) -> Self
pub fn inputs_modifiable(self) -> Self
Sets the inputs modifiable bit in the transaction modifiable flags.
Sourcepub fn outputs_modifiable(self) -> Self
pub fn outputs_modifiable(self) -> Self
Sets the outputs modifiable bit in the transaction modifiable flags.
Sourcepub fn transaction_version(self, version: Version) -> Self
pub fn transaction_version(self, version: Version) -> Self
Sets the transaction version.
You likely do not need this, it is provided for completeness.
The default is transaction::Version::TWO.
Sourcepub fn constructor_modifiable(self) -> Constructor<Modifiable>
pub fn constructor_modifiable(self) -> Constructor<Modifiable>
Builds a Constructor that can add inputs and outputs.
§Examples
use psbt_v2::v2::{Creator, Constructor, Modifiable};
// Creator role separate from Constructor role.
let psbt = Creator::new()
.inputs_modifiable()
.outputs_modifiable()
.psbt();
let _constructor = Constructor::<Modifiable>::new(psbt);
// However, since a single entity is likely to be both a Creator and Constructor.
let _constructor = Creator::new().constructor_modifiable();
// Or the more terse:
let _constructor = Constructor::<Modifiable>::default();Sourcepub fn constructor_inputs_only_modifiable(
self,
) -> Constructor<InputsOnlyModifiable>
pub fn constructor_inputs_only_modifiable( self, ) -> Constructor<InputsOnlyModifiable>
Builds a Constructor that can only add inputs.
§Examples
use psbt_v2::v2::{Creator, Constructor, InputsOnlyModifiable};
// Creator role separate from Constructor role.
let psbt = Creator::new()
.inputs_modifiable()
.psbt();
let _constructor = Constructor::<InputsOnlyModifiable>::new(psbt);
// However, since a single entity is likely to be both a Creator and Constructor.
let _constructor = Creator::new().constructor_inputs_only_modifiable();
// Or the more terse:
let _constructor = Constructor::<InputsOnlyModifiable>::default();Sourcepub fn constructor_outputs_only_modifiable(
self,
) -> Constructor<OutputsOnlyModifiable>
pub fn constructor_outputs_only_modifiable( self, ) -> Constructor<OutputsOnlyModifiable>
Builds a Constructor that can only add outputs.
§Examples
use psbt_v2::v2::{Creator, Constructor, OutputsOnlyModifiable};
// Creator role separate from Constructor role.
let psbt = Creator::new()
.inputs_modifiable()
.psbt();
let _constructor = Constructor::<OutputsOnlyModifiable>::new(psbt);
// However, since a single entity is likely to be both a Creator and Constructor.
let _constructor = Creator::new().constructor_outputs_only_modifiable();
// Or the more terse:
let _constructor = Constructor::<OutputsOnlyModifiable>::default();