@fairmint/canton-node-sdk 0.0.41 → 0.0.43

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.
Files changed (27) hide show
  1. package/build/src/clients/register.d.ts.map +1 -1
  2. package/build/src/clients/register.js +3 -0
  3. package/build/src/clients/register.js.map +1 -1
  4. package/build/src/clients/validator-api/operations/v0/scan-proxy/lookup-featured-app-right.d.ts.map +1 -1
  5. package/build/src/clients/validator-api/operations/v0/scan-proxy/lookup-featured-app-right.js +1 -3
  6. package/build/src/clients/validator-api/operations/v0/scan-proxy/lookup-featured-app-right.js.map +1 -1
  7. package/build/src/utils/amulet/disclosed-contracts.d.ts +41 -0
  8. package/build/src/utils/amulet/disclosed-contracts.d.ts.map +1 -0
  9. package/build/src/utils/amulet/disclosed-contracts.js +79 -0
  10. package/build/src/utils/amulet/disclosed-contracts.js.map +1 -0
  11. package/build/src/utils/amulet/index.d.ts +4 -0
  12. package/build/src/utils/amulet/index.d.ts.map +1 -0
  13. package/build/src/utils/amulet/index.js +20 -0
  14. package/build/src/utils/amulet/index.js.map +1 -0
  15. package/build/src/utils/amulet/pre-approve-transfers.d.ts +52 -0
  16. package/build/src/utils/amulet/pre-approve-transfers.d.ts.map +1 -0
  17. package/build/src/utils/amulet/pre-approve-transfers.js +97 -0
  18. package/build/src/utils/amulet/pre-approve-transfers.js.map +1 -0
  19. package/build/src/utils/amulet/transfer-to-preapproved.d.ts +54 -0
  20. package/build/src/utils/amulet/transfer-to-preapproved.d.ts.map +1 -0
  21. package/build/src/utils/amulet/transfer-to-preapproved.js +109 -0
  22. package/build/src/utils/amulet/transfer-to-preapproved.js.map +1 -0
  23. package/build/src/utils/index.d.ts +1 -0
  24. package/build/src/utils/index.d.ts.map +1 -1
  25. package/build/src/utils/index.js +1 -0
  26. package/build/src/utils/index.js.map +1 -1
  27. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/clients/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAOtD,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/clients/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAWtD,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -6,4 +6,7 @@ Object.defineProperty(exports, "ClientFactory", { enumerable: true, get: functio
6
6
  // Register the Ledger JSON API client
7
7
  const LedgerJsonApiClient_1 = require("./ledger-json-api/LedgerJsonApiClient");
8
8
  ClientFactory_1.ClientFactory.registerClient('LEDGER_JSON_API', LedgerJsonApiClient_1.LedgerJsonApiClient);
9
+ // Register the Validator API client
10
+ const ValidatorApiClient_1 = require("./validator-api/ValidatorApiClient");
11
+ ClientFactory_1.ClientFactory.registerClient('VALIDATOR_API', ValidatorApiClient_1.ValidatorApiClient);
9
12
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/clients/register.ts"],"names":[],"mappings":";;;AAAA,yDAAsD;AAO7C,8FAPA,6BAAa,OAOA;AALtB,sCAAsC;AACtC,+EAA4E;AAC5E,6BAAa,CAAC,cAAc,CAAC,iBAAiB,EAAE,yCAAmB,CAAC,CAAC"}
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/clients/register.ts"],"names":[],"mappings":";;;AAAA,yDAAsD;AAW7C,8FAXA,6BAAa,OAWA;AATtB,sCAAsC;AACtC,+EAA4E;AAC5E,6BAAa,CAAC,cAAc,CAAC,iBAAiB,EAAE,yCAAmB,CAAC,CAAC;AAErE,oCAAoC;AACpC,2EAAwE;AACxE,6BAAa,CAAC,cAAc,CAAC,eAAe,EAAE,uCAAkB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"lookup-featured-app-right.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/validator-api/operations/v0/scan-proxy/lookup-featured-app-right.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;CAWjC,CAAC"}
1
+ {"version":3,"file":"lookup-featured-app-right.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/validator-api/operations/v0/scan-proxy/lookup-featured-app-right.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;CAUjC,CAAC"}
@@ -15,9 +15,7 @@ exports.LookupFeaturedAppRight = (0, core_1.createApiOperation)({
15
15
  paramsSchema: operations_1.GetFeaturedAppRightParamsSchema,
16
16
  method: 'GET',
17
17
  buildUrl: (params, apiUrl) => {
18
- const url = new URL(`${apiUrl}/api/validator/v0/scan-proxy/featured-app-right`);
19
- if (params.partyId)
20
- url.searchParams.set('partyId', params.partyId);
18
+ const url = new URL(`${apiUrl}/api/validator/v0/scan-proxy/featured-apps/${params.partyId}`);
21
19
  return url.toString();
22
20
  },
23
21
  });
@@ -1 +1 @@
1
- {"version":3,"file":"lookup-featured-app-right.js","sourceRoot":"","sources":["../../../../../../../src/clients/validator-api/operations/v0/scan-proxy/lookup-featured-app-right.ts"],"names":[],"mappings":";;;AAAA,8CAAyD;AAEzD,4DAAyG;AAEzG;;;;;;;GAOG;AACU,QAAA,sBAAsB,GAAG,IAAA,yBAAkB,EAGtD;IACA,YAAY,EAAE,4CAA+B;IAC7C,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAc,EAAE,EAAE;QACnC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,MAAM,iDAAiD,CAAC,CAAC;QAChF,IAAI,MAAM,CAAC,OAAO;YAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACpE,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"lookup-featured-app-right.js","sourceRoot":"","sources":["../../../../../../../src/clients/validator-api/operations/v0/scan-proxy/lookup-featured-app-right.ts"],"names":[],"mappings":";;;AAAA,8CAAyD;AAEzD,4DAAyG;AAEzG;;;;;;;GAOG;AACU,QAAA,sBAAsB,GAAG,IAAA,yBAAkB,EAGtD;IACA,YAAY,EAAE,4CAA+B;IAC7C,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAc,EAAE,EAAE;QACnC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,MAAM,8CAA8C,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7F,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { DisclosedContract } from '../../clients/ledger-json-api/schemas/api/commands';
2
+ export interface ContractInfo {
3
+ /** Contract ID */
4
+ contractId: string;
5
+ /** Template ID (optional) */
6
+ templateId?: string | undefined;
7
+ /** Created event blob */
8
+ createdEventBlob: string;
9
+ /** Synchronizer ID */
10
+ synchronizerId: string;
11
+ }
12
+ export interface AmuletDisclosedContractsParams {
13
+ /** AmuletRules contract info */
14
+ amuletRules: ContractInfo;
15
+ /** Open mining round contract info */
16
+ openMiningRound?: ContractInfo;
17
+ /** Issuing mining rounds contract info */
18
+ issuingMiningRounds?: ContractInfo[];
19
+ /** Featured app right contract info */
20
+ featuredAppRight?: ContractInfo;
21
+ /** Additional contracts to disclose */
22
+ additionalContracts?: ContractInfo[];
23
+ }
24
+ /**
25
+ * Builds disclosed contracts array for Amulet operations
26
+ *
27
+ * @param params - Contract information for disclosure
28
+ * @returns Array of disclosed contracts
29
+ */
30
+ export declare function buildAmuletDisclosedContracts(params: AmuletDisclosedContractsParams): DisclosedContract[];
31
+ /**
32
+ * Helper function to create ContractInfo from API responses
33
+ *
34
+ * @param contractId - The contract ID
35
+ * @param templateId - The template ID (optional)
36
+ * @param createdEventBlob - The created event blob
37
+ * @param synchronizerId - The synchronizer ID
38
+ * @returns ContractInfo object
39
+ */
40
+ export declare function createContractInfo(contractId: string, createdEventBlob: string, synchronizerId: string, templateId?: string): ContractInfo;
41
+ //# sourceMappingURL=disclosed-contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disclosed-contracts.d.ts","sourceRoot":"","sources":["../../../../src/utils/amulet/disclosed-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAEvF,MAAM,WAAW,YAAY;IAC3B,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,yBAAyB;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,8BAA8B;IAC7C,gCAAgC;IAChC,WAAW,EAAE,YAAY,CAAC;IAC1B,sCAAsC;IACtC,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,0CAA0C;IAC1C,mBAAmB,CAAC,EAAE,YAAY,EAAE,CAAC;IACrC,uCAAuC;IACvC,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,uCAAuC;IACvC,mBAAmB,CAAC,EAAE,YAAY,EAAE,CAAC;CACtC;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,8BAA8B,GACrC,iBAAiB,EAAE,CAwDrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,UAAU,CAAC,EAAE,MAAM,GAClB,YAAY,CAOd"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildAmuletDisclosedContracts = buildAmuletDisclosedContracts;
4
+ exports.createContractInfo = createContractInfo;
5
+ /**
6
+ * Builds disclosed contracts array for Amulet operations
7
+ *
8
+ * @param params - Contract information for disclosure
9
+ * @returns Array of disclosed contracts
10
+ */
11
+ function buildAmuletDisclosedContracts(params) {
12
+ const disclosedContracts = [];
13
+ // Add AmuletRules contract (required)
14
+ disclosedContracts.push({
15
+ contractId: params.amuletRules.contractId,
16
+ templateId: params.amuletRules.templateId,
17
+ createdEventBlob: params.amuletRules.createdEventBlob,
18
+ synchronizerId: params.amuletRules.synchronizerId,
19
+ });
20
+ // Add open mining round contract if provided
21
+ if (params.openMiningRound) {
22
+ disclosedContracts.push({
23
+ contractId: params.openMiningRound.contractId,
24
+ templateId: params.openMiningRound.templateId,
25
+ createdEventBlob: params.openMiningRound.createdEventBlob,
26
+ synchronizerId: params.openMiningRound.synchronizerId,
27
+ });
28
+ }
29
+ // Add issuing mining rounds contracts if provided
30
+ if (params.issuingMiningRounds) {
31
+ for (const round of params.issuingMiningRounds) {
32
+ disclosedContracts.push({
33
+ contractId: round.contractId,
34
+ templateId: round.templateId,
35
+ createdEventBlob: round.createdEventBlob,
36
+ synchronizerId: round.synchronizerId,
37
+ });
38
+ }
39
+ }
40
+ // Add featured app right contract if provided
41
+ if (params.featuredAppRight) {
42
+ disclosedContracts.push({
43
+ contractId: params.featuredAppRight.contractId,
44
+ templateId: params.featuredAppRight.templateId,
45
+ createdEventBlob: params.featuredAppRight.createdEventBlob,
46
+ synchronizerId: params.featuredAppRight.synchronizerId,
47
+ });
48
+ }
49
+ // Add additional contracts if provided
50
+ if (params.additionalContracts) {
51
+ for (const contract of params.additionalContracts) {
52
+ disclosedContracts.push({
53
+ contractId: contract.contractId,
54
+ templateId: contract.templateId,
55
+ createdEventBlob: contract.createdEventBlob,
56
+ synchronizerId: contract.synchronizerId,
57
+ });
58
+ }
59
+ }
60
+ return disclosedContracts;
61
+ }
62
+ /**
63
+ * Helper function to create ContractInfo from API responses
64
+ *
65
+ * @param contractId - The contract ID
66
+ * @param templateId - The template ID (optional)
67
+ * @param createdEventBlob - The created event blob
68
+ * @param synchronizerId - The synchronizer ID
69
+ * @returns ContractInfo object
70
+ */
71
+ function createContractInfo(contractId, createdEventBlob, synchronizerId, templateId) {
72
+ return {
73
+ contractId,
74
+ ...(templateId && { templateId }),
75
+ createdEventBlob,
76
+ synchronizerId,
77
+ };
78
+ }
79
+ //# sourceMappingURL=disclosed-contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disclosed-contracts.js","sourceRoot":"","sources":["../../../../src/utils/amulet/disclosed-contracts.ts"],"names":[],"mappings":";;AAgCA,sEA0DC;AAWD,gDAYC;AAvFD;;;;;GAKG;AACH,SAAgB,6BAA6B,CAC3C,MAAsC;IAEtC,MAAM,kBAAkB,GAAwB,EAAE,CAAC;IAEnD,sCAAsC;IACtC,kBAAkB,CAAC,IAAI,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU;QACzC,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU;QACzC,gBAAgB,EAAE,MAAM,CAAC,WAAW,CAAC,gBAAgB;QACrD,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,cAAc;KAClD,CAAC,CAAC;IAEH,6CAA6C;IAC7C,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QAC3B,kBAAkB,CAAC,IAAI,CAAC;YACtB,UAAU,EAAE,MAAM,CAAC,eAAe,CAAC,UAAU;YAC7C,UAAU,EAAE,MAAM,CAAC,eAAe,CAAC,UAAU;YAC7C,gBAAgB,EAAE,MAAM,CAAC,eAAe,CAAC,gBAAgB;YACzD,cAAc,EAAE,MAAM,CAAC,eAAe,CAAC,cAAc;SACtD,CAAC,CAAC;IACL,CAAC;IAED,kDAAkD;IAClD,IAAI,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAC/B,KAAK,MAAM,KAAK,I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 @@
1
+ export * from './pre-approve-transfers';
2
+ export * from './transfer-to-preapproved';
3
+ export * from './disclosed-contracts';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/amulet/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,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("./pre-approve-transfers"), exports);
18
+ __exportStar(require("./transfer-to-preapproved"), exports);
19
+ __exportStar(require("./disclosed-contracts"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/amulet/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,4DAA0C;AAC1C,wDAAsC"}
@@ -0,0 +1,52 @@
1
+ import { LedgerJsonApiClient } from '../../clients/ledger-json-api';
2
+ import { ValidatorApiClient } from '../../clients/validator-api';
3
+ export interface PreApproveTransfersParams {
4
+ /** Party ID to enable pre-approved transfers for (receiver) */
5
+ receiverPartyId: string;
6
+ /** Party ID that will manage the pre-approval (provider) */
7
+ providerPartyId: string;
8
+ /** When the pre-approval expires */
9
+ expiresAt: Date;
10
+ /** Amulet inputs to pay for the pre-approval fee */
11
+ inputs: Array<{
12
+ tag: 'InputAmulet';
13
+ value: string;
14
+ }>;
15
+ /** Contract details for disclosed contracts (optional - will be fetched if not provided) */
16
+ contractDetails?: {
17
+ amuletRules?: {
18
+ createdEventBlob: string;
19
+ synchronizerId: string;
20
+ };
21
+ openMiningRound?: {
22
+ createdEventBlob: string;
23
+ synchronizerId: string;
24
+ };
25
+ issuingMiningRounds?: Array<{
26
+ createdEventBlob: string;
27
+ synchronizerId: string;
28
+ }>;
29
+ featuredAppRight?: {
30
+ createdEventBlob: string;
31
+ synchronizerId: string;
32
+ };
33
+ };
34
+ }
35
+ export interface PreApproveTransfersResult {
36
+ /** Contract ID of the created TransferPreapproval contract */
37
+ contractId: string;
38
+ /** Domain ID where the contract was created */
39
+ domainId: string;
40
+ /** Amount of amulet paid for the pre-approval */
41
+ amuletPaid: string;
42
+ }
43
+ /**
44
+ * Creates a TransferPreapproval contract to enable pre-approved transfers for a party
45
+ *
46
+ * @param ledgerClient - Ledger JSON API client for submitting commands
47
+ * @param validatorClient - Validator API client for getting network information
48
+ * @param params - Parameters for creating the pre-approval
49
+ * @returns Promise resolving to the pre-approval result
50
+ */
51
+ export declare function preApproveTransfers(ledgerClient: LedgerJsonApiClient, validatorClient: ValidatorApiClient, params: PreApproveTransfersParams): Promise<PreApproveTransfersResult>;
52
+ //# sourceMappingURL=pre-approve-transfers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pre-approve-transfers.d.ts","sourceRoot":"","sources":["../../../../src/utils/amulet/pre-approve-transfers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAIjE,MAAM,WAAW,yBAAyB;IACxC,+DAA+D;IAC/D,eAAe,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,eAAe,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,SAAS,EAAE,IAAI,CAAC;IAChB,oDAAoD;IACpD,MAAM,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,4FAA4F;IAC5F,eAAe,CAAC,EAAE;QAChB,WAAW,CAAC,EAAE;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,cAAc,EAAE,MAAM,CAAA;SAAE,CAAC;QACnE,eAAe,CAAC,EAAE;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,cAAc,EAAE,MAAM,CAAA;SAAE,CAAC;QACvE,mBAAmB,CAAC,EAAE,KAAK,CAAC;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,cAAc,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClF,gBAAgB,CAAC,EAAE;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,cAAc,EAAE,MAAM,CAAA;SAAE,CAAC;KACzE,CAAC;CACH;AAED,MAAM,WAAW,yBAAyB;IACxC,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,mBAAmB,EACjC,eAAe,EAAE,kBAAkB,EACnC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,yBAAyB,CAAC,CAkHpC"}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.preApproveTransfers = preApproveTransfers;
4
+ const disclosed_contracts_1 = require("./disclosed-contracts");
5
+ /**
6
+ * Creates a TransferPreapproval contract to enable pre-approved transfers for a party
7
+ *
8
+ * @param ledgerClient - Ledger JSON API client for submitting commands
9
+ * @param validatorClient - Validator API client for getting network information
10
+ * @param params - Parameters for creating the pre-approval
11
+ * @returns Promise resolving to the pre-approval result
12
+ */
13
+ async function preApproveTransfers(ledgerClient, validatorClient, params) {
14
+ console.log('🔍 Fetching network information...');
15
+ // Get network information
16
+ const [amuletRules, dsoPartyId, miningRounds, featuredAppRight] = await Promise.all([
17
+ validatorClient.getAmuletRules(),
18
+ validatorClient.getDsoPartyId(),
19
+ validatorClient.getOpenAndIssuingMiningRounds(),
20
+ validatorClient.lookupFeaturedAppRight({ partyId: params.providerPartyId })
21
+ ]);
22
+ console.log('📊 Network information fetched:');
23
+ console.log(` Amulet Rules Contract ID: ${amuletRules.amulet_rules.contract.contract_id}`);
24
+ console.log(` DSO Party ID: ${dsoPartyId.dso_party_id}`);
25
+ console.log(` Open Mining Rounds: ${miningRounds.open_mining_rounds.length}`);
26
+ console.log(` Issuing Mining Rounds: ${miningRounds.issuing_mining_rounds.length}`);
27
+ console.log(` Featured App Right: ${featuredAppRight.featured_app_right ? 'Found' : 'Not found'}`);
28
+ // Get the first open mining round contract ID
29
+ const openMiningRoundContractId = miningRounds.open_mining_rounds[0]?.contract?.contract_id;
30
+ if (!openMiningRoundContractId) {
31
+ console.error('❌ No open mining rounds found. Available rounds:', JSON.stringify(miningRounds, null, 2));
32
+ throw new Error('No open mining rounds available');
33
+ }
34
+ console.log(`✅ Using open mining round: ${openMiningRoundContractId}`);
35
+ // Build disclosed contracts
36
+ const disclosedContractsParams = {
37
+ amuletRules: (0, disclosed_contracts_1.createContractInfo)(amuletRules.amulet_rules.contract.contract_id, amuletRules.amulet_rules.contract.created_event_blob, amuletRules.amulet_rules.domain_id, amuletRules.amulet_rules.contract.template_id),
38
+ openMiningRound: (0, disclosed_contracts_1.createContractInfo)(openMiningRoundContractId, miningRounds.open_mining_rounds[0]?.contract?.created_event_blob || '', miningRounds.open_mining_rounds[0]?.domain_id || '', miningRounds.open_mining_rounds[0]?.contract?.template_id),
39
+ };
40
+ if (featuredAppRight.featured_app_right) {
41
+ disclosedContractsParams.featuredAppRight = (0, disclosed_contracts_1.createContractInfo)(featuredAppRight.featured_app_right.contract_id, featuredAppRight.featured_app_right.created_event_blob, featuredAppRight.featured_app_right.domain_id, featuredAppRight.featured_app_right.template_id);
42
+ }
43
+ const disclosedContracts = (0, disclosed_contracts_1.buildAmuletDisclosedContracts)(disclosedContractsParams);
44
+ console.log(`📋 Built ${disclosedContracts.length} disclosed contracts`);
45
+ // Create the TransferPreapproval contract using AmuletRules_CreateTransferPreapproval
46
+ const createCommand = {
47
+ ExerciseCommand: {
48
+ templateId: amuletRules.amulet_rules.contract.template_id,
49
+ contractId: amuletRules.amulet_rules.contract.contract_id,
50
+ choice: 'AmuletRules_CreateTransferPreapproval',
51
+ choiceArgument: {
52
+ context: {
53
+ amuletRules: amuletRules.amulet_rules.contract.contract_id,
54
+ context: {
55
+ openMiningRound: openMiningRoundContractId,
56
+ issuingMiningRounds: [],
57
+ validatorRights: [],
58
+ featuredAppRight: featuredAppRight.featured_app_right?.contract_id || null
59
+ }
60
+ },
61
+ inputs: params.inputs,
62
+ receiver: params.receiverPartyId,
63
+ provider: params.providerPartyId,
64
+ expiresAt: params.expiresAt.toISOString()
65
+ }
66
+ }
67
+ };
68
+ console.log('📝 Created exercise command for TransferPreapproval');
69
+ // Submit the command
70
+ const submitParams = {
71
+ commands: [createCommand],
72
+ commandId: `create-preapproval-${Date.now()}`,
73
+ actAs: [params.providerPartyId, params.receiverPartyId],
74
+ disclosedContracts,
75
+ };
76
+ console.log('🚀 Submitting command to ledger...');
77
+ const result = await ledgerClient.submitAndWaitForTransactionTree(submitParams);
78
+ // Extract the created TransferPreapproval contract ID from the result
79
+ const events = result.transactionTree.eventsById;
80
+ let contractId;
81
+ for (const eventKey in events) {
82
+ const event = events[eventKey];
83
+ if (event && 'CreatedTreeEvent' in event && event.CreatedTreeEvent?.value?.templateId?.includes('TransferPreapproval')) {
84
+ contractId = event.CreatedTreeEvent.value.contractId;
85
+ break;
86
+ }
87
+ }
88
+ if (!contractId) {
89
+ throw new Error('Failed to create TransferPreapproval contract');
90
+ }
91
+ return {
92
+ contractId,
93
+ domainId: amuletRules.amulet_rules.domain_id,
94
+ amuletPaid: '0' // This would be extracted from the transfer result
95
+ };
96
+ }
97
+ //# sourceMappingURL=pre-approve-transfers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pre-approve-transfers.js","sourceRoot":"","sources":["../../../../src/utils/amulet/pre-approve-transfers.ts"],"names":[],"mappings":";;AAwCA,kDAsHC;AA3JD,+DAA0F;AA6B1F;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CACvC,YAAiC,EACjC,eAAmC,EACnC,MAAiC;IAEjC,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAElD,0BAA0B;IAC1B,MAAM,CAAC,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAClF,eAAe,CAAC,cAAc,EAAE;QAChC,eAAe,CAAC,aAAa,EAAE;QAC/B,eAAe,CAAC,6BAA6B,EAAE;QAC/C,eAAe,CAAC,sBAAsB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC;KAC5E,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,gCAAgC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7F,OAAO,CAAC,GAAG,CAAC,oBAAoB,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC;IAC3D,OAAO,CAAC,GAAG,CAAC,0BAA0B,YAAY,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,CAAC;IAChF,OAAO,CAAC,GAAG,CAAC,6BAA6B,YAAY,CAAC,qBAAqB,CAAC,MAAM,EAAE,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AAC;QACvD,kBAAkB;KACnB,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,+BAA+B,CAAC,YAAY,CAAC,CAAC;IAEhF,sEAAsE;IACtE,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC;IACjD,IAAI,UAA8B,CAAC;IAEnC,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/B,IAAI,KAAK,IAAI,kBAAkB,IAAI,KAAK,IAAI,KAAK,CAAC,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAAC;YACvH,UAAU,GAAG,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC;YACrD,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IAED,OAAO;QACL,UAAU;QACV,QAAQ,EAAE,WAAW,CAAC,YAAY,CAAC,SAAS;QAC5C,UAAU,EAAE,GAAG,CAAC,mDAAmD;KACpE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { LedgerJsonApiClient } from '../../clients/ledger-json-api';
2
+ import { ValidatorApiClient } from '../../clients/validator-api';
3
+ export interface TransferToPreapprovedParams {
4
+ /** Party ID sending the transfer */
5
+ senderPartyId: string;
6
+ /** TransferPreapproval contract ID to use for the transfer */
7
+ transferPreapprovalContractId: string;
8
+ /** Amount to transfer */
9
+ amount: string;
10
+ /** Optional description for the transfer */
11
+ description?: string;
12
+ /** Amulet inputs to transfer */
13
+ inputs: Array<{
14
+ tag: 'InputAmulet';
15
+ value: string;
16
+ }>;
17
+ /** Contract details for disclosed contracts (optional - will be fetched if not provided) */
18
+ contractDetails?: {
19
+ amuletRules?: {
20
+ createdEventBlob: string;
21
+ synchronizerId: string;
22
+ };
23
+ openMiningRound?: {
24
+ createdEventBlob: string;
25
+ synchronizerId: string;
26
+ };
27
+ issuingMiningRounds?: Array<{
28
+ createdEventBlob: string;
29
+ synchronizerId: string;
30
+ }>;
31
+ featuredAppRight?: {
32
+ createdEventBlob: string;
33
+ synchronizerId: string;
34
+ };
35
+ };
36
+ }
37
+ export interface TransferToPreapprovedResult {
38
+ /** Contract ID of the TransferPreapproval contract used */
39
+ contractId: string;
40
+ /** Domain ID where the transfer occurred */
41
+ domainId: string;
42
+ /** Transfer result summary */
43
+ transferResult: any;
44
+ }
45
+ /**
46
+ * Transfers coins to a party that has pre-approved transfers enabled
47
+ *
48
+ * @param ledgerClient - Ledger JSON API client for submitting commands
49
+ * @param validatorClient - Validator API client for getting network information
50
+ * @param params - Parameters for the transfer
51
+ * @returns Promise resolving to the transfer result
52
+ */
53
+ export declare function transferToPreapproved(ledgerClient: LedgerJsonApiClient, validatorClient: ValidatorApiClient, params: TransferToPreapprovedParams): Promise<TransferToPreapprovedResult>;
54
+ //# sourceMappingURL=transfer-to-preapproved.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer-to-preapproved.d.ts","sourceRoot":"","sources":["../../../../src/utils/amulet/transfer-to-preapproved.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE,MAAM,WAAW,2BAA2B;IAC1C,oCAAoC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,6BAA6B,EAAE,MAAM,CAAC;IACtC,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,MAAM,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,4FAA4F;IAC5F,eAAe,CAAC,EAAE;QAChB,WAAW,CAAC,EAAE;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,cAAc,EAAE,MAAM,CAAA;SAAE,CAAC;QACnE,eAAe,CAAC,EAAE;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,cAAc,EAAE,MAAM,CAAA;SAAE,CAAC;QACvE,mBAAmB,CAAC,EAAE,KAAK,CAAC;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,cAAc,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClF,gBAAgB,CAAC,EAAE;YAAE,gBAAgB,EAAE,MAAM,CAAC;YAAC,cAAc,EAAE,MAAM,CAAA;SAAE,CAAC;KACzE,CAAC;CACH;AAED,MAAM,WAAW,2BAA2B;IAC1C,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,cAAc,EAAE,GAAG,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,mBAAmB,EACjC,eAAe,EAAE,kBAAkB,EACnC,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,2BAA2B,CAAC,CA4GtC"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transferToPreapproved = transferToPreapproved;
4
+ /**
5
+ * Transfers coins to a party that has pre-approved transfers enabled
6
+ *
7
+ * @param ledgerClient - Ledger JSON API client for submitting commands
8
+ * @param validatorClient - Validator API client for getting network information
9
+ * @param params - Parameters for the transfer
10
+ * @returns Promise resolving to the transfer result
11
+ */
12
+ async function transferToPreapproved(ledgerClient, validatorClient, params) {
13
+ // Get network information
14
+ const [amuletRules, miningRounds, featuredAppRight] = await Promise.all([
15
+ validatorClient.getAmuletRules(),
16
+ validatorClient.getOpenAndIssuingMiningRounds(),
17
+ validatorClient.lookupFeaturedAppRight({ partyId: params.senderPartyId })
18
+ ]);
19
+ // Get the first open mining round contract ID
20
+ const openMiningRoundContractId = miningRounds.open_mining_rounds[0]?.contract_id;
21
+ if (!openMiningRoundContractId) {
22
+ throw new Error('No open mining rounds available');
23
+ }
24
+ // Create the transfer command using TransferPreapproval_Send
25
+ const transferCommand = {
26
+ ExerciseCommand: {
27
+ templateId: amuletRules.amulet_rules.contract.template_id,
28
+ contractId: params.transferPreapprovalContractId,
29
+ choice: 'TransferPreapproval_Send',
30
+ choiceArgument: {
31
+ context: {
32
+ amuletRules: amuletRules.amulet_rules.contract.contract_id,
33
+ context: {
34
+ openMiningRound: openMiningRoundContractId,
35
+ issuingMiningRounds: miningRounds.issuing_mining_rounds.map(round => ({
36
+ round: round.round_number,
37
+ contractId: round.contract_id
38
+ })),
39
+ validatorRights: [],
40
+ featuredAppRight: featuredAppRight.featured_app_right?.contract_id || null
41
+ }
42
+ },
43
+ inputs: params.inputs,
44
+ amount: params.amount,
45
+ sender: params.senderPartyId,
46
+ description: params.description || null
47
+ }
48
+ }
49
+ };
50
+ // Build disclosed contracts if contract details are provided
51
+ let disclosedContracts;
52
+ if (params.contractDetails) {
53
+ disclosedContracts = [];
54
+ // Add AmuletRules contract
55
+ if (params.contractDetails.amuletRules) {
56
+ disclosedContracts.push({
57
+ contractId: amuletRules.amulet_rules.contract.contract_id,
58
+ templateId: amuletRules.amulet_rules.contract.template_id,
59
+ createdEventBlob: params.contractDetails.amuletRules.createdEventBlob,
60
+ synchronizerId: params.contractDetails.amuletRules.synchronizerId,
61
+ });
62
+ }
63
+ // Add open mining round contract
64
+ if (openMiningRoundContractId && params.contractDetails.openMiningRound) {
65
+ disclosedContracts.push({
66
+ contractId: openMiningRoundContractId,
67
+ createdEventBlob: params.contractDetails.openMiningRound.createdEventBlob,
68
+ synchronizerId: params.contractDetails.openMiningRound.synchronizerId,
69
+ });
70
+ }
71
+ // Add issuing mining rounds contracts
72
+ if (params.contractDetails.issuingMiningRounds) {
73
+ params.contractDetails.issuingMiningRounds.forEach((details, index) => {
74
+ const contractId = miningRounds.issuing_mining_rounds[index]?.contract_id;
75
+ if (contractId) {
76
+ disclosedContracts.push({
77
+ contractId,
78
+ createdEventBlob: details.createdEventBlob,
79
+ synchronizerId: details.synchronizerId,
80
+ });
81
+ }
82
+ });
83
+ }
84
+ // Add featured app right contract
85
+ if (featuredAppRight.featured_app_right?.contract_id && params.contractDetails.featuredAppRight) {
86
+ disclosedContracts.push({
87
+ contractId: featuredAppRight.featured_app_right.contract_id,
88
+ createdEventBlob: params.contractDetails.featuredAppRight.createdEventBlob,
89
+ synchronizerId: params.contractDetails.featuredAppRight.synchronizerId,
90
+ });
91
+ }
92
+ }
93
+ // Submit the command
94
+ const submitParams = {
95
+ commands: [transferCommand],
96
+ commandId: `transfer-preapproved-${Date.now()}`,
97
+ actAs: [params.senderPartyId],
98
+ };
99
+ if (disclosedContracts) {
100
+ submitParams.disclosedContracts = disclosedContracts;
101
+ }
102
+ const result = await ledgerClient.submitAndWaitForTransactionTree(submitParams);
103
+ return {
104
+ contractId: params.transferPreapprovalContractId,
105
+ domainId: amuletRules.amulet_rules.domain_id,
106
+ transferResult: result
107
+ };
108
+ }
109
+ //# sourceMappingURL=transfer-to-preapproved.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer-to-preapproved.js","sourceRoot":"","sources":["../../../../src/utils/amulet/transfer-to-preapproved.ts"],"names":[],"mappings":";;AAyCA,sDAgHC;AAxHD;;;;;;;GAOG;AACI,KAAK,UAAU,qBAAqB,CACzC,YAAiC,EACjC,eAAmC,EACnC,MAAmC;IAEnC,0BAA0B;IAC1B,MAAM,CAAC,WAAW,EAAE,YAAY,EAAE,gBAAgB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACtE,eAAe,CAAC,cAAc,EAAE;QAChC,eAAe,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AM,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC;YAChG,kBAAkB,CAAC,IAAI,CAAC;gBACtB,UAAU,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,WAAW;gBAC3D,gBAAgB,EAAE,MAAM,CAAC,eAAe,CAAC,gBAAgB,CAAC,gBAAgB;gBAC1E,cAAc,EAAE,MAAM,CAAC,eAAe,CAAC,gBAAgB,CAAC,cAAc;aACvE,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,qBAAqB;IACrB,MAAM,YAAY,GAAQ;QACxB,QAAQ,EAAE,CAAC,eAAe,CAAC;QAC3B,SAAS,EAAE,wBAAwB,IAAI,CAAC,GAAG,EAAE,EAAE;QAC/C,KAAK,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC;KAC9B,CAAC;IAEF,IAAI,kBAAkB,EAAE,CAAC;QACvB,YAAY,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IACvD,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,+BAA+B,CAAC,YAAY,CAAC,CAAC;IAEhF,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,6BAA6B;QAChD,QAAQ,EAAE,WAAW,CAAC,YAAY,CAAC,SAAS;QAC5C,cAAc,EAAE,MAAM;KACvB,CAAC;AACJ,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './parsers';
2
+ export * from './amulet';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./parsers"), exports);
18
+ __exportStar(require("./amulet"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fairmint/canton-node-sdk",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "description": "Canton Node SDK",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",