OCF items from any source (desired state)
Current Canton state from getCapTableState()
Sync options
Replication diff with creates, edits, and deletes
const sourceItems = [
{ ocfId: 'stakeholder-1', entityType: 'stakeholder', data: {...} },
{ ocfId: 'stock-class-1', entityType: 'stockClass', data: {...} },
];
const cantonState = await getCapTableState(client, issuerPartyId);
const diff = computeReplicationDiff(sourceItems, cantonState, { syncDeletes: true });
// diff.creates = items in source but not Canton
// diff.deletes = items in Canton but not source
Compute what needs to be synced to Canton.
Compares a list of source items (desired state) against Canton state (actual state) and returns operations needed to synchronize them.