@open-captable-protocol/canton 0.0.15 → 0.0.16
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/OcpClient.d.ts +1 -8
- package/dist/OcpClient.d.ts.map +1 -1
- package/dist/OcpClient.js +7 -14
- package/dist/OcpClient.js.map +1 -1
- package/dist/functions/companyValuationReport/addObserversToCompanyValuationReport.d.ts.map +1 -1
- package/dist/functions/companyValuationReport/addObserversToCompanyValuationReport.js +18 -9
- package/dist/functions/companyValuationReport/addObserversToCompanyValuationReport.js.map +1 -1
- package/dist/functions/companyValuationReport/confirmCurrentCompanyValuationReport.d.ts.map +1 -1
- package/dist/functions/companyValuationReport/confirmCurrentCompanyValuationReport.js +7 -8
- package/dist/functions/companyValuationReport/confirmCurrentCompanyValuationReport.js.map +1 -1
- package/dist/functions/companyValuationReport/createCompanyValuationReport.d.ts.map +1 -1
- package/dist/functions/companyValuationReport/createCompanyValuationReport.js +8 -8
- package/dist/functions/companyValuationReport/createCompanyValuationReport.js.map +1 -1
- package/dist/functions/companyValuationReport/index.d.ts +4 -0
- package/dist/functions/companyValuationReport/index.d.ts.map +1 -0
- package/dist/functions/companyValuationReport/index.js +20 -0
- package/dist/functions/companyValuationReport/index.js.map +1 -0
- package/dist/functions/companyValuationReport/updateCompanyValuation.d.ts.map +1 -1
- package/dist/functions/companyValuationReport/updateCompanyValuation.js +18 -9
- package/dist/functions/companyValuationReport/updateCompanyValuation.js.map +1 -1
- package/dist/functions/index.d.ts +2 -7
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.js +2 -7
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/issuer/authorizeIssuer.d.ts.map +1 -1
- package/dist/functions/issuer/authorizeIssuer.js +13 -8
- package/dist/functions/issuer/authorizeIssuer.js.map +1 -1
- package/dist/functions/issuer/createIssuer.d.ts.map +1 -1
- package/dist/functions/issuer/createIssuer.js +11 -8
- package/dist/functions/issuer/createIssuer.js.map +1 -1
- package/dist/functions/issuer/index.d.ts +4 -0
- package/dist/functions/issuer/index.d.ts.map +1 -0
- package/dist/functions/issuer/index.js +20 -0
- package/dist/functions/issuer/index.js.map +1 -0
- package/dist/functions/issuer/updateIssuerData.d.ts.map +1 -1
- package/dist/functions/issuer/updateIssuerData.js +11 -1
- package/dist/functions/issuer/updateIssuerData.js.map +1 -1
- package/dist/utils/findCreatedEvent.d.ts +20 -0
- package/dist/utils/findCreatedEvent.d.ts.map +1 -0
- package/dist/utils/findCreatedEvent.js +22 -0
- package/dist/utils/findCreatedEvent.js.map +1 -0
- package/package.json +4 -5
package/dist/OcpClient.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { ClientConfig } from '@fairmint/canton-node-sdk';
|
|
2
|
-
import { AuthorizeIssuerParams, AuthorizeIssuerResult } from './functions
|
|
3
|
-
import { CreateIssuerParams, CreateIssuerResult } from './functions/issuer/createIssuer';
|
|
4
|
-
import { UpdateIssuerDataParams, UpdateIssuerDataResult } from './functions/issuer/updateIssuerData';
|
|
5
|
-
import { CreateCompanyValuationReportParams, CreateCompanyValuationReportResult } from './functions/companyValuationReport/createCompanyValuationReport';
|
|
6
|
-
import { UpdateCompanyValuationParams, UpdateCompanyValuationResult } from './functions/companyValuationReport/updateCompanyValuation';
|
|
7
|
-
import { ConfirmCurrentCompanyValuationReportParams, ConfirmCurrentCompanyValuationReportResult } from './functions/companyValuationReport/confirmCurrentCompanyValuationReport';
|
|
8
|
-
import { AddObserversToCompanyValuationReportParams, AddObserversToCompanyValuationReportResult } from './functions/companyValuationReport/addObserversToCompanyValuationReport';
|
|
2
|
+
import { AuthorizeIssuerParams, AuthorizeIssuerResult, CreateIssuerParams, CreateIssuerResult, UpdateIssuerDataParams, UpdateIssuerDataResult, CreateCompanyValuationReportParams, CreateCompanyValuationReportResult, UpdateCompanyValuationParams, UpdateCompanyValuationResult, AddObserversToCompanyValuationReportParams, AddObserversToCompanyValuationReportResult } from './functions';
|
|
9
3
|
export declare class OcpClient {
|
|
10
4
|
private client;
|
|
11
5
|
issuer: {
|
|
@@ -16,7 +10,6 @@ export declare class OcpClient {
|
|
|
16
10
|
companyValuationReport: {
|
|
17
11
|
createCompanyValuationReport: (params: CreateCompanyValuationReportParams) => Promise<CreateCompanyValuationReportResult>;
|
|
18
12
|
updateCompanyValuation: (params: UpdateCompanyValuationParams) => Promise<UpdateCompanyValuationResult>;
|
|
19
|
-
confirmCurrentCompanyValuationReport: (params: ConfirmCurrentCompanyValuationReportParams) => Promise<ConfirmCurrentCompanyValuationReportResult>;
|
|
20
13
|
addObserversToCompanyValuationReport: (params: AddObserversToCompanyValuationReportParams) => Promise<AddObserversToCompanyValuationReportResult>;
|
|
21
14
|
};
|
|
22
15
|
constructor(config?: ClientConfig);
|
package/dist/OcpClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OcpClient.d.ts","sourceRoot":"","sources":["../src/OcpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAmB,qBAAqB,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"OcpClient.d.ts","sourceRoot":"","sources":["../src/OcpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAmB,qBAAqB,EAAE,qBAAqB,EAAe,kBAAkB,EAAE,kBAAkB,EAAoB,sBAAsB,EAAE,sBAAsB,EAAgC,kCAAkC,EAAE,kCAAkC,EAAyB,4BAA4B,EAAE,4BAA4B,EAAyC,0CAA0C,EAAE,0CAA0C,EAAE,MAAM,aAAa,CAAC;AAE3gB,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAsB;IAE7B,MAAM,EAAE;QACb,eAAe,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;QACnF,YAAY,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC1E,gBAAgB,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;KACvF,CAAC;IAEK,sBAAsB,EAAE;QAC7B,4BAA4B,EAAE,CAC5B,MAAM,EAAE,kCAAkC,KACvC,OAAO,CAAC,kCAAkC,CAAC,CAAC;QACjD,sBAAsB,EAAE,CACtB,MAAM,EAAE,4BAA4B,KACjC,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAC3C,oCAAoC,EAAE,CACpC,MAAM,EAAE,0CAA0C,KAC/C,OAAO,CAAC,0CAA0C,CAAC,CAAC;KAC1D,CAAC;gBAEU,MAAM,CAAC,EAAE,YAAY;CAmBlC"}
|
package/dist/OcpClient.js
CHANGED
|
@@ -2,26 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OcpClient = void 0;
|
|
4
4
|
const canton_node_sdk_1 = require("@fairmint/canton-node-sdk");
|
|
5
|
-
const
|
|
6
|
-
const createIssuer_1 = require("./functions/issuer/createIssuer");
|
|
7
|
-
const updateIssuerData_1 = require("./functions/issuer/updateIssuerData");
|
|
8
|
-
const createCompanyValuationReport_1 = require("./functions/companyValuationReport/createCompanyValuationReport");
|
|
9
|
-
const updateCompanyValuation_1 = require("./functions/companyValuationReport/updateCompanyValuation");
|
|
10
|
-
const confirmCurrentCompanyValuationReport_1 = require("./functions/companyValuationReport/confirmCurrentCompanyValuationReport");
|
|
11
|
-
const addObserversToCompanyValuationReport_1 = require("./functions/companyValuationReport/addObserversToCompanyValuationReport");
|
|
5
|
+
const functions_1 = require("./functions");
|
|
12
6
|
class OcpClient {
|
|
13
7
|
constructor(config) {
|
|
14
8
|
this.client = new canton_node_sdk_1.LedgerJsonApiClient(config);
|
|
15
9
|
this.issuer = {
|
|
16
|
-
authorizeIssuer: (params) => (0,
|
|
17
|
-
createIssuer: (params) => (0,
|
|
18
|
-
updateIssuerData: (params) => (0,
|
|
10
|
+
authorizeIssuer: (params) => (0, functions_1.authorizeIssuer)(this.client, params),
|
|
11
|
+
createIssuer: (params) => (0, functions_1.createIssuer)(this.client, params),
|
|
12
|
+
updateIssuerData: (params) => (0, functions_1.updateIssuerData)(this.client, params)
|
|
19
13
|
};
|
|
20
14
|
this.companyValuationReport = {
|
|
21
|
-
createCompanyValuationReport: (params) => (0,
|
|
22
|
-
updateCompanyValuation: (params) => (0,
|
|
23
|
-
|
|
24
|
-
addObserversToCompanyValuationReport: (params) => (0, addObserversToCompanyValuationReport_1.addObserversToCompanyValuationReport)(this.client, params)
|
|
15
|
+
createCompanyValuationReport: (params) => (0, functions_1.createCompanyValuationReport)(this.client, params),
|
|
16
|
+
updateCompanyValuation: (params) => (0, functions_1.updateCompanyValuation)(this.client, params),
|
|
17
|
+
addObserversToCompanyValuationReport: (params) => (0, functions_1.addObserversToCompanyValuationReport)(this.client, params)
|
|
25
18
|
};
|
|
26
19
|
}
|
|
27
20
|
}
|
package/dist/OcpClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OcpClient.js","sourceRoot":"","sources":["../src/OcpClient.ts"],"names":[],"mappings":";;;AAAA,+DAA8E;AAC9E,
|
|
1
|
+
{"version":3,"file":"OcpClient.js","sourceRoot":"","sources":["../src/OcpClient.ts"],"names":[],"mappings":";;;AAAA,+DAA8E;AAC9E,2CAA2gB;AAE3gB,MAAa,SAAS;IAqBpB,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,qCAAmB,CAAC,MAAM,CAAC,CAAC;QAE9C,IAAI,CAAC,MAAM,GAAG;YACZ,eAAe,EAAE,CAAC,MAA6B,EAAE,EAAE,CAAC,IAAA,2BAAe,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;YACxF,YAAY,EAAE,CAAC,MAA0B,EAAE,EAAE,CAAC,IAAA,wBAAY,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;YAC/E,gBAAgB,EAAE,CAAC,MAA8B,EAAE,EAAE,CAAC,IAAA,4BAAgB,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;SAC5F,CAAC;QAEF,IAAI,CAAC,sBAAsB,GAAG;YAC5B,4BAA4B,EAAE,CAAC,MAA0C,EAAE,EAAE,CAC3E,IAAA,wCAA4B,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;YACnD,sBAAsB,EAAE,CAAC,MAAoC,EAAE,EAAE,CAC/D,IAAA,kCAAsB,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;YAC7C,oCAAoC,EAAE,CACpC,MAAkD,EAClD,EAAE,CAAC,IAAA,gDAAoC,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;SAC/D,CAAC;IACJ,CAAC;CACF;AAxCD,8BAwCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addObserversToCompanyValuationReport.d.ts","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/addObserversToCompanyValuationReport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"addObserversToCompanyValuationReport.d.ts","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/addObserversToCompanyValuationReport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,WAAW,0CAA0C;IACzD,gCAAgC,EAAE,MAAM,CAAC;IACzC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,0CAA0C;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAUD;;GAEG;AACH,wBAAsB,oCAAoC,CACxD,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,0CAA0C,GACjD,OAAO,CAAC,0CAA0C,CAAC,CA8CrD"}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addObserversToCompanyValuationReport = addObserversToCompanyValuationReport;
|
|
4
4
|
const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
|
|
5
|
+
const findCreatedEvent_1 = require("../../utils/findCreatedEvent");
|
|
6
|
+
function hasSystemOperator(arg) {
|
|
7
|
+
return !!arg && typeof arg === 'object' && typeof arg.system_operator === 'string';
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* Add observers to a CompanyValuationReport by exercising AddObservers.
|
|
7
11
|
*/
|
|
@@ -10,7 +14,14 @@ async function addObserversToCompanyValuationReport(client, params) {
|
|
|
10
14
|
const eventsResponse = await client.getEventsByContractId({
|
|
11
15
|
contractId: params.companyValuationReportContractId
|
|
12
16
|
});
|
|
13
|
-
|
|
17
|
+
if (!eventsResponse.created?.createdEvent?.createArgument) {
|
|
18
|
+
throw new Error('Invalid contract events response: missing created event or create argument');
|
|
19
|
+
}
|
|
20
|
+
const createArgument = eventsResponse.created.createdEvent.createArgument;
|
|
21
|
+
if (!hasSystemOperator(createArgument)) {
|
|
22
|
+
throw new Error('System operator not found in contract create argument');
|
|
23
|
+
}
|
|
24
|
+
const systemOperator = createArgument.system_operator;
|
|
14
25
|
const choiceArguments = {
|
|
15
26
|
added: params.added
|
|
16
27
|
};
|
|
@@ -27,15 +38,13 @@ async function addObserversToCompanyValuationReport(client, params) {
|
|
|
27
38
|
}
|
|
28
39
|
]
|
|
29
40
|
});
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
return {
|
|
33
|
-
contractId: event.CreatedTreeEvent.value.contractId,
|
|
34
|
-
updateId: response.transactionTree.updateId
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
41
|
+
const created = (0, findCreatedEvent_1.findCreatedEventByTemplateId)(response, open_captable_protocol_daml_js_1.Fairmint.OpenCapTable.CompanyValuationReport.CompanyValuationReport.templateId);
|
|
42
|
+
if (!created) {
|
|
38
43
|
throw new Error('Expected CreatedTreeEvent not found');
|
|
39
44
|
}
|
|
45
|
+
return {
|
|
46
|
+
contractId: created.CreatedTreeEvent.value.contractId,
|
|
47
|
+
updateId: response.transactionTree.updateId
|
|
48
|
+
};
|
|
40
49
|
}
|
|
41
50
|
//# sourceMappingURL=addObserversToCompanyValuationReport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addObserversToCompanyValuationReport.js","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/addObserversToCompanyValuationReport.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"addObserversToCompanyValuationReport.js","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/addObserversToCompanyValuationReport.ts"],"names":[],"mappings":";;AA0BA,oFAiDC;AA3ED,6FAAoE;AAGpE,mEAA4E;AAgB5E,SAAS,iBAAiB,CAAC,GAAY;IACrC,OAAO,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAQ,GAAiD,CAAC,eAAe,KAAK,QAAQ,CAAC;AACpI,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,oCAAoC,CACxD,MAA2B,EAC3B,MAAkD;IAElD,sEAAsE;IACtE,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;QACxD,UAAU,EAAE,MAAM,CAAC,gCAAgC;KACpD,CAAC,CAAC;IAEH,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;IAChG,CAAC;IAED,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC;IAC1E,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IACD,MAAM,cAAc,GAAG,cAAc,CAAC,eAAe,CAAC;IAEtD,MAAM,eAAe,GAA8D;QACjF,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC;QAC5D,KAAK,EAAE,CAAC,cAAc,CAAC;QACvB,QAAQ,EAAE;YACR;gBACE,eAAe,EAAE;oBACf,UAAU,EAAE,yCAAQ,CAAC,YAAY,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,UAAU;oBAC1F,UAAU,EAAE,MAAM,CAAC,gCAAgC;oBACnD,MAAM,EAAE,cAAc;oBACtB,cAAc,EAAE,eAAe;iBAChC;aACF;SACF;KACF,CAA4C,CAAC;IAE9C,MAAM,OAAO,GAAG,IAAA,+CAA4B,EAC1C,QAAQ,EACR,yCAAQ,CAAC,YAAY,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,UAAU,CAC/E,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU;QACrD,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,QAAQ;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmCurrentCompanyValuationReport.d.ts","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/confirmCurrentCompanyValuationReport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"confirmCurrentCompanyValuationReport.d.ts","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/confirmCurrentCompanyValuationReport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,WAAW,0CAA0C;IACzD,gCAAgC,EAAE,MAAM,CAAC;CAC1C;AAED,MAAM,WAAW,0CAA0C;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,oCAAoC,CACxD,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,0CAA0C,GACjD,OAAO,CAAC,0CAA0C,CAAC,CAmCrD"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.confirmCurrentCompanyValuationReport = confirmCurrentCompanyValuationReport;
|
|
4
4
|
const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
|
|
5
|
+
const findCreatedEvent_1 = require("../../utils/findCreatedEvent");
|
|
5
6
|
/**
|
|
6
7
|
* Confirm the current company valuation on a CompanyValuationReport by exercising ConfirmCurrent.
|
|
7
8
|
*/
|
|
@@ -25,15 +26,13 @@ async function confirmCurrentCompanyValuationReport(client, params) {
|
|
|
25
26
|
}
|
|
26
27
|
]
|
|
27
28
|
});
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
return {
|
|
31
|
-
contractId: event.CreatedTreeEvent.value.contractId,
|
|
32
|
-
updateId: response.transactionTree.updateId
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
29
|
+
const created = (0, findCreatedEvent_1.findCreatedEventByTemplateId)(response, open_captable_protocol_daml_js_1.Fairmint.OpenCapTable.CompanyValuationReport.CompanyValuationReport.templateId);
|
|
30
|
+
if (!created) {
|
|
36
31
|
throw new Error('Expected CreatedTreeEvent not found');
|
|
37
32
|
}
|
|
33
|
+
return {
|
|
34
|
+
contractId: created.CreatedTreeEvent.value.contractId,
|
|
35
|
+
updateId: response.transactionTree.updateId
|
|
36
|
+
};
|
|
38
37
|
}
|
|
39
38
|
//# sourceMappingURL=confirmCurrentCompanyValuationReport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmCurrentCompanyValuationReport.js","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/confirmCurrentCompanyValuationReport.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"confirmCurrentCompanyValuationReport.js","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/confirmCurrentCompanyValuationReport.ts"],"names":[],"mappings":";;AAiBA,oFAsCC;AAvDD,6FAAoE;AAGpE,mEAA4E;AAW5E;;GAEG;AACI,KAAK,UAAU,oCAAoC,CACxD,MAA2B,EAC3B,MAAkD;IAElD,sEAAsE;IACtE,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;QACxD,UAAU,EAAE,MAAM,CAAC,gCAAgC;KACpD,CAAC,CAAC;IACH,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,eAAe,CAAC;IAE1F,MAAM,eAAe,GAAgE,EAAE,CAAC;IAExF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC;QAC5D,KAAK,EAAE,CAAC,cAAc,CAAC;QACvB,QAAQ,EAAE;YACR;gBACE,eAAe,EAAE;oBACf,UAAU,EAAE,yCAAQ,CAAC,YAAY,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,UAAU;oBAC1F,UAAU,EAAE,MAAM,CAAC,gCAAgC;oBACnD,MAAM,EAAE,gBAAgB;oBACxB,cAAc,EAAE,eAAe;iBAChC;aACF;SACF;KACF,CAA4C,CAAC;IAE9C,MAAM,OAAO,GAAG,IAAA,+CAA4B,EAC1C,QAAQ,EACR,yCAAQ,CAAC,YAAY,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,UAAU,CAC/E,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU;QACrD,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,QAAQ;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCompanyValuationReport.d.ts","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/createCompanyValuationReport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"createCompanyValuationReport.d.ts","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/createCompanyValuationReport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAMhE;;;;GAIG;AACH,MAAM,WAAW,+BAA+B;IAC9C,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,gBAAgB,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kCAAkC;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,uEAAuE;IACvE,+BAA+B,EAAE,+BAA+B,CAAC;CAClE;AAED,MAAM,WAAW,kCAAkC;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,kCAAkC,GACzC,OAAO,CAAC,kCAAkC,CAAC,CAiD7C"}
|
|
@@ -4,7 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createCompanyValuationReport = createCompanyValuationReport;
|
|
7
|
+
const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
|
|
7
8
|
const ocp_factory_contract_id_json_1 = __importDefault(require("@fairmint/open-captable-protocol-daml-js/ocp-factory-contract-id.json"));
|
|
9
|
+
const findCreatedEvent_1 = require("../../utils/findCreatedEvent");
|
|
8
10
|
/**
|
|
9
11
|
* Create a CompanyValuationReport by exercising the CreateCompanyValuationReport choice
|
|
10
12
|
* on the OCP Factory contract.
|
|
@@ -63,15 +65,13 @@ async function createCompanyValuationReport(client, params) {
|
|
|
63
65
|
}
|
|
64
66
|
]
|
|
65
67
|
});
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
return {
|
|
69
|
-
contractId: event.CreatedTreeEvent.value.contractId,
|
|
70
|
-
updateId: response.transactionTree.updateId
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
68
|
+
const created = (0, findCreatedEvent_1.findCreatedEventByTemplateId)(response, open_captable_protocol_daml_js_1.Fairmint.OpenCapTable.CompanyValuationReport.CompanyValuationReport.templateId);
|
|
69
|
+
if (!created) {
|
|
74
70
|
throw new Error('Expected CreatedTreeEvent not found');
|
|
75
71
|
}
|
|
72
|
+
return {
|
|
73
|
+
contractId: created.CreatedTreeEvent.value.contractId,
|
|
74
|
+
updateId: response.transactionTree.updateId
|
|
75
|
+
};
|
|
76
76
|
}
|
|
77
77
|
//# sourceMappingURL=createCompanyValuationReport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCompanyValuationReport.js","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/createCompanyValuationReport.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"createCompanyValuationReport.js","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/createCompanyValuationReport.ts"],"names":[],"mappings":";;;;;AA4DA,oEAoDC;AAhHD,6FAAoE;AAEpE,yIAA0G;AAG1G,mEAA4E;AA+B5E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,KAAK,UAAU,4BAA4B,CAChD,MAA2B,EAC3B,MAA0C;IAE1C,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACpC,MAAM,WAAW,GAAG,sCAAqB,CAAC,OAA6C,CAAC,CAAC;IACzF,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,eAAe,GAAkE;QACrF,UAAU,EAAE,MAAM,CAAC,SAAS;QAC5B,iBAAiB,EAAE,OAAO,MAAM,CAAC,gBAAgB,KAAK,QAAQ;YAC5D,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE;YACpC,CAAC,CAAC,MAAM,CAAC,gBAAgB;QAC3B,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE;QACjC,kBAAkB,EAAE,MAAM,CAAC,+BAA+B,CAAC,UAAuC;KACnG,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC;QAC5D,QAAQ,EAAE;YACR;gBACE,eAAe,EAAE;oBACf,UAAU,EAAE,WAAW,CAAC,UAAU;oBAClC,UAAU,EAAE,WAAW,CAAC,oBAAoB;oBAC5C,MAAM,EAAE,8BAA8B;oBACtC,cAAc,EAAE,eAAe;iBAChC;aACF;SACF;QACD,kBAAkB,EAAE;YAClB;gBACE,UAAU,EAAE,MAAM,CAAC,+BAA+B,CAAC,UAAU;gBAC7D,UAAU,EAAE,MAAM,CAAC,+BAA+B,CAAC,UAAU;gBAC7D,gBAAgB,EAAE,MAAM,CAAC,+BAA+B,CAAC,gBAAgB;gBACzE,cAAc,EAAE,MAAM,CAAC,+BAA+B,CAAC,cAAc;aACtE;SACF;KACF,CAA4C,CAAC;IAE9C,MAAM,OAAO,GAAG,IAAA,+CAA4B,EAC1C,QAAQ,EACR,yCAAQ,CAAC,YAAY,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,UAAU,CAC/E,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU;QACrD,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,QAAQ;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./addObserversToCompanyValuationReport"), exports);
|
|
18
|
+
__exportStar(require("./createCompanyValuationReport"), exports);
|
|
19
|
+
__exportStar(require("./updateCompanyValuation"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yEAAuD;AACvD,iEAA+C;AAC/C,2DAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateCompanyValuation.d.ts","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/updateCompanyValuation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"updateCompanyValuation.d.ts","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/updateCompanyValuation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,WAAW,4BAA4B;IAC3C,gCAAgC,EAAE,MAAM,CAAC;IACzC,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,4BAA4B;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAUD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,4BAA4B,CAAC,CAgDvC"}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateCompanyValuation = updateCompanyValuation;
|
|
4
4
|
const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
|
|
5
|
+
const findCreatedEvent_1 = require("../../utils/findCreatedEvent");
|
|
6
|
+
function hasSystemOperator(arg) {
|
|
7
|
+
return !!arg && typeof arg === 'object' && typeof arg.system_operator === 'string';
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* Update the company valuation on a CompanyValuationReport by exercising SetCompanyValuation.
|
|
7
11
|
*/
|
|
@@ -10,7 +14,14 @@ async function updateCompanyValuation(client, params) {
|
|
|
10
14
|
const eventsResponse = await client.getEventsByContractId({
|
|
11
15
|
contractId: params.companyValuationReportContractId
|
|
12
16
|
});
|
|
13
|
-
|
|
17
|
+
if (!eventsResponse.created?.createdEvent?.createArgument) {
|
|
18
|
+
throw new Error('Invalid contract events response: missing created event or create argument');
|
|
19
|
+
}
|
|
20
|
+
const createArgument = eventsResponse.created.createdEvent.createArgument;
|
|
21
|
+
if (!hasSystemOperator(createArgument)) {
|
|
22
|
+
throw new Error('System operator not found in contract create argument');
|
|
23
|
+
}
|
|
24
|
+
const systemOperator = createArgument.system_operator;
|
|
14
25
|
const choiceArguments = {
|
|
15
26
|
new_company_valuation: typeof params.newCompanyValuation === 'number'
|
|
16
27
|
? params.newCompanyValuation.toString()
|
|
@@ -29,15 +40,13 @@ async function updateCompanyValuation(client, params) {
|
|
|
29
40
|
}
|
|
30
41
|
]
|
|
31
42
|
});
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
return {
|
|
35
|
-
contractId: event.CreatedTreeEvent.value.contractId,
|
|
36
|
-
updateId: response.transactionTree.updateId
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
43
|
+
const created = (0, findCreatedEvent_1.findCreatedEventByTemplateId)(response, open_captable_protocol_daml_js_1.Fairmint.OpenCapTable.CompanyValuationReport.CompanyValuationReport.templateId);
|
|
44
|
+
if (!created) {
|
|
40
45
|
throw new Error('Expected CreatedTreeEvent not found');
|
|
41
46
|
}
|
|
47
|
+
return {
|
|
48
|
+
contractId: created.CreatedTreeEvent.value.contractId,
|
|
49
|
+
updateId: response.transactionTree.updateId
|
|
50
|
+
};
|
|
42
51
|
}
|
|
43
52
|
//# sourceMappingURL=updateCompanyValuation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateCompanyValuation.js","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/updateCompanyValuation.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"updateCompanyValuation.js","sourceRoot":"","sources":["../../../src/functions/companyValuationReport/updateCompanyValuation.ts"],"names":[],"mappings":";;AA0BA,wDAmDC;AA7ED,6FAAoE;AAGpE,mEAA4E;AAgB5E,SAAS,iBAAiB,CAAC,GAAY;IACrC,OAAO,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAQ,GAAiD,CAAC,eAAe,KAAK,QAAQ,CAAC;AACpI,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,sBAAsB,CAC1C,MAA2B,EAC3B,MAAoC;IAEpC,sEAAsE;IACtE,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;QACxD,UAAU,EAAE,MAAM,CAAC,gCAAgC;KACpD,CAAC,CAAC;IAEH,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;IAChG,CAAC;IAED,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC;IAC1E,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IACD,MAAM,cAAc,GAAG,cAAc,CAAC,eAAe,CAAC;IAEtD,MAAM,eAAe,GAAqE;QACxF,qBAAqB,EAAE,OAAO,MAAM,CAAC,mBAAmB,KAAK,QAAQ;YACnE,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE;YACvC,CAAC,CAAC,MAAM,CAAC,mBAAmB;KAC/B,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC;QAC5D,KAAK,EAAE,CAAC,cAAc,CAAC;QACvB,QAAQ,EAAE;YACR;gBACE,eAAe,EAAE;oBACf,UAAU,EAAE,yCAAQ,CAAC,YAAY,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,UAAU;oBAC1F,UAAU,EAAE,MAAM,CAAC,gCAAgC;oBACnD,MAAM,EAAE,qBAAqB;oBAC7B,cAAc,EAAE,eAAe;iBAChC;aACF;SACF;KACF,CAA4C,CAAC;IAE9C,MAAM,OAAO,GAAG,IAAA,+CAA4B,EAC1C,QAAQ,EACR,yCAAQ,CAAC,YAAY,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,UAAU,CAC/E,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU;QACrD,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,QAAQ;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
export * from './issuer
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './issuer/updateIssuerData';
|
|
4
|
-
export * from './companyValuationReport/createCompanyValuationReport';
|
|
5
|
-
export * from './companyValuationReport/updateCompanyValuation';
|
|
6
|
-
export * from './companyValuationReport/confirmCurrentCompanyValuationReport';
|
|
7
|
-
export * from './companyValuationReport/addObserversToCompanyValuationReport';
|
|
1
|
+
export * from './issuer';
|
|
2
|
+
export * from './companyValuationReport';
|
|
8
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,0BAA0B,CAAC"}
|
package/dist/functions/index.js
CHANGED
|
@@ -14,11 +14,6 @@ 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("./issuer
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./issuer/updateIssuerData"), exports);
|
|
20
|
-
__exportStar(require("./companyValuationReport/createCompanyValuationReport"), exports);
|
|
21
|
-
__exportStar(require("./companyValuationReport/updateCompanyValuation"), exports);
|
|
22
|
-
__exportStar(require("./companyValuationReport/confirmCurrentCompanyValuationReport"), exports);
|
|
23
|
-
__exportStar(require("./companyValuationReport/addObserversToCompanyValuationReport"), exports);
|
|
17
|
+
__exportStar(require("./issuer"), exports);
|
|
18
|
+
__exportStar(require("./companyValuationReport"), exports);
|
|
24
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2DAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorizeIssuer.d.ts","sourceRoot":"","sources":["../../../src/functions/issuer/authorizeIssuer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"authorizeIssuer.d.ts","sourceRoot":"","sources":["../../../src/functions/issuer/authorizeIssuer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAKhE,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAqDhC"}
|
|
@@ -4,7 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.authorizeIssuer = authorizeIssuer;
|
|
7
|
+
const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
|
|
7
8
|
const ocp_factory_contract_id_json_1 = __importDefault(require("@fairmint/open-captable-protocol-daml-js/ocp-factory-contract-id.json"));
|
|
9
|
+
const findCreatedEvent_1 = require("../../utils/findCreatedEvent");
|
|
8
10
|
/**
|
|
9
11
|
* Authorize an issuer using the OCP Factory contract
|
|
10
12
|
* @param client - The ledger JSON API client
|
|
@@ -36,20 +38,23 @@ async function authorizeIssuer(client, params) {
|
|
|
36
38
|
}
|
|
37
39
|
]
|
|
38
40
|
});
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
41
|
+
const created = (0, findCreatedEvent_1.findCreatedEventByTemplateId)(response, open_captable_protocol_daml_js_1.Fairmint.OpenCapTable.IssuerAuthorization.IssuerAuthorization.templateId);
|
|
42
|
+
if (!created) {
|
|
41
43
|
throw new Error('Expected CreatedTreeEvent not found');
|
|
42
44
|
}
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
contractId:
|
|
45
|
+
const issuerAuthorizationContractId = created.CreatedTreeEvent.value.contractId;
|
|
46
|
+
const issuerAuthorizationContractEvents = await client.getEventsByContractId({
|
|
47
|
+
contractId: issuerAuthorizationContractId
|
|
46
48
|
});
|
|
49
|
+
if (!issuerAuthorizationContractEvents.created?.createdEvent?.createdEventBlob) {
|
|
50
|
+
throw new Error('Invalid issuer authorization contract events response: missing created event or created event blob');
|
|
51
|
+
}
|
|
47
52
|
return {
|
|
48
|
-
contractId:
|
|
53
|
+
contractId: issuerAuthorizationContractId,
|
|
49
54
|
updateId: response.transactionTree.updateId,
|
|
50
|
-
createdEventBlob:
|
|
55
|
+
createdEventBlob: issuerAuthorizationContractEvents.created.createdEvent.createdEventBlob,
|
|
51
56
|
synchronizerId: response.transactionTree.synchronizerId,
|
|
52
|
-
templateId:
|
|
57
|
+
templateId: created.CreatedTreeEvent.value.templateId
|
|
53
58
|
};
|
|
54
59
|
}
|
|
55
60
|
//# sourceMappingURL=authorizeIssuer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorizeIssuer.js","sourceRoot":"","sources":["../../../src/functions/issuer/authorizeIssuer.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"authorizeIssuer.js","sourceRoot":"","sources":["../../../src/functions/issuer/authorizeIssuer.ts"],"names":[],"mappings":";;;;;AAwBA,0CAwDC;AAhFD,6FAAoE;AAEpE,yIAA0G;AAE1G,mEAA4E;AAc5E;;;;;GAKG;AACI,KAAK,UAAU,eAAe,CACnC,MAA2B,EAC3B,MAA6B;IAE7B,0CAA0C;IAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IAEpC,0DAA0D;IAC1D,MAAM,WAAW,GAAG,sCAAqB,CAAC,OAA6C,CAAC,CAAC;IACzF,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,kDAAkD;IAClD,MAAM,eAAe,GAAqD;QACxE,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC;IAEF,4CAA4C;IAC5C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC;QAC5D,QAAQ,EAAE;YACR;gBACE,eAAe,EAAE;oBACf,UAAU,EAAE,WAAW,CAAC,UAAU;oBAClC,UAAU,EAAE,WAAW,CAAC,oBAAoB;oBAC5C,MAAM,EAAE,iBAAiB;oBACzB,cAAc,EAAE,eAAe;iBAChC;aACF;SACF;KACF,CAA4C,CAAC;IAE9C,MAAM,OAAO,GAAG,IAAA,+CAA4B,EAC1C,QAAQ,EACR,yCAAQ,CAAC,YAAY,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,UAAU,CACzE,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,6BAA6B,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC;IAChF,MAAM,iCAAiC,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;QAC3E,UAAU,EAAE,6BAA6B;KAC1C,CAAC,CAAC;IAEH,IAAI,CAAC,iCAAiC,CAAC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;QAC/E,MAAM,IAAI,KAAK,CAAC,oGAAoG,CAAC,CAAC;IACxH,CAAC;IAED,OAAO;QACL,UAAU,EAAE,6BAA6B;QACzC,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,QAAQ;QAC3C,gBAAgB,EAAE,iCAAiC,CAAC,OAAO,CAAC,YAAY,CAAC,gBAAgB;QACzF,cAAc,EAAE,QAAQ,CAAC,eAAe,CAAC,cAAc;QACvD,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU;KACtD,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIssuer.d.ts","sourceRoot":"","sources":["../../../src/functions/issuer/createIssuer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"createIssuer.d.ts","sourceRoot":"","sources":["../../../src/functions/issuer/createIssuer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE;;;;GAIG;AACH,MAAM,WAAW,kCAAkC;IACjD,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,gBAAgB,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,kCAAkC,EAAE,kCAAkC,CAAC;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC;CAC5D;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CA8C7B"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createIssuer = createIssuer;
|
|
4
4
|
const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
|
|
5
|
+
const findCreatedEvent_1 = require("../../utils/findCreatedEvent");
|
|
5
6
|
/**
|
|
6
7
|
* Create an issuer by exercising the CreateIssuer choice on an IssuerAuthorization contract
|
|
7
8
|
*
|
|
@@ -57,15 +58,17 @@ async function createIssuer(client, params) {
|
|
|
57
58
|
}
|
|
58
59
|
]
|
|
59
60
|
});
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
return {
|
|
63
|
-
contractId: event.CreatedTreeEvent.value.contractId,
|
|
64
|
-
updateId: response.transactionTree.updateId
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
61
|
+
const created = (0, findCreatedEvent_1.findCreatedEventByTemplateId)(response, open_captable_protocol_daml_js_1.Fairmint.OpenCapTable.Issuer.Issuer.templateId);
|
|
62
|
+
if (!created) {
|
|
68
63
|
throw new Error('Expected CreatedTreeEvent not found');
|
|
69
64
|
}
|
|
65
|
+
const issuerContractId = created.CreatedTreeEvent.value.contractId;
|
|
66
|
+
const issuerContractEvents = await client.getEventsByContractId({
|
|
67
|
+
contractId: issuerContractId
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
contractId: issuerContractId,
|
|
71
|
+
updateId: response.transactionTree.updateId
|
|
72
|
+
};
|
|
70
73
|
}
|
|
71
74
|
//# sourceMappingURL=createIssuer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIssuer.js","sourceRoot":"","sources":["../../../src/functions/issuer/createIssuer.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"createIssuer.js","sourceRoot":"","sources":["../../../src/functions/issuer/createIssuer.ts"],"names":[],"mappings":";;AA8DA,oCAiDC;AA/GD,6FAAoE;AAGpE,mEAA4E;AA+B5E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACI,KAAK,UAAU,YAAY,CAChC,MAA2B,EAC3B,MAA0B;IAE1B,+CAA+C;IAC/C,MAAM,eAAe,GAA2D;QAC9E,WAAW,EAAE,MAAM,CAAC,UAAU;KAC/B,CAAC;IAEF,wDAAwD;IACxD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC;QAC5D,KAAK,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC;QAC3B,QAAQ,EAAE;YACR;gBACE,eAAe,EAAE;oBACf,UAAU,EAAE,yCAAQ,CAAC,YAAY,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,UAAU;oBACpF,UAAU,EAAE,MAAM,CAAC,kCAAkC,CAAC,UAAU;oBAChE,MAAM,EAAE,cAAc;oBACtB,cAAc,EAAE,eAAe;iBAChC;aACF;SACF;QACD,kBAAkB,EAAE;YAClB;gBACE,UAAU,EAAE,MAAM,CAAC,kCAAkC,CAAC,UAAU;gBAChE,UAAU,EAAE,MAAM,CAAC,kCAAkC,CAAC,UAAU;gBAChE,gBAAgB,EAAE,MAAM,CAAC,kCAAkC,CAAC,gBAAgB;gBAC5E,cAAc,EAAE,MAAM,CAAC,kCAAkC,CAAC,cAAc;aACzE;SACF;KACF,CAA4C,CAAC;IAE9C,MAAM,OAAO,GAAG,IAAA,+CAA4B,EAC1C,QAAQ,EACR,yCAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAC/C,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC;IACnE,MAAM,oBAAoB,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;QAC9D,UAAU,EAAE,gBAAgB;KAC7B,CAAC,CAAA;IAEF,OAAO;QACL,UAAU,EAAE,gBAAgB;QAC5B,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,QAAQ;KAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/functions/issuer/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./authorizeIssuer"), exports);
|
|
18
|
+
__exportStar(require("./createIssuer"), exports);
|
|
19
|
+
__exportStar(require("./updateIssuerData"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functions/issuer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,iDAA+B;AAC/B,qDAAmC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateIssuerData.d.ts","sourceRoot":"","sources":["../../../src/functions/issuer/updateIssuerData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC;CAC/D;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"updateIssuerData.d.ts","sourceRoot":"","sources":["../../../src/functions/issuer/updateIssuerData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC;CAC/D;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAUD;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CA6CjC"}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateIssuerData = updateIssuerData;
|
|
4
4
|
const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
|
|
5
|
+
function hasIssuer(arg) {
|
|
6
|
+
return !!arg && typeof arg === 'object' && typeof arg.issuer === 'string';
|
|
7
|
+
}
|
|
5
8
|
/**
|
|
6
9
|
* Update issuer data by exercising the UpdateIssuerData choice on an Issuer contract
|
|
7
10
|
* @param client - The ledger JSON API client
|
|
@@ -13,7 +16,14 @@ async function updateIssuerData(client, params) {
|
|
|
13
16
|
const eventsResponse = await client.getEventsByContractId({
|
|
14
17
|
contractId: params.issuerContractId
|
|
15
18
|
});
|
|
16
|
-
|
|
19
|
+
if (!eventsResponse.created?.createdEvent?.createArgument) {
|
|
20
|
+
throw new Error('Invalid contract events response: missing created event or create argument');
|
|
21
|
+
}
|
|
22
|
+
const createArgument = eventsResponse.created.createdEvent.createArgument;
|
|
23
|
+
if (!hasIssuer(createArgument)) {
|
|
24
|
+
throw new Error('Issuer party not found in contract create argument');
|
|
25
|
+
}
|
|
26
|
+
const issuerParty = createArgument.issuer;
|
|
17
27
|
// Create the choice arguments for UpdateIssuerData
|
|
18
28
|
const choiceArguments = {
|
|
19
29
|
new_issuer_data: params.newIssuerData
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateIssuerData.js","sourceRoot":"","sources":["../../../src/functions/issuer/updateIssuerData.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"updateIssuerData.js","sourceRoot":"","sources":["../../../src/functions/issuer/updateIssuerData.ts"],"names":[],"mappings":";;AA4BA,4CAgDC;AA5ED,6FAAoE;AAkBpE,SAAS,SAAS,CAAC,GAAY;IAC7B,OAAO,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAQ,GAAiC,CAAC,MAAM,KAAK,QAAQ,CAAC;AAC3G,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,gBAAgB,CACpC,MAA2B,EAC3B,MAA8B;IAE9B,qEAAqE;IACrE,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;QACxD,UAAU,EAAE,MAAM,CAAC,gBAAgB;KACpC,CAAC,CAAC;IAEH,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;IAChG,CAAC;IAED,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC;IAC1E,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC;IAE1C,mDAAmD;IACnD,MAAM,eAAe,GAAkD;QACrE,eAAe,EAAE,MAAM,CAAC,aAAa;KACtC,CAAC;IAEF,2CAA2C;IAC3C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC;QAC5D,KAAK,EAAE,CAAC,WAAW,CAAC;QACpB,QAAQ,EAAE;YACR;gBACE,eAAe,EAAE;oBACf,UAAU,EAAE,yCAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU;oBAC1D,UAAU,EAAE,MAAM,CAAC,gBAAgB;oBACnC,MAAM,EAAE,kBAAkB;oBAC1B,cAAc,EAAE,eAAe;iBAChC;aACF;SACF;KACF,CAA4C,CAAC;IAE9C,MAAM,KAAK,GAAG,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACrD,IAAI,kBAAkB,IAAI,KAAK,EAAE,CAAC;QAChC,OAAO;YACL,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU;YACnD,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,QAAQ;SAC5C,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SubmitAndWaitForTransactionTreeResponse } from '@fairmint/canton-node-sdk/build/src/clients/ledger-json-api/operations';
|
|
2
|
+
export interface CreatedTreeEventValue {
|
|
3
|
+
contractId: string;
|
|
4
|
+
templateId: string;
|
|
5
|
+
contractKey?: unknown;
|
|
6
|
+
createArgument?: unknown;
|
|
7
|
+
createdEventBlob?: string;
|
|
8
|
+
witnessParties?: string[];
|
|
9
|
+
signatories?: string[];
|
|
10
|
+
observers?: string[];
|
|
11
|
+
createdAt?: string;
|
|
12
|
+
packageName?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface CreatedTreeEventWrapper {
|
|
15
|
+
CreatedTreeEvent: {
|
|
16
|
+
value: CreatedTreeEventValue;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare function findCreatedEventByTemplateId(response: SubmitAndWaitForTransactionTreeResponse, expectedTemplateId: string): CreatedTreeEventWrapper | undefined;
|
|
20
|
+
//# sourceMappingURL=findCreatedEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findCreatedEvent.d.ts","sourceRoot":"","sources":["../../src/utils/findCreatedEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,MAAM,wEAAwE,CAAC;AAEjI,MAAM,WAAW,qBAAqB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACvC,gBAAgB,EAAE;QACjB,KAAK,EAAE,qBAAqB,CAAC;KAC7B,CAAC;CACF;AAQD,wBAAgB,4BAA4B,CAC3C,QAAQ,EAAE,uCAAuC,EACjD,kBAAkB,EAAE,MAAM,GACxB,uBAAuB,GAAG,SAAS,CAWrC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findCreatedEventByTemplateId = findCreatedEventByTemplateId;
|
|
4
|
+
function isCreatedTreeEventWrapper(event) {
|
|
5
|
+
if (!event || typeof event !== 'object')
|
|
6
|
+
return false;
|
|
7
|
+
const e = event;
|
|
8
|
+
return !!e.CreatedTreeEvent && typeof e.CreatedTreeEvent === 'object' && 'value' in e.CreatedTreeEvent;
|
|
9
|
+
}
|
|
10
|
+
function findCreatedEventByTemplateId(response, expectedTemplateId) {
|
|
11
|
+
const eventsById = (response.transactionTree?.eventsById ?? {});
|
|
12
|
+
for (const event of Object.values(eventsById)) {
|
|
13
|
+
if (isCreatedTreeEventWrapper(event)) {
|
|
14
|
+
const created = event.CreatedTreeEvent.value;
|
|
15
|
+
if (created?.templateId === expectedTemplateId) {
|
|
16
|
+
return event;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=findCreatedEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findCreatedEvent.js","sourceRoot":"","sources":["../../src/utils/findCreatedEvent.ts"],"names":[],"mappings":";;AA2BA,oEAcC;AApBD,SAAS,yBAAyB,CAAC,KAAc;IAChD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,CAAC,GAAG,KAAmD,CAAC;IAC9D,OAAO,CAAC,CAAC,CAAC,CAAC,gBAAgB,IAAI,OAAO,CAAC,CAAC,gBAAgB,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,CAAC,gBAAgB,CAAC;AACxG,CAAC;AAED,SAAgB,4BAA4B,CAC3C,QAAiD,EACjD,kBAA0B;IAE1B,MAAM,UAAU,GAAG,CAAC,QAAQ,CAAC,eAAe,EAAE,UAAU,IAAI,EAAE,CAA4B,CAAC;IAC3F,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/C,IAAI,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,MAAM,OAAO,GAAG,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC;YAC7C,IAAI,OAAO,EAAE,UAAU,KAAK,kBAAkB,EAAE,CAAC;gBAChD,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-captable-protocol/canton",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
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",
|
|
@@ -13,14 +13,13 @@
|
|
|
13
13
|
"dev": "tsc --watch",
|
|
14
14
|
"clean": "rm -rf dist",
|
|
15
15
|
"script:authorize": "ts-node scripts/authorizeIssuer.ts",
|
|
16
|
-
"script:create-issuer": "ts-node scripts/createIssuer.ts"
|
|
17
|
-
"patch-dependency": "node scripts/patch-missing-dependency.js"
|
|
16
|
+
"script:create-issuer": "ts-node scripts/createIssuer.ts"
|
|
18
17
|
},
|
|
19
18
|
"dependencies": {
|
|
20
19
|
"@daml/ledger": "^2.10.2",
|
|
21
20
|
"@daml/types": "^2.10.2",
|
|
22
|
-
"@fairmint/canton-node-sdk": "^0.0.
|
|
23
|
-
"@fairmint/open-captable-protocol-daml-js": "^0.0.
|
|
21
|
+
"@fairmint/canton-node-sdk": "^0.0.80",
|
|
22
|
+
"@fairmint/open-captable-protocol-daml-js": "^0.0.25"
|
|
24
23
|
},
|
|
25
24
|
|
|
26
25
|
"devDependencies": {
|