@open-captable-protocol/canton 0.0.4 → 0.0.6
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/OcpFactoryClient.d.ts +1 -1
- package/dist/OcpFactoryClient.d.ts.map +1 -1
- package/dist/OcpFactoryClient.js.map +1 -1
- package/dist/functions/authorizeIssuer.d.ts +2 -0
- package/dist/functions/authorizeIssuer.d.ts.map +1 -1
- package/dist/functions/authorizeIssuer.js +9 -2
- package/dist/functions/authorizeIssuer.js.map +1 -1
- package/dist/functions/createIssuer.d.ts +39 -2
- package/dist/functions/createIssuer.d.ts.map +1 -1
- package/dist/functions/createIssuer.js +33 -3
- package/dist/functions/createIssuer.js.map +1 -1
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@ import { ClientConfig } from '@fairmint/canton-node-sdk';
|
|
|
2
2
|
import { AuthorizeIssuerParams, AuthorizeIssuerResult } from './functions/authorizeIssuer';
|
|
3
3
|
import { CreateIssuerParams, CreateIssuerResult } from './functions/createIssuer';
|
|
4
4
|
export { AuthorizeIssuerParams, AuthorizeIssuerResult } from './functions/authorizeIssuer';
|
|
5
|
-
export { CreateIssuerParams, CreateIssuerResult } from './functions/createIssuer';
|
|
5
|
+
export { CreateIssuerParams, CreateIssuerResult, IssuerAuthorizationContractDetails } from './functions/createIssuer';
|
|
6
6
|
export declare class OcpFactoryClient {
|
|
7
7
|
private client;
|
|
8
8
|
constructor(config?: ClientConfig);
|
|
@@ -1 +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,
|
|
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,EAAsC,MAAM,0BAA0B,CAAC;AAEpI,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kCAAkC,EAAE,MAAM,0BAA0B,CAAC;AAEtH,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OcpFactoryClient.js","sourceRoot":"","sources":["../src/OcpFactoryClient.ts"],"names":[],"mappings":";;;AAAA,+DAA8E;AAC9E,iEAA4G;AAC5G,
|
|
1
|
+
{"version":3,"file":"OcpFactoryClient.js","sourceRoot":"","sources":["../src/OcpFactoryClient.ts"],"names":[],"mappings":";;;AAAA,+DAA8E;AAC9E,iEAA4G;AAC5G,2DAAoI;AAKpI,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"}
|
|
@@ -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;
|
|
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;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAyChC"}
|
|
@@ -37,9 +37,16 @@ async function authorizeIssuer(client, params) {
|
|
|
37
37
|
}
|
|
38
38
|
]
|
|
39
39
|
});
|
|
40
|
+
const issuerContractId = response.transactionTree.eventsById[1].CreatedTreeEvent.value.contractId;
|
|
41
|
+
const issuerContractEvents = await client.getEventsByContractId({
|
|
42
|
+
contractId: issuerContractId,
|
|
43
|
+
readAs: [params.issuer]
|
|
44
|
+
});
|
|
40
45
|
return {
|
|
41
|
-
contractId:
|
|
42
|
-
updateId: response.transactionTree.updateId
|
|
46
|
+
contractId: issuerContractId,
|
|
47
|
+
updateId: response.transactionTree.updateId,
|
|
48
|
+
createdEventBlob: issuerContractEvents.created.createdEvent.createdEventBlob,
|
|
49
|
+
synchronizerId: response.transactionTree.synchronizerId,
|
|
43
50
|
};
|
|
44
51
|
}
|
|
45
52
|
//# sourceMappingURL=authorizeIssuer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorizeIssuer.js","sourceRoot":"","sources":["../../src/functions/authorizeIssuer.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"authorizeIssuer.js","sourceRoot":"","sources":["../../src/functions/authorizeIssuer.ts"],"names":[],"mappings":";;;;;AAsBA,0CA4CC;AAlED,6FAAoE;AAEpE,yIAA0G;AAc1G;;;;;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,CAA4C,CAAC;IAE9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC;IAClG,MAAM,oBAAoB,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;QAC9D,UAAU,EAAE,gBAAgB;QAC5B,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;KACxB,CAAC,CAAA;IAEF,OAAO;QACL,UAAU,EAAE,gBAAgB;QAC5B,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,QAAQ;QAC3C,gBAAgB,EAAE,oBAAoB,CAAC,OAAO,CAAC,YAAY,CAAC,gBAAgB;QAC5E,cAAc,EAAE,QAAQ,CAAC,eAAe,CAAC,cAAc;KACxD,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import { Fairmint } from '@fairmint/open-captable-protocol-daml-js';
|
|
2
2
|
import { LedgerJsonApiClient } from '@fairmint/canton-node-sdk';
|
|
3
|
+
/**
|
|
4
|
+
* Details about the IssuerAuthorization contract that need to be disclosed
|
|
5
|
+
* when exercising the CreateIssuer choice. This is required for cross-domain
|
|
6
|
+
* contract interactions in Canton.
|
|
7
|
+
*/
|
|
8
|
+
export interface IssuerAuthorizationContractDetails {
|
|
9
|
+
/** The contract ID of the IssuerAuthorization contract */
|
|
10
|
+
contractId: string;
|
|
11
|
+
/** The serialized created event blob of the contract */
|
|
12
|
+
createdEventBlob: string;
|
|
13
|
+
/** The synchronizer ID associated with the contract */
|
|
14
|
+
synchronizerId: string;
|
|
15
|
+
}
|
|
3
16
|
export interface CreateIssuerParams {
|
|
4
|
-
|
|
17
|
+
/** Details of the IssuerAuthorization contract for disclosed contracts */
|
|
18
|
+
issuerAuthorizationContractDetails: IssuerAuthorizationContractDetails;
|
|
19
|
+
/** Issuer data to create */
|
|
5
20
|
issuerData: Fairmint.OpenCapTable.OcfObjects.OcfIssuerData;
|
|
6
21
|
}
|
|
7
22
|
export interface CreateIssuerResult {
|
|
@@ -10,8 +25,30 @@ export interface CreateIssuerResult {
|
|
|
10
25
|
}
|
|
11
26
|
/**
|
|
12
27
|
* Create an issuer by exercising the CreateIssuer choice on an IssuerAuthorization contract
|
|
28
|
+
*
|
|
29
|
+
* This function requires the IssuerAuthorization contract details to be provided for disclosed contracts,
|
|
30
|
+
* which is necessary for cross-domain contract interactions in Canton.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const issuerAuthorizationContractDetails = {
|
|
35
|
+
* contractId: "1234567890abcdef",
|
|
36
|
+
* createdEventBlob: "serialized_contract_blob_here",
|
|
37
|
+
* synchronizerId: "sync_id_here"
|
|
38
|
+
* };
|
|
39
|
+
*
|
|
40
|
+
* const result = await createIssuer(client, {
|
|
41
|
+
* issuerAuthorizationContractDetails,
|
|
42
|
+
* issuerData: {
|
|
43
|
+
* legal_name: "My Company Inc.",
|
|
44
|
+
* country_of_formation: "US",
|
|
45
|
+
* // ... other issuer data
|
|
46
|
+
* }
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
13
50
|
* @param client - The ledger JSON API client
|
|
14
|
-
* @param params - Parameters for creating an issuer
|
|
51
|
+
* @param params - Parameters for creating an issuer, including the IssuerAuthorization contract details
|
|
15
52
|
* @returns Promise resolving to the result of the issuer creation
|
|
16
53
|
*/
|
|
17
54
|
export declare function createIssuer(client: LedgerJsonApiClient, params: CreateIssuerParams): Promise<CreateIssuerResult>;
|
|
@@ -1 +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,
|
|
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;;;;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;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,kCAAkC,EAAE,kCAAkC,CAAC;IACvE,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,CAwC7B"}
|
|
@@ -4,14 +4,36 @@ exports.createIssuer = createIssuer;
|
|
|
4
4
|
const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
|
|
5
5
|
/**
|
|
6
6
|
* Create an issuer by exercising the CreateIssuer choice on an IssuerAuthorization contract
|
|
7
|
+
*
|
|
8
|
+
* This function requires the IssuerAuthorization contract details to be provided for disclosed contracts,
|
|
9
|
+
* which is necessary for cross-domain contract interactions in Canton.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const issuerAuthorizationContractDetails = {
|
|
14
|
+
* contractId: "1234567890abcdef",
|
|
15
|
+
* createdEventBlob: "serialized_contract_blob_here",
|
|
16
|
+
* synchronizerId: "sync_id_here"
|
|
17
|
+
* };
|
|
18
|
+
*
|
|
19
|
+
* const result = await createIssuer(client, {
|
|
20
|
+
* issuerAuthorizationContractDetails,
|
|
21
|
+
* issuerData: {
|
|
22
|
+
* legal_name: "My Company Inc.",
|
|
23
|
+
* country_of_formation: "US",
|
|
24
|
+
* // ... other issuer data
|
|
25
|
+
* }
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
7
29
|
* @param client - The ledger JSON API client
|
|
8
|
-
* @param params - Parameters for creating an issuer
|
|
30
|
+
* @param params - Parameters for creating an issuer, including the IssuerAuthorization contract details
|
|
9
31
|
* @returns Promise resolving to the result of the issuer creation
|
|
10
32
|
*/
|
|
11
33
|
async function createIssuer(client, params) {
|
|
12
34
|
// Get the events for the IssuerAuthorization contract to extract the issuer party
|
|
13
35
|
const eventsResponse = await client.getEventsByContractId({
|
|
14
|
-
contractId: params.
|
|
36
|
+
contractId: params.issuerAuthorizationContractDetails.contractId
|
|
15
37
|
});
|
|
16
38
|
const issuerParty = eventsResponse.created.createdEvent.createArgument.issuer;
|
|
17
39
|
// Create the choice arguments for CreateIssuer
|
|
@@ -25,11 +47,19 @@ async function createIssuer(client, params) {
|
|
|
25
47
|
{
|
|
26
48
|
ExerciseCommand: {
|
|
27
49
|
templateId: open_captable_protocol_daml_js_1.Fairmint.OpenCapTable.IssuerAuthorization.IssuerAuthorization.templateId,
|
|
28
|
-
contractId: params.
|
|
50
|
+
contractId: params.issuerAuthorizationContractDetails.contractId,
|
|
29
51
|
choice: 'CreateIssuer',
|
|
30
52
|
choiceArgument: choiceArguments
|
|
31
53
|
}
|
|
32
54
|
}
|
|
55
|
+
],
|
|
56
|
+
disclosedContracts: [
|
|
57
|
+
{
|
|
58
|
+
templateId: open_captable_protocol_daml_js_1.Fairmint.OpenCapTable.IssuerAuthorization.IssuerAuthorization.templateId,
|
|
59
|
+
contractId: params.issuerAuthorizationContractDetails.contractId,
|
|
60
|
+
createdEventBlob: params.issuerAuthorizationContractDetails.createdEventBlob,
|
|
61
|
+
synchronizerId: params.issuerAuthorizationContractDetails.synchronizerId
|
|
62
|
+
}
|
|
33
63
|
]
|
|
34
64
|
});
|
|
35
65
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIssuer.js","sourceRoot":"","sources":["../../src/functions/createIssuer.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"createIssuer.js","sourceRoot":"","sources":["../../src/functions/createIssuer.ts"],"names":[],"mappings":";;AA0DA,oCA2CC;AArGD,6FAAoE;AA8BpE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACI,KAAK,UAAU,YAAY,CAChC,MAA2B,EAC3B,MAA0B;IAE1B,kFAAkF;IAClF,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC;QACxD,UAAU,EAAE,MAAM,CAAC,kCAAkC,CAAC,UAAU;KACjE,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,kCAAkC,CAAC,UAAU;oBAChE,MAAM,EAAE,cAAc;oBACtB,cAAc,EAAE,eAAe;iBAChC;aACF;SACF;QACD,kBAAkB,EAAE;YAClB;gBACE,UAAU,EAAE,yCAAQ,CAAC,YAAY,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,UAAU;gBACpF,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,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.
|
|
3
|
+
"version": "0.0.6",
|
|
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",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@daml/ledger": "^2.10.2",
|
|
20
20
|
"@daml/types": "^2.10.2",
|
|
21
|
-
"@fairmint/canton-node-sdk": "^0.0.
|
|
22
|
-
"@fairmint/open-captable-protocol-daml-js": "^0.0.
|
|
21
|
+
"@fairmint/canton-node-sdk": "^0.0.75",
|
|
22
|
+
"@fairmint/open-captable-protocol-daml-js": "^0.0.17"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^24.2.0",
|