pub struct Client { /* private fields */ }
Expand description
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(rpc_base_url: &str) -> Self
pub fn new(rpc_base_url: &str) -> Self
new
creates a new instance of a pchain_client given a network provider.
§Arguments
rpc_base_url
- base URL of Parallelchain RPC endpoints
Sourcepub fn set_provider(&mut self, rpc_base_url: &str)
pub fn set_provider(&mut self, rpc_base_url: &str)
set_provider
assigns new network provider for Client.
§Arguments
rpc_base_url
- base URL of Parallelchain RPC endpoints
Sourcepub async fn is_provider_up(&self) -> (String, bool)
pub async fn is_provider_up(&self) -> (String, bool)
is_provider_up
returns the current network provider for Client, and check if
the current provider is up.
§Return
Tuple of (provider url, boolean). Returns true if server is up, otherwise returns false.
Sourcepub async fn submit_transaction(
&self,
signed_tx: &Transaction,
) -> Result<SubmitTransactionResponse, String>
pub async fn submit_transaction( &self, signed_tx: &Transaction, ) -> Result<SubmitTransactionResponse, String>
submit_transaction
sends request to submit a transaction.
Sourcepub async fn state(
&self,
request: &StateRequest,
) -> Result<StateResponse, String>
pub async fn state( &self, request: &StateRequest, ) -> Result<StateResponse, String>
state
sends request to query account data from world state.
Sourcepub async fn view(&self, request: &ViewRequest) -> Result<ViewResponse, String>
pub async fn view(&self, request: &ViewRequest) -> Result<ViewResponse, String>
view
sends request to execute a contract view call.
Sourcepub async fn validator_sets(
&self,
request: &ValidatorSetsRequest,
) -> Result<ValidatorSetsResponse, String>
pub async fn validator_sets( &self, request: &ValidatorSetsRequest, ) -> Result<ValidatorSetsResponse, String>
validator_sets
sends request to query previous / current / next validator and delegator sets
Sourcepub async fn pools(
&self,
request: &PoolsRequest,
) -> Result<PoolsResponse, String>
pub async fn pools( &self, request: &PoolsRequest, ) -> Result<PoolsResponse, String>
pools
sends request to query pools with a set of operator address, with or without stakes of each pool
Sourcepub async fn stakes(
&self,
request: &StakesRequest,
) -> Result<StakesResponse, String>
pub async fn stakes( &self, request: &StakesRequest, ) -> Result<StakesResponse, String>
stakes
sends request to query stakes with a set of (operator address, owner address)
Sourcepub async fn deposits(
&self,
request: &DepositsRequest,
) -> Result<DepositsResponse, String>
pub async fn deposits( &self, request: &DepositsRequest, ) -> Result<DepositsResponse, String>
deposits
sends request to query deposits with a set of (operator address, owner address)
Sourcepub async fn block(
&self,
request: &BlockRequest,
) -> Result<BlockResponse, String>
pub async fn block( &self, request: &BlockRequest, ) -> Result<BlockResponse, String>
block
sends request to get full block data starting from specified block hash.
Sourcepub async fn block_header(
&self,
request: &BlockHeaderRequest,
) -> Result<BlockHeaderResponse, String>
pub async fn block_header( &self, request: &BlockHeaderRequest, ) -> Result<BlockHeaderResponse, String>
block_header
sends request to get block header starting from specified block hash.
Sourcepub async fn block_height_by_hash(
&self,
request: &BlockHeightByHashRequest,
) -> Result<BlockHeightByHashResponse, String>
pub async fn block_height_by_hash( &self, request: &BlockHeightByHashRequest, ) -> Result<BlockHeightByHashResponse, String>
block_height_by_hash
sends request to get block height by specified block hash.
Sourcepub async fn block_hash_by_height(
&self,
request: &BlockHashByHeightRequest,
) -> Result<BlockHashByHeightResponse, String>
pub async fn block_hash_by_height( &self, request: &BlockHashByHeightRequest, ) -> Result<BlockHashByHeightResponse, String>
block_hash_by_height
sends request to get block hash by specified block height.
Sourcepub async fn highest_committed_block(
&self,
) -> Result<HighestCommittedBlockResponse, String>
pub async fn highest_committed_block( &self, ) -> Result<HighestCommittedBlockResponse, String>
highest_committed_block
sends request to get the latest block on ParallelChain.
Sourcepub async fn transaction(
&self,
request: &TransactionRequest,
) -> Result<TransactionResponse, String>
pub async fn transaction( &self, request: &TransactionRequest, ) -> Result<TransactionResponse, String>
transaction
sends request to get transaction by specified tx hash.
Sourcepub async fn receipt(
&self,
request: &ReceiptRequest,
) -> Result<ReceiptResponse, String>
pub async fn receipt( &self, request: &ReceiptRequest, ) -> Result<ReceiptResponse, String>
receipt
sends request to get receipt with transaction, block hash and position by specified tx hash.
Sourcepub async fn transaction_position(
&self,
request: &TransactionPositionRequest,
) -> Result<TransactionPositionResponse, String>
pub async fn transaction_position( &self, request: &TransactionPositionRequest, ) -> Result<TransactionPositionResponse, String>
transaction_position
sends request to get transaction position in block by specified tx hash.