Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactor - use_chain_simulator builder method #1855

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion contracts/examples/adder/interact/src/basic_interact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion contracts/examples/ping-pong-egld/dapp/src/interactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion contracts/examples/ping-pong-egld/interactor/src/interact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
9 changes: 7 additions & 2 deletions framework/snippets/src/interactor/interactor_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();

Expand Down
5 changes: 3 additions & 2 deletions tools/interactor-system-func-calls/src/system_sc_interact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading