certify method

Transaction certify()

Step 4: Build the certify transaction.

Returns an unsigned Transaction for external signing.

Implementation

Transaction certify() {
  if (_step != _FlowStep.uploaded) {
    throw StateError('Must call upload() before certify()');
  }

  if (_certificate == null) {
    throw StateError('No certificate available for certification');
  }

  // Determine committee size for signers→bitmap conversion.
  // Prefer committee info if available; otherwise infer from the
  // certificate's signer indices (max index + 1, rounded to byte).
  final committeeSize =
      _committee?.nodes.length ??
      ((_certificate!.signers.isEmpty
          ? 0
          : _certificate!.signers.reduce((a, b) => a > b ? a : b) + 1));

  final tx = _txBuilder.certifyBlobTransaction(
    CertifyBlobOptions(
      blobId: _metadata!.blobId,
      blobObjectId: _blobObjectId!,
      deletable: _deletable,
      certificate: _certificate,
      committeeSize: committeeSize,
    ),
  );

  _step = _FlowStep.certified;
  return tx;
}