listFiles method
Step 5: Get the final file results with patch IDs.
Implementation
Future<List<WriteFileResult>> listFiles({String? certifyDigest}) async {
if (_step != _WriteFilesFlowStep.certified) {
throw StateError('Must call certify() before listFiles()');
}
if (_suiClient == null) {
throw StateError('A chain client is required to verify certification');
}
await verifyFlowBlob(
client: _suiClient,
objectId: _blobObjectId!,
blobId: _metadata!.blobId,
blobType: _blobType!,
size: _metadata!.unencodedLength,
deletable: _deletable,
owner: _owner!,
certified: true,
digest: certifyDigest,
);
final metadata = _metadata!;
final index = _quiltIndex!;
return index.patches.map((patch) {
return WriteFileResult(
id: encodeQuiltPatchId(
quiltBlobId: metadata.blobId,
version: 1,
startIndex: patch.startIndex,
endIndex: patch.endIndex,
),
blobId: metadata.blobId,
blobObjectId: _blobObjectId!,
);
}).toList();
}