Struct terra_rust_api::client::Terra
source · [−]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
sourceimpl 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
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Terra
impl Send for Terra
impl Sync for Terra
impl Unpin for Terra
impl !UnwindSafe for Terra
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more