@midnightntwrk/compact-js 0.0.0-stage → 4.0.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 (233) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +158 -2
  3. package/dist/dts/effect/CompactContext.d.ts +20 -0
  4. package/dist/dts/effect/CompactContext.d.ts.map +1 -0
  5. package/dist/dts/effect/CompactRuntime.d.ts +76 -0
  6. package/dist/dts/effect/CompactRuntime.d.ts.map +1 -0
  7. package/dist/dts/effect/CompiledContract.d.ts +107 -0
  8. package/dist/dts/effect/CompiledContract.d.ts.map +1 -0
  9. package/dist/dts/effect/Contract.d.ts +154 -0
  10. package/dist/dts/effect/Contract.d.ts.map +1 -0
  11. package/dist/dts/effect/ContractConfigurationError.d.ts +54 -0
  12. package/dist/dts/effect/ContractConfigurationError.d.ts.map +1 -0
  13. package/dist/dts/effect/ContractEventStore.d.ts +167 -0
  14. package/dist/dts/effect/ContractEventStore.d.ts.map +1 -0
  15. package/dist/dts/effect/ContractEventValidationError.d.ts +34 -0
  16. package/dist/dts/effect/ContractEventValidationError.d.ts.map +1 -0
  17. package/dist/dts/effect/ContractEventValidator.d.ts +18 -0
  18. package/dist/dts/effect/ContractEventValidator.d.ts.map +1 -0
  19. package/dist/dts/effect/ContractExecutable.d.ts +99 -0
  20. package/dist/dts/effect/ContractExecutable.d.ts.map +1 -0
  21. package/dist/dts/effect/ContractExecutableRuntime.d.ts +4 -0
  22. package/dist/dts/effect/ContractExecutableRuntime.d.ts.map +1 -0
  23. package/dist/dts/effect/ContractKeyLocation.d.ts +55 -0
  24. package/dist/dts/effect/ContractKeyLocation.d.ts.map +1 -0
  25. package/dist/dts/effect/ContractLog.d.ts +273 -0
  26. package/dist/dts/effect/ContractLog.d.ts.map +1 -0
  27. package/dist/dts/effect/ContractRuntimeError.d.ts +34 -0
  28. package/dist/dts/effect/ContractRuntimeError.d.ts.map +1 -0
  29. package/dist/dts/effect/Ledger.d.ts +104 -0
  30. package/dist/dts/effect/Ledger.d.ts.map +1 -0
  31. package/dist/dts/effect/MalformedHexPrefixError.d.ts +37 -0
  32. package/dist/dts/effect/MalformedHexPrefixError.d.ts.map +1 -0
  33. package/dist/dts/effect/ZKConfiguration.d.ts +52 -0
  34. package/dist/dts/effect/ZKConfiguration.d.ts.map +1 -0
  35. package/dist/dts/effect/ZKConfigurationReadError.d.ts +45 -0
  36. package/dist/dts/effect/ZKConfigurationReadError.d.ts.map +1 -0
  37. package/dist/dts/effect/ZKManifest.d.ts +50 -0
  38. package/dist/dts/effect/ZKManifest.d.ts.map +1 -0
  39. package/dist/dts/effect/ZKManifestError.d.ts +34 -0
  40. package/dist/dts/effect/ZKManifestError.d.ts.map +1 -0
  41. package/dist/dts/effect/index.d.ts +22 -0
  42. package/dist/dts/effect/index.d.ts.map +1 -0
  43. package/dist/dts/effect/internal/boundary.d.ts +35 -0
  44. package/dist/dts/effect/internal/boundary.d.ts.map +1 -0
  45. package/dist/dts/effect/internal/compactContext.d.ts +29 -0
  46. package/dist/dts/effect/internal/compactContext.d.ts.map +1 -0
  47. package/dist/dts/effect/internal/contractEventsSurface.d.ts +43 -0
  48. package/dist/dts/effect/internal/contractEventsSurface.d.ts.map +1 -0
  49. package/dist/dts/effect/internal/era/v8Executable.d.ts +65 -0
  50. package/dist/dts/effect/internal/era/v8Executable.d.ts.map +1 -0
  51. package/dist/dts/effect/internal/era/v8Ledger.d.ts +76 -0
  52. package/dist/dts/effect/internal/era/v8Ledger.d.ts.map +1 -0
  53. package/dist/dts/effect/internal/era/v8Runtime.d.ts +26 -0
  54. package/dist/dts/effect/internal/era/v8Runtime.d.ts.map +1 -0
  55. package/dist/dts/effect/internal/era/v9Executable.d.ts +65 -0
  56. package/dist/dts/effect/internal/era/v9Executable.d.ts.map +1 -0
  57. package/dist/dts/effect/internal/era/v9Ledger.d.ts +76 -0
  58. package/dist/dts/effect/internal/era/v9Ledger.d.ts.map +1 -0
  59. package/dist/dts/effect/internal/era/v9Runtime.d.ts +15 -0
  60. package/dist/dts/effect/internal/era/v9Runtime.d.ts.map +1 -0
  61. package/dist/dts/effect/internal/era.d.ts +117 -0
  62. package/dist/dts/effect/internal/era.d.ts.map +1 -0
  63. package/dist/dts/effect/internal/eraFreeSurface.d.ts +49 -0
  64. package/dist/dts/effect/internal/eraFreeSurface.d.ts.map +1 -0
  65. package/dist/dts/effect/internal/eraNeutralSurface.d.ts +35 -0
  66. package/dist/dts/effect/internal/eraNeutralSurface.d.ts.map +1 -0
  67. package/dist/dts/effect/internal/executable.d.ts +371 -0
  68. package/dist/dts/effect/internal/executable.d.ts.map +1 -0
  69. package/dist/dts/effect/internal/ledger/binding.d.ts +2 -0
  70. package/dist/dts/effect/internal/ledger/binding.d.ts.map +1 -0
  71. package/dist/dts/effect/internal/ledger/conformance.d.ts +2 -0
  72. package/dist/dts/effect/internal/ledger/conformance.d.ts.map +1 -0
  73. package/dist/dts/effect/internal/ledger/conversions.d.ts +167 -0
  74. package/dist/dts/effect/internal/ledger/conversions.d.ts.map +1 -0
  75. package/dist/dts/effect/internal/ledger/current.d.ts +8 -0
  76. package/dist/dts/effect/internal/ledger/current.d.ts.map +1 -0
  77. package/dist/dts/effect/internal/ledger/v8.d.ts +100 -0
  78. package/dist/dts/effect/internal/ledger/v8.d.ts.map +1 -0
  79. package/dist/dts/effect/internal/ledger/v9.d.ts +66 -0
  80. package/dist/dts/effect/internal/ledger/v9.d.ts.map +1 -0
  81. package/dist/dts/effect/internal/runtime/binding.d.ts +2 -0
  82. package/dist/dts/effect/internal/runtime/binding.d.ts.map +1 -0
  83. package/dist/dts/effect/internal/runtime/conformance.d.ts +2 -0
  84. package/dist/dts/effect/internal/runtime/conformance.d.ts.map +1 -0
  85. package/dist/dts/effect/internal/runtime/current.d.ts +11 -0
  86. package/dist/dts/effect/internal/runtime/current.d.ts.map +1 -0
  87. package/dist/dts/effect/internal/runtime/execution.d.ts +176 -0
  88. package/dist/dts/effect/internal/runtime/execution.d.ts.map +1 -0
  89. package/dist/dts/effect/internal/runtime/v0_16.d.ts +169 -0
  90. package/dist/dts/effect/internal/runtime/v0_16.d.ts.map +1 -0
  91. package/dist/dts/effect/internal/runtime/v0_21.d.ts +81 -0
  92. package/dist/dts/effect/internal/runtime/v0_21.d.ts.map +1 -0
  93. package/dist/dts/effect/internal/typeAssertions.d.ts +2 -0
  94. package/dist/dts/effect/internal/typeAssertions.d.ts.map +1 -0
  95. package/dist/dts/index.d.ts +7 -0
  96. package/dist/dts/index.d.ts.map +1 -0
  97. package/dist/dts/v8/effect.d.ts +50 -0
  98. package/dist/dts/v8/effect.d.ts.map +1 -0
  99. package/dist/dts/v8/index.d.ts +10 -0
  100. package/dist/dts/v8/index.d.ts.map +1 -0
  101. package/dist/dts/v9/effect.d.ts +28 -0
  102. package/dist/dts/v9/effect.d.ts.map +1 -0
  103. package/dist/dts/v9/index.d.ts +16 -0
  104. package/dist/dts/v9/index.d.ts.map +1 -0
  105. package/dist/esm/effect/CompactContext.js +16 -0
  106. package/dist/esm/effect/CompactContext.js.map +1 -0
  107. package/dist/esm/effect/CompactRuntime.js +44 -0
  108. package/dist/esm/effect/CompactRuntime.js.map +1 -0
  109. package/dist/esm/effect/CompiledContract.js +102 -0
  110. package/dist/esm/effect/CompiledContract.js.map +1 -0
  111. package/dist/esm/effect/Contract.js +40 -0
  112. package/dist/esm/effect/Contract.js.map +1 -0
  113. package/dist/esm/effect/ContractConfigurationError.js +41 -0
  114. package/dist/esm/effect/ContractConfigurationError.js.map +1 -0
  115. package/dist/esm/effect/ContractEventStore.js +150 -0
  116. package/dist/esm/effect/ContractEventStore.js.map +1 -0
  117. package/dist/esm/effect/ContractEventValidationError.js +40 -0
  118. package/dist/esm/effect/ContractEventValidationError.js.map +1 -0
  119. package/dist/esm/effect/ContractEventValidator.js +49 -0
  120. package/dist/esm/effect/ContractEventValidator.js.map +1 -0
  121. package/dist/esm/effect/ContractExecutable.js +50 -0
  122. package/dist/esm/effect/ContractExecutable.js.map +1 -0
  123. package/dist/esm/effect/ContractExecutableRuntime.js +17 -0
  124. package/dist/esm/effect/ContractExecutableRuntime.js.map +1 -0
  125. package/dist/esm/effect/ContractKeyLocation.js +67 -0
  126. package/dist/esm/effect/ContractKeyLocation.js.map +1 -0
  127. package/dist/esm/effect/ContractLog.js +268 -0
  128. package/dist/esm/effect/ContractLog.js.map +1 -0
  129. package/dist/esm/effect/ContractRuntimeError.js +40 -0
  130. package/dist/esm/effect/ContractRuntimeError.js.map +1 -0
  131. package/dist/esm/effect/Ledger.js +115 -0
  132. package/dist/esm/effect/Ledger.js.map +1 -0
  133. package/dist/esm/effect/MalformedHexPrefixError.js +43 -0
  134. package/dist/esm/effect/MalformedHexPrefixError.js.map +1 -0
  135. package/dist/esm/effect/ZKConfiguration.js +23 -0
  136. package/dist/esm/effect/ZKConfiguration.js.map +1 -0
  137. package/dist/esm/effect/ZKConfigurationReadError.js +46 -0
  138. package/dist/esm/effect/ZKConfigurationReadError.js.map +1 -0
  139. package/dist/esm/effect/ZKManifest.js +286 -0
  140. package/dist/esm/effect/ZKManifest.js.map +1 -0
  141. package/dist/esm/effect/ZKManifestError.js +40 -0
  142. package/dist/esm/effect/ZKManifestError.js.map +1 -0
  143. package/dist/esm/effect/index.js +36 -0
  144. package/dist/esm/effect/index.js.map +1 -0
  145. package/dist/esm/effect/internal/boundary.js +61 -0
  146. package/dist/esm/effect/internal/boundary.js.map +1 -0
  147. package/dist/esm/effect/internal/compactContext.js +52 -0
  148. package/dist/esm/effect/internal/compactContext.js.map +1 -0
  149. package/dist/esm/effect/internal/contractEventsSurface.js +57 -0
  150. package/dist/esm/effect/internal/contractEventsSurface.js.map +1 -0
  151. package/dist/esm/effect/internal/era/v8Executable.js +31 -0
  152. package/dist/esm/effect/internal/era/v8Executable.js.map +1 -0
  153. package/dist/esm/effect/internal/era/v8Ledger.js +85 -0
  154. package/dist/esm/effect/internal/era/v8Ledger.js.map +1 -0
  155. package/dist/esm/effect/internal/era/v8Runtime.js +39 -0
  156. package/dist/esm/effect/internal/era/v8Runtime.js.map +1 -0
  157. package/dist/esm/effect/internal/era/v9Executable.js +31 -0
  158. package/dist/esm/effect/internal/era/v9Executable.js.map +1 -0
  159. package/dist/esm/effect/internal/era/v9Ledger.js +83 -0
  160. package/dist/esm/effect/internal/era/v9Ledger.js.map +1 -0
  161. package/dist/esm/effect/internal/era/v9Runtime.js +28 -0
  162. package/dist/esm/effect/internal/era/v9Runtime.js.map +1 -0
  163. package/dist/esm/effect/internal/era.js +16 -0
  164. package/dist/esm/effect/internal/era.js.map +1 -0
  165. package/dist/esm/effect/internal/eraFreeSurface.js +63 -0
  166. package/dist/esm/effect/internal/eraFreeSurface.js.map +1 -0
  167. package/dist/esm/effect/internal/eraNeutralSurface.js +49 -0
  168. package/dist/esm/effect/internal/eraNeutralSurface.js.map +1 -0
  169. package/dist/esm/effect/internal/executable.js +531 -0
  170. package/dist/esm/effect/internal/executable.js.map +1 -0
  171. package/dist/esm/effect/internal/ledger/binding.js +20 -0
  172. package/dist/esm/effect/internal/ledger/binding.js.map +1 -0
  173. package/dist/esm/effect/internal/ledger/conformance.js +16 -0
  174. package/dist/esm/effect/internal/ledger/conformance.js.map +1 -0
  175. package/dist/esm/effect/internal/ledger/conversions.js +119 -0
  176. package/dist/esm/effect/internal/ledger/conversions.js.map +1 -0
  177. package/dist/esm/effect/internal/ledger/current.js +22 -0
  178. package/dist/esm/effect/internal/ledger/current.js.map +1 -0
  179. package/dist/esm/effect/internal/ledger/v8.js +101 -0
  180. package/dist/esm/effect/internal/ledger/v8.js.map +1 -0
  181. package/dist/esm/effect/internal/ledger/v9.js +91 -0
  182. package/dist/esm/effect/internal/ledger/v9.js.map +1 -0
  183. package/dist/esm/effect/internal/runtime/binding.js +16 -0
  184. package/dist/esm/effect/internal/runtime/binding.js.map +1 -0
  185. package/dist/esm/effect/internal/runtime/conformance.js +16 -0
  186. package/dist/esm/effect/internal/runtime/conformance.js.map +1 -0
  187. package/dist/esm/effect/internal/runtime/current.js +25 -0
  188. package/dist/esm/effect/internal/runtime/current.js.map +1 -0
  189. package/dist/esm/effect/internal/runtime/execution.js +16 -0
  190. package/dist/esm/effect/internal/runtime/execution.js.map +1 -0
  191. package/dist/esm/effect/internal/runtime/v0_16.js +178 -0
  192. package/dist/esm/effect/internal/runtime/v0_16.js.map +1 -0
  193. package/dist/esm/effect/internal/runtime/v0_21.js +129 -0
  194. package/dist/esm/effect/internal/runtime/v0_21.js.map +1 -0
  195. package/dist/esm/effect/internal/typeAssertions.js +16 -0
  196. package/dist/esm/effect/internal/typeAssertions.js.map +1 -0
  197. package/dist/esm/index.js +21 -0
  198. package/dist/esm/index.js.map +1 -0
  199. package/dist/esm/package.json +4 -0
  200. package/dist/esm/v8/effect.js +64 -0
  201. package/dist/esm/v8/effect.js.map +1 -0
  202. package/dist/esm/v8/index.js +24 -0
  203. package/dist/esm/v8/index.js.map +1 -0
  204. package/dist/esm/v9/effect.js +47 -0
  205. package/dist/esm/v9/effect.js.map +1 -0
  206. package/dist/esm/v9/index.js +30 -0
  207. package/dist/esm/v9/index.js.map +1 -0
  208. package/effect/CompactContext/package.json +5 -0
  209. package/effect/CompactRuntime/package.json +5 -0
  210. package/effect/CompiledContract/package.json +5 -0
  211. package/effect/Contract/package.json +5 -0
  212. package/effect/ContractConfigurationError/package.json +5 -0
  213. package/effect/ContractEventStore/package.json +5 -0
  214. package/effect/ContractEventValidationError/package.json +5 -0
  215. package/effect/ContractEventValidator/package.json +5 -0
  216. package/effect/ContractExecutable/package.json +5 -0
  217. package/effect/ContractExecutableRuntime/package.json +5 -0
  218. package/effect/ContractKeyLocation/package.json +5 -0
  219. package/effect/ContractLog/package.json +5 -0
  220. package/effect/ContractRuntimeError/package.json +5 -0
  221. package/effect/Ledger/package.json +5 -0
  222. package/effect/MalformedHexPrefixError/package.json +5 -0
  223. package/effect/ZKConfiguration/package.json +5 -0
  224. package/effect/ZKConfigurationReadError/package.json +5 -0
  225. package/effect/ZKManifest/package.json +5 -0
  226. package/effect/ZKManifestError/package.json +5 -0
  227. package/effect/index/package.json +5 -0
  228. package/effect/package.json +5 -0
  229. package/package.json +220 -4
  230. package/v8/effect/package.json +5 -0
  231. package/v8/package.json +5 -0
  232. package/v9/effect/package.json +5 -0
  233. package/v9/package.json +5 -0
@@ -0,0 +1,167 @@
1
+ import { type SigningKey as PlatformSigningKey } from '@midnight-ntwrk/platform-js/effect/SigningKey';
2
+ import { type Effect, Either } from 'effect';
3
+ import * as ContractConfigurationError from '../../ContractConfigurationError.js';
4
+ import type * as ContractRuntimeError from '../../ContractRuntimeError.js';
5
+ import { tryBoundary as tryConvert } from '../boundary.js';
6
+ import { type RuntimeLine } from '../era.js';
7
+ /**
8
+ * The runtime↔ledger conversions, as a **factory over an era pair** rather than a module bound to
9
+ * one era (midnight-sdk#387/#388).
10
+ *
11
+ * @remarks
12
+ * `Ledger.ts` used to define these directly against `internal/ledger/current.js`, which made the
13
+ * facade a module singleton: every entry — `/effect`, `/v9/effect`, and any future `/v8/effect` —
14
+ * resolves the same `Ledger.ts` instance, so an era-suffixed subpath could only ever *label* the
15
+ * one bound era rather than select it. Moving the bodies here means a second era can be
16
+ * instantiated alongside the first.
17
+ *
18
+ * Types are derived from the supplied bindings by indexed access (`ReturnType`,
19
+ * `InstanceType`, …) rather than declared, so each instantiation keeps its own era's concrete
20
+ * types with no casts and no `unknown` leaking into the facade. That is the same technique the
21
+ * relational binding contract uses, for the same reason: the era packages' declarations stay
22
+ * authoritative.
23
+ *
24
+ * Taking *both* bindings in one call is deliberate. The ledger era and the compact-runtime line
25
+ * are era-paired, and until now nothing in the type system tied them together — the two
26
+ * `current.ts` files were independent, and only `CompactRuntime.test.ts` checked at run time that
27
+ * they agreed. A conversion here needs both halves, so a mismatched pair now fails to construct.
28
+ *
29
+ * This docblock carries no internal-marker JSDoc tag. A module docblock attaches to the file's
30
+ * first declaration, so under `stripInternal` the marker deleted {@link ConversionLedger} from the
31
+ * emitted typings while `makeConversions`' own declaration went on naming it in its constraint —
32
+ * which is exactly the failure the note on that interface says the export exists to prevent.
33
+ * Privacy comes from `package.json` `exports` blocking `./effect/internal/*` instead. See
34
+ * `internal/boundary.ts` for why this note does not spell the tag out.
35
+ */
36
+ /** The ledger-binding members the conversions need. Narrow on purpose: this is not the whole binding. */
37
+ export interface ConversionLedger {
38
+ readonly era: {
39
+ /**
40
+ * The compact-runtime line this ledger era pairs with. Present so {@link makeConversions} can
41
+ * require the runtime half to *be* that line — see its `R` constraint.
42
+ */
43
+ readonly runtime: RuntimeLine;
44
+ readonly supportsCmaSignatureKind: (kind: never) => boolean;
45
+ readonly cmaSignatureKindsDescription: string;
46
+ };
47
+ readonly makeSigningKey: (signingKey: PlatformSigningKey) => unknown;
48
+ readonly ContractState: {
49
+ deserialize(raw: Uint8Array): Serializable;
50
+ };
51
+ readonly LedgerParameters: {
52
+ deserialize(raw: Uint8Array): unknown;
53
+ };
54
+ readonly ContractMaintenanceAuthority: {
55
+ deserialize(raw: Uint8Array): unknown;
56
+ };
57
+ readonly StateValue: {
58
+ decode(value: never): unknown;
59
+ };
60
+ readonly ChargedState: new (state: never) => unknown;
61
+ readonly QueryContext: new (state: never, address: never) => unknown;
62
+ }
63
+ /** The runtime-binding members the conversions need. */
64
+ export interface ConversionRuntime {
65
+ /** The line this binding speaks, checked against the ledger half's `era.runtime`. */
66
+ readonly line: RuntimeLine;
67
+ readonly ContractState: {
68
+ deserialize(raw: Uint8Array): Serializable;
69
+ };
70
+ readonly ContractMaintenanceAuthority: {
71
+ deserialize(raw: Uint8Array): Serializable;
72
+ };
73
+ }
74
+ /**
75
+ * A serializable value — every ledger and runtime handle the conversions cross exposes this.
76
+ *
77
+ * Exported because it appears in the conversions' inferred signatures, which `Ledger.ts`
78
+ * re-exports; a module-private name there fails declaration emit (TS4023).
79
+ */
80
+ export interface Serializable {
81
+ serialize(): Uint8Array;
82
+ }
83
+ /**
84
+ * Wraps a call across the ledger (WASM) boundary so a rejection becomes a typed failure rather
85
+ * than a defect. This is `internal/boundary.ts`'s `tryBoundary` under the name the ledger side
86
+ * knows it by.
87
+ *
88
+ * @remarks
89
+ * Era-independent, so it lives outside {@link makeConversions}: ledger bindings signal rejection by
90
+ * throwing, and a throw inside `Effect.gen` or a bare `Effect.map` callback becomes a defect that
91
+ * escapes the caller's typed error handling.
92
+ *
93
+ * Re-exported rather than defined here so that both seams share *one* copy of the boundary
94
+ * handling — the compact-runtime seam exposes the same function as `CompactRuntime.tryRuntime`,
95
+ * and `CompactRuntime.test.ts` asserts the two are identical. A second definition also loses
96
+ * `tryBoundary`'s constraint rejecting an `async` thunk, which is the defect the wrapper exists to
97
+ * prevent.
98
+ *
99
+ * @category combinators
100
+ */
101
+ export { tryConvert };
102
+ /**
103
+ * Builds the runtime↔ledger conversions for one era pair.
104
+ *
105
+ * @param ledger The era's ledger binding (`v8.ts`, `v9.ts`, …).
106
+ * @param runtime The compact-runtime binding that era pairs with (`v0_16.ts`, `v0_21.ts`, …).
107
+ *
108
+ * @category constructors
109
+ */
110
+ export declare const makeConversions: <L extends ConversionLedger, R extends ConversionRuntime & {
111
+ readonly line: L["era"]["runtime"];
112
+ }>(ledger: L, runtime: R) => {
113
+ /** Converts a runtime contract state to this era's ledger `ContractState`. @category conversions */
114
+ fromRuntimeContractState: (contractState: ReturnType<R["ContractState"]["deserialize"]>) => Effect.Effect<ReturnType<L["ContractState"]["deserialize"]>, ContractRuntimeError.ContractRuntimeError>;
115
+ /** Converts this era's ledger `ContractState` to a runtime contract state. @category conversions */
116
+ toRuntimeContractState: (contractState: ReturnType<L["ContractState"]["deserialize"]>) => Effect.Effect<ReturnType<R["ContractState"]["deserialize"]>, ContractRuntimeError.ContractRuntimeError>;
117
+ /** Deserializes ledger-serialized bytes into this era's `ContractState`. @category conversions */
118
+ contractStateFromBytes: (bytes: Uint8Array) => Effect.Effect<ReturnType<L["ContractState"]["deserialize"]>, ContractRuntimeError.ContractRuntimeError>;
119
+ /** Deserializes ledger-serialized bytes into this era's `LedgerParameters`. @category conversions */
120
+ parametersFromBytes: (bytes: Uint8Array) => Effect.Effect<ReturnType<L["LedgerParameters"]["deserialize"]>, ContractRuntimeError.ContractRuntimeError>;
121
+ /**
122
+ * Converts a runtime contract maintenance authority to this era's ledger one.
123
+ * @category conversions
124
+ */
125
+ fromRuntimeMaintenanceAuthority: (authority: ReturnType<R["ContractMaintenanceAuthority"]["deserialize"]>) => Effect.Effect<ReturnType<L["ContractMaintenanceAuthority"]["deserialize"]>, ContractRuntimeError.ContractRuntimeError>;
126
+ /** Converts a runtime `StateValue` to this era's, via the shared binary encoding. @category conversions */
127
+ fromRuntimeStateValue: (value: {
128
+ encode(): unknown;
129
+ }) => Effect.Effect<ReturnType<L["StateValue"]["decode"]>, ContractRuntimeError.ContractRuntimeError>;
130
+ /**
131
+ * Converts a runtime `QueryContext` to this era's, carrying `state`, `address`, `block`,
132
+ * `effects` and the commitment indices (`comIndices`).
133
+ *
134
+ * @remarks
135
+ * `comIndices` is declared `readonly` and is only *writable* via `insertCommitment`, but it is
136
+ * carried here by the `block` assignment: the commitment map is part of the block-level call
137
+ * context, so assigning `block` restores it. Verified by `test/effect/Ledger.test.ts` — do not
138
+ * "fix" the apparent gap by re-inserting the entries, which would union two commitment sets at
139
+ * any call site that also supplies its own (see `ContractExecutable.partitionAllTranscripts`).
140
+ *
141
+ * @category conversions
142
+ */
143
+ fromRuntimeQueryContext: (queryContext: {
144
+ readonly state: {
145
+ readonly state: {
146
+ encode(): unknown;
147
+ };
148
+ };
149
+ readonly address: unknown;
150
+ block: unknown;
151
+ effects: unknown;
152
+ }) => Effect.Effect<InstanceType<L["QueryContext"]>, ContractRuntimeError.ContractRuntimeError>;
153
+ /**
154
+ * Adapts a platform-js signing key to this era's ledger `SigningKey`, failing when the scheme
155
+ * is not supported by the era's CMA path.
156
+ *
157
+ * @remarks
158
+ * The two halves live in different places on purpose. Admissibility is era-neutral policy and
159
+ * stays here: a scheme outside the era's allowlist fails rather than being silently coerced.
160
+ * The key's *shape* is era-varying — ledger 9 tags each key, ledger 8 uses a bare hex string —
161
+ * so construction is delegated to the binding's `makeSigningKey`.
162
+ *
163
+ * @category conversions
164
+ */
165
+ fromPlatformSigningKey: (signingKey: PlatformSigningKey, contractState?: ReturnType<R["ContractState"]["deserialize"]>) => Either.Either<ReturnType<L["makeSigningKey"]>, ContractConfigurationError.ContractConfigurationError>;
166
+ };
167
+ //# sourceMappingURL=conversions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversions.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/ledger/conversions.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The era currently bound to this build. Every entry — suffixed and unsuffixed — resolves the
3
+ * `Ledger` facade through this one module, so changing the export below changes the era for ALL
4
+ * of them, `/v9` included. Giving each era-pinned entry its own binding is the outstanding work
5
+ * (midnight-sdk#388).
6
+ */
7
+ export * from './v9.js';
8
+ //# sourceMappingURL=current.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"current.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/ledger/current.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,cAAc,SAAS,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The ledger 8 era binding. This module (together with its peers under `internal/ledger`) is the
3
+ * only place in `src/` that may import from a `@midnightntwrk/ledger-v<N>` package; everything else
4
+ * goes through the `Ledger` facade, or through the era-pinned `internal/era/v8Ledger.ts` that
5
+ * `/v8/effect` exports. ESLint enforces this (`no-restricted-imports`); tests are exempt by design,
6
+ * since some must compare ledger module identity.
7
+ *
8
+ * @remarks
9
+ * How the v8 surface differs from v9, against `@midnightntwrk/ledger-v8@8.1.3`:
10
+ *
11
+ * - Every name the facade re-exports is present on v8; nothing was added between v8 and v9 that the
12
+ * facade depends on.
13
+ * - `SigningKey` is a bare `string` on v8, against `{ tag, value }` on v9, and `sampleSigningKey()`
14
+ * takes no argument (v9 takes an optional `SignatureKind`). v8 has no `SignatureKind` concept at
15
+ * all: its keys are BIP-340 only. This is the one difference that reaches the public API, via
16
+ * `Ledger.fromPlatformSigningKey`'s return type — see the note on {@link era} below.
17
+ * - `ContractOperationVersion` accepts only `'v3'` on v8 (`'v3' | 'v4'` on v9, which binds `'v4'`),
18
+ * which is why each binding owns its `CONTRACT_OPERATION_VERSION`.
19
+ */
20
+ import { type SignatureKind, type SigningKey as PlatformSigningKey } from '@midnight-ntwrk/platform-js/effect/SigningKey';
21
+ import { ContractMaintenanceAuthority as LedgerContractMaintenanceAuthority, ContractOperationVersion, ContractOperationVersionedVerifierKey, CostModel as LedgerCostModel, type SignatureVerifyingKey, type SigningKey as LedgerSigningKey } from '@midnightntwrk/ledger-v8';
22
+ import { type EraBranded } from '../era.js';
23
+ export { type Binding, type Bindingish, ChargedState, communicationCommitmentRandomness, type ContractAction, ContractCall, ContractCallPrototype, ContractDeploy, type ContractOperation, type ContractOperationVersion, type ContractOperationVersionedVerifierKey, ContractState, DustActions, Intent, LedgerParameters, MaintenanceUpdate, type NoBinding, type NoProof, partitionTranscripts, type PreBinding, type PreProof, PreTranscript, type Proof, type Proofish, type ProvingKeyMaterial, type ProvingProvider, QueryContext, ReplaceAuthority, type SignatureEnabled, type SignatureErased, type Signaturish, signData, type SigningKey, type SingleUpdate, StateValue, Transaction, type Transcript, type UnprovenIntent, type UnprovenOffer, type UnprovenTransaction, UnshieldedOffer, VerifierKeyInsert, VerifierKeyRemove, ZswapOffer } from '@midnightntwrk/ledger-v8';
24
+ /**
25
+ * Ledger 8's `ContractMaintenanceAuthority`, with `deserialize`'s return type repaired.
26
+ *
27
+ * @remarks
28
+ * `@midnightntwrk/ledger-v8@8.1.2` declares `static deserialize(raw: Uint8Array): ContractState` —
29
+ * an upstream mistake in the generated `.d.ts`. The WASM really returns a
30
+ * `ContractMaintenanceAuthority` (verified against 8.1.2: `deserialize(cma.serialize())` yields a
31
+ * value whose constructor is `ContractMaintenanceAuthority`, and which fails
32
+ * `instanceof ContractState`). Repaired here, at the seam, so every era presents the same
33
+ * relationship to `Ledger.fromRuntimeMaintenanceAuthority` and no call site has to know.
34
+ *
35
+ * Do not drop this in a routine "remove redundant cast" pass: `LedgerBindingViolations` fails the
36
+ * build without it, naming the broken round-trip. Re-check it on each v8 patch release — if
37
+ * upstream fixes the declaration, the cast becomes a no-op and can go.
38
+ */
39
+ declare const ContractMaintenanceAuthority: {
40
+ new (committee: SignatureVerifyingKey[], threshold: number, counter?: bigint): LedgerContractMaintenanceAuthority;
41
+ deserialize(raw: Uint8Array): LedgerContractMaintenanceAuthority;
42
+ };
43
+ export { ContractMaintenanceAuthority };
44
+ /** Ledger 8's `ContractMaintenanceAuthority` instance type, unaffected by the repair above. */
45
+ export type ContractMaintenanceAuthority = LedgerContractMaintenanceAuthority;
46
+ /** Ledger 8's `CostModel`, era-branded. See the v9 twin for why. @category era */
47
+ export type CostModel = EraBranded<LedgerCostModel, 8>;
48
+ declare const CostModel: {
49
+ initialCostModel(): CostModel;
50
+ };
51
+ export { CostModel };
52
+ /**
53
+ * The ledger 8 {@link Era} descriptor.
54
+ *
55
+ * @remarks
56
+ * `supportsCmaSignatureKind` carries real weight here rather than being a formality: an ECDSA key
57
+ * configured against a v8 build has no representation in this era's `SigningKey` at all, so it must
58
+ * be rejected at the descriptor rather than coerced into a bare hex string.
59
+ *
60
+ * The key's *shape* is deliberately not expressed here: `Era` describes which *schemes* an era
61
+ * allows, not what its `SigningKey` looks like. That half lives in the binding instead —
62
+ * `fromPlatformSigningKey` splits, keeping the era-neutral allowlist check in `conversions.ts` and
63
+ * delegating construction to this module's {@link makeSigningKey}, which returns the bare `value`
64
+ * where v9 returns `{ tag, value }`.
65
+ */
66
+ export declare const era: {
67
+ readonly ledger: 8;
68
+ readonly runtime: "0.16";
69
+ readonly supportsCmaSignatureKind: (kind: SignatureKind) => boolean;
70
+ readonly cmaSignatureKindsDescription: string;
71
+ readonly defaultCmaSignatureKind: "schnorr";
72
+ };
73
+ /**
74
+ * Creates the {@link ContractOperationVersion} for this era.
75
+ *
76
+ * @category constructors
77
+ */
78
+ export declare const makeContractOperationVersion: () => ContractOperationVersion;
79
+ /**
80
+ * Creates a {@link ContractOperationVersionedVerifierKey} for `verifierKey` at this era's
81
+ * operation version.
82
+ *
83
+ * @category constructors
84
+ */
85
+ export declare const makeVersionedVerifierKey: (verifierKey: Uint8Array) => ContractOperationVersionedVerifierKey;
86
+ /**
87
+ * Adapts a platform-js signing key to ledger 8's `SigningKey`.
88
+ *
89
+ * @remarks
90
+ * This is the one era difference that reaches compact-js's public API. Ledger 8 has no tagged-key
91
+ * concept — its keys are BIP-340 only and `SigningKey` is a bare hex `string` — so the platform
92
+ * key's `tag` is *dropped* rather than carried, and only its `value` survives. Dropping it is safe
93
+ * only because {@link era}'s allowlist has already rejected every scheme but `schnorr` by the time
94
+ * `Ledger.fromPlatformSigningKey` calls this; an ECDSA key has no representation here at all and
95
+ * must never reach this function.
96
+ *
97
+ * @category constructors
98
+ */
99
+ export declare const makeSigningKey: (signingKey: PlatformSigningKey) => LedgerSigningKey;
100
+ //# sourceMappingURL=v8.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v8.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/ledger/v8.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,UAAU,IAAI,kBAAkB,EACtC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,4BAA4B,IAAI,kCAAkC,EAClE,wBAAwB,EACxB,qCAAqC,EACrC,SAAS,IAAI,eAAe,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,UAAU,IAAI,gBAAgB,EACpC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAKtD,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,YAAY,EACZ,iCAAiC,EACjC,KAAK,cAAc,EACnB,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,qCAAqC,EAC1C,aAAa,EACb,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,aAAa,EACb,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,YAAY,EACZ,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,UAAU,EACV,WAAW,EACX,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACX,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,4BAA4B,EAAoD;IACpF,KAAK,SAAS,EAAE,qBAAqB,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,kCAAkC,CAAC;IAClH,WAAW,CAAC,GAAG,EAAE,UAAU,GAAG,kCAAkC,CAAC;CAClE,CAAC;AAEF,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAExC,+FAA+F;AAC/F,MAAM,MAAM,4BAA4B,GAAG,kCAAkC,CAAC;AAE9E,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;AAEvD,QAAA,MAAM,SAAS,EAAiC;IAAE,gBAAgB,IAAI,SAAS,CAAA;CAAE,CAAC;AAElF,OAAO,EAAE,SAAS,EAAE,CAAC;AAcrB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,GAAG;;;8CAGmB,aAAa;;;CAGxB,CAAC;AASzB;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,QAAO,wBACU,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,aAAa,UAAU,KAAG,qCACiB,CAAC;AAErF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,GAAI,YAAY,kBAAkB,KAAG,gBAAoC,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The ledger 9 era binding. This module (together with its peers under `internal/ledger`) is the
3
+ * only place in `src/` that may import from a `@midnightntwrk/ledger-v<N>` package; everything
4
+ * else goes through the `Ledger` facade so that a future era binds by swapping `current.ts`, not
5
+ * by editing call sites (midnight-sdk#387). ESLint enforces this (`no-restricted-imports`); tests
6
+ * are exempt by design, since some must compare ledger module identity.
7
+ */
8
+ import { type SignatureKind, type SigningKey as PlatformSigningKey } from '@midnight-ntwrk/platform-js/effect/SigningKey';
9
+ import { ContractOperationVersion, ContractOperationVersionedVerifierKey, CostModel as LedgerCostModel, type SigningKey as LedgerSigningKey } from '@midnightntwrk/ledger-v9';
10
+ import { type EraBranded } from '../era.js';
11
+ export { type Binding, type Bindingish, ChargedState, communicationCommitmentRandomness, type ContractAction, ContractCall, ContractCallPrototype, ContractDeploy, ContractMaintenanceAuthority, type ContractOperation, type ContractOperationVersion, type ContractOperationVersionedVerifierKey, ContractState, DustActions, Intent, LedgerParameters, MaintenanceUpdate, type NoBinding, type NoProof, partitionTranscripts, type PreBinding, type PreProof, PreTranscript, type Proof, type Proofish, type ProvingKeyMaterial, type ProvingProvider, QueryContext, ReplaceAuthority, type SignatureEnabled, type SignatureErased, type Signaturish, signData, type SigningKey, type SingleUpdate, StateValue, Transaction, type Transcript, type UnprovenIntent, type UnprovenOffer, type UnprovenTransaction, UnshieldedOffer, VerifierKeyInsert, VerifierKeyRemove, ZswapOffer } from '@midnightntwrk/ledger-v9';
12
+ /**
13
+ * This era's `CostModel`, branded with its ledger major.
14
+ *
15
+ * @remarks
16
+ * The one name here with no nominal separation of its own, so without a brand a consumer holding
17
+ * both entries can cross the eras. Branding is a *cast*, not a wrapper: the value stays the
18
+ * ledger's own class object, which `LedgerEra.test.ts` asserts by identity. It must also be the
19
+ * ledger's rather than onchain-runtime's identical one, kept off that seam by its conformance.
20
+ *
21
+ * @category era
22
+ */
23
+ export type CostModel = EraBranded<LedgerCostModel, 9>;
24
+ declare const CostModel: {
25
+ initialCostModel(): CostModel;
26
+ };
27
+ export { CostModel };
28
+ /** The ledger 9 {@link Era} descriptor. @category era */
29
+ export declare const era: {
30
+ readonly ledger: 9;
31
+ readonly runtime: "0.21";
32
+ readonly supportsCmaSignatureKind: (kind: SignatureKind) => boolean;
33
+ readonly cmaSignatureKindsDescription: string;
34
+ readonly defaultCmaSignatureKind: "schnorr";
35
+ };
36
+ /**
37
+ * Creates the {@link ContractOperationVersion} for this era. The version literal lives here so it
38
+ * cannot leak into era-neutral code.
39
+ *
40
+ * @category constructors
41
+ */
42
+ export declare const makeContractOperationVersion: () => ContractOperationVersion;
43
+ /**
44
+ * Creates a {@link ContractOperationVersionedVerifierKey} for `verifierKey` at this era's
45
+ * operation version.
46
+ *
47
+ * @category constructors
48
+ */
49
+ export declare const makeVersionedVerifierKey: (verifierKey: Uint8Array) => ContractOperationVersionedVerifierKey;
50
+ /**
51
+ * Adapts a platform-js signing key to ledger 9's `SigningKey`.
52
+ *
53
+ * @remarks
54
+ * Ledger 9 keys are tagged (`{ tag, value }`) and, as of platform-js@3.0.0, structurally identical
55
+ * to platform-js's — so this is a field copy rather than a conversion. It is still the binding's
56
+ * job: ledger 8 represents the same key as a bare hex string, so an era-neutral facade cannot know
57
+ * the shape. The caller-supplied `tag` is preserved so an ECDSA-tagged key is never silently
58
+ * treated as Schnorr.
59
+ *
60
+ * Scheme admissibility is *not* checked here — that is era-neutral policy and stays in
61
+ * `Ledger.fromPlatformSigningKey`, which consults {@link era}'s allowlist before calling this.
62
+ *
63
+ * @category constructors
64
+ */
65
+ export declare const makeSigningKey: (signingKey: PlatformSigningKey) => LedgerSigningKey;
66
+ //# sourceMappingURL=v9.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v9.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/ledger/v9.ts"],"names":[],"mappings":"AAeA;;;;;;GAMG;AACH,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,UAAU,IAAI,kBAAkB,EACtC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,wBAAwB,EACxB,qCAAqC,EACrC,SAAS,IAAI,eAAe,EAC5B,KAAK,UAAU,IAAI,gBAAgB,EACpC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAUtD,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,YAAY,EACZ,iCAAiC,EACjC,KAAK,cAAc,EACnB,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,4BAA4B,EAC5B,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,qCAAqC,EAC1C,aAAa,EACb,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,oBAAoB,EACpB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,aAAa,EACb,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,YAAY,EACZ,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,UAAU,EACV,WAAW,EACX,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACX,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;AAEvD,QAAA,MAAM,SAAS,EAAiC;IAAE,gBAAgB,IAAI,SAAS,CAAA;CAAE,CAAC;AAElF,OAAO,EAAE,SAAS,EAAE,CAAC;AAmBrB,yDAAyD;AACzD,eAAO,MAAM,GAAG;;;8CAMmB,aAAa;;;CAGxB,CAAC;AAUzB;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,QAAO,wBACU,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,aAAa,UAAU,KAAG,qCACiB,CAAC;AAErF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,GAAI,YAAY,kBAAkB,KAAG,gBAG9D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=binding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/runtime/binding.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=conformance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/runtime/conformance.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The compact-runtime line currently bound to this build. Every entry — suffixed and unsuffixed —
3
+ * resolves the `CompactRuntime` facade through this one module, so changing the export below
4
+ * changes the runtime for ALL of them, `/v9` included. Giving each era-pinned entry its own
5
+ * binding is the outstanding work (midnight-sdk#388).
6
+ *
7
+ * Swap this together with `internal/ledger/current.ts`: the two are era-paired, and
8
+ * `test/effect/CompactRuntime.test.ts` fails if only one of them moves.
9
+ */
10
+ export * from './v0_21.js';
11
+ //# sourceMappingURL=current.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"current.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/runtime/current.ts"],"names":[],"mappings":"AAeA;;;;;;;;GAQG;AACH,cAAc,YAAY,CAAC"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * The era-neutral shape of "execute one circuit", declared above both runtime bindings so each can
3
+ * present the same view of a fundamentally different execution model (midnight-sdk#387).
4
+ *
5
+ * @remarks
6
+ * `ContractExecutable` used to speak compact-runtime 0.19's model directly: build a context with
7
+ * `createCircuitContext(circuitId, address, …)`, then read `context.callProofDataTrace`,
8
+ * `context.callContext` and `context.events`. None of that exists on 0.16 — it has one flat frame
9
+ * and hands proof data back on `results.proofData`.
10
+ *
11
+ * Rather than fork the executable per era, each binding implements two functions against the types
12
+ * here:
13
+ *
14
+ * - `createExecutionContext` — takes one set of named parameters, which each line maps onto its own
15
+ * entry point (0.21's options object, 0.16's positional arguments), and returns whatever context
16
+ * *that* line's generated contracts accept.
17
+ * - `readExecution` — projects the line's results into {@link ExecutionView}.
18
+ *
19
+ * The type parameters keep this file era-agnostic: each binding instantiates them with its own
20
+ * `QueryContext`, `AlignedValue` and so on, and the relational checks in `binding.ts` assert the
21
+ * instantiation is self-consistent. Deliberately structural — nothing here imports a runtime
22
+ * package, so this module stays above both seams.
23
+ *
24
+ * This docblock carries no internal-marker JSDoc tag. A module docblock attaches to the file's
25
+ * first declaration, so under `stripInternal` the marker deleted {@link CallProofDataView} from the
26
+ * emitted typings while `v0_16.d.ts` and `v0_21.d.ts` went on importing it — `.d.ts` files that
27
+ * only looked sound because most consumers build with `skipLibCheck`. Privacy comes from
28
+ * `package.json` `exports` blocking `./effect/internal/*` instead. See `internal/boundary.ts` for
29
+ * why this note does not spell the tag out.
30
+ */
31
+ /**
32
+ * One entry of an execution's call trace: the data needed to prove a single circuit call and to
33
+ * partition its transcript.
34
+ *
35
+ * @remarks
36
+ * Mirrors compact-runtime 0.21's `CallProofData` because that is the richer of the two models, so
37
+ * nothing is lost on the newer line. On 0.16 a single entry of this shape is *synthesised* from the
38
+ * flat frame, which is faithful rather than lossy: a line with no `crossContractCall` can only
39
+ * produce one call, so a one-element trace is complete by construction.
40
+ */
41
+ export interface CallProofDataView<QueryContext, AlignedValue, Op, EncodedZswapLocalState, CommunicationCommitmentData> {
42
+ readonly circuitId: string;
43
+ readonly contractAddress: string;
44
+ /**
45
+ * The contract's ledger state *before* the call.
46
+ *
47
+ * @remarks
48
+ * Must be captured at context construction, not read back afterwards. 0.16's flat context is
49
+ * mutated in place during execution, so reading `currentQueryContext` at the end would report
50
+ * the final state as the initial one and silently corrupt transcript partitioning.
51
+ */
52
+ readonly initialQueryContext: QueryContext;
53
+ /** The contract's ledger state after the call. */
54
+ readonly finalQueryContext: QueryContext;
55
+ readonly publicTranscript: readonly Op[];
56
+ readonly input: AlignedValue;
57
+ readonly output: AlignedValue;
58
+ readonly privateTranscriptOutputs: readonly AlignedValue[];
59
+ readonly zswapLocalState: EncodedZswapLocalState;
60
+ /** Present only when this call was a cross-contract sub-call, so never on ledger 8. */
61
+ readonly commCommData?: CommunicationCommitmentData | undefined;
62
+ }
63
+ /**
64
+ * The members of a line's query context that a call's transcript partition is built from.
65
+ *
66
+ * @remarks
67
+ * `ContractExecutable` republishes these four on every `ContractCallPublic` so a consumer can redo
68
+ * the partition itself — in a *different* ledger era, which is the case that matters. Across a
69
+ * hard-fork window a call executes on one era and composes on the next, so the partition that came
70
+ * out of the executing era is the wrong one, and the inputs needed to redo it in the right one were
71
+ * unreachable (midnight-sdk#400).
72
+ *
73
+ * Declared here structurally rather than taken from either line, and asserted against both by
74
+ * `conformance.ts`, because the public members are *derived* from {@link CallProofDataView}'s query
75
+ * context: a derivation that misses resolves to `never`, which is assignable to everything — so
76
+ * every call site would still compile and the member would simply be unusable. This is what turns
77
+ * that silent collapse into a build failure.
78
+ *
79
+ * `block`, `effects` and `comIndices` are plain data on every line compact-js binds, which is what
80
+ * lets them cross an era seam; {@link state} is not — it is a live handle, like the post-execution
81
+ * state `ContractCallPublic.contractState` already reports, and a consumer moving it across an era
82
+ * boundary has to encode it first.
83
+ */
84
+ export interface PartitionInputs {
85
+ /**
86
+ * The ledger state the call ran against, one level in (`state.state` is the value itself). Read
87
+ * from the **pre**-execution context.
88
+ *
89
+ * @remarks
90
+ * Required rather than incidental: the partitioner *replays* the transcript against this state to
91
+ * decide where the guaranteed section ends and to charge the ops, so it rejects a state the
92
+ * transcript's reads do not fit and mis-charges one that merely differs. It is listed here for
93
+ * the same reason as the other three — the public member is derived from this context, and a
94
+ * derivation that misses collapses to `never` in silence.
95
+ */
96
+ readonly state: {
97
+ readonly state: unknown;
98
+ };
99
+ /** The block-level call context. Read from the **pre**-execution context. */
100
+ readonly block: unknown;
101
+ /** The contract-external effects the call declared. Read from the **pre**-execution context. */
102
+ readonly effects: unknown;
103
+ /** The commitment indices the call discovered. Read from the **post**-execution context. */
104
+ readonly comIndices: unknown;
105
+ }
106
+ /**
107
+ * The result of executing one root circuit, as `ContractExecutable` consumes it.
108
+ *
109
+ * @remarks
110
+ * `result`, `privateState` and `zswapLocalState` belong to the root contract; `trace` covers every
111
+ * call made (callees first, root last), and `events` is the whole execution's log-event list.
112
+ *
113
+ * On a line that cannot emit events, `LogEvent` is instantiated as `never`, which makes `events`
114
+ * a `never[]` — statically empty rather than merely empty at run time. That is what lets the same
115
+ * `CallResult` type serve both eras while keeping the impossible case unconstructable.
116
+ */
117
+ export interface ExecutionView<Result, PrivateState, Trace, EncodedZswapLocalState, LogEvent, GasCosts> {
118
+ readonly result: Result;
119
+ readonly trace: readonly Trace[];
120
+ readonly privateState: PrivateState;
121
+ readonly zswapLocalState: EncodedZswapLocalState;
122
+ readonly events: readonly LogEvent[];
123
+ readonly gasCosts: GasCosts;
124
+ }
125
+ /**
126
+ * A gas figure in the four dimensions both lines model. The inward-facing twin of
127
+ * {@link PartitionInputs}: structural, so each binding's own call checks it against that line's
128
+ * `RunningCost`. Costs travelling *out* stay era-derived.
129
+ */
130
+ export interface GasCost {
131
+ readonly readTime: bigint;
132
+ readonly computeTime: bigint;
133
+ readonly bytesWritten: bigint;
134
+ readonly bytesDeleted: bigint;
135
+ }
136
+ /**
137
+ * Named parameters for building an execution context.
138
+ *
139
+ * @remarks
140
+ * Named rather than positional because the two lines disagree on shape — 0.21 takes one options
141
+ * object and 0.16 takes `(address, …)` positionally with no circuit id at all. A named object means
142
+ * adding an era cannot silently shift an argument into the wrong slot.
143
+ *
144
+ * `stateProvider` and `moduleProvider` exist only for cross-contract calls, and arrive together. A
145
+ * binding whose line has no `crossContractCall` must *reject* them, and a `parentBlockHash`, rather
146
+ * than ignore them: silently dropping a provider would make a cross-contract call appear to
147
+ * succeed against stale state.
148
+ */
149
+ export interface ExecutionContextParams<PrivateState, ContractState, EncodedZswapLocalState, ContractStateProvider, ContractModuleProvider> {
150
+ readonly circuitId: string;
151
+ readonly address: string;
152
+ readonly zswapLocalState: EncodedZswapLocalState;
153
+ readonly contractState: ContractState;
154
+ readonly privateState: PrivateState;
155
+ readonly stateProvider?: ContractStateProvider | undefined;
156
+ readonly moduleProvider?: ContractModuleProvider | undefined;
157
+ readonly parentBlockHash?: string | undefined;
158
+ /**
159
+ * The execution clock, in **seconds** since the Unix epoch — not milliseconds. Defaults to the
160
+ * wall clock (`Math.floor(Date.now() / 1_000)`) on both lines, so omitting it changes nothing.
161
+ *
162
+ * @remarks
163
+ * Lands in the query context's `block.secondsSinceEpoch`, which {@link PartitionInputs} puts on
164
+ * the public result — so without it every execution produces a `block` that differs on each run
165
+ * and no consumer can record a fixture (midnight-sdk#403).
166
+ *
167
+ * `ContractExecutable.circuit` supplies this from the effect's own `Clock`, converting from
168
+ * milliseconds at the call site. That is why there is no `time` on the public `CircuitContext`:
169
+ * `Clock` is a default Effect service, so a consumer pins the value with a layer and pays no new
170
+ * API for it, while the live clock reproduces the previous behaviour exactly. Add a per-call
171
+ * member only if something needs a *different* time per call — recording a fixture does not.
172
+ */
173
+ readonly time?: number | undefined;
174
+ readonly queryGasLimit?: GasCost | undefined;
175
+ }
176
+ //# sourceMappingURL=execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/runtime/execution.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB,CAAC,YAAY,EAAE,YAAY,EAAE,EAAE,EAAE,sBAAsB,EAAE,2BAA2B;IACpH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,EAAE,YAAY,CAAC;IAC3C,kDAAkD;IAClD,QAAQ,CAAC,iBAAiB,EAAE,YAAY,CAAC;IACzC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,EAAE,EAAE,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,wBAAwB,EAAE,SAAS,YAAY,EAAE,CAAC;IAC3D,QAAQ,CAAC,eAAe,EAAE,sBAAsB,CAAC;IACjD,uFAAuF;IACvF,QAAQ,CAAC,YAAY,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;CACjE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IAC5C,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,gGAAgG;IAChG,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,4FAA4F;IAC5F,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,QAAQ;IACpG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,sBAAsB,CAAC;IACjD,QAAQ,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,sBAAsB,CACrC,YAAY,EACZ,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB;IAEtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,eAAe,EAAE,sBAAsB,CAAC;IACjD,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,aAAa,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAC3D,QAAQ,CAAC,cAAc,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC7D,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAGnC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9C"}