These exports support bulk export / verification: turn a CapTableState from getCapTableState into an OcfManifest shaped like fairmint API buildCaptableInput / processCapTable consumers. The module also exposes deterministic transaction ordering (sortTransactions, buildTransactionSortKey, txWeight, getTimestampOrNull) aligned with historical DB loaders.
Import
import {
extractCantonOcfManifest,
countManifestObjects,
sortTransactions,
buildTransactionSortKey,
txWeight,
getTimestampOrNull,
} from '@open-captable-protocol/canton';
extractCantonOcfManifest(client, cantonState, options?)
client—LedgerJsonApiClientcantonState—CapTableStatefromgetCapTableStateoptions—ExtractCantonOcfOptions:verbose,logger— progress loggingreadAs— forwarded vialedgerReadScopefor issuer-visible readsfailOnReadErrors— defaulttrue; whenfalse, non-benign classified failures log and continue (partial manifest)
Returns: OcfManifest with sorted transactions (via sortTransactions).
Throws: May throw OcpValidationError (e.g. missing object_type mapping), OcpContractError via createDiagnosedContractReadError for hard read failures when failOnReadErrors is true, and errors from underlying readers.
countManifestObjects(manifest)
Counts issuer (0/1) + array lengths for stakeholders, classes, plans, vesting terms, transactions, valuations, documents, legend templates. Accepts Partial<OcfManifest>.
Sort helpers
getTimestampOrNull— coerces numbers / ISO strings to ms ornull.txWeight— domain weight for same-day ordering byobject_type.buildTransactionSortKey— composite keyday|weight|group|created|id; throwsOcpValidationErroriftx.dateinvalid.sortTransactions— decorate-sort-undecorate usingbuildTransactionSortKey.
See also
- contract-read-diagnostics — failure classification used inside extraction.
- read-scope