getAllowance method
Retrieves the allowance of tokens that a spender is allowed to withdraw from an owner.
This method checks the amount of tokens that an owner has allowed a spender
to withdraw from their account using the ERC20 approve
function.
tokenAddress
is the address of the ERC20 token.
spender
is the address of the entity that has been approved to spend the tokens.
Returns a BigInt representing the amount of tokens the spender is allowed to withdraw.
Implementation
Future<BigInt> getAllowance(
EthereumAddress tokenAddress,
EthereumAddress spender,
) {
return ContractsUtils.readFromContractWithFirstResult(
client: wallet.proxy.client,
contractName: 'ERC20',
contractAddress: tokenAddress,
methodName: 'allowance',
params: [
EthereumAddress.fromHex(wallet.getSender()),
spender,
],
);
}