pub struct Contact {
pub jsonrpc_client: Arc<Box<HTTPClient>>,
pub timeout: Duration,
}Expand description
An instance of Contact Cosmos RPC Client.
Fields§
§jsonrpc_client: Arc<Box<HTTPClient>>§timeout: DurationImplementations§
Source§impl Contact
impl Contact
pub async fn get_latest_block_number(&self) -> Result<u64, JsonRpcError>
pub async fn get_latest_block( &self, ) -> Result<LatestBlockEndpointResponse, JsonRpcError>
pub async fn get_syncing_status(&self) -> Result<SyncingStatus, JsonRpcError>
Sourcepub async fn get_account_info(
&self,
address: Address,
) -> Result<ResponseWrapper<TypeWrapper<Option<CosmosAccountInfo>>>, JsonRpcError>
pub async fn get_account_info( &self, address: Address, ) -> Result<ResponseWrapper<TypeWrapper<Option<CosmosAccountInfo>>>, JsonRpcError>
Gets account info for the provided Cosmos account using the accounts endpoint accounts do not have any info if they have no tokens or are otherwise never seen before an Ok(None) result indicates this
pub async fn get_tx_by_hash( &self, txhash: &str, ) -> Result<TXSendResponse, JsonRpcError>
pub async fn get_balances( &self, address: Address, ) -> Result<ResponseWrapper<Vec<Coin>>, JsonRpcError>
Source§impl Contact
impl Contact
Sourcepub async fn send_transaction<M: Clone + Serialize>(
&self,
msg: Transaction<M>,
) -> Result<TXSendResponse, JsonRpcError>
pub async fn send_transaction<M: Clone + Serialize>( &self, msg: Transaction<M>, ) -> Result<TXSendResponse, JsonRpcError>
The advanced version of create_and_send transaction that expects you to perform your own signing and prep first.
Sourcepub async fn retry_on_block<M: Clone + Serialize, T: 'static + for<'de> Deserialize<'de> + Debug>(
&self,
tx: Transaction<M>,
) -> Result<T, JsonRpcError>
pub async fn retry_on_block<M: Clone + Serialize, T: 'static + for<'de> Deserialize<'de> + Debug>( &self, tx: Transaction<M>, ) -> Result<T, JsonRpcError>
When a transaction is in ‘block’ mode it actually asynchronously waits to go into the blockchain before returning. This is very useful in many contexts but is somewhat limited by the fact that nodes by default are configured to time out after 10 seconds. The caller of Contact of course expects the timeout they provide to be honored. This routine allows us to do that, retrying as needed until we reach the specific timeout allowed.
Sourcepub async fn create_and_send_transaction(
&self,
coin: Coin,
fee: Coin,
destination: Address,
private_key: PrivateKey,
chain_id: Option<String>,
account_number: Option<u64>,
sequence: Option<u64>,
) -> Result<TXSendResponse, JsonRpcError>
pub async fn create_and_send_transaction( &self, coin: Coin, fee: Coin, destination: Address, private_key: PrivateKey, chain_id: Option<String>, account_number: Option<u64>, sequence: Option<u64>, ) -> Result<TXSendResponse, JsonRpcError>
The hand holding version of send transaction that does it all for you
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Contact
impl !RefUnwindSafe for Contact
impl !Send for Contact
impl !Sync for Contact
impl Unpin for Contact
impl !UnwindSafe for Contact
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more