isApproved method
Query if an address is an authorized operator for another address
tokenAddress An address for whom to query .
ownerAddress The address which owns the funds.
operatorAddress The address that acts on behalf of the owner
return True if operatorAddress
is an approved operator for ownerAddress
, False otherwise
Implementation
Future<bool> isApproved(
String __tokenAdd_, String ownerr_Addr, String spender_addr__) async {
final EthereumAddress contractAddr = EthereumAddress.fromHex(__tokenAdd_);
final EthereumAddress ownerAddress = EthereumAddress.fromHex(ownerr_Addr);
final EthereumAddress spender = EthereumAddress.fromHex(spender_addr__);
final contract =
DeployedContract(ContractAbi.fromJson(abiFile, 'XRC721'), contractAddr);
final isApprove = contract.function('isApprovedForAll');
final isApproved = await client.call(
contract: contract,
function: isApprove,
params: [ownerAddress, spender]);
final isApproveofAll = isApproved[0];
return (isApproveofAll);
}