pub struct TxInputsBuilder { /* private fields */ }

Implementations§

source§

impl TxInputsBuilder

source

pub fn new() -> Self

source

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

  1. mock witnesses have different lengths depending on the type which changes the expecting fee
  2. Witnesses are a set so we need to get rid of duplicates to avoid over-estimating the fee
source

pub 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.

!!! 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

source

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

source

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

source

pub fn add_bootstrap_input( &mut self, hash: &ByronAddress, input: &TransactionInput, amount: &Value )

source

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.

source

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

source

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

source

pub 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.

!!! 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

source

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

source

pub fn get_ref_inputs(&self) -> TransactionInputs

source

pub fn get_native_input_scripts(&self) -> Option<NativeScripts>

Returns a copy of the current script input witness scripts in the builder

source

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

source

pub fn len(&self) -> usize

source

pub fn add_required_signer(&mut self, key: &Ed25519KeyHash)

source

pub fn add_required_signers(&mut self, keys: &RequiredSigners)

source

pub fn total_value(&self) -> Result<Value, JsError>

source

pub fn inputs(&self) -> TransactionInputs

source

pub fn inputs_option(&self) -> Option<TransactionInputs>

Trait Implementations§

source§

impl Clone for TxInputsBuilder

source§

fn clone(&self) -> TxInputsBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TxInputsBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&TxInputsBuilder> for RequiredSignersSet

source§

fn from(inputs: &TxInputsBuilder) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V