@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.
- package/LICENSE +14 -0
- package/README.md +158 -2
- package/dist/dts/effect/CompactContext.d.ts +20 -0
- package/dist/dts/effect/CompactContext.d.ts.map +1 -0
- package/dist/dts/effect/CompactRuntime.d.ts +76 -0
- package/dist/dts/effect/CompactRuntime.d.ts.map +1 -0
- package/dist/dts/effect/CompiledContract.d.ts +107 -0
- package/dist/dts/effect/CompiledContract.d.ts.map +1 -0
- package/dist/dts/effect/Contract.d.ts +154 -0
- package/dist/dts/effect/Contract.d.ts.map +1 -0
- package/dist/dts/effect/ContractConfigurationError.d.ts +54 -0
- package/dist/dts/effect/ContractConfigurationError.d.ts.map +1 -0
- package/dist/dts/effect/ContractEventStore.d.ts +167 -0
- package/dist/dts/effect/ContractEventStore.d.ts.map +1 -0
- package/dist/dts/effect/ContractEventValidationError.d.ts +34 -0
- package/dist/dts/effect/ContractEventValidationError.d.ts.map +1 -0
- package/dist/dts/effect/ContractEventValidator.d.ts +18 -0
- package/dist/dts/effect/ContractEventValidator.d.ts.map +1 -0
- package/dist/dts/effect/ContractExecutable.d.ts +99 -0
- package/dist/dts/effect/ContractExecutable.d.ts.map +1 -0
- package/dist/dts/effect/ContractExecutableRuntime.d.ts +4 -0
- package/dist/dts/effect/ContractExecutableRuntime.d.ts.map +1 -0
- package/dist/dts/effect/ContractKeyLocation.d.ts +55 -0
- package/dist/dts/effect/ContractKeyLocation.d.ts.map +1 -0
- package/dist/dts/effect/ContractLog.d.ts +273 -0
- package/dist/dts/effect/ContractLog.d.ts.map +1 -0
- package/dist/dts/effect/ContractRuntimeError.d.ts +34 -0
- package/dist/dts/effect/ContractRuntimeError.d.ts.map +1 -0
- package/dist/dts/effect/Ledger.d.ts +104 -0
- package/dist/dts/effect/Ledger.d.ts.map +1 -0
- package/dist/dts/effect/MalformedHexPrefixError.d.ts +37 -0
- package/dist/dts/effect/MalformedHexPrefixError.d.ts.map +1 -0
- package/dist/dts/effect/ZKConfiguration.d.ts +52 -0
- package/dist/dts/effect/ZKConfiguration.d.ts.map +1 -0
- package/dist/dts/effect/ZKConfigurationReadError.d.ts +45 -0
- package/dist/dts/effect/ZKConfigurationReadError.d.ts.map +1 -0
- package/dist/dts/effect/ZKManifest.d.ts +50 -0
- package/dist/dts/effect/ZKManifest.d.ts.map +1 -0
- package/dist/dts/effect/ZKManifestError.d.ts +34 -0
- package/dist/dts/effect/ZKManifestError.d.ts.map +1 -0
- package/dist/dts/effect/index.d.ts +22 -0
- package/dist/dts/effect/index.d.ts.map +1 -0
- package/dist/dts/effect/internal/boundary.d.ts +35 -0
- package/dist/dts/effect/internal/boundary.d.ts.map +1 -0
- package/dist/dts/effect/internal/compactContext.d.ts +29 -0
- package/dist/dts/effect/internal/compactContext.d.ts.map +1 -0
- package/dist/dts/effect/internal/contractEventsSurface.d.ts +43 -0
- package/dist/dts/effect/internal/contractEventsSurface.d.ts.map +1 -0
- package/dist/dts/effect/internal/era/v8Executable.d.ts +65 -0
- package/dist/dts/effect/internal/era/v8Executable.d.ts.map +1 -0
- package/dist/dts/effect/internal/era/v8Ledger.d.ts +76 -0
- package/dist/dts/effect/internal/era/v8Ledger.d.ts.map +1 -0
- package/dist/dts/effect/internal/era/v8Runtime.d.ts +26 -0
- package/dist/dts/effect/internal/era/v8Runtime.d.ts.map +1 -0
- package/dist/dts/effect/internal/era/v9Executable.d.ts +65 -0
- package/dist/dts/effect/internal/era/v9Executable.d.ts.map +1 -0
- package/dist/dts/effect/internal/era/v9Ledger.d.ts +76 -0
- package/dist/dts/effect/internal/era/v9Ledger.d.ts.map +1 -0
- package/dist/dts/effect/internal/era/v9Runtime.d.ts +15 -0
- package/dist/dts/effect/internal/era/v9Runtime.d.ts.map +1 -0
- package/dist/dts/effect/internal/era.d.ts +117 -0
- package/dist/dts/effect/internal/era.d.ts.map +1 -0
- package/dist/dts/effect/internal/eraFreeSurface.d.ts +49 -0
- package/dist/dts/effect/internal/eraFreeSurface.d.ts.map +1 -0
- package/dist/dts/effect/internal/eraNeutralSurface.d.ts +35 -0
- package/dist/dts/effect/internal/eraNeutralSurface.d.ts.map +1 -0
- package/dist/dts/effect/internal/executable.d.ts +371 -0
- package/dist/dts/effect/internal/executable.d.ts.map +1 -0
- package/dist/dts/effect/internal/ledger/binding.d.ts +2 -0
- package/dist/dts/effect/internal/ledger/binding.d.ts.map +1 -0
- package/dist/dts/effect/internal/ledger/conformance.d.ts +2 -0
- package/dist/dts/effect/internal/ledger/conformance.d.ts.map +1 -0
- package/dist/dts/effect/internal/ledger/conversions.d.ts +167 -0
- package/dist/dts/effect/internal/ledger/conversions.d.ts.map +1 -0
- package/dist/dts/effect/internal/ledger/current.d.ts +8 -0
- package/dist/dts/effect/internal/ledger/current.d.ts.map +1 -0
- package/dist/dts/effect/internal/ledger/v8.d.ts +100 -0
- package/dist/dts/effect/internal/ledger/v8.d.ts.map +1 -0
- package/dist/dts/effect/internal/ledger/v9.d.ts +66 -0
- package/dist/dts/effect/internal/ledger/v9.d.ts.map +1 -0
- package/dist/dts/effect/internal/runtime/binding.d.ts +2 -0
- package/dist/dts/effect/internal/runtime/binding.d.ts.map +1 -0
- package/dist/dts/effect/internal/runtime/conformance.d.ts +2 -0
- package/dist/dts/effect/internal/runtime/conformance.d.ts.map +1 -0
- package/dist/dts/effect/internal/runtime/current.d.ts +11 -0
- package/dist/dts/effect/internal/runtime/current.d.ts.map +1 -0
- package/dist/dts/effect/internal/runtime/execution.d.ts +176 -0
- package/dist/dts/effect/internal/runtime/execution.d.ts.map +1 -0
- package/dist/dts/effect/internal/runtime/v0_16.d.ts +169 -0
- package/dist/dts/effect/internal/runtime/v0_16.d.ts.map +1 -0
- package/dist/dts/effect/internal/runtime/v0_21.d.ts +81 -0
- package/dist/dts/effect/internal/runtime/v0_21.d.ts.map +1 -0
- package/dist/dts/effect/internal/typeAssertions.d.ts +2 -0
- package/dist/dts/effect/internal/typeAssertions.d.ts.map +1 -0
- package/dist/dts/index.d.ts +7 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/v8/effect.d.ts +50 -0
- package/dist/dts/v8/effect.d.ts.map +1 -0
- package/dist/dts/v8/index.d.ts +10 -0
- package/dist/dts/v8/index.d.ts.map +1 -0
- package/dist/dts/v9/effect.d.ts +28 -0
- package/dist/dts/v9/effect.d.ts.map +1 -0
- package/dist/dts/v9/index.d.ts +16 -0
- package/dist/dts/v9/index.d.ts.map +1 -0
- package/dist/esm/effect/CompactContext.js +16 -0
- package/dist/esm/effect/CompactContext.js.map +1 -0
- package/dist/esm/effect/CompactRuntime.js +44 -0
- package/dist/esm/effect/CompactRuntime.js.map +1 -0
- package/dist/esm/effect/CompiledContract.js +102 -0
- package/dist/esm/effect/CompiledContract.js.map +1 -0
- package/dist/esm/effect/Contract.js +40 -0
- package/dist/esm/effect/Contract.js.map +1 -0
- package/dist/esm/effect/ContractConfigurationError.js +41 -0
- package/dist/esm/effect/ContractConfigurationError.js.map +1 -0
- package/dist/esm/effect/ContractEventStore.js +150 -0
- package/dist/esm/effect/ContractEventStore.js.map +1 -0
- package/dist/esm/effect/ContractEventValidationError.js +40 -0
- package/dist/esm/effect/ContractEventValidationError.js.map +1 -0
- package/dist/esm/effect/ContractEventValidator.js +49 -0
- package/dist/esm/effect/ContractEventValidator.js.map +1 -0
- package/dist/esm/effect/ContractExecutable.js +50 -0
- package/dist/esm/effect/ContractExecutable.js.map +1 -0
- package/dist/esm/effect/ContractExecutableRuntime.js +17 -0
- package/dist/esm/effect/ContractExecutableRuntime.js.map +1 -0
- package/dist/esm/effect/ContractKeyLocation.js +67 -0
- package/dist/esm/effect/ContractKeyLocation.js.map +1 -0
- package/dist/esm/effect/ContractLog.js +268 -0
- package/dist/esm/effect/ContractLog.js.map +1 -0
- package/dist/esm/effect/ContractRuntimeError.js +40 -0
- package/dist/esm/effect/ContractRuntimeError.js.map +1 -0
- package/dist/esm/effect/Ledger.js +115 -0
- package/dist/esm/effect/Ledger.js.map +1 -0
- package/dist/esm/effect/MalformedHexPrefixError.js +43 -0
- package/dist/esm/effect/MalformedHexPrefixError.js.map +1 -0
- package/dist/esm/effect/ZKConfiguration.js +23 -0
- package/dist/esm/effect/ZKConfiguration.js.map +1 -0
- package/dist/esm/effect/ZKConfigurationReadError.js +46 -0
- package/dist/esm/effect/ZKConfigurationReadError.js.map +1 -0
- package/dist/esm/effect/ZKManifest.js +286 -0
- package/dist/esm/effect/ZKManifest.js.map +1 -0
- package/dist/esm/effect/ZKManifestError.js +40 -0
- package/dist/esm/effect/ZKManifestError.js.map +1 -0
- package/dist/esm/effect/index.js +36 -0
- package/dist/esm/effect/index.js.map +1 -0
- package/dist/esm/effect/internal/boundary.js +61 -0
- package/dist/esm/effect/internal/boundary.js.map +1 -0
- package/dist/esm/effect/internal/compactContext.js +52 -0
- package/dist/esm/effect/internal/compactContext.js.map +1 -0
- package/dist/esm/effect/internal/contractEventsSurface.js +57 -0
- package/dist/esm/effect/internal/contractEventsSurface.js.map +1 -0
- package/dist/esm/effect/internal/era/v8Executable.js +31 -0
- package/dist/esm/effect/internal/era/v8Executable.js.map +1 -0
- package/dist/esm/effect/internal/era/v8Ledger.js +85 -0
- package/dist/esm/effect/internal/era/v8Ledger.js.map +1 -0
- package/dist/esm/effect/internal/era/v8Runtime.js +39 -0
- package/dist/esm/effect/internal/era/v8Runtime.js.map +1 -0
- package/dist/esm/effect/internal/era/v9Executable.js +31 -0
- package/dist/esm/effect/internal/era/v9Executable.js.map +1 -0
- package/dist/esm/effect/internal/era/v9Ledger.js +83 -0
- package/dist/esm/effect/internal/era/v9Ledger.js.map +1 -0
- package/dist/esm/effect/internal/era/v9Runtime.js +28 -0
- package/dist/esm/effect/internal/era/v9Runtime.js.map +1 -0
- package/dist/esm/effect/internal/era.js +16 -0
- package/dist/esm/effect/internal/era.js.map +1 -0
- package/dist/esm/effect/internal/eraFreeSurface.js +63 -0
- package/dist/esm/effect/internal/eraFreeSurface.js.map +1 -0
- package/dist/esm/effect/internal/eraNeutralSurface.js +49 -0
- package/dist/esm/effect/internal/eraNeutralSurface.js.map +1 -0
- package/dist/esm/effect/internal/executable.js +531 -0
- package/dist/esm/effect/internal/executable.js.map +1 -0
- package/dist/esm/effect/internal/ledger/binding.js +20 -0
- package/dist/esm/effect/internal/ledger/binding.js.map +1 -0
- package/dist/esm/effect/internal/ledger/conformance.js +16 -0
- package/dist/esm/effect/internal/ledger/conformance.js.map +1 -0
- package/dist/esm/effect/internal/ledger/conversions.js +119 -0
- package/dist/esm/effect/internal/ledger/conversions.js.map +1 -0
- package/dist/esm/effect/internal/ledger/current.js +22 -0
- package/dist/esm/effect/internal/ledger/current.js.map +1 -0
- package/dist/esm/effect/internal/ledger/v8.js +101 -0
- package/dist/esm/effect/internal/ledger/v8.js.map +1 -0
- package/dist/esm/effect/internal/ledger/v9.js +91 -0
- package/dist/esm/effect/internal/ledger/v9.js.map +1 -0
- package/dist/esm/effect/internal/runtime/binding.js +16 -0
- package/dist/esm/effect/internal/runtime/binding.js.map +1 -0
- package/dist/esm/effect/internal/runtime/conformance.js +16 -0
- package/dist/esm/effect/internal/runtime/conformance.js.map +1 -0
- package/dist/esm/effect/internal/runtime/current.js +25 -0
- package/dist/esm/effect/internal/runtime/current.js.map +1 -0
- package/dist/esm/effect/internal/runtime/execution.js +16 -0
- package/dist/esm/effect/internal/runtime/execution.js.map +1 -0
- package/dist/esm/effect/internal/runtime/v0_16.js +178 -0
- package/dist/esm/effect/internal/runtime/v0_16.js.map +1 -0
- package/dist/esm/effect/internal/runtime/v0_21.js +129 -0
- package/dist/esm/effect/internal/runtime/v0_21.js.map +1 -0
- package/dist/esm/effect/internal/typeAssertions.js +16 -0
- package/dist/esm/effect/internal/typeAssertions.js.map +1 -0
- package/dist/esm/index.js +21 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +4 -0
- package/dist/esm/v8/effect.js +64 -0
- package/dist/esm/v8/effect.js.map +1 -0
- package/dist/esm/v8/index.js +24 -0
- package/dist/esm/v8/index.js.map +1 -0
- package/dist/esm/v9/effect.js +47 -0
- package/dist/esm/v9/effect.js.map +1 -0
- package/dist/esm/v9/index.js +30 -0
- package/dist/esm/v9/index.js.map +1 -0
- package/effect/CompactContext/package.json +5 -0
- package/effect/CompactRuntime/package.json +5 -0
- package/effect/CompiledContract/package.json +5 -0
- package/effect/Contract/package.json +5 -0
- package/effect/ContractConfigurationError/package.json +5 -0
- package/effect/ContractEventStore/package.json +5 -0
- package/effect/ContractEventValidationError/package.json +5 -0
- package/effect/ContractEventValidator/package.json +5 -0
- package/effect/ContractExecutable/package.json +5 -0
- package/effect/ContractExecutableRuntime/package.json +5 -0
- package/effect/ContractKeyLocation/package.json +5 -0
- package/effect/ContractLog/package.json +5 -0
- package/effect/ContractRuntimeError/package.json +5 -0
- package/effect/Ledger/package.json +5 -0
- package/effect/MalformedHexPrefixError/package.json +5 -0
- package/effect/ZKConfiguration/package.json +5 -0
- package/effect/ZKConfigurationReadError/package.json +5 -0
- package/effect/ZKManifest/package.json +5 -0
- package/effect/ZKManifestError/package.json +5 -0
- package/effect/index/package.json +5 -0
- package/effect/package.json +5 -0
- package/package.json +220 -4
- package/v8/effect/package.json +5 -0
- package/v8/package.json +5 -0
- package/v9/effect/package.json +5 -0
- package/v9/package.json +5 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compact-runtime 0.16 binding. This module (together with its peers under `internal/runtime`)
|
|
3
|
+
* is the only place in `src/` that may import the 0.16 line; everything else goes through the
|
|
4
|
+
* `CompactRuntime` facade, or through the era-pinned `internal/era/v8Runtime.ts` that `/v8/effect`
|
|
5
|
+
* exports. ESLint enforces this (`no-restricted-imports`); tests are exempt by design, since some
|
|
6
|
+
* must compare module identity.
|
|
7
|
+
*
|
|
8
|
+
* The runtime line is era-paired with the ledger — 0.16 with ledger 8, over onchain-runtime-v3 —
|
|
9
|
+
* so this binding and `internal/ledger/v8.ts` are selected together. Neither is meaningful alone.
|
|
10
|
+
*
|
|
11
|
+
* The package is reached through the `compact-runtime-ledger8` npm alias so that one dependency
|
|
12
|
+
* tree can hold both lines, and the alias resolves the public npmjs tarball rather than the
|
|
13
|
+
* GitHub Packages copy the `@midnight-ntwrk` scope routing in `.yarnrc.yml` would otherwise pick.
|
|
14
|
+
* Renaming the alias to the real package name breaks the install.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* It satisfies {@link RuntimeBinding} (the era-neutral core) and deliberately **not**
|
|
18
|
+
* {@link CallTreeRuntimeBinding}. That is not an omission to be filled in later: the 0.16
|
|
19
|
+
* execution model is a single flat frame, and the call-tree members simply do not exist on this
|
|
20
|
+
* line. What is missing, measured against 0.19.0-rc.0:
|
|
21
|
+
*
|
|
22
|
+
* - `CircuitContext` is `{ currentPrivateState, currentZswapLocalState, currentQueryContext,
|
|
23
|
+
* costModel, gasLimit }` — one contract, no `callContext`, no `queryContexts`/`gasCosts`/
|
|
24
|
+
* `zswapLocalStates`/`contractStates` maps, no `callProofDataTrace`, no `events`.
|
|
25
|
+
* - `createCircuitContext` takes the contract address first (0.19 takes the circuit id) and has no
|
|
26
|
+
* `stateProvider`, `parentBlockHash` or `reentrancyGuard` parameters.
|
|
27
|
+
* - `CircuitResults` carries `proofData: ProofData`; 0.19 dropped it in favour of the trace on the
|
|
28
|
+
* context.
|
|
29
|
+
* - Absent entirely: `CircuitId`, `CallContext`, `CallProofData`, `CallProofDataTrace`,
|
|
30
|
+
* `CommunicationCommitmentData`, `LogEvent`, `ContractStateProvider`, `crossContractCall`,
|
|
31
|
+
* `copyCircuitContext`, `finalizeCallProofData`, `createInitialQueryContext`,
|
|
32
|
+
* `createCallContext`.
|
|
33
|
+
* - `queryLedgerState` returns `AlignedValue | GatherResult[]`, against 0.19's
|
|
34
|
+
* `AlignedValue | undefined`.
|
|
35
|
+
*
|
|
36
|
+
* Everything else — `constructor-context`, `zswap`, `proof-data`, `contract-dependencies`,
|
|
37
|
+
* `compact-types`, `casts`, `built-ins`, `utils`, `error`, `constants`, `witness`, `version` — is
|
|
38
|
+
* identical to 0.19 apart from the onchain-runtime-v3 → v4 import swap, which is why the core
|
|
39
|
+
* contract below is satisfiable at all.
|
|
40
|
+
*/
|
|
41
|
+
import { type SignatureKind } from '@midnight-ntwrk/platform-js/effect/SigningKey';
|
|
42
|
+
import { type AlignedValue, type CircuitContext, type CircuitResults, ContractMaintenanceAuthority as RuntimeContractMaintenanceAuthority, type ContractState, type EncodedZswapLocalState, type Op, type ProofData, type QueryContext, type SignatureVerifyingKey, type SigningKey } from 'compact-runtime-ledger8';
|
|
43
|
+
import { type CallProofDataView, type ExecutionContextParams, type ExecutionView } from './execution.js';
|
|
44
|
+
export { type AlignedValue, type CallContext, type CircuitContext, type CircuitResults, type CoinCommitment, CompactError, type ConstructorContext, type ConstructorResult, ContractState, createCircuitContext, createConstructorContext, decodeZswapLocalState, type Effects, emptyZswapLocalState, type EncodedStateValue, type EncodedZswapLocalState, encodeZswapLocalState, type Op, type ProofData, type QueryContext, signatureVerifyingKey, type StateValue, type WitnessContext, type ZswapLocalState } from 'compact-runtime-ledger8';
|
|
45
|
+
/**
|
|
46
|
+
* This line's `ContractMaintenanceAuthority`, with `deserialize`'s return type repaired.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* onchain-runtime-v3 declares `static deserialize(raw: Uint8Array): ContractState` — an upstream
|
|
50
|
+
* mistake in the generated `.d.ts`, and the exact one `@midnightntwrk/ledger-v8@8.1.3` carries on
|
|
51
|
+
* the ledger side (see `internal/ledger/v8.ts`). The WASM really returns a
|
|
52
|
+
* `ContractMaintenanceAuthority`: verified against the shipped 3.1.1 build, where
|
|
53
|
+
* `deserialize(cma.serialize())` yields a value whose constructor is
|
|
54
|
+
* `ContractMaintenanceAuthority` and which fails `instanceof ContractState`.
|
|
55
|
+
*
|
|
56
|
+
* Repairing it at the seam matters more here than the label suggests. `makeConversions` derives
|
|
57
|
+
* `fromRuntimeMaintenanceAuthority`'s **parameter** from this return type, so unrepaired the
|
|
58
|
+
* published `/v8/effect` signature asks for a `ContractState`: the authority a caller actually
|
|
59
|
+
* holds is rejected at compile time, and the contract state that is accepted instead fails inside
|
|
60
|
+
* WASM. The ledger 9 line declares this correctly, so without the repair the two eras would also
|
|
61
|
+
* disagree on a signature that #388 requires to be identical.
|
|
62
|
+
*
|
|
63
|
+
* Re-check on each 3.x release — if upstream fixes the declaration, this cast becomes a no-op and
|
|
64
|
+
* can go. `RuntimeBinding.tst.ts` pins the relationship on both lines.
|
|
65
|
+
*/
|
|
66
|
+
declare const ContractMaintenanceAuthority: {
|
|
67
|
+
new (committee: SignatureVerifyingKey[], threshold: number, counter?: bigint): RuntimeContractMaintenanceAuthority;
|
|
68
|
+
deserialize(raw: Uint8Array): RuntimeContractMaintenanceAuthority;
|
|
69
|
+
};
|
|
70
|
+
export { ContractMaintenanceAuthority };
|
|
71
|
+
/** This line's `ContractMaintenanceAuthority` instance type, unaffected by the repair above. */
|
|
72
|
+
export type ContractMaintenanceAuthority = RuntimeContractMaintenanceAuthority;
|
|
73
|
+
/**
|
|
74
|
+
* The compact-runtime line this binding targets.
|
|
75
|
+
*
|
|
76
|
+
* @category era
|
|
77
|
+
*/
|
|
78
|
+
export declare const line = "0.16";
|
|
79
|
+
/**
|
|
80
|
+
* Samples a fresh signing key in this line's native representation.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* `kind` is accepted and **ignored**: onchain-runtime-v3 has no scheme concept at all — its
|
|
84
|
+
* `SigningKey` is a bare hex string and `sampleSigningKey()` takes no argument — so BIP-340
|
|
85
|
+
* Schnorr is the only thing this line can produce. Callers must consult the *ledger* era's
|
|
86
|
+
* allowlist first (`internal/ledger/v8.ts` permits `schnorr` only), which is what makes ignoring
|
|
87
|
+
* the argument safe rather than silently wrong.
|
|
88
|
+
*
|
|
89
|
+
* The key is returned in this line's native representation — a bare hex string — so that it stays
|
|
90
|
+
* assignable to this line's own `signatureVerifyingKey`. {@link signingKeyHex} is what makes the
|
|
91
|
+
* hex readable era-neutrally.
|
|
92
|
+
*
|
|
93
|
+
* @category constructors
|
|
94
|
+
*/
|
|
95
|
+
export declare const makeSampleSigningKey: (_kind: SignatureKind) => SigningKey;
|
|
96
|
+
/**
|
|
97
|
+
* Extracts the hex value of a ledger 8 era signing key.
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* The identity: onchain-runtime-v3 has no tagged-key concept, so a `SigningKey` *is* its hex
|
|
101
|
+
* string. Present so era-neutral code can read a key's hex without branching — the ledger 9 era's
|
|
102
|
+
* counterpart reads `.value` off a tagged key.
|
|
103
|
+
*
|
|
104
|
+
* @category conversions
|
|
105
|
+
*/
|
|
106
|
+
export declare const signingKeyHex: (key: SigningKey) => string;
|
|
107
|
+
/**
|
|
108
|
+
* Contract events do not exist on this line, so there is no type to carry one.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* `never` rather than an empty-object stand-in, and this is load-bearing: it makes
|
|
112
|
+
* `ContractExecutable`'s `CallResult.events` a `never[]` on this era — a list that is *statically*
|
|
113
|
+
* empty, not merely empty at run time. So the same `CallResult` type serves both eras while the
|
|
114
|
+
* impossible case stays unconstructable, which is what #388 asks for.
|
|
115
|
+
*
|
|
116
|
+
* The VM-level `log` gather op does exist under onchain-runtime-v3, but its payload is a bare
|
|
117
|
+
* `EncodedStateValue` against v4's `{ version, eventType, data }`, it has no emitting-contract
|
|
118
|
+
* address, and 0.16 accumulates nothing on the circuit context. Events here would be a rebuild
|
|
119
|
+
* against a different payload, not a binding.
|
|
120
|
+
*
|
|
121
|
+
* @category execution
|
|
122
|
+
*/
|
|
123
|
+
export type LogEvent = never;
|
|
124
|
+
/** This line's instantiation of the era-neutral call-trace entry. @category execution */
|
|
125
|
+
export type CallTraceEntry = CallProofDataView<QueryContext, AlignedValue, Op<AlignedValue>, EncodedZswapLocalState, never>;
|
|
126
|
+
/** This line's instantiation of the era-neutral execution view. @category execution */
|
|
127
|
+
export type Execution<Result, PrivateState> = ExecutionView<Result, PrivateState, CallTraceEntry, EncodedZswapLocalState, LogEvent, undefined>;
|
|
128
|
+
/**
|
|
129
|
+
* Builds a circuit-execution context for this line.
|
|
130
|
+
*
|
|
131
|
+
* @remarks
|
|
132
|
+
* Two adaptations. The positional order differs — 0.16 takes the contract address first and has no
|
|
133
|
+
* circuit-id parameter at all — and the circuit id, address and pre-execution query context are
|
|
134
|
+
* recorded on the context so {@link readExecution} can rebuild a trace entry the newer line
|
|
135
|
+
* supplies natively.
|
|
136
|
+
*
|
|
137
|
+
* The initial query context is snapshotted *here*, not read back later: the flat 0.16 context is
|
|
138
|
+
* mutated in place during execution, so reading it afterwards would report the final state as the
|
|
139
|
+
* initial one and silently corrupt transcript partitioning.
|
|
140
|
+
*
|
|
141
|
+
* @throws If `stateProvider`, `moduleProvider` or `parentBlockHash` is supplied. This line has no
|
|
142
|
+
* `crossContractCall`, `ContractStateProvider` or `ContractModuleProvider`, so honouring a
|
|
143
|
+
* cross-contract call is impossible; ignoring a provider would instead make such a call appear to
|
|
144
|
+
* succeed against stale state.
|
|
145
|
+
*
|
|
146
|
+
* @category execution
|
|
147
|
+
*/
|
|
148
|
+
export declare const createExecutionContext: <PS>(params: ExecutionContextParams<PS, ContractState, EncodedZswapLocalState, never, never>) => CircuitContext<PS>;
|
|
149
|
+
/**
|
|
150
|
+
* Projects this line's circuit results into the era-neutral execution view.
|
|
151
|
+
*
|
|
152
|
+
* @remarks
|
|
153
|
+
* The trace is **synthesised** as a single entry. That is faithful rather than lossy: without
|
|
154
|
+
* `crossContractCall` this line can only ever produce one call, so a one-element trace is complete
|
|
155
|
+
* by construction. The proof data 0.21 hangs off each `CallProofData` lives on `results.proofData`
|
|
156
|
+
* here, and is moved across.
|
|
157
|
+
*
|
|
158
|
+
* `events` is always empty, and typed `never[]` — see {@link LogEvent}.
|
|
159
|
+
*
|
|
160
|
+
* @throws If the context was not built by {@link createExecutionContext}. Without the recorded
|
|
161
|
+
* metadata the circuit id, address and pre-execution state are unrecoverable, and guessing them
|
|
162
|
+
* would produce a trace that looks valid and proves the wrong call.
|
|
163
|
+
*
|
|
164
|
+
* @category execution
|
|
165
|
+
*/
|
|
166
|
+
export declare const readExecution: <Result, PS>(results: CircuitResults<PS, Result> & {
|
|
167
|
+
readonly proofData: ProofData;
|
|
168
|
+
}) => Execution<Result, PS | undefined>;
|
|
169
|
+
//# sourceMappingURL=v0_16.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v0_16.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/runtime/v0_16.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,4BAA4B,IAAI,mCAAmC,EACnE,KAAK,aAAa,EAElB,KAAK,sBAAsB,EAC3B,KAAK,EAAE,EACP,KAAK,SAAS,EACd,KAAK,YAAY,EAEjB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAOzG,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,aAAa,EACb,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,OAAO,EACZ,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,qBAAqB,EACrB,KAAK,EAAE,EACP,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,qBAAqB,EACrB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,4BAA4B,EAAqD;IACrF,KAAK,SAAS,EAAE,qBAAqB,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,mCAAmC,CAAC;IACnH,WAAW,CAAC,GAAG,EAAE,UAAU,GAAG,mCAAmC,CAAC;CACnE,CAAC;AAEF,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAExC,gGAAgG;AAChG,MAAM,MAAM,4BAA4B,GAAG,mCAAmC,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,IAAI,SAA+B,CAAC;AAEjD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,aAAa,KAAG,UAAgC,CAAC;AAE7F;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,UAAU,KAAG,MAAa,CAAC;AAE9D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC;AAE7B,yFAAyF;AACzF,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAC5C,YAAY,EACZ,YAAY,EACZ,EAAE,CAAC,YAAY,CAAC,EAChB,sBAAsB,EACtB,KAAK,CACN,CAAC;AAEF,uFAAuF;AACvF,MAAM,MAAM,SAAS,CAAC,MAAM,EAAE,YAAY,IAAI,aAAa,CACzD,MAAM,EACN,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,QAAQ,EAGR,SAAS,CACV,CAAC;AAsBF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,GAAI,EAAE,EACvC,QAAQ,sBAAsB,CAAC,EAAE,EAAE,aAAa,EAAE,sBAAsB,EAAE,KAAK,EAAE,KAAK,CAAC,KACtF,cAAc,CAAC,EAAE,CAqCnB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,EAAE,EAAE,EACtC,SAAS,cAAc,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;CAAE,KACtE,SAAS,CAAC,MAAM,EAAE,EAAE,GAAG,SAAS,CA+BlC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compact-runtime 0.21 binding. This module (together with its peers under `internal/runtime`)
|
|
3
|
+
* is the only place in `src/` that may import from `@midnight-ntwrk/compact-runtime`; everything
|
|
4
|
+
* else goes through the `CompactRuntime` facade so that a future runtime line binds by swapping
|
|
5
|
+
* `current.ts`, not by editing call sites (midnight-sdk#387). ESLint enforces this
|
|
6
|
+
* (`no-restricted-imports`); tests are exempt by design, since some must compare module identity.
|
|
7
|
+
*
|
|
8
|
+
* The runtime line is era-paired with the ledger — 0.21 with ledger 9, over onchain-runtime-v4 —
|
|
9
|
+
* so this binding and `internal/ledger/v9.ts` are swapped together. Neither is meaningful alone.
|
|
10
|
+
*/
|
|
11
|
+
import { type AlignedValue, type CircuitContext, type CircuitResults, type CommunicationCommitmentData, type ContractModuleProvider, type ContractState, type ContractStateProvider, type EncodedZswapLocalState, type LogEvent, type Op, type QueryContext, type RunningCost, type SigningKey } from '@midnight-ntwrk/compact-runtime';
|
|
12
|
+
import { type SignatureKind } from '@midnight-ntwrk/platform-js/effect/SigningKey';
|
|
13
|
+
import { type CallProofDataView, type ExecutionContextParams, type ExecutionView } from './execution.js';
|
|
14
|
+
export { type AlignedValue, type CallContext, type CallProofData, type CircuitContext, type CircuitResults, type CoinCommitment, type CommunicationCommitmentData, CompactError, type ConstructorContext, type ConstructorResult, ContractMaintenanceAuthority, type ContractModuleProvider, ContractState, type ContractStateProvider, createCircuitContext, createConstructorContext, decodeZswapLocalState, type Effects, emptyZswapLocalState, type EncodedStateValue, type EncodedZswapLocalState, encodeZswapLocalState, type LogEvent, type Module, type ModuleThunk, type Op, type QueryContext, type RunningCost, signatureVerifyingKey, type StateValue, type WitnessContext, type ZswapLocalState } from '@midnight-ntwrk/compact-runtime';
|
|
15
|
+
/**
|
|
16
|
+
* The compact-runtime line this binding targets. Read by the era-pairing check rather than
|
|
17
|
+
* hard-coded at any call site, so a runtime swap is a one-line edit here plus `current.ts`.
|
|
18
|
+
*
|
|
19
|
+
* `as const satisfies` rather than a `: RuntimeLine` annotation, matching the ledger twin
|
|
20
|
+
* (`internal/ledger/v9.ts`): an annotation widens `typeof CompactRuntime.line` to the whole union
|
|
21
|
+
* at every consumer and in the emitted `.d.ts`, which forecloses any compile-time use of the
|
|
22
|
+
* pairing. The two coincide while the union is a singleton and stop coinciding the moment a second
|
|
23
|
+
* line is bound.
|
|
24
|
+
*
|
|
25
|
+
* @category era
|
|
26
|
+
*/
|
|
27
|
+
export declare const line: "0.21";
|
|
28
|
+
/**
|
|
29
|
+
* Samples a fresh signing key for `kind`.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* A thin pass-through on this line: onchain-runtime-v4 keys are already tagged (`{ tag, value }`)
|
|
33
|
+
* and `sampleSigningKey` already takes the scheme. The wrapper exists so the *older* line can
|
|
34
|
+
* present the same shape — see `v0_16.ts`, where the underlying call takes no argument and returns
|
|
35
|
+
* a bare hex string — and so era-neutral code reads `.value` without branching.
|
|
36
|
+
*
|
|
37
|
+
* @category constructors
|
|
38
|
+
*/
|
|
39
|
+
export declare const makeSampleSigningKey: (kind: SignatureKind) => SigningKey;
|
|
40
|
+
/** This line's instantiation of the era-neutral call-trace entry. @category execution */
|
|
41
|
+
export type CallTraceEntry = CallProofDataView<QueryContext, AlignedValue, Op<AlignedValue>, EncodedZswapLocalState, CommunicationCommitmentData>;
|
|
42
|
+
/** This line's instantiation of the era-neutral execution view. @category execution */
|
|
43
|
+
export type Execution<Result, PrivateState> = ExecutionView<Result, PrivateState, CallTraceEntry, EncodedZswapLocalState | undefined, LogEvent, Record<string, RunningCost>>;
|
|
44
|
+
/**
|
|
45
|
+
* Builds a circuit-execution context for this line.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* A direct pass-through: 0.21 *is* the call-tree model the era-neutral view is modelled on, so this
|
|
49
|
+
* only renames parameters into `createCircuitContext`'s options and pairs the two providers into
|
|
50
|
+
* its `crossContract`. The one gap, `costModel`, keeps the runtime's own default. `costModel` is not
|
|
51
|
+
* one a caller could fill: `CostModel` has a private constructor and one static factory, whose
|
|
52
|
+
* result *is* that default.
|
|
53
|
+
*
|
|
54
|
+
* @throws If exactly one provider is supplied. The runtime would accept half a pair and fail only
|
|
55
|
+
* at the first cross-contract call, far from the caller that dropped the other half.
|
|
56
|
+
*
|
|
57
|
+
* @category execution
|
|
58
|
+
*/
|
|
59
|
+
export declare const createExecutionContext: <PS>(params: ExecutionContextParams<PS, ContractState, EncodedZswapLocalState, ContractStateProvider, ContractModuleProvider>) => CircuitContext<PS>;
|
|
60
|
+
/**
|
|
61
|
+
* Projects this line's circuit results into the era-neutral execution view.
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* Also a pass-through: the trace, root private state, root zswap state and event list are all
|
|
65
|
+
* already on the 0.21 context. `zswapLocalState` is asserted non-`undefined` by the caller, which
|
|
66
|
+
* owns the typed failure — this function stays total.
|
|
67
|
+
*
|
|
68
|
+
* @category execution
|
|
69
|
+
*/
|
|
70
|
+
export declare const readExecution: <Result, PS>(results: CircuitResults<PS, Result>) => Execution<Result, PS | undefined>;
|
|
71
|
+
/**
|
|
72
|
+
* Extracts the hex value of a ledger 9 era signing key.
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* onchain-runtime-v4 keys are tagged, so the hex lives under `value`. The 0.16 binding's
|
|
76
|
+
* counterpart is the identity, its keys being bare hex strings already.
|
|
77
|
+
*
|
|
78
|
+
* @category conversions
|
|
79
|
+
*/
|
|
80
|
+
export declare const signingKeyHex: (key: SigningKey) => string;
|
|
81
|
+
//# sourceMappingURL=v0_21.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v0_21.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/runtime/v0_21.ts"],"names":[],"mappings":"AAeA;;;;;;;;;GASG;AACH,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAE1B,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,KAAK,EAAE,EACP,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,KAAK,UAAU,EAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAGnF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAexB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,2BAA2B,EAChC,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,aAAa,EACb,KAAK,qBAAqB,EAC1B,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,OAAO,EACZ,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,qBAAqB,EACrB,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,EAAE,EACP,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,qBAAqB,EACrB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,IAAI,QAAwC,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,aAAa,KAAG,UAAoC,CAAC;AAEhG,yFAAyF;AACzF,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAC5C,YAAY,EACZ,YAAY,EACZ,EAAE,CAAC,YAAY,CAAC,EAChB,sBAAsB,EACtB,2BAA2B,CAC5B,CAAC;AAEF,uFAAuF;AACvF,MAAM,MAAM,SAAS,CAAC,MAAM,EAAE,YAAY,IAAI,aAAa,CACzD,MAAM,EACN,YAAY,EACZ,cAAc,EAGd,sBAAsB,GAAG,SAAS,EAClC,QAAQ,EACR,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAC5B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,GAAI,EAAE,EACvC,QAAQ,sBAAsB,CAC5B,EAAE,EACF,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,CACvB,KACA,cAAc,CAAC,EAAE,CAiBnB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,EAAE,EAAE,EACtC,SAAS,cAAc,CAAC,EAAE,EAAE,MAAM,CAAC,KAClC,SAAS,CAAC,MAAM,EAAE,EAAE,GAAG,SAAS,CASjC,CAAC;AAQH;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,UAAU,KAAG,MAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeAssertions.d.ts","sourceRoot":"","sources":["../../../../src/effect/internal/typeAssertions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * as CompiledContract from './effect/CompiledContract.js';
|
|
2
|
+
export * from './effect/Contract.js';
|
|
3
|
+
export * as ContractEventStore from './effect/ContractEventStore.js';
|
|
4
|
+
export * as ContractExecutable from './effect/ContractExecutable.js';
|
|
5
|
+
export * from './effect/ContractKeyLocation.js';
|
|
6
|
+
export * as ContractLog from './effect/ContractLog.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,gBAAgB,MAAM,8BAA8B,CAAC;AACjE,cAAc,sBAAsB,CAAC;AACrC,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,kBAAkB,MAAM,gCAAgC,CAAC;AACrE,cAAc,iCAAiC,CAAC;AAChD,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **ledger 8** era-pinned Effect entry (midnight-sdk#387/#388). The `v8` suffix names the
|
|
3
|
+
* ledger era this entry targets — ledger 8 — not this package's own version.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Unlike `/v9/effect`, this entry does **not** follow `internal/ledger/current.ts`. It binds ledger
|
|
7
|
+
* 8 and its paired compact-runtime 0.16 line directly, so importing it selects an era rather than
|
|
8
|
+
* labelling whichever era the build happens to be bound to. Both era facades can be live in one
|
|
9
|
+
* process; `test/era8/LedgerEightFacade.test.ts` exercises this one alongside the ledger 9 pair.
|
|
10
|
+
*
|
|
11
|
+
* ## What this entry provides
|
|
12
|
+
*
|
|
13
|
+
* - `Ledger` — the ledger 8 seam: its types and constructors, plus the runtime↔ledger conversions
|
|
14
|
+
* instantiated for the ledger 8 / runtime 0.16 pair.
|
|
15
|
+
* - `CompactRuntime` — the compact-runtime 0.16 seam, including the execution adapter
|
|
16
|
+
* (`createExecutionContext` / `readExecution`) that presents 0.16's flat, single-frame execution
|
|
17
|
+
* model in the same shape as 0.21's call tree.
|
|
18
|
+
* - The **era-free core** (`internal/eraFreeSurface.ts`) — contract and ZK-configuration modules
|
|
19
|
+
* whose module graph reaches neither facade, so the objects here are the *same instances* the
|
|
20
|
+
* ledger 9 entry exports. This is #388's "identical public API wherever the era permits": code
|
|
21
|
+
* using them compiles unchanged against either entry.
|
|
22
|
+
*
|
|
23
|
+
* ## What it does not provide, and why
|
|
24
|
+
*
|
|
25
|
+
* **Contract events and cross-contract calls are absent because ledger 8 cannot do them.**
|
|
26
|
+
* onchain-runtime-v3's `log` payload is a bare `EncodedStateValue` with no emitting-contract
|
|
27
|
+
* address and no versioning, 0.16 accumulates nothing on the circuit context, and there is no
|
|
28
|
+
* `crossContractCall` or `ContractStateProvider` at all. `createExecutionContext` therefore
|
|
29
|
+
* *rejects* a state provider rather than ignoring it. This is the "absent, not runtime-failing"
|
|
30
|
+
* requirement in #388.
|
|
31
|
+
*
|
|
32
|
+
* **`ContractExecutable` executes against ledger 8 here, not against the build's bound era.** It is
|
|
33
|
+
* `internal/executable.ts` applied to this entry's two facades, so `deploy`, `circuit` and the
|
|
34
|
+
* maintenance operations all speak ledger 8 and runtime 0.16 — including the types they return.
|
|
35
|
+
* A cross-contract state provider is *rejected* by this era's `createExecutionContext` rather than
|
|
36
|
+
* ignored, and `CallResult.events` is statically empty, so the two features ledger 8 cannot do stay
|
|
37
|
+
* unreachable from here rather than failing at run time.
|
|
38
|
+
*
|
|
39
|
+
* A compiled ledger 8 contract still has to resolve its own `@midnight-ntwrk/compact-runtime` to
|
|
40
|
+
* the 0.16 line — its generated code imports that specifier directly and asserts
|
|
41
|
+
* `checkRuntimeVersion('0.16.0')` on load, which no compact-js entry can influence. The recipe is
|
|
42
|
+
* one line in the manifest of the package holding those artifacts; `test/effect/DualEraResolution.test.ts`
|
|
43
|
+
* pins it, and `test/era8/LedgerEightExecutable.test.ts` runs a contract end to end through this
|
|
44
|
+
* entry.
|
|
45
|
+
*/
|
|
46
|
+
export * as ContractExecutable from '../effect/internal/era/v8Executable.js';
|
|
47
|
+
export * as Ledger from '../effect/internal/era/v8Ledger.js';
|
|
48
|
+
export * as CompactRuntime from '../effect/internal/era/v8Runtime.js';
|
|
49
|
+
export * from '../effect/internal/eraFreeSurface.js';
|
|
50
|
+
//# sourceMappingURL=effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect.d.ts","sourceRoot":"","sources":["../../../src/v8/effect.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,KAAK,kBAAkB,MAAM,wCAAwC,CAAC;AAC7E,OAAO,KAAK,MAAM,MAAM,oCAAoC,CAAC;AAC7D,OAAO,KAAK,cAAc,MAAM,qCAAqC,CAAC;AACtE,cAAc,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **ledger 8** era-pinned entry (midnight-sdk#387/#388). The `v8` suffix names the ledger era
|
|
3
|
+
* this entry targets — ledger 8 — not this package's own version.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Same surface as `@midnightntwrk/compact-js/v8/effect`; see that module for what this era can
|
|
7
|
+
* and cannot do, and why `ContractExecutable` is not among it yet.
|
|
8
|
+
*/
|
|
9
|
+
export * from './effect.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/v8/index.ts"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **ledger 9** era-pinned Effect entry (midnight-sdk#387/#388). The `v9` suffix names the
|
|
3
|
+
* ledger era this entry targets — ledger 9 — not this package's own version. Same API as
|
|
4
|
+
* `@midnightntwrk/compact-js/effect`.
|
|
5
|
+
*
|
|
6
|
+
* This entry **binds ledger 9 itself** (`internal/era/v9Ledger.ts` and `internal/runtime/v0_21.ts`),
|
|
7
|
+
* rather than re-exporting the facades. It used to do the latter, which made it an alias for
|
|
8
|
+
* whatever `internal/ledger/current.ts` bound: advancing that turned `/v9` into an entry for a
|
|
9
|
+
* different era, with nothing to catch it — the `/v9`-versus-root parity tests were comparing an
|
|
10
|
+
* alias with its own target. The unsuffixed `@midnightntwrk/compact-js/effect` keeps that
|
|
11
|
+
* follow-the-build-era behaviour, which is what it is *for*; the two agree today and are meant to
|
|
12
|
+
* diverge the first time `current.ts` advances.
|
|
13
|
+
*
|
|
14
|
+
* Composed from named modules rather than by re-exporting `../effect/index.js`, so what a ledger 9
|
|
15
|
+
* entry includes is visible here:
|
|
16
|
+
*
|
|
17
|
+
* - `eraFreeSurface.ts` — the core every era entry shares, the same object instances on both.
|
|
18
|
+
* - `contractEventsSurface.ts` — ledger 9 only. A ledger 8 entry omits *this* module and takes the
|
|
19
|
+
* era-free core alone (`src/v8/effect.ts`), which is the shape #388 asks for: a member that
|
|
20
|
+
* cannot exist on an older era is absent rather than present and failing.
|
|
21
|
+
* - its own `Ledger` and `CompactRuntime` bindings, plus `ContractExecutable` — see below.
|
|
22
|
+
*/
|
|
23
|
+
export * from '../effect/internal/contractEventsSurface.js';
|
|
24
|
+
export * as Ledger from '../effect/internal/era/v9Ledger.js';
|
|
25
|
+
export * as CompactRuntime from '../effect/internal/era/v9Runtime.js';
|
|
26
|
+
export * from '../effect/internal/eraFreeSurface.js';
|
|
27
|
+
export * as ContractExecutable from '../effect/internal/era/v9Executable.js';
|
|
28
|
+
//# sourceMappingURL=effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect.d.ts","sourceRoot":"","sources":["../../../src/v9/effect.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,cAAc,6CAA6C,CAAC;AAC5D,OAAO,KAAK,MAAM,MAAM,oCAAoC,CAAC;AAC7D,OAAO,KAAK,cAAc,MAAM,qCAAqC,CAAC;AACtE,cAAc,sCAAsC,CAAC;AAOrD,OAAO,KAAK,kBAAkB,MAAM,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **ledger 9** era-pinned entry (midnight-sdk#387/#388). The `v9` suffix names the ledger
|
|
3
|
+
* era this entry targets — ledger 9 — not this package's own version. Binding to this path
|
|
4
|
+
* records an intent to speak a specific ledger era (e.g. across a hardfork window).
|
|
5
|
+
*
|
|
6
|
+
* Same surface as `@midnightntwrk/compact-js/v9/effect`, exactly as `/v8` mirrors `/v8/effect`.
|
|
7
|
+
*
|
|
8
|
+
* This used to be `export * from '../index.js'` — the *root* barrel, which resolves both seams'
|
|
9
|
+
* `current.ts`. That made this entry an alias for whichever era the build bound, so repointing
|
|
10
|
+
* `current.ts` at ledger 10 would have turned `/v9` into a ledger 10 entry: a path naming an era it
|
|
11
|
+
* no longer speaks, with no build error to catch it. `/v9/effect` was rebound to its own binding
|
|
12
|
+
* when the era-pinned entries landed and this one was missed, which is the failure mode
|
|
13
|
+
* `internal/era/v9Ledger.ts` describes and CLAUDE.md's era-swap checklist promises cannot happen.
|
|
14
|
+
*/
|
|
15
|
+
export * from './effect.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/v9/index.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;GAaG;AACH,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of midnight-sdk.
|
|
3
|
+
* Copyright (C) 2025 Midnight Foundation
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* You may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=CompactContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompactContext.js","sourceRoot":"","sources":["../../../src/effect/CompactContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of midnight-sdk.
|
|
3
|
+
* Copyright (C) 2025 Midnight Foundation
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* You may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
import * as boundary from './internal/boundary.js';
|
|
16
|
+
export * from './internal/runtime/current.js';
|
|
17
|
+
/**
|
|
18
|
+
* Wraps a call across the compact-runtime (WASM) boundary so that a rejection becomes a typed
|
|
19
|
+
* failure rather than a defect.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Routing a call through this facade makes it *look* protected without making it so: the seam only
|
|
23
|
+
* changes where the binding is resolved, and compact-runtime still signals rejection by throwing.
|
|
24
|
+
* A throw evaluated in an `Effect.gen` body is a defect, which escapes the caller's declared error
|
|
25
|
+
* channel — `ContractExecutable.circuit`'s `ContractExecutionError` becomes unsound at that point,
|
|
26
|
+
* and the CLI (which runs with `disableErrorReporting`) exits non-zero printing nothing at all.
|
|
27
|
+
* Every runtime call is held in the error channel one of three ways: inside an
|
|
28
|
+
* `Effect.try`/`Effect.tryPromise` callback, through this wrapper, or — in `ContractExecutable`'s
|
|
29
|
+
* synchronous `Either`-returning maintenance helpers, which have no `Effect` to wrap — inside a
|
|
30
|
+
* plain `try`/`catch` yielding a `ContractConfigurationError`. Reach for this one by default; the
|
|
31
|
+
* third applies only where the surrounding function is not an `Effect`.
|
|
32
|
+
*
|
|
33
|
+
* This is the ledger seam's {@link Ledger.tryConvert} under the name the runtime side knows it by
|
|
34
|
+
* — one copy of the boundary handling, shared (see `internal/boundary.ts` for why it lives above
|
|
35
|
+
* both facades rather than in either).
|
|
36
|
+
*
|
|
37
|
+
* @param message A message describing the operation, used as the failure's message.
|
|
38
|
+
* @param evaluate A thunk that performs the runtime call.
|
|
39
|
+
* @returns An `Effect` that yields the result of `evaluate`, failing with a
|
|
40
|
+
* {@link ContractRuntimeError.ContractRuntimeError} if the runtime rejects it.
|
|
41
|
+
* @category combinators
|
|
42
|
+
*/
|
|
43
|
+
export const tryRuntime = boundary.tryBoundary;
|
|
44
|
+
//# sourceMappingURL=CompactRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompactRuntime.js","sourceRoot":"","sources":["../../../src/effect/CompactRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAiDH,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AAGnD,cAAc,+BAA+B,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,UAAU,GAG4C,QAAQ,CAAC,WAAW,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of midnight-sdk.
|
|
3
|
+
* Copyright (C) 2025 Midnight Foundation
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* You may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
import { dual } from 'effect/Function';
|
|
16
|
+
import { pipeArguments } from 'effect/Pipeable';
|
|
17
|
+
import * as CompactContextInternal from './internal/compactContext.js';
|
|
18
|
+
export const TypeId = Symbol.for('compact-js/CompiledContract');
|
|
19
|
+
const CompiledContractProto = {
|
|
20
|
+
[TypeId]: {
|
|
21
|
+
_C: (_) => _,
|
|
22
|
+
_PS: (_) => _,
|
|
23
|
+
_R: (_) => _
|
|
24
|
+
},
|
|
25
|
+
pipe() {
|
|
26
|
+
return pipeArguments(this, arguments); // eslint-disable-line prefer-rest-params
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Initializes an object that represents a binding to a Compact compiled contract.
|
|
31
|
+
*
|
|
32
|
+
* @param tag A unique identifier that represents this type of contract.
|
|
33
|
+
* @param ctor The contract constructor, as imported from the compiled Compact output.
|
|
34
|
+
* @returns A {@link CompiledContract}.
|
|
35
|
+
*
|
|
36
|
+
* @category constructors
|
|
37
|
+
*/
|
|
38
|
+
export const make = (tag, ctor) => {
|
|
39
|
+
const self = Object.create(CompiledContractProto);
|
|
40
|
+
self.tag = tag;
|
|
41
|
+
self[CompactContextInternal.TypeId] = { ctor };
|
|
42
|
+
return self;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Associates an object that implements the contract witnesses for the Compact compiled contract.
|
|
46
|
+
*
|
|
47
|
+
* @category combinators
|
|
48
|
+
*/
|
|
49
|
+
export const withWitnesses = dual(2, (self, witnesses) => {
|
|
50
|
+
return {
|
|
51
|
+
...self,
|
|
52
|
+
[CompactContextInternal.TypeId]: {
|
|
53
|
+
...self[CompactContextInternal.TypeId],
|
|
54
|
+
witnesses
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Associates _vacant_ witnesses with a Compact compiled contract that specifies no witnesses.
|
|
60
|
+
*
|
|
61
|
+
* @param self The {@link CompiledContract} for which no witnesses are required.
|
|
62
|
+
*
|
|
63
|
+
* @category combinators
|
|
64
|
+
*/
|
|
65
|
+
export const withVacantWitnesses = (self) => {
|
|
66
|
+
return {
|
|
67
|
+
...self,
|
|
68
|
+
[CompactContextInternal.TypeId]: {
|
|
69
|
+
...self[CompactContextInternal.TypeId],
|
|
70
|
+
witnesses: {}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Associates a file path of where to find the compiled assets for the Compact compiled contract.
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* Relative file paths will be resolved relative to the base paths provided to each service that accesses
|
|
79
|
+
* the compiled file assets.
|
|
80
|
+
*
|
|
81
|
+
* @category combinators
|
|
82
|
+
*/
|
|
83
|
+
export const withCompiledFileAssets = dual(2, (self, compiledAssetsPath) => {
|
|
84
|
+
return {
|
|
85
|
+
...self,
|
|
86
|
+
[CompactContextInternal.TypeId]: {
|
|
87
|
+
...self[CompactContextInternal.TypeId],
|
|
88
|
+
compiledAssetsPath
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* Retrieves a path to file based assets associated with a compiled contract.
|
|
94
|
+
*
|
|
95
|
+
* @param self The {@link CompiledContract} from which the assets path should be retrieved.
|
|
96
|
+
* @returns A string representing a path to the file assets configured for `self`.
|
|
97
|
+
*/
|
|
98
|
+
export const getCompiledAssetsPath = (self) => {
|
|
99
|
+
const context = CompactContextInternal.getContractContext(self);
|
|
100
|
+
return context.compiledAssetsPath;
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=CompiledContract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompiledContract.js","sourceRoot":"","sources":["../../../src/effect/CompiledContract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAI/D,OAAO,KAAK,sBAAsB,MAAM,8BAA8B,CAAC;AAEvE,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;AAkDhE,MAAM,qBAAqB,GAAG;IAC5B,CAAC,MAAM,CAAC,EAAE;QACR,EAAE,EAAE,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC;QACrB,GAAG,EAAE,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC;QACtB,EAAE,EAAE,CAAC,CAAQ,EAAE,EAAE,CAAC,CAAC;KACpB;IACD,IAAI;QACF,OAAO,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,yCAAyC;IAClF,CAAC;CACF,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,IAAI,GAGiB,CAChC,GAAW,EACX,IAAmB,EACnB,EAAE;IACF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAA8C,CAAC;IAC/F,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACf,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;IAC/C,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAgBtB,IAAI,CACN,CAAC,EACD,CACE,IAAgC,EAChC,SAAqE,EACrE,EAAE;IACF,OAAO;QACL,GAAG,IAAI;QACP,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE;YAC/B,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC;YACtC,SAAS;SACV;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAG9B,CAAgC,IAAgC,EAAE,EAAE;IAClE,OAAO;QACL,GAAG,IAAI;QACP,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE;YAC/B,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC;YACtC,SAAS,EAAE,EAAE;SACd;KACkE,CAAC;AACxE,CAAC,CAAC;AAEJ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAgB/B,IAAI,CACN,CAAC,EACD,CACE,IAAgC,EAChC,kBAAgF,EAChF,EAAE;IACF,OAAO;QACL,GAAG,IAAI;QACP,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE;YAC/B,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC;YACtC,kBAAkB;SACnB;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAChC,CAA6B,IAA6B,EAAE,EAAE;IAC5D,MAAM,OAAO,GAAG,sBAAsB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,OAAO,CAAC,kBAAkB,CAAC;AACpC,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of midnight-sdk.
|
|
3
|
+
* Copyright (C) 2025 Midnight Foundation
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* You may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Provides types and utilities for working directly with Compact generated contract executables.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
21
|
+
import { Brand } from 'effect';
|
|
22
|
+
export const VerifierKey = Brand.nominal();
|
|
23
|
+
export const ZKIR = Brand.nominal();
|
|
24
|
+
const ProvableCircuitId_ = Brand.nominal();
|
|
25
|
+
/**
|
|
26
|
+
* Brands a circuit id, optionally narrowed to the single circuit it names.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* `K` is second and defaulted so a call site can name `C` alone. TypeScript has no *partial*
|
|
30
|
+
* type-argument inference, so naming `C` fixes `K` to its default — the union of every circuit `C`
|
|
31
|
+
* declares, which rejects arguments no circuit takes but still accepts one circuit's for another.
|
|
32
|
+
* Naming both narrows to the one literal. Naming neither — what the CLI does, from a `string`
|
|
33
|
+
* variable — leaves `C` at `Contract.Any` and brands the id over `string`.
|
|
34
|
+
*/
|
|
35
|
+
export const ProvableCircuitId = (id) =>
|
|
36
|
+
// The nominal constructor is built once, at the widest instantiation, so it hands back the brand
|
|
37
|
+
// over `string`; the cast re-states the literal the caller already passed.
|
|
38
|
+
ProvableCircuitId_(id);
|
|
39
|
+
export const getProvableCircuitIds = (contract) => Object.keys(contract.provableCircuits).map(ProvableCircuitId);
|
|
40
|
+
//# sourceMappingURL=Contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Contract.js","sourceRoot":"","sources":["../../../src/effect/Contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AAEH,uDAAuD;AAEvD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AA2F/B,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,EAAe,CAAC;AAGxD,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,EAAQ,CAAC;AAY1C,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,EAAqB,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAI/B,EAAK,EACoB,EAAE;AAC3B,iGAAiG;AACjG,2EAA2E;AAC3E,kBAAkB,CAAC,EAAE,CAA4B,CAAC;AA8DpD,MAAM,CAAC,MAAM,qBAAqB,GAAoE,CAAC,QAAQ,EAAE,EAAE,CACjH,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC"}
|