Skip to content

Commit

Permalink
Merge branch 'chain-simulator-interactor' of https://github.com/multi…
Browse files Browse the repository at this point in the history
…versx/mx-sdk-rs into chain-simulator-interactor
  • Loading branch information
BiancaIalangi committed Sep 27, 2024
2 parents a39c586 + 5134dc4 commit d4773f4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion sdk/core/examples/account_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use multiversx_sdk::{
#[tokio::main]
async fn main() {
let addr = Address::from_bech32_string(
"erd1932eft30w753xyvme8d49qejgkjc09n5e49w4mwdjtm0neld797su0dlxp",
"erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th",
)
.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion sdk/core/examples/get_hyper_block_by_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use multiversx_sdk::gateway::{GatewayProxy, DEFAULT_USE_CHAIN_SIMULATOR, DEVNET_
async fn main() {
let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string(), DEFAULT_USE_CHAIN_SIMULATOR);
let result = blockchain
.get_hyper_block_by_hash("20b14ba0e68c465810c5ded091f220e51dad41629d7ccd87dab572206185e419")
.get_hyper_block_by_hash("d59e0dc7d407b1175655357cb8056ec3bb77961192753cddda2fb700c6ce71c6")
.await;

println!("block by hash result: {result:?}");
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/examples/get_hyper_block_latest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use multiversx_sdk::gateway::{GatewayProxy, DEFAULT_USE_CHAIN_SIMULATOR, DEVNET_
#[tokio::main]
async fn main() {
let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string(), DEFAULT_USE_CHAIN_SIMULATOR);
let result = blockchain.get_latest_hyper_block_nonce(false).await;
let result = blockchain.get_latest_hyper_block_nonce().await;

println!("latest block result: {result:?}")
}
2 changes: 1 addition & 1 deletion sdk/core/examples/tx_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use multiversx_sdk::gateway::{GatewayProxy, DEFAULT_USE_CHAIN_SIMULATOR, DEVNET_

#[tokio::main]
async fn main() {
let tx_hash = "49edb289892a655a0e988b360c19326c21107f9696c6197b435667c6e8c6e1a3";
let tx_hash = "fd21782ddb9e2217a3239e849e39d1d2c8fa74142a73f2dda3adb3028c0514e9";
let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string(), DEFAULT_USE_CHAIN_SIMULATOR);

let status = blockchain.get_transaction_status(tx_hash).await;
Expand Down
9 changes: 3 additions & 6 deletions sdk/core/examples/vm_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ use multiversx_sdk::{

#[tokio::main]
async fn main() {
let wl = Wallet::from_private_key(
"1648ad209d6b157a289884933e3bb30f161ec7113221ec16f87c3578b05830b0",
)
.unwrap();
let wl = Wallet::from_pem_file("sdk/core/tests/alice.pem").unwrap();
let addr = wl.address();
let blockchain = GatewayProxy::new(DEVNET_GATEWAY.to_string(), DEFAULT_USE_CHAIN_SIMULATOR);
let req = VmValueRequest {
sc_address: Address::from_bech32_string(
"erd1qqqqqqqqqqqqqpgqhn3ae8dpc957t7jadn7kywtg503dy7pnj9ts3umqxx",
"erd1qqqqqqqqqqqqqpgq5dvvkmka7sujfsx7cfmygnx0n7luv8k0d8sskpqcec",
)
.unwrap(),
func_name: "get".to_string(),
func_name: "empty".to_string(),
args: vec![],
caller: addr.clone(),
value: "0".to_string(),
Expand Down
8 changes: 2 additions & 6 deletions sdk/core/src/gateway/gateway_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,8 @@ impl GatewayProxy {
}

// 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<u64> {
let mut endpoint = GET_NETWORK_STATUS_ENDPOINT.to_string();

if with_metachain {
endpoint = format!("{GET_NETWORK_STATUS_ENDPOINT}/{METACHAIN_SHARD_ID}");
}
pub async fn get_latest_hyper_block_nonce(&self) -> Result<u64> {
let endpoint = format!("{GET_NETWORK_STATUS_ENDPOINT}/{METACHAIN_SHARD_ID}");

let endpoint = self.get_endpoint(endpoint.as_str());

Expand Down

0 comments on commit d4773f4

Please sign in to comment.