buildTransactionPayload method
Implementation
TransactionPayload buildTransactionPayload(String func, List<String> tyTags, List<dynamic> args) {
final typeTags = tyTags.map((e) => TypeTagParser(e).parseTypeTag()).toList();
TransactionPayload payload;
if (!abiMap.containsKey(func)) {
throw ArgumentError("Cannot find function: $func");
}
final scriptABI = abiMap[func];
if (scriptABI is EntryFunctionABI) {
final bcsArgs = TransactionBuilderABI._toBCSArgs(scriptABI.args, args);
payload = TransactionPayloadEntryFunction(
EntryFunction(scriptABI.moduleName, Identifier(scriptABI.name), typeTags, bcsArgs),
);
} else if (scriptABI is TransactionScriptABI) {
final scriptArgs = TransactionBuilderABI._toTransactionArguments(scriptABI.args, args);
payload = TransactionPayloadScript(Script(scriptABI.code, typeTags, scriptArgs));
} else {
/* istanbul ignore next */
throw ArgumentError("Unknown ABI format.");
}
return payload;
}