pub enum TestTransaction {
V1(TestIntentV1),
V2 {
root_intent: TestIntentV2,
subintents: Vec<TestIntentV2>,
},
}
Variants§
Implementations§
Source§impl TestTransaction
impl TestTransaction
Sourcepub fn new_v1_from_nonce(
manifest: TransactionManifestV1,
nonce: u32,
initial_proofs: BTreeSet<NonFungibleGlobalId>,
) -> TestTransaction
pub fn new_v1_from_nonce( manifest: TransactionManifestV1, nonce: u32, initial_proofs: BTreeSet<NonFungibleGlobalId>, ) -> TestTransaction
The nonce needs to be globally unique amongst test transactions on your ledger
pub fn new_from_any_manifest( any_manifest: AnyManifest, nonce: u32, initial_proofs: BTreeSet<NonFungibleGlobalId>, ) -> Result<TestTransaction, String>
pub fn new_v1( manifest: TransactionManifestV1, hash: Hash, initial_proofs: BTreeSet<NonFungibleGlobalId>, ) -> TestTransaction
Sourcepub fn new_v2_builder(nonce: u32) -> TestTransactionV2Builder
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);
pub fn prepare( self, settings: &PreparationSettingsV1, ) -> Result<PreparedTestTransaction, PrepareError>
Trait Implementations§
Source§impl<D> Decode<ManifestCustomValueKind, D> for TestTransactionwhere
D: Decoder<ManifestCustomValueKind>,
impl<D> Decode<ManifestCustomValueKind, D> for TestTransactionwhere
D: Decoder<ManifestCustomValueKind>,
Source§fn decode_body_with_value_kind(
decoder: &mut D,
value_kind: ValueKind<ManifestCustomValueKind>,
) -> Result<TestTransaction, DecodeError>
fn decode_body_with_value_kind( decoder: &mut D, value_kind: ValueKind<ManifestCustomValueKind>, ) -> Result<TestTransaction, DecodeError>
Decodes the type from the decoder, which should match a preloaded value kind. Read more
Source§impl<E> Encode<ManifestCustomValueKind, E> for TestTransactionwhere
E: Encoder<ManifestCustomValueKind>,
impl<E> Encode<ManifestCustomValueKind, E> for TestTransactionwhere
E: Encoder<ManifestCustomValueKind>,
Source§fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
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>
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
impl IntoExecutable for TestTransaction
type Error = PrepareError
fn into_executable( self, validator: &TransactionValidator, ) -> Result<ExecutableTransaction, <TestTransaction as IntoExecutable>::Error>
Source§fn into_executable_unwrap(self) -> ExecutableTransactionwhere
Self: Sized,
fn into_executable_unwrap(self) -> ExecutableTransactionwhere
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
impl SborEnum<ManifestCustomValueKind> for TestTransaction
fn get_discriminator(&self) -> u8
fn get_length(&self) -> usize
Auto Trait Implementations§
impl Freeze for TestTransaction
impl RefUnwindSafe for TestTransaction
impl Send for TestTransaction
impl Sync for TestTransaction
impl Unpin for TestTransaction
impl UnwindSafe for TestTransaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
type Error = <U as ContextualTryFrom<T>>::Error
type Context = <U as ContextualTryFrom<T>>::Context
fn contextual_try_into( self, context: &<U as ContextualTryFrom<T>>::Context, ) -> Result<U, <U as ContextualTryFrom<T>>::Error>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
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>
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)
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)
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
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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