Utilities for extracting cap table state, building OCF manifests, syncing with a database, and diagnosing read failures.
Canton OCF extractor
cantonOcfExtractor — turn a CapTableState into an OcfManifest for bulk export or verification.
import { extractCantonOcfManifest, countManifestObjects } from '@open-captable-protocol/canton';
const state = await ocp.OpenCapTable.capTable.getState(issuerPartyId);
const manifest = await extractCantonOcfManifest(ocp.ledger, state, issuerPartyId);
Key exports: extractCantonOcfManifest, countManifestObjects, sortTransactions, buildTransactionSortKey
Replication helpers
replicationHelpers — compare a Canton manifest against a relational projection to find drift.
import { computeReplicationDiff, buildCantonOcfDataMap } from '@open-captable-protocol/canton';
Key exports: computeReplicationDiff, buildCantonOcfDataMap, mapCategorizedTypeToEntityType, isOcfEntityType, TRANSACTION_SUBTYPE_MAP
Plan security aliases
planSecurityAliases — normalize legacy “Plan Security” entity types to their current equity-compensation equivalents.
import { normalizeEntityType, normalizeObjectType } from '@open-captable-protocol/canton';
Key exports: PLAN_SECURITY_TO_EQUITY_COMPENSATION_MAP, normalizeEntityType, normalizeObjectType, normalizeOcfData, isPlanSecurityEntityType, deepNormalizeNumericStrings
Transaction helpers
transactionHelpers — navigate submitAndWaitForTransactionTree results.
import { findCreatedEventsByTemplateId, buildOcfIdToContractIdMap } from '@open-captable-protocol/canton';
Key exports: findCreatedEventsByTemplateId, extractOcfIdFromEvent, buildOcfIdToContractIdMap, buildAllOcfIdMaps, buildAllOcfEventArrays, safeGet
Template identity
templateIdentity — parse and compare DAML template ID strings for multi-version deployments.
import { parseTemplateIdentity, matchesTemplateIdentity } from '@open-captable-protocol/canton';
Key exports: parseTemplateIdentity, tryParseTemplateIdentity, compareTemplateIdentity, matchesTemplateIdentity, assertTemplateIdentity
Contract read diagnostics
contractReadDiagnostics — classify and normalize Canton read failures for extractors.
Key exports: classifyReadFailure, buildOcpContractError, ContractReadResult