TestTransaction

Enum TestTransaction 

Source
pub enum TestTransaction {
    V1(TestIntentV1),
    V2 {
        root_intent: TestIntentV2,
        subintents: Vec<TestIntentV2>,
    },
}

Variants§

§

V1(TestIntentV1)

§

V2

Fields

§root_intent: TestIntentV2
§subintents: Vec<TestIntentV2>

Implementations§

Source§

impl TestTransaction

Source

pub fn new_v1_from_nonce( manifest: TransactionManifestV1, nonce: u32, initial_proofs: BTreeSet<NonFungibleGlobalId>, ) -> Self

The nonce needs to be globally unique amongst test transactions on your ledger

Source

pub fn new_from_any_manifest( any_manifest: AnyManifest, nonce: u32, initial_proofs: BTreeSet<NonFungibleGlobalId>, ) -> Result<Self, String>

Source

pub fn new_v1( manifest: TransactionManifestV1, hash: Hash, initial_proofs: BTreeSet<NonFungibleGlobalId>, ) -> Self

Source

pub fn new_v2_builder(nonce: u32) -> TestTransactionV2Builder

§Example usage
let mut ledger = LedgerSimulatorBuilder::new().build();
let mut builder = TestTransaction::new_v2_builder(ledger.next_transaction_nonce());

let child = builder.add_subintent(
    ManifestBuilder::new_subintent_v2()
        .yield_to_parent(())
        .build(),
    [child_public_key.signature_proof()],
);

let transaction = builder.finish_with_root_intent(
    ManifestBuilder::new_v2()
        .use_child("child", child)
        .lock_standard_test_fee(account)
        .yield_to_child("child", ())
        .build(),
    [public_key.signature_proof()],
);

let receipt = ledger.execute_test_transaction(transaction);
Source

pub fn prepare( self, settings: &PreparationSettings, ) -> Result<PreparedTestTransaction, PrepareError>

Trait Implementations§

Source§

impl Categorize<ManifestCustomValueKind> for TestTransaction

Source§

impl<D: Decoder<ManifestCustomValueKind>> Decode<ManifestCustomValueKind, D> for TestTransaction

Source§

fn decode_body_with_value_kind( decoder: &mut D, value_kind: ValueKind<ManifestCustomValueKind>, ) -> Result<Self, DecodeError>

Decodes the type from the decoder, which should match a preloaded value kind. Read more
Source§

impl<E: Encoder<ManifestCustomValueKind>> Encode<ManifestCustomValueKind, E> for TestTransaction

Source§

fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>

Encodes the SBOR value’s kind to the encoder
Source§

fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>

Encodes the SBOR body of the type to the encoder. Read more
Source§

impl IntoExecutable for TestTransaction

Source§

type Error = PrepareError

Source§

fn into_executable( self, validator: &TransactionValidator, ) -> Result<ExecutableTransaction, Self::Error>

Source§

fn into_executable_unwrap(self) -> ExecutableTransaction
where Self: Sized,

For use in tests as a quick mechanism to get an executable. Validates with a network-independent validator, using the latest settings.
Source§

impl SborEnum<ManifestCustomValueKind> for TestTransaction

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, 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, 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.
Source§

impl<T> ManifestCategorize for T

Source§

impl<T> ManifestDecode for T

Source§

impl<T> ManifestEncode for T

Source§

impl<T> ManifestSborEnum for T

Source§

impl<X, T> VecDecode<X> for T
where X: CustomValueKind, T: for<'a> Decode<X, VecDecoder<'a, X>>,

Source§

impl<X, T> VecEncode<X> for T
where X: CustomValueKind, T: for<'a> Encode<X, VecEncoder<'a, X>> + ?Sized,