getBlob method

Future<WriteBlobResult> getBlob({
  1. String? certifyDigest,
})

Step 5: Get the final blob result.

Implementation

Future<WriteBlobResult> getBlob({String? certifyDigest}) async {
  if (_step != _FlowStep.certified) {
    throw StateError('Must call certify() before getBlob()');
  }

  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,
  );
  return WriteBlobResult(
    blobId: _metadata!.blobId,
    blobObjectId: _blobObjectId!,
    certifyDigest:
        certifyDigest ??
        '', // No digest is invented for chain-only verification.
  );
}