multiversx_sdk_http/gateway_http_proxy/
http_chain_simulator.rs1use super::GatewayHttpProxy;
2use anyhow::Error;
3use multiversx_sdk::{
4 chain_core::std::Bech32Address,
5 gateway::{
6 ChainSimulatorGenerateBlocksRequest, ChainSimulatorSendFundsRequest, GatewayAsyncService,
7 },
8};
9
10impl GatewayHttpProxy {
11 pub async fn send_user_funds(&self, receiver: &Bech32Address) -> Result<String, Error> {
12 self.request(ChainSimulatorSendFundsRequest::to_address(receiver))
13 .await
14 }
15
16 pub async fn generate_blocks(&self, num_blocks: u64) -> Result<String, Error> {
17 self.request(ChainSimulatorGenerateBlocksRequest::num_blocks(num_blocks))
18 .await
19 }
20
21 pub async fn generate_blocks_until_epoch(&self, epoch_number: u64) -> Result<String, Error> {
22 self.request(ChainSimulatorGenerateBlocksRequest::until_epoch(
23 epoch_number,
24 ))
25 .await
26 }
27
28 pub async fn generate_blocks_until_tx_processed(&self, tx_hash: &str) -> Result<String, Error> {
29 self.request(ChainSimulatorGenerateBlocksRequest::until_tx_processed(
30 tx_hash,
31 ))
32 .await
33 }
34}