Struct 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§

Source§

impl Terra

Source

pub fn lcd_client<S: Into<String>>( url: S, chain_id: S, gas_options: &GasOptions, debug: Option<bool>, ) -> Terra

Create a LCD client interface

Source

pub fn lcd_client_no_tx<S: Into<String>>(url: S, chain_id: S) -> Terra

Create a read-only / query client interface

Source

pub fn auth(&self) -> Auth<'_>

Auth API functions

Source

pub fn bank(&self) -> Bank<'_>

Bank API functions

Source

pub fn staking(&self) -> Staking<'_>

Staking API functions

Source

pub fn market(&self) -> Market<'_>

Market API functions

Source

pub fn oracle(&self) -> Oracle<'_>

Oracle API functions

Source

pub fn tendermint(&self) -> Tendermint<'_>

Tendermint (MISC) API Functions

Source

pub fn tx(&self) -> TX<'_>

TXS API Functions

Source

pub fn rpc<'a>(&'a self, tendermint_url: &'a str) -> RPC<'_>

RPC Api Functions

Source

pub fn fcd<'a>(&'a self, fcd_url: &'a str) -> FCD<'_>

FCD Api Functions

Source

pub fn wasm(&self) -> Wasm<'_>

WASM module / smart contract API Functions

Source

pub fn construct_headers() -> HeaderMap

Source

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

Source

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

Source

pub async fn fetch_url<T: for<'de> Deserialize<'de>>( client: &Client, url: &str, path: &str, args: Option<&str>, ) -> Result<T, TerraRustAPIError>

Source

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

Source

pub async fn calc_fees( &self, auth_account: &AuthAccount, messages: &[Message], ) -> Result<StdFee, TerraRustAPIError>

Generate Fee structure, either by estimation method or hardcoded

Source

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

Source

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

Source

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

Source

pub async fn production_address_book() -> Result<AddressBook, TerraRustAPIError>

fetch the address book for the production network

Source

pub async fn testnet_address_book() -> Result<AddressBook, TerraRustAPIError>

fetch the address book for the testnet network

Source

pub async fn address_book( addr_url: &str, ) -> Result<AddressBook, TerraRustAPIError>

fetch a address book json structure

Trait Implementations§

Source§

impl Clone for Terra

Source§

fn clone(&self) -> Terra

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl Freeze for Terra

§

impl !RefUnwindSafe for Terra

§

impl Send for Terra

§

impl Sync for Terra

§

impl Unpin for Terra

§

impl !UnwindSafe for Terra

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,