invokeAction method
Implementation
Future<TransactionResponseDoc> invokeAction({
required String operator,
required String name,
required String fromAccountId,
String? targetAccountId,
bool targetAll = false,
List<int> payload = const [],
String? contextId,
}) async {
final Target target;
if (targetAccountId != null) {
target = Target()..accountId = hex.decode(targetAccountId);
} else if (targetAll) {
target = Target()..anyAccount = Empty();
} else {
throw 'Missing action target';
}
final action = InvokeAction()
..name = name
..fromAccount = hex.decode(fromAccountId)
..target = target
..payload = payload;
final request = TransactionRequestPayload()
..data = (TransactionData()..invokeAction = action);
final client = getServiceClient(operator);
final envelop = await requestEnvelope(
request: request,
contextId: contextId != null ? hex.decode(contextId) : null,
);
final response = await client.tx.createTransaction(envelop);
return TransactionResponseDoc(response, contextId);
}