pub struct TransactionBuilder { /* private fields */ }

Implementations

This automatically selects and adds inputs from {inputs} consisting of just enough to cover the outputs that have already been added. This should be called after adding all certs/outputs/etc and will be an error otherwise. Uses CIP2: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0002/CIP-0002.md Adding a change output must be called after via TransactionBuilder::add_change_if_needed() This function, diverging from CIP2, takes into account fees and will attempt to add additional inputs to cover the minimum fees. This does not, however, set the txbuilder’s fee.

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

calculates how much the fee would increase if you added a given output

Add explicit output via a TransactionOutput object

calculates how much the fee would increase if you added a given output

Set explicit auxiliary data via an AuxiliaryData object It might contain some metadata plus native or Plutus scripts

Set explicit native scripts via a NativeScripts object

Set metadata using a GeneralTransactionMetadata object It will be set to the existing or new auxiliary data in this builder

Add a single metadatum using TransactionMetadatumLabel and TransactionMetadatum objects It will be securely added to existing or new metadata in this builder

Add a single JSON metadatum using a TransactionMetadatumLabel and a String It will be securely added to existing or new metadata in this builder

Add a single JSON metadatum using a TransactionMetadatumLabel, a String, and a MetadataJsonSchema object It will be securely added to existing or new metadata in this builder

Set explicit Mint object and the required witnesses to this builder it will replace any previously existing mint and mint scripts NOTE! Error will be returned in case a mint policy does not have a matching script

Returns a copy of the current mint state in the builder

Returns a copy of the current witness native scripts in the builder

Add a mint entry to this builder using a PolicyID and MintAssets object It will be securely added to existing or new Mint in this builder It will replace any existing mint assets with the same PolicyID

Add a mint entry to this builder using a PolicyID, AssetName, and Int object for amount It will be securely added to existing or new Mint in this builder It will replace any previous existing amount same PolicyID and AssetName

Add a mint entry together with an output to this builder Using a PolicyID, AssetName, Int for amount, Address, and Coin (BigNum) objects The asset will be securely added to existing or new Mint in this builder A new output will be added with the specified Address, the Coin value, and the minted asset

Add a mint entry together with an output to this builder Using a PolicyID, AssetName, Int for amount, and Address objects The asset will be securely added to existing or new Mint in this builder A new output will be added with the specified Address and the minted asset The output will be set to contain the minimum required amount of Coin

does not include refunds or withdrawals

withdrawals and refunds

Return explicit input plus implicit input plus mint minus burn

does not include fee

Warning: this function will mutate the /fee/ field Make sure to call this function last after setting all other tx-body properties Editing inputs, outputs, mint, etc. after change been calculated might cause a mismatch in calculated fee versus the required fee

Returns object the body of the new transaction Auxiliary data itself is not included You can use get_auxiliary_data or build_tx

Returns full Transaction object with the body and the auxiliary data NOTE: witness_set will contain all mint_scripts if any been added or set NOTE: is_valid set to true

warning: sum of all parts of a transaction must equal 0. You cannot just set the fee to the min value and forget about it warning: min_fee may be slightly larger than the actual minimum fee (ex: a few lovelaces) this is done to simplify the library code, but can be fixed later

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.