pub struct Terra {
pub chain_id: String,
pub gas_options: Option<GasOptions>,
pub debug: bool,
/* private fields */
}
Expand description
The main structure that all API calls are generated from
Fields§
§chain_id: String
The Chain of the network
gas_options: Option<GasOptions>
Gas Options used to help with gas/fee generation of transactions
debug: bool
Implementations§
Source§impl Terra
impl Terra
Sourcepub fn lcd_client<S: Into<String>>(
url: S,
chain_id: S,
gas_options: &GasOptions,
debug: Option<bool>,
) -> Terra
pub fn lcd_client<S: Into<String>>( url: S, chain_id: S, gas_options: &GasOptions, debug: Option<bool>, ) -> Terra
Create a LCD client interface
Sourcepub fn lcd_client_no_tx<S: Into<String>>(url: S, chain_id: S) -> Terra
pub fn lcd_client_no_tx<S: Into<String>>(url: S, chain_id: S) -> Terra
Create a read-only / query client interface
Sourcepub fn tendermint(&self) -> Tendermint<'_>
pub fn tendermint(&self) -> Tendermint<'_>
Tendermint (MISC) API Functions
pub fn construct_headers() -> HeaderMap
Sourcepub async fn send_cmd<T: for<'de> Deserialize<'de>>(
&self,
path: &str,
args: Option<&str>,
) -> Result<T, TerraRustAPIError>
pub async fn send_cmd<T: for<'de> Deserialize<'de>>( &self, path: &str, args: Option<&str>, ) -> Result<T, TerraRustAPIError>
used to send a GET command to the LCD
Sourcepub async fn send_cmd_url<T: for<'de> Deserialize<'de>>(
&self,
url: &str,
path: &str,
args: Option<&str>,
) -> Result<T, TerraRustAPIError>
pub async fn send_cmd_url<T: for<'de> Deserialize<'de>>( &self, url: &str, path: &str, args: Option<&str>, ) -> Result<T, TerraRustAPIError>
used to send a GET command to any URL
pub async fn fetch_url<T: for<'de> Deserialize<'de>>( client: &Client, url: &str, path: &str, args: Option<&str>, ) -> Result<T, TerraRustAPIError>
Sourcepub async fn post_cmd<R: for<'de> Serialize, T: for<'de> Deserialize<'de>>(
&self,
path: &str,
args: &R,
) -> Result<T, TerraRustAPIError>
pub async fn post_cmd<R: for<'de> Serialize, T: for<'de> Deserialize<'de>>( &self, path: &str, args: &R, ) -> Result<T, TerraRustAPIError>
used to send a POST with a JSON body to the LCD
Sourcepub async fn calc_fees(
&self,
auth_account: &AuthAccount,
messages: &[Message],
) -> Result<StdFee, TerraRustAPIError>
pub async fn calc_fees( &self, auth_account: &AuthAccount, messages: &[Message], ) -> Result<StdFee, TerraRustAPIError>
Generate Fee structure, either by estimation method or hardcoded
Sourcepub async fn generate_transaction_to_broadcast<C: Signing + Context>(
&self,
secp: &Secp256k1<C>,
from: &PrivateKey,
messages: Vec<Message>,
memo: Option<String>,
) -> Result<(StdSignMsg, Vec<StdSignature>), TerraRustAPIError>
pub async fn generate_transaction_to_broadcast<C: Signing + Context>( &self, secp: &Secp256k1<C>, from: &PrivateKey, messages: Vec<Message>, memo: Option<String>, ) -> Result<(StdSignMsg, Vec<StdSignature>), TerraRustAPIError>
helper function to generate a ‘StdSignMsg’ & ‘Signature’ blocks to be used to broadcast a transaction This version calculates fees, and obtains account# and sequence# as well
Sourcepub async fn submit_transaction_sync<C: Signing + Context>(
&self,
secp: &Secp256k1<C>,
from: &PrivateKey,
messages: Vec<Message>,
memo: Option<String>,
) -> Result<TXResultSync, TerraRustAPIError>
pub async fn submit_transaction_sync<C: Signing + Context>( &self, secp: &Secp256k1<C>, from: &PrivateKey, messages: Vec<Message>, memo: Option<String>, ) -> Result<TXResultSync, TerraRustAPIError>
helper: sign & submit the transaction sync
Sourcepub async fn submit_transaction_async<C: Signing + Context>(
&self,
secp: &Secp256k1<C>,
from: &PrivateKey,
messages: Vec<Message>,
memo: Option<String>,
) -> Result<TXResultAsync, TerraRustAPIError>
pub async fn submit_transaction_async<C: Signing + Context>( &self, secp: &Secp256k1<C>, from: &PrivateKey, messages: Vec<Message>, memo: Option<String>, ) -> Result<TXResultAsync, TerraRustAPIError>
helper: sign & submit the transaction async
Sourcepub async fn production_address_book() -> Result<AddressBook, TerraRustAPIError>
pub async fn production_address_book() -> Result<AddressBook, TerraRustAPIError>
fetch the address book for the production network
Sourcepub async fn testnet_address_book() -> Result<AddressBook, TerraRustAPIError>
pub async fn testnet_address_book() -> Result<AddressBook, TerraRustAPIError>
fetch the address book for the testnet network
Sourcepub async fn address_book(
addr_url: &str,
) -> Result<AddressBook, TerraRustAPIError>
pub async fn address_book( addr_url: &str, ) -> Result<AddressBook, TerraRustAPIError>
fetch a address book json structure