Client

Struct Client 

Source
pub struct Client { /* private fields */ }

Implementations§

Source§

impl Client

Source

pub fn new(base_url: &str) -> Result<Self, Error>

§Errors
Source

pub fn new_with_timeout(base_url: &str, timeout: u64) -> Result<Self, Error>

👎Deprecated: To be marked private in a future major release. Please use new_with_headers instead.

Create a new client with a timeout in seconds

§Errors
Source

pub fn new_with_headers( base_url: &str, additional_headers: HeaderMap, ) -> Result<Self, Error>

Create a new client with additional headers

§Errors
Source

pub fn base_url(&self) -> &str

Source

pub fn client(&self) -> &HttpClient

Source

pub async fn friendbot_url(&self) -> Result<String, Error>

§Errors
Source

pub async fn verify_network_passphrase( &self, expected: Option<&str>, ) -> Result<String, Error>

§Errors
Source

pub async fn get_network(&self) -> Result<GetNetworkResponse, Error>

§Errors
Source

pub async fn get_health(&self) -> Result<GetHealthResponse, Error>

§Errors
Source

pub async fn get_latest_ledger(&self) -> Result<GetLatestLedgerResponse, Error>

§Errors
Source

pub async fn get_ledgers( &self, start: LedgerStart, limit: Option<usize>, format: Option<String>, ) -> Result<GetLedgersResponse, Error>

§Errors
Source

pub async fn get_account(&self, address: &str) -> Result<AccountEntry, Error>

§Errors
Source

pub async fn get_fee_stats(&self) -> Result<GetFeeStatsResponse, Error>

Get network fee stats

§Errors
Source

pub async fn get_version_info(&self) -> Result<GetVersionInfoResponse, Error>

§Errors
Source

pub async fn send_transaction( &self, tx: &TransactionEnvelope, ) -> Result<Hash, Error>

Send a transaction to the network and get back the hash of the transaction.

§Errors
Source

pub async fn send_transaction_polling( &self, tx: &TransactionEnvelope, ) -> Result<GetTransactionResponse, Error>

§Errors
Source

pub async fn simulate_transaction_envelope( &self, tx: &TransactionEnvelope, auth_mode: Option<AuthMode>, ) -> Result<SimulateTransactionResponse, Error>

§Errors
Source

pub async fn next_simulate_transaction_envelope( &self, tx: &TransactionEnvelope, auth_mode: Option<AuthMode>, resource_config: Option<ResourceConfig>, ) -> Result<SimulateTransactionResponse, Error>

Internal function, not to be used.

§Errors
Source

pub async fn get_transaction( &self, tx_id: &Hash, ) -> Result<GetTransactionResponse, Error>

§Errors
Source

pub async fn get_transactions( &self, request: GetTransactionsRequest, ) -> Result<GetTransactionsResponse, Error>

§Errors
Source

pub async fn get_transaction_polling( &self, tx_id: &Hash, timeout_s: Option<Duration>, ) -> Result<GetTransactionResponse, Error>

Poll the transaction status. Can provide a timeout in seconds, otherwise uses the default timeout.

It uses exponential backoff with a base of 1 second and a maximum of 30 seconds.

§Errors
  • Error::TransactionSubmissionTimeout if the transaction status is not found within the timeout
  • Error::TransactionSubmissionFailed if the transaction status is “FAILED”
  • Error::UnexpectedTransactionStatus if the transaction status is not one of “SUCCESS”, “FAILED”, or NOT_FOUND
  • json_rpsee Errors
Source

pub async fn get_ledger_entries( &self, keys: &[LedgerKey], ) -> Result<GetLedgerEntriesResponse, Error>

§Errors
Source

pub async fn get_full_ledger_entries( &self, ledger_keys: &[LedgerKey], ) -> Result<FullLedgerEntries, Error>

§Errors
Source

pub async fn get_events( &self, start: EventStart, event_type: Option<EventType>, contract_ids: &[String], topics: &[String], limit: Option<usize>, ) -> Result<GetEventsResponse, Error>

§Errors
Source

pub async fn get_contract_data( &self, contract_id: &[u8; 32], ) -> Result<ContractDataEntry, Error>

§Errors
Source

pub async fn get_remote_wasm( &self, contract_id: &[u8; 32], ) -> Result<Vec<u8>, Error>

👎Deprecated: To be removed in future versions, use get_ledger_entries()
§Errors
Source

pub async fn get_remote_wasm_from_hash( &self, hash: Hash, ) -> Result<Vec<u8>, Error>

👎Deprecated: To be removed in future versions, use get_ledger_entries()
§Errors
Source

pub async fn get_contract_instance( &self, contract_id: &[u8; 32], ) -> Result<ScContractInstance, Error>

Get the contract instance from the network. Could be normal contract or native Stellar Asset Contract (SAC)

§Errors
  • Could fail to find contract or have a network error

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

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

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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<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,

Source§

impl<T> MaybeSend for T
where T: Send,