Client

Struct Client 

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

Client for interacting with Rango APIs

Implementations§

Source§

impl Client

Source

pub async fn is_approved( &self, request: IsApprovedRequest, ) -> Result<CheckApprovalResponse, SdkErr>

In some blockchains (like evm), before sending the swap transaction, user is needing to give a approval to the conttact. This method will track and check the approval transcation.

Source

pub async fn status( &self, request: StatusRequest, ) -> Result<StatusResponse, SdkErr>

After signing the transaction by the user and receiving transaction hash, you could periodically call Rango check-status API to track the transaction status.

Source

pub async fn balance( &self, request: BalanceRequest, ) -> Result<BalanceResponse, SdkErr>

Getting wallet’s balance by giving blockchain and address.

Source§

impl Client

Source

pub async fn meta(&self) -> Result<Meta, SdkErr>

All the essential data needed for a client, including list of support blockchains, tokens and protocols (DEXs & Bridges).

Source

pub async fn chains(&self) -> Result<Vec<BlockchainMeta>, SdkErr>

List of supported chains by Rango

Source

pub async fn swappers(&self) -> Result<Vec<SwapperMeta>, SdkErr>

List of supported swappers by Rango

Source

pub async fn messaging_protocols(&self) -> Result<MessagingProtocols, SdkErr>

List of supported messaging protocols by Rango

Source§

impl Client

Source

pub async fn quote( &self, request: QuoteRequest, ) -> Result<QuoteResponse, SdkErr>

Getting a quote for requested swap Rango will find the best route from available DEX or bridges for doing the swap. Quote is a preview of route, if the quote confirmed by the user, you will need to use swap for getting the actual swap and complete the swap.

Source§

impl Client

Source

pub async fn swap(&self, request: SwapRequest) -> Result<SwapResponse, SdkErr>

After getting a quote, you will call swap. it includes the route and required transaction to be singed by user.

Source§

impl Client

Source

pub fn new(device_id: &str, api_key: &str, api_url: Option<String>) -> Self

Creating a client to send request to Rango’s server using available methods.

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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