Struct soroban_sdk::token::Client

source ·
pub struct Client<'a> {
    pub env: Env,
    pub contract_id: BytesN<{ _ }>,
    /* private fields */
}
Expand description

Client is a client for calling the contract defined in “Interface”.

Fields§

§env: Env§contract_id: BytesN<{ _ }>

Implementations§

source§

impl<'a> Client<'a>

source

pub fn new(env: &Env, contract_id: &impl IntoVal<Env, BytesN<{ _ }>>) -> Self

source

pub fn address(&self) -> Address

source

pub fn set_auths(&self, auths: &'a [ContractAuth]) -> Self

source

pub fn mock_auths(&self, mock_auths: &'a [MockAuth<'a>]) -> Self

source

pub fn mock_all_auths(&self) -> Self

source

pub fn allowance(&self, from: &Address, spender: &Address) -> i128

source

pub fn try_allowance( &self, from: &Address, spender: &Address ) -> Result<Result<i128, <i128 as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn increase_allowance( &self, from: &Address, spender: &Address, amount: &i128 )

source

pub fn try_increase_allowance( &self, from: &Address, spender: &Address, amount: &i128 ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn decrease_allowance( &self, from: &Address, spender: &Address, amount: &i128 )

source

pub fn try_decrease_allowance( &self, from: &Address, spender: &Address, amount: &i128 ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn balance(&self, id: &Address) -> i128

source

pub fn try_balance( &self, id: &Address ) -> Result<Result<i128, <i128 as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn spendable_balance(&self, id: &Address) -> i128

source

pub fn try_spendable_balance( &self, id: &Address ) -> Result<Result<i128, <i128 as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn authorized(&self, id: &Address) -> bool

source

pub fn try_authorized( &self, id: &Address ) -> Result<Result<bool, <bool as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn transfer(&self, from: &Address, to: &Address, amount: &i128)

source

pub fn try_transfer( &self, from: &Address, to: &Address, amount: &i128 ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn transfer_from( &self, spender: &Address, from: &Address, to: &Address, amount: &i128 )

source

pub fn try_transfer_from( &self, spender: &Address, from: &Address, to: &Address, amount: &i128 ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn burn(&self, from: &Address, amount: &i128)

source

pub fn try_burn( &self, from: &Address, amount: &i128 ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn burn_from(&self, spender: &Address, from: &Address, amount: &i128)

source

pub fn try_burn_from( &self, spender: &Address, from: &Address, amount: &i128 ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn set_authorized(&self, id: &Address, authorize: &bool)

source

pub fn try_set_authorized( &self, id: &Address, authorize: &bool ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn mint(&self, to: &Address, amount: &i128)

source

pub fn try_mint( &self, to: &Address, amount: &i128 ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn clawback(&self, from: &Address, amount: &i128)

source

pub fn try_clawback( &self, from: &Address, amount: &i128 ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn set_admin(&self, new_admin: &Address)

source

pub fn try_set_admin( &self, new_admin: &Address ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn decimals(&self) -> u32

source

pub fn try_decimals( &self ) -> Result<Result<u32, <u32 as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn name(&self) -> Bytes

source

pub fn try_name( &self ) -> Result<Result<Bytes, <Bytes as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

source

pub fn symbol(&self) -> Bytes

source

pub fn try_symbol( &self ) -> Result<Result<Bytes, <Bytes as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Client<'a>

§

impl<'a> !Send for Client<'a>

§

impl<'a> !Sync for Client<'a>

§

impl<'a> Unpin for Client<'a>

§

impl<'a> !UnwindSafe for Client<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T, C> Compare<&T> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

§

fn compare(&self, a: &&T, b: &&T) -> Result<Ordering, <C as Compare<&T>>::Error>

§

impl<T, U, E, C> Compare<(T, U)> for Cwhere C: Compare<T, Error = E, Error = E> + Compare<U>,

§

type Error = E

§

fn compare( &self, a: &(T, U), b: &(T, U) ) -> Result<Ordering, <C as Compare<(T, U)>>::Error>

§

impl<T, U, V, E, C> Compare<(T, U, V)> for Cwhere C: Compare<T, Error = E, Error = E, Error = E> + Compare<U> + Compare<V>,

§

type Error = E

§

fn compare( &self, a: &(T, U, V), b: &(T, U, V) ) -> Result<Ordering, <C as Compare<(T, U, V)>>::Error>

§

impl<T, C> Compare<Box<T, Global>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

§

fn compare( &self, a: &Box<T, Global>, b: &Box<T, Global> ) -> Result<Ordering, <C as Compare<Box<T, Global>>>::Error>

§

impl<T, C> Compare<Option<T>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

§

fn compare( &self, a: &Option<T>, b: &Option<T> ) -> Result<Ordering, <C as Compare<Option<T>>>::Error>

§

impl<T, C> Compare<Rc<T>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

§

fn compare( &self, a: &Rc<T>, b: &Rc<T> ) -> Result<Ordering, <C as Compare<Rc<T>>>::Error>

§

impl<T, C> Compare<Vec<T, Global>> for Cwhere C: Compare<T>,

§

type Error = <C as Compare<T>>::Error

§

fn compare( &self, a: &Vec<T, Global>, b: &Vec<T, Global> ) -> Result<Ordering, <C as Compare<Vec<T, Global>>>::Error>

§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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<E, T, U> IntoVal<E, T> for Uwhere E: Env, T: FromVal<E, U>,

source§

fn into_val(&self, e: &E) -> T

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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

impl<E, T, U> TryIntoVal<E, T> for Uwhere E: Env, T: TryFromVal<E, U>,

§

type Error = <T as TryFromVal<E, U>>::Error

§

fn try_into_val(&self, env: &E) -> Result<T, <U as TryIntoVal<E, T>>::Error>

§

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

§

fn vzip(self) -> V