scCall method
Future<(String, bool)>
scCall({
- required Account account,
- required double fee,
- required double maximumGas,
- required double coins,
- required String smartContracAddress,
- required String functionName,
- required Uint8List functionParameters,
override
scCall executes smart contract
Implementation
@override
Future<(String, bool)> scCall(
{required Account account,
required double fee,
required double maximumGas,
required double coins,
required String smartContracAddress,
required String functionName,
required Uint8List functionParameters}) async {
try {
final status = await _grpc.getStatus();
final expirePeriod = status.lastExecutedFinalSlot.period + status.config.operationValidityPeriods;
final operation = await callSC(
account, smartContracAddress, functionName, functionParameters, fee, maximumGas, coins, 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);
}
}