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>
impl<'a> Client<'a>
pub fn new(env: &Env, contract_id: &impl IntoVal<Env, BytesN<{ _ }>>) -> Self
pub fn address(&self) -> Address
pub fn set_auths(&self, auths: &'a [ContractAuth]) -> Self
pub fn mock_auths(&self, mock_auths: &'a [MockAuth<'a>]) -> Self
pub fn mock_all_auths(&self) -> Self
pub fn allowance(&self, from: &Address, spender: &Address) -> i128
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>>
pub fn increase_allowance( &self, from: &Address, spender: &Address, amount: &i128 )
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>>
pub fn decrease_allowance( &self, from: &Address, spender: &Address, amount: &i128 )
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>>
pub fn balance(&self, id: &Address) -> i128
pub fn try_balance( &self, id: &Address ) -> Result<Result<i128, <i128 as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>
pub fn spendable_balance(&self, id: &Address) -> i128
pub fn try_spendable_balance( &self, id: &Address ) -> Result<Result<i128, <i128 as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>
pub fn transfer(&self, from: &Address, to: &Address, amount: &i128)
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>>
pub fn transfer_from( &self, spender: &Address, from: &Address, to: &Address, amount: &i128 )
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>>
pub fn burn(&self, from: &Address, amount: &i128)
pub fn try_burn( &self, from: &Address, amount: &i128 ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>
pub fn burn_from(&self, spender: &Address, from: &Address, amount: &i128)
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>>
pub fn mint(&self, to: &Address, amount: &i128)
pub fn try_mint( &self, to: &Address, amount: &i128 ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>
pub fn clawback(&self, from: &Address, amount: &i128)
pub fn try_clawback( &self, from: &Address, amount: &i128 ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>
pub fn set_admin(&self, new_admin: &Address)
pub fn try_set_admin( &self, new_admin: &Address ) -> Result<Result<(), <() as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>
pub fn decimals(&self) -> u32
pub fn try_decimals( &self ) -> Result<Result<u32, <u32 as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>
pub fn name(&self) -> Bytes
pub fn try_name( &self ) -> Result<Result<Bytes, <Bytes as TryFromVal<Env, RawVal>>::Error>, Result<Status, <Status as TryFrom<Status>>::Error>>
pub fn symbol(&self) -> Bytes
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§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>,
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>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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>
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)
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)
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.