Retrieve detailed information about multiple tokens by providing their addresses.
The ID of the network where the tokens are located.
The array with token addresses for which you want to retrieve the information.
An optional object containing additional options.
Optional
getOptional
baseAn optional array of Token
objects representing the base tokens to override the default base tokens for the specified network.
Optional
extraAn optional array of token addresses representing the base tokens added to the default base tokens for the specified network.
Optional
blockThe number of the block in which the query will run.
A Promise that resolves to an object with key-value pairs representing multiple tokens with its associated information. Where the keys represent token addresses and the values are Token
objects.
Retrieve the balances of multiple tokens for the given holders addresses.
The network ID.
An array of objects containing token and holder addresses.
An optional object containing additional options.
Optional
blockThe number of the block in which the query will run.
A Promise that resolves to an TokensBalances
object representing token balances for multiple tokens and holders.
Throws a error if the library is not initialized.
Throws a type error if the network ID is invalid.
Throws a type error if inputList
is not an array of objects with the token and holder addresses.
Retrieve the allowances of multiple tokens for the given holders and spender addresses.
The ID of the network where the tokens are located.
An array of objects containing token, holder, and spender information.
An optional object containing additional options.
Optional
blockThe number of the block in which the query will run.
A Promise that resolves to an TokensAllowances
object representing token allowances for multiple tokens, holders and spenders.
Throws a error if the library is not initialized.
Throws a type error if the network ID is invalid.
Throws a type error if inputList
is not an array of objects with the token, holder and spender addresses.
Generated using TypeDoc
The
Tokens
class provides the methods for fetching the information of any token that comply with theERC-20
standard. These methods include:getTokens
method: You can use this method to retrieve detailed information about multiple tokens by providing their addresses.getBalances
method: By using this method, you can retrieve the balances of multiple tokens for the given holders addresses.getAllowances
method: This method enables you to retrieve the allowances of multiple tokens for the given holders and spender addresses.To use the
Tokens
class, you need to create an instance of theDeFiData
class first and wait for it to be ready. Then you can access thetokens
property from theDeFiData
instance.Example
Here's an example of how the
Tokens
class can be used: