PartialTransactionV2Builder

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() -> PartialTransactionV2Builder

Source

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

Source

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

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(ManifestBuilder<SubintentManifestV2>) -> ManifestBuilder<SubintentManifestV2>, ) -> PartialTransactionV2Builder

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(ManifestBuilder<SubintentManifestV2>, ManifestNameLookup) -> ManifestBuilder<SubintentManifestV2>, ) -> PartialTransactionV2Builder

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, ) -> PartialTransactionV2Builder

Panics:

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

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

Source

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

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>(self, signer: S) -> PartialTransactionV2Builder
where S: Signer,

Source

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

Source

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

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromBits<T> for T

Source§

fn from_bits(other: T) -> T

Convert other to Self, preserving bitwise representation
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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.