@ottochain/sdk 2.3.0 → 2.5.0

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 (287) hide show
  1. package/dist/cjs/apps/compute/index.js +33 -0
  2. package/dist/cjs/apps/compute/state-machines/compute-rule110.js +164 -0
  3. package/dist/cjs/apps/compute/state-machines/index.js +9 -0
  4. package/dist/cjs/apps/contracts/index.js +16 -9
  5. package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +134 -161
  6. package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +192 -170
  7. package/dist/cjs/apps/contracts/state-machines/contract-universal.js +46 -58
  8. package/dist/cjs/apps/corporate/index.js +2 -2
  9. package/dist/cjs/apps/corporate/state-machines/corp-board.js +500 -456
  10. package/dist/cjs/apps/corporate/state-machines/corp-entity.js +487 -361
  11. package/dist/cjs/apps/corporate/state-machines/corp-securities.js +769 -576
  12. package/dist/cjs/apps/corporate/state-machines/corp-shareholders.js +567 -557
  13. package/dist/cjs/apps/governance/index.js +21 -21
  14. package/dist/cjs/apps/governance/state-machines/dao-multisig.js +188 -209
  15. package/dist/cjs/apps/governance/state-machines/dao-reputation.js +181 -228
  16. package/dist/cjs/apps/governance/state-machines/dao-single.js +105 -88
  17. package/dist/cjs/apps/governance/state-machines/dao-token.js +199 -227
  18. package/dist/cjs/apps/governance/state-machines/governance-simple.js +231 -231
  19. package/dist/cjs/apps/governance/state-machines/governance-universal.js +64 -64
  20. package/dist/cjs/apps/identity/constants.js +55 -22
  21. package/dist/cjs/apps/identity/index.js +28 -12
  22. package/dist/cjs/apps/identity/state-machines/identity-agent.js +124 -158
  23. package/dist/cjs/apps/identity/state-machines/identity-oracle.js +158 -173
  24. package/dist/cjs/apps/identity/state-machines/identity-registry.js +262 -0
  25. package/dist/cjs/apps/identity/state-machines/identity-universal.js +51 -57
  26. package/dist/cjs/apps/identity/state-machines/index.js +3 -1
  27. package/dist/cjs/apps/index.js +22 -8
  28. package/dist/cjs/apps/lending/assets.js +247 -0
  29. package/dist/cjs/apps/lending/credit-scoring.js +87 -0
  30. package/dist/cjs/apps/lending/eligibility.js +105 -0
  31. package/dist/cjs/apps/lending/index.js +91 -0
  32. package/dist/cjs/apps/lending/state-machines/index.js +9 -0
  33. package/dist/cjs/apps/lending/state-machines/lending-zk-loan.js +433 -0
  34. package/dist/cjs/apps/markets/index.js +22 -12
  35. package/dist/cjs/apps/markets/state-machines/market-auction.js +116 -134
  36. package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +131 -141
  37. package/dist/cjs/apps/markets/state-machines/market-group-buy.js +163 -184
  38. package/dist/cjs/apps/markets/state-machines/market-prediction.js +226 -233
  39. package/dist/cjs/apps/markets/state-machines/market-universal.js +65 -80
  40. package/dist/cjs/apps/oracles/index.js +3 -3
  41. package/dist/cjs/apps/privacy/index.js +67 -0
  42. package/dist/cjs/apps/privacy/state-machines/index.js +17 -0
  43. package/dist/cjs/apps/privacy/state-machines/mixer-ddhRing.js +286 -0
  44. package/dist/cjs/apps/privacy/state-machines/note-pool.js +476 -0
  45. package/dist/cjs/apps/staked-pool/assets.js +103 -0
  46. package/dist/cjs/apps/staked-pool/base.js +498 -0
  47. package/dist/cjs/apps/staked-pool/consumer.js +55 -0
  48. package/dist/cjs/apps/staked-pool/index.js +83 -0
  49. package/dist/cjs/apps/staked-pool/state-machines/index.js +12 -0
  50. package/dist/cjs/apps/staked-pool/state-machines/staked-pool-base.js +49 -0
  51. package/dist/cjs/apps/staked-pool/state-machines/staked-pool-oracle.js +131 -0
  52. package/dist/cjs/errors.js +3 -3
  53. package/dist/cjs/generated/google/protobuf/struct.js +5 -5
  54. package/dist/cjs/generated/google/protobuf/timestamp.js +1 -1
  55. package/dist/cjs/generated/index.js +11 -7
  56. package/dist/cjs/generated/openapi.js +6 -0
  57. package/dist/cjs/generated/ottochain/apps/contracts/v1/contract.js +51 -51
  58. package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +20 -21
  59. package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +14 -14
  60. package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +5 -5
  61. package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +125 -131
  62. package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +108 -108
  63. package/dist/cjs/generated/ottochain/v1/common.js +5 -5
  64. package/dist/cjs/generated/ottochain/v1/fiber.js +44 -6
  65. package/dist/cjs/generated/ottochain/v1/messages.js +1 -1
  66. package/dist/cjs/generated/ottochain/v1/records.js +1 -1
  67. package/dist/cjs/index.js +58 -7
  68. package/dist/cjs/openapi.js +2 -0
  69. package/dist/cjs/ottochain/drop-nulls.js +1 -2
  70. package/dist/cjs/ottochain/genesis-manifest.js +17 -11
  71. package/dist/cjs/ottochain/index.js +23 -13
  72. package/dist/cjs/ottochain/metagraph-client.js +81 -16
  73. package/dist/cjs/ottochain/snapshot.js +13 -16
  74. package/dist/cjs/ottochain/transaction.js +67 -14
  75. package/dist/cjs/ottochain/types.js +16 -2
  76. package/dist/cjs/privacy/index.js +14 -0
  77. package/dist/cjs/privacy/sealed-bid.js +213 -0
  78. package/dist/cjs/privacy/shield-app.js +131 -0
  79. package/dist/cjs/schema/effects.js +156 -0
  80. package/dist/cjs/schema/fiber-app.js +150 -15
  81. package/dist/cjs/schema/guard-lint.js +343 -0
  82. package/dist/cjs/schema/guards.js +246 -0
  83. package/dist/cjs/signing.js +80 -0
  84. package/dist/cjs/templates/asset-policy.js +190 -0
  85. package/dist/cjs/templates/index.js +86 -0
  86. package/dist/cjs/templates/machine.js +130 -0
  87. package/dist/cjs/templates/migration.js +39 -0
  88. package/dist/cjs/templates/state-shape.js +38 -0
  89. package/dist/cjs/types.js +2 -3
  90. package/dist/cjs/validation.js +9 -11
  91. package/dist/cjs/verify.js +9 -4
  92. package/dist/cjs/zk/commit.js +53 -0
  93. package/dist/cjs/zk/guard.js +107 -0
  94. package/dist/cjs/zk/index.js +48 -0
  95. package/dist/cjs/zk/preimage.js +37 -0
  96. package/dist/cjs/zk/prover.js +87 -0
  97. package/dist/cjs/zk/registry.js +62 -0
  98. package/dist/cjs/zk/types.js +28 -0
  99. package/dist/cjs/zk/witness.js +19 -0
  100. package/dist/esm/apps/compute/index.js +29 -0
  101. package/dist/esm/apps/compute/state-machines/compute-rule110.js +161 -0
  102. package/dist/esm/apps/compute/state-machines/index.js +5 -0
  103. package/dist/esm/apps/contracts/index.js +9 -5
  104. package/dist/esm/apps/contracts/state-machines/contract-agreement.js +135 -162
  105. package/dist/esm/apps/contracts/state-machines/contract-escrow.js +193 -171
  106. package/dist/esm/apps/contracts/state-machines/contract-universal.js +47 -59
  107. package/dist/esm/apps/corporate/index.js +2 -2
  108. package/dist/esm/apps/corporate/state-machines/corp-board.js +501 -457
  109. package/dist/esm/apps/corporate/state-machines/corp-entity.js +488 -362
  110. package/dist/esm/apps/corporate/state-machines/corp-securities.js +770 -577
  111. package/dist/esm/apps/corporate/state-machines/corp-shareholders.js +568 -558
  112. package/dist/esm/apps/governance/index.js +10 -10
  113. package/dist/esm/apps/governance/state-machines/dao-multisig.js +189 -210
  114. package/dist/esm/apps/governance/state-machines/dao-reputation.js +182 -229
  115. package/dist/esm/apps/governance/state-machines/dao-single.js +106 -89
  116. package/dist/esm/apps/governance/state-machines/dao-token.js +200 -228
  117. package/dist/esm/apps/governance/state-machines/governance-simple.js +232 -232
  118. package/dist/esm/apps/governance/state-machines/governance-universal.js +65 -65
  119. package/dist/esm/apps/identity/constants.js +52 -21
  120. package/dist/esm/apps/identity/index.js +14 -9
  121. package/dist/esm/apps/identity/state-machines/identity-agent.js +125 -159
  122. package/dist/esm/apps/identity/state-machines/identity-oracle.js +159 -174
  123. package/dist/esm/apps/identity/state-machines/identity-registry.js +259 -0
  124. package/dist/esm/apps/identity/state-machines/identity-universal.js +52 -58
  125. package/dist/esm/apps/identity/state-machines/index.js +1 -0
  126. package/dist/esm/apps/index.js +9 -5
  127. package/dist/esm/apps/lending/assets.js +231 -0
  128. package/dist/esm/apps/lending/credit-scoring.js +81 -0
  129. package/dist/esm/apps/lending/eligibility.js +99 -0
  130. package/dist/esm/apps/lending/index.js +69 -0
  131. package/dist/esm/apps/lending/state-machines/index.js +5 -0
  132. package/dist/esm/apps/lending/state-machines/lending-zk-loan.js +430 -0
  133. package/dist/esm/apps/markets/index.js +11 -7
  134. package/dist/esm/apps/markets/state-machines/market-auction.js +117 -135
  135. package/dist/esm/apps/markets/state-machines/market-crowdfund.js +132 -142
  136. package/dist/esm/apps/markets/state-machines/market-group-buy.js +164 -185
  137. package/dist/esm/apps/markets/state-machines/market-prediction.js +227 -234
  138. package/dist/esm/apps/markets/state-machines/market-universal.js +66 -81
  139. package/dist/esm/apps/oracles/index.js +3 -3
  140. package/dist/esm/apps/privacy/index.js +56 -0
  141. package/dist/esm/apps/privacy/state-machines/index.js +6 -0
  142. package/dist/esm/apps/privacy/state-machines/mixer-ddhRing.js +282 -0
  143. package/dist/esm/apps/privacy/state-machines/note-pool.js +470 -0
  144. package/dist/esm/apps/staked-pool/assets.js +91 -0
  145. package/dist/esm/apps/staked-pool/base.js +493 -0
  146. package/dist/esm/apps/staked-pool/consumer.js +49 -0
  147. package/dist/esm/apps/staked-pool/index.js +60 -0
  148. package/dist/esm/apps/staked-pool/state-machines/index.js +6 -0
  149. package/dist/esm/apps/staked-pool/state-machines/staked-pool-base.js +46 -0
  150. package/dist/esm/apps/staked-pool/state-machines/staked-pool-oracle.js +127 -0
  151. package/dist/esm/generated/google/protobuf/struct.js +1 -1
  152. package/dist/esm/generated/google/protobuf/timestamp.js +1 -1
  153. package/dist/esm/generated/index.js +9 -5
  154. package/dist/esm/generated/openapi.js +5 -0
  155. package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +47 -47
  156. package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
  157. package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +1 -1
  158. package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +1 -1
  159. package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +115 -121
  160. package/dist/esm/generated/ottochain/apps/markets/v1/market.js +101 -101
  161. package/dist/esm/generated/ottochain/v1/common.js +1 -1
  162. package/dist/esm/generated/ottochain/v1/fiber.js +40 -2
  163. package/dist/esm/generated/ottochain/v1/messages.js +1 -1
  164. package/dist/esm/generated/ottochain/v1/records.js +1 -1
  165. package/dist/esm/index.js +28 -3
  166. package/dist/esm/openapi.js +1 -0
  167. package/dist/esm/ottochain/genesis-manifest.js +15 -9
  168. package/dist/esm/ottochain/index.js +2 -3
  169. package/dist/esm/ottochain/metagraph-client.js +81 -16
  170. package/dist/esm/ottochain/snapshot.js +6 -8
  171. package/dist/esm/ottochain/transaction.js +51 -3
  172. package/dist/esm/ottochain/types.js +15 -1
  173. package/dist/esm/privacy/index.js +6 -0
  174. package/dist/esm/privacy/sealed-bid.js +209 -0
  175. package/dist/esm/privacy/shield-app.js +127 -0
  176. package/dist/esm/schema/effects.js +145 -0
  177. package/dist/esm/schema/fiber-app.js +139 -8
  178. package/dist/esm/schema/guard-lint.js +337 -0
  179. package/dist/esm/schema/guards.js +228 -0
  180. package/dist/esm/signing.js +74 -0
  181. package/dist/esm/templates/asset-policy.js +182 -0
  182. package/dist/esm/templates/index.js +41 -0
  183. package/dist/esm/templates/machine.js +125 -0
  184. package/dist/esm/templates/migration.js +34 -0
  185. package/dist/esm/templates/state-shape.js +34 -0
  186. package/dist/esm/validation.js +1 -3
  187. package/dist/esm/verify.js +8 -2
  188. package/dist/esm/zk/commit.js +44 -0
  189. package/dist/esm/zk/guard.js +99 -0
  190. package/dist/esm/zk/index.js +19 -0
  191. package/dist/esm/zk/preimage.js +30 -0
  192. package/dist/esm/zk/prover.js +82 -0
  193. package/dist/esm/zk/registry.js +55 -0
  194. package/dist/esm/zk/types.js +25 -0
  195. package/dist/esm/zk/witness.js +15 -0
  196. package/dist/types/apps/compute/index.d.ts +176 -0
  197. package/dist/types/apps/compute/state-machines/compute-rule110.d.ts +157 -0
  198. package/dist/types/apps/compute/state-machines/index.d.ts +5 -0
  199. package/dist/types/apps/contracts/index.d.ts +81 -221
  200. package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +23 -98
  201. package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +49 -115
  202. package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +4 -4
  203. package/dist/types/apps/corporate/index.d.ts +1176 -440
  204. package/dist/types/apps/corporate/state-machines/corp-board.d.ts +271 -135
  205. package/dist/types/apps/corporate/state-machines/corp-entity.d.ts +279 -74
  206. package/dist/types/apps/corporate/state-machines/corp-securities.d.ts +373 -149
  207. package/dist/types/apps/corporate/state-machines/corp-shareholders.d.ts +252 -80
  208. package/dist/types/apps/governance/index.d.ts +368 -470
  209. package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +92 -107
  210. package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +61 -85
  211. package/dist/types/apps/governance/state-machines/dao-single.d.ts +25 -47
  212. package/dist/types/apps/governance/state-machines/dao-token.d.ts +79 -68
  213. package/dist/types/apps/governance/state-machines/governance-simple.d.ts +95 -125
  214. package/dist/types/apps/governance/state-machines/governance-universal.d.ts +6 -6
  215. package/dist/types/apps/identity/constants.d.ts +33 -5
  216. package/dist/types/apps/identity/index.d.ts +415 -131
  217. package/dist/types/apps/identity/state-machines/identity-agent.d.ts +23 -23
  218. package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +27 -98
  219. package/dist/types/apps/identity/state-machines/identity-registry.d.ts +379 -0
  220. package/dist/types/apps/identity/state-machines/identity-universal.d.ts +4 -4
  221. package/dist/types/apps/identity/state-machines/index.d.ts +1 -0
  222. package/dist/types/apps/index.d.ts +9 -5
  223. package/dist/types/apps/lending/assets.d.ts +258 -0
  224. package/dist/types/apps/lending/credit-scoring.d.ts +80 -0
  225. package/dist/types/apps/lending/eligibility.d.ts +83 -0
  226. package/dist/types/apps/lending/index.d.ts +556 -0
  227. package/dist/types/apps/lending/state-machines/index.d.ts +5 -0
  228. package/dist/types/apps/lending/state-machines/lending-zk-loan.d.ts +536 -0
  229. package/dist/types/apps/markets/index.d.ts +181 -276
  230. package/dist/types/apps/markets/state-machines/market-auction.d.ts +25 -49
  231. package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +35 -53
  232. package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +35 -61
  233. package/dist/types/apps/markets/state-machines/market-prediction.d.ts +65 -86
  234. package/dist/types/apps/markets/state-machines/market-universal.d.ts +12 -12
  235. package/dist/types/apps/oracles/index.d.ts +1 -1
  236. package/dist/types/apps/privacy/index.d.ts +328 -0
  237. package/dist/types/apps/privacy/state-machines/index.d.ts +6 -0
  238. package/dist/types/apps/privacy/state-machines/mixer-ddhRing.d.ts +337 -0
  239. package/dist/types/apps/privacy/state-machines/note-pool.d.ts +196 -0
  240. package/dist/types/apps/staked-pool/assets.d.ts +53 -0
  241. package/dist/types/apps/staked-pool/base.d.ts +80 -0
  242. package/dist/types/apps/staked-pool/consumer.d.ts +29 -0
  243. package/dist/types/apps/staked-pool/index.d.ts +51 -0
  244. package/dist/types/apps/staked-pool/state-machines/index.d.ts +6 -0
  245. package/dist/types/apps/staked-pool/state-machines/staked-pool-base.d.ts +8 -0
  246. package/dist/types/apps/staked-pool/state-machines/staked-pool-oracle.d.ts +34 -0
  247. package/dist/types/generated/index.d.ts +5 -5
  248. package/dist/types/generated/openapi.d.ts +1270 -0
  249. package/dist/types/generated/ottochain/apps/contracts/v1/contract.d.ts +5 -5
  250. package/dist/types/generated/ottochain/apps/identity/v1/identity.d.ts +12 -12
  251. package/dist/types/generated/ottochain/apps/markets/v1/market.d.ts +11 -11
  252. package/dist/types/generated/ottochain/v1/fiber.d.ts +7 -0
  253. package/dist/types/index.d.ts +7 -3
  254. package/dist/types/openapi.d.ts +24 -0
  255. package/dist/types/ottochain/genesis-manifest.d.ts +11 -5
  256. package/dist/types/ottochain/index.d.ts +5 -6
  257. package/dist/types/ottochain/metagraph-client.d.ts +49 -7
  258. package/dist/types/ottochain/snapshot.d.ts +6 -6
  259. package/dist/types/ottochain/transaction.d.ts +41 -1
  260. package/dist/types/ottochain/types.d.ts +336 -31
  261. package/dist/types/privacy/index.d.ts +6 -0
  262. package/dist/types/privacy/sealed-bid.d.ts +348 -0
  263. package/dist/types/privacy/shield-app.d.ts +48 -0
  264. package/dist/types/schema/effects.d.ts +141 -0
  265. package/dist/types/schema/fiber-app.d.ts +282 -2
  266. package/dist/types/schema/guard-lint.d.ts +111 -0
  267. package/dist/types/schema/guards.d.ts +146 -0
  268. package/dist/types/signing.d.ts +45 -0
  269. package/dist/types/templates/asset-policy.d.ts +119 -0
  270. package/dist/types/templates/index.d.ts +26 -0
  271. package/dist/types/templates/machine.d.ts +139 -0
  272. package/dist/types/templates/migration.d.ts +34 -0
  273. package/dist/types/templates/state-shape.d.ts +30 -0
  274. package/dist/types/validation.d.ts +22 -217
  275. package/dist/types/verify.d.ts +4 -0
  276. package/dist/types/zk/commit.d.ts +28 -0
  277. package/dist/types/zk/guard.d.ts +46 -0
  278. package/dist/types/zk/index.d.ts +19 -0
  279. package/dist/types/zk/preimage.d.ts +10 -0
  280. package/dist/types/zk/prover.d.ts +34 -0
  281. package/dist/types/zk/registry.d.ts +34 -0
  282. package/dist/types/zk/types.d.ts +33 -0
  283. package/dist/types/zk/witness.d.ts +40 -0
  284. package/package.json +47 -15
  285. package/dist/cjs/ottochain/normalize.js +0 -186
  286. package/dist/esm/ottochain/normalize.js +0 -179
  287. package/dist/types/ottochain/normalize.d.ts +0 -79
@@ -0,0 +1,247 @@
1
+ "use strict";
2
+ /**
3
+ * Asset-subsystem integration for the lending family.
4
+ *
5
+ * The loan's collateral, principal/debt, and repayment are ASSETS. This module provides
6
+ * typed payload builders for the OttoChain asset operations and loan-specific helpers that
7
+ * map the zk-loan lifecycle onto typed asset morphisms.
8
+ *
9
+ * Wire shapes mirror the asset-model proposal
10
+ * (`/home/euler/repos/ottochain/docs/proposals/asset-model.md` §7 — `CreateAssetPolicy`,
11
+ * `MintAsset`, `ApplyMorphism`, `AuthorizeCompose`; §8 — Governed/ZkVerify-gated morphisms)
12
+ * and follow the SDK's existing single-key-wrapper convention (the discriminator is the outer
13
+ * key, e.g. `{ MintAsset: {...} }`), matching `src/ottochain/transaction.ts`
14
+ * (`createTransitionPayload`, `createScriptPayload`, ...). The asset op-codes are not yet a
15
+ * merged TypeScript SDK surface; these builders let the lending app construct the proposed
16
+ * wire format today and sign it with the existing `signTransaction` path.
17
+ *
18
+ * Amounts are `Long` on-chain; modeled here as `number` for SDK ergonomics (callers may pass a
19
+ * string for values beyond 2^53 — the field is serialized verbatim).
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.TokenBehaviors = exports.fiberHolder = exports.walletHolder = void 0;
23
+ exports.behaviorBits = behaviorBits;
24
+ exports.createAssetPolicyPayload = createAssetPolicyPayload;
25
+ exports.createMintAssetPayload = createMintAssetPayload;
26
+ exports.createApplyMorphismPayload = createApplyMorphismPayload;
27
+ exports.createAuthorizeComposePayload = createAuthorizeComposePayload;
28
+ exports.collateralPolicy = collateralPolicy;
29
+ exports.debtPolicy = debtPolicy;
30
+ exports.lockCollateralOp = lockCollateralOp;
31
+ exports.mintPrincipalOp = mintPrincipalOp;
32
+ exports.repayBurnOp = repayBurnOp;
33
+ exports.settleCollateralOp = settleCollateralOp;
34
+ /** Helpers for the two-variant holder. */
35
+ const walletHolder = (address) => ({ Wallet: { address } });
36
+ exports.walletHolder = walletHolder;
37
+ const fiberHolder = (fiberId) => ({ Fiber: { fiberId } });
38
+ exports.fiberHolder = fiberHolder;
39
+ /** Pack a {@link TokenBehavior} to its 5-bit integer (T=16 S=8 C=4 E=2 G=1). */
40
+ function behaviorBits(b) {
41
+ return ((b.transferable ? 16 : 0) |
42
+ (b.splittable ? 8 : 0) |
43
+ (b.combinable ? 4 : 0) |
44
+ (b.expirable ? 2 : 0) |
45
+ (b.governable ? 1 : 0));
46
+ }
47
+ /** Common behavior presets (asset-model.md §2). */
48
+ exports.TokenBehaviors = {
49
+ /** Non-transferable, non-divisible (bits 0). */
50
+ Soulbound: {
51
+ transferable: false,
52
+ splittable: false,
53
+ combinable: false,
54
+ expirable: false,
55
+ governable: false,
56
+ },
57
+ /** Transferable only (bits 16). */
58
+ NFT: {
59
+ transferable: true,
60
+ splittable: false,
61
+ combinable: false,
62
+ expirable: false,
63
+ governable: false,
64
+ },
65
+ /** Transferable + splittable + combinable (bits 28 = TSC). */
66
+ Fungible: {
67
+ transferable: true,
68
+ splittable: true,
69
+ combinable: true,
70
+ expirable: false,
71
+ governable: false,
72
+ },
73
+ /** Fungible + governable (bits 29 = TSCG) — the default for a gated debt token. */
74
+ GovernedFungible: {
75
+ transferable: true,
76
+ splittable: true,
77
+ combinable: true,
78
+ expirable: false,
79
+ governable: true,
80
+ },
81
+ };
82
+ /** Publish an asset policy package version. asset-model.md §7. */
83
+ function createAssetPolicyPayload(params) {
84
+ return {
85
+ CreateAssetPolicy: {
86
+ name: params.name,
87
+ version: params.version,
88
+ behavior: params.behavior,
89
+ supply: params.supply,
90
+ morphisms: params.morphisms,
91
+ stateShape: params.stateShape,
92
+ ...(params.metadata ? { metadata: params.metadata } : {}),
93
+ },
94
+ };
95
+ }
96
+ /**
97
+ * Mint an asset instance. asset-model.md §7. When the policy's `mintPolicy` is a
98
+ * `groth16_verify` guard (proof-gated mint), pass the eligibility `witness`.
99
+ */
100
+ function createMintAssetPayload(params) {
101
+ return {
102
+ MintAsset: {
103
+ assetId: params.assetId,
104
+ policyRef: params.policyRef,
105
+ holder: params.holder,
106
+ amount: params.amount,
107
+ ...(params.expiresAt !== undefined ? { expiresAt: params.expiresAt } : {}),
108
+ ...(params.witness ? { witness: params.witness } : {}),
109
+ },
110
+ };
111
+ }
112
+ /**
113
+ * Apply a typed morphism (Transfer / Burn / Compose / ...). asset-model.md §7.
114
+ * Transfer = `{ kind: "Transfer", recipient }`; Burn (repay) = `{ kind: "Burn" }`.
115
+ */
116
+ function createApplyMorphismPayload(params) {
117
+ return {
118
+ ApplyMorphism: {
119
+ assetId: params.assetId,
120
+ kind: params.kind,
121
+ targetSequenceNumber: params.targetSequenceNumber,
122
+ ...(params.recipient ? { recipient: params.recipient } : {}),
123
+ ...(params.otherAssets ? { otherAssets: params.otherAssets } : {}),
124
+ ...(params.compositeId ? { compositeId: params.compositeId } : {}),
125
+ ...(params.shardIds ? { shardIds: params.shardIds } : {}),
126
+ ...(params.nonce !== undefined ? { nonce: params.nonce } : {}),
127
+ ...(params.witness ? { witness: params.witness } : {}),
128
+ },
129
+ };
130
+ }
131
+ /** Commit half of a two-party compose. asset-model.md §7/§8. */
132
+ function createAuthorizeComposePayload(params) {
133
+ return {
134
+ AuthorizeCompose: {
135
+ assetId: params.assetId,
136
+ partnerPolicy: params.partnerPolicy,
137
+ nonce: params.nonce,
138
+ expiresAt: params.expiresAt,
139
+ targetSequenceNumber: params.targetSequenceNumber,
140
+ },
141
+ };
142
+ }
143
+ // ---------------------------------------------------------------------------
144
+ // Loan-specific asset policy builders
145
+ // ---------------------------------------------------------------------------
146
+ /**
147
+ * The collateral vault policy: an NFT-like custodial holding (no fungible split) whose
148
+ * `Transfer` morphism is Governed — the loan/escrow fiber is the authorization. Locking is
149
+ * a custody Transfer into `AssetHolder.Fiber(escrow)`; release/liquidation is a Transfer out
150
+ * driven by the loan fiber's REPAID / LIQUIDATED transition (`_transferAsset`).
151
+ */
152
+ function collateralPolicy(name = 'collateral-vault-v1.asset', version = '1.0.0') {
153
+ return {
154
+ name,
155
+ version,
156
+ behavior: { transferable: true, splittable: false, combinable: false, expirable: false, governable: true },
157
+ supply: { maxSupply: null, mintPolicy: null, burnPolicy: null, decimals: 0 },
158
+ morphisms: {
159
+ Transfer: { visibility: 'Governed' },
160
+ Burn: { visibility: 'Disabled' },
161
+ Compose: { visibility: 'Disabled' },
162
+ },
163
+ stateShape: {},
164
+ metadata: { family: 'lending', role: 'collateral' },
165
+ };
166
+ }
167
+ /**
168
+ * The loan-debt / principal policy: a governed fungible whose `mintPolicy` is the
169
+ * proof-gated origination guard — the principal is mintable to the borrower only when the
170
+ * eligibility proof verifies. Repayment is a `Burn` governed by `burnPolicy`.
171
+ *
172
+ * @param mintGuard the origination guard (see `buildOriginationGuard`) — a `groth16_verify`
173
+ * expression bound to the pinned public lending rule.
174
+ */
175
+ function debtPolicy(mintGuard, name = 'loan-debt-v1.asset', version = '1.0.0') {
176
+ return {
177
+ name,
178
+ version,
179
+ behavior: exports.TokenBehaviors.GovernedFungible,
180
+ supply: {
181
+ maxSupply: null,
182
+ // Proof-gated mint: principal is minted only if the eligibility proof verifies.
183
+ mintPolicy: mintGuard,
184
+ // Repayment burns the debt; only the holder (borrower) may burn theirs. The asset context has
185
+ // no `event` key — bind to the verified `signers` (chain-derived from the op's proofs).
186
+ burnPolicy: { in: [{ var: 'holder.Wallet.address' }, { var: 'signers' }] },
187
+ decimals: 2,
188
+ },
189
+ morphisms: {
190
+ Transfer: { visibility: 'Public' },
191
+ Burn: { visibility: 'Public' },
192
+ },
193
+ stateShape: {},
194
+ metadata: { family: 'lending', role: 'debt' },
195
+ };
196
+ }
197
+ // ---------------------------------------------------------------------------
198
+ // Loan lifecycle → asset morphism drivers
199
+ // ---------------------------------------------------------------------------
200
+ /**
201
+ * lock_collateral: custody Transfer of the pledged collateral into the loan escrow fiber.
202
+ * (asset-model.md §10 — locking is a custody transfer to `AssetHolder.Fiber`, there is no
203
+ * `Lock` morphism.)
204
+ */
205
+ function lockCollateralOp(args) {
206
+ return createApplyMorphismPayload({
207
+ assetId: args.collateralAssetId,
208
+ kind: 'Transfer',
209
+ recipient: (0, exports.fiberHolder)(args.escrowFiberId),
210
+ targetSequenceNumber: args.targetSequenceNumber,
211
+ });
212
+ }
213
+ /**
214
+ * originate: Mint the loan principal/debt to the borrower. The policy's `mintPolicy`
215
+ * (the origination guard) reads the eligibility `witness` ({publicValues, proof}).
216
+ */
217
+ function mintPrincipalOp(args) {
218
+ return createMintAssetPayload({
219
+ assetId: args.debtAssetId,
220
+ policyRef: args.debtPolicyRef,
221
+ holder: (0, exports.walletHolder)(args.borrower),
222
+ amount: args.principalAmount,
223
+ witness: args.witness,
224
+ });
225
+ }
226
+ /** repay: Burn the borrower's debt token (the principal is repaid). */
227
+ function repayBurnOp(args) {
228
+ return createApplyMorphismPayload({
229
+ assetId: args.debtAssetId,
230
+ kind: 'Burn',
231
+ targetSequenceNumber: args.targetSequenceNumber,
232
+ });
233
+ }
234
+ /**
235
+ * release / liquidate: Transfer the escrowed collateral out of the escrow fiber to a
236
+ * recipient (the borrower on REPAID, the lender on LIQUIDATED). On-chain this is emitted by
237
+ * the loan fiber's transition via `_transferAsset`; this builder produces the equivalent
238
+ * explicit `ApplyMorphism(Transfer)` for off-fiber/manual settlement.
239
+ */
240
+ function settleCollateralOp(args) {
241
+ return createApplyMorphismPayload({
242
+ assetId: args.collateralAssetId,
243
+ kind: 'Transfer',
244
+ recipient: (0, exports.walletHolder)(args.recipient),
245
+ targetSequenceNumber: args.targetSequenceNumber,
246
+ });
247
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reputationScore = reputationScore;
4
+ exports.reputationCreditRule = reputationCreditRule;
5
+ exports.buildCreditDataContext = buildCreditDataContext;
6
+ exports.reputationAuthorityClause = reputationAuthorityClause;
7
+ /**
8
+ * Credit scoring via the identity + reputation app.
9
+ *
10
+ * A zk-loan's `creditScore` is NOT a self-asserted number — it is the borrower's on-chain identity
11
+ * REPUTATION, derived from their {@link Attestation} deltas (the identity app's reputation model:
12
+ * `baseReputation + Σ delta`, floored at `minReputation`). This module is the wire between the two
13
+ * apps: it computes the reputation-backed score, pins a lending rule that BINDS the score to a
14
+ * specific borrower identity (so a borrower cannot prove eligibility against someone else's
15
+ * reputation), and assembles the PRIVATE data context the borrower proves it over.
16
+ *
17
+ * Privacy boundary: the exact `creditScore` and `collateralValue` stay private (their keccak is the
18
+ * proof's `dataHash`); the `subject` (borrower identity) and the bounds are PUBLIC (pinned in the
19
+ * rule's `logicHash`). The zk proof attests "borrower X's reputation-backed score ≥ floor and
20
+ * collateral coverage ≥ ratio" without revealing the score or the holdings.
21
+ *
22
+ * Trust model: the proof binds the score to the borrower's identity, but the borrower supplies the
23
+ * score value. When reputation attestations are PUBLIC on-chain, a verifier can independently
24
+ * recompute the score and check the proof used it; when reputation is PRIVATE (off-chain / held
25
+ * credentials) the score is genuinely hidden. To make the score AUTHORITY-attested in zero knowledge
26
+ * (the strongest form), have the SP1 rule additionally `schnorr_verify` the reputation issuer's
27
+ * signature over `(subject, score)` — see {@link reputationAuthorityClause}.
28
+ */
29
+ const index_js_1 = require("../identity/index.js");
30
+ const eligibility_js_1 = require("./eligibility.js");
31
+ /**
32
+ * Derive an agent's credit score from their identity reputation attestations:
33
+ * `baseReputation + Σ attestation.delta`, floored at `minReputation`. This IS the integration point —
34
+ * a zk-loan's creditScore is the borrower's identity reputation, not an independent number.
35
+ */
36
+ function reputationScore(attestations, config = index_js_1.DEFAULT_REPUTATION_CONFIG) {
37
+ const raw = attestations.reduce((sum, a) => sum + (a.delta ?? 0), config.baseReputation);
38
+ return Math.max(config.minReputation, raw);
39
+ }
40
+ /**
41
+ * The PUBLIC reputation-credit lending rule. Extends {@link lendingRule} (collateral coverage +
42
+ * optional credit-score floor) with a SUBJECT binding `subject === borrowerId`, so the proven score
43
+ * belongs to a specific identity — a borrower cannot prove eligibility against another agent's
44
+ * reputation. `borrowerId` and all bounds are literals, so pinning the rule pins them.
45
+ */
46
+ function reputationCreditRule(params) {
47
+ const base = (0, eligibility_js_1.lendingRule)(params); // coverage, or {and:[coverage, creditScore floor]}
48
+ const subjectBound = { '===': [{ var: 'subject' }, params.borrowerId] };
49
+ const clauses = 'and' in base ? base.and : [base];
50
+ return { and: [...clauses, subjectBound] };
51
+ }
52
+ /**
53
+ * Assemble the PRIVATE data context the borrower feeds to the zk-jlvm prover: the `creditScore` is
54
+ * their identity {@link reputationScore}, the `subject` is their identity. Only its keccak (`dataHash`)
55
+ * becomes public.
56
+ */
57
+ function buildCreditDataContext(args) {
58
+ return {
59
+ collateralValue: args.collateralValue,
60
+ creditScore: reputationScore(args.attestations, args.config ?? index_js_1.DEFAULT_REPUTATION_CONFIG),
61
+ subject: args.borrowerId,
62
+ };
63
+ }
64
+ /**
65
+ * OPTIONAL hardening — an authority-attested credit clause. ANDed into a rule, it makes the SP1 guest
66
+ * verify (in zero knowledge) the reputation issuer's Schnorr signature over the score, so the score is
67
+ * not merely borrower-supplied but ATTESTED.
68
+ *
69
+ * SECURITY: the authority's `authorityPubKey` MUST be a LITERAL pinned in the rule (it is part of the
70
+ * rule's keccak `logicHash`, so pinning it binds it) — NEVER read from the borrower's witness/private
71
+ * data, or the borrower could supply their own keypair and self-attest any score. Only the signature
72
+ * `repSig` and the signed `scoreCommit` ride on the (private) witness; the signature binds them to the
73
+ * pinned key. `scoreCommit` should commit the pinned `subject` + the proof's `dataHash` so a signature
74
+ * cannot be replayed for a different borrower/score.
75
+ *
76
+ * NOTE: producing a real signature + proof is required to exercise this end-to-end; the builder pins
77
+ * the structure so the on-chain rule and the prover agree. See the JLVM `schnorr_verify` opcode.
78
+ */
79
+ function reputationAuthorityClause(authorityPubKey) {
80
+ return {
81
+ schnorr_verify: [
82
+ authorityPubKey, // the reputation authority's public key — PINNED literal, not witness-supplied
83
+ { var: 'scoreCommit' }, // the signed message: a commitment over (subject, creditScore)
84
+ { var: 'repSig' }, // the authority's signature over scoreCommit
85
+ ],
86
+ };
87
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lendingRule = lendingRule;
4
+ exports.pinLendingRule = pinLendingRule;
5
+ exports.buildOriginationGuard = buildOriginationGuard;
6
+ exports.buildEligibilityWitness = buildEligibilityWitness;
7
+ /**
8
+ * The eligibility-proof model for the zk-loan: pin a PUBLIC lending rule, build the
9
+ * semi-private origination guard that gates it, and construct the witness the guard reads.
10
+ *
11
+ * The borrower proves in zero-knowledge that their PRIVATE financials satisfy the PUBLIC
12
+ * lending rule — without revealing them. The rule (with its literal bounds) is canonicalized
13
+ * and keccak-hashed into a `logicHash`; the proof commits that same `exprHash`, so binding
14
+ * `exprHash == logicHash` pins exactly WHICH rule was proven. See `src/zk` and
15
+ * `/home/euler/repos/ottochain/docs/proposals/asset-model.md` §8 (ZkVerify-gated morphisms).
16
+ */
17
+ const index_js_1 = require("../../zk/index.js");
18
+ /**
19
+ * The PUBLIC lending rule, as a JSON-Logic predicate over the borrower's PRIVATE data context
20
+ * `{ collateralValue, creditScore }`. Evaluates to `true` iff the borrower is eligible:
21
+ *
22
+ * collateralValue * 100 >= loanAmount * collateralRatioPct (collateral coverage)
23
+ * AND creditScore >= minCreditScore (if a floor is set)
24
+ *
25
+ * Only the predicate and its literal bounds are public; the data it is evaluated over
26
+ * (`collateralValue`, `creditScore`) is the prover's private witness — its keccak is the
27
+ * proof's `dataHash`, never revealed. This is the rule the zk-jlvm guest runs; its `exprHash`
28
+ * is pinned as the loan's `lendingRuleLogicHash`.
29
+ */
30
+ function lendingRule(params) {
31
+ const coverage = {
32
+ '>=': [{ '*': [{ var: 'collateralValue' }, 100] }, params.loanAmount * params.collateralRatioPct],
33
+ };
34
+ if (params.minCreditScore === undefined) {
35
+ return coverage;
36
+ }
37
+ return {
38
+ and: [coverage, { '>=': [{ var: 'creditScore' }, params.minCreditScore] }],
39
+ };
40
+ }
41
+ /**
42
+ * Pin a lending rule: produce the public rule plus the three constants the loan's origination
43
+ * guard binds against. `vkey` is the verifying key of the SP1 zk-jlvm program that runs the
44
+ * rule (supplied by the lender / deployment).
45
+ */
46
+ function pinLendingRule(params, vkey) {
47
+ const rule = lendingRule(params);
48
+ return {
49
+ rule,
50
+ logicHash: (0, index_js_1.exprHash)(rule),
51
+ keccakTrue: index_js_1.KECCAK_TRUE,
52
+ vkey,
53
+ };
54
+ }
55
+ /**
56
+ * Build the semi-private ORIGINATION guard expression.
57
+ *
58
+ * It verifies the SP1-Groth16 eligibility proof AND binds its committed public values to the
59
+ * pinned public rule. `publicValues = abi_encode(JlvmPublicValues{exprHash|dataHash|outputHash|ok})`
60
+ * is opaque to `groth16_verify`; the guard slices the `0x`-hex form with native JLVM `substr`
61
+ * (start, len) and re-`cat`s the `0x` prefix — there is no `jlvm_pv_decode` opcode. Clauses:
62
+ *
63
+ * 1. `groth16_verify(vkey, witness.publicValues, witness.proof)` — the proof is valid
64
+ * 2. `exprHash == logicHash` (word 0, hex chars [2,66)) — it proved THE pinned rule
65
+ * 3. `outputHash == keccakTrue` (word 2, hex chars [130,194)) — the rule evaluated to true
66
+ * 4. `ok == "01"` (word 3 final pair, [256,258)) — the JLVM run did not error
67
+ *
68
+ * This is the closed boolean an asset `mintPolicy` or a fiber-transition guard wraps. The
69
+ * lending state machine ANDs clause 0 (`agent == lender`) in front of it; the debt asset
70
+ * policy uses it directly as the proof-gated `mintPolicy`.
71
+ */
72
+ function buildOriginationGuard(refs = {}) {
73
+ const vkeyVar = refs.vkeyVar ?? 'state.lendingRuleVKey';
74
+ const logicHashVar = refs.logicHashVar ?? 'state.lendingRuleLogicHash';
75
+ const keccakTrueVar = refs.keccakTrueVar ?? 'state.keccakTrue';
76
+ return {
77
+ and: [
78
+ {
79
+ groth16_verify: [{ var: vkeyVar }, { var: 'witness.publicValues' }, { var: 'witness.proof' }],
80
+ },
81
+ {
82
+ '===': [{ cat: ['0x', { substr: [{ var: 'witness.publicValues' }, 2, 64] }] }, { var: logicHashVar }],
83
+ },
84
+ {
85
+ '===': [{ cat: ['0x', { substr: [{ var: 'witness.publicValues' }, 130, 64] }] }, { var: keccakTrueVar }],
86
+ },
87
+ {
88
+ '===': [{ substr: [{ var: 'witness.publicValues' }, 256, 2] }, '01'],
89
+ },
90
+ ],
91
+ };
92
+ }
93
+ /**
94
+ * Construct the eligibility-proof witness the origination guard reads. The `{publicValues,
95
+ * proof}` come from the SP1 zk-jlvm prover (`--mode groth16`) run over the public rule and the
96
+ * borrower's PRIVATE data context. Both are lowercase `0x`-hex; they are exposed to the guard
97
+ * under the reserved `witness` key (on the loan `originate` event payload, or on a proof-gated
98
+ * `MintAsset`).
99
+ */
100
+ function buildEligibilityWitness(bundle) {
101
+ return {
102
+ publicValues: bundle.publicValues,
103
+ proof: bundle.proof,
104
+ };
105
+ }
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ /**
3
+ * Lending Application — privacy-preserving credit & lending on OttoChain.
4
+ *
5
+ * The lending family hosts private-finance fibers whose financial state stays private while
6
+ * eligibility is proven in zero-knowledge. The collateral, principal, and repayment are
7
+ * asset-subsystem tokens driven by the fiber lifecycle.
8
+ *
9
+ * Variants:
10
+ * - `zkLoan` — a collateralized loan whose origination is gated by a zk eligibility proof
11
+ * (collateral coverage / credit-score floor) without revealing the borrower's financials.
12
+ *
13
+ * The name `lending` (vs. `loans`) deliberately generalizes for the future credit family —
14
+ * credit lines, BNPL, bonds, escrowed credit — mirroring how `markets` hosts prediction /
15
+ * auction / crowdfund variants under one app.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * import {
20
+ * getLendingDefinition,
21
+ * pinLendingRule,
22
+ * buildOriginationGuard,
23
+ * buildEligibilityWitness,
24
+ * debtPolicy,
25
+ * collateralPolicy,
26
+ * } from '@ottochain/sdk/apps/lending';
27
+ *
28
+ * const loanDef = getLendingDefinition('zkLoan');
29
+ *
30
+ * // Pin the public rule + build the proof-gated origination guard.
31
+ * const pinned = pinLendingRule({ collateralRatioPct: 150, loanAmount: 1000, minCreditScore: 680 }, vkey);
32
+ * const guard = buildOriginationGuard();
33
+ * const debt = debtPolicy(guard);
34
+ * ```
35
+ *
36
+ * @packageDocumentation
37
+ */
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.settleCollateralOp = exports.repayBurnOp = exports.mintPrincipalOp = exports.lockCollateralOp = exports.debtPolicy = exports.collateralPolicy = exports.createAuthorizeComposePayload = exports.createApplyMorphismPayload = exports.createMintAssetPayload = exports.createAssetPolicyPayload = exports.TokenBehaviors = exports.behaviorBits = exports.fiberHolder = exports.walletHolder = exports.reputationAuthorityClause = exports.buildCreditDataContext = exports.reputationCreditRule = exports.reputationScore = exports.buildEligibilityWitness = exports.buildOriginationGuard = exports.pinLendingRule = exports.lendingRule = exports.LENDING_DEFINITIONS = exports.lendingZkLoanDef = void 0;
40
+ exports.getLendingDefinition = getLendingDefinition;
41
+ const index_js_1 = require("./state-machines/index.js");
42
+ Object.defineProperty(exports, "lendingZkLoanDef", { enumerable: true, get: function () { return index_js_1.lendingZkLoanDef; } });
43
+ /** All lending state machine definitions. */
44
+ exports.LENDING_DEFINITIONS = {
45
+ zkLoan: index_js_1.lendingZkLoanDef,
46
+ };
47
+ /**
48
+ * Get a lending state machine definition by type.
49
+ * @param type - 'zkLoan' (default: 'zkLoan')
50
+ */
51
+ function getLendingDefinition(type = 'zkLoan') {
52
+ return exports.LENDING_DEFINITIONS[type];
53
+ }
54
+ // ---------------------------------------------------------------------------
55
+ // Eligibility-proof model (the semi-private gate)
56
+ // ---------------------------------------------------------------------------
57
+ var eligibility_js_1 = require("./eligibility.js");
58
+ Object.defineProperty(exports, "lendingRule", { enumerable: true, get: function () { return eligibility_js_1.lendingRule; } });
59
+ Object.defineProperty(exports, "pinLendingRule", { enumerable: true, get: function () { return eligibility_js_1.pinLendingRule; } });
60
+ Object.defineProperty(exports, "buildOriginationGuard", { enumerable: true, get: function () { return eligibility_js_1.buildOriginationGuard; } });
61
+ Object.defineProperty(exports, "buildEligibilityWitness", { enumerable: true, get: function () { return eligibility_js_1.buildEligibilityWitness; } });
62
+ // ---------------------------------------------------------------------------
63
+ // Credit scoring via the identity + reputation app (the creditScore IS reputation)
64
+ // ---------------------------------------------------------------------------
65
+ var credit_scoring_js_1 = require("./credit-scoring.js");
66
+ Object.defineProperty(exports, "reputationScore", { enumerable: true, get: function () { return credit_scoring_js_1.reputationScore; } });
67
+ Object.defineProperty(exports, "reputationCreditRule", { enumerable: true, get: function () { return credit_scoring_js_1.reputationCreditRule; } });
68
+ Object.defineProperty(exports, "buildCreditDataContext", { enumerable: true, get: function () { return credit_scoring_js_1.buildCreditDataContext; } });
69
+ Object.defineProperty(exports, "reputationAuthorityClause", { enumerable: true, get: function () { return credit_scoring_js_1.reputationAuthorityClause; } });
70
+ // ---------------------------------------------------------------------------
71
+ // Asset-subsystem integration (collateral, debt/principal, repayment morphisms)
72
+ // ---------------------------------------------------------------------------
73
+ var assets_js_1 = require("./assets.js");
74
+ // value types
75
+ Object.defineProperty(exports, "walletHolder", { enumerable: true, get: function () { return assets_js_1.walletHolder; } });
76
+ Object.defineProperty(exports, "fiberHolder", { enumerable: true, get: function () { return assets_js_1.fiberHolder; } });
77
+ Object.defineProperty(exports, "behaviorBits", { enumerable: true, get: function () { return assets_js_1.behaviorBits; } });
78
+ Object.defineProperty(exports, "TokenBehaviors", { enumerable: true, get: function () { return assets_js_1.TokenBehaviors; } });
79
+ // op payload builders
80
+ Object.defineProperty(exports, "createAssetPolicyPayload", { enumerable: true, get: function () { return assets_js_1.createAssetPolicyPayload; } });
81
+ Object.defineProperty(exports, "createMintAssetPayload", { enumerable: true, get: function () { return assets_js_1.createMintAssetPayload; } });
82
+ Object.defineProperty(exports, "createApplyMorphismPayload", { enumerable: true, get: function () { return assets_js_1.createApplyMorphismPayload; } });
83
+ Object.defineProperty(exports, "createAuthorizeComposePayload", { enumerable: true, get: function () { return assets_js_1.createAuthorizeComposePayload; } });
84
+ // loan policy builders
85
+ Object.defineProperty(exports, "collateralPolicy", { enumerable: true, get: function () { return assets_js_1.collateralPolicy; } });
86
+ Object.defineProperty(exports, "debtPolicy", { enumerable: true, get: function () { return assets_js_1.debtPolicy; } });
87
+ // lifecycle → morphism drivers
88
+ Object.defineProperty(exports, "lockCollateralOp", { enumerable: true, get: function () { return assets_js_1.lockCollateralOp; } });
89
+ Object.defineProperty(exports, "mintPrincipalOp", { enumerable: true, get: function () { return assets_js_1.mintPrincipalOp; } });
90
+ Object.defineProperty(exports, "repayBurnOp", { enumerable: true, get: function () { return assets_js_1.repayBurnOp; } });
91
+ Object.defineProperty(exports, "settleCollateralOp", { enumerable: true, get: function () { return assets_js_1.settleCollateralOp; } });
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lendingZkLoanDef = void 0;
4
+ /**
5
+ * Lending state machine definitions.
6
+ * Re-exports from TypeScript definition files.
7
+ */
8
+ var lending_zk_loan_js_1 = require("./lending-zk-loan.js");
9
+ Object.defineProperty(exports, "lendingZkLoanDef", { enumerable: true, get: function () { return lending_zk_loan_js_1.lendingZkLoanDef; } });