Token#
- pydantic model empyrealSDK.types.Token[source]#
An abstraction of an ERC20 token instance
Show JSON schema
{ "title": "Token", "description": "An abstraction of an ERC20 token instance", "type": "object", "properties": { "id": { "format": "uuid", "title": "Id", "type": "string" }, "address": { "title": "Address", "type": "string" }, "name": { "title": "Name", "type": "string" }, "symbol": { "title": "Symbol", "type": "string" }, "decimals": { "title": "Decimals", "type": "integer" }, "chainId": { "$ref": "#/$defs/Network" } }, "$defs": { "Network": { "const": 1, "description": "An enum representing the different Networks supported by the SDK", "title": "Network" } }, "required": [ "id", "address", "name", "symbol", "decimals", "chainId" ] }
- Fields:
address (eth_typing.evm.ChecksumAddress)
decimals (int)
id (uuid.UUID)
name (str)
network (empyrealSDK.types.network.Network)
symbol (str)
- field address: ChecksumAddress [Required]#
- field decimals: int [Required]#
- field id: UUID [Required]#
- field name: str [Required]#
- field symbol: str [Required]#
- async allowance(owner: ChecksumAddress, spender: ChecksumAddress, block_num: int | Literal['latest'] | None = 'latest') TokenAmount [source]#
Gets the allowance allocated to an address from a spender
- Parameters:
- Returns:
- async approve(from_wallet: Wallet, spender: Wallet | ChecksumAddress, amount: int = 115792089237316195423570985008687907853269984665640564039457584007913129639935, priority_fee: int | None = None) HexStr [source]#
Approve a spender to use a token. :param _sphinx_paramlinks_empyrealSDK.types.Token.approve.from_wallet:
empyrealSDK.Wallet
making the approval :param _sphinx_paramlinks_empyrealSDK.types.Token.approve.spender: A checksummed ethereum address :return: HexStr
- balance_of(wallet: Wallet, block: int | Literal['latest'] = 'latest') TokenAmount [source]#
- balance_of(wallet_address: ChecksumAddress, network: Network = Network.Ethereum, block: int | Literal['latest'] = 'latest')
Gets the balance of a wallet at a particular block. Defaults to latest block.
- Parameters:
- Returns:
TokenAmount
of the current balance
- async transfer(from_wallet: Wallet, recipient: Wallet | ChecksumAddress, amount: TokenAmount, gas_price: int | None = None) HexStr [source]#
Transfer a token amount to a target address