@ottochain/sdk 2.4.0 → 2.6.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 (227) 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 +1 -1
  5. package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +126 -148
  6. package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +153 -174
  7. package/dist/cjs/apps/contracts/state-machines/contract-universal.js +46 -58
  8. package/dist/cjs/apps/corporate/state-machines/corp-board.js +415 -481
  9. package/dist/cjs/apps/corporate/state-machines/corp-entity.js +368 -440
  10. package/dist/cjs/apps/corporate/state-machines/corp-securities.js +532 -647
  11. package/dist/cjs/apps/corporate/state-machines/corp-shareholders.js +499 -603
  12. package/dist/cjs/apps/governance/index.js +7 -7
  13. package/dist/cjs/apps/governance/state-machines/dao-multisig.js +170 -209
  14. package/dist/cjs/apps/governance/state-machines/dao-reputation.js +161 -214
  15. package/dist/cjs/apps/governance/state-machines/dao-single.js +92 -92
  16. package/dist/cjs/apps/governance/state-machines/dao-token.js +169 -223
  17. package/dist/cjs/apps/governance/state-machines/governance-simple.js +185 -217
  18. package/dist/cjs/apps/governance/state-machines/governance-universal.js +64 -64
  19. package/dist/cjs/apps/identity/constants.js +16 -24
  20. package/dist/cjs/apps/identity/index.js +1 -1
  21. package/dist/cjs/apps/identity/state-machines/identity-agent.js +124 -158
  22. package/dist/cjs/apps/identity/state-machines/identity-oracle.js +151 -169
  23. package/dist/cjs/apps/identity/state-machines/identity-registry.js +89 -115
  24. package/dist/cjs/apps/identity/state-machines/identity-universal.js +51 -57
  25. package/dist/cjs/apps/index.js +4 -1
  26. package/dist/cjs/apps/lending/assets.js +41 -17
  27. package/dist/cjs/apps/lending/credit-scoring.js +4 -4
  28. package/dist/cjs/apps/lending/eligibility.js +9 -25
  29. package/dist/cjs/apps/lending/index.js +1 -1
  30. package/dist/cjs/apps/lending/state-machines/lending-zk-loan.js +177 -156
  31. package/dist/cjs/apps/markets/index.js +1 -1
  32. package/dist/cjs/apps/markets/state-machines/market-auction.js +115 -134
  33. package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +122 -137
  34. package/dist/cjs/apps/markets/state-machines/market-group-buy.js +158 -177
  35. package/dist/cjs/apps/markets/state-machines/market-prediction.js +193 -227
  36. package/dist/cjs/apps/markets/state-machines/market-universal.js +65 -80
  37. package/dist/cjs/apps/oracles/index.js +1 -1
  38. package/dist/cjs/apps/privacy/index.js +67 -0
  39. package/dist/cjs/apps/privacy/state-machines/index.js +17 -0
  40. package/dist/cjs/apps/privacy/state-machines/mixer-ddhRing.js +286 -0
  41. package/dist/cjs/apps/privacy/state-machines/note-pool.js +476 -0
  42. package/dist/cjs/apps/staked-pool/assets.js +103 -0
  43. package/dist/cjs/apps/staked-pool/base.js +498 -0
  44. package/dist/cjs/apps/staked-pool/consumer.js +55 -0
  45. package/dist/cjs/apps/staked-pool/index.js +83 -0
  46. package/dist/cjs/apps/staked-pool/state-machines/index.js +12 -0
  47. package/dist/cjs/apps/staked-pool/state-machines/staked-pool-base.js +49 -0
  48. package/dist/cjs/apps/staked-pool/state-machines/staked-pool-oracle.js +131 -0
  49. package/dist/cjs/generated/google/protobuf/struct.js +1 -1
  50. package/dist/cjs/generated/google/protobuf/timestamp.js +1 -1
  51. package/dist/cjs/generated/ottochain/apps/contracts/v1/contract.js +1 -1
  52. package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
  53. package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +1 -1
  54. package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +1 -1
  55. package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +1 -1
  56. package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +1 -1
  57. package/dist/cjs/generated/ottochain/v1/common.js +1 -1
  58. package/dist/cjs/generated/ottochain/v1/fiber.js +40 -2
  59. package/dist/cjs/generated/ottochain/v1/messages.js +1 -1
  60. package/dist/cjs/generated/ottochain/v1/records.js +1 -1
  61. package/dist/cjs/index.js +21 -3
  62. package/dist/cjs/ottochain/genesis-manifest.js +6 -0
  63. package/dist/cjs/ottochain/metagraph-client.js +63 -11
  64. package/dist/cjs/ottochain/snapshot.js +2 -4
  65. package/dist/cjs/ottochain/transaction.js +10 -0
  66. package/dist/cjs/privacy/sealed-bid.js +85 -82
  67. package/dist/cjs/privacy/shield-app.js +32 -32
  68. package/dist/cjs/schema/effects.js +145 -1
  69. package/dist/cjs/schema/fiber-app.js +139 -5
  70. package/dist/cjs/schema/guard-lint.js +3 -12
  71. package/dist/cjs/schema/guards.js +38 -38
  72. package/dist/cjs/templates/asset-policy.js +190 -0
  73. package/dist/cjs/templates/index.js +86 -0
  74. package/dist/cjs/templates/machine.js +130 -0
  75. package/dist/cjs/templates/migration.js +39 -0
  76. package/dist/cjs/templates/state-shape.js +38 -0
  77. package/dist/cjs/validation.js +1 -3
  78. package/dist/esm/apps/compute/index.js +29 -0
  79. package/dist/esm/apps/compute/state-machines/compute-rule110.js +161 -0
  80. package/dist/esm/apps/compute/state-machines/index.js +5 -0
  81. package/dist/esm/apps/contracts/index.js +4 -4
  82. package/dist/esm/apps/contracts/state-machines/contract-agreement.js +128 -150
  83. package/dist/esm/apps/contracts/state-machines/contract-escrow.js +155 -176
  84. package/dist/esm/apps/contracts/state-machines/contract-universal.js +47 -59
  85. package/dist/esm/apps/corporate/index.js +2 -2
  86. package/dist/esm/apps/corporate/state-machines/corp-board.js +418 -484
  87. package/dist/esm/apps/corporate/state-machines/corp-entity.js +371 -443
  88. package/dist/esm/apps/corporate/state-machines/corp-securities.js +535 -650
  89. package/dist/esm/apps/corporate/state-machines/corp-shareholders.js +502 -606
  90. package/dist/esm/apps/governance/index.js +10 -10
  91. package/dist/esm/apps/governance/state-machines/dao-multisig.js +172 -211
  92. package/dist/esm/apps/governance/state-machines/dao-reputation.js +163 -216
  93. package/dist/esm/apps/governance/state-machines/dao-single.js +94 -94
  94. package/dist/esm/apps/governance/state-machines/dao-token.js +171 -225
  95. package/dist/esm/apps/governance/state-machines/governance-simple.js +187 -219
  96. package/dist/esm/apps/governance/state-machines/governance-universal.js +65 -65
  97. package/dist/esm/apps/identity/constants.js +18 -26
  98. package/dist/esm/apps/identity/index.js +8 -8
  99. package/dist/esm/apps/identity/state-machines/identity-agent.js +125 -159
  100. package/dist/esm/apps/identity/state-machines/identity-oracle.js +153 -171
  101. package/dist/esm/apps/identity/state-machines/identity-registry.js +91 -117
  102. package/dist/esm/apps/identity/state-machines/identity-universal.js +52 -58
  103. package/dist/esm/apps/index.js +9 -6
  104. package/dist/esm/apps/lending/assets.js +41 -17
  105. package/dist/esm/apps/lending/credit-scoring.js +6 -6
  106. package/dist/esm/apps/lending/eligibility.js +10 -26
  107. package/dist/esm/apps/lending/index.js +5 -5
  108. package/dist/esm/apps/lending/state-machines/lending-zk-loan.js +178 -157
  109. package/dist/esm/apps/markets/index.js +5 -5
  110. package/dist/esm/apps/markets/state-machines/market-auction.js +117 -136
  111. package/dist/esm/apps/markets/state-machines/market-crowdfund.js +124 -139
  112. package/dist/esm/apps/markets/state-machines/market-group-buy.js +160 -179
  113. package/dist/esm/apps/markets/state-machines/market-prediction.js +195 -229
  114. package/dist/esm/apps/markets/state-machines/market-universal.js +66 -81
  115. package/dist/esm/apps/oracles/index.js +3 -3
  116. package/dist/esm/apps/privacy/index.js +56 -0
  117. package/dist/esm/apps/privacy/state-machines/index.js +6 -0
  118. package/dist/esm/apps/privacy/state-machines/mixer-ddhRing.js +282 -0
  119. package/dist/esm/apps/privacy/state-machines/note-pool.js +470 -0
  120. package/dist/esm/apps/staked-pool/assets.js +91 -0
  121. package/dist/esm/apps/staked-pool/base.js +493 -0
  122. package/dist/esm/apps/staked-pool/consumer.js +49 -0
  123. package/dist/esm/apps/staked-pool/index.js +60 -0
  124. package/dist/esm/apps/staked-pool/state-machines/index.js +6 -0
  125. package/dist/esm/apps/staked-pool/state-machines/staked-pool-base.js +46 -0
  126. package/dist/esm/apps/staked-pool/state-machines/staked-pool-oracle.js +127 -0
  127. package/dist/esm/generated/google/protobuf/struct.js +1 -1
  128. package/dist/esm/generated/google/protobuf/timestamp.js +1 -1
  129. package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +1 -1
  130. package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
  131. package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +1 -1
  132. package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +1 -1
  133. package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +1 -1
  134. package/dist/esm/generated/ottochain/apps/markets/v1/market.js +1 -1
  135. package/dist/esm/generated/ottochain/v1/common.js +1 -1
  136. package/dist/esm/generated/ottochain/v1/fiber.js +40 -2
  137. package/dist/esm/generated/ottochain/v1/messages.js +1 -1
  138. package/dist/esm/generated/ottochain/v1/records.js +1 -1
  139. package/dist/esm/index.js +10 -4
  140. package/dist/esm/ottochain/genesis-manifest.js +6 -0
  141. package/dist/esm/ottochain/metagraph-client.js +63 -11
  142. package/dist/esm/ottochain/snapshot.js +2 -4
  143. package/dist/esm/ottochain/transaction.js +8 -0
  144. package/dist/esm/privacy/index.js +2 -2
  145. package/dist/esm/privacy/sealed-bid.js +87 -84
  146. package/dist/esm/privacy/shield-app.js +33 -33
  147. package/dist/esm/schema/effects.js +137 -0
  148. package/dist/esm/schema/fiber-app.js +134 -5
  149. package/dist/esm/schema/guard-lint.js +3 -12
  150. package/dist/esm/schema/guards.js +36 -37
  151. package/dist/esm/templates/asset-policy.js +182 -0
  152. package/dist/esm/templates/index.js +41 -0
  153. package/dist/esm/templates/machine.js +125 -0
  154. package/dist/esm/templates/migration.js +34 -0
  155. package/dist/esm/templates/state-shape.js +34 -0
  156. package/dist/esm/validation.js +1 -3
  157. package/dist/esm/zk/index.js +4 -4
  158. package/dist/types/apps/compute/index.d.ts +176 -0
  159. package/dist/types/apps/compute/state-machines/compute-rule110.d.ts +157 -0
  160. package/dist/types/apps/compute/state-machines/index.d.ts +5 -0
  161. package/dist/types/apps/contracts/index.d.ts +14 -14
  162. package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +3 -3
  163. package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +3 -3
  164. package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +4 -4
  165. package/dist/types/apps/corporate/index.d.ts +162 -162
  166. package/dist/types/apps/corporate/state-machines/corp-board.d.ts +88 -88
  167. package/dist/types/apps/corporate/state-machines/corp-entity.d.ts +14 -14
  168. package/dist/types/apps/corporate/state-machines/corp-securities.d.ts +18 -18
  169. package/dist/types/apps/corporate/state-machines/corp-shareholders.d.ts +43 -43
  170. package/dist/types/apps/governance/index.d.ts +81 -81
  171. package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +16 -16
  172. package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +22 -22
  173. package/dist/types/apps/governance/state-machines/dao-token.d.ts +21 -21
  174. package/dist/types/apps/governance/state-machines/governance-simple.d.ts +11 -11
  175. package/dist/types/apps/governance/state-machines/governance-universal.d.ts +4 -4
  176. package/dist/types/apps/identity/constants.d.ts +2 -2
  177. package/dist/types/apps/identity/index.d.ts +70 -70
  178. package/dist/types/apps/identity/state-machines/identity-agent.d.ts +23 -23
  179. package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +11 -11
  180. package/dist/types/apps/identity/state-machines/identity-registry.d.ts +27 -27
  181. package/dist/types/apps/identity/state-machines/identity-universal.d.ts +4 -4
  182. package/dist/types/apps/index.d.ts +9 -6
  183. package/dist/types/apps/lending/assets.d.ts +2 -2
  184. package/dist/types/apps/lending/credit-scoring.d.ts +5 -5
  185. package/dist/types/apps/lending/eligibility.d.ts +2 -2
  186. package/dist/types/apps/lending/index.d.ts +20 -12
  187. package/dist/types/apps/lending/state-machines/lending-zk-loan.d.ts +15 -7
  188. package/dist/types/apps/markets/index.d.ts +76 -76
  189. package/dist/types/apps/markets/state-machines/market-auction.d.ts +12 -12
  190. package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +19 -19
  191. package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +18 -18
  192. package/dist/types/apps/markets/state-machines/market-prediction.d.ts +15 -15
  193. package/dist/types/apps/markets/state-machines/market-universal.d.ts +7 -7
  194. package/dist/types/apps/oracles/index.d.ts +1 -1
  195. package/dist/types/apps/privacy/index.d.ts +328 -0
  196. package/dist/types/apps/privacy/state-machines/index.d.ts +6 -0
  197. package/dist/types/apps/privacy/state-machines/mixer-ddhRing.d.ts +337 -0
  198. package/dist/types/apps/privacy/state-machines/note-pool.d.ts +196 -0
  199. package/dist/types/apps/staked-pool/assets.d.ts +53 -0
  200. package/dist/types/apps/staked-pool/base.d.ts +80 -0
  201. package/dist/types/apps/staked-pool/consumer.d.ts +29 -0
  202. package/dist/types/apps/staked-pool/index.d.ts +51 -0
  203. package/dist/types/apps/staked-pool/state-machines/index.d.ts +6 -0
  204. package/dist/types/apps/staked-pool/state-machines/staked-pool-base.d.ts +8 -0
  205. package/dist/types/apps/staked-pool/state-machines/staked-pool-oracle.d.ts +34 -0
  206. package/dist/types/generated/openapi.d.ts +13 -0
  207. package/dist/types/generated/ottochain/v1/fiber.d.ts +7 -0
  208. package/dist/types/index.d.ts +3 -3
  209. package/dist/types/openapi.d.ts +4 -2
  210. package/dist/types/ottochain/genesis-manifest.d.ts +6 -0
  211. package/dist/types/ottochain/index.d.ts +1 -1
  212. package/dist/types/ottochain/metagraph-client.d.ts +69 -15
  213. package/dist/types/ottochain/transaction.d.ts +9 -1
  214. package/dist/types/ottochain/types.d.ts +1 -1
  215. package/dist/types/privacy/index.d.ts +2 -2
  216. package/dist/types/privacy/sealed-bid.d.ts +9 -9
  217. package/dist/types/privacy/shield-app.d.ts +1 -1
  218. package/dist/types/schema/effects.d.ts +132 -0
  219. package/dist/types/schema/fiber-app.d.ts +281 -0
  220. package/dist/types/schema/guards.d.ts +12 -0
  221. package/dist/types/templates/asset-policy.d.ts +119 -0
  222. package/dist/types/templates/index.d.ts +26 -0
  223. package/dist/types/templates/machine.d.ts +139 -0
  224. package/dist/types/templates/migration.d.ts +34 -0
  225. package/dist/types/templates/state-shape.d.ts +30 -0
  226. package/dist/types/zk/index.d.ts +4 -4
  227. package/package.json +31 -13
@@ -10,6 +10,8 @@
10
10
  */
11
11
  import type { Signed } from '@constellation-network/metagraph-sdk';
12
12
  import type { OnChain, CalculatedState, StateMachineFiberRecord, ScriptFiberRecord, EventReceipt, ScriptInvocation, FiberStatus, RegistryEntry } from './types.js';
13
+ import type { VersionInfo, TransitionFeeEstimate, ScriptFeeEstimate, SubscribeRequest, SubscribeResponse, SubscriberList } from '../openapi.js';
14
+ export type { VersionInfo, TransitionFeeEstimate, ScriptFeeEstimate, SubscribeRequest, SubscribeResponse, SubscriberList, } from '../openapi.js';
13
15
  /**
14
16
  * Checkpoint response from the metagraph (ordinal + calculated state).
15
17
  */
@@ -23,22 +25,39 @@ export interface Checkpoint {
23
25
  * endpoints.
24
26
  */
25
27
  export interface StateProof {
26
- /** The record (or projected field) the proof attests to. */
27
- record: unknown;
28
+ /**
29
+ * The trie key the proof is keyed on — the fiber/asset id (optionally suffixed with the requested
30
+ * field). Chain: `StateProofResponse.key: String` (required).
31
+ */
32
+ key: string;
33
+ ordinal: number;
28
34
  /** The committed-state combined root (= the snapshot's `calculatedStateProof`). */
29
35
  committedRoot: string;
30
36
  /** The Merkle-Patricia trie root. */
31
37
  mptRoot: string;
32
- ordinal: number;
38
+ /** The record (or projected field) the proof attests to. */
39
+ record: unknown;
33
40
  /** The Merkle-Patricia inclusion proof. */
34
41
  proof: unknown;
42
+ /**
43
+ * The `stateData` field name that was projected, present ONLY when a `?field=` was requested
44
+ * (chain `field: Option[String]`, `dropNullValues`-stripped otherwise).
45
+ */
46
+ field?: string;
47
+ /**
48
+ * The value of the projected `field`, present ONLY when a `?field=` was requested
49
+ * (chain `fieldValue: Option[Json]`, `dropNullValues`-stripped otherwise).
50
+ */
51
+ fieldValue?: unknown;
35
52
  }
36
- /** A fee/gas estimate for a transition or script invocation (shape is advisory / may evolve). */
37
- export interface FeeEstimate {
38
- gas?: number;
39
- fee?: number;
40
- [key: string]: unknown;
41
- }
53
+ /**
54
+ * A static fee/gas estimate. The wire is one of two per-endpoint shapes — {@link TransitionFeeEstimate}
55
+ * (state-machine transition) or {@link ScriptFeeEstimate} (script invocation) — that mirror the chain's
56
+ * `FeeEstimates.scala` case classes byte-for-byte. Prefer the per-endpoint types on
57
+ * {@link MetagraphClient.estimateTransitionFee} / {@link MetagraphClient.estimateScriptFee}; this union is
58
+ * a convenience for code that handles either.
59
+ */
60
+ export type FeeEstimate = TransitionFeeEstimate | ScriptFeeEstimate;
42
61
  /**
43
62
  * Options for subscribeFiberState polling behaviour.
44
63
  */
@@ -151,8 +170,12 @@ export declare class MetagraphClient {
151
170
  * Get script invocations from the current ordinal's logs.
152
171
  */
153
172
  getScriptInvocations(scriptId: string): Promise<ScriptInvocation[]>;
154
- /** Get the metagraph version string. */
155
- getVersion(): Promise<string>;
173
+ /**
174
+ * Get the node's service identity + build metadata. The chain's `GET …/version` returns a
175
+ * `VersionInfo` OBJECT (`{ service, version, name, scalaVersion, sbtVersion, gitCommit, buildTime,
176
+ * tessellationVersion }`) — chain `ServiceMeta.scala` — NOT a bare string.
177
+ */
178
+ getVersion(): Promise<VersionInfo>;
156
179
  /** Get the full registry namespace, keyed by full registry name `labels.tld`. */
157
180
  getRegistry(): Promise<Record<string, RegistryEntry>>;
158
181
  /** Resolve a single registry entry by full name (`labels.tld`), or null if unregistered. */
@@ -167,10 +190,41 @@ export declare class MetagraphClient {
167
190
  getScriptStateProof(fiberId: string, field: string): Promise<StateProof>;
168
191
  /** Light-client state proof for a field of an asset instance. */
169
192
  getAssetStateProof(assetId: string, field: string): Promise<StateProof>;
170
- /** Estimate the fee/gas for a transition event on a state-machine fiber. */
171
- estimateTransitionFee(fiberId: string, eventName: string): Promise<FeeEstimate>;
172
- /** Estimate the fee/gas for invoking a script fiber. */
173
- estimateScriptFee(fiberId: string): Promise<FeeEstimate>;
193
+ /**
194
+ * Estimate the fee/gas for a transition event on a state-machine fiber. Returns a
195
+ * {@link TransitionFeeEstimate} (`{ fiberId, currentState, event, gasEstimate, opCount, maxDepth,
196
+ * candidateTransitions, note }`) — chain `FeeEstimates.scala`.
197
+ */
198
+ estimateTransitionFee(fiberId: string, eventName: string): Promise<TransitionFeeEstimate>;
199
+ /**
200
+ * Estimate the fee/gas for invoking a script fiber. Returns a {@link ScriptFeeEstimate}
201
+ * (`{ scriptId, gasEstimate, opCount, maxDepth, note }`) — chain `FeeEstimates.scala`.
202
+ */
203
+ estimateScriptFee(fiberId: string): Promise<ScriptFeeEstimate>;
204
+ /**
205
+ * Subscribe a callback URL to snapshot-notification webhooks.
206
+ *
207
+ * `POST …/webhooks/subscribe` with `SubscribeRequest { callbackUrl, secret? }`; the chain replies
208
+ * `201 Created` with `SubscribeResponse { id, callbackUrl, createdAt }`. Chain: `ML0Routes.scala`
209
+ * (`webhook.subscribe`) + `webhooks/Subscriber.scala`.
210
+ */
211
+ subscribeWebhook(request: SubscribeRequest): Promise<SubscribeResponse>;
212
+ /**
213
+ * Unsubscribe a webhook by its subscriber id.
214
+ *
215
+ * `DELETE …/webhooks/subscribe/{id}` → `204 No Content` (empty body) on success, or `404` if the id is
216
+ * unknown. Chain: `ML0Routes.scala` (`webhook.unsubscribe`). The vendored `HttpClient` exposes only
217
+ * `get`/`post`, so this reuses its shared private `request` helper — same `NetworkError`/timeout
218
+ * handling as every other call — to issue the DELETE.
219
+ */
220
+ unsubscribeWebhook(id: string): Promise<void>;
221
+ /**
222
+ * List the current webhook subscribers (secrets are redacted server-side).
223
+ *
224
+ * `GET …/webhooks/subscribers` → `SubscriberList { subscribers: Subscriber[] }`. Chain:
225
+ * `ML0Routes.scala` (`webhook.list`) + `webhooks/Subscriber.scala`.
226
+ */
227
+ listWebhookSubscribers(): Promise<SubscriberList>;
174
228
  /**
175
229
  * Get the latest snapshot and decode its on-chain state.
176
230
  */
@@ -5,7 +5,7 @@
5
5
  * self-signed mode, where clients sign their own transactions.
6
6
  */
7
7
  import type { Signed } from '@constellation-network/metagraph-sdk';
8
- import type { CreateAssetPolicy, MintAsset, ApplyMorphism, AuthorizeCompose } from './types.js';
8
+ import type { CreateAssetPolicy, MintAsset, ApplyMorphism, AuthorizeCompose, PublishMachineVersion, UpgradeFiber } from './types.js';
9
9
  /**
10
10
  * Parameters for creating a new state machine fiber
11
11
  */
@@ -202,6 +202,14 @@ export declare function createApplyMorphismPayload(params: ApplyMorphism): {
202
202
  export declare function createAuthorizeComposePayload(params: AuthorizeCompose): {
203
203
  AuthorizeCompose: AuthorizeCompose;
204
204
  };
205
+ /** Wrap a {@link PublishMachineVersion} (create-or-append a STATE-MACHINE registry version). */
206
+ export declare function createPublishMachineVersionPayload(params: PublishMachineVersion): {
207
+ PublishMachineVersion: PublishMachineVersion;
208
+ };
209
+ /** Wrap an {@link UpgradeFiber} (re-pin a fiber to another registered version of the SAME package). */
210
+ export declare function createUpgradeFiberPayload(params: UpgradeFiber): {
211
+ UpgradeFiber: UpgradeFiber;
212
+ };
205
213
  /**
206
214
  * Sign a transaction payload for self-signed mode.
207
215
  *
@@ -7,7 +7,7 @@
7
7
  * @see modules/models/src/main/scala/xyz/kd5ujc/schema/
8
8
  * @packageDocumentation
9
9
  */
10
- export type { Address, FiberId, StateId, HashValue, FiberOrdinal, SnapshotOrdinal, Timestamp, } from '../types.js';
10
+ export type { Address, FiberId, StateId, HashValue, FiberOrdinal, SnapshotOrdinal, Timestamp } from '../types.js';
11
11
  /**
12
12
  * JSON logic value - arbitrary JSON data used for state data and payloads.
13
13
  */
@@ -2,5 +2,5 @@
2
2
  * Privacy: shield any fiber app into a zk-jlvm-shielded private-state pool.
3
3
  * See docs/design/zk-private-contract-state-rfc.md.
4
4
  */
5
- export { shieldApp, SHIELDED_POOL_STATE, type ShieldOptions } from "./shield-app.js";
6
- export { sealedBidAccountDef, shieldedSealedBidDef, vickreyAuctionDef } from "./sealed-bid.js";
5
+ export { shieldApp, SHIELDED_POOL_STATE, type ShieldOptions } from './shield-app.js';
6
+ export { sealedBidAccountDef, shieldedSealedBidDef, vickreyAuctionDef } from './sealed-bid.js';
@@ -11,8 +11,8 @@
11
11
  * (the Vickrey price). This is the one shared-state step, kept simple for v1; a zk settlement
12
12
  * proof that seals losers' amounts forever is the deferred upgrade (RFC §10).
13
13
  */
14
- import { type FiberAppDefinition } from "../schema/fiber-app.js";
15
- import { type ShieldOptions } from "./shield-app.js";
14
+ import { type FiberAppDefinition } from '../schema/fiber-app.js';
15
+ import { type ShieldOptions } from './shield-app.js';
16
16
  /** The per-bidder PRIVATE state: a bid note `{ amount, bidder, nonce }`. */
17
17
  export declare const sealedBidAccountDef: {
18
18
  readonly metadata: {
@@ -75,7 +75,7 @@ export declare const sealedBidAccountDef: {
75
75
  readonly to: "BID";
76
76
  readonly eventName: "place_bid";
77
77
  readonly guard: {
78
- readonly ">": readonly [{
78
+ readonly '>': readonly [{
79
79
  readonly var: "event.amount";
80
80
  }, 0];
81
81
  };
@@ -209,7 +209,7 @@ export declare const vickreyAuctionDef: {
209
209
  readonly to: "REVEAL";
210
210
  readonly eventName: "reveal";
211
211
  readonly guard: {
212
- readonly ">=": readonly [{
212
+ readonly '>=': readonly [{
213
213
  readonly var: "$timestamp";
214
214
  }, {
215
215
  readonly var: "state.deadline";
@@ -240,7 +240,7 @@ export declare const vickreyAuctionDef: {
240
240
  readonly to: "REVEAL";
241
241
  readonly eventName: "reveal";
242
242
  readonly guard: {
243
- readonly ">=": readonly [{
243
+ readonly '>=': readonly [{
244
244
  readonly var: "$timestamp";
245
245
  }, {
246
246
  readonly var: "state.deadline";
@@ -270,11 +270,11 @@ export declare const vickreyAuctionDef: {
270
270
  readonly to: "SETTLED";
271
271
  readonly eventName: "settle";
272
272
  readonly guard: {
273
- readonly ">": readonly [{
273
+ readonly '>': readonly [{
274
274
  readonly reduce: readonly [{
275
275
  readonly var: "state.revealed";
276
276
  }, {
277
- readonly "+": readonly [{
277
+ readonly '+': readonly [{
278
278
  readonly var: "accumulator";
279
279
  }, 1];
280
280
  }, 0];
@@ -299,7 +299,7 @@ export declare const vickreyAuctionDef: {
299
299
  readonly var: "state.revealed";
300
300
  }, {
301
301
  readonly if: readonly [{
302
- readonly ">": readonly [{
302
+ readonly '>': readonly [{
303
303
  readonly var: "current.amount";
304
304
  }, {
305
305
  readonly var: "accumulator.max";
@@ -316,7 +316,7 @@ export declare const vickreyAuctionDef: {
316
316
  };
317
317
  }, {
318
318
  readonly if: readonly [{
319
- readonly ">": readonly [{
319
+ readonly '>': readonly [{
320
320
  readonly var: "current.amount";
321
321
  }, {
322
322
  readonly var: "accumulator.second";
@@ -24,7 +24,7 @@
24
24
  * O(state size) (RFC §8). Keep shielded note state small (a few KB); for large keyed state use
25
25
  * the auth-DB variant (RFC §3.1.1).
26
26
  */
27
- import { type FiberAppDefinition, type SchemaField } from "../schema/fiber-app.js";
27
+ import { type FiberAppDefinition, type SchemaField } from '../schema/fiber-app.js';
28
28
  export interface ShieldOptions {
29
29
  /** SP1 program vkey for the zk-jlvm-shielded circuit (0x-prefixed bytes32 hex). Pinned at creation. */
30
30
  vkey: string;
@@ -14,6 +14,7 @@
14
14
  * }
15
15
  * ```
16
16
  */
17
+ import type { ProtoStateMachineDefinition } from './fiber-app.js';
17
18
  /** A JSON-Logic value: a literal (string/number/bool) or a `{var}`/operator expression. */
18
19
  type JsonLogicValue = unknown;
19
20
  /**
@@ -31,4 +32,135 @@ export declare const addDependency: (fiberId: JsonLogicValue) => Record<string,
31
32
  * may be a literal or an expression.
32
33
  */
33
34
  export declare const setDependencyActive: (fiberId: JsonLogicValue, active: boolean) => Record<string, unknown>;
35
+ /**
36
+ * `_transferAsset`: move one or more WHOLE asset instances the emitting fiber holds, each to a single
37
+ * recipient. The directive rides INSIDE a `merge` effect map (the engine extracts `_`-prefixed keys
38
+ * before merging into state); a transition-level `emits` block is silently stripped by
39
+ * `toProtoDefinition`, which would strand the asset.
40
+ *
41
+ * Each directive is `{ assetId, recipient }` ONLY — there is NO `amount` field. The combiner reassigns
42
+ * `holder := recipient` on the WHOLE asset record (`AssetCombiner.applyFiberTransfer`); value is moved
43
+ * one whole instance at a time, never split. `recipient` must resolve to the canonical `AssetHolder`
44
+ * OBJECT form — `{"Fiber":{"fiberId":..}}` / `{"Wallet":{"address":..}}` — built with {@link toFiber} /
45
+ * {@link toWallet}; the chain raises a graceful `CombineRejected` on a bare string or malformed object
46
+ * (`EffectExtractor.parseAssetTransfer`). `assetId` is a UUID; the holder id may be a literal or an
47
+ * expression (e.g. `{ var: "event.agent" }`).
48
+ *
49
+ * Combiner-side holder defense (R1) independently re-validates every directive: the asset must resolve,
50
+ * be held by `Fiber(self)`, be `behavior.transferable`, and (Fiber recipient) the recipient fiber must be
51
+ * live — else the whole transition is `CombineRejected`. There is a hard cap of 32 asset mutations per
52
+ * transition (all-or-nothing); keep emitting fibers at ≤1 transfer per transition for claim/withdraw/slash.
53
+ *
54
+ * @example
55
+ * effect: { merge: [ { var: "state" }, {
56
+ * status: "SETTLED",
57
+ * ...transferAsset([{ assetId: { var: "event.rewardAssetId" }, recipient: toWallet({ var: "event.agent" }) }]),
58
+ * } ] }
59
+ */
60
+ export declare const transferAsset: (transfers: {
61
+ assetId: JsonLogicValue;
62
+ recipient: JsonLogicValue;
63
+ }[]) => Record<string, unknown>;
64
+ /**
65
+ * Build a `_transferAsset` `recipient` as the canonical `AssetHolder` OBJECT form. The chain requires the
66
+ * object form ONLY — `{"Fiber":{"fiberId":..}}` / `{"Wallet":{"address":..}}` — and raises a graceful
67
+ * `CombineRejected` on a bare string or a malformed object (`EffectExtractor.parseAssetTransfer`); the
68
+ * legacy bare-string UUID/DAG-address disambiguation has been removed. These mirror the typed
69
+ * {@link fiberHolder} / {@link walletHolder} `AssetHolder` builders (used for `MintAsset.holder` /
70
+ * `ApplyMorphism.recipient`) but accept a `JsonLogicValue`, so the id can be a runtime expression:
71
+ *
72
+ * ```ts
73
+ * transferAsset([{ assetId, recipient: toFiber({ var: "event.retailerId" }) }]); // → {"Fiber":{"fiberId":..}}
74
+ * transferAsset([{ assetId, recipient: toWallet({ var: "event.agent" }) }]); // → {"Wallet":{"address":..}}
75
+ * ```
76
+ */
77
+ export declare const toFiber: (fiberId: JsonLogicValue) => JsonLogicValue;
78
+ /** See {@link toFiber}: a `transferAsset` recipient held by a wallet — `{"Wallet":{"address":..}}`. */
79
+ export declare const toWallet: (address: JsonLogicValue) => JsonLogicValue;
80
+ /**
81
+ * `_triggers` (F4): fire one or more CROSS-FIBER events. Each entry is projected to
82
+ * `{ targetMachineId, eventName, payload }` — the exact shape the chain's `EffectExtractor` reads
83
+ * (`ReservedKeys.scala`, `EffectExtractor.scala`). `target` is the recipient fiber id (a literal UUID
84
+ * or an expression, e.g. `{ var: "event.retailerId" }`); `event` is the event NAME to enqueue on it;
85
+ * `payload` is the event body — omit it and the builder emits `{}` (never `null`).
86
+ *
87
+ * Authoring this as a builder makes a typo'd `_trigger` / `triggres` a TypeScript error rather than a
88
+ * silently-merged state field (the F4 foot-gun). Place the fragment INSIDE the effect's state-update
89
+ * map so it rides in the evaluated result the extractor reads.
90
+ *
91
+ * @example
92
+ * effect: { merge: [ { var: "state" }, {
93
+ * status: "debt_current",
94
+ * ...triggers([{ target: { var: "event.retailerId" }, event: "process_sale",
95
+ * payload: { buyerId: { var: "machineId" }, quantity: { var: "event.quantity" } } }]),
96
+ * } ] }
97
+ */
98
+ export declare const triggers: (ts: {
99
+ target: JsonLogicValue;
100
+ event: string;
101
+ payload?: Record<string, unknown>;
102
+ }[]) => Record<string, unknown>;
103
+ /**
104
+ * `_spawn`: create one or more CHILD fibers, each from a literal machine `definition`. Each entry is
105
+ * `{ childId, definition, initialData, owners }` (`ReservedKeys.scala`, `EffectExtractor.scala`).
106
+ *
107
+ * The chain extracts `_spawn` from the effect EXPRESSION, not the evaluated result, so `definition`
108
+ * MUST be a literal {@link ProtoStateMachineDefinition} (e.g. a nested `machine().wireDefinition()` /
109
+ * `toProtoDefinition(child)` output) — NOT an expression the engine would evaluate at runtime.
110
+ *
111
+ * F8 gotcha — `owners` is load-bearing. A spawned child's transitions are gated by
112
+ * `owners ∪ authorizedSigners` (`riverdale-economy/README.md`), so EVERY party that will later drive
113
+ * the child (e.g. every bidder on a spawned auction) MUST be listed in `owners`, or their events are
114
+ * rejected. `owners` may be a literal id array or an expression (e.g. `{ var: "event.auctionOwners" }`);
115
+ * `childId` / `initialData` likewise accept literals or expressions.
116
+ */
117
+ export declare const spawn: (ds: {
118
+ childId: JsonLogicValue;
119
+ definition: ProtoStateMachineDefinition;
120
+ initialData: Record<string, unknown>;
121
+ owners: JsonLogicValue;
122
+ }[]) => Record<string, unknown>;
123
+ /**
124
+ * `_emit`: emit one or more domain events to the fiber's outbox. Each entry is
125
+ * `{ name, data, destination? }` (`ReservedKeys.scala`, `EffectExtractor.scala`). `name` is the event
126
+ * name, `data` the body (a literal or an expression), and `destination` an OPTIONAL routing target —
127
+ * omit it when absent (callers never pass `null`, so it is simply absent on the wire).
128
+ */
129
+ export declare const emit: (es: {
130
+ name: string;
131
+ data: JsonLogicValue;
132
+ destination?: string;
133
+ }[]) => Record<string, unknown>;
134
+ /**
135
+ * `_scriptCall`: invoke a SCRIPT fiber's `method` from an effect. Unlike the array-valued directives,
136
+ * `_scriptCall` is a SINGLE object `{ fiberId, method, args }` (chain `ReservedKeys.scala` `SCRIPT_CALL` /
137
+ * `EffectExtractor.extractScriptCall`). `fiberId` is the target script's UUID (a literal or an expression,
138
+ * e.g. `{ var: "state.resolverId" }`); `method` is the script method NAME; `args` is the argument body —
139
+ * a JSON-Logic value the chain EVALUATES against the transition context before dispatch.
140
+ *
141
+ * The chain's extractor requires ALL THREE fields — if `args` is absent the whole call is silently DROPPED
142
+ * (fail-silent, like the other extractors). So the builder ALWAYS emits `args`, defaulting an omitted one
143
+ * to `{}` (no-args), mirroring how {@link triggers} defaults an absent `payload`. Authoring this as a
144
+ * builder makes a typo'd `_scriptcall` / wrong field a TypeScript error rather than a silently-merged
145
+ * state field. Place the fragment INSIDE the effect's state-update map so it rides in the evaluated result.
146
+ *
147
+ * @example
148
+ * effect: { merge: [ { var: "state" }, {
149
+ * status: "resolving",
150
+ * ...scriptCall({ fiberId: { var: "state.resolverId" }, method: "resolve",
151
+ * args: { marketId: { var: "machineId" } } }),
152
+ * } ] }
153
+ */
154
+ export declare const scriptCall: (call: {
155
+ fiberId: JsonLogicValue;
156
+ method: string;
157
+ args?: JsonLogicValue;
158
+ }) => Record<string, unknown>;
159
+ /**
160
+ * The complete set of `_`-prefixed RESERVED effect keys the chain's `EffectExtractor` consumes and
161
+ * `StateMerger` strips from state (`ReservedKeys.scala:12-49`). Exported so a validator (Proposal 01)
162
+ * can reject an unknown `_`-prefixed key (a typo'd directive) instead of letting it silently leak into
163
+ * persisted state.
164
+ */
165
+ export declare const RESERVED_EFFECT_KEYS: readonly ["_triggers", "_spawn", "_emit", "_transferAsset", "_scriptCall", "_addDependency", "_setDependencyActive"];
34
166
  export {};