transfer method
Future<(String, bool)>
transfer({
- required Account account,
- required String recipientAddress,
- required double amount,
- required double fee,
override
transfer coins from the account address to the a recipient address
Implementation
@override
Future<(String, bool)> transfer({
required Account account,
required String recipientAddress,
required double amount,
required double fee,
}) async {
try {
final status = await _grpc.getStatus();
final expirePeriod = status.lastExecutedFinalSlot.period + status.config.operationValidityPeriods;
final operation = await sendTransaction(account, recipientAddress, amount, fee, expirePeriod.toInt());
String operationID = "";
await for (final resp in _grpc.sendOperations([operation])) {
if (resp.operationIds.operationIds.isEmpty) {
return (operationID, false);
}
operationID = resp.operationIds.operationIds[0];
final status = await waitForFinalOperationStatus(operationID);
return (operationID, status);
}
return (operationID, false);
} catch (error) {
throw Exception(error);
}
}