diff --git a/Cargo.lock b/Cargo.lock
index fb08c18c3e..ec245b66b9 100755
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2076,6 +2076,7 @@ dependencies = [
"hex",
"hmac",
"itertools",
+ "log",
"pbkdf2",
"pem",
"rand 0.8.5",
diff --git a/framework/snippets/src/account_tool.rs b/framework/snippets/src/account_tool.rs
index 70eaafdace..b10baf4a80 100644
--- a/framework/snippets/src/account_tool.rs
+++ b/framework/snippets/src/account_tool.rs
@@ -4,8 +4,8 @@ use multiversx_sc_scenario::{
scenario_model::{Account, BytesKey, BytesValue, Scenario, SetStateStep, Step},
};
use multiversx_sdk::{
- blockchain::CommunicationProxy,
data::{address::Address, esdt::EsdtBalance},
+ gateway::GatewayProxy,
};
use std::collections::{BTreeMap, HashMap};
@@ -17,7 +17,7 @@ pub async fn print_account_as_scenario_set_state(
api_string: String,
address_bech32_string: String,
) {
- let api = CommunicationProxy::new(api_string);
+ let api = GatewayProxy::new(api_string);
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);
@@ -34,7 +34,7 @@ fn build_scenario(set_state: SetStateStep) -> Scenario {
}
pub async fn retrieve_account_as_scenario_set_state(
- api: &CommunicationProxy,
+ api: &GatewayProxy,
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 82c59752f6..bb38873afe 100644
--- a/framework/snippets/src/interactor.rs
+++ b/framework/snippets/src/interactor.rs
@@ -5,8 +5,8 @@ use multiversx_sc_scenario::{
scenario_model::AddressValue,
};
use multiversx_sdk::{
- blockchain::CommunicationProxy,
data::{address::Address as ErdrsAddress, network_config::NetworkConfig},
+ gateway::GatewayProxy,
wallet::Wallet,
};
use std::{
@@ -20,7 +20,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: CommunicationProxy,
+ pub proxy: GatewayProxy,
pub network_config: NetworkConfig,
pub sender_map: HashMap
,
@@ -33,7 +33,7 @@ pub struct Interactor {
impl Interactor {
pub async fn new(gateway_url: &str) -> Self {
- let proxy = CommunicationProxy::new(gateway_url.to_string());
+ let proxy = GatewayProxy::new(gateway_url.to_string());
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 061005ea13..6802304ae9 100644
--- a/framework/snippets/src/interactor_scenario/interactor_sc_call.rs
+++ b/framework/snippets/src/interactor_scenario/interactor_sc_call.rs
@@ -14,7 +14,7 @@ impl Interactor {
{
let sc_call_step = sc_call_step.as_mut();
let tx_hash = self.launch_sc_call(sc_call_step).await;
- let tx = self.retrieve_tx_on_network(tx_hash.clone()).await;
+ let tx = self.proxy.retrieve_tx_on_network(tx_hash.clone()).await;
sc_call_step.save_response(network_response::parse_tx_response(tx));
diff --git a/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs b/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs
index 529efc38bb..59de249e83 100644
--- a/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs
+++ b/framework/snippets/src/interactor_scenario/interactor_sc_deploy.rs
@@ -53,7 +53,7 @@ impl Interactor {
{
let sc_deploy_step = sc_deploy_step.as_mut();
let tx_hash = self.launch_sc_deploy(sc_deploy_step).await;
- let tx = self.retrieve_tx_on_network(tx_hash.clone()).await;
+ let tx = self.proxy.retrieve_tx_on_network(tx_hash.clone()).await;
let addr = sc_deploy_step.tx.from.clone();
let nonce = tx.nonce;
diff --git a/framework/snippets/src/interactor_scenario/interactor_transfer.rs b/framework/snippets/src/interactor_scenario/interactor_transfer.rs
index 2e99372b0f..6557e4119f 100644
--- a/framework/snippets/src/interactor_scenario/interactor_transfer.rs
+++ b/framework/snippets/src/interactor_scenario/interactor_transfer.rs
@@ -14,7 +14,7 @@ impl Interactor {
println!("transfer tx hash: {tx_hash}");
info!("transfer tx hash: {}", tx_hash);
- self.retrieve_tx_on_network(tx_hash.clone()).await;
+ self.proxy.retrieve_tx_on_network(tx_hash.clone()).await;
self.post_runners.run_transfer_step(&transfer_step);
diff --git a/framework/snippets/src/lib.rs b/framework/snippets/src/lib.rs
index 6240a9f152..7d3b52c696 100644
--- a/framework/snippets/src/lib.rs
+++ b/framework/snippets/src/lib.rs
@@ -1,7 +1,6 @@
pub mod account_tool;
mod interactor;
mod interactor_dns;
-mod interactor_retrieve;
mod interactor_scenario;
mod interactor_sender;
mod interactor_tx;
diff --git a/framework/snippets/src/multi/interactor_multi_sc_process.rs b/framework/snippets/src/multi/interactor_multi_sc_process.rs
index f19dcfb171..3364a4d5ee 100644
--- a/framework/snippets/src/multi/interactor_multi_sc_process.rs
+++ b/framework/snippets/src/multi/interactor_multi_sc_process.rs
@@ -31,7 +31,7 @@ impl Interactor {
.expect("failed to send transaction");
println!("process tx hash: {tx_hash} with nonce: {}", tx.nonce);
- futures.push(self.retrieve_tx_on_network(tx_hash.clone()));
+ futures.push(self.proxy.retrieve_tx_on_network(tx_hash.clone()));
}
join_all(futures).await
diff --git a/sdk/core/Cargo.toml b/sdk/core/Cargo.toml
index 319c81b137..c8bf3c75fb 100644
--- a/sdk/core/Cargo.toml
+++ b/sdk/core/Cargo.toml
@@ -34,3 +34,4 @@ zeroize = "1.4.2"
bech32 = "0.9"
itertools = "0.12.0"
pem = "3.0.2"
+log = "0.4.17"
diff --git a/sdk/core/examples/account.rs b/sdk/core/examples/account.rs
index 2ad1d6c4cc..5e9456f4b0 100644
--- a/sdk/core/examples/account.rs
+++ b/sdk/core/examples/account.rs
@@ -1,6 +1,6 @@
use multiversx_sdk::{
- blockchain::{CommunicationProxy, DEVNET_GATEWAY},
data::address::Address,
+ gateway::{GatewayProxy, DEVNET_GATEWAY},
};
#[tokio::main]
@@ -10,7 +10,7 @@ async fn main() {
)
.unwrap();
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let account = blockchain.get_account(&addr).await.unwrap();
println!("account: {account:#?}");
diff --git a/sdk/core/examples/account_storage.rs b/sdk/core/examples/account_storage.rs
index 31adc7d0f9..7693c26e08 100644
--- a/sdk/core/examples/account_storage.rs
+++ b/sdk/core/examples/account_storage.rs
@@ -1,6 +1,6 @@
use multiversx_sdk::{
- blockchain::{CommunicationProxy, DEVNET_GATEWAY},
data::address::Address,
+ gateway::{GatewayProxy, DEVNET_GATEWAY},
};
#[tokio::main]
@@ -10,7 +10,7 @@ async fn main() {
)
.unwrap();
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let account_storage = blockchain.get_account_storage_keys(&addr).await.unwrap();
println!("Account Storage: {account_storage:#?}");
diff --git a/sdk/core/examples/get_esdt_tokens.rs b/sdk/core/examples/get_esdt_tokens.rs
index faa4debfba..fac424da27 100644
--- a/sdk/core/examples/get_esdt_tokens.rs
+++ b/sdk/core/examples/get_esdt_tokens.rs
@@ -1,6 +1,6 @@
use multiversx_sdk::{
- blockchain::{CommunicationProxy, DEVNET_GATEWAY},
data::address::Address,
+ gateway::{GatewayProxy, DEVNET_GATEWAY},
};
#[tokio::main]
@@ -10,7 +10,7 @@ async fn main() {
)
.unwrap();
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let balances = blockchain.get_account_esdt_tokens(&addr).await.unwrap();
println!("{balances:#?}");
diff --git a/sdk/core/examples/get_hyper_block_by_hash.rs b/sdk/core/examples/get_hyper_block_by_hash.rs
index c67b479767..1d7f969ce1 100644
--- a/sdk/core/examples/get_hyper_block_by_hash.rs
+++ b/sdk/core/examples/get_hyper_block_by_hash.rs
@@ -1,8 +1,8 @@
-use multiversx_sdk::blockchain::{CommunicationProxy, DEVNET_GATEWAY};
+use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY};
#[tokio::main]
async fn main() {
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let result = blockchain
.get_hyper_block_by_hash("20b14ba0e68c465810c5ded091f220e51dad41629d7ccd87dab572206185e419")
.await;
diff --git a/sdk/core/examples/get_hyper_block_by_nonce.rs b/sdk/core/examples/get_hyper_block_by_nonce.rs
index c3d270d2bc..575255d6c9 100644
--- a/sdk/core/examples/get_hyper_block_by_nonce.rs
+++ b/sdk/core/examples/get_hyper_block_by_nonce.rs
@@ -1,8 +1,8 @@
-use multiversx_sdk::blockchain::{CommunicationProxy, DEVNET_GATEWAY};
+use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY};
#[tokio::main]
async fn main() {
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let result = blockchain.get_hyper_block_by_nonce(7468).await;
println!("block by nonce result: {result:?}")
diff --git a/sdk/core/examples/get_hyper_block_latest.rs b/sdk/core/examples/get_hyper_block_latest.rs
index b9ad946829..934358fdbf 100644
--- a/sdk/core/examples/get_hyper_block_latest.rs
+++ b/sdk/core/examples/get_hyper_block_latest.rs
@@ -1,8 +1,8 @@
-use multiversx_sdk::blockchain::{CommunicationProxy, DEVNET_GATEWAY};
+use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY};
#[tokio::main]
async fn main() {
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let result = blockchain.get_latest_hyper_block_nonce(false).await;
println!("latest block result: {result:?}")
diff --git a/sdk/core/examples/get_network_config.rs b/sdk/core/examples/get_network_config.rs
index 7ca699b3c8..d53e0e7ce1 100644
--- a/sdk/core/examples/get_network_config.rs
+++ b/sdk/core/examples/get_network_config.rs
@@ -1,8 +1,8 @@
-use multiversx_sdk::blockchain::{CommunicationProxy, DEVNET_GATEWAY};
+use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY};
#[tokio::main]
async fn main() {
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let network_config = blockchain.get_network_config().await.unwrap();
println!("network_config: {network_config:#?}")
diff --git a/sdk/core/examples/get_network_economics.rs b/sdk/core/examples/get_network_economics.rs
index e562f3db46..bb0410c8f0 100644
--- a/sdk/core/examples/get_network_economics.rs
+++ b/sdk/core/examples/get_network_economics.rs
@@ -1,8 +1,8 @@
-use multiversx_sdk::blockchain::{CommunicationProxy, DEVNET_GATEWAY};
+use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY};
#[tokio::main]
async fn main() {
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let network_economics = blockchain.get_network_economics().await.unwrap();
println!("network_economics: {network_economics:#?}")
diff --git a/sdk/core/examples/sign_tx.rs b/sdk/core/examples/sign_tx.rs
index 1455061830..aa3f977321 100644
--- a/sdk/core/examples/sign_tx.rs
+++ b/sdk/core/examples/sign_tx.rs
@@ -1,6 +1,6 @@
use multiversx_sdk::{
- blockchain::{CommunicationProxy, DEVNET_GATEWAY},
data::transaction::Transaction,
+ gateway::{GatewayProxy, DEVNET_GATEWAY},
wallet::Wallet,
};
@@ -11,7 +11,7 @@ async fn main() {
)
.unwrap();
let addr = wl.address();
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let network_config = blockchain.get_network_config().await.unwrap();
let arg = blockchain
diff --git a/sdk/core/examples/sign_txs.rs b/sdk/core/examples/sign_txs.rs
index 6a4a12a231..2860d528f7 100644
--- a/sdk/core/examples/sign_txs.rs
+++ b/sdk/core/examples/sign_txs.rs
@@ -1,6 +1,6 @@
use multiversx_sdk::{
- blockchain::{CommunicationProxy, DEVNET_GATEWAY},
data::transaction::Transaction,
+ gateway::{GatewayProxy, DEVNET_GATEWAY},
wallet::Wallet,
};
@@ -11,7 +11,7 @@ async fn main() {
)
.unwrap();
let addr = wl.address();
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let network_config = blockchain.get_network_config().await.unwrap();
let arg = blockchain
diff --git a/sdk/core/examples/tx_cost.rs b/sdk/core/examples/tx_cost.rs
index b98cbd2e4b..a982b130ec 100644
--- a/sdk/core/examples/tx_cost.rs
+++ b/sdk/core/examples/tx_cost.rs
@@ -1,6 +1,6 @@
use multiversx_sdk::{
- blockchain::{CommunicationProxy, DEVNET_GATEWAY},
data::{address::Address, transaction::Transaction},
+ gateway::{GatewayProxy, DEVNET_GATEWAY},
utils::base64_encode,
};
@@ -26,7 +26,7 @@ async fn main() {
signature: None,
};
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let cost = blockchain.request_transaction_cost(&tx).await.unwrap();
println!("tx cost: {cost:#?}");
diff --git a/sdk/core/examples/tx_default_args.rs b/sdk/core/examples/tx_default_args.rs
index dad593eaf8..01b91aa5a6 100644
--- a/sdk/core/examples/tx_default_args.rs
+++ b/sdk/core/examples/tx_default_args.rs
@@ -1,11 +1,11 @@
use multiversx_sdk::{
- blockchain::{CommunicationProxy, DEVNET_GATEWAY},
data::address::Address,
+ gateway::{GatewayProxy, DEVNET_GATEWAY},
};
#[tokio::main]
async fn main() {
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let network_config = blockchain.get_network_config().await.unwrap();
let addr = Address::from_bech32_string(
"erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts",
diff --git a/sdk/core/examples/tx_info.rs b/sdk/core/examples/tx_info.rs
index 33c929be50..f7126daca9 100644
--- a/sdk/core/examples/tx_info.rs
+++ b/sdk/core/examples/tx_info.rs
@@ -1,9 +1,9 @@
-use multiversx_sdk::blockchain::{CommunicationProxy, DEVNET_GATEWAY};
+use multiversx_sdk::gateway::{GatewayProxy, DEVNET_GATEWAY};
#[tokio::main]
async fn main() {
let tx_hash = "49edb289892a655a0e988b360c19326c21107f9696c6197b435667c6e8c6e1a3";
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let status = blockchain.get_transaction_status(tx_hash).await;
println!("tx status: {status:?}");
diff --git a/sdk/core/examples/vm_query.rs b/sdk/core/examples/vm_query.rs
index 41cdfd5dbf..d07f49b856 100644
--- a/sdk/core/examples/vm_query.rs
+++ b/sdk/core/examples/vm_query.rs
@@ -1,6 +1,6 @@
use multiversx_sdk::{
- blockchain::{CommunicationProxy, DEVNET_GATEWAY},
data::{address::Address, vm::VmValueRequest},
+ gateway::{GatewayProxy, DEVNET_GATEWAY},
wallet::Wallet,
};
@@ -11,7 +11,7 @@ async fn main() {
)
.unwrap();
let addr = wl.address();
- let blockchain = CommunicationProxy::new(DEVNET_GATEWAY.to_string());
+ let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string());
let req = VmValueRequest {
sc_address: Address::from_bech32_string(
"erd1qqqqqqqqqqqqqpgqhn3ae8dpc957t7jadn7kywtg503dy7pnj9ts3umqxx",
diff --git a/sdk/core/src/blockchain.rs b/sdk/core/src/blockchain.rs
deleted file mode 100644
index 73d97ef0ea..0000000000
--- a/sdk/core/src/blockchain.rs
+++ /dev/null
@@ -1,405 +0,0 @@
-use std::collections::HashMap;
-
-use crate::data::{
- account::{Account, AccountResponse},
- account_storage::AccountStorageResponse,
- address::Address,
- esdt::{EsdtBalance, EsdtBalanceResponse, EsdtRolesResponse},
- hyperblock::{HyperBlock, HyperBlockResponse},
- network_config::{NetworkConfig, NetworkConfigResponse},
- network_economics::{NetworkEconomics, NetworkEconomicsResponse},
- network_status::NetworkStatusResponse,
- transaction::{
- ArgCreateTransaction, ResponseTxCost, SendTransactionResponse, SendTransactionsResponse,
- Transaction, TransactionInfo, TransactionOnNetwork, TransactionStatus, TxCostResponseData,
- },
- vm::{ResponseVmValue, VmValueRequest, VmValuesResponseData},
-};
-use anyhow::{anyhow, Result};
-use itertools::Itertools;
-use reqwest::Client;
-
-pub const MAINNET_GATEWAY: &str = "https://gateway.multiversx.com";
-pub const TESTNET_GATEWAY: &str = "https://testnet-gateway.multiversx.com";
-pub const DEVNET_GATEWAY: &str = "https://devnet-gateway.multiversx.com";
-
-// MetachainShardId will be used to identify a shard ID as metachain
-pub const METACHAIN_SHARD_ID: u32 = 0xFFFFFFFF;
-
-const NETWORK_CONFIG_ENDPOINT: &str = "network/config";
-const NETWORK_ECONOMICS_ENDPOINT: &str = "network/economics";
-const ACCOUNT_ENDPOINT: &str = "address/";
-const KEYS_ENDPOINT: &str = "/keys/";
-const COST_TRANSACTION_ENDPOINT: &str = "transaction/cost";
-const SEND_TRANSACTION_ENDPOINT: &str = "transaction/send";
-const SEND_MULTIPLE_TRANSACTIONS_ENDPOINT: &str = "transaction/send-multiple";
-const GET_TRANSACTION_INFO_ENDPOINT: &str = "transaction/";
-const GET_HYPER_BLOCK_BY_NONCE_ENDPOINT: &str = "hyperblock/by-nonce/";
-const GET_HYPER_BLOCK_BY_HASH_ENDPOINT: &str = "hyperblock/by-hash/";
-const GET_NETWORK_STATUS_ENDPOINT: &str = "network/status";
-const WITH_RESULTS_QUERY_PARAM: &str = "?withResults=true";
-const VM_VALUES_ENDPOINT: &str = "vm-values/query";
-
-#[derive(Clone, Debug)]
-pub struct CommunicationProxy {
- proxy_url: String,
- client: Client,
-}
-
-impl CommunicationProxy {
- pub fn new(proxy_url: String) -> Self {
- Self {
- proxy_url,
- client: Client::new(),
- }
- }
-
- fn get_endpoint(&self, endpoint: &str) -> String {
- format!("{}/{}", self.proxy_url, endpoint)
- }
-
- // get_network_config retrieves the network configuration from the proxy
- pub async fn get_network_config(&self) -> Result {
- let endpoint = self.get_endpoint(NETWORK_CONFIG_ENDPOINT);
- let resp = self
- .client
- .get(endpoint)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b.config),
- }
- }
-
- // get_network_economics retrieves the network economics from the proxy
- pub async fn get_network_economics(&self) -> Result {
- let endpoint = self.get_endpoint(NETWORK_ECONOMICS_ENDPOINT);
- let resp = self
- .client
- .get(endpoint)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b.metrics),
- }
- }
-
- async fn get_hyper_block(&self, endpoint: &str) -> Result {
- let endpoint = self.get_endpoint(endpoint);
- let resp = self
- .client
- .get(endpoint)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b.hyperblock),
- }
- }
-
- // get_hyper_block_by_hash retrieves a hyper block's info by hash from the network
- pub async fn get_hyper_block_by_hash(&self, hash: &str) -> Result {
- let endpoint = GET_HYPER_BLOCK_BY_HASH_ENDPOINT.to_string() + hash;
- self.get_hyper_block(endpoint.as_str()).await
- }
-
- // get_hyper_block_by_nonce retrieves a hyper block's info by nonce from the network
- pub async fn get_hyper_block_by_nonce(&self, nonce: u64) -> Result {
- let endpoint = GET_HYPER_BLOCK_BY_NONCE_ENDPOINT.to_string() + nonce.to_string().as_str();
- self.get_hyper_block(endpoint.as_str()).await
- }
-
- // get_latest_hyper_block_nonce retrieves the latest hyper block (metachain) nonce from the network
- pub async fn get_latest_hyper_block_nonce(&self, with_metachain: bool) -> Result {
- let mut endpoint = GET_NETWORK_STATUS_ENDPOINT.to_string();
-
- if with_metachain {
- endpoint = format!("{GET_NETWORK_STATUS_ENDPOINT}/{METACHAIN_SHARD_ID}");
- }
-
- let endpoint = self.get_endpoint(endpoint.as_str());
-
- let resp = self
- .client
- .get(endpoint)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b.status.nonce),
- }
- }
-
- // request_transaction_cost retrieves how many gas a transaction will consume
- pub async fn request_transaction_cost(&self, tx: &Transaction) -> Result {
- let endpoint = self.get_endpoint(COST_TRANSACTION_ENDPOINT);
- let resp = self
- .client
- .post(endpoint)
- .json(tx)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b),
- }
- }
-
- // get_account retrieves an account info from the network (nonce, balance)
- pub async fn get_account(&self, address: &Address) -> Result {
- if !address.is_valid() {
- return Err(anyhow!("invalid address"));
- }
-
- let endpoint = ACCOUNT_ENDPOINT.to_string() + address.to_string().as_str();
- let endpoint = self.get_endpoint(endpoint.as_str());
- let resp = self
- .client
- .get(endpoint)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b.account),
- }
- }
-
- // get_account_esdt_roles retrieves an all esdt roles of an account from the network
- pub async fn get_account_esdt_roles(
- &self,
- address: &Address,
- ) -> Result>> {
- if !address.is_valid() {
- return Err(anyhow!("invalid address"));
- }
-
- let endpoint = ACCOUNT_ENDPOINT.to_string() + address.to_string().as_str() + "/esdts/roles";
- let endpoint = self.get_endpoint(endpoint.as_str());
- let resp = self
- .client
- .get(endpoint)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b.roles),
- }
- }
-
- // get_account_esdt_tokens retrieves an all esdt token of an account from the network
- pub async fn get_account_esdt_tokens(
- &self,
- address: &Address,
- ) -> Result> {
- if !address.is_valid() {
- return Err(anyhow!("invalid address"));
- }
-
- let endpoint = ACCOUNT_ENDPOINT.to_string() + address.to_string().as_str() + "/esdt";
- let endpoint = self.get_endpoint(endpoint.as_str());
- let resp = self
- .client
- .get(endpoint)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b.esdts),
- }
- }
-
- // get_account_esdt_tokens retrieves an all esdt token of an account from the network
- pub async fn get_account_storage_keys(
- &self,
- address: &Address,
- ) -> Result> {
- if !address.is_valid() {
- return Err(anyhow!("invalid address"));
- }
-
- let endpoint = ACCOUNT_ENDPOINT.to_string() + address.to_string().as_str() + KEYS_ENDPOINT;
- let endpoint = self.get_endpoint(endpoint.as_str());
- let resp = self
- .client
- .get(endpoint)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b.pairs),
- }
- }
-
- async fn get_transaction_info_internal(
- &self,
- hash: &str,
- with_results: bool,
- ) -> Result {
- let mut endpoint = GET_TRANSACTION_INFO_ENDPOINT.to_string() + hash;
-
- if with_results {
- endpoint += WITH_RESULTS_QUERY_PARAM
- }
-
- let endpoint = self.get_endpoint(endpoint.as_str());
- let resp = self
- .client
- .get(endpoint)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b.transaction),
- }
- }
-
- // get_transaction_info retrieves a transaction's details from the network
- pub async fn get_transaction_info(&self, hash: &str) -> Result {
- self.get_transaction_info_internal(hash, false).await
- }
-
- // get_transaction_info_with_results retrieves a transaction's details from the network with events
- pub async fn get_transaction_info_with_results(
- &self,
- hash: &str,
- ) -> Result {
- self.get_transaction_info_internal(hash, true).await
- }
-
- // get_transaction_status retrieves a transaction's status from the network
- pub async fn get_transaction_status(&self, hash: &str) -> Result {
- let endpoint = format!("transaction/{hash}/status");
- let endpoint = self.get_endpoint(endpoint.as_str());
-
- let resp = self
- .client
- .get(endpoint)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b.status),
- }
- }
-
- // get_default_transaction_arguments will prepare the transaction creation argument by querying the account's info
- pub async fn get_default_transaction_arguments(
- &self,
- address: &Address,
- network_configs: &NetworkConfig,
- ) -> Result {
- let account = self.get_account(address).await?;
-
- Ok(ArgCreateTransaction {
- nonce: account.nonce,
- value: "".to_string(),
- rcv_addr: address.clone(),
- snd_addr: address.clone(),
- gas_price: network_configs.min_gas_price,
- gas_limit: network_configs.min_gas_limit,
- data: None,
- signature: "".to_string(),
- chain_id: network_configs.chain_id.clone(),
- version: network_configs.min_transaction_version,
- options: 0,
- available_balance: account.balance,
- })
- }
-
- pub async fn send_transaction(&self, tx: &Transaction) -> Result {
- let endpoint = self.get_endpoint(SEND_TRANSACTION_ENDPOINT);
- let resp = self
- .client
- .post(endpoint)
- .json(tx)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b.tx_hash),
- }
- }
-
- pub async fn send_transactions(&self, txs: &Vec) -> Result> {
- let endpoint = self.get_endpoint(SEND_MULTIPLE_TRANSACTIONS_ENDPOINT);
- let resp = self
- .client
- .post(endpoint)
- .json(txs)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => {
- let mut tx_hashs: Vec = vec![];
- for key in b.txs_hashes.keys().sorted() {
- tx_hashs.push(b.txs_hashes[key].clone());
- }
-
- Ok(tx_hashs)
- },
- }
- }
-
- // execute_vmquery retrieves data from existing SC trie through the use of a VM
- pub async fn execute_vmquery(
- &self,
- vm_request: &VmValueRequest,
- ) -> Result {
- let endpoint = self.get_endpoint(VM_VALUES_ENDPOINT);
- let resp = self
- .client
- .post(endpoint)
- .json(vm_request)
- .send()
- .await?
- .json::()
- .await?;
-
- match resp.data {
- None => Err(anyhow!("{}", resp.error)),
- Some(b) => Ok(b),
- }
- }
-}
diff --git a/sdk/core/src/gateway.rs b/sdk/core/src/gateway.rs
new file mode 100644
index 0000000000..35e2668b50
--- /dev/null
+++ b/sdk/core/src/gateway.rs
@@ -0,0 +1,15 @@
+mod gateway_account;
+mod gateway_block;
+mod gateway_network;
+mod gateway_proxy;
+mod gateway_tx;
+mod gateway_tx_retrieve;
+
+pub use gateway_proxy::GatewayProxy;
+
+pub const MAINNET_GATEWAY: &str = "https://gateway.multiversx.com";
+pub const TESTNET_GATEWAY: &str = "https://testnet-gateway.multiversx.com";
+pub const DEVNET_GATEWAY: &str = "https://devnet-gateway.multiversx.com";
+
+// MetachainShardId will be used to identify a shard ID as metachain
+pub const METACHAIN_SHARD_ID: u32 = 0xFFFFFFFF;
diff --git a/sdk/core/src/gateway/gateway_account.rs b/sdk/core/src/gateway/gateway_account.rs
new file mode 100644
index 0000000000..7d72258544
--- /dev/null
+++ b/sdk/core/src/gateway/gateway_account.rs
@@ -0,0 +1,112 @@
+use crate::data::{
+ account::{Account, AccountResponse},
+ account_storage::AccountStorageResponse,
+ address::Address,
+ esdt::{EsdtBalance, EsdtBalanceResponse, EsdtRolesResponse},
+};
+use anyhow::{anyhow, Result};
+use std::collections::HashMap;
+
+use super::GatewayProxy;
+
+const ACCOUNT_ENDPOINT: &str = "address/";
+const KEYS_ENDPOINT: &str = "/keys/";
+
+impl GatewayProxy {
+ // get_account retrieves an account info from the network (nonce, balance)
+ pub async fn get_account(&self, address: &Address) -> Result {
+ if !address.is_valid() {
+ return Err(anyhow!("invalid address"));
+ }
+
+ let endpoint = ACCOUNT_ENDPOINT.to_string() + address.to_string().as_str();
+ let endpoint = self.get_endpoint(endpoint.as_str());
+ let resp = self
+ .client
+ .get(endpoint)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b.account),
+ }
+ }
+
+ // get_account_esdt_roles retrieves an all esdt roles of an account from the network
+ pub async fn get_account_esdt_roles(
+ &self,
+ address: &Address,
+ ) -> Result>> {
+ if !address.is_valid() {
+ return Err(anyhow!("invalid address"));
+ }
+
+ let endpoint = ACCOUNT_ENDPOINT.to_string() + address.to_string().as_str() + "/esdts/roles";
+ let endpoint = self.get_endpoint(endpoint.as_str());
+ let resp = self
+ .client
+ .get(endpoint)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b.roles),
+ }
+ }
+
+ // get_account_esdt_tokens retrieves an all esdt token of an account from the network
+ pub async fn get_account_esdt_tokens(
+ &self,
+ address: &Address,
+ ) -> Result> {
+ if !address.is_valid() {
+ return Err(anyhow!("invalid address"));
+ }
+
+ let endpoint = ACCOUNT_ENDPOINT.to_string() + address.to_string().as_str() + "/esdt";
+ let endpoint = self.get_endpoint(endpoint.as_str());
+ let resp = self
+ .client
+ .get(endpoint)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b.esdts),
+ }
+ }
+
+ // get_account_esdt_tokens retrieves an all esdt token of an account from the network
+ pub async fn get_account_storage_keys(
+ &self,
+ address: &Address,
+ ) -> Result> {
+ if !address.is_valid() {
+ return Err(anyhow!("invalid address"));
+ }
+
+ let endpoint = ACCOUNT_ENDPOINT.to_string() + address.to_string().as_str() + KEYS_ENDPOINT;
+ let endpoint = self.get_endpoint(endpoint.as_str());
+ let resp = self
+ .client
+ .get(endpoint)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b.pairs),
+ }
+ }
+}
diff --git a/sdk/core/src/gateway/gateway_block.rs b/sdk/core/src/gateway/gateway_block.rs
new file mode 100644
index 0000000000..b6daf57abb
--- /dev/null
+++ b/sdk/core/src/gateway/gateway_block.rs
@@ -0,0 +1,66 @@
+use crate::data::{
+ hyperblock::{HyperBlock, HyperBlockResponse},
+ network_status::NetworkStatusResponse,
+};
+use anyhow::{anyhow, Result};
+
+use super::GatewayProxy;
+use super::METACHAIN_SHARD_ID;
+
+const GET_HYPER_BLOCK_BY_NONCE_ENDPOINT: &str = "hyperblock/by-nonce/";
+const GET_HYPER_BLOCK_BY_HASH_ENDPOINT: &str = "hyperblock/by-hash/";
+const GET_NETWORK_STATUS_ENDPOINT: &str = "network/status";
+
+impl GatewayProxy {
+ async fn get_hyper_block(&self, endpoint: &str) -> Result {
+ let endpoint = self.get_endpoint(endpoint);
+ let resp = self
+ .client
+ .get(endpoint)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b.hyperblock),
+ }
+ }
+
+ // get_hyper_block_by_hash retrieves a hyper block's info by hash from the network
+ pub async fn get_hyper_block_by_hash(&self, hash: &str) -> Result {
+ let endpoint = GET_HYPER_BLOCK_BY_HASH_ENDPOINT.to_string() + hash;
+ self.get_hyper_block(endpoint.as_str()).await
+ }
+
+ // get_hyper_block_by_nonce retrieves a hyper block's info by nonce from the network
+ pub async fn get_hyper_block_by_nonce(&self, nonce: u64) -> Result {
+ let endpoint = GET_HYPER_BLOCK_BY_NONCE_ENDPOINT.to_string() + nonce.to_string().as_str();
+ self.get_hyper_block(endpoint.as_str()).await
+ }
+
+ // get_latest_hyper_block_nonce retrieves the latest hyper block (metachain) nonce from the network
+ pub async fn get_latest_hyper_block_nonce(&self, with_metachain: bool) -> Result {
+ let mut endpoint = GET_NETWORK_STATUS_ENDPOINT.to_string();
+
+ if with_metachain {
+ endpoint = format!("{GET_NETWORK_STATUS_ENDPOINT}/{METACHAIN_SHARD_ID}");
+ }
+
+ let endpoint = self.get_endpoint(endpoint.as_str());
+
+ let resp = self
+ .client
+ .get(endpoint)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b.status.nonce),
+ }
+ }
+}
diff --git a/sdk/core/src/gateway/gateway_network.rs b/sdk/core/src/gateway/gateway_network.rs
new file mode 100644
index 0000000000..8b02a57d0d
--- /dev/null
+++ b/sdk/core/src/gateway/gateway_network.rs
@@ -0,0 +1,46 @@
+use crate::data::{
+ network_config::{NetworkConfig, NetworkConfigResponse},
+ network_economics::{NetworkEconomics, NetworkEconomicsResponse},
+};
+use anyhow::{anyhow, Result};
+
+use super::GatewayProxy;
+
+const NETWORK_CONFIG_ENDPOINT: &str = "network/config";
+const NETWORK_ECONOMICS_ENDPOINT: &str = "network/economics";
+
+impl GatewayProxy {
+ // get_network_config retrieves the network configuration from the proxy
+ pub async fn get_network_config(&self) -> Result {
+ let endpoint = self.get_endpoint(NETWORK_CONFIG_ENDPOINT);
+ let resp = self
+ .client
+ .get(endpoint)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b.config),
+ }
+ }
+
+ // get_network_economics retrieves the network economics from the proxy
+ pub async fn get_network_economics(&self) -> Result {
+ let endpoint = self.get_endpoint(NETWORK_ECONOMICS_ENDPOINT);
+ let resp = self
+ .client
+ .get(endpoint)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b.metrics),
+ }
+ }
+}
diff --git a/sdk/core/src/gateway/gateway_proxy.rs b/sdk/core/src/gateway/gateway_proxy.rs
new file mode 100644
index 0000000000..47925cd79f
--- /dev/null
+++ b/sdk/core/src/gateway/gateway_proxy.rs
@@ -0,0 +1,21 @@
+use reqwest::Client;
+
+/// Allows communication with the MultiversX gateway API.
+#[derive(Clone, Debug)]
+pub struct GatewayProxy {
+ pub(crate) proxy_url: String,
+ pub(crate) client: Client,
+}
+
+impl GatewayProxy {
+ pub fn new(proxy_url: String) -> Self {
+ Self {
+ proxy_url,
+ client: Client::new(),
+ }
+ }
+
+ pub(crate) fn get_endpoint(&self, endpoint: &str) -> String {
+ format!("{}/{}", self.proxy_url, endpoint)
+ }
+}
diff --git a/sdk/core/src/gateway/gateway_tx.rs b/sdk/core/src/gateway/gateway_tx.rs
new file mode 100644
index 0000000000..47aa8b5a83
--- /dev/null
+++ b/sdk/core/src/gateway/gateway_tx.rs
@@ -0,0 +1,184 @@
+use crate::data::{
+ address::Address,
+ network_config::NetworkConfig,
+ transaction::{
+ ArgCreateTransaction, ResponseTxCost, SendTransactionResponse, SendTransactionsResponse,
+ Transaction, TransactionInfo, TransactionOnNetwork, TransactionStatus, TxCostResponseData,
+ },
+ vm::{ResponseVmValue, VmValueRequest, VmValuesResponseData},
+};
+use anyhow::{anyhow, Result};
+use itertools::Itertools;
+
+use super::GatewayProxy;
+
+const COST_TRANSACTION_ENDPOINT: &str = "transaction/cost";
+const SEND_TRANSACTION_ENDPOINT: &str = "transaction/send";
+const SEND_MULTIPLE_TRANSACTIONS_ENDPOINT: &str = "transaction/send-multiple";
+const GET_TRANSACTION_INFO_ENDPOINT: &str = "transaction/";
+const WITH_RESULTS_QUERY_PARAM: &str = "?withResults=true";
+const VM_VALUES_ENDPOINT: &str = "vm-values/query";
+
+impl GatewayProxy {
+ // request_transaction_cost retrieves how many gas a transaction will consume
+ pub async fn request_transaction_cost(&self, tx: &Transaction) -> Result {
+ let endpoint = self.get_endpoint(COST_TRANSACTION_ENDPOINT);
+ let resp = self
+ .client
+ .post(endpoint)
+ .json(tx)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b),
+ }
+ }
+
+ async fn get_transaction_info_internal(
+ &self,
+ hash: &str,
+ with_results: bool,
+ ) -> Result {
+ let mut endpoint = GET_TRANSACTION_INFO_ENDPOINT.to_string() + hash;
+
+ if with_results {
+ endpoint += WITH_RESULTS_QUERY_PARAM
+ }
+
+ let endpoint = self.get_endpoint(endpoint.as_str());
+ let resp = self
+ .client
+ .get(endpoint)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b.transaction),
+ }
+ }
+
+ // get_transaction_info retrieves a transaction's details from the network
+ pub async fn get_transaction_info(&self, hash: &str) -> Result {
+ self.get_transaction_info_internal(hash, false).await
+ }
+
+ // get_transaction_info_with_results retrieves a transaction's details from the network with events
+ pub async fn get_transaction_info_with_results(
+ &self,
+ hash: &str,
+ ) -> Result {
+ self.get_transaction_info_internal(hash, true).await
+ }
+
+ // get_transaction_status retrieves a transaction's status from the network
+ pub async fn get_transaction_status(&self, hash: &str) -> Result {
+ let endpoint = format!("transaction/{hash}/status");
+ let endpoint = self.get_endpoint(endpoint.as_str());
+
+ let resp = self
+ .client
+ .get(endpoint)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b.status),
+ }
+ }
+
+ // get_default_transaction_arguments will prepare the transaction creation argument by querying the account's info
+ pub async fn get_default_transaction_arguments(
+ &self,
+ address: &Address,
+ network_configs: &NetworkConfig,
+ ) -> Result {
+ let account = self.get_account(address).await?;
+
+ Ok(ArgCreateTransaction {
+ nonce: account.nonce,
+ value: "".to_string(),
+ rcv_addr: address.clone(),
+ snd_addr: address.clone(),
+ gas_price: network_configs.min_gas_price,
+ gas_limit: network_configs.min_gas_limit,
+ data: None,
+ signature: "".to_string(),
+ chain_id: network_configs.chain_id.clone(),
+ version: network_configs.min_transaction_version,
+ options: 0,
+ available_balance: account.balance,
+ })
+ }
+
+ pub async fn send_transaction(&self, tx: &Transaction) -> Result {
+ let endpoint = self.get_endpoint(SEND_TRANSACTION_ENDPOINT);
+ let resp = self
+ .client
+ .post(endpoint)
+ .json(tx)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b.tx_hash),
+ }
+ }
+
+ pub async fn send_transactions(&self, txs: &Vec) -> Result> {
+ let endpoint = self.get_endpoint(SEND_MULTIPLE_TRANSACTIONS_ENDPOINT);
+ let resp = self
+ .client
+ .post(endpoint)
+ .json(txs)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => {
+ let mut tx_hashs: Vec = vec![];
+ for key in b.txs_hashes.keys().sorted() {
+ tx_hashs.push(b.txs_hashes[key].clone());
+ }
+
+ Ok(tx_hashs)
+ },
+ }
+ }
+
+ // execute_vmquery retrieves data from existing SC trie through the use of a VM
+ pub async fn execute_vmquery(
+ &self,
+ vm_request: &VmValueRequest,
+ ) -> Result {
+ let endpoint = self.get_endpoint(VM_VALUES_ENDPOINT);
+ let resp = self
+ .client
+ .post(endpoint)
+ .json(vm_request)
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ match resp.data {
+ None => Err(anyhow!("{}", resp.error)),
+ Some(b) => Ok(b),
+ }
+ }
+}
diff --git a/framework/snippets/src/interactor_retrieve.rs b/sdk/core/src/gateway/gateway_tx_retrieve.rs
similarity index 87%
rename from framework/snippets/src/interactor_retrieve.rs
rename to sdk/core/src/gateway/gateway_tx_retrieve.rs
index cd9291ba33..821713f972 100644
--- a/framework/snippets/src/interactor_retrieve.rs
+++ b/sdk/core/src/gateway/gateway_tx_retrieve.rs
@@ -1,28 +1,28 @@
-use crate::Interactor;
+use crate::data::transaction::TransactionOnNetwork;
use log::info;
-use multiversx_sdk::data::transaction::TransactionOnNetwork;
use std::time::{Duration, Instant};
+use super::GatewayProxy;
+
const INITIAL_BACKOFF_DELAY: f32 = 1.4;
const MAX_RETRIES: usize = 8;
const MAX_BACKOFF_DELAY: Duration = Duration::from_secs(6);
-impl Interactor {
+impl GatewayProxy {
/// Retrieves a transaction from the network.
- pub(crate) async fn retrieve_tx_on_network(&self, tx_hash: String) -> TransactionOnNetwork {
+ pub async fn retrieve_tx_on_network(&self, tx_hash: String) -> TransactionOnNetwork {
let mut retries = 0;
let mut backoff_delay = Duration::from_secs_f32(INITIAL_BACKOFF_DELAY);
let start_time = Instant::now();
loop {
- match self.proxy.get_transaction_status(&tx_hash).await {
+ match self.get_transaction_status(&tx_hash).await {
Ok(status) => {
// checks if transaction status is final
match status.as_str() {
"success" | "fail" => {
// retrieve transaction info with results
let transaction_info_with_results = self
- .proxy
.get_transaction_info_with_results(&tx_hash)
.await
.unwrap();
diff --git a/sdk/core/src/lib.rs b/sdk/core/src/lib.rs
index f37f2197e5..3a1db99fd7 100644
--- a/sdk/core/src/lib.rs
+++ b/sdk/core/src/lib.rs
@@ -1,5 +1,5 @@
-pub mod blockchain;
pub mod crypto;
pub mod data;
+pub mod gateway;
pub mod utils;
pub mod wallet;