@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
@@ -23,21 +23,10 @@ export declare const PublicKeySchema: z.ZodString;
23
23
  * Schema for a KeyPair
24
24
  */
25
25
  export declare const KeyPairSchema: z.ZodObject<{
26
- /** Private key in hex format */
27
26
  privateKey: z.ZodString;
28
- /** Public key in hex format (uncompressed, with 04 prefix) */
29
27
  publicKey: z.ZodString;
30
- /** DAG address derived from the public key */
31
28
  address: z.ZodString;
32
- }, "strip", z.ZodTypeAny, {
33
- address: string;
34
- publicKey: string;
35
- privateKey: string;
36
- }, {
37
- address: string;
38
- publicKey: string;
39
- privateKey: string;
40
- }>;
29
+ }, z.core.$strip>;
41
30
  /**
42
31
  * Type for a validated KeyPair
43
32
  */
@@ -46,17 +35,9 @@ export type ValidatedKeyPair = z.infer<typeof KeyPairSchema>;
46
35
  * Schema for a SignatureProof
47
36
  */
48
37
  export declare const SignatureProofSchema: z.ZodObject<{
49
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
50
38
  id: z.ZodString;
51
- /** DER-encoded ECDSA signature in hex format */
52
39
  signature: z.ZodString;
53
- }, "strip", z.ZodTypeAny, {
54
- id: string;
55
- signature: string;
56
- }, {
57
- id: string;
58
- signature: string;
59
- }>;
40
+ }, z.core.$strip>;
60
41
  /**
61
42
  * Type for a validated SignatureProof
62
43
  */
@@ -67,87 +48,17 @@ export type ValidatedSignatureProof = z.infer<typeof SignatureProofSchema>;
67
48
  export declare const SignedSchema: <T extends z.ZodTypeAny>(valueSchema: T) => z.ZodObject<{
68
49
  value: T;
69
50
  proofs: z.ZodArray<z.ZodObject<{
70
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
71
51
  id: z.ZodString;
72
- /** DER-encoded ECDSA signature in hex format */
73
52
  signature: z.ZodString;
74
- }, "strip", z.ZodTypeAny, {
75
- id: string;
76
- signature: string;
77
- }, {
78
- id: string;
79
- signature: string;
80
- }>, "many">;
81
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
82
- value: T;
83
- proofs: z.ZodArray<z.ZodObject<{
84
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
85
- id: z.ZodString;
86
- /** DER-encoded ECDSA signature in hex format */
87
- signature: z.ZodString;
88
- }, "strip", z.ZodTypeAny, {
89
- id: string;
90
- signature: string;
91
- }, {
92
- id: string;
93
- signature: string;
94
- }>, "many">;
95
- }>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
96
- value: T;
97
- proofs: z.ZodArray<z.ZodObject<{
98
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
99
- id: z.ZodString;
100
- /** DER-encoded ECDSA signature in hex format */
101
- signature: z.ZodString;
102
- }, "strip", z.ZodTypeAny, {
103
- id: string;
104
- signature: string;
105
- }, {
106
- id: string;
107
- signature: string;
108
- }>, "many">;
109
- }>, any>[k]; } : never, z.baseObjectInputType<{
110
- value: T;
111
- proofs: z.ZodArray<z.ZodObject<{
112
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
113
- id: z.ZodString;
114
- /** DER-encoded ECDSA signature in hex format */
115
- signature: z.ZodString;
116
- }, "strip", z.ZodTypeAny, {
117
- id: string;
118
- signature: string;
119
- }, {
120
- id: string;
121
- signature: string;
122
- }>, "many">;
123
- }> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
124
- value: T;
125
- proofs: z.ZodArray<z.ZodObject<{
126
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
127
- id: z.ZodString;
128
- /** DER-encoded ECDSA signature in hex format */
129
- signature: z.ZodString;
130
- }, "strip", z.ZodTypeAny, {
131
- id: string;
132
- signature: string;
133
- }, {
134
- id: string;
135
- signature: string;
136
- }>, "many">;
137
- }>[k_1]; } : never>;
53
+ }, z.core.$strip>>;
54
+ }, z.core.$strip>;
138
55
  /**
139
56
  * Schema for TransactionReference
140
57
  */
141
58
  export declare const TransactionReferenceSchema: z.ZodObject<{
142
59
  ordinal: z.ZodNumber;
143
60
  hash: z.ZodString;
144
- }, "strip", z.ZodTypeAny, {
145
- hash: string;
146
- ordinal: number;
147
- }, {
148
- hash: string;
149
- ordinal: number;
150
- }>;
61
+ }, z.core.$strip>;
151
62
  /**
152
63
  * Schema for CurrencyTransactionValue
153
64
  */
@@ -156,17 +67,7 @@ export declare const CurrencyTransactionValueSchema: z.ZodObject<{
156
67
  destination: z.ZodString;
157
68
  amount: z.ZodNumber;
158
69
  fee: z.ZodDefault<z.ZodNumber>;
159
- }, "strip", z.ZodTypeAny, {
160
- amount: number;
161
- destination: string;
162
- source: string;
163
- fee: number;
164
- }, {
165
- amount: number;
166
- destination: string;
167
- source: string;
168
- fee?: number | undefined;
169
- }>;
70
+ }, z.core.$strip>;
170
71
  /**
171
72
  * Schema for CurrencyTransaction
172
73
  */
@@ -176,50 +77,12 @@ export declare const CurrencyTransactionSchema: z.ZodObject<{
176
77
  destination: z.ZodString;
177
78
  amount: z.ZodNumber;
178
79
  fee: z.ZodDefault<z.ZodNumber>;
179
- }, "strip", z.ZodTypeAny, {
180
- amount: number;
181
- destination: string;
182
- source: string;
183
- fee: number;
184
- }, {
185
- amount: number;
186
- destination: string;
187
- source: string;
188
- fee?: number | undefined;
189
- }>;
80
+ }, z.core.$strip>;
190
81
  parent: z.ZodObject<{
191
82
  ordinal: z.ZodNumber;
192
83
  hash: z.ZodString;
193
- }, "strip", z.ZodTypeAny, {
194
- hash: string;
195
- ordinal: number;
196
- }, {
197
- hash: string;
198
- ordinal: number;
199
- }>;
200
- }, "strip", z.ZodTypeAny, {
201
- value: {
202
- amount: number;
203
- destination: string;
204
- source: string;
205
- fee: number;
206
- };
207
- parent: {
208
- hash: string;
209
- ordinal: number;
210
- };
211
- }, {
212
- value: {
213
- amount: number;
214
- destination: string;
215
- source: string;
216
- fee?: number | undefined;
217
- };
218
- parent: {
219
- hash: string;
220
- ordinal: number;
221
- };
222
- }>;
84
+ }, z.core.$strip>;
85
+ }, z.core.$strip>;
223
86
  /**
224
87
  * Type for a validated CurrencyTransaction
225
88
  */
@@ -232,17 +95,7 @@ export declare const TransferParamsSchema: z.ZodObject<{
232
95
  to: z.ZodString;
233
96
  amount: z.ZodNumber;
234
97
  fee: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
235
- }, "strip", z.ZodTypeAny, {
236
- from: string;
237
- to: string;
238
- amount: number;
239
- fee: number;
240
- }, {
241
- from: string;
242
- to: string;
243
- amount: number;
244
- fee?: number | undefined;
245
- }>;
98
+ }, z.core.$strip>;
246
99
  /**
247
100
  * Type for validated TransferParams
248
101
  */
@@ -251,21 +104,10 @@ export type ValidatedTransferParams = z.infer<typeof TransferParamsSchema>;
251
104
  * Schema for AgentIdentity registration
252
105
  */
253
106
  export declare const AgentIdentityRegistrationSchema: z.ZodObject<{
254
- /** Public key in hex format */
255
107
  publicKey: z.ZodString;
256
- /** Display name for the agent */
257
108
  displayName: z.ZodString;
258
- /** Initial reputation (default: 10) */
259
109
  reputation: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
260
- }, "strip", z.ZodTypeAny, {
261
- reputation: number;
262
- publicKey: string;
263
- displayName: string;
264
- }, {
265
- publicKey: string;
266
- displayName: string;
267
- reputation?: number | undefined;
268
- }>;
110
+ }, z.core.$strip>;
269
111
  /**
270
112
  * Type for validated AgentIdentity registration
271
113
  */
@@ -274,21 +116,17 @@ export type ValidatedAgentIdentityRegistration = z.infer<typeof AgentIdentityReg
274
116
  * Schema for PlatformLink
275
117
  */
276
118
  export declare const PlatformLinkSchema: z.ZodObject<{
277
- platform: z.ZodEnum<["DISCORD", "TELEGRAM", "TWITTER", "GITHUB", "CUSTOM"]>;
119
+ platform: z.ZodEnum<{
120
+ DISCORD: "DISCORD";
121
+ TELEGRAM: "TELEGRAM";
122
+ TWITTER: "TWITTER";
123
+ GITHUB: "GITHUB";
124
+ CUSTOM: "CUSTOM";
125
+ }>;
278
126
  platformUserId: z.ZodString;
279
127
  platformUsername: z.ZodString;
280
128
  verified: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
281
- }, "strip", z.ZodTypeAny, {
282
- platform: "DISCORD" | "TELEGRAM" | "TWITTER" | "GITHUB" | "CUSTOM";
283
- platformUserId: string;
284
- platformUsername: string;
285
- verified: boolean;
286
- }, {
287
- platform: "DISCORD" | "TELEGRAM" | "TWITTER" | "GITHUB" | "CUSTOM";
288
- platformUserId: string;
289
- platformUsername: string;
290
- verified?: boolean | undefined;
291
- }>;
129
+ }, z.core.$strip>;
292
130
  /**
293
131
  * Type for validated PlatformLink
294
132
  */
@@ -301,25 +139,11 @@ export declare const ContractTermsSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>
301
139
  * Schema for ProposeContractRequest
302
140
  */
303
141
  export declare const ProposeContractRequestSchema: z.ZodObject<{
304
- /** Proposer's DAG address */
305
142
  proposer: z.ZodString;
306
- /** Counterparty's DAG address */
307
143
  counterparty: z.ZodString;
308
- /** Contract terms */
309
144
  terms: z.ZodRecord<z.ZodString, z.ZodUnknown>;
310
- /** Human-readable description */
311
145
  description: z.ZodString;
312
- }, "strip", z.ZodTypeAny, {
313
- description: string;
314
- proposer: string;
315
- terms: Record<string, unknown>;
316
- counterparty: string;
317
- }, {
318
- description: string;
319
- proposer: string;
320
- terms: Record<string, unknown>;
321
- counterparty: string;
322
- }>;
146
+ }, z.core.$strip>;
323
147
  /**
324
148
  * Type for validated ProposeContractRequest
325
149
  */
@@ -328,17 +152,9 @@ export type ValidatedProposeContractRequest = z.infer<typeof ProposeContractRequ
328
152
  * Schema for AcceptContractRequest
329
153
  */
330
154
  export declare const AcceptContractRequestSchema: z.ZodObject<{
331
- /** Contract ID to accept */
332
155
  contractId: z.ZodString;
333
- /** Acceptor's DAG address */
334
156
  acceptor: z.ZodString;
335
- }, "strip", z.ZodTypeAny, {
336
- contractId: string;
337
- acceptor: string;
338
- }, {
339
- contractId: string;
340
- acceptor: string;
341
- }>;
157
+ }, z.core.$strip>;
342
158
  /**
343
159
  * Type for validated AcceptContractRequest
344
160
  */
@@ -347,21 +163,10 @@ export type ValidatedAcceptContractRequest = z.infer<typeof AcceptContractReques
347
163
  * Schema for CompleteContractRequest
348
164
  */
349
165
  export declare const CompleteContractRequestSchema: z.ZodObject<{
350
- /** Contract ID to complete */
351
166
  contractId: z.ZodString;
352
- /** Completer's DAG address */
353
167
  completer: z.ZodString;
354
- /** Proof of completion */
355
168
  proof: z.ZodString;
356
- }, "strip", z.ZodTypeAny, {
357
- contractId: string;
358
- completer: string;
359
- proof: string;
360
- }, {
361
- contractId: string;
362
- completer: string;
363
- proof: string;
364
- }>;
169
+ }, z.core.$strip>;
365
170
  /**
366
171
  * Type for validated CompleteContractRequest
367
172
  */
@@ -4,6 +4,10 @@
4
4
  * The package embeds `mode: "standard"|"dataUpdate"` in signed objects and
5
5
  * its verify() ignores the `isDataUpdate` parameter when `mode` is present.
6
6
  * This wrapper strips `mode` so callers' explicit `isDataUpdate` always wins.
7
+ *
8
+ * In dataUpdate mode, verification happens over the null-dropped canonical
9
+ * bytes (drop null object fields, preserve array nulls, then RFC 8785) —
10
+ * mirroring the SDK's dataUpdate signers and metakit's content-hash rule.
7
11
  */
8
12
  import type { Signed, VerificationResult } from '@constellation-network/metagraph-sdk';
9
13
  export declare function verify<T>(signed: Signed<T>, isDataUpdate?: boolean): VerificationResult;
@@ -0,0 +1,28 @@
1
+ /** Lowercase `0x` 32-byte big-endian hex — the JLVM-opcode Fr encoding. */
2
+ export type FrHex = `0x${string}`;
3
+ /**
4
+ * BN254 (alt_bn128) scalar field modulus R. A public field constant (not a secret / not Poseidon
5
+ * itself); the `poseidon` opcode re-validates canonicity, so this only drives reduction + sampling.
6
+ */
7
+ export declare const R = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;
8
+ /** Reduce an arbitrary bigint into a canonical BN254 Fr element `[0, R)`. */
9
+ export declare const toFr: (x: bigint) => bigint;
10
+ /** Encode a field element as the lowercase `0x` 32-byte big-endian hex the crypto opcodes expect. */
11
+ export declare const frToHex: (x: bigint) => FrHex;
12
+ /** A fresh random salt as a canonical Fr (rejection-sampled to avoid modulo bias near R). */
13
+ export declare function randomSalt(): bigint;
14
+ /** `cm = Poseidon([...fields, salt])` via the VM's own opcode. Returns the `0x` 32-byte commitment. */
15
+ export declare function poseidonCommitN(fields: bigint[], saltFr: bigint): FrHex;
16
+ /** `cm = Poseidon([fieldFr, saltFr])` — the commitment for one value field (a bid, a score). */
17
+ export declare function poseidonCommit(fieldFr: bigint, saltFr: bigint): FrHex;
18
+ /** A client-held commitment + its opening. The opening is SECRET; only `cm` is published. */
19
+ export interface Commitment {
20
+ /** The 32-byte commitment published on-chain. */
21
+ cm: FrHex;
22
+ /** The committed field values (client-held). */
23
+ fields: bigint[];
24
+ /** The blinding salt (client-held). */
25
+ salt: bigint;
26
+ }
27
+ /** Commit `fields` under a fresh (or supplied) salt; returns the commitment + opening. */
28
+ export declare function openCommitment(fields: bigint[], salt?: bigint): Commitment;
@@ -0,0 +1,46 @@
1
+ import { type DecodedPublicValues, type Groth16Bundle } from './types';
2
+ /** Char offset of public-values word `w` (0=exprHash, 1=dataHash, 2=outputHash, 3=ok) in the `0x` string. */
3
+ export declare const wordOffset: (w: number) => number;
4
+ /** Options for {@link semiPrivateGuard} / {@link checkSemiPrivateBinding}. */
5
+ export interface SemiPrivateGuardOptions {
6
+ /** Require the rule to have evaluated to `true` (`outputHash == keccak256("true")`). Default true. */
7
+ requireTrue?: boolean;
8
+ }
9
+ /**
10
+ * Build the JLVM guard a `Governed` morphism / mint policy embeds. `vkey` is the zk-jlvm program
11
+ * verification key (a `bytes32` `0x`-hex literal); `logicHash` is the pinned rule's hash (from
12
+ * {@link ExprRegistry.logicHashOf}). Returns plain JSON — feed it into an ASSET policy's guard/mintPolicy
13
+ * (the asset combiner injects the reserved `witness`). In a fiber TRANSITION there is no `witness` key —
14
+ * the proof rides in the event payload, so read `event.witness.*` instead.
15
+ *
16
+ * REPLAY (audit zk-guards): the proven public values commit only {exprHash, dataHash, outputHash, ok} —
17
+ * nothing situational (no fiber / asset / `$ordinal` / nonce). A valid `{publicValues, proof}` is therefore
18
+ * a reusable bearer token, replayable across any action pinning the same vkey + logicHash. Bind the action
19
+ * INSIDE the proven rule (pin a spender/asset/subject, as `reputationCreditRule` pins `subject`) and/or gate
20
+ * with a one-time nonce ledger until the public values carry action context.
21
+ */
22
+ export declare function semiPrivateGuard(vkey: `0x${string}`, logicHash: `0x${string}`, opts?: SemiPrivateGuardOptions): Record<string, unknown>;
23
+ /** The outcome of {@link verifyGroth16Bundle} + binding checks: `ok`, with `reasons` when it is not. */
24
+ export interface BindingResult {
25
+ ok: boolean;
26
+ /** Empty when `ok`; otherwise one human-readable reason per failed check. */
27
+ reasons: string[];
28
+ decoded: DecodedPublicValues;
29
+ }
30
+ /**
31
+ * Locally run the SAME `groth16_verify` pairing the chain runs (the verifier opcode, not the prover).
32
+ * Returns `false` — never throws — on an invalid/garbage bundle, mirroring the guard's graceful deny.
33
+ */
34
+ export declare function verifyGroth16Bundle(bundle: Groth16Bundle): boolean;
35
+ /**
36
+ * Check the binding words WITHOUT the pairing: `exprHash == expectedLogicHash`, `ok` set, and
37
+ * (when `requireTrue`) `outputHash == keccak256("true")`. Pair with {@link verifyGroth16Bundle} for
38
+ * the full client-side mirror of the on-chain guard (see {@link verifySemiPrivate}).
39
+ */
40
+ export declare function checkSemiPrivateBinding(bundle: Groth16Bundle, expectedLogicHash: `0x${string}`, opts?: SemiPrivateGuardOptions): BindingResult;
41
+ /**
42
+ * The full client-side mirror of the on-chain guard: the proof verifies AND its words bind to the
43
+ * pinned rule (and, by default, to a `true` result). Run this before submitting to fail fast instead
44
+ * of paying for an on-chain rejection.
45
+ */
46
+ export declare function verifySemiPrivate(bundle: Groth16Bundle, expectedLogicHash: `0x${string}`, opts?: SemiPrivateGuardOptions): BindingResult;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `@ottochain/sdk/zk` — the client-side semi-private tier.
3
+ *
4
+ * Public-by-default, private-by-opt-in: a holder proves (off-chain, via SP1 zk-jlvm) that some
5
+ * PRIVATE data satisfies a PUBLIC, pinned JLVM rule, and carries only `{publicValues, proof}` on a
6
+ * signed op. A policy's {@link semiPrivateGuard} re-verifies the proof and binds it to the pinned
7
+ * rule on-chain — the value stays hidden, the predicate stays legible.
8
+ *
9
+ * The ONE canonical invariant tying it together: the prover is fed `canonicalForSigning(expr)` /
10
+ * `canonicalForSigning(data)`, so a proof's `exprHash` word equals {@link exprHash}`(rule)` equals a
11
+ * policy's `logicHash` — see {@link proverPreimage} and docs/design/client-side-private-data.md §3.0.
12
+ */
13
+ export { canonicalForSigning, proverPreimage, exprHash, dataHash, KECCAK_TRUE } from './preimage';
14
+ export { type FrHex, R, toFr, frToHex, randomSalt, poseidonCommit, poseidonCommitN, type Commitment, openCommitment, } from './commit';
15
+ export { type DecodedPublicValues, type Groth16Bundle, decodeJlvmPublicValues } from './types';
16
+ export { type Groth16WitnessMap, type Groth16Witness, groth16Witness, type PmtWitnessMap, pmtWitness } from './witness';
17
+ export { type RegisteredRule, ExprRegistry, type Comparator, boundRule, atLeast, atMost } from './registry';
18
+ export { type SemiPrivateGuardOptions, wordOffset, semiPrivateGuard, type BindingResult, verifyGroth16Bundle, checkSemiPrivateBinding, verifySemiPrivate, } from './guard';
19
+ export { type ZkProver, type Groth16ProveRequest, SubprocessProver, type SubprocessProverOptions, parseGroth16Stdout, } from './prover';
@@ -0,0 +1,10 @@
1
+ /** The single canonical string both the signer and the prover-feed share (JCS ∘ dropNullFields). */
2
+ export declare function canonicalForSigning(x: unknown): string;
3
+ /** keccak256 of the canonical bytes — the value the zk-jlvm guest commits as exprHash / dataHash. */
4
+ export declare function proverPreimage(x: unknown): `0x${string}`;
5
+ /** exprHash of a published JLVM rule (canonicalized + keccak'd). Equals the chain's `logicHash`. */
6
+ export declare const exprHash: (rule: unknown) => `0x${string}`;
7
+ /** dataHash of a private data context — kept private; only its hash is public. */
8
+ export declare const dataHash: (data: unknown) => `0x${string}`;
9
+ /** `keccak256(canonicalize(true))` — the `outputHash` a guard binds for a "rule returned true" proof. */
10
+ export declare const KECCAK_TRUE: `0x${string}`;
@@ -0,0 +1,34 @@
1
+ import type { Groth16Bundle } from './types';
2
+ /** A request to prove that evaluating `expr` over `data` yields a result (raw JSON — canonicalized here). */
3
+ export interface Groth16ProveRequest {
4
+ /** The JLVM rule (plain JSON). Canonicalized before it reaches the prover. */
5
+ expr: unknown;
6
+ /** The (private) data context (plain JSON). Canonicalized before it reaches the prover. */
7
+ data: unknown;
8
+ }
9
+ /** Produces SP1-Groth16 bundles for the semi-private tier. Swap implementations in tests. */
10
+ export interface ZkProver {
11
+ proveGroth16(req: Groth16ProveRequest): Promise<Groth16Bundle>;
12
+ }
13
+ /** Configuration for {@link SubprocessProver}. Provide a binary OR a cargo manifest (binary wins). */
14
+ export interface SubprocessProverOptions {
15
+ /** Path to a prebuilt zk-jlvm host binary. Defaults to `ZK_JLVM_BIN`. */
16
+ binaryPath?: string;
17
+ /** Path to the zk-jlvm `script` crate's `Cargo.toml` (run via `cargo run --release`). Defaults to `ZK_JLVM_MANIFEST`. */
18
+ cargoManifestPath?: string;
19
+ /** Extra environment for the child (e.g. `{ SP1_PROVER: 'cuda' }`). Merged over `process.env`. */
20
+ env?: Record<string, string>;
21
+ /** Working directory for the child process. */
22
+ cwd?: string;
23
+ /** Hard timeout in ms. Default 1_800_000 (30 min) — SP1 Groth16 wrapping is slow. */
24
+ timeoutMs?: number;
25
+ }
26
+ /** Parse the host's `vkey:` / `public values:` / `proof bytes:` stdout lines into a bundle. */
27
+ export declare function parseGroth16Stdout(stdout: string): Groth16Bundle;
28
+ /** Drives the zk-jlvm host out-of-process. */
29
+ export declare class SubprocessProver implements ZkProver {
30
+ private readonly opts;
31
+ constructor(opts?: SubprocessProverOptions);
32
+ proveGroth16(req: Groth16ProveRequest): Promise<Groth16Bundle>;
33
+ private run;
34
+ }
@@ -0,0 +1,34 @@
1
+ /** A registered rule and the public `logicHash` that pins it on-chain and in proofs. */
2
+ export interface RegisteredRule {
3
+ /** The JLVM rule, as plain JSON (canonicalized when hashed and when fed to the prover). */
4
+ rule: unknown;
5
+ /** `keccak256(canonicalize(rule))` — the on-chain `logicHash` and a proof's `exprHash` word. */
6
+ logicHash: `0x${string}`;
7
+ }
8
+ /** A client-side registry mapping rule names to their canonical `logicHash`. */
9
+ export declare class ExprRegistry {
10
+ private readonly byName;
11
+ /** Register (or replace) a named rule; returns the entry with its computed `logicHash`. */
12
+ register(name: string, rule: unknown): RegisteredRule;
13
+ /** Whether a rule is registered under `name`. */
14
+ has(name: string): boolean;
15
+ /** The registered rule, or throw if unknown. */
16
+ ruleOf(name: string): unknown;
17
+ /** The registered rule's `logicHash`, or throw if unknown. */
18
+ logicHashOf(name: string): `0x${string}`;
19
+ /** All registered names, in insertion order. */
20
+ names(): string[];
21
+ private require;
22
+ }
23
+ /** The comparators a bound rule can pin a private value against. */
24
+ export type Comparator = '>=' | '>' | '<=' | '<' | '==' | '!=';
25
+ /**
26
+ * A single-bound predicate `{[op]:[{var:varName}, bound]}` — the "pinned bound" a proof binds to.
27
+ * `bound` stays a JSON primitive (number/string) so the canonical bytes the prover hashes match the
28
+ * canonical bytes the rule registers under (bigint is not JSON-serializable — pre-encode if needed).
29
+ */
30
+ export declare function boundRule(varName: string, op: Comparator, bound: number | string): Record<string, unknown>;
31
+ /** `{">=":[{"var":varName}, bound]}` — "the hidden `varName` is at least `bound`". */
32
+ export declare const atLeast: (varName: string, bound: number | string) => Record<string, unknown>;
33
+ /** `{"<=":[{"var":varName}, bound]}` — "the hidden `varName` is at most `bound`". */
34
+ export declare const atMost: (varName: string, bound: number | string) => Record<string, unknown>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * SP1 zk-jlvm public-values types + decode.
3
+ *
4
+ * The guest commits `abi_encode(JlvmPublicValues{ bytes32 exprHash, bytes32 dataHash,
5
+ * bytes32 outputHash, bool ok })` — four 32-byte words, the bool right-aligned in its word.
6
+ * There is no on-chain `jlvm_pv_decode` opcode: the chain guard parses the same blob with the
7
+ * native JLVM `cat`/`substr` ops. This decode mirrors that for client-side binding/inspection.
8
+ */
9
+ /** The decoded zk-jlvm public values: the keccak triple + the ok bit. */
10
+ export interface DecodedPublicValues {
11
+ /** keccak256(canonicalize(expr)) — pins WHICH JLVM rule ran (equals the registry logicHash). */
12
+ exprHash: `0x${string}`;
13
+ /** keccak256(canonicalize(data)) — the (private) data context's hash. */
14
+ dataHash: `0x${string}`;
15
+ /** keccak256(canonicalize(output)) — for a guarded "rule == true" proof, equals KECCAK_TRUE. */
16
+ outputHash: `0x${string}`;
17
+ /** Whether the JLVM evaluation succeeded (false ⇒ the guest aborted / errored). */
18
+ ok: boolean;
19
+ }
20
+ /** A produced SP1-Groth16 bundle from the zk-jlvm prover (`--mode groth16`). */
21
+ export interface Groth16Bundle {
22
+ /** `abi_encode(JlvmPublicValues)` as a `0x` hex string. */
23
+ publicValues: `0x${string}`;
24
+ /** SP1 Groth16 proof bytes as a `0x` hex string. */
25
+ proof: `0x${string}`;
26
+ /** The program verification key (`bytes32`) as a `0x` hex string. */
27
+ vkey: `0x${string}`;
28
+ }
29
+ /**
30
+ * Decode `abi_encode(JlvmPublicValues)`: four 32-byte words `[exprHash | dataHash | outputHash | ok]`.
31
+ * The bool is right-aligned in its word (final byte `0x00`/`0x01`).
32
+ */
33
+ export declare function decodeJlvmPublicValues(pv: `0x${string}`): DecodedPublicValues;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Witness shapers: turn a produced proof bundle (or a Merkle inclusion path) into the exact
3
+ * `JsonLogicValue` map a holder carries on a signed op's `witness` field. The combiner injects that
4
+ * map under the `witness` context key, and the policy guard reads `witness.publicValues` /
5
+ * `witness.proof` (groth16) or `witness.leaf` / `witness.index` / `witness.siblings` (pmt) — the
6
+ * shapes are fixed by metakit's guard opcodes (see ottochain ZkGatedMorphismSuite).
7
+ */
8
+ import type { FrHex } from './commit';
9
+ import { type DecodedPublicValues, type Groth16Bundle } from './types';
10
+ /** The on-op map a `groth16_verify` guard reads. The vkey is NOT here — it is a literal in the guard. */
11
+ export interface Groth16WitnessMap {
12
+ /** `abi_encode(JlvmPublicValues)` as `0x` hex — the guard's `witness.publicValues`. */
13
+ publicValues: `0x${string}`;
14
+ /** SP1-Groth16 proof bytes as `0x` hex — the guard's `witness.proof`. */
15
+ proof: `0x${string}`;
16
+ }
17
+ /** A groth16 witness ready to attach to an op, plus its decoded public values for client binding. */
18
+ export interface Groth16Witness {
19
+ /** Attach this to the op's `witness` field (it is a plain `JsonLogicValue` map). */
20
+ witness: Groth16WitnessMap;
21
+ /** The decoded `{exprHash, dataHash, outputHash, ok}` — inspect/bind BEFORE submitting. */
22
+ decoded: DecodedPublicValues;
23
+ }
24
+ /**
25
+ * Shape a produced {@link Groth16Bundle} into the on-op witness map (`{publicValues, proof}`) and
26
+ * surface its decoded public values. The vkey rides in the guard, not the witness, so it is dropped.
27
+ */
28
+ export declare function groth16Witness(bundle: Groth16Bundle): Groth16Witness;
29
+ /**
30
+ * The on-op map a `pmt_verify` guard reads. `siblings` is the authentication path in the order the
31
+ * `pmt_verify` opcode folds it (ROOT-FIRST / top-down, as produced by metakit's PoseidonMerkleTree);
32
+ * `index` is the leaf position. Pass values straight through from the tree builder — do not reorder.
33
+ */
34
+ export interface PmtWitnessMap {
35
+ leaf: FrHex;
36
+ index: number;
37
+ siblings: FrHex[];
38
+ }
39
+ /** Shape a Poseidon-Merkle inclusion path into the on-op `pmt_verify` witness map. */
40
+ export declare function pmtWitness(leaf: FrHex, index: number, siblings: FrHex[]): PmtWitnessMap;