diff --git a/contracts/examples/multisig/interact/src/multisig_interact.rs b/contracts/examples/multisig/interact/src/multisig_interact.rs index c21a772003..3eb44ed228 100644 --- a/contracts/examples/multisig/interact/src/multisig_interact.rs +++ b/contracts/examples/multisig/interact/src/multisig_interact.rs @@ -145,7 +145,6 @@ impl MultisigInteract { .code(&self.multisig_code) .gas(NumExpr("100,000,000")) .returns(ReturnsNewBech32Address) - .prepare_async() .run() .await; @@ -202,7 +201,6 @@ impl MultisigInteract { .from(&self.wallet_address) .to(self.state.current_multisig_address()) .egld(BigUint::from(50_000_000_000_000_000u64)) // 0,05 or 5 * 10^16 - .prepare_async() .run() .await; } @@ -220,7 +218,6 @@ impl MultisigInteract { .gas(gas_expr) .typed(multisig_proxy::MultisigProxy) .perform_action_endpoint(action_id) - .prepare_async() .run() .await; @@ -273,7 +270,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .quorum_reached(action_id) .returns(ReturnsResult) - .prepare_async() .run() .await } @@ -285,7 +281,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .signed(signer, action_id) .returns(ReturnsResult) - .prepare_async() .run() .await } @@ -340,7 +335,6 @@ impl MultisigInteract { .gas(NumExpr("30,000,000")) .typed(multisig_proxy::MultisigProxy) .dns_register(dns_address, name) - .prepare_async() .run() .await; @@ -355,7 +349,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .quorum() .returns(ReturnsResult) - .prepare_async() .run() .await; @@ -370,7 +363,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .num_board_members() .returns(ReturnsResult) - .prepare_async() .run() .await; diff --git a/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs b/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs index 2efda8e4d6..e46411e776 100644 --- a/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs +++ b/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs @@ -50,7 +50,6 @@ impl MultisigInteract { .argument(&0u32), ) .returns(ReturnsResult) - .prepare_async() .run() .await; @@ -75,7 +74,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .perform_action_endpoint(action_id) .returns(ReturnsNewTokenIdentifier) - .prepare_async() .run() .await; self.collection_token_identifier = new_token_id.to_string(); @@ -102,7 +100,6 @@ impl MultisigInteract { .argument(&COLLECTION_TICKER), ) .returns(ReturnsResult) - .prepare_async() .run() .await; @@ -127,7 +124,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .perform_action_endpoint(action_id) .returns(ReturnsNewTokenIdentifier) - .prepare_async() .run() .await; self.collection_token_identifier = new_token_id; @@ -156,7 +152,6 @@ impl MultisigInteract { .argument(&"ESDTRoleNFTCreate"), ) .returns(ReturnsResult) - .prepare_async() .run() .await; diff --git a/contracts/examples/multisig/interact/src/multisig_interact_wegld.rs b/contracts/examples/multisig/interact/src/multisig_interact_wegld.rs index 7774bc02d4..2ed1a93b30 100644 --- a/contracts/examples/multisig/interact/src/multisig_interact_wegld.rs +++ b/contracts/examples/multisig/interact/src/multisig_interact_wegld.rs @@ -56,7 +56,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .propose_async_call(&self.config.wegld_address, WRAP_AMOUNT, function_call) .returns(ReturnsResult) - .prepare_async() .run() .await; @@ -72,7 +71,6 @@ impl MultisigInteract { .typed(wegld_proxy::EgldEsdtSwapProxy) .wrapped_egld_token_id() .returns(ReturnsResult) - .prepare_async() .run() .await; @@ -104,7 +102,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .propose_async_call(normalized_to, 0u64, normalized_data) .returns(ReturnsResult) - .prepare_async() .run() .await; diff --git a/contracts/examples/ping-pong-egld/dapp/src/interactor.rs b/contracts/examples/ping-pong-egld/dapp/src/interactor.rs index f8841141c0..ba5ca3f3f8 100644 --- a/contracts/examples/ping-pong-egld/dapp/src/interactor.rs +++ b/contracts/examples/ping-pong-egld/dapp/src/interactor.rs @@ -1,13 +1,10 @@ -use imports::{Address, Bech32Address, BytesValue}; -use multiversx_sc_snippets_dapp::*; +use multiversx_sc_snippets_dapp::imports::*; use serde::{Deserialize, Serialize}; -const GATEWAY: &str = sdk::core::gateway::DEVNET_GATEWAY; +const GATEWAY: &str = multiversx_sc_snippets_dapp::sdk::core::gateway::DEVNET_GATEWAY; const CONTRACT_ADDRESS: &str = "erd1qqqqqqqqqqqqqpgq6tqvj5f59xrgxwrtwy30elgpu7l4zrv6d8ssnjdwxq"; const PING_PONG_CODE: &[u8] = include_bytes!("../ping-pong-egld.wasm"); -use multiversx_sc_snippets_dapp::imports::*; - #[derive(Debug, Default, Serialize, Deserialize)] pub struct Config { gateway: String, diff --git a/contracts/examples/ping-pong-egld/dapp/src/requests/transaction.rs b/contracts/examples/ping-pong-egld/dapp/src/requests/transaction.rs index 3765ee63d6..a7629ea8e9 100644 --- a/contracts/examples/ping-pong-egld/dapp/src/requests/transaction.rs +++ b/contracts/examples/ping-pong-egld/dapp/src/requests/transaction.rs @@ -1,8 +1,5 @@ use crate::interactor::ContractInteract; -use multiversx_sc_snippets_dapp::imports::{ - Bech32Address, BigUint, IgnoreValue, InteractorPrepareAsync, OptionalValue, ReturnsMessage, - ReturnsNewBech32Address, ReturnsStatus, -}; +use multiversx_sc_snippets_dapp::imports::*; use super::proxy; @@ -29,7 +26,6 @@ pub async fn deploy_sc() -> Result { .returns(ReturnsNewBech32Address) .returns(ReturnsStatus) .returns(ReturnsMessage) - .prepare_async() .run() .await; @@ -57,7 +53,6 @@ pub async fn ping() -> Result { .typed(proxy::PingPongProxy) .ping(_data) .egld(BigUint::from(amount)) - .prepare_async() .run() .await; diff --git a/contracts/feature-tests/basic-features/interact/src/bf_interact.rs b/contracts/feature-tests/basic-features/interact/src/bf_interact.rs index b971818f2b..57d5e9bfe0 100644 --- a/contracts/feature-tests/basic-features/interact/src/bf_interact.rs +++ b/contracts/feature-tests/basic-features/interact/src/bf_interact.rs @@ -86,7 +86,6 @@ impl BasicFeaturesInteract { .code(&self.code_expr) .gas(NumExpr("4,000,000")) .returns(ReturnsNewBech32Address) - .prepare_async() .run() .await; @@ -103,7 +102,6 @@ impl BasicFeaturesInteract { .gas(NumExpr("600,000,000")) .typed(basic_features_proxy::BasicFeaturesProxy) .store_bytes(value) - .prepare_async() .run() .await; @@ -118,7 +116,6 @@ impl BasicFeaturesInteract { .typed(basic_features_proxy::BasicFeaturesProxy) .load_bytes() .returns(ReturnsResult) - .prepare_async() .run() .await; diff --git a/contracts/feature-tests/composability/interact/src/call_tree_calling_functions.rs b/contracts/feature-tests/composability/interact/src/call_tree_calling_functions.rs index 0cb35bdbec..0bd8797f05 100644 --- a/contracts/feature-tests/composability/interact/src/call_tree_calling_functions.rs +++ b/contracts/feature-tests/composability/interact/src/call_tree_calling_functions.rs @@ -124,7 +124,6 @@ impl ComposabilityInteract { .to(&root_addr) .typed(forwarder_queue_proxy::ForwarderQueueProxy) .forward_queued_calls() - .prepare_async() .run() .await; diff --git a/framework/meta-lib/src/contract/generate_snippets/snippet_sc_functions_gen.rs b/framework/meta-lib/src/contract/generate_snippets/snippet_sc_functions_gen.rs index d450decd82..b2b5a23d5b 100644 --- a/framework/meta-lib/src/contract/generate_snippets/snippet_sc_functions_gen.rs +++ b/framework/meta-lib/src/contract/generate_snippets/snippet_sc_functions_gen.rs @@ -65,7 +65,7 @@ fn write_deploy_method_impl(file: &mut File, init_abi: &EndpointAbi, name: &Stri .init({}) .code(&self.contract_code) .returns(ReturnsNewAddress) - .prepare_async() + .run() .await; let new_address_bech32 = bech32::encode(&new_address); @@ -101,7 +101,7 @@ fn write_upgrade_endpoint_impl(file: &mut File, upgrade_abi: &EndpointAbi, name: .code(&self.contract_code) .code_metadata(CodeMetadata::UPGRADEABLE) .returns(ReturnsNewAddress) - .prepare_async() + .run() .await; @@ -214,7 +214,7 @@ fn write_contract_call(file: &mut File, endpoint_abi: &EndpointAbi, name: &Strin .typed(proxy::{}Proxy) .{}({}){} .returns(ReturnsResultUnmanaged) - .prepare_async() + .run() .await; @@ -237,7 +237,7 @@ fn write_contract_query(file: &mut File, endpoint_abi: &EndpointAbi, name: &Stri .typed(proxy::{}Proxy) .{}({}) .returns(ReturnsResultUnmanaged) - .prepare_async() + .run() .await; diff --git a/framework/snippets-base/src/interactor_tx/interactor_prepare_async.rs b/framework/snippets-base/src/interactor_tx/interactor_prepare_async.rs index 8eae3f990e..fcb8f7a7d9 100644 --- a/framework/snippets-base/src/interactor_tx/interactor_prepare_async.rs +++ b/framework/snippets-base/src/interactor_tx/interactor_prepare_async.rs @@ -18,6 +18,10 @@ where pub trait InteractorPrepareAsync { type Exec; + #[deprecated( + since = "0.54.0", + note = "Calling `.prepare_async()` no longer necessary, `.run()` can be called directly." + )] fn prepare_async(self) -> Self::Exec; } diff --git a/framework/snippets-dapp/src/imports.rs b/framework/snippets-dapp/src/imports.rs index 2556622174..0f8f13ba35 100644 --- a/framework/snippets-dapp/src/imports.rs +++ b/framework/snippets-dapp/src/imports.rs @@ -1,9 +1,11 @@ pub use crate::multiversx_sc_scenario::imports::*; pub use multiversx_sc_snippets_base::{ - dns_address_for_name, InteractorBase, InteractorPrepareAsync, StepBuffer, + dns_address_for_name, InteractorBase, InteractorPrepareAsync, InteractorRunAsync, StepBuffer, }; pub use multiversx_sdk_dapp::{core::test_wallets, data::keystore::InsertPassword, wallet::Wallet}; +pub use crate::DappInteractor; + pub use env_logger; diff --git a/tools/interactor-system-func-calls/src/system_sc_interact.rs b/tools/interactor-system-func-calls/src/system_sc_interact.rs index 97d72beb01..10830eb072 100644 --- a/tools/interactor-system-func-calls/src/system_sc_interact.rs +++ b/tools/interactor-system-func-calls/src/system_sc_interact.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] // TODO: move prepare_async calls to a test for backwards compatibility and delete from here + mod system_sc_interact_cli; mod system_sc_interact_config; mod system_sc_interact_state;