@open-captable-protocol/canton 0.2.208 → 0.2.210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/cantonOcfExtractor.d.ts +81 -0
- package/dist/utils/cantonOcfExtractor.d.ts.map +1 -0
- package/dist/utils/cantonOcfExtractor.js +291 -0
- package/dist/utils/cantonOcfExtractor.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract full OCF data from Canton for verification and comparison.
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities to fetch all OCF objects from Canton and transform them
|
|
5
|
+
* into a manifest format for cap table processing.
|
|
6
|
+
*
|
|
7
|
+
* The returned manifest structure is compatible with external OCF processing tools
|
|
8
|
+
* like buildCaptableInput/processCapTable from the fairmint/api repository.
|
|
9
|
+
*
|
|
10
|
+
* @module cantonOcfExtractor
|
|
11
|
+
*/
|
|
12
|
+
import type { LedgerJsonApiClient } from '@fairmint/canton-node-sdk';
|
|
13
|
+
import type { OcfEntityType } from '../functions/OpenCapTable/capTable/batchTypes';
|
|
14
|
+
import type { SupportedOcfReadType } from '../functions/OpenCapTable/capTable/damlToOcf';
|
|
15
|
+
import type { CapTableState } from '../functions/OpenCapTable/capTable/getCapTableState';
|
|
16
|
+
/**
|
|
17
|
+
* Core OCF entity types that have dedicated `get*AsOcf` functions.
|
|
18
|
+
* These are not included in SupportedOcfReadType but need special handling.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CORE_ENTITY_TYPES: Set<OcfEntityType>;
|
|
21
|
+
/**
|
|
22
|
+
* Entity types that are classified as transactions for buildCaptableInput.
|
|
23
|
+
* All entity types except core objects and a few non-transaction types.
|
|
24
|
+
*/
|
|
25
|
+
export declare const TRANSACTION_ENTITY_TYPES: Set<OcfEntityType>;
|
|
26
|
+
/**
|
|
27
|
+
* Entity types supported by getEntityAsOcf dispatcher.
|
|
28
|
+
* This matches the SupportedOcfReadType from damlToOcf.ts.
|
|
29
|
+
*/
|
|
30
|
+
export declare const SUPPORTED_READ_TYPES: Set<SupportedOcfReadType>;
|
|
31
|
+
/**
|
|
32
|
+
* OCF manifest structure compatible with processCapTable / buildCaptableInput.
|
|
33
|
+
*/
|
|
34
|
+
export interface OcfManifest {
|
|
35
|
+
issuer: Record<string, unknown> | null;
|
|
36
|
+
stockClasses: Array<Record<string, unknown>>;
|
|
37
|
+
stockPlans: Array<Record<string, unknown>>;
|
|
38
|
+
stakeholders: Array<Record<string, unknown>>;
|
|
39
|
+
transactions: Array<Record<string, unknown>>;
|
|
40
|
+
vestingTerms: Array<Record<string, unknown>>;
|
|
41
|
+
valuations: Array<Record<string, unknown>>;
|
|
42
|
+
documents: Array<Record<string, unknown>>;
|
|
43
|
+
stockLegendTemplates: Array<Record<string, unknown>>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Options for extracting OCF data from Canton.
|
|
47
|
+
*/
|
|
48
|
+
export interface ExtractCantonOcfOptions {
|
|
49
|
+
/** Log progress to console. Default: false */
|
|
50
|
+
verbose?: boolean;
|
|
51
|
+
/** Callback for logging (defaults to console.log when verbose) */
|
|
52
|
+
logger?: (message: string) => void;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Extract all OCF objects from Canton and return them in manifest format.
|
|
56
|
+
*
|
|
57
|
+
* This function fetches all entities from a CapTable contract and transforms
|
|
58
|
+
* them into an OCF manifest structure suitable for cap table processing.
|
|
59
|
+
*
|
|
60
|
+
* @param client - LedgerJsonApiClient instance
|
|
61
|
+
* @param cantonState - CapTableState from getCapTableState
|
|
62
|
+
* @param options - Extraction options
|
|
63
|
+
* @returns OCF manifest with all objects grouped by category
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { getCapTableState, extractCantonOcfManifest } from '@open-captable-protocol/canton';
|
|
68
|
+
*
|
|
69
|
+
* const cantonState = await getCapTableState(client, issuerPartyId);
|
|
70
|
+
* if (cantonState) {
|
|
71
|
+
* const manifest = await extractCantonOcfManifest(client, cantonState);
|
|
72
|
+
* // manifest.stakeholders, manifest.stockClasses, manifest.transactions, etc.
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare function extractCantonOcfManifest(client: LedgerJsonApiClient, cantonState: CapTableState, options?: ExtractCantonOcfOptions): Promise<OcfManifest>;
|
|
77
|
+
/**
|
|
78
|
+
* Count the total number of OCF objects in a manifest.
|
|
79
|
+
*/
|
|
80
|
+
export declare function countManifestObjects(manifest: OcfManifest): number;
|
|
81
|
+
//# sourceMappingURL=cantonOcfExtractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cantonOcfExtractor.d.ts","sourceRoot":"","sources":["../../src/utils/cantonOcfExtractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAEzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAC;AAkBzF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,GAAG,CAAC,aAAa,CAK/C,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,GAAG,CAAC,aAAa,CAiDtD,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,GAAG,CAAC,oBAAoB,CA2CzD,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,G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all OCF objects from Canton and transform them
|
|
6
|
+
* into a manifest format for cap table processing.
|
|
7
|
+
*
|
|
8
|
+
* The returned manifest structure is compatible with external OCF processing tools
|
|
9
|
+
* like buildCaptableInput/processCapTable from the fairmint/api repository.
|
|
10
|
+
*
|
|
11
|
+
* @module cantonOcfExtractor
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.SUPPORTED_READ_TYPES = exports.TRANSACTION_ENTITY_TYPES = exports.CORE_ENTITY_TYPES = void 0;
|
|
15
|
+
exports.extractCantonOcfManifest = extractCantonOcfManifest;
|
|
16
|
+
exports.countManifestObjects = countManifestObjects;
|
|
17
|
+
const damlToOcf_1 = require("../functions/OpenCapTable/capTable/damlToOcf");
|
|
18
|
+
const convertibleIssuance_1 = require("../functions/OpenCapTable/convertibleIssuance");
|
|
19
|
+
const document_1 = require("../functions/OpenCapTable/document");
|
|
20
|
+
const equityCompensationExercise_1 = require("../functions/OpenCapTable/equityCompensationExercise");
|
|
21
|
+
const equityCompensationIssuance_1 = require("../functions/OpenCapTable/equityCompensationIssuance");
|
|
22
|
+
const issuer_1 = require("../functions/OpenCapTable/issuer");
|
|
23
|
+
const issuerAuthorizedSharesAdjustment_1 = require("../functions/OpenCapTable/issuerAuthorizedSharesAdjustment");
|
|
24
|
+
const stakeholder_1 = require("../functions/OpenCapTable/stakeholder");
|
|
25
|
+
const stockClass_1 = require("../functions/OpenCapTable/stockClass");
|
|
26
|
+
const stockClassAuthorizedSharesAdjustment_1 = require("../functions/OpenCapTable/stockClassAuthorizedSharesAdjustment");
|
|
27
|
+
const stockIssuance_1 = require("../functions/OpenCapTable/stockIssuance");
|
|
28
|
+
const stockLegendTemplate_1 = require("../functions/OpenCapTable/stockLegendTemplate");
|
|
29
|
+
const stockPlan_1 = require("../functions/OpenCapTable/stockPlan");
|
|
30
|
+
const stockPlanPoolAdjustment_1 = require("../functions/OpenCapTable/stockPlanPoolAdjustment");
|
|
31
|
+
const valuation_1 = require("../functions/OpenCapTable/valuation");
|
|
32
|
+
const vestingTerms_1 = require("../functions/OpenCapTable/vestingTerms");
|
|
33
|
+
const warrantIssuance_1 = require("../functions/OpenCapTable/warrantIssuance");
|
|
34
|
+
/**
|
|
35
|
+
* Core OCF entity types that have dedicated `get*AsOcf` functions.
|
|
36
|
+
* These are not included in SupportedOcfReadType but need special handling.
|
|
37
|
+
*/
|
|
38
|
+
exports.CORE_ENTITY_TYPES = new Set([
|
|
39
|
+
'stakeholder',
|
|
40
|
+
'stockClass',
|
|
41
|
+
'stockPlan',
|
|
42
|
+
'vestingTerms',
|
|
43
|
+
]);
|
|
44
|
+
/**
|
|
45
|
+
* Entity types that are classified as transactions for buildCaptableInput.
|
|
46
|
+
* All entity types except core objects and a few non-transaction types.
|
|
47
|
+
*/
|
|
48
|
+
exports.TRANSACTION_ENTITY_TYPES = new Set([
|
|
49
|
+
// Stock Transactions
|
|
50
|
+
'stockIssuance',
|
|
51
|
+
'stockTransfer',
|
|
52
|
+
'stockCancellation',
|
|
53
|
+
'stockRetraction',
|
|
54
|
+
'stockRepurchase',
|
|
55
|
+
'stockAcceptance',
|
|
56
|
+
'stockReissuance',
|
|
57
|
+
'stockConversion',
|
|
58
|
+
'stockConsolidation',
|
|
59
|
+
// Stock Class Adjustments
|
|
60
|
+
'stockClassAuthorizedSharesAdjustment',
|
|
61
|
+
'stockClassConversionRatioAdjustment',
|
|
62
|
+
'stockClassSplit',
|
|
63
|
+
'issuerAuthorizedSharesAdjustment',
|
|
64
|
+
// Stock Plan Events
|
|
65
|
+
'stockPlanPoolAdjustment',
|
|
66
|
+
'stockPlanReturnToPool',
|
|
67
|
+
// Convertible Transactions
|
|
68
|
+
'convertibleIssuance',
|
|
69
|
+
'convertibleTransfer',
|
|
70
|
+
'convertibleCancellation',
|
|
71
|
+
'convertibleRetraction',
|
|
72
|
+
'convertibleAcceptance',
|
|
73
|
+
'convertibleConversion',
|
|
74
|
+
// Warrant Transactions
|
|
75
|
+
'warrantIssuance',
|
|
76
|
+
'warrantTransfer',
|
|
77
|
+
'warrantCancellation',
|
|
78
|
+
'warrantAcceptance',
|
|
79
|
+
'warrantExercise',
|
|
80
|
+
'warrantRetraction',
|
|
81
|
+
// Equity Compensation Transactions
|
|
82
|
+
'equityCompensationIssuance',
|
|
83
|
+
'equityCompensationTransfer',
|
|
84
|
+
'equityCompensationCancellation',
|
|
85
|
+
'equityCompensationRetraction',
|
|
86
|
+
'equityCompensationAcceptance',
|
|
87
|
+
'equityCompensationRelease',
|
|
88
|
+
'equityCompensationExercise',
|
|
89
|
+
'equityCompensationRepricing',
|
|
90
|
+
// Stakeholder Events
|
|
91
|
+
'stakeholderRelationshipChangeEvent',
|
|
92
|
+
'stakeholderStatusChangeEvent',
|
|
93
|
+
// Vesting Events
|
|
94
|
+
'vestingAcceleration',
|
|
95
|
+
'vestingEvent',
|
|
96
|
+
'vestingStart',
|
|
97
|
+
]);
|
|
98
|
+
/**
|
|
99
|
+
* Entity types supported by getEntityAsOcf dispatcher.
|
|
100
|
+
* This matches the SupportedOcfReadType from damlToOcf.ts.
|
|
101
|
+
*/
|
|
102
|
+
exports.SUPPORTED_READ_TYPES = new Set([
|
|
103
|
+
// Acceptance types
|
|
104
|
+
'stockAcceptance',
|
|
105
|
+
'convertibleAcceptance',
|
|
106
|
+
'equityCompensationAcceptance',
|
|
107
|
+
'warrantAcceptance',
|
|
108
|
+
// Stock class adjustments
|
|
109
|
+
'stockClassConversionRatioAdjustment',
|
|
110
|
+
'stockClassSplit',
|
|
111
|
+
'stockConsolidation',
|
|
112
|
+
// Valuation and vesting
|
|
113
|
+
'valuation',
|
|
114
|
+
'vestingAcceleration',
|
|
115
|
+
'vestingEvent',
|
|
116
|
+
'vestingStart',
|
|
117
|
+
// Other stock operations
|
|
118
|
+
'stockRetraction',
|
|
119
|
+
'stockConversion',
|
|
120
|
+
'stockPlanReturnToPool',
|
|
121
|
+
'stockReissuance',
|
|
122
|
+
'stockRepurchase',
|
|
123
|
+
// Warrant operations
|
|
124
|
+
'warrantExercise',
|
|
125
|
+
'warrantRetraction',
|
|
126
|
+
'warrantTransfer',
|
|
127
|
+
'warrantCancellation',
|
|
128
|
+
// Convertible operations
|
|
129
|
+
'convertibleConversion',
|
|
130
|
+
'convertibleRetraction',
|
|
131
|
+
'convertibleTransfer',
|
|
132
|
+
'convertibleCancellation',
|
|
133
|
+
// Equity compensation
|
|
134
|
+
'equityCompensationRelease',
|
|
135
|
+
'equityCompensationRepricing',
|
|
136
|
+
'equityCompensationRetraction',
|
|
137
|
+
'equityCompensationTransfer',
|
|
138
|
+
'equityCompensationCancellation',
|
|
139
|
+
// Transfer/cancellation
|
|
140
|
+
'stockTransfer',
|
|
141
|
+
'stockCancellation',
|
|
142
|
+
// Stakeholder events
|
|
143
|
+
'stakeholderRelationshipChangeEvent',
|
|
144
|
+
'stakeholderStatusChangeEvent',
|
|
145
|
+
]);
|
|
146
|
+
/**
|
|
147
|
+
* Extract all OCF objects from Canton and return them in manifest format.
|
|
148
|
+
*
|
|
149
|
+
* This function fetches all entities from a CapTable contract and transforms
|
|
150
|
+
* them into an OCF manifest structure suitable for cap table processing.
|
|
151
|
+
*
|
|
152
|
+
* @param client - LedgerJsonApiClient instance
|
|
153
|
+
* @param cantonState - CapTableState from getCapTableState
|
|
154
|
+
* @param options - Extraction options
|
|
155
|
+
* @returns OCF manifest with all objects grouped by category
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* import { getCapTableState, extractCantonOcfManifest } from '@open-captable-protocol/canton';
|
|
160
|
+
*
|
|
161
|
+
* const cantonState = await getCapTableState(client, issuerPartyId);
|
|
162
|
+
* if (cantonState) {
|
|
163
|
+
* const manifest = await extractCantonOcfManifest(client, cantonState);
|
|
164
|
+
* // manifest.stakeholders, manifest.stockClasses, manifest.transactions, etc.
|
|
165
|
+
* }
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
async function extractCantonOcfManifest(client, cantonState, options = {}) {
|
|
169
|
+
const { verbose = false } = options;
|
|
170
|
+
// eslint-disable-next-line no-console
|
|
171
|
+
const log = options.logger ?? (verbose ? (msg) => console.log(msg) : () => { });
|
|
172
|
+
const result = {
|
|
173
|
+
issuer: null,
|
|
174
|
+
stockClasses: [],
|
|
175
|
+
stockPlans: [],
|
|
176
|
+
stakeholders: [],
|
|
177
|
+
transactions: [],
|
|
178
|
+
vestingTerms: [],
|
|
179
|
+
valuations: [],
|
|
180
|
+
documents: [],
|
|
181
|
+
stockLegendTemplates: [],
|
|
182
|
+
};
|
|
183
|
+
// Fetch issuer
|
|
184
|
+
if (cantonState.issuerContractId) {
|
|
185
|
+
try {
|
|
186
|
+
const { issuer } = await (0, issuer_1.getIssuerAsOcf)(client, { contractId: cantonState.issuerContractId });
|
|
187
|
+
result.issuer = issuer;
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
191
|
+
log(` ⚠️ Failed to fetch issuer: ${msg}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// Process each entity type from the cap table
|
|
195
|
+
for (const [entityType, ocfIdToContractId] of cantonState.contractIds) {
|
|
196
|
+
for (const [ocfId, contractId] of ocfIdToContractId) {
|
|
197
|
+
try {
|
|
198
|
+
// Handle core objects with their specific functions
|
|
199
|
+
if (entityType === 'stakeholder') {
|
|
200
|
+
const { stakeholder } = await (0, stakeholder_1.getStakeholderAsOcf)(client, { contractId });
|
|
201
|
+
result.stakeholders.push(stakeholder);
|
|
202
|
+
}
|
|
203
|
+
else if (entityType === 'stockClass') {
|
|
204
|
+
const { stockClass } = await (0, stockClass_1.getStockClassAsOcf)(client, { contractId });
|
|
205
|
+
result.stockClasses.push(stockClass);
|
|
206
|
+
}
|
|
207
|
+
else if (entityType === 'stockPlan') {
|
|
208
|
+
const { stockPlan } = await (0, stockPlan_1.getStockPlanAsOcf)(client, { contractId });
|
|
209
|
+
result.stockPlans.push(stockPlan);
|
|
210
|
+
}
|
|
211
|
+
else if (entityType === 'vestingTerms') {
|
|
212
|
+
const { vestingTerms } = await (0, vestingTerms_1.getVestingTermsAsOcf)(client, { contractId });
|
|
213
|
+
result.vestingTerms.push(vestingTerms);
|
|
214
|
+
}
|
|
215
|
+
else if (entityType === 'stockIssuance') {
|
|
216
|
+
const { stockIssuance } = await (0, stockIssuance_1.getStockIssuanceAsOcf)(client, { contractId });
|
|
217
|
+
result.transactions.push(stockIssuance);
|
|
218
|
+
}
|
|
219
|
+
else if (entityType === 'convertibleIssuance') {
|
|
220
|
+
const { event } = await (0, convertibleIssuance_1.getConvertibleIssuanceAsOcf)(client, { contractId });
|
|
221
|
+
result.transactions.push(event);
|
|
222
|
+
}
|
|
223
|
+
else if (entityType === 'warrantIssuance') {
|
|
224
|
+
const { event } = await (0, warrantIssuance_1.getWarrantIssuanceAsOcf)(client, { contractId });
|
|
225
|
+
result.transactions.push(event);
|
|
226
|
+
}
|
|
227
|
+
else if (entityType === 'equityCompensationIssuance') {
|
|
228
|
+
const { event } = await (0, equityCompensationIssuance_1.getEquityCompensationIssuanceAsOcf)(client, { contractId });
|
|
229
|
+
result.transactions.push(event);
|
|
230
|
+
}
|
|
231
|
+
else if (entityType === 'equityCompensationExercise') {
|
|
232
|
+
const { event } = await (0, equityCompensationExercise_1.getEquityCompensationExerciseAsOcf)(client, { contractId });
|
|
233
|
+
result.transactions.push(event);
|
|
234
|
+
}
|
|
235
|
+
else if (entityType === 'stockClassAuthorizedSharesAdjustment') {
|
|
236
|
+
const { event } = await (0, stockClassAuthorizedSharesAdjustment_1.getStockClassAuthorizedSharesAdjustmentAsOcf)(client, { contractId });
|
|
237
|
+
result.transactions.push(event);
|
|
238
|
+
}
|
|
239
|
+
else if (entityType === 'issuerAuthorizedSharesAdjustment') {
|
|
240
|
+
const { event } = await (0, issuerAuthorizedSharesAdjustment_1.getIssuerAuthorizedSharesAdjustmentAsOcf)(client, { contractId });
|
|
241
|
+
result.transactions.push(event);
|
|
242
|
+
}
|
|
243
|
+
else if (entityType === 'stockPlanPoolAdjustment') {
|
|
244
|
+
const { event } = await (0, stockPlanPoolAdjustment_1.getStockPlanPoolAdjustmentAsOcf)(client, { contractId });
|
|
245
|
+
result.transactions.push(event);
|
|
246
|
+
}
|
|
247
|
+
else if (entityType === 'valuation') {
|
|
248
|
+
const { valuation } = await (0, valuation_1.getValuationAsOcf)(client, { contractId });
|
|
249
|
+
result.valuations.push(valuation);
|
|
250
|
+
}
|
|
251
|
+
else if (entityType === 'document') {
|
|
252
|
+
const { document } = await (0, document_1.getDocumentAsOcf)(client, { contractId });
|
|
253
|
+
result.documents.push(document);
|
|
254
|
+
}
|
|
255
|
+
else if (entityType === 'stockLegendTemplate') {
|
|
256
|
+
const { stockLegendTemplate } = await (0, stockLegendTemplate_1.getStockLegendTemplateAsOcf)(client, { contractId });
|
|
257
|
+
result.stockLegendTemplates.push(stockLegendTemplate);
|
|
258
|
+
}
|
|
259
|
+
else if (exports.SUPPORTED_READ_TYPES.has(entityType) &&
|
|
260
|
+
exports.TRANSACTION_ENTITY_TYPES.has(entityType)) {
|
|
261
|
+
// Handle remaining transaction types with the generic dispatcher
|
|
262
|
+
const supportedType = entityType;
|
|
263
|
+
const { data } = await (0, damlToOcf_1.getEntityAsOcf)(client, supportedType, contractId);
|
|
264
|
+
result.transactions.push(data);
|
|
265
|
+
}
|
|
266
|
+
// Unsupported types are silently skipped
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
270
|
+
log(` ⚠️ Failed to fetch ${entityType}/${ocfId}: ${msg}`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return result;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Count the total number of OCF objects in a manifest.
|
|
278
|
+
*/
|
|
279
|
+
function countManifestObjects(manifest) {
|
|
280
|
+
let count = manifest.issuer ? 1 : 0;
|
|
281
|
+
count += manifest.stakeholders.length;
|
|
282
|
+
count += manifest.stockClasses.length;
|
|
283
|
+
count += manifest.stockPlans.length;
|
|
284
|
+
count += manifest.vestingTerms.length;
|
|
285
|
+
count += manifest.transactions.length;
|
|
286
|
+
count += manifest.valuations.length;
|
|
287
|
+
count += manifest.documents.length;
|
|
288
|
+
count += manifest.stockLegendTemplates.length;
|
|
289
|
+
return count;
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=cantonOcfExtractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cantonOcfExtractor.js","sourceRoot":"","sources":["../../src/utils/cantonOcfExtractor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AA0LH,4DAoGC;AAKD,oDAWC;AAzSD,4EAA8E;AAE9E,uFAA4F;AAC5F,iEAAsE;AACtE,qGAA0G;AAC1G,qGAA0G;AAC1G,6DAAkE;AAClE,iHAAsH;AACtH,uEAA4E;AAC5E,qEAA0E;AAC1E,yHAA8H;AAC9H,2EAAgF;AAChF,uFAA4F;AAC5F,mEAAwE;AACxE,+FAAoG;AACpG,mEAAwE;AACxE,yEAA8E;AAC9E,+EAAoF;AAEpF;;;GAGG;AACU,QAAA,iBAAiB,GAAuB,IAAI,GAAG,CAAC;IAC3D,aAAa;IACb,YAAY;IACZ,WAAW;IACX,cAAc;CACf,CAAC,CAAC;AAEH;;;GAGG;AACU,QAAA,wBAAwB,GAAuB,IAAI,GAAG,CAAC;IAClE,qBAAqB;IACrB,eAAe;IACf,eAAe;IACf,mBAAmB;IACnB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,oBAAoB;IACpB,0BAA0B;IAC1B,sCAAsC;IACtC,qCAAqC;IACrC,iBAAiB;IACjB,kCAAkC;IAClC,oBAAoB;IACpB,yBAAyB;IACzB,uBAAuB;IACvB,2BAA2B;IAC3B,qBAAqB;IACrB,qBAAqB;IACrB,yBAAy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AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cantonOcfExtractor"), exports);
|
|
17
18
|
__exportStar(require("./deprecatedFieldNormalization"), exports);
|
|
18
19
|
__exportStar(require("./entityValidators"), exports);
|
|
19
20
|
__exportStar(require("./enumConversions"), exports);
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,qDAAmC;AACnC,oDAAkC;AAClC,kDAAgC;AAChC,+CAA6B;AAC7B,gDAA8B;AAC9B,wDAAsC;AACtC,uDAAqC;AACrC,uDAAqC;AACrC,oDAAkC;AAClC,+CAA6B;AAC7B,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,iEAA+C;AAC/C,qDAAmC;AACnC,oDAAkC;AAClC,kDAAgC;AAChC,+CAA6B;AAC7B,gDAA8B;AAC9B,wDAAsC;AACtC,uDAAqC;AACrC,uDAAqC;AACrC,oDAAkC;AAClC,+CAA6B;AAC7B,+CAA6B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-captable-protocol/canton",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.210",
|
|
4
4
|
"description": "A TypeScript SDK for interacting with the Open CapTable Protocol (OCP) Factory contract on Canton blockchain",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|