diff --git a/Cargo.lock b/Cargo.lock
index e1b410aedf..0834b88f90 100755
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2425,7 +2425,7 @@ dependencies = [
"log",
"multiversx-chain-scenario-format",
"multiversx-sc-scenario",
- "multiversx-sdk-reqwest",
+ "multiversx-sdk-http",
"serde_json",
"tokio",
]
@@ -2484,7 +2484,7 @@ dependencies = [
]
[[package]]
-name = "multiversx-sdk-reqwest"
+name = "multiversx-sdk-http"
version = "0.6.1"
dependencies = [
"anyhow",
diff --git a/Cargo.toml b/Cargo.toml
index b4412fb681..f052471768 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,7 +15,7 @@ members = [
"framework/wasm-adapter",
"sdk/core",
- "sdk/reqwest",
+ "sdk/http",
"sdk/wbg",
"sdk/scenario-format",
diff --git a/framework/snippets/Cargo.toml b/framework/snippets/Cargo.toml
index 92237a074e..a3a3011d45 100644
--- a/framework/snippets/Cargo.toml
+++ b/framework/snippets/Cargo.toml
@@ -29,9 +29,9 @@ path = "../scenario"
version = "0.23.0"
path = "../../sdk/scenario-format"
-[dependencies.multiversx-sdk-reqwest]
+[dependencies.multiversx-sdk-http]
version = "=0.6.1"
-path = "../../sdk/reqwest"
+path = "../../sdk/http"
[dev-dependencies]
serde_json = "1.0"
diff --git a/framework/snippets/src/account_tool.rs b/framework/snippets/src/account_tool.rs
index 7121d3d613..df51497df8 100644
--- a/framework/snippets/src/account_tool.rs
+++ b/framework/snippets/src/account_tool.rs
@@ -4,7 +4,7 @@ use multiversx_sc_scenario::{
imports::Bech32Address,
scenario_model::{Account, BytesKey, BytesValue, Scenario, SetStateStep, Step},
};
-use multiversx_sdk_reqwest::gateway::GatewayProxy;
+use multiversx_sdk_http::GatewayHttpProxy;
use std::collections::{BTreeMap, HashMap};
/// Called directly from CLI, from `sc-meta`.
@@ -16,7 +16,7 @@ pub async fn print_account_as_scenario_set_state(
use_chain_simulator: bool,
address_bech32_string: String,
) {
- let api = GatewayProxy::new(api_string, use_chain_simulator);
+ let api = GatewayHttpProxy::new(api_string, use_chain_simulator);
let address = Bech32Address::from_bech32_string(address_bech32_string);
let set_state = retrieve_account_as_scenario_set_state(&api, &address).await;
let scenario = build_scenario(set_state);
@@ -33,7 +33,7 @@ fn build_scenario(set_state: SetStateStep) -> Scenario {
}
pub async fn retrieve_account_as_scenario_set_state(
- api: &GatewayProxy,
+ api: &GatewayHttpProxy,
address: &Bech32Address,
) -> SetStateStep {
let sdk_address = Address::from_bech32_string(address.to_bech32_str()).unwrap();
diff --git a/framework/snippets/src/interactor.rs b/framework/snippets/src/interactor.rs
index 45825284db..bf1b517743 100644
--- a/framework/snippets/src/interactor.rs
+++ b/framework/snippets/src/interactor.rs
@@ -4,8 +4,7 @@ use multiversx_sc_scenario::{
mandos_system::{run_list::ScenarioRunnerList, run_trace::ScenarioTraceFile},
multiversx_sc::types::Address,
};
-// use multiversx_sdk_reqwest::core::{data::network_config::NetworkConfig, wallet::Wallet};
-use multiversx_sdk_reqwest::gateway::GatewayProxy;
+use multiversx_sdk_http::GatewayHttpProxy;
use std::{
collections::HashMap,
path::{Path, PathBuf},
@@ -17,7 +16,7 @@ use crate::{account_tool::retrieve_account_as_scenario_set_state, Sender};
pub const INTERACTOR_SCENARIO_TRACE_PATH: &str = "interactor_trace.scen.json";
pub struct Interactor {
- pub proxy: GatewayProxy,
+ pub proxy: GatewayHttpProxy,
pub network_config: NetworkConfig,
pub sender_map: HashMap
,
@@ -30,7 +29,7 @@ pub struct Interactor {
impl Interactor {
pub async fn new(gateway_uri: &str, use_chain_simulator: bool) -> Self {
- let proxy = GatewayProxy::new(gateway_uri.to_string(), use_chain_simulator);
+ let proxy = GatewayHttpProxy::new(gateway_uri.to_string(), use_chain_simulator);
let network_config = proxy.get_network_config().await.unwrap();
Self {
proxy,
diff --git a/framework/snippets/src/interactor_scenario/interactor_sc_call.rs b/framework/snippets/src/interactor_scenario/interactor_sc_call.rs
index 5677fb3ac6..112e5aba0e 100644
--- a/framework/snippets/src/interactor_scenario/interactor_sc_call.rs
+++ b/framework/snippets/src/interactor_scenario/interactor_sc_call.rs
@@ -5,7 +5,7 @@ use multiversx_sc_scenario::{
scenario::ScenarioRunner,
scenario_model::{ScCallStep, SetStateStep, TxCall},
};
-use multiversx_sdk_reqwest::core::{data::transaction::Transaction, utils::base64_encode};
+use multiversx_sdk_http::core::{data::transaction::Transaction, utils::base64_encode};
impl Interactor {
pub async fn sc_call(&mut self, mut sc_call_step: S)
diff --git a/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs b/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs
index 68f3427266..331af64752 100644
--- a/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs
+++ b/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs
@@ -5,7 +5,7 @@ use multiversx_sc_scenario::{
mandos_system::ScenarioRunner,
scenario_model::{ScDeployStep, SetStateStep},
};
-use multiversx_sdk_reqwest::core::{data::transaction::Transaction, utils::base64_encode};
+use multiversx_sdk_http::core::{data::transaction::Transaction, utils::base64_encode};
impl Interactor {
pub(crate) fn sc_deploy_to_blockchain_tx(&self, sc_deploy_step: &ScDeployStep) -> Transaction {
diff --git a/framework/snippets/src/interactor_scenario/interactor_vm_query.rs b/framework/snippets/src/interactor_scenario/interactor_vm_query.rs
index 81298894b1..e11d753fbb 100644
--- a/framework/snippets/src/interactor_scenario/interactor_vm_query.rs
+++ b/framework/snippets/src/interactor_scenario/interactor_vm_query.rs
@@ -8,7 +8,7 @@ use multiversx_sc_scenario::{
multiversx_sc::{abi::TypeAbiFrom, codec::TopDecodeMulti, types::ContractCall},
scenario_model::{ScQueryStep, TxResponse},
};
-use multiversx_sdk_reqwest::core::{data::vm::VMQueryInput, utils::base64_decode};
+use multiversx_sdk_http::core::{data::vm::VMQueryInput, utils::base64_decode};
impl Interactor {
pub async fn sc_query(&mut self, mut step: S) -> &mut Self
diff --git a/framework/snippets/src/lib.rs b/framework/snippets/src/lib.rs
index 2c1f37c5e3..d3e51792f2 100644
--- a/framework/snippets/src/lib.rs
+++ b/framework/snippets/src/lib.rs
@@ -6,7 +6,6 @@ mod interactor_sender;
mod interactor_tx;
mod multi;
pub mod network_response;
-// pub mod test_wallets;
pub use env_logger;
pub use hex;
@@ -17,8 +16,8 @@ pub use interactor_tx::*;
pub use log;
pub use multi::*;
pub use multiversx_sc_scenario::{self, multiversx_sc};
-pub use multiversx_sdk_reqwest::core as sdk_core;
-pub use multiversx_sdk_reqwest::core as sdk;
+pub use multiversx_sdk_http::core as sdk_core;
+pub use multiversx_sdk_http::core as sdk;
pub use tokio;
/// Imports normally needed in interactors, grouped together.
diff --git a/sdk/core/src/gateway.rs b/sdk/core/src/gateway.rs
index 7b40532231..3730381055 100644
--- a/sdk/core/src/gateway.rs
+++ b/sdk/core/src/gateway.rs
@@ -57,12 +57,12 @@ pub enum GatewayRequestType {
}
/// Models requests to the gateway.
-pub trait GatewayRequest {
+pub trait GatewayRequest: Send {
type Payload: serde::ser::Serialize + ?Sized;
type DecodedJson: serde::de::DeserializeOwned;
- type Result;
+ type Result: Send;
fn request_type(&self) -> GatewayRequestType;
@@ -74,3 +74,12 @@ pub trait GatewayRequest {
fn process_json(&self, decoded: Self::DecodedJson) -> anyhow::Result;
}
+
+pub trait GatewayAsyncService: Send {
+ fn request(
+ &self,
+ request: G,
+ ) -> impl std::future::Future