Tokens
- class ape_starknet.tokens.TokenManager
Token Manager for Starknet ERC20 tokens.
- get_balance(account: Union[Address, ChecksumAddress], token: str = 'eth') int
Get token balance of an account.
- Parameters:
account (Union[Address, AddressType]) – The contract address of the account.
token (str) – The fee token symbol. Defaults to ETH.
- request_balance(account: Union[ChecksumAddress, int], token: str = 'eth') int
Get the balance from the provider and update the cache.
- Parameters:
account (Union[AddressType, int]) – The contract address of the account.
token (str) – The fee token symbol. Defaults to
ETH
.
- transfer(sender: Union[int, ChecksumAddress, BaseStarknetAccount], receiver: Union[int, ChecksumAddress, BaseStarknetAccount], amount: int, token: str = 'eth', **kwargs)
Transfer an amount of tokens from one account to another.
- Parameters:
sender (Union[int, AddressType, BaseStarknetAccount]) – The account to transfer tokens from.
receiver (Union[int, AddressType, BaseStarknetAccount]) – The account to transfer tokens to.
amount (int) – The amount of tokens to be transferred.
token (str) – The fee token symbol. Defaults to
ETH
.
- update_cache(address: Union[AccountAPI, ChecksumAddress, int], amount: Union[int, Dict], token: str = 'eth')
Update cache.
- Parameters:
address (Union[AccountAPI, AddressType, int]) – The contract address of the account.
amount (Union[int, Dict]) – The amount of tokens to be updated to the account balance.
token (str) – The fee token symbol. Defaults to
ETH
.