pub struct TxInputsBuilder { /* private fields */ }
Implementations§
source§impl TxInputsBuilder
impl TxInputsBuilder
pub fn new() -> Self
sourcepub fn add_key_input(
&mut self,
hash: &Ed25519KeyHash,
input: &TransactionInput,
amount: &Value
)
pub fn add_key_input( &mut self, hash: &Ed25519KeyHash, input: &TransactionInput, amount: &Value )
We have to know what kind of inputs these are to know what kind of mock witnesses to create since
- mock witnesses have different lengths depending on the type which changes the expecting fee
- Witnesses are a set so we need to get rid of duplicates to avoid over-estimating the fee
sourcepub fn add_script_input(
&mut self,
hash: &ScriptHash,
input: &TransactionInput,
amount: &Value
)
👎Deprecated since 11.2.0: Use .add_native_script_input
or .add_plutus_script_input
instead.
pub fn add_script_input( &mut self, hash: &ScriptHash, input: &TransactionInput, amount: &Value )
.add_native_script_input
or .add_plutus_script_input
instead.!!! DEPRECATED !!!
This function can make a mistake in choosing right input index. Use .add_native_script_input
or .add_plutus_script_input
instead.
This method adds the input to the builder BUT leaves a missing spot for the witness native script
After adding the input with this method, use .add_required_native_input_scripts
and .add_required_plutus_input_scripts
to add the witness scripts
Or instead use .add_native_script_input
and .add_plutus_script_input
to add inputs right along with the script, instead of the script hash
sourcepub fn add_native_script_input(
&mut self,
script: &NativeScript,
input: &TransactionInput,
amount: &Value
)
pub fn add_native_script_input( &mut self, script: &NativeScript, input: &TransactionInput, amount: &Value )
This method will add the input to the builder and also register the required native script witness
sourcepub fn add_plutus_script_input(
&mut self,
witness: &PlutusWitness,
input: &TransactionInput,
amount: &Value
)
pub fn add_plutus_script_input( &mut self, witness: &PlutusWitness, input: &TransactionInput, amount: &Value )
This method will add the input to the builder and also register the required plutus witness
pub fn add_bootstrap_input( &mut self, hash: &ByronAddress, input: &TransactionInput, amount: &Value )
sourcepub fn add_input(
&mut self,
address: &Address,
input: &TransactionInput,
amount: &Value
)
pub fn add_input( &mut self, address: &Address, input: &TransactionInput, amount: &Value )
Note that for script inputs this method will use underlying generic .add_script_input
which leaves a required empty spot for the script witness (or witnesses in case of Plutus).
You can use .add_native_script_input
or .add_plutus_script_input
directly to register the input along with the witness.
sourcepub fn count_missing_input_scripts(&self) -> usize
pub fn count_missing_input_scripts(&self) -> usize
Returns the number of still missing input scripts (either native or plutus)
Use .add_required_native_input_scripts
or .add_required_plutus_input_scripts
to add the missing scripts
sourcepub fn add_required_native_input_scripts(
&mut self,
scripts: &NativeScripts
) -> usize
pub fn add_required_native_input_scripts( &mut self, scripts: &NativeScripts ) -> usize
Try adding the specified scripts as witnesses for ALREADY ADDED script inputs
Any scripts that don’t match any of the previously added inputs will be ignored
Returns the number of remaining required missing witness scripts
Use .count_missing_input_scripts
to find the number of still missing scripts
sourcepub fn add_required_plutus_input_scripts(
&mut self,
scripts: &PlutusWitnesses
) -> usize
👎Deprecated since 11.2.0: This function can make a mistake in choosing right input index. Use .add_required_script_input_witnesses
instead.
pub fn add_required_plutus_input_scripts( &mut self, scripts: &PlutusWitnesses ) -> usize
.add_required_script_input_witnesses
instead.!!! DEPRECATED !!!
This function can make a mistake in choosing right input index. Use .add_required_script_input_witnesses
instead.
Try adding the specified scripts as witnesses for ALREADY ADDED script inputs
Any scripts that don’t match any of the previously added inputs will be ignored
Returns the number of remaining required missing witness scripts
Use .count_missing_input_scripts
to find the number of still missing scripts
sourcepub fn add_required_script_input_witnesses(
&mut self,
inputs_with_wit: &InputsWithScriptWitness
) -> usize
pub fn add_required_script_input_witnesses( &mut self, inputs_with_wit: &InputsWithScriptWitness ) -> usize
Try adding the specified scripts as witnesses for ALREADY ADDED script inputs
Any scripts that don’t match any of the previously added inputs will be ignored
Returns the number of remaining required missing witness scripts
Use .count_missing_input_scripts
to find the number of still missing scripts
pub fn get_ref_inputs(&self) -> TransactionInputs
sourcepub fn get_native_input_scripts(&self) -> Option<NativeScripts>
pub fn get_native_input_scripts(&self) -> Option<NativeScripts>
Returns a copy of the current script input witness scripts in the builder
sourcepub fn get_plutus_input_scripts(&self) -> Option<PlutusWitnesses>
pub fn get_plutus_input_scripts(&self) -> Option<PlutusWitnesses>
Returns a copy of the current plutus input witness scripts in the builder. NOTE: each plutus witness will be cloned with a specific corresponding input index
pub fn len(&self) -> usize
pub fn add_required_signer(&mut self, key: &Ed25519KeyHash)
pub fn add_required_signers(&mut self, keys: &RequiredSigners)
pub fn total_value(&self) -> Result<Value, JsError>
pub fn inputs(&self) -> TransactionInputs
pub fn inputs_option(&self) -> Option<TransactionInputs>
Trait Implementations§
source§impl Clone for TxInputsBuilder
impl Clone for TxInputsBuilder
source§fn clone(&self) -> TxInputsBuilder
fn clone(&self) -> TxInputsBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more