Struct tendermint_rpc::HttpClient [−][src]
pub struct HttpClient { /* fields omitted */ }
Expand description
A JSON-RPC/HTTP Tendermint RPC client (implements crate::Client
).
Supports both HTTP and HTTPS connections to Tendermint RPC endpoints, and
allows for the use of HTTP proxies (see HttpClient::new_with_proxy
for
details).
Does not provide crate::event::Event
subscription facilities (see
crate::WebSocketClient
for a client that does).
Examples
use tendermint_rpc::{HttpClient, Client};
#[tokio::main]
async fn main() {
let client = HttpClient::new("http://127.0.0.1:26657")
.unwrap();
let abci_info = client.abci_info()
.await
.unwrap();
println!("Got ABCI info: {:?}", abci_info);
}
Implementations
Construct a new Tendermint RPC HTTP/S client connecting to the given URL.
pub fn new_with_proxy<U, P>(url: U, proxy_url: P) -> Result<Self, Error> where
U: TryInto<HttpClientUrl, Error = Error>,
P: TryInto<HttpClientUrl, Error = Error>,
pub fn new_with_proxy<U, P>(url: U, proxy_url: P) -> Result<Self, Error> where
U: TryInto<HttpClientUrl, Error = Error>,
P: TryInto<HttpClientUrl, Error = Error>,
Construct a new Tendermint RPC HTTP/S client connecting to the given URL, but via the specified proxy’s URL.
If the RPC endpoint is secured (HTTPS), the proxy will automatically attempt to connect using the HTTP CONNECT method.
Trait Implementations
Perform a request against the RPC endpoint
/abci_info
: get information about the ABCI application.
/abci_query
: query the ABCI application
/block
: get block at a given height.
/block
: get the latest block.
/block_results
: get ABCI results for a block at a particular height.
/block_results
: get ABCI results for the latest block.
/block_search
: search for blocks by BeginBlock and EndBlock events.
/blockchain
: get block headers for min
<= height
<= max
. Read more
/broadcast_tx_async
: broadcast a transaction, returning immediately.
/broadcast_tx_sync
: broadcast a transaction, returning the response
from CheckTx
. Read more
/broadcast_tx_commit
: broadcast a transaction, returning the response
from DeliverTx
. Read more
/commit
: get block commit at a given height.
/consensus_params
: get current consensus parameters at the specified
height. Read more
/consensus_state
: get current consensus state
/validators
: get validators a given height.
/consensus_params
: get the latest consensus parameters.
/commit
: get the latest block commit
/health
: get node health. Read more
/genesis
: get genesis file.
/net_info
: obtain information about P2P and other network connections.
/status
: get Tendermint status including node info, pubkey, latest
block hash, app hash, block height and time. Read more
/broadcast_evidence
: broadcast an evidence.
/tx
: find transaction by hash.
/tx_search
: search for transactions with their results.
Poll the /health
endpoint until it returns a successful result or
the given timeout
has elapsed. Read more
Auto Trait Implementations
impl !RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl !UnwindSafe for HttpClient
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more