build method
Implementation
Future<T?> build() async {
final flatFee = this.flatFee;
final suggestedFeePerByte = this.suggestedFeePerByte;
// Fee validation
if (suggestedFeePerByte != null && flatFee != null) {
throw AlgorandException(message: 'Cannot set both fee and flat fee.');
}
if (suggestedFeePerByte != null) {
// Set the fee to calculate correct estimated transaction size
// see setFeeByFeePerByte in Java
_fee = suggestedFeePerByte;
final transactionSize = await estimatedTransactionSize();
_fee = await FeeCalculator.calculateTransactionFee(
transactionSize,
suggestedFeePerByte,
);
} else if (flatFee != null) {
_fee = flatFee;
}
// Ensure min fee
if (fee < RawTransaction.MIN_TX_FEE_UALGOS) {
_fee = RawTransaction.MIN_TX_FEE_UALGOS;
}
return null;
}