checkAvailableGasFee method

  1. @override
Future<bool> checkAvailableGasFee({
  1. required String toAddress,
  2. required String privateKey,
  3. required double amount,
})
override

Implementation

@override
Future<bool> checkAvailableGasFee({
  required String toAddress,
  required String privateKey,
  required double amount,
}) async {

  // 자격증명 생성
  final credentials = EthPrivateKey.fromHex(privateKey);
  final from = credentials.address;

  // 가스비 계산
  final gasFee = await estimateGasFee(
      from: from.hex,
      toAddress: toAddress,
      amount: amount,
      isBEP20: true
  );

  // BNB 잔액 확인 (가스비를 위한)
  final bnbBalance = await _client.getBalance(from);
  if (bnbBalance.getInWei < gasFee['totalGasFee']!) {
    return false;
  }
  return true;
}