parseVoutScriptForData function
Implementation
Iterable<VoutData> parseVoutScriptForData(Uint8List script) {
final opCodes = getOpCodes(script);
final dataPoints = <VoutData>[];
int maybeOpRVNAssetTuplePtr = opCodes.length;
for (int tupleCnt = 0; tupleCnt < opCodes.length; tupleCnt++) {
if (opCodes[tupleCnt].item1 == 0xc0) {
maybeOpRVNAssetTuplePtr = tupleCnt;
break;
}
}
if (opCodes.isNotEmpty && opCodes[0].item1 == 0x6a) {
dataPoints.add(OPReturnVoutData(script));
}
final addressData = tryGuessAddressFromOpList(
opCodes.sublist(0, maybeOpRVNAssetTuplePtr), testnetConstants);
if (addressData != null) dataPoints.add(addressData);
if (maybeOpRVNAssetTuplePtr == 0) {
final assetTagData = tryGuessAssetTagFromOpList(opCodes);
if (assetTagData != null) dataPoints.add(assetTagData);
} else if (maybeOpRVNAssetTuplePtr < opCodes.length) {
final assetTransferData =
parseAssetTransfer(opCodes.sublist(maybeOpRVNAssetTuplePtr), script);
dataPoints.addAll(assetTransferData);
}
return dataPoints;
}