@hyperscale0/hsx 1.0.0 → 1.0.123

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 (316) hide show
  1. package/CHANGELOG.md +5 -256
  2. package/LICENSE.md +356 -0
  3. package/NOTICE.md +8 -0
  4. package/README.md +44 -44
  5. package/bin/hsx.ts +0 -7
  6. package/dist/bin/hsx.d.ts +0 -4
  7. package/dist/bin/hsx.d.ts.map +1 -1
  8. package/dist/bin/hsx.js +0 -6
  9. package/dist/bin/hsx.js.map +1 -1
  10. package/dist/src/ast.d.ts +113 -308
  11. package/dist/src/ast.d.ts.map +1 -1
  12. package/dist/src/ast.js +7 -71
  13. package/dist/src/ast.js.map +1 -1
  14. package/dist/src/attachment-economics.d.ts +5 -0
  15. package/dist/src/attachment-economics.d.ts.map +1 -0
  16. package/dist/src/attachment-economics.js +55 -0
  17. package/dist/src/attachment-economics.js.map +1 -0
  18. package/dist/src/binding-contract.d.ts +22 -0
  19. package/dist/src/binding-contract.d.ts.map +1 -0
  20. package/dist/src/binding-contract.js +74 -0
  21. package/dist/src/binding-contract.js.map +1 -0
  22. package/dist/src/cli.d.ts +4 -19
  23. package/dist/src/cli.d.ts.map +1 -1
  24. package/dist/src/cli.js +89 -276
  25. package/dist/src/cli.js.map +1 -1
  26. package/dist/src/compile.d.ts +34 -66
  27. package/dist/src/compile.d.ts.map +1 -1
  28. package/dist/src/compile.js +2949 -117
  29. package/dist/src/compile.js.map +1 -1
  30. package/dist/src/cost.d.ts +8 -75
  31. package/dist/src/cost.d.ts.map +1 -1
  32. package/dist/src/cost.js +54 -364
  33. package/dist/src/cost.js.map +1 -1
  34. package/dist/src/diagnostics.d.ts +14 -9
  35. package/dist/src/diagnostics.d.ts.map +1 -1
  36. package/dist/src/diagnostics.js +39 -416
  37. package/dist/src/diagnostics.js.map +1 -1
  38. package/dist/src/examples-bundle.d.ts +3 -0
  39. package/dist/src/examples-bundle.d.ts.map +1 -0
  40. package/dist/src/examples-bundle.js +18 -0
  41. package/dist/src/examples-bundle.js.map +1 -0
  42. package/dist/src/examples.d.ts +10 -0
  43. package/dist/src/examples.d.ts.map +1 -0
  44. package/dist/src/examples.js +2 -0
  45. package/dist/src/examples.js.map +1 -0
  46. package/dist/src/format.d.ts +8 -7
  47. package/dist/src/format.d.ts.map +1 -1
  48. package/dist/src/format.js +9 -175
  49. package/dist/src/format.js.map +1 -1
  50. package/dist/src/header-source.d.ts +3 -0
  51. package/dist/src/header-source.d.ts.map +1 -0
  52. package/dist/src/header-source.js +41 -0
  53. package/dist/src/header-source.js.map +1 -0
  54. package/dist/src/headers.d.ts +64 -0
  55. package/dist/src/headers.d.ts.map +1 -0
  56. package/dist/src/headers.js +167 -0
  57. package/dist/src/headers.js.map +1 -0
  58. package/dist/src/index.d.ts +7 -11
  59. package/dist/src/index.d.ts.map +1 -1
  60. package/dist/src/index.js +4 -9
  61. package/dist/src/index.js.map +1 -1
  62. package/dist/src/keywords.d.ts +56 -0
  63. package/dist/src/keywords.d.ts.map +1 -0
  64. package/dist/src/keywords.js +133 -0
  65. package/dist/src/keywords.js.map +1 -0
  66. package/dist/src/language.d.ts +26 -0
  67. package/dist/src/language.d.ts.map +1 -0
  68. package/dist/src/language.js +440 -0
  69. package/dist/src/language.js.map +1 -0
  70. package/dist/src/lex.d.ts +13 -28
  71. package/dist/src/lex.d.ts.map +1 -1
  72. package/dist/src/lex.js +119 -145
  73. package/dist/src/lex.js.map +1 -1
  74. package/dist/src/parse.d.ts +4 -17
  75. package/dist/src/parse.d.ts.map +1 -1
  76. package/dist/src/parse.js +484 -1036
  77. package/dist/src/parse.js.map +1 -1
  78. package/dist/src/std-bundle.d.ts.map +1 -1
  79. package/dist/src/std-bundle.js +11 -84
  80. package/dist/src/std-bundle.js.map +1 -1
  81. package/dist/src/std-library.d.ts +1 -1
  82. package/dist/src/std-library.d.ts.map +1 -1
  83. package/dist/src/std-library.js +1 -5
  84. package/dist/src/std-library.js.map +1 -1
  85. package/dist/src/tunables.d.ts +7 -0
  86. package/dist/src/tunables.d.ts.map +1 -0
  87. package/dist/src/tunables.js +27 -0
  88. package/dist/src/tunables.js.map +1 -0
  89. package/docs/README.md +528 -26
  90. package/docs/assets/brand/hsx-horizontal-white.svg +1 -0
  91. package/docs/assets/brand/hsx-horizontal.svg +1 -0
  92. package/docs/assets/brand/hsx-stacked-white.svg +1 -0
  93. package/docs/assets/brand/hsx-stacked.svg +1 -0
  94. package/docs/assets/brand/manifest.json +30 -0
  95. package/docs/assets/hsx.svg +11 -0
  96. package/examples/cards.hsx +34 -0
  97. package/examples/collections.hsx +37 -0
  98. package/examples/cost-table.json +633 -385
  99. package/examples/escrow.hsx +24 -0
  100. package/examples/financing.hsx +32 -0
  101. package/examples/insurance.hsx +30 -0
  102. package/examples/lending.hsx +57 -0
  103. package/examples/library.hsx +15 -0
  104. package/examples/marketplace.hsx +32 -0
  105. package/examples/money.hsx +19 -0
  106. package/examples/rental-deposit.hsx +60 -0
  107. package/examples/repair-approval.hsx +44 -0
  108. package/examples/reporting.hsx +28 -0
  109. package/examples/savings.hsx +21 -0
  110. package/examples/serviced.hsx +25 -0
  111. package/examples/wallet.hsx +24 -0
  112. package/package.json +25 -23
  113. package/src/ast.ts +83 -440
  114. package/src/attachment-economics.ts +103 -0
  115. package/src/binding-contract.ts +104 -0
  116. package/src/cli.ts +95 -325
  117. package/src/compile.ts +4063 -209
  118. package/src/cost.ts +71 -574
  119. package/src/diagnostics.ts +57 -437
  120. package/src/examples-bundle.ts +19 -0
  121. package/src/examples.ts +9 -0
  122. package/src/format.ts +12 -256
  123. package/src/header-source.ts +54 -0
  124. package/src/headers.ts +195 -0
  125. package/src/index.ts +18 -33
  126. package/src/keywords.ts +134 -0
  127. package/src/language.ts +629 -0
  128. package/src/lex.ts +131 -192
  129. package/src/parse.ts +489 -1195
  130. package/src/std-bundle.ts +12 -88
  131. package/src/std-library.ts +2 -7
  132. package/src/tunables.ts +36 -0
  133. package/std/cards.hsx +85 -0
  134. package/std/collections.hsx +90 -0
  135. package/std/escrow.hsx +73 -0
  136. package/std/financing.hsx +683 -0
  137. package/std/insurance.hsx +89 -0
  138. package/std/lending.hsx +138 -0
  139. package/std/marketplace.hsx +123 -0
  140. package/std/money.hsx +173 -0
  141. package/std/reporting.hsx +753 -0
  142. package/std/savings.hsx +68 -0
  143. package/std/wallet.hsx +57 -0
  144. package/LICENSE +0 -661
  145. package/LICENSING.md +0 -52
  146. package/TRADEMARKS.md +0 -35
  147. package/dist/src/emit.d.ts +0 -34
  148. package/dist/src/emit.d.ts.map +0 -1
  149. package/dist/src/emit.js +0 -137
  150. package/dist/src/emit.js.map +0 -1
  151. package/dist/src/entry-overrides.d.ts +0 -58
  152. package/dist/src/entry-overrides.d.ts.map +0 -1
  153. package/dist/src/entry-overrides.js +0 -284
  154. package/dist/src/entry-overrides.js.map +0 -1
  155. package/dist/src/ir.d.ts +0 -66
  156. package/dist/src/ir.d.ts.map +0 -1
  157. package/dist/src/ir.js +0 -15
  158. package/dist/src/ir.js.map +0 -1
  159. package/dist/src/limits.d.ts +0 -21
  160. package/dist/src/limits.d.ts.map +0 -1
  161. package/dist/src/limits.js +0 -21
  162. package/dist/src/limits.js.map +0 -1
  163. package/dist/src/lsp/server.d.ts +0 -32
  164. package/dist/src/lsp/server.d.ts.map +0 -1
  165. package/dist/src/lsp/server.js +0 -391
  166. package/dist/src/lsp/server.js.map +0 -1
  167. package/dist/src/modules.d.ts +0 -38
  168. package/dist/src/modules.d.ts.map +0 -1
  169. package/dist/src/modules.js +0 -368
  170. package/dist/src/modules.js.map +0 -1
  171. package/dist/src/typecheck.d.ts +0 -8
  172. package/dist/src/typecheck.d.ts.map +0 -1
  173. package/dist/src/typecheck.js +0 -2958
  174. package/dist/src/typecheck.js.map +0 -1
  175. package/dist/src/version.d.ts +0 -5
  176. package/dist/src/version.d.ts.map +0 -1
  177. package/dist/src/version.js +0 -5
  178. package/dist/src/version.js.map +0 -1
  179. package/docs/guide/01-first-program.md +0 -24
  180. package/docs/guide/02-money.md +0 -25
  181. package/docs/guide/03-instruments.md +0 -22
  182. package/docs/guide/04-lifecycles.md +0 -25
  183. package/docs/guide/05-fees-and-splits.md +0 -45
  184. package/docs/guide/06-schedules.md +0 -22
  185. package/docs/guide/07-composition.md +0 -46
  186. package/docs/guide/08-writing-a-module.md +0 -26
  187. package/docs/guide/09-cost.md +0 -24
  188. package/docs/guide/10-diagnostics.md +0 -27
  189. package/docs/llms-full.txt +0 -1739
  190. package/docs/llms.txt +0 -45
  191. package/docs/playground.md +0 -54
  192. package/docs/reference/cli.md +0 -35
  193. package/docs/reference/diagnostics.md +0 -619
  194. package/docs/reference/grammar.md +0 -39
  195. package/docs/reference/std/advance.md +0 -35
  196. package/docs/reference/std/cancellable_booking.md +0 -35
  197. package/docs/reference/std/captured_payment.md +0 -43
  198. package/docs/reference/std/conditional_disbursement.md +0 -33
  199. package/docs/reference/std/credit_facility.md +0 -35
  200. package/docs/reference/std/held_payment.md +0 -64
  201. package/docs/reference/std/instant_transfer.md +0 -30
  202. package/docs/reference/std/metered.md +0 -27
  203. package/docs/reference/std/pooled_split.md +0 -26
  204. package/docs/reference/std/premium_forward.md +0 -39
  205. package/docs/reference/std/reconciled_payout.md +0 -33
  206. package/docs/reference/std/recurring_collection.md +0 -25
  207. package/docs/reference/std/rotating_pool.md +0 -42
  208. package/docs/reference/std/scheduled.md +0 -51
  209. package/docs/reference/std/security_deposit.md +0 -46
  210. package/docs/reference/std/settlement_batch.md +0 -42
  211. package/docs/reference/std/swap.md +0 -46
  212. package/docs/reference/std/threshold_pool.md +0 -47
  213. package/docs/reference/std/weighted_distribution.md +0 -39
  214. package/docs/reference/types.md +0 -20
  215. package/docs/reference/udl-output.md +0 -13
  216. package/docs/sessions/2026-09-02-two-instruments.hsx +0 -21
  217. package/docs/sessions/2026-09-02-two-instruments.md +0 -41
  218. package/examples/01-first-program/README.md +0 -45
  219. package/examples/01-first-program/tip-jar.hsx +0 -17
  220. package/examples/02-imports-and-archetypes/README.md +0 -96
  221. package/examples/02-imports-and-archetypes/photo-booth.hsx +0 -37
  222. package/examples/03-diagnostics/README.md +0 -68
  223. package/examples/03-diagnostics/corner-shop-fixed.hsx +0 -22
  224. package/examples/03-diagnostics/corner-shop.hsx +0 -19
  225. package/examples/04-complete-product/README.md +0 -84
  226. package/examples/04-complete-product/study-hall.hsx +0 -67
  227. package/examples/05-watch-club/README.md +0 -9
  228. package/examples/05-watch-club/watch-club.hsx +0 -124
  229. package/examples/README.md +0 -18
  230. package/examples/advance/README.md +0 -3
  231. package/examples/advance/advance.hsx +0 -13
  232. package/examples/advance/advance.udl +0 -339
  233. package/examples/cancellable_booking/README.md +0 -3
  234. package/examples/cancellable_booking/cancellable_booking.hsx +0 -14
  235. package/examples/cancellable_booking/cancellable_booking.udl +0 -391
  236. package/examples/captured_payment/README.md +0 -3
  237. package/examples/captured_payment/captured_payment.hsx +0 -21
  238. package/examples/captured_payment/captured_payment.udl +0 -677
  239. package/examples/conditional_disbursement/README.md +0 -3
  240. package/examples/conditional_disbursement/conditional_disbursement.hsx +0 -17
  241. package/examples/conditional_disbursement/conditional_disbursement.udl +0 -412
  242. package/examples/credit_facility/README.md +0 -3
  243. package/examples/credit_facility/credit_facility.hsx +0 -27
  244. package/examples/credit_facility/credit_facility.udl +0 -1373
  245. package/examples/held_payment/README.md +0 -3
  246. package/examples/held_payment/held_payment.hsx +0 -13
  247. package/examples/held_payment/held_payment.udl +0 -507
  248. package/examples/instant_transfer/README.md +0 -3
  249. package/examples/instant_transfer/instant_transfer.hsx +0 -16
  250. package/examples/instant_transfer/instant_transfer.udl +0 -364
  251. package/examples/metered/README.md +0 -3
  252. package/examples/metered/metered.hsx +0 -13
  253. package/examples/metered/metered.udl +0 -247
  254. package/examples/pooled_split/README.md +0 -3
  255. package/examples/pooled_split/pooled_split.hsx +0 -15
  256. package/examples/pooled_split/pooled_split.udl +0 -425
  257. package/examples/premium_forward/README.md +0 -3
  258. package/examples/premium_forward/premium_forward.hsx +0 -19
  259. package/examples/premium_forward/premium_forward.udl +0 -594
  260. package/examples/reconciled_payout/README.md +0 -3
  261. package/examples/reconciled_payout/reconciled_payout.hsx +0 -13
  262. package/examples/reconciled_payout/reconciled_payout.udl +0 -303
  263. package/examples/recurring_collection/README.md +0 -3
  264. package/examples/recurring_collection/recurring_collection.hsx +0 -21
  265. package/examples/recurring_collection/recurring_collection.udl +0 -1130
  266. package/examples/rotating_pool/README.md +0 -3
  267. package/examples/rotating_pool/rotating_pool.hsx +0 -18
  268. package/examples/rotating_pool/rotating_pool.udl +0 -4352
  269. package/examples/scheduled/README.md +0 -3
  270. package/examples/scheduled/scheduled.hsx +0 -12
  271. package/examples/scheduled/scheduled.udl +0 -335
  272. package/examples/security_deposit/README.md +0 -3
  273. package/examples/security_deposit/security_deposit.hsx +0 -21
  274. package/examples/security_deposit/security_deposit.udl +0 -293
  275. package/examples/settlement_batch/README.md +0 -3
  276. package/examples/settlement_batch/settlement_batch.hsx +0 -19
  277. package/examples/settlement_batch/settlement_batch.udl +0 -753
  278. package/examples/swap/README.md +0 -3
  279. package/examples/swap/swap.hsx +0 -19
  280. package/examples/swap/swap.udl +0 -876
  281. package/examples/threshold_pool/README.md +0 -3
  282. package/examples/threshold_pool/threshold_pool.hsx +0 -16
  283. package/examples/threshold_pool/threshold_pool.udl +0 -667
  284. package/examples/weighted_distribution/README.md +0 -3
  285. package/examples/weighted_distribution/weighted_distribution.hsx +0 -20
  286. package/examples/weighted_distribution/weighted_distribution.udl +0 -337
  287. package/skills/hsx/SKILL.md +0 -483
  288. package/src/emit.ts +0 -201
  289. package/src/entry-overrides.ts +0 -428
  290. package/src/ir.ts +0 -99
  291. package/src/limits.ts +0 -20
  292. package/src/lsp/server.ts +0 -460
  293. package/src/modules.ts +0 -446
  294. package/src/typecheck.ts +0 -3876
  295. package/src/version.ts +0 -5
  296. package/std/SEMANTICS.md +0 -130
  297. package/std/settlements/advance.hsx +0 -177
  298. package/std/settlements/cancellable_booking.hsx +0 -87
  299. package/std/settlements/captured_payment.hsx +0 -144
  300. package/std/settlements/conditional_disbursement.hsx +0 -185
  301. package/std/settlements/credit_facility.hsx +0 -167
  302. package/std/settlements/held_payment.hsx +0 -578
  303. package/std/settlements/index.hsx +0 -3
  304. package/std/settlements/instant_transfer.hsx +0 -190
  305. package/std/settlements/metered.hsx +0 -67
  306. package/std/settlements/pooled_split.hsx +0 -68
  307. package/std/settlements/premium_forward.hsx +0 -257
  308. package/std/settlements/reconciled_payout.hsx +0 -77
  309. package/std/settlements/recurring_collection.hsx +0 -27
  310. package/std/settlements/rotating_pool.hsx +0 -252
  311. package/std/settlements/scheduled.hsx +0 -641
  312. package/std/settlements/security_deposit.hsx +0 -166
  313. package/std/settlements/settlement_batch.hsx +0 -122
  314. package/std/settlements/swap.hsx +0 -1114
  315. package/std/settlements/threshold_pool.hsx +0 -221
  316. package/std/settlements/weighted_distribution.hsx +0 -141
@@ -1,3 +0,0 @@
1
- # held_payment
2
-
3
- This example applies the `held_payment` standard-library module. Its sibling UDL file pins the canonical compiler output byte for byte. The company and parties are invented.
@@ -1,13 +0,0 @@
1
- program held_payment_example "Held payment example"
2
- import { held_payment } from "std/settlements"
3
- party buyer: person
4
- party seller: business
5
- settlement sale = held_payment {
6
- payer: buyer
7
- payee: seller
8
- amount: price: money(SAR)
9
- fees { buyer: 1% }
10
- on_cancel(funded) { buyer: 100% }
11
- release: port confirm_delivery | at(releaseDueAt)
12
- }
13
- port confirm_delivery { allowed: [buyer] }
@@ -1,507 +0,0 @@
1
- {
2
- "instruments": [
3
- {
4
- "actionOrder": [
5
- "create",
6
- "fund_piece_1",
7
- "confirm_delivery",
8
- "release_on_deadline",
9
- "cancel",
10
- "abandon"
11
- ],
12
- "actions": {
13
- "abandon": {
14
- "agentDescription": "Close a sale that was never funded. The escrow account must be empty, so this refuses once any piece is in it. It moves no money and the settlement ends here with no way back.",
15
- "moves": [],
16
- "publicAction": "abandonSale",
17
- "requiresDrainedAccount": {
18
- "path": "refs.escrowAccountId"
19
- },
20
- "steps": [],
21
- "summary": "Abandon the settlement before any money is held"
22
- },
23
- "cancel": {
24
- "agentDescription": "Cancel the sale and start returning the held money to the buyer. It must be funded and not yet released. Cancellation is final, and a cancelled settlement never releases. Where the product sets a release deadline, this call is refused once that date passes.",
25
- "deadline": {
26
- "field": "releaseDueAt"
27
- },
28
- "effects": {
29
- "moves": [
30
- {
31
- "signature": "moves.transfer.internal",
32
- "source": "moves[0]"
33
- }
34
- ],
35
- "schedules": [
36
- {
37
- "signature": "schedules.deadline",
38
- "source": "deadline"
39
- }
40
- ]
41
- },
42
- "moves": [
43
- {
44
- "bind": {
45
- "amount": {
46
- "from": "instance",
47
- "path": "fields.price"
48
- },
49
- "currency": {
50
- "from": "instance",
51
- "path": "fields.currency"
52
- },
53
- "destinationAccountId": {
54
- "from": "instance",
55
- "path": "fields.buyerAccountId"
56
- },
57
- "metadata.instrumentId": {
58
- "from": "const",
59
- "value": "sale"
60
- },
61
- "metadata.instrumentInstanceId": {
62
- "from": "instance",
63
- "path": "instrumentInstanceId"
64
- },
65
- "metadata.phase": {
66
- "from": "const",
67
- "value": "cancel"
68
- },
69
- "productId": {
70
- "from": "instance",
71
- "path": "productId"
72
- },
73
- "sourceAccountId": {
74
- "from": "instance",
75
- "path": "refs.escrowAccountId"
76
- }
77
- },
78
- "capture": {
79
- "cancelTransferTransferId": "transferId"
80
- },
81
- "key": "transfer",
82
- "operation": "internal_transfer.create"
83
- }
84
- ],
85
- "publicAction": "cancelSale",
86
- "steps": [],
87
- "summary": "Cancel the settlement and start the unwind"
88
- },
89
- "confirm_delivery": {
90
- "agentDescription": "Confirm confirm_delivery and start paying the held money out of escrow. The sale must be funded first, and the caller must be buyer. Where the product requires a decision reference, supply it here. Money leaves escrow on this call and does not come back.",
91
- "deadline": {
92
- "field": "releaseDueAt"
93
- },
94
- "effects": {
95
- "decides": [
96
- {
97
- "signature": "decides.tenant_port",
98
- "source": "port"
99
- }
100
- ],
101
- "moves": [
102
- {
103
- "signature": "moves.transfer.internal",
104
- "source": "moves[0]"
105
- }
106
- ],
107
- "schedules": [
108
- {
109
- "signature": "schedules.deadline",
110
- "source": "deadline"
111
- }
112
- ]
113
- },
114
- "moves": [
115
- {
116
- "bind": {
117
- "amount": {
118
- "from": "instance",
119
- "path": "fields.price"
120
- },
121
- "currency": {
122
- "from": "instance",
123
- "path": "fields.currency"
124
- },
125
- "destinationAccountId": {
126
- "from": "instance",
127
- "path": "fields.sellerAccountId"
128
- },
129
- "metadata.instrumentId": {
130
- "from": "const",
131
- "value": "sale"
132
- },
133
- "metadata.instrumentInstanceId": {
134
- "from": "instance",
135
- "path": "instrumentInstanceId"
136
- },
137
- "metadata.phase": {
138
- "from": "const",
139
- "value": "confirm_delivery"
140
- },
141
- "productId": {
142
- "from": "instance",
143
- "path": "productId"
144
- },
145
- "sourceAccountId": {
146
- "from": "instance",
147
- "path": "refs.escrowAccountId"
148
- }
149
- },
150
- "capture": {
151
- "confirmDeliveryTransferTransferId": "transferId"
152
- },
153
- "key": "transfer",
154
- "operation": "internal_transfer.create"
155
- }
156
- ],
157
- "port": {
158
- "allowedParties": [
159
- "payer"
160
- ]
161
- },
162
- "publicAction": "confirmDeliverySale",
163
- "steps": [],
164
- "summary": "Confirm through confirm_delivery and start the release payout"
165
- },
166
- "create": {
167
- "agentDescription": "Open the sale and provision the escrow account that holds the funds. This is the first call, and every funding and release action moves money through that account. It does not move the held amount itself.",
168
- "moves": [],
169
- "publicAction": "createSale",
170
- "steps": [
171
- {
172
- "bind": {
173
- "currency": {
174
- "from": "instance",
175
- "path": "fields.currency"
176
- },
177
- "owner.id": {
178
- "from": "instance",
179
- "path": "productId"
180
- },
181
- "owner.type": {
182
- "from": "const",
183
- "value": "product"
184
- },
185
- "productId": {
186
- "from": "instance",
187
- "path": "productId"
188
- },
189
- "role": {
190
- "from": "const",
191
- "value": "product_escrow"
192
- }
193
- },
194
- "capture": {
195
- "escrowAccountId": "accountId"
196
- },
197
- "operation": "account.escrow.provision"
198
- }
199
- ],
200
- "summary": "Create a sale settlement"
201
- },
202
- "fund_piece_1": {
203
- "agentDescription": "Move the buyer's money into this settlement's escrow. Call it after create and before any release. It debits the buyer for real, and where the product charges a payer-side fee that fee is taken on top in the same call. Only a later release or unwind moves the money again.",
204
- "effects": {
205
- "moves": [
206
- {
207
- "signature": "moves.collection.pay_in",
208
- "source": "moves[0]"
209
- },
210
- {
211
- "signature": "moves.transfer.internal",
212
- "source": "moves[1]"
213
- }
214
- ]
215
- },
216
- "moves": [
217
- {
218
- "bind": {
219
- "amount": {
220
- "from": "instance",
221
- "path": "fields.price"
222
- },
223
- "currency": {
224
- "from": "instance",
225
- "path": "fields.currency"
226
- },
227
- "destinationAccountId": {
228
- "from": "instance",
229
- "path": "refs.escrowAccountId"
230
- },
231
- "metadata.instrumentId": {
232
- "from": "const",
233
- "value": "sale"
234
- },
235
- "metadata.instrumentInstanceId": {
236
- "from": "instance",
237
- "path": "instrumentInstanceId"
238
- },
239
- "metadata.phase": {
240
- "from": "const",
241
- "value": "fund_piece_1"
242
- },
243
- "productId": {
244
- "from": "instance",
245
- "path": "productId"
246
- },
247
- "sourceAccountId": {
248
- "from": "instance",
249
- "path": "fields.buyerAccountId"
250
- }
251
- },
252
- "capture": {
253
- "fundPiece1TransferTransferId": "transferId"
254
- },
255
- "key": "transfer",
256
- "operation": "internal_transfer.create"
257
- },
258
- {
259
- "bind": {
260
- "amount": {
261
- "from": "instance",
262
- "path": "fields.serviceFeeAmount"
263
- },
264
- "currency": {
265
- "from": "instance",
266
- "path": "fields.currency"
267
- },
268
- "destinationAccountId": {
269
- "from": "instance",
270
- "path": "fields.platformAccountId"
271
- },
272
- "metadata.instrumentId": {
273
- "from": "const",
274
- "value": "sale"
275
- },
276
- "metadata.instrumentInstanceId": {
277
- "from": "instance",
278
- "path": "instrumentInstanceId"
279
- },
280
- "metadata.phase": {
281
- "from": "const",
282
- "value": "fund_piece_1"
283
- },
284
- "productId": {
285
- "from": "instance",
286
- "path": "productId"
287
- },
288
- "sourceAccountId": {
289
- "from": "instance",
290
- "path": "fields.buyerAccountId"
291
- }
292
- },
293
- "capture": {
294
- "fundPiece1ServiceFeeTransferId": "transferId"
295
- },
296
- "key": "service_fee",
297
- "operation": "internal_transfer.create"
298
- }
299
- ],
300
- "publicAction": "fundPiece1Sale",
301
- "steps": [],
302
- "summary": "Fund piece 1 of the held amount into escrow"
303
- },
304
- "release_on_deadline": {
305
- "due": {
306
- "field": "releaseDueAt"
307
- },
308
- "effects": {
309
- "moves": [
310
- {
311
- "signature": "moves.transfer.internal",
312
- "source": "moves[0]"
313
- }
314
- ],
315
- "schedules": [
316
- {
317
- "signature": "schedules.due",
318
- "source": "due"
319
- }
320
- ]
321
- },
322
- "moves": [
323
- {
324
- "bind": {
325
- "amount": {
326
- "from": "instance",
327
- "path": "fields.price"
328
- },
329
- "currency": {
330
- "from": "instance",
331
- "path": "fields.currency"
332
- },
333
- "destinationAccountId": {
334
- "from": "instance",
335
- "path": "fields.sellerAccountId"
336
- },
337
- "metadata.instrumentId": {
338
- "from": "const",
339
- "value": "sale"
340
- },
341
- "metadata.instrumentInstanceId": {
342
- "from": "instance",
343
- "path": "instrumentInstanceId"
344
- },
345
- "metadata.phase": {
346
- "from": "const",
347
- "value": "release_on_deadline"
348
- },
349
- "productId": {
350
- "from": "instance",
351
- "path": "productId"
352
- },
353
- "sourceAccountId": {
354
- "from": "instance",
355
- "path": "refs.escrowAccountId"
356
- }
357
- },
358
- "capture": {
359
- "releaseOnDeadlineTransferTransferId": "transferId"
360
- },
361
- "key": "transfer",
362
- "operation": "internal_transfer.create"
363
- }
364
- ],
365
- "steps": [],
366
- "summary": "Release to the seller when releaseDueAt arrives undecided"
367
- }
368
- },
369
- "agentDescription": "Reach for sale when the buyer must commit money up front and nobody is paid until confirm_delivery fires. Funding moves price into this settlement's own escrow account, where it stays until a release or an unwind pays it out. A straight-through payment with no custody step is a different shape.",
370
- "description": "Held payment: the buyer funds price into this settlement's own escrow; buyer confirms through confirm_delivery to release",
371
- "feeRules": [
372
- {
373
- "amountField": "serviceFeeAmount",
374
- "baseField": "price",
375
- "bearerField": "buyerAccountId",
376
- "position": "on_top",
377
- "rule": {
378
- "bps": 100,
379
- "kind": "bps"
380
- }
381
- }
382
- ],
383
- "fields": {
384
- "buyerAccountId": {
385
- "description": "The buyer account",
386
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
387
- "type": "string",
388
- "x-hyperscale-reference-filter": {
389
- "column": "role",
390
- "values": [
391
- "customer_balance"
392
- ]
393
- }
394
- },
395
- "currency": {
396
- "description": "ISO 4217 currency code",
397
- "maxLength": 3,
398
- "minLength": 3,
399
- "pattern": "^[A-Z]{3}$",
400
- "type": "string"
401
- },
402
- "platformAccountId": {
403
- "description": "The product fee collection account",
404
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
405
- "type": "string",
406
- "x-hyperscale-fee-collection-port": true,
407
- "x-hyperscale-reference-filter": {
408
- "column": "role",
409
- "values": [
410
- "customer_balance",
411
- "product_revenue"
412
- ]
413
- }
414
- },
415
- "price": {
416
- "description": "The held amount in SAR minor units, funded and paid out whole",
417
- "pattern": "^[1-9][0-9]{0,17}$",
418
- "type": "string"
419
- },
420
- "releaseDueAt": {
421
- "description": "The date an undecided hold releases to the seller on; confirm_delivery and cancellation decide only before it",
422
- "format": "hyperscale-date-time",
423
- "type": "string"
424
- },
425
- "sellerAccountId": {
426
- "description": "The seller account",
427
- "pattern": "^acct_(sandbox|live)_[a-z0-9]{8,64}$",
428
- "type": "string",
429
- "x-hyperscale-reference-filter": {
430
- "column": "role",
431
- "values": [
432
- "customer_balance"
433
- ]
434
- }
435
- },
436
- "serviceFeeAmount": {
437
- "description": "Machine-owned 1% service fee computed from price; charged on top at funding",
438
- "pattern": "^[1-9][0-9]{0,17}$",
439
- "type": "string"
440
- }
441
- },
442
- "id": "sale",
443
- "idPrefix": "sale",
444
- "lifecycle": {
445
- "initial": "created",
446
- "states": [
447
- "created",
448
- "funded",
449
- "released",
450
- "cancelled",
451
- "abandoned"
452
- ],
453
- "transitions": {
454
- "abandon": {
455
- "from": [
456
- "created"
457
- ],
458
- "to": "abandoned"
459
- },
460
- "cancel": {
461
- "from": [
462
- "funded"
463
- ],
464
- "to": "cancelled"
465
- },
466
- "confirm_delivery": {
467
- "from": [
468
- "funded"
469
- ],
470
- "to": "released"
471
- },
472
- "fund_piece_1": {
473
- "from": [
474
- "created"
475
- ],
476
- "to": "funded"
477
- },
478
- "release_on_deadline": {
479
- "from": [
480
- "funded"
481
- ],
482
- "to": "released"
483
- }
484
- }
485
- },
486
- "parties": {
487
- "beneficiary": "sellerAccountId",
488
- "payer": "buyerAccountId"
489
- },
490
- "required": [
491
- "buyerAccountId",
492
- "sellerAccountId",
493
- "platformAccountId",
494
- "price",
495
- "releaseDueAt",
496
- "currency"
497
- ],
498
- "summary": "Escrow-held payment from buyer to seller",
499
- "title": "Sale"
500
- }
501
- ],
502
- "product": "held_payment_example",
503
- "subjects": [],
504
- "title": "Held payment example",
505
- "udl": 1,
506
- "version": 1
507
- }
@@ -1,3 +0,0 @@
1
- # instant_transfer
2
-
3
- This example applies the `instant_transfer` standard-library module. Its sibling UDL file pins the canonical compiler output byte for byte. The company and parties are invented.
@@ -1,16 +0,0 @@
1
- program instant_transfer_example "Instant transfer example"
2
- import { instant_transfer } from "std/settlements"
3
- party customer: person
4
- party merchant: business
5
- settlement transfer = instant_transfer {
6
- payer: customer
7
- payee: merchant
8
- amount: transferAmount: money(SAR)
9
- fees {
10
- customer: checkoutFee: money(SAR)
11
- merchant {
12
- tier { from: 0, to: 10000, fee: 1% }
13
- tier { from: 10000, fee: highValueFee: money(SAR) }
14
- }
15
- }
16
- }