@midnightntwrk/compact-js-command 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 +263 -2
- package/dist/dts/effect/CompiledContractReflection.d.ts +66 -0
- package/dist/dts/effect/CompiledContractReflection.d.ts.map +1 -0
- package/dist/dts/effect/ConfigCompilationError.d.ts +38 -0
- package/dist/dts/effect/ConfigCompilationError.d.ts.map +1 -0
- package/dist/dts/effect/ConfigCompiler.d.ts +63 -0
- package/dist/dts/effect/ConfigCompiler.d.ts.map +1 -0
- package/dist/dts/effect/ConfigError.d.ts +34 -0
- package/dist/dts/effect/ConfigError.d.ts.map +1 -0
- package/dist/dts/effect/index.d.ts +73 -0
- package/dist/dts/effect/index.d.ts.map +1 -0
- package/dist/dts/effect/internal/args.d.ts +7 -0
- package/dist/dts/effect/internal/args.d.ts.map +1 -0
- package/dist/dts/effect/internal/circuitCommand.d.ts +2 -0
- package/dist/dts/effect/internal/circuitCommand.d.ts.map +1 -0
- package/dist/dts/effect/internal/command.d.ts +98 -0
- package/dist/dts/effect/internal/command.d.ts.map +1 -0
- package/dist/dts/effect/internal/commandConfigProvider.d.ts +2 -0
- package/dist/dts/effect/internal/commandConfigProvider.d.ts.map +1 -0
- package/dist/dts/effect/internal/compiledContractReflection.d.ts +5 -0
- package/dist/dts/effect/internal/compiledContractReflection.d.ts.map +1 -0
- package/dist/dts/effect/internal/deployCommand.d.ts +2 -0
- package/dist/dts/effect/internal/deployCommand.d.ts.map +1 -0
- package/dist/dts/effect/internal/encodedZswapLocalStateSchema.d.ts +129 -0
- package/dist/dts/effect/internal/encodedZswapLocalStateSchema.d.ts.map +1 -0
- package/dist/dts/effect/internal/era/binding.d.ts +270 -0
- package/dist/dts/effect/internal/era/binding.d.ts.map +1 -0
- package/dist/dts/effect/internal/era/eras.d.ts +16 -0
- package/dist/dts/effect/internal/era/eras.d.ts.map +1 -0
- package/dist/dts/effect/internal/era/registry.d.ts +2 -0
- package/dist/dts/effect/internal/era/registry.d.ts.map +1 -0
- package/dist/dts/effect/internal/era/v8.d.ts +2 -0
- package/dist/dts/effect/internal/era/v8.d.ts.map +1 -0
- package/dist/dts/effect/internal/era/v9.d.ts +2 -0
- package/dist/dts/effect/internal/era/v9.d.ts.map +1 -0
- package/dist/dts/effect/internal/json.d.ts +2 -0
- package/dist/dts/effect/internal/json.d.ts.map +1 -0
- package/dist/dts/effect/internal/maintainCircuitCommand.d.ts +2 -0
- package/dist/dts/effect/internal/maintainCircuitCommand.d.ts.map +1 -0
- package/dist/dts/effect/internal/maintainCommand.d.ts +2 -0
- package/dist/dts/effect/internal/maintainCommand.d.ts.map +1 -0
- package/dist/dts/effect/internal/maintainContractCommand.d.ts +2 -0
- package/dist/dts/effect/internal/maintainContractCommand.d.ts.map +1 -0
- package/dist/dts/effect/internal/options.d.ts +7 -0
- package/dist/dts/effect/internal/options.d.ts.map +1 -0
- package/dist/dts/index.d.ts +2 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/esm/effect/CompiledContractReflection.js +33 -0
- package/dist/esm/effect/CompiledContractReflection.js.map +1 -0
- package/dist/esm/effect/ConfigCompilationError.js +40 -0
- package/dist/esm/effect/ConfigCompilationError.js.map +1 -0
- package/dist/esm/effect/ConfigCompiler.js +73 -0
- package/dist/esm/effect/ConfigCompiler.js.map +1 -0
- package/dist/esm/effect/ConfigError.js +40 -0
- package/dist/esm/effect/ConfigError.js.map +1 -0
- package/dist/esm/effect/index.js +53 -0
- package/dist/esm/effect/index.js.map +1 -0
- package/dist/esm/effect/internal/args.js +25 -0
- package/dist/esm/effect/internal/args.js.map +1 -0
- package/dist/esm/effect/internal/circuitCommand.js +282 -0
- package/dist/esm/effect/internal/circuitCommand.js.map +1 -0
- package/dist/esm/effect/internal/command.js +316 -0
- package/dist/esm/effect/internal/command.js.map +1 -0
- package/dist/esm/effect/internal/commandConfigProvider.js +19 -0
- package/dist/esm/effect/internal/commandConfigProvider.js.map +1 -0
- package/dist/esm/effect/internal/compiledContractReflection.js +296 -0
- package/dist/esm/effect/internal/compiledContractReflection.js.map +1 -0
- package/dist/esm/effect/internal/deployCommand.js +68 -0
- package/dist/esm/effect/internal/deployCommand.js.map +1 -0
- package/dist/esm/effect/internal/encodedZswapLocalStateSchema.js +51 -0
- package/dist/esm/effect/internal/encodedZswapLocalStateSchema.js.map +1 -0
- package/dist/esm/effect/internal/era/binding.js +16 -0
- package/dist/esm/effect/internal/era/binding.js.map +1 -0
- package/dist/esm/effect/internal/era/eras.js +50 -0
- package/dist/esm/effect/internal/era/eras.js.map +1 -0
- package/dist/esm/effect/internal/era/registry.js +46 -0
- package/dist/esm/effect/internal/era/registry.js.map +1 -0
- package/dist/esm/effect/internal/era/v8.js +75 -0
- package/dist/esm/effect/internal/era/v8.js.map +1 -0
- package/dist/esm/effect/internal/era/v9.js +61 -0
- package/dist/esm/effect/internal/era/v9.js.map +1 -0
- package/dist/esm/effect/internal/json.js +41 -0
- package/dist/esm/effect/internal/json.js.map +1 -0
- package/dist/esm/effect/internal/maintainCircuitCommand.js +62 -0
- package/dist/esm/effect/internal/maintainCircuitCommand.js.map +1 -0
- package/dist/esm/effect/internal/maintainCommand.js +35 -0
- package/dist/esm/effect/internal/maintainCommand.js.map +1 -0
- package/dist/esm/effect/internal/maintainContractCommand.js +64 -0
- package/dist/esm/effect/internal/maintainContractCommand.js.map +1 -0
- package/dist/esm/effect/internal/options.js +137 -0
- package/dist/esm/effect/internal/options.js.map +1 -0
- package/dist/esm/index.js +44 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +4 -0
- package/effect/CompiledContractReflection/package.json +5 -0
- package/effect/ConfigCompilationError/package.json +5 -0
- package/effect/ConfigCompiler/package.json +5 -0
- package/effect/ConfigError/package.json +5 -0
- package/effect/index/package.json +5 -0
- package/effect/package.json +5 -0
- package/package.json +96 -4
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { FileSystem, Path } from '@effect/platform';
|
|
2
|
+
import { type PlatformError } from '@effect/platform/Error';
|
|
3
|
+
import { NodeContext } from '@effect/platform-node';
|
|
4
|
+
import * as Configuration from '@midnight-ntwrk/platform-js/effect/Configuration';
|
|
5
|
+
import { type ContractExecutable, type ContractRuntimeError, type ZKConfiguration } from '@midnightntwrk/compact-js/effect';
|
|
6
|
+
import { ConfigError as EffectConfigError, type ConfigProvider, Effect, Layer } from 'effect';
|
|
7
|
+
import * as ConfigCompilationError from '../ConfigCompilationError.js';
|
|
8
|
+
import * as ConfigCompiler from '../ConfigCompiler.js';
|
|
9
|
+
import * as ConfigError from '../ConfigError.js';
|
|
10
|
+
import type * as EraBinding from './era/binding.js';
|
|
11
|
+
/**
|
|
12
|
+
* The intent operations every command shares, instantiated for one era.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* `tryLedger` is the era's own `Ledger.tryConvert` under the name the command handlers know it by,
|
|
16
|
+
* so there is exactly one copy of the boundary handling. Ledger bindings signal rejection by
|
|
17
|
+
* *throwing* — `Intent.addMaintenanceUpdate()` throws `'expected instance of MaintenanceUpdate'`
|
|
18
|
+
* when handed a value built against a different WASM instance, which is exactly what a config and a
|
|
19
|
+
* `--ledger-era` that disagree produce. A throw inside `Effect.gen` becomes a defect, and a defect
|
|
20
|
+
* escapes both the `Effect.mapError(...)` a handler ends with *and* {@link invocationHandler}'s
|
|
21
|
+
* `Effect.catchAll(reportContractExecutionError)`: the user gets a raw fiber dump instead of the
|
|
22
|
+
* CLI's formatted report. Every ledger call made outside the facade goes through here.
|
|
23
|
+
*
|
|
24
|
+
* The compact-runtime seam has the same hazard and the same wrapper: reach for the era's
|
|
25
|
+
* `CompactRuntime.tryRuntime` at a runtime call site rather than adding a third alias.
|
|
26
|
+
*/
|
|
27
|
+
export interface Intents {
|
|
28
|
+
readonly tryLedger: <A>(message: string, evaluate: () => A extends PromiseLike<unknown> ? never : A) => Effect.Effect<A, ContractRuntimeError.ContractRuntimeError>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates an empty ledger `Intent` with the command-wide TTL applied. Every command emits its
|
|
31
|
+
* result as an intent with the same TTL policy; single-sourcing it here keeps the default in one
|
|
32
|
+
* place.
|
|
33
|
+
*/
|
|
34
|
+
readonly newIntent: () => Effect.Effect<EraBinding.CommandIntent, ContractRuntimeError.ContractRuntimeError>;
|
|
35
|
+
/**
|
|
36
|
+
* Serializes a ledger `Intent`, ready for writing to a command's output file.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Takes {@link EraBinding.CommandIntent} rather than a bare `{ serialize(): Uint8Array }` duck
|
|
40
|
+
* type: ledger contract states are serialized through `tryLedger` with that identical shape
|
|
41
|
+
* elsewhere in this package, so a structural parameter would accept one, write a contract state
|
|
42
|
+
* into the intent output file, and still report 'Failed to serialize the intent' — with nothing
|
|
43
|
+
* catching it until the file is deserialized as an `Intent` at submission. In a seam built to
|
|
44
|
+
* make era and type mismatches loud, this is the one signature that would let a wrong type
|
|
45
|
+
* through quietly. `CommandIntent` also demands the three `add*` members, so a contract state
|
|
46
|
+
* does not satisfy it.
|
|
47
|
+
*/
|
|
48
|
+
readonly serializeIntent: (intent: EraBinding.CommandIntent) => Effect.Effect<Uint8Array, ContractRuntimeError.ContractRuntimeError>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Pretty prints a configuration error from {@link ConfigCompiler.ConfigCompiler | ConfigCompiler} implementations.
|
|
52
|
+
*
|
|
53
|
+
* @param err The {@link ConfigError.ConfigError | ConfigError} or
|
|
54
|
+
* {@link ConfigCompilationError.ConfigCompilationError | ConfigCompilationError} to report for.
|
|
55
|
+
* @returns An `Effect` that writes `err` to the console.
|
|
56
|
+
*/
|
|
57
|
+
export declare const reportContractConfigError: (err: ConfigError.ConfigError | ConfigCompilationError.ConfigCompilationError) => Effect.Effect<void, never>;
|
|
58
|
+
/**
|
|
59
|
+
* Pretty prints a configuration or contract execution error.
|
|
60
|
+
*
|
|
61
|
+
* @param err The {@link ContractExecutable.ContractExecutionError | ContractExecutionError} or `ConfigError` to
|
|
62
|
+
* report for.
|
|
63
|
+
* @returns An `Effect` that writes `err` to the console.
|
|
64
|
+
*/
|
|
65
|
+
export declare const reportContractExecutionError: (err: ContractExecutable.ContractExecutionError | EffectConfigError.ConfigError | PlatformError) => Effect.Effect<void, never>;
|
|
66
|
+
/**
|
|
67
|
+
* Creates a default layer that provides services for executing Compact contracts via a command line.
|
|
68
|
+
*
|
|
69
|
+
* @param configProvider
|
|
70
|
+
* @param zkBaseFolderPath A base path to a folder containing the ZK assets for the contract that will be in
|
|
71
|
+
* scope during invocation
|
|
72
|
+
*
|
|
73
|
+
* @category layers
|
|
74
|
+
*/
|
|
75
|
+
export declare const layer: (configProvider: ConfigProvider.ConfigProvider, zkBaseFolderPath: string) => Layer.Layer<ZKConfiguration.ZKConfiguration | Configuration.Keys | Configuration.Network | NodeContext.NodeContext, EffectConfigError.ConfigError>;
|
|
76
|
+
/**
|
|
77
|
+
* Creates an appropriate runtime for a command handler, having first resolved the era the
|
|
78
|
+
* invocation selected.
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* The parameter is a *selector* rather than a handler because the handler is era-specific: each
|
|
82
|
+
* command module is a factory applied once per era (`internal/era/v8.ts`, `internal/era/v9.ts`),
|
|
83
|
+
* and this is where `--ledger-era` stops being a validated-then-discarded option and becomes the
|
|
84
|
+
* choice of which of those applications runs.
|
|
85
|
+
*
|
|
86
|
+
* It takes the era as a *number* and resolves nothing itself, so this module does not import the
|
|
87
|
+
* era registry. That keeps the graph acyclic — the registry imports the command modules, which
|
|
88
|
+
* import this one — and leaves `effect/index.ts`, which is downstream of all of them, as the single
|
|
89
|
+
* place where a command is tied to the handler it wants.
|
|
90
|
+
*
|
|
91
|
+
* @param handlerForEra Picks this command's handler for the selected ledger era, e.g.
|
|
92
|
+
* `(era) => EraRegistry.forLedgerEra(era).circuit`.
|
|
93
|
+
* @returns An `Effect` that adapts the selected handler by compiling the configured configuration
|
|
94
|
+
* file, reconciling its era against the selected one, and invoking the handler within an
|
|
95
|
+
* appropriate `ContractExecutableRuntime`.
|
|
96
|
+
*/
|
|
97
|
+
export declare const invocationHandler: <I>(handlerForEra: (ledgerEra: number) => CommandHandler<I>) => (inputs: I & GlobalOptions) => Effect.Effect<void, ConfigError.ConfigError | EffectConfigError.ConfigError, Path.Path | FileSystem.FileSystem | ConfigCompiler.ConfigCompiler>;
|
|
98
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/effect/internal/command.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,KAAK,aAAa,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAE,KAAK,kBAAkB,EAA6B,KAAK,oBAAoB,EAAE,KAAK,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEvJ,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,KAAK,cAAc,EAA+B,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAG3H,OAAO,KAAK,sBAAsB,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AAEjD,OAAO,KAAK,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAepD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,EACpB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,CAAC,SAAS,WAAW,CAAC,OAAO,CAAC,GAAG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AAC,GAAG,aAAa,KACxB,MAAM,CAAC,MAAM,CACX,IAAI,EACJ,WAAW,CAAC,WAAW,GAAG,iBAAiB,CAAC,WAAW,EACvD,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,UAAU,GAAG,cAAc,CAAC,cAAc,CAgClE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandConfigProvider.d.ts","sourceRoot":"","sources":["../../../../src/effect/internal/commandConfigProvider.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FileSystem, Path } from '@effect/platform';
|
|
2
|
+
import { Layer } from 'effect';
|
|
3
|
+
import * as CompiledContractReflection from "../CompiledContractReflection.js";
|
|
4
|
+
export declare const layer: (baseAssetFolderPath?: string) => Layer.Layer<CompiledContractReflection.CompiledContractReflection, never, Path.Path | FileSystem.FileSystem>;
|
|
5
|
+
//# sourceMappingURL=compiledContractReflection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiledContractReflection.d.ts","sourceRoot":"","sources":["../../../../src/effect/internal/compiledContractReflection.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,EAA4B,KAAK,EAAE,MAAM,QAAQ,CAAC;AAOzD,OAAO,KAAK,0BAA0B,MAAM,kCAAkC,CAAC;AAsV/E,eAAO,MAAM,KAAK,GAAI,4BAAyB,iHAU9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployCommand.d.ts","sourceRoot":"","sources":["../../../../src/effect/internal/deployCommand.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
export declare const EncodedCoinPublicKeySchema: Schema.Struct<{
|
|
3
|
+
bytes: typeof Schema.Uint8Array;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const EncodedContractAddressSchema: Schema.Struct<{
|
|
6
|
+
bytes: typeof Schema.Uint8Array;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const EncodedQualifiedShieldedCoinInfoSchema: Schema.Struct<{
|
|
9
|
+
nonce: typeof Schema.Uint8Array;
|
|
10
|
+
color: typeof Schema.Uint8Array;
|
|
11
|
+
value: typeof Schema.BigInt;
|
|
12
|
+
mt_index: typeof Schema.BigInt;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const EncodedShieldedCoinInfoSchema: Schema.Struct<{
|
|
15
|
+
nonce: typeof Schema.Uint8Array;
|
|
16
|
+
color: typeof Schema.Uint8Array;
|
|
17
|
+
value: typeof Schema.BigInt;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const EncodedRecipientSchema: Schema.Struct<{
|
|
20
|
+
is_left: typeof Schema.Boolean;
|
|
21
|
+
left: Schema.Struct<{
|
|
22
|
+
bytes: typeof Schema.Uint8Array;
|
|
23
|
+
}>;
|
|
24
|
+
right: Schema.Struct<{
|
|
25
|
+
bytes: typeof Schema.Uint8Array;
|
|
26
|
+
}>;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const EncodedZswapLocalStateSchema: Schema.Struct<{
|
|
29
|
+
coinPublicKey: Schema.Struct<{
|
|
30
|
+
bytes: typeof Schema.Uint8Array;
|
|
31
|
+
}>;
|
|
32
|
+
currentIndex: typeof Schema.BigInt;
|
|
33
|
+
inputs: Schema.mutable<Schema.Array$<Schema.Struct<{
|
|
34
|
+
nonce: typeof Schema.Uint8Array;
|
|
35
|
+
color: typeof Schema.Uint8Array;
|
|
36
|
+
value: typeof Schema.BigInt;
|
|
37
|
+
mt_index: typeof Schema.BigInt;
|
|
38
|
+
}>>>;
|
|
39
|
+
outputs: Schema.mutable<Schema.Array$<Schema.Struct<{
|
|
40
|
+
coinInfo: Schema.Struct<{
|
|
41
|
+
nonce: typeof Schema.Uint8Array;
|
|
42
|
+
color: typeof Schema.Uint8Array;
|
|
43
|
+
value: typeof Schema.BigInt;
|
|
44
|
+
}>;
|
|
45
|
+
recipient: Schema.Struct<{
|
|
46
|
+
is_left: typeof Schema.Boolean;
|
|
47
|
+
left: Schema.Struct<{
|
|
48
|
+
bytes: typeof Schema.Uint8Array;
|
|
49
|
+
}>;
|
|
50
|
+
right: Schema.Struct<{
|
|
51
|
+
bytes: typeof Schema.Uint8Array;
|
|
52
|
+
}>;
|
|
53
|
+
}>;
|
|
54
|
+
}>>>;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* This schema's decoded type — the shape the commands hand to, and receive from, an era's
|
|
58
|
+
* compact-runtime zswap codec.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* Every check that used to sit here against `CompactRuntime.EncodedZswapLocalState` has moved into
|
|
62
|
+
* `internal/era/binding.ts`, which states them once per era the CLI can select rather than once
|
|
63
|
+
* against whichever line the build happens to bind: the two assignability pins as the *parameter*
|
|
64
|
+
* and *return* types of `CommandRuntime`'s zswap members (parameters contravariantly, returns
|
|
65
|
+
* covariantly), and the key-set comparison as `AssertNoZswapKeyDrift`.
|
|
66
|
+
*
|
|
67
|
+
* Why the encode direction matters is unchanged and worth keeping in view: `Schema.Struct` defaults
|
|
68
|
+
* to `onExcessProperty: 'ignore'`, so a field added to a line's encoded zswap state would be
|
|
69
|
+
* silently stripped from every written `--output-zswap` file, surfacing only when the file is read
|
|
70
|
+
* back and the coin set is wrong.
|
|
71
|
+
*/
|
|
72
|
+
export type EncodedZswapLocalStateSchema = typeof EncodedZswapLocalStateSchema.Type;
|
|
73
|
+
export declare const encodeZswapLocalStateObject: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
|
|
74
|
+
readonly coinPublicKey: {
|
|
75
|
+
readonly bytes: readonly number[];
|
|
76
|
+
};
|
|
77
|
+
readonly currentIndex: string;
|
|
78
|
+
readonly inputs: {
|
|
79
|
+
readonly value: string;
|
|
80
|
+
readonly nonce: readonly number[];
|
|
81
|
+
readonly color: readonly number[];
|
|
82
|
+
readonly mt_index: string;
|
|
83
|
+
}[];
|
|
84
|
+
readonly outputs: {
|
|
85
|
+
readonly recipient: {
|
|
86
|
+
readonly left: {
|
|
87
|
+
readonly bytes: readonly number[];
|
|
88
|
+
};
|
|
89
|
+
readonly is_left: boolean;
|
|
90
|
+
readonly right: {
|
|
91
|
+
readonly bytes: readonly number[];
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
readonly coinInfo: {
|
|
95
|
+
readonly value: string;
|
|
96
|
+
readonly nonce: readonly number[];
|
|
97
|
+
readonly color: readonly number[];
|
|
98
|
+
};
|
|
99
|
+
}[];
|
|
100
|
+
}, import("effect/ParseResult").ParseError, never>;
|
|
101
|
+
export declare const decodeZswapLocalStateObject: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
|
|
102
|
+
readonly coinPublicKey: {
|
|
103
|
+
readonly bytes: Uint8Array<ArrayBufferLike>;
|
|
104
|
+
};
|
|
105
|
+
readonly currentIndex: bigint;
|
|
106
|
+
readonly inputs: {
|
|
107
|
+
readonly value: bigint;
|
|
108
|
+
readonly nonce: Uint8Array<ArrayBufferLike>;
|
|
109
|
+
readonly color: Uint8Array<ArrayBufferLike>;
|
|
110
|
+
readonly mt_index: bigint;
|
|
111
|
+
}[];
|
|
112
|
+
readonly outputs: {
|
|
113
|
+
readonly recipient: {
|
|
114
|
+
readonly left: {
|
|
115
|
+
readonly bytes: Uint8Array<ArrayBufferLike>;
|
|
116
|
+
};
|
|
117
|
+
readonly is_left: boolean;
|
|
118
|
+
readonly right: {
|
|
119
|
+
readonly bytes: Uint8Array<ArrayBufferLike>;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
readonly coinInfo: {
|
|
123
|
+
readonly value: bigint;
|
|
124
|
+
readonly nonce: Uint8Array<ArrayBufferLike>;
|
|
125
|
+
readonly color: Uint8Array<ArrayBufferLike>;
|
|
126
|
+
};
|
|
127
|
+
}[];
|
|
128
|
+
}, import("effect/ParseResult").ParseError, never>;
|
|
129
|
+
//# sourceMappingURL=encodedZswapLocalStateSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encodedZswapLocalStateSchema.d.ts","sourceRoot":"","sources":["../../../../src/effect/internal/encodedZswapLocalStateSchema.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,0BAA0B;;EAErC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;EAEvC,CAAC;AAEH,eAAO,MAAM,sCAAsC;;;;;EAKjD,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;EAIxC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;EAIjC,CAAC;AAIH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQvC,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,4BAA4B,GAAG,OAAO,4BAA4B,CAAC,IAAI,CAAC;AAEpF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAAqD,CAAC;AAC9F,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAAqD,CAAC"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a command handler needs from an era, declared above every era.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* The command handlers used to be written against the bound `Ledger` and `CompactRuntime` facades
|
|
6
|
+
* — roughly forty call sites — which made the CLI single-era by construction and left
|
|
7
|
+
* `--ledger-era` able to do nothing but reject a value it could not honour. The handlers are now
|
|
8
|
+
* factories over the three interfaces below, exactly as `compact-js`'s `internal/executable.ts` is
|
|
9
|
+
* a factory over its two: **an era is an argument, not a module path** (midnight-sdk#387/#388).
|
|
10
|
+
*
|
|
11
|
+
* The contracts are deliberately *narrow*: only the members the handlers call, and never the whole
|
|
12
|
+
* facade. Era-varying values are typed `never` in parameter position, so any era's concrete type is
|
|
13
|
+
* assignable (parameters are contravariant) and the handlers must cast at each call — the same
|
|
14
|
+
* `as never` discipline `ExecutableLedger` uses, and for the same reason. What flows between the
|
|
15
|
+
* executable and the facade is opaque to the handler by design: it is that era's contract state,
|
|
16
|
+
* transcript or zswap state, and the handler's job is to carry it from one era-matched call to the
|
|
17
|
+
* next, not to name it.
|
|
18
|
+
*
|
|
19
|
+
* Two members are *not* opaque, and that is load-bearing — see {@link CommandRuntime}.
|
|
20
|
+
*
|
|
21
|
+
* This docblock carries no internal-marker JSDoc tag. A module docblock attaches to the file's
|
|
22
|
+
* first statement, so under `stripInternal` the marker deletes it — here the imports every
|
|
23
|
+
* declaration below is written in terms of, leaving typings that name namespaces they no longer
|
|
24
|
+
* import. Privacy comes from `package.json` `exports` blocking `./effect/internal/*` instead. See
|
|
25
|
+
* `compact-js`'s `internal/boundary.ts` for why this note does not spell the tag out.
|
|
26
|
+
*/
|
|
27
|
+
import type * as SigningKey from '@midnight-ntwrk/platform-js/effect/SigningKey';
|
|
28
|
+
import type { CompiledContract, Contract, ContractExecutable, Ledger } from '@midnightntwrk/compact-js/effect';
|
|
29
|
+
import { type ContractRuntimeError } from '@midnightntwrk/compact-js/effect';
|
|
30
|
+
import { type Effect, type Option } from 'effect';
|
|
31
|
+
import { type EncodedZswapLocalStateSchema } from '../encodedZswapLocalStateSchema.js';
|
|
32
|
+
/**
|
|
33
|
+
* A wrapper that holds a WASM-boundary rejection in the error channel — `Ledger.tryConvert` on the
|
|
34
|
+
* ledger side, `CompactRuntime.tryRuntime` on the runtime side. Both facades of every era export
|
|
35
|
+
* one, which is part of what "the same public API across eras" means.
|
|
36
|
+
*/
|
|
37
|
+
type TryBoundary = <A>(message: string, evaluate: () => A extends PromiseLike<unknown> ? never : A) => Effect.Effect<A, ContractRuntimeError.ContractRuntimeError>;
|
|
38
|
+
/** A conversion across the ledger seam, which fails rather than throwing. */
|
|
39
|
+
type Convert<A> = (value: never) => Effect.Effect<A, ContractRuntimeError.ContractRuntimeError>;
|
|
40
|
+
/**
|
|
41
|
+
* An era's ledger `ContractState`, as the handlers use it: deserialized from `--input`, re-pointed
|
|
42
|
+
* at a post-execution `ChargedState`, and serialized back out to `--output-oc`.
|
|
43
|
+
*
|
|
44
|
+
* `data` is `unknown` rather than `never` so that each era's own `ChargedState` type is assignable
|
|
45
|
+
* *into* the slot; the value written is always built by the same era's `ChargedState` constructor,
|
|
46
|
+
* one line above the write.
|
|
47
|
+
*/
|
|
48
|
+
export interface CommandContractState {
|
|
49
|
+
data: unknown;
|
|
50
|
+
serialize(): Uint8Array;
|
|
51
|
+
}
|
|
52
|
+
/** An era's `ContractOperation`, as the handlers use it: routed into a call prototype and hashed. */
|
|
53
|
+
export interface CommandContractOperation {
|
|
54
|
+
readonly verifierKey: Uint8Array;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* An era's ledger `Intent` — the one thing every command produces.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* Recursive rather than opaque because the handlers chain onto the result: `addCall` in a fold over
|
|
61
|
+
* the call trace, then `serialize`. Each era's `Intent` is a phantom-typed class whose `add*`
|
|
62
|
+
* methods return a re-parameterised `Intent`, and stating the relationship here is what lets one
|
|
63
|
+
* fold body serve every era.
|
|
64
|
+
*/
|
|
65
|
+
export interface CommandIntent {
|
|
66
|
+
addCall(call: never): CommandIntent;
|
|
67
|
+
addDeploy(deploy: never): CommandIntent;
|
|
68
|
+
addMaintenanceUpdate(update: never): CommandIntent;
|
|
69
|
+
serialize(): Uint8Array;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The ledger-facade members the command handlers call.
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* Satisfied by every era's `Ledger` — `@midnightntwrk/compact-js/v8/effect`'s as much as
|
|
76
|
+
* `/v9/effect`'s — because it names only what is common to both and keeps the era's own types in
|
|
77
|
+
* `never`/`unknown` positions.
|
|
78
|
+
*/
|
|
79
|
+
export interface CommandLedger {
|
|
80
|
+
/** This era's descriptor. `era.ledger` is what `--ledger-era` selects on, and what errors quote. */
|
|
81
|
+
readonly era: Ledger.Era;
|
|
82
|
+
readonly Intent: {
|
|
83
|
+
readonly new: (ttl: Date) => CommandIntent;
|
|
84
|
+
};
|
|
85
|
+
readonly ChargedState: new (state: never) => unknown;
|
|
86
|
+
readonly ContractCallPrototype: new (address: never, entryPoint: never, operation: never, guaranteedTranscript: never, fallibleTranscript: never, privateTranscriptOutputs: never, input: never, output: never, communicationCommitmentRand: never, keyLocation: never) => unknown;
|
|
87
|
+
readonly ContractDeploy: new (contractState: never) => unknown;
|
|
88
|
+
readonly communicationCommitmentRandomness: () => unknown;
|
|
89
|
+
readonly tryConvert: TryBoundary;
|
|
90
|
+
readonly contractStateFromBytes: (bytes: Uint8Array) => Effect.Effect<CommandContractState, ContractRuntimeError.ContractRuntimeError>;
|
|
91
|
+
readonly parametersFromBytes: (bytes: Uint8Array) => Effect.Effect<unknown, ContractRuntimeError.ContractRuntimeError>;
|
|
92
|
+
readonly fromRuntimeContractState: Convert<CommandContractState>;
|
|
93
|
+
readonly toRuntimeContractState: Convert<unknown>;
|
|
94
|
+
readonly fromRuntimeStateValue: Convert<unknown>;
|
|
95
|
+
readonly operationForCircuit: (contractState: never, circuitId: string, contractAddress: string) => Effect.Effect<CommandContractOperation, ContractRuntimeError.ContractRuntimeError>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The compact-runtime-facade members the command handlers call.
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* The two zswap members are typed against the CLI's own
|
|
102
|
+
* {@link EncodedZswapLocalStateSchema} rather than left opaque, and that is deliberate. `--input-zswap`
|
|
103
|
+
* decodes a JSON file through that schema and hands the result to `decodeZswapLocalState`;
|
|
104
|
+
* `--output-zswap` takes what `encodeZswapLocalState` produced and writes it back through the same
|
|
105
|
+
* schema, which — `Schema.Struct` defaulting to `onExcessProperty: 'ignore'` — *strips* fields it
|
|
106
|
+
* does not know rather than rejecting them. So a line whose encoded zswap state gained a field
|
|
107
|
+
* would silently drop it from every written state file.
|
|
108
|
+
*
|
|
109
|
+
* Stating the two shapes here checks both directions at each era's instantiation: `decode`'s
|
|
110
|
+
* parameter is contravariant, so the schema's type must be assignable to the line's, and `encode`'s
|
|
111
|
+
* return is covariant, so the line's must be assignable to the schema's. That replaces the pair of
|
|
112
|
+
* hand-written assertions that used to sit in `encodedZswapLocalStateSchema.ts` checking only the
|
|
113
|
+
* *bound* line, and extends the guarantee to every era the CLI can select.
|
|
114
|
+
*/
|
|
115
|
+
export interface CommandRuntime {
|
|
116
|
+
readonly tryRuntime: TryBoundary;
|
|
117
|
+
readonly decodeZswapLocalState: (state: EncodedZswapLocalStateSchema) => unknown;
|
|
118
|
+
readonly encodeZswapLocalState: (state: never) => EncodedZswapLocalStateSchema;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Fails the build if a line's `EncodedZswapLocalState` has a key the CLI's schema does not —
|
|
122
|
+
* the gap neither direction of {@link CommandRuntime}'s zswap members covers.
|
|
123
|
+
*
|
|
124
|
+
* @remarks
|
|
125
|
+
* An **optional** field added to the runtime's type is assignable in both directions, so both pins
|
|
126
|
+
* stay silent, yet it is exactly what a compatible upstream release adds. `Schema.Struct` defaults
|
|
127
|
+
* to `onExcessProperty: 'ignore'`, so the field is **stripped** rather than rejected:
|
|
128
|
+
* `--output-zswap` writes a value that came *from* the runtime, so the field vanishes from every
|
|
129
|
+
* written state file with the build still green, and the loss surfaces much later, when the file is
|
|
130
|
+
* read back through `--input-zswap` and the coin set is wrong.
|
|
131
|
+
*
|
|
132
|
+
* Comparing key sets rather than types is what makes optional fields visible. Applied once per era
|
|
133
|
+
* in `internal/era/v<N>.ts`, where that era's `CompactRuntime` is in scope. The constraint is on
|
|
134
|
+
* the *argument*, so it is not vacuous the way `T extends never` in return position would be: the
|
|
135
|
+
* excess keys are what gets checked against `never`, and any non-empty union fails to satisfy it.
|
|
136
|
+
*/
|
|
137
|
+
export type AssertNoZswapKeyDrift<ExcessKeys extends never> = ExcessKeys;
|
|
138
|
+
/** The excess keys {@link AssertNoZswapKeyDrift} is applied to, for a line's encoded zswap state. */
|
|
139
|
+
export type ZswapKeyDrift<S> = Exclude<keyof S, keyof EncodedZswapLocalStateSchema>;
|
|
140
|
+
/**
|
|
141
|
+
* The capabilities an era either has or does not, as the commands see them.
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* A capability an era lacks is **absent** here rather than present and failing, mirroring how
|
|
145
|
+
* `/v8/effect` omits the contract-event modules instead of exporting ones that throw. The commands
|
|
146
|
+
* read absence to reject the options that depend on it, naming the era, before any work starts.
|
|
147
|
+
*
|
|
148
|
+
* The two are shaped differently because they *are* different: cross-contract calls need a
|
|
149
|
+
* value from the era (a state provider built against that era's conversions), while events need
|
|
150
|
+
* only a yes/no. Deriving the second from the first would be a coincidence, not a fact.
|
|
151
|
+
*/
|
|
152
|
+
export interface EraCapabilities {
|
|
153
|
+
/**
|
|
154
|
+
* Builds this era's cross-contract state provider over a directory of ledger-serialized contract
|
|
155
|
+
* states, or is absent on an era with no cross-contract calls at all.
|
|
156
|
+
*
|
|
157
|
+
* @remarks
|
|
158
|
+
* Absence is the CLI's gate, but not the only one: on such an era the runtime line's
|
|
159
|
+
* `createExecutionContext` *rejects* a state provider outright, so a handler that slipped one
|
|
160
|
+
* through would fail loudly rather than execute against stale state.
|
|
161
|
+
*/
|
|
162
|
+
readonly makeContractStateProvider?: (baseFolderPath: string) => unknown;
|
|
163
|
+
/**
|
|
164
|
+
* Builds this era's cross-contract module provider over a directory of compiled contracts, or is
|
|
165
|
+
* absent on an era with no cross-contract calls. A callee needs its code as well as its state,
|
|
166
|
+
* therefore an era that has one of these two members has both.
|
|
167
|
+
*/
|
|
168
|
+
readonly makeContractModuleProvider?: (baseFolderPath: string) => unknown;
|
|
169
|
+
/** Whether circuits on this era can emit contract log events (MIP-0002). */
|
|
170
|
+
readonly contractEvents: boolean;
|
|
171
|
+
}
|
|
172
|
+
/** One entry of a circuit execution's call trace, as the `circuit` command consumes it. */
|
|
173
|
+
export interface CommandContractCall {
|
|
174
|
+
readonly contractAddress: string;
|
|
175
|
+
readonly circuitId: string;
|
|
176
|
+
readonly public: {
|
|
177
|
+
readonly contractState: unknown;
|
|
178
|
+
readonly partitionedTranscript: readonly [unknown, unknown];
|
|
179
|
+
};
|
|
180
|
+
readonly private: {
|
|
181
|
+
readonly input: unknown;
|
|
182
|
+
readonly output: unknown;
|
|
183
|
+
readonly privateTranscriptOutputs: readonly unknown[];
|
|
184
|
+
readonly zswapLocalState: unknown;
|
|
185
|
+
};
|
|
186
|
+
readonly communicationCommitment: Option.Option<{
|
|
187
|
+
readonly commCommRand: unknown;
|
|
188
|
+
}>;
|
|
189
|
+
}
|
|
190
|
+
/** The result of `ContractExecutable.circuit`, as the `circuit` command consumes it. */
|
|
191
|
+
export interface CommandCallResult<PS> {
|
|
192
|
+
readonly result: unknown;
|
|
193
|
+
readonly privateState: PS | undefined;
|
|
194
|
+
readonly zswapLocalState: unknown;
|
|
195
|
+
readonly events: readonly unknown[];
|
|
196
|
+
readonly calls: readonly CommandContractCall[];
|
|
197
|
+
}
|
|
198
|
+
/** The result of `ContractExecutable.initialize`, as the `deploy` command consumes it. */
|
|
199
|
+
export interface CommandDeployResult<PS> {
|
|
200
|
+
readonly public: {
|
|
201
|
+
readonly contractState: unknown;
|
|
202
|
+
};
|
|
203
|
+
readonly private: {
|
|
204
|
+
readonly privateState: PS;
|
|
205
|
+
readonly zswapLocalState: unknown;
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/** The result of the maintenance operations, as the `maintain` commands consume them. */
|
|
209
|
+
export interface CommandMaintenanceResult {
|
|
210
|
+
readonly public: {
|
|
211
|
+
readonly maintenanceUpdate: unknown;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* A contract executable as the commands use it — era-agnostic on purpose.
|
|
216
|
+
*
|
|
217
|
+
* @remarks
|
|
218
|
+
* The executable in a `contract.config.ts` is built by *the config author's* import: `/v8/effect`
|
|
219
|
+
* or `/v9/effect` fixes its era, not anything the CLI does. Naming one era's
|
|
220
|
+
* `ContractExecutable` here would therefore declare a config written against the other era to be
|
|
221
|
+
* the wrong type, which is precisely backwards — the CLI accepts either and reconciles the two era
|
|
222
|
+
* choices at run time by comparing {@link era} with the selected `--ledger-era`.
|
|
223
|
+
*
|
|
224
|
+
* So the members are described structurally, with era-typed arguments left `never` and era-typed
|
|
225
|
+
* results left `unknown`. The looseness is the same looseness the CLI already had (it loads an
|
|
226
|
+
* arbitrary module at run time and reflects over it), only now it is stated rather than inherited
|
|
227
|
+
* from a `ModuleSpec<PS = any>`.
|
|
228
|
+
*/
|
|
229
|
+
export interface CommandExecutable<PS = any> {
|
|
230
|
+
/** The era this executable was built for — `ContractExecutable`'s own `era`, not the CLI's. */
|
|
231
|
+
readonly era: Ledger.Era;
|
|
232
|
+
readonly compiledContract: CompiledContract.CompiledContract<Contract.Contract<PS>, PS, never>;
|
|
233
|
+
initialize(initialPrivateState: PS, ...args: any[]): Effect.Effect<CommandDeployResult<PS>, ContractExecutable.ContractExecutionError, ContractExecutable.ContractExecutable.Context>;
|
|
234
|
+
circuit(provableCircuitId: Contract.ProvableCircuitId, circuitContext: never, ...args: any[]): Effect.Effect<CommandCallResult<PS>, ContractExecutable.ContractExecutionError, ContractExecutable.ContractExecutable.Context>;
|
|
235
|
+
replaceContractMaintenanceAuthority(newSigningKey: Option.Option<SigningKey.SigningKey>, contractContext: never): Effect.Effect<CommandMaintenanceResult, ContractExecutable.ContractExecutionError, ContractExecutable.ContractExecutable.Context>;
|
|
236
|
+
removeContractOperation(provableCircuitId: Contract.ProvableCircuitId, contractContext: never): Effect.Effect<CommandMaintenanceResult, ContractExecutable.ContractExecutionError, ContractExecutable.ContractExecutable.Context>;
|
|
237
|
+
addOrReplaceContractOperation(provableCircuitId: Contract.ProvableCircuitId, verifierKey: Contract.VerifierKey, contractContext: never): Effect.Effect<CommandMaintenanceResult, ContractExecutable.ContractExecutionError, ContractExecutable.ContractExecutable.Context>;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Fails the build unless `X` — an era's real `ContractExecutable` — satisfies
|
|
241
|
+
* {@link CommandExecutable}.
|
|
242
|
+
*
|
|
243
|
+
* @remarks
|
|
244
|
+
* Nothing else checks that claim. A `contract.config.ts` is loaded with `await import(...)`, whose
|
|
245
|
+
* result is `any`, so `ConfigCompiler.ModuleExport` describes a shape no compiler ever verifies
|
|
246
|
+
* against a real executable: if an era's executable and this view drifted apart, every handler
|
|
247
|
+
* would keep compiling and fail at the first call. Applied once per era in
|
|
248
|
+
* `internal/era/v<N>.ts`, where that era's `ContractExecutable` is in scope, so the drift is caught
|
|
249
|
+
* for each era the CLI can select rather than for whichever one happens to be bound.
|
|
250
|
+
*/
|
|
251
|
+
export type AssertIsCommandExecutable<X extends CommandExecutable<PS>, PS> = X;
|
|
252
|
+
/**
|
|
253
|
+
* The contract context every executable call but `circuit` takes, built by the handlers from the
|
|
254
|
+
* era's own conversions and cast into place at the call.
|
|
255
|
+
*/
|
|
256
|
+
export interface CommandContractContext {
|
|
257
|
+
readonly address: string;
|
|
258
|
+
readonly contractState: unknown;
|
|
259
|
+
}
|
|
260
|
+
/** The circuit context, as the `circuit` command assembles it. See {@link CommandContractContext}. */
|
|
261
|
+
export interface CommandCircuitContext<PS> extends CommandContractContext {
|
|
262
|
+
readonly privateState: PS;
|
|
263
|
+
readonly zswapLocalState: unknown;
|
|
264
|
+
readonly ledgerParameters: unknown;
|
|
265
|
+
readonly stateProvider?: unknown;
|
|
266
|
+
readonly moduleProvider?: unknown;
|
|
267
|
+
readonly parentBlockHash?: string;
|
|
268
|
+
}
|
|
269
|
+
export {};
|
|
270
|
+
//# sourceMappingURL=binding.d.ts.map
|
|
@@ -0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,QAAQ,CAAC,WAAW,EACjC,eAAe,EAAE,KAAK,GACrB,MAAM,CAAC,MAAM,CACd,wBAAwB,EACxB,kBAAkB,CAAC,sBAAsB,EACzC,kBAAkB,CAAC,kBAAkB,CAAC,OAAO,CAC9C,CAAC;CACH;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;AAE/E;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED,sGAAsG;AACtG,MAAM,WAAW,qBAAqB,CAAC,EAAE,CAAE,SAAQ,sBAAsB;IACvE,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC;IAC1B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ledger eras this CLI can select. One entry per `internal/era/v<N>.ts`, and per era-pinned
|
|
3
|
+
* entry `@midnightntwrk/compact-js` publishes.
|
|
4
|
+
*/
|
|
5
|
+
export declare const SELECTABLE_LEDGER_ERAS: readonly [8, 9];
|
|
6
|
+
/** One of {@link SELECTABLE_LEDGER_ERAS}. */
|
|
7
|
+
export type SelectableLedgerEra = (typeof SELECTABLE_LEDGER_ERAS)[number];
|
|
8
|
+
/**
|
|
9
|
+
* The era an invocation gets when `--ledger-era` is not given: the era this build *binds*, which is
|
|
10
|
+
* also the era a `contract.config.ts` gets from the unsuffixed `@midnightntwrk/compact-js/effect`.
|
|
11
|
+
* Defaulting to anything else would change the meaning of every existing configuration.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_LEDGER_ERA: SelectableLedgerEra;
|
|
14
|
+
/** Whether `ledgerEra` is an era this CLI can select. */
|
|
15
|
+
export declare const isSelectableLedgerEra: (ledgerEra: number) => ledgerEra is SelectableLedgerEra;
|
|
16
|
+
//# sourceMappingURL=eras.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eras.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/era/eras.ts"],"names":[],"mappings":"AAsCA;;;GAGG;AACH,eAAO,MAAM,sBAAsB,iBAAkB,CAAC;AAEtD,6CAA6C;AAC7C,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,mBAAuC,CAAC;AAEzE,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,KAAG,SAAS,IAAI,mBACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/era/registry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v8.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/era/v8.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v9.d.ts","sourceRoot":"","sources":["../../../../../src/effect/internal/era/v9.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../../src/effect/internal/json.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintainCircuitCommand.d.ts","sourceRoot":"","sources":["../../../../src/effect/internal/maintainCircuitCommand.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintainCommand.d.ts","sourceRoot":"","sources":["../../../../src/effect/internal/maintainCommand.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintainContractCommand.d.ts","sourceRoot":"","sources":["../../../../src/effect/internal/maintainContractCommand.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Command } from '@effect/cli';
|
|
2
|
+
import { ConfigProvider } from 'effect';
|
|
3
|
+
export type ConfigOptionInput = Command.Command.ParseConfig<{
|
|
4
|
+
config: typeof config;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const asConfigProvider: (configurableOptions: Partial<AllConfigurableOptionInputs>) => ConfigProvider.ConfigProvider;
|
|
7
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../src/effect/internal/options.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,OAAO,EAAqC,MAAM,aAAa,CAAC;AAI9E,OAAO,EAAE,cAAc,EAA0B,MAAM,QAAQ,CAAC;AAwPhE,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;IAC1D,MAAM,EAAE,OAAO,MAAM,CAAC;CACvB,CAAC,CAAC;AAcH,eAAO,MAAM,gBAAgB,EAAE,CAC7B,mBAAmB,EAAE,OAAO,CAAC,2BAA2B,CAAC,KACtD,cAAc,CAAC,cAOhB,CAAC"}
|