@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,129 @@
|
|
|
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
|
+
* The compact-runtime 0.21 binding. This module (together with its peers under `internal/runtime`)
|
|
17
|
+
* is the only place in `src/` that may import from `@midnight-ntwrk/compact-runtime`; everything
|
|
18
|
+
* else goes through the `CompactRuntime` facade so that a future runtime line binds by swapping
|
|
19
|
+
* `current.ts`, not by editing call sites (midnight-sdk#387). ESLint enforces this
|
|
20
|
+
* (`no-restricted-imports`); tests are exempt by design, since some must compare module identity.
|
|
21
|
+
*
|
|
22
|
+
* The runtime line is era-paired with the ledger — 0.21 with ledger 9, over onchain-runtime-v4 —
|
|
23
|
+
* so this binding and `internal/ledger/v9.ts` are swapped together. Neither is meaningful alone.
|
|
24
|
+
*/
|
|
25
|
+
import { createCircuitContext, sampleSigningKey } from '@midnight-ntwrk/compact-runtime';
|
|
26
|
+
// `CallContext`, `Effects` and `CoinCommitment` are the types of the partition inputs
|
|
27
|
+
// `ContractCallPublic` exposes (midnight-sdk#400) — `block`, `effects`, and the key type of the
|
|
28
|
+
// `comIndices` map. Without them a consumer receives the three values but cannot name what it
|
|
29
|
+
// received, and has to import the era package around the seam to declare them — which is what the
|
|
30
|
+
// facade exists to prevent. `EncodedStateValue` is not one of those: it is the encoded form a
|
|
31
|
+
// `StateValue` round-trips through and the shape a contract event's payload arrives in, listed here
|
|
32
|
+
// for consumers decoding either.
|
|
33
|
+
//
|
|
34
|
+
// `CallContext` here is **onchain-runtime-v4's** block-level context, not circuit-context.ts's
|
|
35
|
+
// `CallContext<PS>`: compact-runtime's `index.d.ts` exports both, and the explicit named re-export
|
|
36
|
+
// takes precedence over the `export *`, so this is the one the name resolves to. That is the one
|
|
37
|
+
// wanted — the other is the runtime's own per-call frame, which never reaches compact-js's surface.
|
|
38
|
+
// `CompactRuntime.tst.ts` pins which of the two resolves, so reordering those exports fails there.
|
|
39
|
+
export { CompactError, ContractMaintenanceAuthority, ContractState, createCircuitContext, createConstructorContext, decodeZswapLocalState, emptyZswapLocalState, encodeZswapLocalState, signatureVerifyingKey } from '@midnight-ntwrk/compact-runtime';
|
|
40
|
+
/**
|
|
41
|
+
* The compact-runtime line this binding targets. Read by the era-pairing check rather than
|
|
42
|
+
* hard-coded at any call site, so a runtime swap is a one-line edit here plus `current.ts`.
|
|
43
|
+
*
|
|
44
|
+
* `as const satisfies` rather than a `: RuntimeLine` annotation, matching the ledger twin
|
|
45
|
+
* (`internal/ledger/v9.ts`): an annotation widens `typeof CompactRuntime.line` to the whole union
|
|
46
|
+
* at every consumer and in the emitted `.d.ts`, which forecloses any compile-time use of the
|
|
47
|
+
* pairing. The two coincide while the union is a singleton and stop coinciding the moment a second
|
|
48
|
+
* line is bound.
|
|
49
|
+
*
|
|
50
|
+
* @category era
|
|
51
|
+
*/
|
|
52
|
+
export const line = '0.21';
|
|
53
|
+
/**
|
|
54
|
+
* Samples a fresh signing key for `kind`.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* A thin pass-through on this line: onchain-runtime-v4 keys are already tagged (`{ tag, value }`)
|
|
58
|
+
* and `sampleSigningKey` already takes the scheme. The wrapper exists so the *older* line can
|
|
59
|
+
* present the same shape — see `v0_16.ts`, where the underlying call takes no argument and returns
|
|
60
|
+
* a bare hex string — and so era-neutral code reads `.value` without branching.
|
|
61
|
+
*
|
|
62
|
+
* @category constructors
|
|
63
|
+
*/
|
|
64
|
+
export const makeSampleSigningKey = (kind) => sampleSigningKey(kind);
|
|
65
|
+
/**
|
|
66
|
+
* Builds a circuit-execution context for this line.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* A direct pass-through: 0.21 *is* the call-tree model the era-neutral view is modelled on, so this
|
|
70
|
+
* only renames parameters into `createCircuitContext`'s options and pairs the two providers into
|
|
71
|
+
* its `crossContract`. The one gap, `costModel`, keeps the runtime's own default. `costModel` is not
|
|
72
|
+
* one a caller could fill: `CostModel` has a private constructor and one static factory, whose
|
|
73
|
+
* result *is* that default.
|
|
74
|
+
*
|
|
75
|
+
* @throws If exactly one provider is supplied. The runtime would accept half a pair and fail only
|
|
76
|
+
* at the first cross-contract call, far from the caller that dropped the other half.
|
|
77
|
+
*
|
|
78
|
+
* @category execution
|
|
79
|
+
*/
|
|
80
|
+
export const createExecutionContext = (params) => {
|
|
81
|
+
const { stateProvider, moduleProvider } = params;
|
|
82
|
+
if ((stateProvider === undefined) !== (moduleProvider === undefined)) {
|
|
83
|
+
throw new Error('A cross-contract call needs both a state provider and a module provider, or neither.');
|
|
84
|
+
}
|
|
85
|
+
return createCircuitContext({
|
|
86
|
+
circuitId: params.circuitId,
|
|
87
|
+
contractAddress: params.address,
|
|
88
|
+
coinPublicKeyOrZswapState: params.zswapLocalState,
|
|
89
|
+
contractState: params.contractState,
|
|
90
|
+
privateState: params.privateState,
|
|
91
|
+
gasLimit: params.queryGasLimit,
|
|
92
|
+
time: params.time,
|
|
93
|
+
parentBlockHash: params.parentBlockHash,
|
|
94
|
+
crossContract: stateProvider === undefined || moduleProvider === undefined ? undefined : { stateProvider, moduleProvider }
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Projects this line's circuit results into the era-neutral execution view.
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* Also a pass-through: the trace, root private state, root zswap state and event list are all
|
|
102
|
+
* already on the 0.21 context. `zswapLocalState` is asserted non-`undefined` by the caller, which
|
|
103
|
+
* owns the typed failure — this function stays total.
|
|
104
|
+
*
|
|
105
|
+
* @category execution
|
|
106
|
+
*/
|
|
107
|
+
export const readExecution = (results) => ({
|
|
108
|
+
result: results.result,
|
|
109
|
+
trace: results.context.callProofDataTrace,
|
|
110
|
+
privateState: results.context.callContext.currentPrivateState,
|
|
111
|
+
zswapLocalState: results.context.callContext.currentZswapLocalState,
|
|
112
|
+
events: results.context.events,
|
|
113
|
+
// The context's map, not `results.gasCost`: that one is the root frame's tally alone and omits
|
|
114
|
+
// every callee.
|
|
115
|
+
gasCosts: results.context.gasCosts
|
|
116
|
+
});
|
|
117
|
+
const _traceEntryConforms = true;
|
|
118
|
+
void _traceEntryConforms;
|
|
119
|
+
/**
|
|
120
|
+
* Extracts the hex value of a ledger 9 era signing key.
|
|
121
|
+
*
|
|
122
|
+
* @remarks
|
|
123
|
+
* onchain-runtime-v4 keys are tagged, so the hex lives under `value`. The 0.16 binding's
|
|
124
|
+
* counterpart is the identity, its keys being bare hex strings already.
|
|
125
|
+
*
|
|
126
|
+
* @category conversions
|
|
127
|
+
*/
|
|
128
|
+
export const signingKeyHex = (key) => key.value;
|
|
129
|
+
//# sourceMappingURL=v0_21.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v0_21.js","sourceRoot":"","sources":["../../../../../src/effect/internal/runtime/v0_21.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;GASG;AACH,OAAO,EASL,oBAAoB,EAMpB,gBAAgB,EAEjB,MAAM,iCAAiC,CAAC;AAUzC,sFAAsF;AACtF,gGAAgG;AAChG,8FAA8F;AAC9F,kGAAkG;AAClG,8FAA8F;AAC9F,oGAAoG;AACpG,iCAAiC;AACjC,EAAE;AACF,+FAA+F;AAC/F,mGAAmG;AACnG,iGAAiG;AACjG,oGAAoG;AACpG,mGAAmG;AACnG,OAAO,EAQL,YAAY,EAGZ,4BAA4B,EAE5B,aAAa,EAEb,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EAErB,oBAAoB,EAGpB,qBAAqB,EAOrB,qBAAqB,EAItB,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAqC,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAmB,EAAc,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAuBhG;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,MAMC,EACmB,EAAE;IACtB,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IACjD,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,KAAK,CAAC,cAAc,KAAK,SAAS,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,sFAAsF,CAAC,CAAC;IAC1G,CAAC;IACD,OAAO,oBAAoB,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,eAAe,EAAE,MAAM,CAAC,OAAO;QAC/B,yBAAyB,EAAE,MAAM,CAAC,eAAe;QACjD,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,QAAQ,EAAE,MAAM,CAAC,aAAa;QAC9B,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,aAAa,EACX,aAAa,KAAK,SAAS,IAAI,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE;KAC9G,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,OAAmC,EACA,EAAE,CAAC,CAAC;IACvC,MAAM,EAAE,OAAO,CAAC,MAAM;IACtB,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,kBAA+C;IACtE,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,mBAAmB;IAC7D,eAAe,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,sBAAsB;IACnE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM;IAC9B,+FAA+F;IAC/F,gBAAgB;IAChB,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ;CACnC,CAAC,CAAC;AAKH,MAAM,mBAAmB,GAAoC,IAAI,CAAC;AAClE,KAAK,mBAAmB,CAAC;AAEzB;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAe,EAAU,EAAE,CAAC,GAAG,CAAC,KAAK,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=typeAssertions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeAssertions.js","sourceRoot":"","sources":["../../../../src/effect/internal/typeAssertions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 * as CompiledContract from './effect/CompiledContract.js';
|
|
16
|
+
export * from './effect/Contract.js';
|
|
17
|
+
export * as ContractEventStore from './effect/ContractEventStore.js';
|
|
18
|
+
export * as ContractExecutable from './effect/ContractExecutable.js';
|
|
19
|
+
export * from './effect/ContractKeyLocation.js';
|
|
20
|
+
export * as ContractLog from './effect/ContractLog.js';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,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,64 @@
|
|
|
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
|
+
* The **ledger 8** era-pinned Effect entry (midnight-sdk#387/#388). The `v8` suffix names the
|
|
17
|
+
* ledger era this entry targets — ledger 8 — not this package's own version.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Unlike `/v9/effect`, this entry does **not** follow `internal/ledger/current.ts`. It binds ledger
|
|
21
|
+
* 8 and its paired compact-runtime 0.16 line directly, so importing it selects an era rather than
|
|
22
|
+
* labelling whichever era the build happens to be bound to. Both era facades can be live in one
|
|
23
|
+
* process; `test/era8/LedgerEightFacade.test.ts` exercises this one alongside the ledger 9 pair.
|
|
24
|
+
*
|
|
25
|
+
* ## What this entry provides
|
|
26
|
+
*
|
|
27
|
+
* - `Ledger` — the ledger 8 seam: its types and constructors, plus the runtime↔ledger conversions
|
|
28
|
+
* instantiated for the ledger 8 / runtime 0.16 pair.
|
|
29
|
+
* - `CompactRuntime` — the compact-runtime 0.16 seam, including the execution adapter
|
|
30
|
+
* (`createExecutionContext` / `readExecution`) that presents 0.16's flat, single-frame execution
|
|
31
|
+
* model in the same shape as 0.21's call tree.
|
|
32
|
+
* - The **era-free core** (`internal/eraFreeSurface.ts`) — contract and ZK-configuration modules
|
|
33
|
+
* whose module graph reaches neither facade, so the objects here are the *same instances* the
|
|
34
|
+
* ledger 9 entry exports. This is #388's "identical public API wherever the era permits": code
|
|
35
|
+
* using them compiles unchanged against either entry.
|
|
36
|
+
*
|
|
37
|
+
* ## What it does not provide, and why
|
|
38
|
+
*
|
|
39
|
+
* **Contract events and cross-contract calls are absent because ledger 8 cannot do them.**
|
|
40
|
+
* onchain-runtime-v3's `log` payload is a bare `EncodedStateValue` with no emitting-contract
|
|
41
|
+
* address and no versioning, 0.16 accumulates nothing on the circuit context, and there is no
|
|
42
|
+
* `crossContractCall` or `ContractStateProvider` at all. `createExecutionContext` therefore
|
|
43
|
+
* *rejects* a state provider rather than ignoring it. This is the "absent, not runtime-failing"
|
|
44
|
+
* requirement in #388.
|
|
45
|
+
*
|
|
46
|
+
* **`ContractExecutable` executes against ledger 8 here, not against the build's bound era.** It is
|
|
47
|
+
* `internal/executable.ts` applied to this entry's two facades, so `deploy`, `circuit` and the
|
|
48
|
+
* maintenance operations all speak ledger 8 and runtime 0.16 — including the types they return.
|
|
49
|
+
* A cross-contract state provider is *rejected* by this era's `createExecutionContext` rather than
|
|
50
|
+
* ignored, and `CallResult.events` is statically empty, so the two features ledger 8 cannot do stay
|
|
51
|
+
* unreachable from here rather than failing at run time.
|
|
52
|
+
*
|
|
53
|
+
* A compiled ledger 8 contract still has to resolve its own `@midnight-ntwrk/compact-runtime` to
|
|
54
|
+
* the 0.16 line — its generated code imports that specifier directly and asserts
|
|
55
|
+
* `checkRuntimeVersion('0.16.0')` on load, which no compact-js entry can influence. The recipe is
|
|
56
|
+
* one line in the manifest of the package holding those artifacts; `test/effect/DualEraResolution.test.ts`
|
|
57
|
+
* pins it, and `test/era8/LedgerEightExecutable.test.ts` runs a contract end to end through this
|
|
58
|
+
* entry.
|
|
59
|
+
*/
|
|
60
|
+
export * as ContractExecutable from '../effect/internal/era/v8Executable.js';
|
|
61
|
+
export * as Ledger from '../effect/internal/era/v8Ledger.js';
|
|
62
|
+
export * as CompactRuntime from '../effect/internal/era/v8Runtime.js';
|
|
63
|
+
export * from '../effect/internal/eraFreeSurface.js';
|
|
64
|
+
//# sourceMappingURL=effect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect.js","sourceRoot":"","sources":["../../../src/v8/effect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,24 @@
|
|
|
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
|
+
* The **ledger 8** era-pinned entry (midnight-sdk#387/#388). The `v8` suffix names the ledger era
|
|
17
|
+
* this entry targets — ledger 8 — not this package's own version.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Same surface as `@midnightntwrk/compact-js/v8/effect`; see that module for what this era can
|
|
21
|
+
* and cannot do, and why `ContractExecutable` is not among it yet.
|
|
22
|
+
*/
|
|
23
|
+
export * from './effect.js';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v8/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
* The **ledger 9** era-pinned Effect entry (midnight-sdk#387/#388). The `v9` suffix names the
|
|
17
|
+
* ledger era this entry targets — ledger 9 — not this package's own version. Same API as
|
|
18
|
+
* `@midnightntwrk/compact-js/effect`.
|
|
19
|
+
*
|
|
20
|
+
* This entry **binds ledger 9 itself** (`internal/era/v9Ledger.ts` and `internal/runtime/v0_21.ts`),
|
|
21
|
+
* rather than re-exporting the facades. It used to do the latter, which made it an alias for
|
|
22
|
+
* whatever `internal/ledger/current.ts` bound: advancing that turned `/v9` into an entry for a
|
|
23
|
+
* different era, with nothing to catch it — the `/v9`-versus-root parity tests were comparing an
|
|
24
|
+
* alias with its own target. The unsuffixed `@midnightntwrk/compact-js/effect` keeps that
|
|
25
|
+
* follow-the-build-era behaviour, which is what it is *for*; the two agree today and are meant to
|
|
26
|
+
* diverge the first time `current.ts` advances.
|
|
27
|
+
*
|
|
28
|
+
* Composed from named modules rather than by re-exporting `../effect/index.js`, so what a ledger 9
|
|
29
|
+
* entry includes is visible here:
|
|
30
|
+
*
|
|
31
|
+
* - `eraFreeSurface.ts` — the core every era entry shares, the same object instances on both.
|
|
32
|
+
* - `contractEventsSurface.ts` — ledger 9 only. A ledger 8 entry omits *this* module and takes the
|
|
33
|
+
* era-free core alone (`src/v8/effect.ts`), which is the shape #388 asks for: a member that
|
|
34
|
+
* cannot exist on an older era is absent rather than present and failing.
|
|
35
|
+
* - its own `Ledger` and `CompactRuntime` bindings, plus `ContractExecutable` — see below.
|
|
36
|
+
*/
|
|
37
|
+
export * from '../effect/internal/contractEventsSurface.js';
|
|
38
|
+
export * as Ledger from '../effect/internal/era/v9Ledger.js';
|
|
39
|
+
export * as CompactRuntime from '../effect/internal/era/v9Runtime.js';
|
|
40
|
+
export * from '../effect/internal/eraFreeSurface.js';
|
|
41
|
+
// `ContractExecutable` is this entry's own application of `internal/executable.ts` to the ledger 9
|
|
42
|
+
// pair, not a re-export of `effect/ContractExecutable.ts`. That module applies the same factory to
|
|
43
|
+
// the *bound* facades, so re-exporting it would have made this entry follow a `current.ts` swap —
|
|
44
|
+
// the trap CLAUDE.md's era-swap checklist calls out at step 5. It needed a build-time assertion to
|
|
45
|
+
// catch; now it cannot happen, because the era arrives as an argument here.
|
|
46
|
+
export * as ContractExecutable from '../effect/internal/era/v9Executable.js';
|
|
47
|
+
//# sourceMappingURL=effect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect.js","sourceRoot":"","sources":["../../../src/v9/effect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,cAAc,6CAA6C,CAAC;AAC5D,OAAO,KAAK,MAAM,MAAM,oCAAoC,CAAC;AAC7D,OAAO,KAAK,cAAc,MAAM,qCAAqC,CAAC;AACtE,cAAc,sCAAsC,CAAC;AAErD,mGAAmG;AACnG,mGAAmG;AACnG,kGAAkG;AAClG,mGAAmG;AACnG,4EAA4E;AAC5E,OAAO,KAAK,kBAAkB,MAAM,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
* The **ledger 9** era-pinned entry (midnight-sdk#387/#388). The `v9` suffix names the ledger
|
|
17
|
+
* era this entry targets — ledger 9 — not this package's own version. Binding to this path
|
|
18
|
+
* records an intent to speak a specific ledger era (e.g. across a hardfork window).
|
|
19
|
+
*
|
|
20
|
+
* Same surface as `@midnightntwrk/compact-js/v9/effect`, exactly as `/v8` mirrors `/v8/effect`.
|
|
21
|
+
*
|
|
22
|
+
* This used to be `export * from '../index.js'` — the *root* barrel, which resolves both seams'
|
|
23
|
+
* `current.ts`. That made this entry an alias for whichever era the build bound, so repointing
|
|
24
|
+
* `current.ts` at ledger 10 would have turned `/v9` into a ledger 10 entry: a path naming an era it
|
|
25
|
+
* no longer speaks, with no build error to catch it. `/v9/effect` was rebound to its own binding
|
|
26
|
+
* when the era-pinned entries landed and this one was missed, which is the failure mode
|
|
27
|
+
* `internal/era/v9Ledger.ts` describes and CLAUDE.md's era-swap checklist promises cannot happen.
|
|
28
|
+
*/
|
|
29
|
+
export * from './effect.js';
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v9/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;GAaG;AACH,cAAc,aAAa,CAAC"}
|