diff --git a/contracts/examples/adder/interact/src/basic_interact.rs b/contracts/examples/adder/interact/src/basic_interact.rs index efdfc5d996..2acff49ecb 100644 --- a/contracts/examples/adder/interact/src/basic_interact.rs +++ b/contracts/examples/adder/interact/src/basic_interact.rs @@ -62,8 +62,9 @@ pub struct AdderInteract { impl AdderInteract { pub async fn init(config: Config) -> Self { - let mut interactor = Interactor::new(config.gateway_uri(), config.use_chain_simulator()) + let mut interactor = Interactor::new(config.gateway_uri()) .await + .use_chain_simulator(config.use_chain_simulator()) .with_tracer(INTERACTOR_SCENARIO_TRACE_PATH) .await; diff --git a/contracts/examples/multisig/interact/src/multisig_interact.rs b/contracts/examples/multisig/interact/src/multisig_interact.rs index 4006686c63..ab66377b24 100644 --- a/contracts/examples/multisig/interact/src/multisig_interact.rs +++ b/contracts/examples/multisig/interact/src/multisig_interact.rs @@ -86,8 +86,9 @@ struct MultisigInteract { impl MultisigInteract { async fn init() -> Self { let config = Config::load_config(); - let mut interactor = Interactor::new(config.gateway_uri(), config.use_chain_simulator()) + let mut interactor = Interactor::new(config.gateway_uri()) .await + .use_chain_simulator(config.use_chain_simulator()) .with_tracer(INTERACTOR_SCENARIO_TRACE_PATH) .await; interactor.set_current_dir_from_workspace("contracts/examples/multisig/interact"); diff --git a/contracts/examples/ping-pong-egld/dapp/src/interactor.rs b/contracts/examples/ping-pong-egld/dapp/src/interactor.rs index 659a05cce6..843540649e 100644 --- a/contracts/examples/ping-pong-egld/dapp/src/interactor.rs +++ b/contracts/examples/ping-pong-egld/dapp/src/interactor.rs @@ -42,7 +42,7 @@ pub struct ContractInteract { impl ContractInteract { pub async fn new() -> Self { let config = Config::new(); - let mut interactor = DappInteractor::new(&config.gateway, false).await; + let mut interactor = DappInteractor::new(&config.gateway).await; interactor.set_current_dir_from_workspace("contracts/examples/ping-pong-egld/dapp"); let wallet_address = interactor.register_wallet(test_wallets::mike()).await; diff --git a/contracts/examples/ping-pong-egld/interactor/src/interact.rs b/contracts/examples/ping-pong-egld/interactor/src/interact.rs index c2366de032..3ebee775b1 100644 --- a/contracts/examples/ping-pong-egld/interactor/src/interact.rs +++ b/contracts/examples/ping-pong-egld/interactor/src/interact.rs @@ -116,8 +116,9 @@ pub struct PingPongEgldInteract { impl PingPongEgldInteract { pub async fn init(config: Config) -> Self { - let mut interactor = Interactor::new(config.gateway_uri(), config.use_chain_simulator()) + let mut interactor = Interactor::new(config.gateway_uri()) .await + .use_chain_simulator(config.use_chain_simulator()) .with_tracer(INTERACTOR_SCENARIO_TRACE_PATH) .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 b54ef876d4..665fa24fc8 100644 --- a/contracts/feature-tests/basic-features/interact/src/bf_interact.rs +++ b/contracts/feature-tests/basic-features/interact/src/bf_interact.rs @@ -61,8 +61,9 @@ pub struct BasicFeaturesInteract { impl BasicFeaturesInteract { pub async fn init(config: Config) -> Self { - let mut interactor = Interactor::new(config.gateway_uri(), config.use_chain_simulator()) + let mut interactor = Interactor::new(config.gateway_uri()) .await + .use_chain_simulator(config.use_chain_simulator()) .with_tracer(INTERACTOR_SCENARIO_TRACE_PATH) .await; interactor diff --git a/contracts/feature-tests/composability/interact/src/comp_interact_controller.rs b/contracts/feature-tests/composability/interact/src/comp_interact_controller.rs index ca0e7ffb5e..8e480b76c1 100644 --- a/contracts/feature-tests/composability/interact/src/comp_interact_controller.rs +++ b/contracts/feature-tests/composability/interact/src/comp_interact_controller.rs @@ -16,8 +16,9 @@ pub struct ComposabilityInteract { impl ComposabilityInteract { pub async fn init() -> Self { let config = Config::load_config(); - let mut interactor = Interactor::new(config.gateway_uri(), config.use_chain_simulator()) + let mut interactor = Interactor::new(config.gateway_uri()) .await + .use_chain_simulator(config.use_chain_simulator()) .with_tracer(INTERACTOR_SCENARIO_TRACE_PATH) .await; interactor.set_current_dir_from_workspace("contracts/feature-tests/composability/interact"); diff --git a/framework/snippets/src/interactor/interactor_base.rs b/framework/snippets/src/interactor/interactor_base.rs index ea204adbc6..604051d7a0 100644 --- a/framework/snippets/src/interactor/interactor_base.rs +++ b/framework/snippets/src/interactor/interactor_base.rs @@ -37,12 +37,12 @@ where GatewayProxy: GatewayAsyncService, { /// Not yet changed for backwards compatibility. - pub async fn new(gateway_uri: &str, use_chain_simulator: bool) -> Self { + pub async fn new(gateway_uri: &str) -> Self { let proxy = GatewayProxy::from_uri(gateway_uri); let network_config = proxy.request(NetworkConfigRequest).await.unwrap(); Self { proxy, - use_chain_simulator, + use_chain_simulator: false, network_config, sender_map: HashMap::new(), waiting_time_ms: 0, @@ -52,6 +52,11 @@ where } } + pub fn use_chain_simulator(mut self, use_chain_simulator: bool) -> Self { + self.use_chain_simulator = use_chain_simulator; + self + } + pub async fn register_wallet(&mut self, wallet: Wallet) -> Address { let address = wallet.to_address(); 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 4300210269..97d3005c97 100644 --- a/tools/interactor-system-func-calls/src/system_sc_interact.rs +++ b/tools/interactor-system-func-calls/src/system_sc_interact.rs @@ -229,8 +229,9 @@ struct SysFuncCallsInteract { impl SysFuncCallsInteract { async fn init() -> Self { let config = Config::load_config(); - let mut interactor = - Interactor::new(config.gateway_uri(), config.use_chain_simulator()).await; + let mut interactor = Interactor::new(config.gateway_uri()) + .await + .use_chain_simulator(config.use_chain_simulator()); interactor.set_current_dir_from_workspace("tools/interactor-system-func-calls"); let wallet_address = interactor.register_wallet(test_wallets::alice()).await;