Struct PartialTransactionV2Builder

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

A builder for a SignedPartialTransactionV2.

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 PartialTransactionV2Builder

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(SubintentManifestV2Builder) -> SubintentManifestV2Builder, ) -> 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(SubintentManifestV2Builder, ManifestNameLookup) -> SubintentManifestV2Builder, ) -> 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: SubintentManifestV2) -> 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 create_subintent(&mut self) -> &SubintentV2

Source

pub fn create_prepared_subintent(&mut self) -> &PreparedSubintentV2

Source

pub fn subintent_hash(&mut self) -> SubintentHash

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 build(self) -> DetailedSignedPartialTransactionV2

Builds a DetailedSignedPartialTransactionV2, including the SignedPartialTransactionV2 and other useful data.

§Panics
  • Panics if any required part of the partial transaction has not been provided.
  • Panics if the built transaction cannot be prepared.

Unlike TransactionV2Builder, build() does not validate the partial transaction, to save lots duplicate work when building a full transaction from layers of partial transaction. If you wish, you can opt into validation with build_and_validate().

Source

pub fn build_and_validate(self) -> DetailedSignedPartialTransactionV2

Builds a DetailedSignedPartialTransactionV2, including the SignedPartialTransactionV2 and other useful data.

§Panics
  • Panics if any required part of the partial transaction has not been provided.
  • Panics if the built transaction does not pass validation with the latest validator.

You can use build() to skip this validation.

Source

pub fn build_minimal(self) -> SignedPartialTransactionV2

Builds the SignedPartialTransactionV2.

You may wish to use [build_detailed()][Self::build_detailed] to get the hashes, or to preserve the names used for manifest variables in the root and non-root subintents.

Unlike TransactionV2Builder, build() does not validate the partial transaction, to save lots duplicate work when building a full transaction from layers of partial transaction. If you wish, you can opt into validation with build_and_validate().

Source

pub fn build_minimal_and_validate(self) -> SignedPartialTransactionV2

Builds and validates the SignedPartialTransactionV2.

You may wish to use build() to get the hashes, or to preserve the names used for manifest variables in the root and non-root subintents.

§Panics

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

You can use build_minimal() to skip this validation.

Trait Implementations§

Source§

impl Clone for PartialTransactionV2Builder

Source§

fn clone(&self) -> PartialTransactionV2Builder

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 PartialTransactionV2Builder

Source§

fn default() -> PartialTransactionV2Builder

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.