@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.
Files changed (241) hide show
  1. package/dist/clients/json-api/sdkHelper.js +1 -1
  2. package/dist/clients/shared/runtime.d.ts.map +1 -1
  3. package/dist/clients/shared/runtime.js +4 -7
  4. package/dist/clients/shared/runtime.js.map +1 -1
  5. package/dist/extensions/CantonPaymentsExtension.d.ts +34 -0
  6. package/dist/extensions/CantonPaymentsExtension.d.ts.map +1 -0
  7. package/dist/extensions/CantonPaymentsExtension.js +23 -0
  8. package/dist/extensions/CantonPaymentsExtension.js.map +1 -0
  9. package/dist/extensions/PaymentStreamsExtension.d.ts +71 -0
  10. package/dist/extensions/PaymentStreamsExtension.d.ts.map +1 -0
  11. package/dist/extensions/PaymentStreamsExtension.js +55 -0
  12. package/dist/extensions/PaymentStreamsExtension.js.map +1 -0
  13. package/dist/extensions/index.d.ts +3 -0
  14. package/dist/extensions/index.d.ts.map +1 -0
  15. package/dist/extensions/index.js +8 -0
  16. package/dist/extensions/index.js.map +1 -0
  17. package/dist/fairmintOcpClient.d.ts +48 -0
  18. package/dist/fairmintOcpClient.d.ts.map +1 -0
  19. package/dist/fairmintOcpClient.js +52 -0
  20. package/dist/fairmintOcpClient.js.map +1 -0
  21. package/dist/functions/CantonPayments/airdrop/addObserversToAirdrop.d.ts +8 -0
  22. package/dist/functions/CantonPayments/airdrop/addObserversToAirdrop.d.ts.map +1 -0
  23. package/dist/functions/CantonPayments/airdrop/addObserversToAirdrop.js +18 -0
  24. package/dist/functions/CantonPayments/airdrop/addObserversToAirdrop.js.map +1 -0
  25. package/dist/functions/CantonPayments/airdrop/createAirdrop.d.ts +13 -0
  26. package/dist/functions/CantonPayments/airdrop/createAirdrop.d.ts.map +1 -0
  27. package/dist/functions/CantonPayments/airdrop/createAirdrop.js +23 -0
  28. package/dist/functions/CantonPayments/airdrop/createAirdrop.js.map +1 -0
  29. package/dist/functions/CantonPayments/airdrop/executeAirdrop.d.ts +20 -0
  30. package/dist/functions/CantonPayments/airdrop/executeAirdrop.d.ts.map +1 -0
  31. package/dist/functions/CantonPayments/airdrop/executeAirdrop.js +31 -0
  32. package/dist/functions/CantonPayments/airdrop/executeAirdrop.js.map +1 -0
  33. package/dist/functions/CantonPayments/airdrop/index.d.ts +6 -0
  34. package/dist/functions/CantonPayments/airdrop/index.d.ts.map +1 -0
  35. package/dist/functions/CantonPayments/airdrop/index.js +22 -0
  36. package/dist/functions/CantonPayments/airdrop/index.js.map +1 -0
  37. package/dist/functions/CantonPayments/airdrop/joinAirdrop.d.ts +14 -0
  38. package/dist/functions/CantonPayments/airdrop/joinAirdrop.d.ts.map +1 -0
  39. package/dist/functions/CantonPayments/airdrop/joinAirdrop.js +36 -0
  40. package/dist/functions/CantonPayments/airdrop/joinAirdrop.js.map +1 -0
  41. package/dist/functions/CantonPayments/airdrop/updateAirdropConfig.d.ts +8 -0
  42. package/dist/functions/CantonPayments/airdrop/updateAirdropConfig.d.ts.map +1 -0
  43. package/dist/functions/CantonPayments/airdrop/updateAirdropConfig.js +22 -0
  44. package/dist/functions/CantonPayments/airdrop/updateAirdropConfig.js.map +1 -0
  45. package/dist/functions/CantonPayments/index.d.ts +3 -0
  46. package/dist/functions/CantonPayments/index.d.ts.map +1 -0
  47. package/dist/functions/CantonPayments/index.js +19 -0
  48. package/dist/functions/CantonPayments/index.js.map +1 -0
  49. package/dist/functions/CantonPayments/simpleAirdrop/archiveSimpleAirdrop.d.ts +6 -0
  50. package/dist/functions/CantonPayments/simpleAirdrop/archiveSimpleAirdrop.d.ts.map +1 -0
  51. package/dist/functions/CantonPayments/simpleAirdrop/archiveSimpleAirdrop.js +15 -0
  52. package/dist/functions/CantonPayments/simpleAirdrop/archiveSimpleAirdrop.js.map +1 -0
  53. package/dist/functions/CantonPayments/simpleAirdrop/createSimpleAirdrop.d.ts +12 -0
  54. package/dist/functions/CantonPayments/simpleAirdrop/createSimpleAirdrop.d.ts.map +1 -0
  55. package/dist/functions/CantonPayments/simpleAirdrop/createSimpleAirdrop.js +21 -0
  56. package/dist/functions/CantonPayments/simpleAirdrop/createSimpleAirdrop.js.map +1 -0
  57. package/dist/functions/CantonPayments/simpleAirdrop/executeSimpleAirdrop.d.ts +14 -0
  58. package/dist/functions/CantonPayments/simpleAirdrop/executeSimpleAirdrop.d.ts.map +1 -0
  59. package/dist/functions/CantonPayments/simpleAirdrop/executeSimpleAirdrop.js +26 -0
  60. package/dist/functions/CantonPayments/simpleAirdrop/executeSimpleAirdrop.js.map +1 -0
  61. package/dist/functions/CantonPayments/simpleAirdrop/index.d.ts +4 -0
  62. package/dist/functions/CantonPayments/simpleAirdrop/index.d.ts.map +1 -0
  63. package/dist/functions/CantonPayments/simpleAirdrop/index.js +20 -0
  64. package/dist/functions/CantonPayments/simpleAirdrop/index.js.map +1 -0
  65. package/dist/functions/CouponMinter/canMintCouponsNow.d.ts +56 -0
  66. package/dist/functions/CouponMinter/canMintCouponsNow.d.ts.map +1 -0
  67. package/dist/functions/CouponMinter/canMintCouponsNow.js +89 -0
  68. package/dist/functions/CouponMinter/canMintCouponsNow.js.map +1 -0
  69. package/dist/functions/CouponMinter/index.d.ts +3 -0
  70. package/dist/functions/CouponMinter/index.d.ts.map +1 -0
  71. package/dist/functions/CouponMinter/index.js +12 -0
  72. package/dist/functions/CouponMinter/index.js.map +1 -0
  73. package/dist/functions/CouponMinter/waitUntilCanMint.d.ts +176 -0
  74. package/dist/functions/CouponMinter/waitUntilCanMint.d.ts.map +1 -0
  75. package/dist/functions/CouponMinter/waitUntilCanMint.js +235 -0
  76. package/dist/functions/CouponMinter/waitUntilCanMint.js.map +1 -0
  77. package/dist/functions/PaymentStreams/activePaymentStream/addFunds.d.ts +10 -0
  78. package/dist/functions/PaymentStreams/activePaymentStream/addFunds.d.ts.map +1 -0
  79. package/dist/functions/PaymentStreams/activePaymentStream/addFunds.js +30 -0
  80. package/dist/functions/PaymentStreams/activePaymentStream/addFunds.js.map +1 -0
  81. package/dist/functions/PaymentStreams/activePaymentStream/archiveInactivePaymentStream.d.ts +7 -0
  82. package/dist/functions/PaymentStreams/activePaymentStream/archiveInactivePaymentStream.d.ts.map +1 -0
  83. package/dist/functions/PaymentStreams/activePaymentStream/archiveInactivePaymentStream.js +18 -0
  84. package/dist/functions/PaymentStreams/activePaymentStream/archiveInactivePaymentStream.js.map +1 -0
  85. package/dist/functions/PaymentStreams/activePaymentStream/cancel.d.ts +10 -0
  86. package/dist/functions/PaymentStreams/activePaymentStream/cancel.d.ts.map +1 -0
  87. package/dist/functions/PaymentStreams/activePaymentStream/cancel.js +22 -0
  88. package/dist/functions/PaymentStreams/activePaymentStream/cancel.js.map +1 -0
  89. package/dist/functions/PaymentStreams/activePaymentStream/changeParty.d.ts +10 -0
  90. package/dist/functions/PaymentStreams/activePaymentStream/changeParty.d.ts.map +1 -0
  91. package/dist/functions/PaymentStreams/activePaymentStream/changeParty.js +20 -0
  92. package/dist/functions/PaymentStreams/activePaymentStream/changeParty.js.map +1 -0
  93. package/dist/functions/PaymentStreams/activePaymentStream/index.d.ts +19 -0
  94. package/dist/functions/PaymentStreams/activePaymentStream/index.d.ts.map +1 -0
  95. package/dist/functions/PaymentStreams/activePaymentStream/index.js +39 -0
  96. package/dist/functions/PaymentStreams/activePaymentStream/index.js.map +1 -0
  97. package/dist/functions/PaymentStreams/activePaymentStream/processFreeTrial.d.ts +8 -0
  98. package/dist/functions/PaymentStreams/activePaymentStream/processFreeTrial.d.ts.map +1 -0
  99. package/dist/functions/PaymentStreams/activePaymentStream/processFreeTrial.js +21 -0
  100. package/dist/functions/PaymentStreams/activePaymentStream/processFreeTrial.js.map +1 -0
  101. package/dist/functions/PaymentStreams/activePaymentStream/processPayment.d.ts +11 -0
  102. package/dist/functions/PaymentStreams/activePaymentStream/processPayment.d.ts.map +1 -0
  103. package/dist/functions/PaymentStreams/activePaymentStream/processPayment.js +28 -0
  104. package/dist/functions/PaymentStreams/activePaymentStream/processPayment.js.map +1 -0
  105. package/dist/functions/PaymentStreams/activePaymentStream/proposeChanges.d.ts +26 -0
  106. package/dist/functions/PaymentStreams/activePaymentStream/proposeChanges.d.ts.map +1 -0
  107. package/dist/functions/PaymentStreams/activePaymentStream/proposeChanges.js +72 -0
  108. package/dist/functions/PaymentStreams/activePaymentStream/proposeChanges.js.map +1 -0
  109. package/dist/functions/PaymentStreams/activePaymentStream/refund.d.ts +10 -0
  110. package/dist/functions/PaymentStreams/activePaymentStream/refund.d.ts.map +1 -0
  111. package/dist/functions/PaymentStreams/activePaymentStream/refund.js +25 -0
  112. package/dist/functions/PaymentStreams/activePaymentStream/refund.js.map +1 -0
  113. package/dist/functions/PaymentStreams/activePaymentStream/replaceLockedAmulet.d.ts +10 -0
  114. package/dist/functions/PaymentStreams/activePaymentStream/replaceLockedAmulet.d.ts.map +1 -0
  115. package/dist/functions/PaymentStreams/activePaymentStream/replaceLockedAmulet.js +26 -0
  116. package/dist/functions/PaymentStreams/activePaymentStream/replaceLockedAmulet.js.map +1 -0
  117. package/dist/functions/PaymentStreams/activePaymentStream/withdrawFunds.d.ts +9 -0
  118. package/dist/functions/PaymentStreams/activePaymentStream/withdrawFunds.d.ts.map +1 -0
  119. package/dist/functions/PaymentStreams/activePaymentStream/withdrawFunds.js +25 -0
  120. package/dist/functions/PaymentStreams/activePaymentStream/withdrawFunds.js.map +1 -0
  121. package/dist/functions/PaymentStreams/index.d.ts +17 -0
  122. package/dist/functions/PaymentStreams/index.d.ts.map +1 -0
  123. package/dist/functions/PaymentStreams/index.js +58 -0
  124. package/dist/functions/PaymentStreams/index.js.map +1 -0
  125. package/dist/functions/PaymentStreams/partyMigrationProposal/approve.d.ts +7 -0
  126. package/dist/functions/PaymentStreams/partyMigrationProposal/approve.d.ts.map +1 -0
  127. package/dist/functions/PaymentStreams/partyMigrationProposal/approve.js +18 -0
  128. package/dist/functions/PaymentStreams/partyMigrationProposal/approve.js.map +1 -0
  129. package/dist/functions/PaymentStreams/partyMigrationProposal/archive.d.ts +8 -0
  130. package/dist/functions/PaymentStreams/partyMigrationProposal/archive.d.ts.map +1 -0
  131. package/dist/functions/PaymentStreams/partyMigrationProposal/archive.js +20 -0
  132. package/dist/functions/PaymentStreams/partyMigrationProposal/archive.js.map +1 -0
  133. package/dist/functions/PaymentStreams/partyMigrationProposal/index.d.ts +5 -0
  134. package/dist/functions/PaymentStreams/partyMigrationProposal/index.d.ts.map +1 -0
  135. package/dist/functions/PaymentStreams/partyMigrationProposal/index.js +21 -0
  136. package/dist/functions/PaymentStreams/partyMigrationProposal/index.js.map +1 -0
  137. package/dist/functions/PaymentStreams/partyMigrationProposal/migrateActivePaymentStream.d.ts +8 -0
  138. package/dist/functions/PaymentStreams/partyMigrationProposal/migrateActivePaymentStream.d.ts.map +1 -0
  139. package/dist/functions/PaymentStreams/partyMigrationProposal/migrateActivePaymentStream.js +19 -0
  140. package/dist/functions/PaymentStreams/partyMigrationProposal/migrateActivePaymentStream.js.map +1 -0
  141. package/dist/functions/PaymentStreams/partyMigrationProposal/migrateProposedPaymentStream.d.ts +8 -0
  142. package/dist/functions/PaymentStreams/partyMigrationProposal/migrateProposedPaymentStream.d.ts.map +1 -0
  143. package/dist/functions/PaymentStreams/partyMigrationProposal/migrateProposedPaymentStream.js +19 -0
  144. package/dist/functions/PaymentStreams/partyMigrationProposal/migrateProposedPaymentStream.js.map +1 -0
  145. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/apply.d.ts +8 -0
  146. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/apply.d.ts.map +1 -0
  147. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/apply.js +19 -0
  148. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/apply.js.map +1 -0
  149. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/approve.d.ts +7 -0
  150. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/approve.d.ts.map +1 -0
  151. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/approve.js +18 -0
  152. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/approve.js.map +1 -0
  153. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/index.d.ts +4 -0
  154. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/index.d.ts.map +1 -0
  155. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/index.js +20 -0
  156. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/index.js.map +1 -0
  157. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/reject.d.ts +8 -0
  158. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/reject.d.ts.map +1 -0
  159. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/reject.js +20 -0
  160. package/dist/functions/PaymentStreams/paymentStreamChangeProposal/reject.js.map +1 -0
  161. package/dist/functions/PaymentStreams/paymentStreamFactory/createPaymentStreamProposal.d.ts +10 -0
  162. package/dist/functions/PaymentStreams/paymentStreamFactory/createPaymentStreamProposal.d.ts.map +1 -0
  163. package/dist/functions/PaymentStreams/paymentStreamFactory/createPaymentStreamProposal.js +22 -0
  164. package/dist/functions/PaymentStreams/paymentStreamFactory/createPaymentStreamProposal.js.map +1 -0
  165. package/dist/functions/PaymentStreams/paymentStreamFactory/index.d.ts +2 -0
  166. package/dist/functions/PaymentStreams/paymentStreamFactory/index.d.ts.map +1 -0
  167. package/dist/functions/PaymentStreams/paymentStreamFactory/index.js +18 -0
  168. package/dist/functions/PaymentStreams/paymentStreamFactory/index.js.map +1 -0
  169. package/dist/functions/PaymentStreams/proposedPaymentStream/approve.d.ts +7 -0
  170. package/dist/functions/PaymentStreams/proposedPaymentStream/approve.d.ts.map +1 -0
  171. package/dist/functions/PaymentStreams/proposedPaymentStream/approve.js +19 -0
  172. package/dist/functions/PaymentStreams/proposedPaymentStream/approve.js.map +1 -0
  173. package/dist/functions/PaymentStreams/proposedPaymentStream/changeParty.d.ts +10 -0
  174. package/dist/functions/PaymentStreams/proposedPaymentStream/changeParty.d.ts.map +1 -0
  175. package/dist/functions/PaymentStreams/proposedPaymentStream/changeParty.js +20 -0
  176. package/dist/functions/PaymentStreams/proposedPaymentStream/changeParty.js.map +1 -0
  177. package/dist/functions/PaymentStreams/proposedPaymentStream/editPaymentStreamProposal.d.ts +27 -0
  178. package/dist/functions/PaymentStreams/proposedPaymentStream/editPaymentStreamProposal.d.ts.map +1 -0
  179. package/dist/functions/PaymentStreams/proposedPaymentStream/editPaymentStreamProposal.js +75 -0
  180. package/dist/functions/PaymentStreams/proposedPaymentStream/editPaymentStreamProposal.js.map +1 -0
  181. package/dist/functions/PaymentStreams/proposedPaymentStream/index.d.ts +6 -0
  182. package/dist/functions/PaymentStreams/proposedPaymentStream/index.d.ts.map +1 -0
  183. package/dist/functions/PaymentStreams/proposedPaymentStream/index.js +22 -0
  184. package/dist/functions/PaymentStreams/proposedPaymentStream/index.js.map +1 -0
  185. package/dist/functions/PaymentStreams/proposedPaymentStream/startPaymentStream.d.ts +8 -0
  186. package/dist/functions/PaymentStreams/proposedPaymentStream/startPaymentStream.d.ts.map +1 -0
  187. package/dist/functions/PaymentStreams/proposedPaymentStream/startPaymentStream.js +28 -0
  188. package/dist/functions/PaymentStreams/proposedPaymentStream/startPaymentStream.js.map +1 -0
  189. package/dist/functions/PaymentStreams/proposedPaymentStream/withdraw.d.ts +8 -0
  190. package/dist/functions/PaymentStreams/proposedPaymentStream/withdraw.d.ts.map +1 -0
  191. package/dist/functions/PaymentStreams/proposedPaymentStream/withdraw.js +20 -0
  192. package/dist/functions/PaymentStreams/proposedPaymentStream/withdraw.js.map +1 -0
  193. package/dist/functions/PaymentStreams/types/activePaymentStream.d.ts +64 -0
  194. package/dist/functions/PaymentStreams/types/activePaymentStream.d.ts.map +1 -0
  195. package/dist/functions/PaymentStreams/types/activePaymentStream.js +52 -0
  196. package/dist/functions/PaymentStreams/types/activePaymentStream.js.map +1 -0
  197. package/dist/functions/PaymentStreams/types/index.d.ts +6 -0
  198. package/dist/functions/PaymentStreams/types/index.d.ts.map +1 -0
  199. package/dist/functions/PaymentStreams/types/index.js +22 -0
  200. package/dist/functions/PaymentStreams/types/index.js.map +1 -0
  201. package/dist/functions/PaymentStreams/types/lockFundsInput.d.ts +8 -0
  202. package/dist/functions/PaymentStreams/types/lockFundsInput.d.ts.map +1 -0
  203. package/dist/functions/PaymentStreams/types/lockFundsInput.js +3 -0
  204. package/dist/functions/PaymentStreams/types/lockFundsInput.js.map +1 -0
  205. package/dist/functions/PaymentStreams/types/partyRole.d.ts +3 -0
  206. package/dist/functions/PaymentStreams/types/partyRole.d.ts.map +1 -0
  207. package/dist/functions/PaymentStreams/types/partyRole.js +3 -0
  208. package/dist/functions/PaymentStreams/types/partyRole.js.map +1 -0
  209. package/dist/functions/PaymentStreams/types/paymentStreamProposalInput.d.ts +37 -0
  210. package/dist/functions/PaymentStreams/types/paymentStreamProposalInput.d.ts.map +1 -0
  211. package/dist/functions/PaymentStreams/types/paymentStreamProposalInput.js +4 -0
  212. package/dist/functions/PaymentStreams/types/paymentStreamProposalInput.js.map +1 -0
  213. package/dist/functions/PaymentStreams/types/proposedPaymentStream.d.ts +81 -0
  214. package/dist/functions/PaymentStreams/types/proposedPaymentStream.d.ts.map +1 -0
  215. package/dist/functions/PaymentStreams/types/proposedPaymentStream.js +51 -0
  216. package/dist/functions/PaymentStreams/types/proposedPaymentStream.js.map +1 -0
  217. package/dist/functions/PaymentStreams/utils/disclosedContracts.d.ts +14 -0
  218. package/dist/functions/PaymentStreams/utils/disclosedContracts.d.ts.map +1 -0
  219. package/dist/functions/PaymentStreams/utils/disclosedContracts.js +53 -0
  220. package/dist/functions/PaymentStreams/utils/disclosedContracts.js.map +1 -0
  221. package/dist/functions/PaymentStreams/utils/factoryContractId.d.ts +17 -0
  222. package/dist/functions/PaymentStreams/utils/factoryContractId.d.ts.map +1 -0
  223. package/dist/functions/PaymentStreams/utils/factoryContractId.js +27 -0
  224. package/dist/functions/PaymentStreams/utils/factoryContractId.js.map +1 -0
  225. package/dist/functions/PaymentStreams/utils/index.d.ts +4 -0
  226. package/dist/functions/PaymentStreams/utils/index.d.ts.map +1 -0
  227. package/dist/functions/PaymentStreams/utils/index.js +20 -0
  228. package/dist/functions/PaymentStreams/utils/index.js.map +1 -0
  229. package/dist/functions/PaymentStreams/utils/paymentContext.d.ts +61 -0
  230. package/dist/functions/PaymentStreams/utils/paymentContext.d.ts.map +1 -0
  231. package/dist/functions/PaymentStreams/utils/paymentContext.js +209 -0
  232. package/dist/functions/PaymentStreams/utils/paymentContext.js.map +1 -0
  233. package/dist/functions/PaymentStreams/utils/paymentStreamDamlCodec.d.ts +75 -0
  234. package/dist/functions/PaymentStreams/utils/paymentStreamDamlCodec.d.ts.map +1 -0
  235. package/dist/functions/PaymentStreams/utils/paymentStreamDamlCodec.js +81 -0
  236. package/dist/functions/PaymentStreams/utils/paymentStreamDamlCodec.js.map +1 -0
  237. package/dist/index.d.ts +5 -0
  238. package/dist/index.d.ts.map +1 -1
  239. package/dist/index.js +8 -0
  240. package/dist/index.js.map +1 -1
  241. package/package.json +20 -20
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Utility functions for waiting until coupon minting is allowed based on TPS rate limits.
3
+ *
4
+ * These utilities provide "fire and forget" style minting with automatic rate limit handling.
5
+ */
6
+ import { type CanMintResult, type CouponMinterPayload } from './canMintCouponsNow';
7
+ /**
8
+ * Options for waiting until minting is allowed.
9
+ */
10
+ export interface WaitUntilCanMintOptions {
11
+ /**
12
+ * Maximum time to wait in milliseconds before giving up.
13
+ * @default 300000 (5 minutes)
14
+ */
15
+ maxWaitMs?: number;
16
+ /**
17
+ * Minimum polling interval in milliseconds when rate limited.
18
+ * The actual wait will use the calculated waitMs from canMintCouponsNow,
19
+ * but this sets a minimum interval between checks.
20
+ * @default 100
21
+ */
22
+ minPollIntervalMs?: number;
23
+ /**
24
+ * Signal to abort the wait operation.
25
+ * If the signal is aborted, the promise will reject with an AbortError.
26
+ */
27
+ signal?: AbortSignal;
28
+ /**
29
+ * Optional callback invoked when waiting starts, providing the estimated wait time.
30
+ * Useful for logging or updating UI.
31
+ */
32
+ onWaitStart?: (waitMs: number) => void;
33
+ }
34
+ /**
35
+ * Error thrown when the wait operation is aborted.
36
+ */
37
+ export declare class WaitAbortedError extends Error {
38
+ constructor(message?: string);
39
+ }
40
+ /**
41
+ * Error thrown when the maximum wait time is exceeded.
42
+ */
43
+ export declare class WaitTimeoutError extends Error {
44
+ constructor(maxWaitMs: number);
45
+ }
46
+ /**
47
+ * Waits until coupon minting is allowed based on the current rate limit state.
48
+ *
49
+ * This function will sleep until the rate limit allows minting, checking periodically
50
+ * until either minting is allowed or the maximum wait time is exceeded.
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * // Wait until we can mint, then proceed
55
+ * await waitUntilCanMint(couponMinterPayload);
56
+ * await mintCoupons(...);
57
+ * ```
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * // Wait with a timeout and abort support
62
+ * const controller = new AbortController();
63
+ * setTimeout(() => controller.abort(), 10000); // 10 second timeout
64
+ *
65
+ * try {
66
+ * await waitUntilCanMint(couponMinterPayload, {
67
+ * maxWaitMs: 30000,
68
+ * signal: controller.signal,
69
+ * onWaitStart: (ms) => console.log(`Waiting ${ms}ms for rate limit...`),
70
+ * });
71
+ * await mintCoupons(...);
72
+ * } catch (error) {
73
+ * if (error instanceof WaitAbortedError) {
74
+ * console.log('Wait was cancelled');
75
+ * }
76
+ * }
77
+ * ```
78
+ *
79
+ * @param payload - The CouponMinter contract payload with rate limit state
80
+ * @param options - Optional configuration for the wait operation
81
+ * @returns Promise that resolves when minting is allowed
82
+ * @throws WaitAbortedError if the operation is aborted via the signal
83
+ * @throws WaitTimeoutError if the maximum wait time is exceeded
84
+ */
85
+ export declare function waitUntilCanMint(payload: CouponMinterPayload, options?: WaitUntilCanMintOptions): Promise<void>;
86
+ /**
87
+ * Result of a mintWithRateLimit operation.
88
+ */
89
+ export interface MintWithRateLimitResult<T> {
90
+ /** Whether we had to wait due to rate limiting */
91
+ wasRateLimited: boolean;
92
+ /** How long we waited in milliseconds (0 if not rate limited) */
93
+ waitedMs: number;
94
+ /** The result from the mint function */
95
+ result: T;
96
+ }
97
+ /**
98
+ * Options for mintWithRateLimit operation.
99
+ */
100
+ export interface MintWithRateLimitOptions extends WaitUntilCanMintOptions {
101
+ /**
102
+ * Callback invoked just before the mint function is called.
103
+ * Useful for logging or updating UI.
104
+ */
105
+ onBeforeMint?: () => void;
106
+ }
107
+ /**
108
+ * Waits until minting is allowed, then executes the provided mint function.
109
+ *
110
+ * This is a "fire and forget" style wrapper that handles rate limiting automatically.
111
+ * It waits for the rate limit to allow minting, then executes your mint function.
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * // Simple usage with async mint function
116
+ * const { result, wasRateLimited, waitedMs } = await mintWithRateLimit(
117
+ * couponMinterPayload,
118
+ * async () => {
119
+ * return await ledgerClient.exerciseChoice(
120
+ * couponMinterCid,
121
+ * 'MintCoupons',
122
+ * mintParams
123
+ * );
124
+ * }
125
+ * );
126
+ * console.log(`Minting complete. Rate limited: ${wasRateLimited}, waited: ${waitedMs}ms`);
127
+ * ```
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * // With callbacks for progress tracking
132
+ * const { result } = await mintWithRateLimit(
133
+ * couponMinterPayload,
134
+ * async () => mintCoupons(params),
135
+ * {
136
+ * onWaitStart: (ms) => console.log(`Rate limited, waiting ${ms}ms...`),
137
+ * onBeforeMint: () => console.log('Submitting mint transaction...'),
138
+ * maxWaitMs: 60000,
139
+ * }
140
+ * );
141
+ * ```
142
+ *
143
+ * @param payload - The CouponMinter contract payload with rate limit state
144
+ * @param mintFn - The async function to execute once minting is allowed
145
+ * @param options - Optional configuration for the wait and mint operation
146
+ * @returns Promise resolving to the mint result along with rate limit metadata
147
+ * @throws WaitAbortedError if the operation is aborted via the signal
148
+ * @throws WaitTimeoutError if the maximum wait time is exceeded
149
+ * @throws Any error thrown by the mintFn
150
+ */
151
+ export declare function mintWithRateLimit<T>(payload: CouponMinterPayload, mintFn: () => Promise<T>, options?: MintWithRateLimitOptions): Promise<MintWithRateLimitResult<T>>;
152
+ /**
153
+ * Checks the current rate limit status and returns detailed information.
154
+ *
155
+ * This is a convenience wrapper around canMintCouponsNow that provides
156
+ * additional context useful for UI display or logging.
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * const status = getRateLimitStatus(couponMinterPayload);
161
+ * if (status.canMint) {
162
+ * console.log('Ready to mint!');
163
+ * } else {
164
+ * console.log(`Rate limited. Can mint in ${status.waitMs}ms (${status.waitSeconds.toFixed(1)}s)`);
165
+ * }
166
+ * ```
167
+ *
168
+ * @param payload - The CouponMinter contract payload
169
+ * @param now - Optional current time for testing
170
+ * @returns Detailed rate limit status information
171
+ */
172
+ export declare function getRateLimitStatus(payload: CouponMinterPayload, now?: Date): CanMintResult & {
173
+ waitSeconds?: number;
174
+ isRateLimitEnabled: boolean;
175
+ };
176
+ //# sourceMappingURL=waitUntilCanMint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waitUntilCanMint.d.ts","sourceRoot":"","sources":["../../../src/functions/CouponMinter/waitUntilCanMint.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAQ7B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,SAA+B;CAInD;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,SAAS,EAAE,MAAM;CAM9B;AAyCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,IAAI,CAAC,CAyCf;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,kDAAkD;IAClD,cAAc,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,MAAM,EAAE,CAAC,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,uBAAuB;IACvE;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACxB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAyBrC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,mBAAmB,EAC5B,GAAG,CAAC,EAAE,IAAI,GACT,aAAa,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,OAAO,CAAA;CAAE,CAgBvE"}
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ /**
3
+ * Utility functions for waiting until coupon minting is allowed based on TPS rate limits.
4
+ *
5
+ * These utilities provide "fire and forget" style minting with automatic rate limit handling.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.WaitTimeoutError = exports.WaitAbortedError = void 0;
9
+ exports.waitUntilCanMint = waitUntilCanMint;
10
+ exports.mintWithRateLimit = mintWithRateLimit;
11
+ exports.getRateLimitStatus = getRateLimitStatus;
12
+ const canMintCouponsNow_1 = require("./canMintCouponsNow");
13
+ /** Default polling interval when waiting for mint readiness (in milliseconds) */
14
+ const DEFAULT_POLL_INTERVAL_MS = 100;
15
+ /** Maximum wait time to prevent infinite waiting (5 minutes) */
16
+ const DEFAULT_MAX_WAIT_MS = 5 * 60 * 1000;
17
+ /**
18
+ * Error thrown when the wait operation is aborted.
19
+ */
20
+ class WaitAbortedError extends Error {
21
+ constructor(message = 'Wait operation was aborted') {
22
+ super(message);
23
+ this.name = 'WaitAbortedError';
24
+ }
25
+ }
26
+ exports.WaitAbortedError = WaitAbortedError;
27
+ /**
28
+ * Error thrown when the maximum wait time is exceeded.
29
+ */
30
+ class WaitTimeoutError extends Error {
31
+ constructor(maxWaitMs) {
32
+ super(`Maximum wait time of ${maxWaitMs}ms exceeded while waiting for rate limit`);
33
+ this.name = 'WaitTimeoutError';
34
+ }
35
+ }
36
+ exports.WaitTimeoutError = WaitTimeoutError;
37
+ /**
38
+ * Sleeps for the specified duration, respecting abort signals.
39
+ *
40
+ * @param ms - Duration to sleep in milliseconds
41
+ * @param signal - Optional abort signal
42
+ * @returns Promise that resolves after the sleep duration
43
+ * @throws WaitAbortedError if the signal is aborted during sleep
44
+ */
45
+ async function sleep(ms, signal) {
46
+ if (signal?.aborted) {
47
+ throw new WaitAbortedError();
48
+ }
49
+ return new Promise((resolve, reject) => {
50
+ let timeoutId;
51
+ const cleanup = () => {
52
+ if (signal) {
53
+ signal.removeEventListener('abort', onAbort);
54
+ }
55
+ };
56
+ const onAbort = () => {
57
+ clearTimeout(timeoutId);
58
+ cleanup();
59
+ reject(new WaitAbortedError());
60
+ };
61
+ timeoutId = setTimeout(() => {
62
+ cleanup();
63
+ resolve();
64
+ }, ms);
65
+ if (signal) {
66
+ signal.addEventListener('abort', onAbort, { once: true });
67
+ }
68
+ });
69
+ }
70
+ /**
71
+ * Waits until coupon minting is allowed based on the current rate limit state.
72
+ *
73
+ * This function will sleep until the rate limit allows minting, checking periodically
74
+ * until either minting is allowed or the maximum wait time is exceeded.
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * // Wait until we can mint, then proceed
79
+ * await waitUntilCanMint(couponMinterPayload);
80
+ * await mintCoupons(...);
81
+ * ```
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * // Wait with a timeout and abort support
86
+ * const controller = new AbortController();
87
+ * setTimeout(() => controller.abort(), 10000); // 10 second timeout
88
+ *
89
+ * try {
90
+ * await waitUntilCanMint(couponMinterPayload, {
91
+ * maxWaitMs: 30000,
92
+ * signal: controller.signal,
93
+ * onWaitStart: (ms) => console.log(`Waiting ${ms}ms for rate limit...`),
94
+ * });
95
+ * await mintCoupons(...);
96
+ * } catch (error) {
97
+ * if (error instanceof WaitAbortedError) {
98
+ * console.log('Wait was cancelled');
99
+ * }
100
+ * }
101
+ * ```
102
+ *
103
+ * @param payload - The CouponMinter contract payload with rate limit state
104
+ * @param options - Optional configuration for the wait operation
105
+ * @returns Promise that resolves when minting is allowed
106
+ * @throws WaitAbortedError if the operation is aborted via the signal
107
+ * @throws WaitTimeoutError if the maximum wait time is exceeded
108
+ */
109
+ async function waitUntilCanMint(payload, options) {
110
+ const { maxWaitMs = DEFAULT_MAX_WAIT_MS, minPollIntervalMs = DEFAULT_POLL_INTERVAL_MS, signal, onWaitStart, } = options ?? {};
111
+ if (signal?.aborted) {
112
+ throw new WaitAbortedError();
113
+ }
114
+ const startTime = Date.now();
115
+ // Initial check
116
+ let result = (0, canMintCouponsNow_1.canMintCouponsNow)(payload);
117
+ while (!result.canMint) {
118
+ const elapsed = Date.now() - startTime;
119
+ // Check if we've exceeded max wait time
120
+ if (elapsed >= maxWaitMs) {
121
+ throw new WaitTimeoutError(maxWaitMs);
122
+ }
123
+ // Calculate wait time (use the larger of waitMs and minPollIntervalMs)
124
+ const waitMs = Math.max(result.waitMs, minPollIntervalMs);
125
+ // Don't wait longer than remaining max wait time
126
+ const remainingTime = maxWaitMs - elapsed;
127
+ const actualWaitMs = Math.min(waitMs, remainingTime);
128
+ // Notify callback if provided
129
+ onWaitStart?.(actualWaitMs);
130
+ // Sleep for the calculated duration
131
+ await sleep(actualWaitMs, signal);
132
+ // Re-check with current time
133
+ result = (0, canMintCouponsNow_1.canMintCouponsNow)(payload);
134
+ }
135
+ }
136
+ /**
137
+ * Waits until minting is allowed, then executes the provided mint function.
138
+ *
139
+ * This is a "fire and forget" style wrapper that handles rate limiting automatically.
140
+ * It waits for the rate limit to allow minting, then executes your mint function.
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * // Simple usage with async mint function
145
+ * const { result, wasRateLimited, waitedMs } = await mintWithRateLimit(
146
+ * couponMinterPayload,
147
+ * async () => {
148
+ * return await ledgerClient.exerciseChoice(
149
+ * couponMinterCid,
150
+ * 'MintCoupons',
151
+ * mintParams
152
+ * );
153
+ * }
154
+ * );
155
+ * console.log(`Minting complete. Rate limited: ${wasRateLimited}, waited: ${waitedMs}ms`);
156
+ * ```
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * // With callbacks for progress tracking
161
+ * const { result } = await mintWithRateLimit(
162
+ * couponMinterPayload,
163
+ * async () => mintCoupons(params),
164
+ * {
165
+ * onWaitStart: (ms) => console.log(`Rate limited, waiting ${ms}ms...`),
166
+ * onBeforeMint: () => console.log('Submitting mint transaction...'),
167
+ * maxWaitMs: 60000,
168
+ * }
169
+ * );
170
+ * ```
171
+ *
172
+ * @param payload - The CouponMinter contract payload with rate limit state
173
+ * @param mintFn - The async function to execute once minting is allowed
174
+ * @param options - Optional configuration for the wait and mint operation
175
+ * @returns Promise resolving to the mint result along with rate limit metadata
176
+ * @throws WaitAbortedError if the operation is aborted via the signal
177
+ * @throws WaitTimeoutError if the maximum wait time is exceeded
178
+ * @throws Any error thrown by the mintFn
179
+ */
180
+ async function mintWithRateLimit(payload, mintFn, options) {
181
+ const startTime = Date.now();
182
+ // Check initial rate limit status
183
+ const initialCheck = (0, canMintCouponsNow_1.canMintCouponsNow)(payload);
184
+ const wasRateLimited = !initialCheck.canMint;
185
+ // Wait if necessary
186
+ if (wasRateLimited) {
187
+ await waitUntilCanMint(payload, options);
188
+ }
189
+ const waitedMs = Date.now() - startTime;
190
+ // Notify before mint callback
191
+ options?.onBeforeMint?.();
192
+ // Execute the mint function
193
+ const result = await mintFn();
194
+ return {
195
+ wasRateLimited,
196
+ waitedMs,
197
+ result,
198
+ };
199
+ }
200
+ /**
201
+ * Checks the current rate limit status and returns detailed information.
202
+ *
203
+ * This is a convenience wrapper around canMintCouponsNow that provides
204
+ * additional context useful for UI display or logging.
205
+ *
206
+ * @example
207
+ * ```typescript
208
+ * const status = getRateLimitStatus(couponMinterPayload);
209
+ * if (status.canMint) {
210
+ * console.log('Ready to mint!');
211
+ * } else {
212
+ * console.log(`Rate limited. Can mint in ${status.waitMs}ms (${status.waitSeconds.toFixed(1)}s)`);
213
+ * }
214
+ * ```
215
+ *
216
+ * @param payload - The CouponMinter contract payload
217
+ * @param now - Optional current time for testing
218
+ * @returns Detailed rate limit status information
219
+ */
220
+ function getRateLimitStatus(payload, now) {
221
+ const result = (0, canMintCouponsNow_1.canMintCouponsNow)(payload, now);
222
+ const isRateLimitEnabled = payload.maxTps != null;
223
+ if (result.canMint) {
224
+ return {
225
+ ...result,
226
+ isRateLimitEnabled,
227
+ };
228
+ }
229
+ return {
230
+ ...result,
231
+ waitSeconds: result.waitMs / 1000,
232
+ isRateLimitEnabled,
233
+ };
234
+ }
235
+ //# sourceMappingURL=waitUntilCanMint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waitUntilCanMint.js","sourceRoot":"","sources":["../../../src/functions/CouponMinter/waitUntilCanMint.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,10 @@
1
+ import type { CommandWithDisclosedContracts } from '@open-captable-protocol/canton';
2
+ import type { LockFundsInput } from '../types/lockFundsInput';
3
+ export interface AddFundsParams {
4
+ paymentStreamContractId: string;
5
+ actor: string;
6
+ lockFundsInput: LockFundsInput;
7
+ description?: string;
8
+ }
9
+ export declare function buildAddFundsCommand(params: AddFundsParams): CommandWithDisclosedContracts;
10
+ //# sourceMappingURL=addFunds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addFunds.d.ts","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/activePaymentStream/addFunds.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC7B,uBAAuB,EAAE,MAAM,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,GACrB,6BAA6B,CA4B/B"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildAddFundsCommand = buildAddFundsCommand;
4
+ const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
5
+ function buildAddFundsCommand(params) {
6
+ const choiceArguments = {
7
+ actor: params.actor,
8
+ lockFundsInput: {
9
+ amuletInputs: params.lockFundsInput.amuletInputs,
10
+ amountToLock: params.lockFundsInput.amountToLock,
11
+ paymentContext: {
12
+ amuletRulesCid: params.lockFundsInput.paymentContext.amuletRulesCid,
13
+ openMiningRoundCid: params.lockFundsInput.paymentContext.openMiningRoundCid,
14
+ featuredAppRight: params.lockFundsInput.paymentContext.featuredAppRight,
15
+ },
16
+ },
17
+ description: params.description ?? null,
18
+ };
19
+ const command = {
20
+ ExerciseCommand: {
21
+ templateId: open_captable_protocol_daml_js_1.CantonPayments.PaymentStream.ActivePaymentStream.ActivePaymentStream
22
+ .templateId,
23
+ contractId: params.paymentStreamContractId,
24
+ choice: 'ActivePaymentStream_AddFunds',
25
+ choiceArgument: choiceArguments,
26
+ },
27
+ };
28
+ return { command, disclosedContracts: [] };
29
+ }
30
+ //# sourceMappingURL=addFunds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addFunds.js","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/activePaymentStream/addFunds.ts"],"names":[],"mappings":";;AAYA,oDA8BC;AAzCD,6FAA0E;AAW1E,SAAgB,oBAAoB,CAClC,MAAsB;IAEtB,MAAM,eAAe,GAAG;QACtB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,cAAc,EAAE;YACd,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,YAAY;YAChD,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,YAAY;YAChD,cAAc,EAAE;gBACd,cAAc,EAAE,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,cAAc;gBACnE,kBAAkB,EAChB,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,kBAAkB;gBACzD,gBAAgB,EAAE,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,gBAAgB;aACxE;SACF;QACD,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,IAAI;KACxC,CAAC;IAEF,MAAM,OAAO,GAAY;QACvB,eAAe,EAAE;YACf,UAAU,EACR,+CAAc,CAAC,aAAa,CAAC,mBAAmB,CAAC,mBAAmB;iBACjE,UAAU;YACf,UAAU,EAAE,MAAM,CAAC,uBAAuB;YAC1C,MAAM,EAAE,8BAA8B;YACtC,cAAc,EAAE,eAAe;SAChC;KACF,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { Command } from '@fairmint/canton-node-sdk/build/src/clients/ledger-json-api/schemas/api/commands';
2
+ export interface ArchiveInactivePaymentStreamParams {
3
+ paymentStreamContractId: string;
4
+ actor: string;
5
+ }
6
+ export declare function buildArchiveInactivePaymentStreamCommand(params: ArchiveInactivePaymentStreamParams): Command;
7
+ //# sourceMappingURL=archiveInactivePaymentStream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archiveInactivePaymentStream.d.ts","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/activePaymentStream/archiveInactivePaymentStream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kFAAkF,CAAC;AAGhH,MAAM,WAAW,kCAAkC;IACjD,uBAAuB,EAAE,MAAM,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,wCAAwC,CACtD,MAAM,EAAE,kCAAkC,GACzC,OAAO,CAaT"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildArchiveInactivePaymentStreamCommand = buildArchiveInactivePaymentStreamCommand;
4
+ const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
5
+ function buildArchiveInactivePaymentStreamCommand(params) {
6
+ return {
7
+ ExerciseCommand: {
8
+ templateId: open_captable_protocol_daml_js_1.CantonPayments.PaymentStream.ActivePaymentStream.ActivePaymentStream
9
+ .templateId,
10
+ contractId: params.paymentStreamContractId,
11
+ choice: 'ActivePaymentStream_ArchiveInactivePaymentStream',
12
+ choiceArgument: {
13
+ actor: params.actor,
14
+ },
15
+ },
16
+ };
17
+ }
18
+ //# sourceMappingURL=archiveInactivePaymentStream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archiveInactivePaymentStream.js","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/activePaymentStream/archiveInactivePaymentStream.ts"],"names":[],"mappings":";;AAQA,4FAeC;AAtBD,6FAA0E;AAO1E,SAAgB,wCAAwC,CACtD,MAA0C;IAE1C,OAAO;QACL,eAAe,EAAE;YACf,UAAU,EACR,+CAAc,CAAC,aAAa,CAAC,mBAAmB,CAAC,mBAAmB;iBACjE,UAAU;YACf,UAAU,EAAE,MAAM,CAAC,uBAAuB;YAC1C,MAAM,EAAE,kDAAkD;YAC1D,cAAc,EAAE;gBACd,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Command } from '@fairmint/canton-node-sdk/build/src/clients/ledger-json-api/schemas/api/commands';
2
+ export interface CancelPaymentStreamParams {
3
+ paymentStreamContractId: string;
4
+ actor: string;
5
+ disregardAvailablePaidPeriod?: boolean;
6
+ description?: string;
7
+ openMiningRoundCid?: string;
8
+ }
9
+ export declare function buildCancelPaymentStreamCommand(params: CancelPaymentStreamParams): Command;
10
+ //# sourceMappingURL=cancel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/activePaymentStream/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kFAAkF,CAAC;AAGhH,MAAM,WAAW,yBAAyB;IACxC,uBAAuB,EAAE,MAAM,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAkBT"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildCancelPaymentStreamCommand = buildCancelPaymentStreamCommand;
4
+ const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
5
+ function buildCancelPaymentStreamCommand(params) {
6
+ const choiceArgument = {
7
+ actor: params.actor,
8
+ disregardAvailablePaidPeriod: params.disregardAvailablePaidPeriod ?? false,
9
+ description: params.description ?? null,
10
+ openMiningRoundCid: params.openMiningRoundCid ?? null,
11
+ };
12
+ return {
13
+ ExerciseCommand: {
14
+ templateId: open_captable_protocol_daml_js_1.CantonPayments.PaymentStream.ActivePaymentStream.ActivePaymentStream
15
+ .templateId,
16
+ contractId: params.paymentStreamContractId,
17
+ choice: 'ActivePaymentStream_Cancel',
18
+ choiceArgument,
19
+ },
20
+ };
21
+ }
22
+ //# sourceMappingURL=cancel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/activePaymentStream/cancel.ts"],"names":[],"mappings":";;AAWA,0EAoBC;AA9BD,6FAA0E;AAU1E,SAAgB,+BAA+B,CAC7C,MAAiC;IAEjC,MAAM,cAAc,GAAG;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,4BAA4B,EAAE,MAAM,CAAC,4BAA4B,IAAI,KAAK;QAC1E,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,IAAI;QACvC,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,IAAI,IAAI;KACtD,CAAC;IAEF,OAAO;QACL,eAAe,EAAE;YACf,UAAU,EACR,+CAAc,CAAC,aAAa,CAAC,mBAAmB,CAAC,mBAAmB;iBACjE,UAAU;YACf,UAAU,EAAE,MAAM,CAAC,uBAAuB;YAC1C,MAAM,EAAE,4BAA4B;YACpC,cAAc;SACf;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Command } from '@fairmint/canton-node-sdk/build/src/clients/ledger-json-api/schemas/api/commands';
2
+ import type { PartyRole } from '../types/partyRole';
3
+ export interface ActivePaymentStreamChangePartyParams {
4
+ paymentStreamContractId: string;
5
+ partyType: PartyRole;
6
+ oldParty: string;
7
+ newParty: string;
8
+ }
9
+ export declare function buildActivePaymentStreamChangePartyCommand(params: ActivePaymentStreamChangePartyParams): Command;
10
+ //# sourceMappingURL=changeParty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changeParty.d.ts","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/activePaymentStream/changeParty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kFAAkF,CAAC;AAEhH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,WAAW,oCAAoC;IACnD,uBAAuB,EAAE,MAAM,CAAC;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,0CAA0C,CACxD,MAAM,EAAE,oCAAoC,GAC3C,OAAO,CAeT"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildActivePaymentStreamChangePartyCommand = buildActivePaymentStreamChangePartyCommand;
4
+ const open_captable_protocol_daml_js_1 = require("@fairmint/open-captable-protocol-daml-js");
5
+ function buildActivePaymentStreamChangePartyCommand(params) {
6
+ return {
7
+ ExerciseCommand: {
8
+ templateId: open_captable_protocol_daml_js_1.CantonPayments.PaymentStream.ActivePaymentStream.ActivePaymentStream
9
+ .templateId,
10
+ contractId: params.paymentStreamContractId,
11
+ choice: 'ActivePaymentStream_ChangeParty',
12
+ choiceArgument: {
13
+ partyType: params.partyType,
14
+ oldParty: params.oldParty,
15
+ newParty: params.newParty,
16
+ },
17
+ },
18
+ };
19
+ }
20
+ //# sourceMappingURL=changeParty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changeParty.js","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/activePaymentStream/changeParty.ts"],"names":[],"mappings":";;AAWA,gGAiBC;AA3BD,6FAA0E;AAU1E,SAAgB,0CAA0C,CACxD,MAA4C;IAE5C,OAAO;QACL,eAAe,EAAE;YACf,UAAU,EACR,+CAAc,CAAC,aAAa,CAAC,mBAAmB,CAAC,mBAAmB;iBACjE,UAAU;YACf,UAAU,EAAE,MAAM,CAAC,uBAAuB;YAC1C,MAAM,EAAE,iCAAiC;YACzC,cAAc,EAAE;gBACd,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ export * from './archiveInactivePaymentStream';
2
+ export * from './cancel';
3
+ export * from './proposeChanges';
4
+ export { buildProcessFreeTrialCommand } from './processFreeTrial';
5
+ export type { ProcessFreeTrialParams } from './processFreeTrial';
6
+ export { buildProcessPaymentCommand } from './processPayment';
7
+ export type { ProcessPaymentParams } from './processPayment';
8
+ export { buildActivePaymentStreamChangePartyCommand } from './changeParty';
9
+ export type { ActivePaymentStreamChangePartyParams } from './changeParty';
10
+ export type { PartyRole as ActivePaymentStreamPartyRole } from '../types/partyRole';
11
+ export { buildRefundPaymentStreamCommand } from './refund';
12
+ export type { RefundPaymentStreamParams } from './refund';
13
+ export { buildAddFundsCommand } from './addFunds';
14
+ export type { AddFundsParams } from './addFunds';
15
+ export { buildWithdrawFundsCommand } from './withdrawFunds';
16
+ export type { WithdrawFundsParams } from './withdrawFunds';
17
+ export { buildReplaceLockedAmuletCommand } from './replaceLockedAmulet';
18
+ export type { ReplaceLockedAmuletParams } from './replaceLockedAmulet';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/functions/PaymentStreams/activePaymentStream/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAAE,0CAA0C,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AAC1E,YAAY,EAAE,SAAS,IAAI,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAGpF,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAC3D,YAAY,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAG1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,YAAY,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC"}