@open-captable-protocol/canton 0.0.1

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.
@@ -0,0 +1,22 @@
1
+ import { ClientConfig } from '@fairmint/canton-node-sdk';
2
+ import { AuthorizeIssuerParams, AuthorizeIssuerResult } from './functions/authorizeIssuer';
3
+ import { CreateIssuerParams, CreateIssuerResult } from './functions/createIssuer';
4
+ export { AuthorizeIssuerParams, AuthorizeIssuerResult } from './functions/authorizeIssuer';
5
+ export { CreateIssuerParams, CreateIssuerResult } from './functions/createIssuer';
6
+ export declare class OcpFactoryClient {
7
+ private client;
8
+ constructor(config?: ClientConfig);
9
+ /**
10
+ * Authorize an issuer using the OCP Factory contract
11
+ * @param params - Parameters for authorizing an issuer
12
+ * @returns Promise resolving to the result of the authorization
13
+ */
14
+ authorizeIssuer(params: AuthorizeIssuerParams): Promise<AuthorizeIssuerResult>;
15
+ /**
16
+ * Create an issuer by exercising the CreateIssuer choice on an IssuerAuthorization contract
17
+ * @param params - Parameters for creating an issuer
18
+ * @returns Promise resolving to the result of the issuer creation
19
+ */
20
+ createIssuer(params: CreateIssuerParams): Promise<CreateIssuerResult>;
21
+ }
22
+ //# sourceMappingURL=OcpFactoryClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcpFactoryClient.d.ts","sourceRoot":"","sources":["../src/OcpFactoryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAmB,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAC5G,OAAO,EAAgB,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEhG,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAElF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,CAAC,EAAE,YAAY;IAIjC;;;;OAIG;IACG,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIpF;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAG5E"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OcpFactoryClient = void 0;
4
+ const canton_node_sdk_1 = require("@fairmint/canton-node-sdk");
5
+ const authorizeIssuer_1 = require("./functions/authorizeIssuer");
6
+ const createIssuer_1 = require("./functions/createIssuer");
7
+ class OcpFactoryClient {
8
+ constructor(config) {
9
+ this.client = new canton_node_sdk_1.LedgerJsonApiClient(config);
10
+ }
11
+ /**
12
+ * Authorize an issuer using the OCP Factory contract
13
+ * @param params - Parameters for authorizing an issuer
14
+ * @returns Promise resolving to the result of the authorization
15
+ */
16
+ async authorizeIssuer(params) {
17
+ return (0, authorizeIssuer_1.authorizeIssuer)(this.client, params);
18
+ }
19
+ /**
20
+ * Create an issuer by exercising the CreateIssuer choice on an IssuerAuthorization contract
21
+ * @param params - Parameters for creating an issuer
22
+ * @returns Promise resolving to the result of the issuer creation
23
+ */
24
+ async createIssuer(params) {
25
+ return (0, createIssuer_1.createIssuer)(this.client, params);
26
+ }
27
+ }
28
+ exports.OcpFactoryClient = OcpFactoryClient;
29
+ //# sourceMappingURL=OcpFactoryClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcpFactoryClient.js","sourceRoot":"","sources":["../src/OcpFactoryClient.ts"],"names":[],"mappings":";;;AAAA,+DAA8E;AAC9E,iEAA4G;AAC5G,2DAAgG;AAKhG,MAAa,gBAAgB;IAG3B,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,qCAAmB,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,eAAe,CAAC,MAA6B;QACjD,OAAO,IAAA,iCAAe,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,OAAO,IAAA,2BAAY,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;CACF;AAxBD,4CAwBC"}
@@ -0,0 +1,16 @@
1
+ import { LedgerJsonApiClient } from '@fairmint/canton-node-sdk';
2
+ export interface AuthorizeIssuerParams {
3
+ issuer: string;
4
+ }
5
+ export interface AuthorizeIssuerResult {
6
+ contractId: string;
7
+ updateId: string;
8
+ }
9
+ /**
10
+ * Authorize an issuer using the OCP Factory contract
11
+ * @param client - The ledger JSON API client
12
+ * @param params - Parameters for authorizing an issuer
13
+ * @returns Promise resolving to the result of the authorization
14
+ */
15
+ export declare function authorizeIssuer(client: LedgerJsonApiClient, params: AuthorizeIssuerParams): Promise<AuthorizeIssuerResult>;
16
+ //# sourceMappingURL=authorizeIssuer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorizeIssuer.d.ts","sourceRoot":"","sources":["../../src/functions/authorizeIssuer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAwBhC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.authorizeIssuer = authorizeIssuer;
7
+ const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
8
+ const ocp_factory_contract_id_json_1 = __importDefault(require("@fairmint/open-captable-protocol-daml-js/ocp-factory-contract-id.json"));
9
+ /**
10
+ * Authorize an issuer using the OCP Factory contract
11
+ * @param client - The ledger JSON API client
12
+ * @param params - Parameters for authorizing an issuer
13
+ * @returns Promise resolving to the result of the authorization
14
+ */
15
+ async function authorizeIssuer(client, params) {
16
+ // Create the choice arguments for AuthorizeIssuer
17
+ const choiceArguments = {
18
+ issuer: params.issuer
19
+ };
20
+ // Submit the choice to the factory contract
21
+ const response = await client.submitAndWaitForTransactionTree({
22
+ commands: [
23
+ {
24
+ ExerciseCommand: {
25
+ templateId: open_captable_protocol_daml_js_1.Fairmint.OpenCapTable.OcpFactory.OcpFactory.templateId,
26
+ contractId: ocp_factory_contract_id_json_1.default.ocpFactoryContractId,
27
+ choice: 'AuthorizeIssuer',
28
+ choiceArgument: choiceArguments
29
+ }
30
+ }
31
+ ]
32
+ });
33
+ return {
34
+ contractId: response.transactionTree.eventsById[1].CreatedTreeEvent.value.contractId,
35
+ updateId: response.transactionTree.updateId
36
+ };
37
+ }
38
+ //# sourceMappingURL=authorizeIssuer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorizeIssuer.js","sourceRoot":"","sources":["../../src/functions/authorizeIssuer.ts"],"names":[],"mappings":";;;;;AAoBA,0CA2BC;AA/CD,6FAAoE;AAEpE,yIAA0G;AAY1G;;;;;GAKG;AACI,KAAK,UAAU,eAAe,CACnC,MAA2B,EAC3B,MAA6B;IAE7B,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,yCAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU;oBAClE,UAAU,EAAE,sCAAqB,CAAC,oBAAoB;oBACtD,MAAM,EAAE,iBAAiB;oBACzB,cAAc,EAAE,eAAe;iBAChC;aACF;SACF;KACF,CAA8C,CAAC;IAEhD,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU;QACpF,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,QAAQ;KAC5C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Fairmint } from '@fairmint/open-captable-protocol-daml-js';
2
+ import { LedgerJsonApiClient } from '@fairmint/canton-node-sdk';
3
+ export interface CreateIssuerParams {
4
+ issuerAuthorizationContractId: string;
5
+ issuerData: Fairmint.OpenCapTable.OcfObjects.OcfIssuerData;
6
+ }
7
+ export interface CreateIssuerResult {
8
+ contractId: string;
9
+ updateId: string;
10
+ }
11
+ /**
12
+ * Create an issuer by exercising the CreateIssuer choice on an IssuerAuthorization contract
13
+ * @param client - The ledger JSON API client
14
+ * @param params - Parameters for creating an issuer
15
+ * @returns Promise resolving to the result of the issuer creation
16
+ */
17
+ export declare function createIssuer(client: LedgerJsonApiClient, params: CreateIssuerParams): Promise<CreateIssuerResult>;
18
+ //# sourceMappingURL=createIssuer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createIssuer.d.ts","sourceRoot":"","sources":["../../src/functions/createIssuer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,MAAM,WAAW,kBAAkB;IACjC,6BAA6B,EAAE,MAAM,CAAC;IACtC,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;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CAgC7B"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createIssuer = createIssuer;
4
+ const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
5
+ /**
6
+ * Create an issuer by exercising the CreateIssuer choice on an IssuerAuthorization contract
7
+ * @param client - The ledger JSON API client
8
+ * @param params - Parameters for creating an issuer
9
+ * @returns Promise resolving to the result of the issuer creation
10
+ */
11
+ async function createIssuer(client, params) {
12
+ // Get the events for the IssuerAuthorization contract to extract the issuer party
13
+ const eventsResponse = await client.getEventsByContractId({
14
+ contractId: params.issuerAuthorizationContractId
15
+ });
16
+ const issuerParty = eventsResponse.created.createdEvent.createArgument.issuer;
17
+ // Create the choice arguments for CreateIssuer
18
+ const choiceArguments = {
19
+ issuer_data: params.issuerData
20
+ };
21
+ // Submit the choice to the IssuerAuthorization contract
22
+ const response = await client.submitAndWaitForTransactionTree({
23
+ actAs: [issuerParty],
24
+ commands: [
25
+ {
26
+ ExerciseCommand: {
27
+ templateId: open_captable_protocol_daml_js_1.Fairmint.OpenCapTable.IssuerAuthorization.IssuerAuthorization.templateId,
28
+ contractId: params.issuerAuthorizationContractId,
29
+ choice: 'CreateIssuer',
30
+ choiceArgument: choiceArguments
31
+ }
32
+ }
33
+ ]
34
+ });
35
+ return {
36
+ contractId: response.transactionTree.eventsById[1].CreatedTreeEvent.value.contractId,
37
+ updateId: response.transactionTree.updateId
38
+ };
39
+ }
40
+ //# sourceMappingURL=createIssuer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createIssuer.js","sourceRoot":"","sources":["../../src/functions/createIssuer.ts"],"names":[],"mappings":";;AAoBA,oCAmCC;AAvDD,6FAAoE;AAcpE;;;;;GAKG;AACI,KAAK,UAAU,YAAY,CAChC,MAA2B,EAC3B,MAA0B;IAE1B,kFAAkF;IAClF,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;QACxD,UAAU,EAAE,MAAM,CAAC,6BAA6B;KACjD,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,MAAM,CAAC;IAE9E,+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,WAAW,CAAC;QACpB,QAAQ,EAAE;YACR;gBACE,eAAe,EAAE;oBACf,UAAU,EAAE,yCAAQ,CAAC,YAAY,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,UAAU;oBACpF,UAAU,EAAE,MAAM,CAAC,6BAA6B;oBAChD,MAAM,EAAE,cAAc;oBACtB,cAAc,EAAE,eAAe;iBAChC;aACF;SACF;KACF,CAA8C,CAAC;IAEhD,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU;QACpF,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,QAAQ;KAC5C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './authorizeIssuer';
2
+ export * from './createIssuer';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,19 @@
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
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,iDAA+B"}
@@ -0,0 +1,3 @@
1
+ export * from './OcpFactoryClient';
2
+ export * from './functions';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
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("./OcpFactoryClient"), exports);
18
+ __exportStar(require("./functions"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,8CAA4B"}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@open-captable-protocol/canton",
3
+ "version": "0.0.1",
4
+ "description": "A TypeScript SDK for interacting with the Open CapTable Protocol (OCP) Factory contract on Canton blockchain",
5
+ "license": "MIT",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "dev": "tsc --watch",
14
+ "clean": "rm -rf dist",
15
+ "script:authorize": "ts-node scripts/authorizeIssuer.ts",
16
+ "script:create-issuer": "ts-node scripts/createIssuer.ts"
17
+ },
18
+ "dependencies": {
19
+ "@daml/ledger": "^2.10.2",
20
+ "@daml/types": "^2.10.2",
21
+ "@fairmint/canton-node-sdk": "^0.0.65",
22
+ "@fairmint/open-captable-protocol-daml-js": "^0.0.13"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^24.2.0",
26
+ "ts-node": "^10.9.2",
27
+ "typescript": "^5.9.2"
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ]
32
+ }