isInstantWithdrawalAllowed function

Future<bool?> isInstantWithdrawalAllowed(
  1. double amount,
  2. Token token
)

Implementation

Future<bool?> isInstantWithdrawalAllowed(double amount, Token token) async {
  final hermezContract = await ContractParser.fromAssets(
      'HermezABI.json',
      getCurrentEnvironment()!.contracts[ContractName.hermez]!,
      ContractName.hermez);

  final instantWithdrawalCall = await HermezSDK.currentWeb3Client!.call(
      contract: hermezContract,
      function: _instantWithdrawalViewer(hermezContract),
      params: [
        EthereumAddress.fromHex(token.ethereumAddress!),
        BigInt.from(amount),
      ]);
  final allowed = instantWithdrawalCall.first as bool?;
  return allowed;
}