Struct TransactionV2Builder

Source
pub struct TransactionV2Builder { /* private fields */ }
Expand description

A builder for a NotarizedTransactionV2.

This should be used in the following order:

The error messages aren’t great if used out of order. In future, this may become a state-machine style builder, to catch more errors at compile time.

Implementations§

Source§

impl TransactionV2Builder

Source

pub fn new() -> Self

Source

pub fn then(self, next: impl FnOnce(Self) -> Self) -> Self

Source

pub fn add_signed_child( self, name: impl AsRef<str>, signed_partial_transaction: impl ResolvableSignedPartialTransaction, ) -> Self

When used with the manifest_builder method, the provided name and hash are provided automatically via use_child at the start of manifest creation.

When used with the manifest method, the provided name is simply ignored - names are returned from the provided manifest.

Source

pub fn manifest_builder( self, build_manifest: impl FnOnce(TransactionManifestV2Builder) -> TransactionManifestV2Builder, ) -> Self

If the intent has any children, you should call add_signed_child first. These children will get added to the manifest for you, with the corresponding names.

You may also want to try manifest_builder_with_lookup.

Source

pub fn manifest_builder_with_lookup( self, build_manifest: impl FnOnce(TransactionManifestV2Builder, ManifestNameLookup) -> TransactionManifestV2Builder, ) -> Self

If the intent has any children, you should call add_signed_child first. These children will get added to the manifest for you, with the corresponding names.

Source

pub fn manifest(self, manifest: TransactionManifestV2) -> Self

§Panics:
  • If called with a manifest which references different children to those provided by add_signed_child.
Source

pub fn message(self, message: MessageV2) -> Self

Source

pub fn intent_header(self, intent_header: IntentHeaderV2) -> Self

Source

pub fn transaction_header(self, transaction_header: TransactionHeaderV2) -> Self

Source

pub fn create_intent_and_subintent_info(&mut self) -> &TransactionIntentV2

Source

pub fn create_prepared_intent(&mut self) -> &PreparedTransactionIntentV2

Source

pub fn intent_hash(&mut self) -> TransactionIntentHash

Source

pub fn sign<S: Signer>(self, signer: S) -> Self

Source

pub fn multi_sign<S: Signer>(self, signers: impl IntoIterator<Item = S>) -> Self

Source

pub fn add_signature(self, signature: SignatureWithPublicKeyV1) -> Self

Source

pub fn create_signed_transaction_intent(&mut self) -> &SignedTransactionIntentV2

Source

pub fn create_prepared_signed_transaction_intent( &mut self, ) -> &PreparedSignedTransactionIntentV2

Source

pub fn notarize<S: Signer>(self, signer: &S) -> Self

Source

pub fn notary_signature(self, signature: SignatureV1) -> Self

Source

pub fn build_preview_transaction( &mut self, transaction_intent_signer_keys: impl IntoIterator<Item = PublicKey>, ) -> PreviewTransactionV2

Creates a PreviewTransactionV2. For all non-root subintents, existing signatures are converted into the corresponding public key.

§Panics
  • Panics if any subintent signatures are not recoverable. Untrusted partial transactions should be validated before using in the transaction builder.
  • If the resulting preview transaction could not be validated.
Source

pub fn build_preview_transaction_no_validate( &mut self, transaction_intent_signer_keys: impl IntoIterator<Item = PublicKey>, ) -> PreviewTransactionV2

Creates a PreviewTransactionV2. For all non-root subintents, existing signatures are converted into the corresponding public key.

§Panics
  • Panics if any subintent signatures are not recoverable. Untrusted partial transactions should be validated before using in the transaction builder.
Source

pub fn build_no_validate(self) -> DetailedNotarizedTransactionV2

Builds a DetailedNotarizedTransactionV2, including the NotarizedTransactionV2 and other useful data.

§Panics
  • If the builder has not been notarized
  • If the transaction is not preparable against latest settings (e.g. it is too big)
Source

pub fn build(self) -> DetailedNotarizedTransactionV2

Builds and validates a DetailedNotarizedTransactionV2, which includes a NotarizedTransactionV2 and other useful data.

§Panics
  • Panics if the built transaction does not pass validation with the latest validator.

You can use build_no_validate() to skip this validation.

Source

pub fn build_minimal_no_validate(self) -> NotarizedTransactionV2

Builds the NotarizedTransactionV2, with no validation.

Source

pub fn build_minimal(self) -> NotarizedTransactionV2

Builds and validates the NotarizedTransactionV2.

You may prefer build() instead if you need the transaction hashes, or wish to keep a record of the names used in the manifest variables.

§Panics

Panics if the built transaction does not pass validation with the latest validator.

You can use build_minimal_no_validate() to skip this validation.

Trait Implementations§

Source§

impl Clone for TransactionV2Builder

Source§

fn clone(&self) -> TransactionV2Builder

Returns a duplicate 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 Default for TransactionV2Builder

Source§

fn default() -> TransactionV2Builder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, U> ContextualTryInto<U> for T
where U: ContextualTryFrom<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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<X, Y> LabelledResolve<Y> for X
where Y: LabelledResolveFrom<X>,

Source§

fn labelled_resolve( self, resolver: &impl LabelResolver<<Y as LabelledResolvable>::ResolverOutput>, ) -> Y

Source§

impl<X, Y> Resolve<Y> for X
where Y: ResolveFrom<X>,

Source§

fn resolve(self) -> Y

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.