@open-captable-protocol/canton 0.0.1 → 0.0.3

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.
@@ -1 +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"}
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,CAiChC"}
@@ -13,6 +13,13 @@ const ocp_factory_contract_id_json_1 = __importDefault(require("@fairmint/open-c
13
13
  * @returns Promise resolving to the result of the authorization
14
14
  */
15
15
  async function authorizeIssuer(client, params) {
16
+ // Get the current network from the client
17
+ const network = client.getNetwork();
18
+ // Select the appropriate contract ID based on the network
19
+ const networkData = ocp_factory_contract_id_json_1.default[network];
20
+ if (!networkData) {
21
+ throw new Error(`Unsupported network: ${network}`);
22
+ }
16
23
  // Create the choice arguments for AuthorizeIssuer
17
24
  const choiceArguments = {
18
25
  issuer: params.issuer
@@ -23,7 +30,7 @@ async function authorizeIssuer(client, params) {
23
30
  {
24
31
  ExerciseCommand: {
25
32
  templateId: open_captable_protocol_daml_js_1.Fairmint.OpenCapTable.OcpFactory.OcpFactory.templateId,
26
- contractId: ocp_factory_contract_id_json_1.default.ocpFactoryContractId,
33
+ contractId: networkData.ocpFactoryContractId,
27
34
  choice: 'AuthorizeIssuer',
28
35
  choiceArgument: choiceArguments
29
36
  }
@@ -1 +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"}
1
+ {"version":3,"file":"authorizeIssuer.js","sourceRoot":"","sources":["../../src/functions/authorizeIssuer.ts"],"names":[],"mappings":";;;;;AAoBA,0CAoCC;AAxDD,6FAAoE;AAEpE,yIAA0G;AAY1G;;;;;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,yCAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU;oBAClE,UAAU,EAAE,WAAW,CAAC,oBAAoB;oBAC5C,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"}
@@ -1,3 +1,4 @@
1
1
  export * from './authorizeIssuer';
2
2
  export * from './createIssuer';
3
+ export * from './updateIssuerData';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./authorizeIssuer"), exports);
18
18
  __exportStar(require("./createIssuer"), exports);
19
+ __exportStar(require("./updateIssuerData"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,iDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,iDAA+B;AAC/B,qDAAmC"}
@@ -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 UpdateIssuerDataParams {
4
+ issuerContractId: string;
5
+ newIssuerData: Fairmint.OpenCapTable.OcfObjects.OcfIssuerData;
6
+ }
7
+ export interface UpdateIssuerDataResult {
8
+ contractId: string;
9
+ updateId: string;
10
+ }
11
+ /**
12
+ * Update issuer data by exercising the UpdateIssuerData choice on an Issuer contract
13
+ * @param client - The ledger JSON API client
14
+ * @param params - Parameters for updating issuer data
15
+ * @returns Promise resolving to the result of the issuer data update
16
+ */
17
+ export declare function updateIssuerData(client: LedgerJsonApiClient, params: UpdateIssuerDataParams): Promise<UpdateIssuerDataResult>;
18
+ //# sourceMappingURL=updateIssuerData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateIssuerData.d.ts","sourceRoot":"","sources":["../../src/functions/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;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CAgCjC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateIssuerData = updateIssuerData;
4
+ const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
5
+ /**
6
+ * Update issuer data by exercising the UpdateIssuerData choice on an Issuer contract
7
+ * @param client - The ledger JSON API client
8
+ * @param params - Parameters for updating issuer data
9
+ * @returns Promise resolving to the result of the issuer data update
10
+ */
11
+ async function updateIssuerData(client, params) {
12
+ // Get the events for the Issuer contract to extract the issuer party
13
+ const eventsResponse = await client.getEventsByContractId({
14
+ contractId: params.issuerContractId
15
+ });
16
+ const issuerParty = eventsResponse.created.createdEvent.createArgument.issuer;
17
+ // Create the choice arguments for UpdateIssuerData
18
+ const choiceArguments = {
19
+ new_issuer_data: params.newIssuerData
20
+ };
21
+ // Submit the choice to the Issuer 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.Issuer.Issuer.templateId,
28
+ contractId: params.issuerContractId,
29
+ choice: 'UpdateIssuerData',
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=updateIssuerData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateIssuerData.js","sourceRoot":"","sources":["../../src/functions/updateIssuerData.ts"],"names":[],"mappings":";;AAoBA,4CAmCC;AAvDD,6FAAoE;AAcpE;;;;;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,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,MAAM,CAAC;IAE9E,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,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-captable-protocol/canton",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
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",
@@ -19,7 +19,7 @@
19
19
  "@daml/ledger": "^2.10.2",
20
20
  "@daml/types": "^2.10.2",
21
21
  "@fairmint/canton-node-sdk": "^0.0.65",
22
- "@fairmint/open-captable-protocol-daml-js": "^0.0.13"
22
+ "@fairmint/open-captable-protocol-daml-js": "^0.0.15"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^24.2.0",