pub struct TestEnv {
pub cluster: TestCluster,
pub rgp: u64,
pub chain_id: ChainIdentifier,
pub gas_objects: BTreeMap<SuiAddress, Vec<ObjectRef>>,
/* private fields */
}Fields§
§cluster: TestCluster§rgp: u64§chain_id: ChainIdentifier§gas_objects: BTreeMap<SuiAddress, Vec<ObjectRef>>Implementations§
Source§impl TestEnv
impl TestEnv
pub async fn update_all_gas(&mut self)
pub async fn fund_one_address_balance( &mut self, address: SuiAddress, amount: u64, )
pub async fn fund_all_address_balances(&mut self, amount: u64)
pub fn get_sender(&self, index: usize) -> SuiAddress
pub fn get_sender_and_gas(&self, index: usize) -> (SuiAddress, ObjectRef)
pub fn get_sender_and_all_gas( &self, index: usize, ) -> (SuiAddress, Vec<ObjectRef>)
pub fn get_all_senders(&self) -> Vec<SuiAddress>
pub fn get_gas_for_sender(&self, sender: SuiAddress) -> Vec<ObjectRef> ⓘ
pub fn tx_builder(&self, sender: SuiAddress) -> TestTransactionBuilder
pub fn tx_builder_with_gas( &self, sender: SuiAddress, gas: ObjectRef, ) -> TestTransactionBuilder
pub fn tx_builder_with_gas_objects( &self, sender: SuiAddress, gas_objects: Vec<ObjectRef>, ) -> TestTransactionBuilder
pub async fn exec_tx_directly( &mut self, tx: TransactionData, ) -> SuiResult<(TransactionDigest, TransactionEffects)>
pub async fn setup_test_package(&mut self, path: impl AsRef<Path>) -> ObjectID
pub async fn setup_custom_coin(&mut self) -> (SuiAddress, TypeTag)
Sourcepub async fn setup_mintable_coin(
&mut self,
) -> (SuiAddress, ObjectID, TypeTag, ObjectRef)
pub async fn setup_mintable_coin( &mut self, ) -> (SuiAddress, ObjectID, TypeTag, ObjectRef)
Publish the coins package and return (publisher, package_id, coin_type, treasury_cap_ref). The MINTABLE_COIN TreasuryCap is unfrozen so new Coin objects can be minted.
Sourcepub async fn mint_coin(
&mut self,
publisher: SuiAddress,
package_id: ObjectID,
treasury_cap_ref: ObjectRef,
amount: u64,
recipient: SuiAddress,
) -> (ObjectRef, ObjectRef)
pub async fn mint_coin( &mut self, publisher: SuiAddress, package_id: ObjectID, treasury_cap_ref: ObjectRef, amount: u64, recipient: SuiAddress, ) -> (ObjectRef, ObjectRef)
Mint a Coin<T> of the given amount to the recipient using the TreasuryCap.
Returns the updated TreasuryCap ref and the new Coin object ref.
pub fn encode_coin_reservation( &self, sender: SuiAddress, epoch: u64, amount: u64, ) -> ObjectRef
pub fn encode_coin_reservation_for_type( &self, sender: SuiAddress, epoch: u64, amount: u64, coin_type: TypeTag, ) -> ObjectRef
Sourcepub async fn transfer_from_coin_to_address_balance(
&mut self,
sender: SuiAddress,
coin: ObjectRef,
amounts_and_recipients: Vec<(u64, SuiAddress)>,
) -> SuiResult<(TransactionDigest, TransactionEffects)>
pub async fn transfer_from_coin_to_address_balance( &mut self, sender: SuiAddress, coin: ObjectRef, amounts_and_recipients: Vec<(u64, SuiAddress)>, ) -> SuiResult<(TransactionDigest, TransactionEffects)>
Transfer a portion of a coin to one or more addresses.
Sourcepub async fn transfer_coin_to_address_balance(
&mut self,
sender: SuiAddress,
coin: ObjectRef,
recipient: SuiAddress,
) -> SuiResult<(TransactionDigest, TransactionEffects)>
pub async fn transfer_coin_to_address_balance( &mut self, sender: SuiAddress, coin: ObjectRef, recipient: SuiAddress, ) -> SuiResult<(TransactionDigest, TransactionEffects)>
Transfer the entire coin to a single address.
pub fn verify_accumulator_exists( &self, owner: SuiAddress, expected_balance: u64, )
Sourcepub fn verify_accumulator_object_count(&self, expected_object_count: u64)
pub fn verify_accumulator_object_count(&self, expected_object_count: u64)
Verify the accumulator object count after settlement.
Sourcepub fn get_sui_balance_ab(&self, owner: SuiAddress) -> u64
pub fn get_sui_balance_ab(&self, owner: SuiAddress) -> u64
Get the balance of the owner’s SUI address balance.
pub async fn get_coin_balance(&self, object_id: ObjectID) -> u64
Sourcepub fn get_balance_ab(&self, owner: SuiAddress, coin_type: TypeTag) -> u64
pub fn get_balance_ab(&self, owner: SuiAddress, coin_type: TypeTag) -> u64
Get the balance of the owner’s address balance for a given coin type.
Sourcepub async fn get_sui_balance(&self, owner: SuiAddress) -> u64
pub async fn get_sui_balance(&self, owner: SuiAddress) -> u64
Get the total balance of SUI owned by the address (including address balance and coins).
Sourcepub async fn get_balance_for_coin_type(
&self,
owner: SuiAddress,
coin_type: TypeTag,
) -> u64
pub async fn get_balance_for_coin_type( &self, owner: SuiAddress, coin_type: TypeTag, ) -> u64
Get the total balance of a given coin type owned by the address (including address balance and coins).
pub fn verify_accumulator_removed(&self, owner: SuiAddress)
pub async fn trigger_reconfiguration(&self)
pub fn create_gasless_transaction( &self, amount: u64, token_type: TypeTag, sender: SuiAddress, recipient: SuiAddress, nonce: u32, epoch: u64, ) -> TransactionData
pub fn gasless_transaction_data( &self, tx_kind: TransactionKind, sender: SuiAddress, nonce: u32, epoch: u64, ) -> TransactionData
Sourcepub async fn setup_funded_object_balance_vault(
&mut self,
amount: u64,
) -> (ObjectID, ObjectID)
pub async fn setup_funded_object_balance_vault( &mut self, amount: u64, ) -> (ObjectID, ObjectID)
Publishes the object_balance example package, creates an owned vault object,
and funds it with the given amount. Returns (package_id, vault_id).
Sourcepub async fn publish_trusted_coin(
&mut self,
sender: SuiAddress,
) -> (ObjectID, TypeTag, ObjectRef)
pub async fn publish_trusted_coin( &mut self, sender: SuiAddress, ) -> (ObjectID, TypeTag, ObjectRef)
Publish the trusted_coin package and return (package_id, coin_type, treasury_cap).
Sourcepub async fn mint_trusted_coin(
&mut self,
sender: SuiAddress,
package_id: ObjectID,
treasury_cap: ObjectRef,
amount: u64,
) -> (ObjectRef, ObjectRef)
pub async fn mint_trusted_coin( &mut self, sender: SuiAddress, package_id: ObjectID, treasury_cap: ObjectRef, amount: u64, ) -> (ObjectRef, ObjectRef)
Mint a trusted coin. Returns (coin_ref, updated_treasury_cap).
Sourcepub async fn transfer_coin(
&mut self,
sender: SuiAddress,
coin: ObjectRef,
recipient: SuiAddress,
)
pub async fn transfer_coin( &mut self, sender: SuiAddress, coin: ObjectRef, recipient: SuiAddress, )
Transfer a coin to recipient.
Sourcepub async fn transfer_sui(
&mut self,
sender: SuiAddress,
recipient: SuiAddress,
amount: u64,
)
pub async fn transfer_sui( &mut self, sender: SuiAddress, recipient: SuiAddress, amount: u64, )
Transfer SUI from sender’s gas to recipient.
Sourcepub async fn transfer_sui_to_address_balance(
&mut self,
sender: SuiAddress,
recipient: SuiAddress,
amount: u64,
)
pub async fn transfer_sui_to_address_balance( &mut self, sender: SuiAddress, recipient: SuiAddress, amount: u64, )
Transfer SUI from sender’s gas to recipient’s address balance.
Sourcepub async fn publish_trusted_coin_and_setup(
&mut self,
funder: SuiAddress,
recipient: SuiAddress,
config: &CoinTypeConfig,
coin_amount: u64,
) -> (ObjectID, TypeTag)
pub async fn publish_trusted_coin_and_setup( &mut self, funder: SuiAddress, recipient: SuiAddress, config: &CoinTypeConfig, coin_amount: u64, ) -> (ObjectID, TypeTag)
Convenience: publish trusted_coin and set up coins for recipient per config.
Sourcepub async fn publish_and_mint_trusted_coin(
&mut self,
sender: SuiAddress,
amount: u64,
) -> (ObjectID, TypeTag)
pub async fn publish_and_mint_trusted_coin( &mut self, sender: SuiAddress, amount: u64, ) -> (ObjectID, TypeTag)
Legacy: publish trusted_coin with one real coin and address balance for sender.
Auto Trait Implementations§
impl !Freeze for TestEnv
impl !RefUnwindSafe for TestEnv
impl Send for TestEnv
impl Sync for TestEnv
impl Unpin for TestEnv
impl !UnwindSafe for TestEnv
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
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§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a Request§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.