@fairmint/canton-fairmint-sdk 0.0.58 → 0.0.60
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/clients/json-api/sdkHelper.js +1 -1
- package/dist/clients/shared/runtime.d.ts.map +1 -1
- package/dist/clients/shared/runtime.js +4 -7
- package/dist/clients/shared/runtime.js.map +1 -1
- package/dist/extensions/CantonPaymentsExtension.d.ts +34 -0
- package/dist/extensions/CantonPaymentsExtension.d.ts.map +1 -0
- package/dist/extensions/CantonPaymentsExtension.js +23 -0
- package/dist/extensions/CantonPaymentsExtension.js.map +1 -0
- package/dist/extensions/PaymentStreamsExtension.d.ts +71 -0
- package/dist/extensions/PaymentStreamsExtension.d.ts.map +1 -0
- package/dist/extensions/PaymentStreamsExtension.js +55 -0
- package/dist/extensions/PaymentStreamsExtension.js.map +1 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +8 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/fairmintOcpClient.d.ts +48 -0
- package/dist/fairmintOcpClient.d.ts.map +1 -0
- package/dist/fairmintOcpClient.js +52 -0
- package/dist/fairmintOcpClient.js.map +1 -0
- package/dist/functions/CantonPayments/airdrop/addObserversToAirdrop.d.ts +8 -0
- package/dist/functions/CantonPayments/airdrop/addObserversToAirdrop.d.ts.map +1 -0
- package/dist/functions/CantonPayments/airdrop/addObserversToAirdrop.js +18 -0
- package/dist/functions/CantonPayments/airdrop/addObserversToAirdrop.js.map +1 -0
- package/dist/functions/CantonPayments/airdrop/createAirdrop.d.ts +13 -0
- package/dist/functions/CantonPayments/airdrop/createAirdrop.d.ts.map +1 -0
- package/dist/functions/CantonPayments/airdrop/createAirdrop.js +23 -0
- package/dist/functions/CantonPayments/airdrop/createAirdrop.js.map +1 -0
- package/dist/functions/CantonPayments/airdrop/executeAirdrop.d.ts +20 -0
- package/dist/functions/CantonPayments/airdrop/executeAirdrop.d.ts.map +1 -0
- package/dist/functions/CantonPayments/airdrop/executeAirdrop.js +31 -0
- package/dist/functions/CantonPayments/airdrop/executeAirdrop.js.map +1 -0
- package/dist/functions/CantonPayments/airdrop/index.d.ts +6 -0
- package/dist/functions/CantonPayments/airdrop/index.d.ts.map +1 -0
- package/dist/functions/CantonPayments/airdrop/index.js +22 -0
- package/dist/functions/CantonPayments/airdrop/index.js.map +1 -0
- package/dist/functions/CantonPayments/airdrop/joinAirdrop.d.ts +14 -0
- package/dist/functions/CantonPayments/airdrop/joinAirdrop.d.ts.map +1 -0
- package/dist/functions/CantonPayments/airdrop/joinAirdrop.js +36 -0
- package/dist/functions/CantonPayments/airdrop/joinAirdrop.js.map +1 -0
- package/dist/functions/CantonPayments/airdrop/updateAirdropConfig.d.ts +8 -0
- package/dist/functions/CantonPayments/airdrop/updateAirdropConfig.d.ts.map +1 -0
- package/dist/functions/CantonPayments/airdrop/updateAirdropConfig.js +22 -0
- package/dist/functions/CantonPayments/airdrop/updateAirdropConfig.js.map +1 -0
- package/dist/functions/CantonPayments/index.d.ts +3 -0
- package/dist/functions/CantonPayments/index.d.ts.map +1 -0
- package/dist/functions/CantonPayments/index.js +19 -0
- package/dist/functions/CantonPayments/index.js.map +1 -0
- package/dist/functions/CantonPayments/simpleAirdrop/archiveSimpleAirdrop.d.ts +6 -0
- package/dist/functions/CantonPayments/simpleAirdrop/archiveSimpleAirdrop.d.ts.map +1 -0
- package/dist/functions/CantonPayments/simpleAirdrop/archiveSimpleAirdrop.js +15 -0
- package/dist/functions/CantonPayments/simpleAirdrop/archiveSimpleAirdrop.js.map +1 -0
- package/dist/functions/CantonPayments/simpleAirdrop/createSimpleAirdrop.d.ts +12 -0
- package/dist/functions/CantonPayments/simpleAirdrop/createSimpleAirdrop.d.ts.map +1 -0
- package/dist/functions/CantonPayments/simpleAirdrop/createSimpleAirdrop.js +21 -0
- package/dist/functions/CantonPayments/simpleAirdrop/createSimpleAirdrop.js.map +1 -0
- package/dist/functions/CantonPayments/simpleAirdrop/executeSimpleAirdrop.d.ts +14 -0
- package/dist/functions/CantonPayments/simpleAirdrop/executeSimpleAirdrop.d.ts.map +1 -0
- package/dist/functions/CantonPayments/simpleAirdrop/executeSimpleAirdrop.js +26 -0
- package/dist/functions/CantonPayments/simpleAirdrop/executeSimpleAirdrop.js.map +1 -0
- package/dist/functions/CantonPayments/simpleAirdrop/index.d.ts +4 -0
- package/dist/functions/CantonPayments/simpleAirdrop/index.d.ts.map +1 -0
- package/dist/functions/CantonPayments/simpleAirdrop/index.js +20 -0
- package/dist/functions/CantonPayments/simpleAirdrop/index.js.map +1 -0
- package/dist/functions/CouponMinter/canMintCouponsNow.d.ts +56 -0
- package/dist/functions/CouponMinter/canMintCouponsNow.d.ts.map +1 -0
- package/dist/functions/CouponMinter/canMintCouponsNow.js +89 -0
- package/dist/functions/CouponMinter/canMintCouponsNow.js.map +1 -0
- package/dist/functions/CouponMinter/index.d.ts +3 -0
- package/dist/functions/CouponMinter/index.d.ts.map +1 -0
- package/dist/functions/CouponMinter/index.js +12 -0
- package/dist/functions/CouponMinter/index.js.map +1 -0
- package/dist/functions/CouponMinter/waitUntilCanMint.d.ts +176 -0
- package/dist/functions/CouponMinter/waitUntilCanMint.d.ts.map +1 -0
- package/dist/functions/CouponMinter/waitUntilCanMint.js +235 -0
- package/dist/functions/CouponMinter/waitUntilCanMint.js.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/addFunds.d.ts +10 -0
- package/dist/functions/PaymentStreams/activePaymentStream/addFunds.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/addFunds.js +30 -0
- package/dist/functions/PaymentStreams/activePaymentStream/addFunds.js.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/archiveInactivePaymentStream.d.ts +7 -0
- package/dist/functions/PaymentStreams/activePaymentStream/archiveInactivePaymentStream.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/archiveInactivePaymentStream.js +18 -0
- package/dist/functions/PaymentStreams/activePaymentStream/archiveInactivePaymentStream.js.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/cancel.d.ts +10 -0
- package/dist/functions/PaymentStreams/activePaymentStream/cancel.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/cancel.js +22 -0
- package/dist/functions/PaymentStreams/activePaymentStream/cancel.js.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/changeParty.d.ts +10 -0
- package/dist/functions/PaymentStreams/activePaymentStream/changeParty.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/changeParty.js +20 -0
- package/dist/functions/PaymentStreams/activePaymentStream/changeParty.js.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/index.d.ts +19 -0
- package/dist/functions/PaymentStreams/activePaymentStream/index.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/index.js +39 -0
- package/dist/functions/PaymentStreams/activePaymentStream/index.js.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/processFreeTrial.d.ts +8 -0
- package/dist/functions/PaymentStreams/activePaymentStream/processFreeTrial.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/processFreeTrial.js +21 -0
- package/dist/functions/PaymentStreams/activePaymentStream/processFreeTrial.js.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/processPayment.d.ts +11 -0
- package/dist/functions/PaymentStreams/activePaymentStream/processPayment.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/processPayment.js +28 -0
- package/dist/functions/PaymentStreams/activePaymentStream/processPayment.js.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/proposeChanges.d.ts +26 -0
- package/dist/functions/PaymentStreams/activePaymentStream/proposeChanges.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/proposeChanges.js +72 -0
- package/dist/functions/PaymentStreams/activePaymentStream/proposeChanges.js.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/refund.d.ts +10 -0
- package/dist/functions/PaymentStreams/activePaymentStream/refund.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/refund.js +25 -0
- package/dist/functions/PaymentStreams/activePaymentStream/refund.js.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/replaceLockedAmulet.d.ts +10 -0
- package/dist/functions/PaymentStreams/activePaymentStream/replaceLockedAmulet.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/replaceLockedAmulet.js +26 -0
- package/dist/functions/PaymentStreams/activePaymentStream/replaceLockedAmulet.js.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/withdrawFunds.d.ts +9 -0
- package/dist/functions/PaymentStreams/activePaymentStream/withdrawFunds.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/activePaymentStream/withdrawFunds.js +25 -0
- package/dist/functions/PaymentStreams/activePaymentStream/withdrawFunds.js.map +1 -0
- package/dist/functions/PaymentStreams/index.d.ts +17 -0
- package/dist/functions/PaymentStreams/index.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/index.js +58 -0
- package/dist/functions/PaymentStreams/index.js.map +1 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/approve.d.ts +7 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/approve.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/approve.js +18 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/approve.js.map +1 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/archive.d.ts +8 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/archive.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/archive.js +20 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/archive.js.map +1 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/index.d.ts +5 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/index.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/index.js +21 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/index.js.map +1 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/migrateActivePaymentStream.d.ts +8 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/migrateActivePaymentStream.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/migrateActivePaymentStream.js +19 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/migrateActivePaymentStream.js.map +1 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/migrateProposedPaymentStream.d.ts +8 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/migrateProposedPaymentStream.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/migrateProposedPaymentStream.js +19 -0
- package/dist/functions/PaymentStreams/partyMigrationProposal/migrateProposedPaymentStream.js.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/apply.d.ts +8 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/apply.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/apply.js +19 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/apply.js.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/approve.d.ts +7 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/approve.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/approve.js +18 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/approve.js.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/index.d.ts +4 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/index.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/index.js +20 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/index.js.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/reject.d.ts +8 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/reject.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/reject.js +20 -0
- package/dist/functions/PaymentStreams/paymentStreamChangeProposal/reject.js.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamFactory/createPaymentStreamProposal.d.ts +10 -0
- package/dist/functions/PaymentStreams/paymentStreamFactory/createPaymentStreamProposal.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamFactory/createPaymentStreamProposal.js +22 -0
- package/dist/functions/PaymentStreams/paymentStreamFactory/createPaymentStreamProposal.js.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamFactory/index.d.ts +2 -0
- package/dist/functions/PaymentStreams/paymentStreamFactory/index.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/paymentStreamFactory/index.js +18 -0
- package/dist/functions/PaymentStreams/paymentStreamFactory/index.js.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/approve.d.ts +7 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/approve.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/approve.js +19 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/approve.js.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/changeParty.d.ts +10 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/changeParty.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/changeParty.js +20 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/changeParty.js.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/editPaymentStreamProposal.d.ts +27 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/editPaymentStreamProposal.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/editPaymentStreamProposal.js +75 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/editPaymentStreamProposal.js.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/index.d.ts +6 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/index.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/index.js +22 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/index.js.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/startPaymentStream.d.ts +8 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/startPaymentStream.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/startPaymentStream.js +28 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/startPaymentStream.js.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/withdraw.d.ts +8 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/withdraw.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/withdraw.js +20 -0
- package/dist/functions/PaymentStreams/proposedPaymentStream/withdraw.js.map +1 -0
- package/dist/functions/PaymentStreams/types/activePaymentStream.d.ts +64 -0
- package/dist/functions/PaymentStreams/types/activePaymentStream.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/types/activePaymentStream.js +52 -0
- package/dist/functions/PaymentStreams/types/activePaymentStream.js.map +1 -0
- package/dist/functions/PaymentStreams/types/index.d.ts +6 -0
- package/dist/functions/PaymentStreams/types/index.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/types/index.js +22 -0
- package/dist/functions/PaymentStreams/types/index.js.map +1 -0
- package/dist/functions/PaymentStreams/types/lockFundsInput.d.ts +8 -0
- package/dist/functions/PaymentStreams/types/lockFundsInput.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/types/lockFundsInput.js +3 -0
- package/dist/functions/PaymentStreams/types/lockFundsInput.js.map +1 -0
- package/dist/functions/PaymentStreams/types/partyRole.d.ts +3 -0
- package/dist/functions/PaymentStreams/types/partyRole.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/types/partyRole.js +3 -0
- package/dist/functions/PaymentStreams/types/partyRole.js.map +1 -0
- package/dist/functions/PaymentStreams/types/paymentStreamProposalInput.d.ts +37 -0
- package/dist/functions/PaymentStreams/types/paymentStreamProposalInput.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/types/paymentStreamProposalInput.js +4 -0
- package/dist/functions/PaymentStreams/types/paymentStreamProposalInput.js.map +1 -0
- package/dist/functions/PaymentStreams/types/proposedPaymentStream.d.ts +81 -0
- package/dist/functions/PaymentStreams/types/proposedPaymentStream.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/types/proposedPaymentStream.js +51 -0
- package/dist/functions/PaymentStreams/types/proposedPaymentStream.js.map +1 -0
- package/dist/functions/PaymentStreams/utils/disclosedContracts.d.ts +14 -0
- package/dist/functions/PaymentStreams/utils/disclosedContracts.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/utils/disclosedContracts.js +53 -0
- package/dist/functions/PaymentStreams/utils/disclosedContracts.js.map +1 -0
- package/dist/functions/PaymentStreams/utils/factoryContractId.d.ts +17 -0
- package/dist/functions/PaymentStreams/utils/factoryContractId.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/utils/factoryContractId.js +27 -0
- package/dist/functions/PaymentStreams/utils/factoryContractId.js.map +1 -0
- package/dist/functions/PaymentStreams/utils/index.d.ts +4 -0
- package/dist/functions/PaymentStreams/utils/index.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/utils/index.js +20 -0
- package/dist/functions/PaymentStreams/utils/index.js.map +1 -0
- package/dist/functions/PaymentStreams/utils/paymentContext.d.ts +61 -0
- package/dist/functions/PaymentStreams/utils/paymentContext.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/utils/paymentContext.js +209 -0
- package/dist/functions/PaymentStreams/utils/paymentContext.js.map +1 -0
- package/dist/functions/PaymentStreams/utils/paymentStreamDamlCodec.d.ts +75 -0
- package/dist/functions/PaymentStreams/utils/paymentStreamDamlCodec.d.ts.map +1 -0
- package/dist/functions/PaymentStreams/utils/paymentStreamDamlCodec.js +81 -0
- package/dist/functions/PaymentStreams/utils/paymentStreamDamlCodec.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/package.json +20 -20
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** Utilities for building payment context for paymentStream payments */
|
|
2
|
+
import type { ValidatorApiClient } from '@fairmint/canton-node-sdk';
|
|
3
|
+
import type { DisclosedContract } from '@fairmint/canton-node-sdk/build/src/clients/ledger-json-api/schemas/api/commands';
|
|
4
|
+
export interface PaymentContext {
|
|
5
|
+
amuletRulesCid: string;
|
|
6
|
+
openMiningRoundCid: string;
|
|
7
|
+
featuredAppRight: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface PaymentContextWithDisclosedContracts {
|
|
10
|
+
paymentContext: PaymentContext;
|
|
11
|
+
disclosedContracts: DisclosedContract[];
|
|
12
|
+
}
|
|
13
|
+
export interface PaymentContextWithAmulets {
|
|
14
|
+
payerAmulets: string[];
|
|
15
|
+
amuletRulesCid: string;
|
|
16
|
+
openMiningRoundCid: string;
|
|
17
|
+
featuredAppRight?: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface PaymentContextWithAmuletsAndDisclosed {
|
|
20
|
+
paymentContext: PaymentContextWithAmulets;
|
|
21
|
+
disclosedContracts: DisclosedContract[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Build payment context for processing paymentStream payments (no amulet inputs needed)
|
|
25
|
+
*
|
|
26
|
+
* Queries the ledger for:
|
|
27
|
+
*
|
|
28
|
+
* - AmuletRules contract
|
|
29
|
+
* - OpenMiningRound contract
|
|
30
|
+
* - FeaturedAppRight contract (if provider specified)
|
|
31
|
+
*
|
|
32
|
+
* Returns both the payment context and the disclosed contracts needed
|
|
33
|
+
*
|
|
34
|
+
* @param validatorClient - Validator API client for getting rules/rounds
|
|
35
|
+
* @param provider - Optional provider party ID to lookup featured app right
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildPaymentContext(validatorClient: ValidatorApiClient, provider: string): Promise<PaymentContextWithDisclosedContracts>;
|
|
38
|
+
/**
|
|
39
|
+
* Build payment context with payer's amulets for initial paymentStream approval
|
|
40
|
+
*
|
|
41
|
+
* Queries the ledger for:
|
|
42
|
+
*
|
|
43
|
+
* - Payer's Amulet contracts (via Validator API)
|
|
44
|
+
* - AmuletRules contract
|
|
45
|
+
* - OpenMiningRound contract
|
|
46
|
+
* - FeaturedAppRight contract
|
|
47
|
+
*
|
|
48
|
+
* Selects the minimum number of amulets needed to cover the requested amount, choosing largest amulets first to
|
|
49
|
+
* minimize the number of inputs.
|
|
50
|
+
*
|
|
51
|
+
* Returns both the payment context and the disclosed contracts needed
|
|
52
|
+
*
|
|
53
|
+
* NOTE: The validatorClient must be authenticated as the payerParty
|
|
54
|
+
*
|
|
55
|
+
* @param validatorClient - Validator API client authenticated as payer
|
|
56
|
+
* @param payerParty - Party ID of the payer (for validation only)
|
|
57
|
+
* @param requestedAmount - Amount in CC needed for the payment
|
|
58
|
+
* @param provider - Provider party ID for featured app right lookup
|
|
59
|
+
*/
|
|
60
|
+
export declare function buildPaymentContextWithAmulets(validatorClient: ValidatorApiClient, payerParty: string, requestedAmount: string, provider: string): Promise<PaymentContextWithAmuletsAndDisclosed>;
|
|
61
|
+
//# sourceMappingURL=paymentContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentContext.d.ts","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/utils/paymentContext.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kFAAkF,CAAC;AAY1H,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,oCAAoC;IACnD,cAAc,EAAE,cAAc,CAAC;IAC/B,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,qCAAqC;IACpD,cAAc,EAAE,yBAAyB,CAAC;IAC1C,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CACvC,eAAe,EAAE,kBAAkB,EACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,oCAAoC,CAAC,CAwD/C;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,8BAA8B,CAClD,eAAe,EAAE,kBAAkB,EACnC,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,qCAAqC,CAAC,CA6IhD"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Utilities for building payment context for paymentStream payments */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.buildPaymentContext = buildPaymentContext;
|
|
5
|
+
exports.buildPaymentContextWithAmulets = buildPaymentContextWithAmulets;
|
|
6
|
+
const mining_rounds_1 = require("@fairmint/canton-node-sdk/build/src/utils/mining/mining-rounds");
|
|
7
|
+
const canton_1 = require("@open-captable-protocol/canton");
|
|
8
|
+
function isLikelyOptionalFeaturedAppRightMiss(error) {
|
|
9
|
+
const s = error instanceof Error ? error.message : String(error);
|
|
10
|
+
return /not\s*found|404|NOT_FOUND|not\s+found|unknown\s+contract/i.test(s);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Build payment context for processing paymentStream payments (no amulet inputs needed)
|
|
14
|
+
*
|
|
15
|
+
* Queries the ledger for:
|
|
16
|
+
*
|
|
17
|
+
* - AmuletRules contract
|
|
18
|
+
* - OpenMiningRound contract
|
|
19
|
+
* - FeaturedAppRight contract (if provider specified)
|
|
20
|
+
*
|
|
21
|
+
* Returns both the payment context and the disclosed contracts needed
|
|
22
|
+
*
|
|
23
|
+
* @param validatorClient - Validator API client for getting rules/rounds
|
|
24
|
+
* @param provider - Optional provider party ID to lookup featured app right
|
|
25
|
+
*/
|
|
26
|
+
async function buildPaymentContext(validatorClient, provider) {
|
|
27
|
+
// Get AmuletRules contract
|
|
28
|
+
const amuletRulesResponse = await validatorClient.getAmuletRules();
|
|
29
|
+
const amuletRulesCid = amuletRulesResponse.amulet_rules.contract.contract_id;
|
|
30
|
+
const amuletRulesContract = {
|
|
31
|
+
templateId: amuletRulesResponse.amulet_rules.contract.template_id,
|
|
32
|
+
contractId: amuletRulesCid,
|
|
33
|
+
createdEventBlob: amuletRulesResponse.amulet_rules.contract.created_event_blob,
|
|
34
|
+
synchronizerId: amuletRulesResponse.amulet_rules.domain_id,
|
|
35
|
+
};
|
|
36
|
+
// Get OpenMiningRound contract
|
|
37
|
+
const miningRoundContext = await (0, mining_rounds_1.getCurrentMiningRoundContext)(validatorClient);
|
|
38
|
+
const openMiningRoundCid = miningRoundContext.openMiningRound;
|
|
39
|
+
const { openMiningRoundContract } = miningRoundContext;
|
|
40
|
+
// Get FeaturedAppRight contract if provider specified
|
|
41
|
+
let featuredAppRightCid = null;
|
|
42
|
+
const disclosedContracts = [
|
|
43
|
+
amuletRulesContract,
|
|
44
|
+
openMiningRoundContract,
|
|
45
|
+
];
|
|
46
|
+
if (provider) {
|
|
47
|
+
try {
|
|
48
|
+
const featuredAppRight = await validatorClient.lookupFeaturedAppRight({
|
|
49
|
+
partyId: provider,
|
|
50
|
+
});
|
|
51
|
+
const contractId = featuredAppRight.featured_app_right?.contract_id;
|
|
52
|
+
if (contractId) {
|
|
53
|
+
featuredAppRightCid = contractId;
|
|
54
|
+
disclosedContracts.push({
|
|
55
|
+
templateId: featuredAppRight.featured_app_right.template_id,
|
|
56
|
+
contractId,
|
|
57
|
+
createdEventBlob: featuredAppRight.featured_app_right.created_event_blob,
|
|
58
|
+
synchronizerId: amuletRulesResponse.amulet_rules.domain_id,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (!isLikelyOptionalFeaturedAppRightMiss(error)) {
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
paymentContext: {
|
|
70
|
+
amuletRulesCid,
|
|
71
|
+
openMiningRoundCid,
|
|
72
|
+
featuredAppRight: featuredAppRightCid,
|
|
73
|
+
},
|
|
74
|
+
disclosedContracts,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Build payment context with payer's amulets for initial paymentStream approval
|
|
79
|
+
*
|
|
80
|
+
* Queries the ledger for:
|
|
81
|
+
*
|
|
82
|
+
* - Payer's Amulet contracts (via Validator API)
|
|
83
|
+
* - AmuletRules contract
|
|
84
|
+
* - OpenMiningRound contract
|
|
85
|
+
* - FeaturedAppRight contract
|
|
86
|
+
*
|
|
87
|
+
* Selects the minimum number of amulets needed to cover the requested amount, choosing largest amulets first to
|
|
88
|
+
* minimize the number of inputs.
|
|
89
|
+
*
|
|
90
|
+
* Returns both the payment context and the disclosed contracts needed
|
|
91
|
+
*
|
|
92
|
+
* NOTE: The validatorClient must be authenticated as the payerParty
|
|
93
|
+
*
|
|
94
|
+
* @param validatorClient - Validator API client authenticated as payer
|
|
95
|
+
* @param payerParty - Party ID of the payer (for validation only)
|
|
96
|
+
* @param requestedAmount - Amount in CC needed for the payment
|
|
97
|
+
* @param provider - Provider party ID for featured app right lookup
|
|
98
|
+
*/
|
|
99
|
+
async function buildPaymentContextWithAmulets(validatorClient, payerParty, requestedAmount, provider) {
|
|
100
|
+
// Get payer's Amulet contracts via Validator API
|
|
101
|
+
// Note: validatorClient must be authenticated as payerParty
|
|
102
|
+
const amuletsResponse = await validatorClient.getAmulets();
|
|
103
|
+
if (amuletsResponse.amulets.length === 0) {
|
|
104
|
+
throw new canton_1.OcpValidationError('payerParty.amulets', `Payer ${payerParty} has no Amulet contracts`, {
|
|
105
|
+
code: canton_1.OcpErrorCodes.REQUIRED_FIELD_MISSING,
|
|
106
|
+
receivedValue: amuletsResponse.amulets,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
// Map amulets with their effective amounts
|
|
110
|
+
const amuletsWithAmounts = amuletsResponse.amulets.map(amulet => {
|
|
111
|
+
const effectiveAmount = parseFloat(amulet.effective_amount);
|
|
112
|
+
if (!Number.isFinite(effectiveAmount)) {
|
|
113
|
+
throw new canton_1.OcpValidationError('amulet.effective_amount', `Invalid effective_amount for amulet ${amulet.contract.contract.contract_id}: "${amulet.effective_amount}"`, {
|
|
114
|
+
code: canton_1.OcpErrorCodes.INVALID_FORMAT,
|
|
115
|
+
receivedValue: amulet.effective_amount,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
contractId: amulet.contract.contract.contract_id,
|
|
120
|
+
templateId: amulet.contract.contract.template_id,
|
|
121
|
+
synchronizerId: amulet.contract.domain_id,
|
|
122
|
+
effectiveAmount,
|
|
123
|
+
createdEventBlob: amulet.contract.contract.created_event_blob,
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
// Sort by effective amount (largest first) to minimize number of inputs
|
|
127
|
+
amuletsWithAmounts.sort((a, b) => b.effectiveAmount - a.effectiveAmount);
|
|
128
|
+
// Select minimum amulets needed to cover requested amount
|
|
129
|
+
const requestedAmountNum = parseFloat(requestedAmount);
|
|
130
|
+
if (!Number.isFinite(requestedAmountNum) || requestedAmountNum < 0) {
|
|
131
|
+
throw new canton_1.OcpValidationError('requestedAmount', `Invalid requested amount: "${requestedAmount}". Expected a non-negative finite number.`, {
|
|
132
|
+
code: canton_1.OcpErrorCodes.INVALID_FORMAT,
|
|
133
|
+
receivedValue: requestedAmount,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
const selectedAmulets = [];
|
|
137
|
+
let accumulatedAmount = 0;
|
|
138
|
+
for (const amulet of amuletsWithAmounts) {
|
|
139
|
+
selectedAmulets.push(amulet);
|
|
140
|
+
accumulatedAmount += amulet.effectiveAmount;
|
|
141
|
+
// Stop once we have enough to cover the requested amount
|
|
142
|
+
if (accumulatedAmount >= requestedAmountNum) {
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Check if we have sufficient funds
|
|
147
|
+
if (accumulatedAmount < requestedAmountNum) {
|
|
148
|
+
throw new canton_1.OcpValidationError('payerParty.balance', `Insufficient funds: Payer ${payerParty} has ${accumulatedAmount.toFixed(2)} CC available but needs ${requestedAmountNum.toFixed(2)} CC (missing ${(requestedAmountNum - accumulatedAmount).toFixed(2)} CC)`, { code: canton_1.OcpErrorCodes.OUT_OF_RANGE, receivedValue: accumulatedAmount });
|
|
149
|
+
}
|
|
150
|
+
// Build disclosed contracts for selected amulets
|
|
151
|
+
const amuletDisclosedContracts = selectedAmulets.map(amulet => ({
|
|
152
|
+
templateId: amulet.templateId,
|
|
153
|
+
contractId: amulet.contractId,
|
|
154
|
+
createdEventBlob: amulet.createdEventBlob,
|
|
155
|
+
synchronizerId: amulet.synchronizerId,
|
|
156
|
+
}));
|
|
157
|
+
// Get AmuletRules contract
|
|
158
|
+
const amuletRulesResponse = await validatorClient.getAmuletRules();
|
|
159
|
+
const amuletRulesCid = amuletRulesResponse.amulet_rules.contract.contract_id;
|
|
160
|
+
const amuletRulesContract = {
|
|
161
|
+
templateId: amuletRulesResponse.amulet_rules.contract.template_id,
|
|
162
|
+
contractId: amuletRulesCid,
|
|
163
|
+
createdEventBlob: amuletRulesResponse.amulet_rules.contract.created_event_blob,
|
|
164
|
+
synchronizerId: amuletRulesResponse.amulet_rules.domain_id,
|
|
165
|
+
};
|
|
166
|
+
// Get OpenMiningRound contract
|
|
167
|
+
const miningRoundContext = await (0, mining_rounds_1.getCurrentMiningRoundContext)(validatorClient);
|
|
168
|
+
const openMiningRoundCid = miningRoundContext.openMiningRound;
|
|
169
|
+
const { openMiningRoundContract } = miningRoundContext;
|
|
170
|
+
// Build payment context with selected amulets
|
|
171
|
+
const amuletInputs = selectedAmulets.map(a => a.contractId);
|
|
172
|
+
// Get FeaturedAppRight contract for provider
|
|
173
|
+
let featuredAppRightCid = null;
|
|
174
|
+
const disclosedContracts = [
|
|
175
|
+
amuletRulesContract,
|
|
176
|
+
openMiningRoundContract,
|
|
177
|
+
...amuletDisclosedContracts,
|
|
178
|
+
];
|
|
179
|
+
try {
|
|
180
|
+
const featuredAppRight = await validatorClient.lookupFeaturedAppRight({
|
|
181
|
+
partyId: provider,
|
|
182
|
+
});
|
|
183
|
+
const contractId = featuredAppRight.featured_app_right?.contract_id;
|
|
184
|
+
if (contractId) {
|
|
185
|
+
featuredAppRightCid = contractId;
|
|
186
|
+
disclosedContracts.push({
|
|
187
|
+
templateId: featuredAppRight.featured_app_right.template_id,
|
|
188
|
+
contractId,
|
|
189
|
+
createdEventBlob: featuredAppRight.featured_app_right.created_event_blob,
|
|
190
|
+
synchronizerId: amuletRulesResponse.amulet_rules.domain_id,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
if (!isLikelyOptionalFeaturedAppRightMiss(error)) {
|
|
196
|
+
throw error;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
paymentContext: {
|
|
201
|
+
payerAmulets: amuletInputs,
|
|
202
|
+
amuletRulesCid,
|
|
203
|
+
openMiningRoundCid,
|
|
204
|
+
featuredAppRight: featuredAppRightCid,
|
|
205
|
+
},
|
|
206
|
+
disclosedContracts,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=paymentContext.js.map
|
|
@@ -0,0 +1 @@
|
|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,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO;QACL,cAAc,EAAE;YACd,YAAY,EAAE,YAAY;YAC1B,cAAc;YACd,kBAAkB;YAClB,gBAAgB,EAAE,mBAAmB;SACtC;QACD,kBAAkB;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { relTimeToDAML } from '@open-captable-protocol/canton';
|
|
2
|
+
import type { PaymentStreamAmountInput, PaymentStreamProposalInput, PaymentStreamTimeInput } from '../types/paymentStreamProposalInput';
|
|
3
|
+
/** DAML RelTime JSON shape from OCP helpers. */
|
|
4
|
+
export type DamlRelTime = ReturnType<typeof relTimeToDAML>;
|
|
5
|
+
export type DamlPaymentStreamAmount = {
|
|
6
|
+
tag: 'AmuletAmount';
|
|
7
|
+
value: string;
|
|
8
|
+
} | {
|
|
9
|
+
tag: 'USDAmount';
|
|
10
|
+
value: string;
|
|
11
|
+
};
|
|
12
|
+
export type DamlPaymentStreamTime = {
|
|
13
|
+
tag: 'PreciseTime';
|
|
14
|
+
value: string;
|
|
15
|
+
} | {
|
|
16
|
+
tag: 'RelativeTime';
|
|
17
|
+
value: string;
|
|
18
|
+
};
|
|
19
|
+
/** Choice argument fragment: `ActivePaymentStream_ProposeChanges.paymentStreamChanges`. */
|
|
20
|
+
export interface PaymentStreamChangesDaml {
|
|
21
|
+
processedAndPaidUntilAdjustment?: DamlRelTime;
|
|
22
|
+
recipientProvider?: string;
|
|
23
|
+
recipientBeneficiaries?: Array<{
|
|
24
|
+
party: string;
|
|
25
|
+
weight: string;
|
|
26
|
+
}> | null;
|
|
27
|
+
recipientPaymentPerDay?: DamlPaymentStreamAmount;
|
|
28
|
+
processorPaymentPerDay?: DamlPaymentStreamAmount | null;
|
|
29
|
+
prepayWindow?: DamlRelTime | null;
|
|
30
|
+
paymentsEndAt?: DamlPaymentStreamTime | null;
|
|
31
|
+
trialEndsAt?: DamlPaymentStreamTime | null;
|
|
32
|
+
description?: string | null;
|
|
33
|
+
metadata?: Record<string, string> | null;
|
|
34
|
+
observers?: string[];
|
|
35
|
+
}
|
|
36
|
+
/** Choice argument fragment: `ProposedPaymentStream_EditPaymentStreamProposal.changes`. */
|
|
37
|
+
export interface PaymentStreamProposalChangesDaml {
|
|
38
|
+
payer?: string;
|
|
39
|
+
recipient?: string;
|
|
40
|
+
recipientProvider?: string;
|
|
41
|
+
recipientBeneficiaries?: Array<{
|
|
42
|
+
party: string;
|
|
43
|
+
weight: string;
|
|
44
|
+
}> | null;
|
|
45
|
+
recipientPaymentPerDay?: DamlPaymentStreamAmount;
|
|
46
|
+
processorPaymentPerDay?: DamlPaymentStreamAmount | null;
|
|
47
|
+
paymentsEndAt?: DamlPaymentStreamTime | null;
|
|
48
|
+
prepayWindow?: DamlRelTime | null;
|
|
49
|
+
freeTrialExpiration?: DamlPaymentStreamTime | null;
|
|
50
|
+
description?: string | null;
|
|
51
|
+
metadata?: Record<string, string> | null;
|
|
52
|
+
observers?: string[];
|
|
53
|
+
}
|
|
54
|
+
/** Choice argument fragment: `PaymentStreamFactory_CreatePaymentStreamProposal.paymentStreamProposal`. */
|
|
55
|
+
export interface PaymentStreamProposalDaml {
|
|
56
|
+
payer: string;
|
|
57
|
+
recipient: string;
|
|
58
|
+
provider: string;
|
|
59
|
+
recipientPaymentPerDay: DamlPaymentStreamAmount;
|
|
60
|
+
prepayWindow: DamlRelTime;
|
|
61
|
+
appRewardBeneficiaries: Array<{
|
|
62
|
+
beneficiary: string;
|
|
63
|
+
weight: string;
|
|
64
|
+
}>;
|
|
65
|
+
observers: string[];
|
|
66
|
+
processorPaymentPerDay?: DamlPaymentStreamAmount;
|
|
67
|
+
paymentsEndAt?: DamlPaymentStreamTime;
|
|
68
|
+
freeTrialExpiration?: DamlPaymentStreamTime;
|
|
69
|
+
description?: string;
|
|
70
|
+
metadata?: Record<string, string>;
|
|
71
|
+
}
|
|
72
|
+
export declare function paymentStreamAmountToDaml(amount: PaymentStreamAmountInput): DamlPaymentStreamAmount;
|
|
73
|
+
export declare function paymentStreamTimeToDaml(time: PaymentStreamTimeInput): DamlPaymentStreamTime;
|
|
74
|
+
export declare function paymentStreamProposalToDaml(proposal: PaymentStreamProposalInput): PaymentStreamProposalDaml;
|
|
75
|
+
//# sourceMappingURL=paymentStreamDamlCodec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentStreamDamlCodec.d.ts","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/utils/paymentStreamDamlCodec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,qCAAqC,CAAC;AAE7C,gDAAgD;AAChD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AAE3D,MAAM,MAAM,uBAAuB,GAC/B;IAAE,GAAG,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,GAAG,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,MAAM,MAAM,qBAAqB,GAC7B;IAAE,GAAG,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,GAAG,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,2FAA2F;AAC3F,MAAM,WAAW,wBAAwB;IACvC,+BAA+B,CAAC,EAAE,WAAW,CAAC;IAC9C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IACzE,sBAAsB,CAAC,EAAE,uBAAuB,CAAC;IACjD,sBAAs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B,CAAC;IAChD,YAAY,EAAE,WAAW,CAAC;IAC1B,sBAAsB,EAAE,KAAK,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,sBAAsB,CAAC,EAAE,uBAAuB,CAAC;IACjD,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,mBAAmB,CAAC,EAAE,qBAAqB,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,wBAAwB,GAC/B,uBAAuB,CAwBzB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,sBAAsB,GAC3B,qBAAqB,CA+BvB;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,0BAA0B,GACnC,yBAAyB,CAkC3B"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paymentStreamAmountToDaml = paymentStreamAmountToDaml;
|
|
4
|
+
exports.paymentStreamTimeToDaml = paymentStreamTimeToDaml;
|
|
5
|
+
exports.paymentStreamProposalToDaml = paymentStreamProposalToDaml;
|
|
6
|
+
const canton_1 = require("@open-captable-protocol/canton");
|
|
7
|
+
function paymentStreamAmountToDaml(amount) {
|
|
8
|
+
const amountValue = typeof amount.amount === 'number'
|
|
9
|
+
? amount.amount.toString()
|
|
10
|
+
: amount.amount;
|
|
11
|
+
switch (amount.type) {
|
|
12
|
+
case 'AMULET':
|
|
13
|
+
return {
|
|
14
|
+
tag: 'AmuletAmount',
|
|
15
|
+
value: amountValue,
|
|
16
|
+
};
|
|
17
|
+
case 'USD':
|
|
18
|
+
return {
|
|
19
|
+
tag: 'USDAmount',
|
|
20
|
+
value: amountValue,
|
|
21
|
+
};
|
|
22
|
+
default: {
|
|
23
|
+
const _exhaustive = amount;
|
|
24
|
+
throw new TypeError(`Unsupported PaymentStreamAmountInput.type: ${String(_exhaustive.type)} (expected AMULET or USD)`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function paymentStreamTimeToDaml(time) {
|
|
29
|
+
switch (time.type) {
|
|
30
|
+
case 'PRECISE': {
|
|
31
|
+
if (!(time.value instanceof Date)) {
|
|
32
|
+
throw new TypeError(`PRECISE PaymentStreamTimeInput requires value instanceof Date, got ${typeof time.value}`);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
tag: 'PreciseTime',
|
|
36
|
+
value: time.value.toISOString(),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
case 'RELATIVE': {
|
|
40
|
+
if (typeof time.value !== 'string') {
|
|
41
|
+
throw new TypeError(`RELATIVE PaymentStreamTimeInput requires value: string (microseconds), got ${typeof time.value}`);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
tag: 'RelativeTime',
|
|
45
|
+
value: time.value,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
default: {
|
|
49
|
+
const _exhaustive = time;
|
|
50
|
+
throw new TypeError(`Unsupported PaymentStreamTimeInput.type: ${String(_exhaustive.type)} (expected PRECISE or RELATIVE)`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function paymentStreamProposalToDaml(proposal) {
|
|
55
|
+
const result = {
|
|
56
|
+
payer: proposal.payer,
|
|
57
|
+
recipient: proposal.recipient,
|
|
58
|
+
provider: proposal.provider,
|
|
59
|
+
recipientPaymentPerDay: paymentStreamAmountToDaml(proposal.recipientPaymentPerDay),
|
|
60
|
+
prepayWindow: (0, canton_1.relTimeToDAML)(proposal.prepayWindow),
|
|
61
|
+
appRewardBeneficiaries: proposal.appRewardBeneficiaries ?? [],
|
|
62
|
+
observers: proposal.observers ?? [],
|
|
63
|
+
};
|
|
64
|
+
if (proposal.processorPaymentPerDay) {
|
|
65
|
+
result.processorPaymentPerDay = paymentStreamAmountToDaml(proposal.processorPaymentPerDay);
|
|
66
|
+
}
|
|
67
|
+
if (proposal.paymentsEndAt != null) {
|
|
68
|
+
result.paymentsEndAt = paymentStreamTimeToDaml(proposal.paymentsEndAt);
|
|
69
|
+
}
|
|
70
|
+
if (proposal.freeTrialExpiration != null) {
|
|
71
|
+
result.freeTrialExpiration = paymentStreamTimeToDaml(proposal.freeTrialExpiration);
|
|
72
|
+
}
|
|
73
|
+
if (proposal.description !== undefined) {
|
|
74
|
+
result.description = proposal.description;
|
|
75
|
+
}
|
|
76
|
+
if (proposal.metadata !== undefined) {
|
|
77
|
+
result.metadata = proposal.metadata;
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=paymentStreamDamlCodec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentStreamDamlCodec.js","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/utils/paymentStreamDamlCodec.ts"],"names":[],"mappings":";;AAiEA,8DA0BC;AAED,0DAiCC;AAED,kEAoCC;AApKD,2DAA+D;AAiE/D,SAAgB,yBAAyB,CACvC,MAAgC;IAEhC,MAAM,WAAW,GACf,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;QAC/B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;QAC1B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IAEpB,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,QAAQ;YACX,OAAO;gBACL,GAAG,EAAE,cAAc;gBACnB,KAAK,EAAE,WAAW;aACnB,CAAC;QACJ,KAAK,KAAK;YACR,OAAO;gBACL,GAAG,EAAE,WAAW;gBAChB,KAAK,EAAE,WAAW;aACnB,CAAC;QACJ,OAAO,CAAC,CAAC,CAAC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,EAAE,yBAAyB,CAC/C,QAAQ,CAAC,sBAAsB,CAChC;QACD,YAAY,EAAE,IAAA,sBAAa,EAAC,QAAQ,CAAC,YAAY,CAAC;QAClD,sBAAsB,EAAE,QAAQ,CAAC,sBAAsB,IAAI,EAAE;QAC7D,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE;KACpC,CAAC;IAEF,IAAI,QAAQ,CAAC,sBAAsB,EAAE,CAAC;QACpC,MAAM,CAAC,sBAAsB,GAAG,yBAAyB,CACvD,QAAQ,CAAC,sBAAsB,CAChC,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,CAAC,aAAa,IAAI,IAAI,EAAE,CAAC;QACnC,MAAM,CAAC,aAAa,GAAG,uBAAuB,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,QAAQ,CAAC,mBAAmB,IAAI,IAAI,EAAE,CAAC;QACzC,MAAM,CAAC,mBAAmB,GAAG,uBAAuB,CAClD,QAAQ,CAAC,mBAAmB,CAC7B,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACvC,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;IAC5C,CAAC;IACD,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACtC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,9 @@ export * from './clients/shared/config';
|
|
|
4
4
|
export * from './clients/postgres-db-api/postgresDbClient';
|
|
5
5
|
export * from './clients/postgres-db-api/cantonDbClient';
|
|
6
6
|
export * from './clients/postgres-db-api/types';
|
|
7
|
+
export * from './extensions';
|
|
8
|
+
export * from './functions/CouponMinter';
|
|
9
|
+
export * from './functions/CantonPayments';
|
|
10
|
+
export * from './functions/PaymentStreams';
|
|
11
|
+
export { createFairmintOcpClient, type FairmintOcpClient, type OcpClientDependencies, type PaymentStreamsMethodsWithClient, } from './fairmintOcpClient';
|
|
7
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,iCAAiC,CAAC;AAGhD,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,+BAA+B,GACrC,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ 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
|
+
exports.createFairmintOcpClient = void 0;
|
|
17
18
|
// Re-export all clients and utilities
|
|
18
19
|
__exportStar(require("./clients"), exports);
|
|
19
20
|
__exportStar(require("./clients/shared/types"), exports);
|
|
@@ -21,4 +22,11 @@ __exportStar(require("./clients/shared/config"), exports);
|
|
|
21
22
|
__exportStar(require("./clients/postgres-db-api/postgresDbClient"), exports);
|
|
22
23
|
__exportStar(require("./clients/postgres-db-api/cantonDbClient"), exports);
|
|
23
24
|
__exportStar(require("./clients/postgres-db-api/types"), exports);
|
|
25
|
+
// Fairmint-only OCP extensions (CouponMinter, CantonPayments, PaymentStreams)
|
|
26
|
+
__exportStar(require("./extensions"), exports);
|
|
27
|
+
__exportStar(require("./functions/CouponMinter"), exports);
|
|
28
|
+
__exportStar(require("./functions/CantonPayments"), exports);
|
|
29
|
+
__exportStar(require("./functions/PaymentStreams"), exports);
|
|
30
|
+
var fairmintOcpClient_1 = require("./fairmintOcpClient");
|
|
31
|
+
Object.defineProperty(exports, "createFairmintOcpClient", { enumerable: true, get: function () { return fairmintOcpClient_1.createFairmintOcpClient; } });
|
|
24
32
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,4CAA0B;AAC1B,yDAAuC;AACvC,0DAAwC;AACxC,6EAA2D;AAC3D,2EAAyD;AACzD,kEAAgD;AAEhD,8EAA8E;AAC9E,+CAA6B;AAC7B,2DAAyC;AACzC,6DAA2C;AAC3C,6DAA2C;AAC3C,yDAK6B;AAJ3B,4HAAA,uBAAuB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fairmint/canton-fairmint-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"description": "Shared SDK utilities for Canton blockchain integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"test:integration": "npm run -s typecheck && jest -c jest.integration.config.js",
|
|
26
26
|
"test:integration:ci": "npm run -s typecheck && jest -c jest.integration.config.js --runInBand",
|
|
27
27
|
"test:watch": "jest --watch",
|
|
28
|
-
"prepare-release": "ts-node scripts/prepare-release.ts",
|
|
28
|
+
"prepare-release": "ts-node --project scripts/tsconfig.json scripts/prepare-release.ts",
|
|
29
29
|
"prepublishOnly": "npm run clean && npm run build"
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
@@ -45,31 +45,31 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/fairmint/canton-fairmint-sdk#readme",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"dotenv": "17.2
|
|
49
|
-
"pg": "8.
|
|
50
|
-
"pg-connection-string": "2.
|
|
48
|
+
"dotenv": "17.4.2",
|
|
49
|
+
"pg": "8.20.0",
|
|
50
|
+
"pg-connection-string": "2.12.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@fairmint/canton-node-sdk": ">=0.0.
|
|
53
|
+
"@fairmint/canton-node-sdk": ">=0.0.198",
|
|
54
54
|
"@fairmint/open-captable-protocol-daml-js": ">=0.2.66",
|
|
55
|
-
"@open-captable-protocol/canton": ">=0.2.
|
|
55
|
+
"@open-captable-protocol/canton": ">=0.2.296"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@eslint/eslintrc": "3.3.
|
|
59
|
-
"@fairmint/canton-node-sdk": "0.0.
|
|
60
|
-
"@fairmint/open-captable-protocol-daml-js": "0.2.
|
|
61
|
-
"@open-captable-protocol/canton": "0.2.
|
|
58
|
+
"@eslint/eslintrc": "3.3.5",
|
|
59
|
+
"@fairmint/canton-node-sdk": "0.0.198",
|
|
60
|
+
"@fairmint/open-captable-protocol-daml-js": "0.2.161",
|
|
61
|
+
"@open-captable-protocol/canton": "0.2.302",
|
|
62
62
|
"@types/jest": "30.0.0",
|
|
63
|
-
"@types/node": "25.
|
|
64
|
-
"@types/pg": "8.
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
66
|
-
"@typescript-eslint/parser": "8.
|
|
67
|
-
"eslint": "
|
|
63
|
+
"@types/node": "25.6.0",
|
|
64
|
+
"@types/pg": "8.20.0",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "8.59.0",
|
|
66
|
+
"@typescript-eslint/parser": "8.59.0",
|
|
67
|
+
"eslint": "10.2.1",
|
|
68
68
|
"eslint-plugin-unused-imports": "4.4.1",
|
|
69
|
-
"jest": "30.
|
|
70
|
-
"prettier": "3.8.
|
|
71
|
-
"ts-jest": "29.4.
|
|
69
|
+
"jest": "30.3.0",
|
|
70
|
+
"prettier": "3.8.3",
|
|
71
|
+
"ts-jest": "29.4.9",
|
|
72
72
|
"ts-node": "10.9.2",
|
|
73
|
-
"typescript": "
|
|
73
|
+
"typescript": "6.0.3"
|
|
74
74
|
}
|
|
75
75
|
}
|