@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.
Files changed (102) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +263 -2
  3. package/dist/dts/effect/CompiledContractReflection.d.ts +66 -0
  4. package/dist/dts/effect/CompiledContractReflection.d.ts.map +1 -0
  5. package/dist/dts/effect/ConfigCompilationError.d.ts +38 -0
  6. package/dist/dts/effect/ConfigCompilationError.d.ts.map +1 -0
  7. package/dist/dts/effect/ConfigCompiler.d.ts +63 -0
  8. package/dist/dts/effect/ConfigCompiler.d.ts.map +1 -0
  9. package/dist/dts/effect/ConfigError.d.ts +34 -0
  10. package/dist/dts/effect/ConfigError.d.ts.map +1 -0
  11. package/dist/dts/effect/index.d.ts +73 -0
  12. package/dist/dts/effect/index.d.ts.map +1 -0
  13. package/dist/dts/effect/internal/args.d.ts +7 -0
  14. package/dist/dts/effect/internal/args.d.ts.map +1 -0
  15. package/dist/dts/effect/internal/circuitCommand.d.ts +2 -0
  16. package/dist/dts/effect/internal/circuitCommand.d.ts.map +1 -0
  17. package/dist/dts/effect/internal/command.d.ts +98 -0
  18. package/dist/dts/effect/internal/command.d.ts.map +1 -0
  19. package/dist/dts/effect/internal/commandConfigProvider.d.ts +2 -0
  20. package/dist/dts/effect/internal/commandConfigProvider.d.ts.map +1 -0
  21. package/dist/dts/effect/internal/compiledContractReflection.d.ts +5 -0
  22. package/dist/dts/effect/internal/compiledContractReflection.d.ts.map +1 -0
  23. package/dist/dts/effect/internal/deployCommand.d.ts +2 -0
  24. package/dist/dts/effect/internal/deployCommand.d.ts.map +1 -0
  25. package/dist/dts/effect/internal/encodedZswapLocalStateSchema.d.ts +129 -0
  26. package/dist/dts/effect/internal/encodedZswapLocalStateSchema.d.ts.map +1 -0
  27. package/dist/dts/effect/internal/era/binding.d.ts +270 -0
  28. package/dist/dts/effect/internal/era/binding.d.ts.map +1 -0
  29. package/dist/dts/effect/internal/era/eras.d.ts +16 -0
  30. package/dist/dts/effect/internal/era/eras.d.ts.map +1 -0
  31. package/dist/dts/effect/internal/era/registry.d.ts +2 -0
  32. package/dist/dts/effect/internal/era/registry.d.ts.map +1 -0
  33. package/dist/dts/effect/internal/era/v8.d.ts +2 -0
  34. package/dist/dts/effect/internal/era/v8.d.ts.map +1 -0
  35. package/dist/dts/effect/internal/era/v9.d.ts +2 -0
  36. package/dist/dts/effect/internal/era/v9.d.ts.map +1 -0
  37. package/dist/dts/effect/internal/json.d.ts +2 -0
  38. package/dist/dts/effect/internal/json.d.ts.map +1 -0
  39. package/dist/dts/effect/internal/maintainCircuitCommand.d.ts +2 -0
  40. package/dist/dts/effect/internal/maintainCircuitCommand.d.ts.map +1 -0
  41. package/dist/dts/effect/internal/maintainCommand.d.ts +2 -0
  42. package/dist/dts/effect/internal/maintainCommand.d.ts.map +1 -0
  43. package/dist/dts/effect/internal/maintainContractCommand.d.ts +2 -0
  44. package/dist/dts/effect/internal/maintainContractCommand.d.ts.map +1 -0
  45. package/dist/dts/effect/internal/options.d.ts +7 -0
  46. package/dist/dts/effect/internal/options.d.ts.map +1 -0
  47. package/dist/dts/index.d.ts +2 -0
  48. package/dist/dts/index.d.ts.map +1 -0
  49. package/dist/esm/effect/CompiledContractReflection.js +33 -0
  50. package/dist/esm/effect/CompiledContractReflection.js.map +1 -0
  51. package/dist/esm/effect/ConfigCompilationError.js +40 -0
  52. package/dist/esm/effect/ConfigCompilationError.js.map +1 -0
  53. package/dist/esm/effect/ConfigCompiler.js +73 -0
  54. package/dist/esm/effect/ConfigCompiler.js.map +1 -0
  55. package/dist/esm/effect/ConfigError.js +40 -0
  56. package/dist/esm/effect/ConfigError.js.map +1 -0
  57. package/dist/esm/effect/index.js +53 -0
  58. package/dist/esm/effect/index.js.map +1 -0
  59. package/dist/esm/effect/internal/args.js +25 -0
  60. package/dist/esm/effect/internal/args.js.map +1 -0
  61. package/dist/esm/effect/internal/circuitCommand.js +282 -0
  62. package/dist/esm/effect/internal/circuitCommand.js.map +1 -0
  63. package/dist/esm/effect/internal/command.js +316 -0
  64. package/dist/esm/effect/internal/command.js.map +1 -0
  65. package/dist/esm/effect/internal/commandConfigProvider.js +19 -0
  66. package/dist/esm/effect/internal/commandConfigProvider.js.map +1 -0
  67. package/dist/esm/effect/internal/compiledContractReflection.js +296 -0
  68. package/dist/esm/effect/internal/compiledContractReflection.js.map +1 -0
  69. package/dist/esm/effect/internal/deployCommand.js +68 -0
  70. package/dist/esm/effect/internal/deployCommand.js.map +1 -0
  71. package/dist/esm/effect/internal/encodedZswapLocalStateSchema.js +51 -0
  72. package/dist/esm/effect/internal/encodedZswapLocalStateSchema.js.map +1 -0
  73. package/dist/esm/effect/internal/era/binding.js +16 -0
  74. package/dist/esm/effect/internal/era/binding.js.map +1 -0
  75. package/dist/esm/effect/internal/era/eras.js +50 -0
  76. package/dist/esm/effect/internal/era/eras.js.map +1 -0
  77. package/dist/esm/effect/internal/era/registry.js +46 -0
  78. package/dist/esm/effect/internal/era/registry.js.map +1 -0
  79. package/dist/esm/effect/internal/era/v8.js +75 -0
  80. package/dist/esm/effect/internal/era/v8.js.map +1 -0
  81. package/dist/esm/effect/internal/era/v9.js +61 -0
  82. package/dist/esm/effect/internal/era/v9.js.map +1 -0
  83. package/dist/esm/effect/internal/json.js +41 -0
  84. package/dist/esm/effect/internal/json.js.map +1 -0
  85. package/dist/esm/effect/internal/maintainCircuitCommand.js +62 -0
  86. package/dist/esm/effect/internal/maintainCircuitCommand.js.map +1 -0
  87. package/dist/esm/effect/internal/maintainCommand.js +35 -0
  88. package/dist/esm/effect/internal/maintainCommand.js.map +1 -0
  89. package/dist/esm/effect/internal/maintainContractCommand.js +64 -0
  90. package/dist/esm/effect/internal/maintainContractCommand.js.map +1 -0
  91. package/dist/esm/effect/internal/options.js +137 -0
  92. package/dist/esm/effect/internal/options.js.map +1 -0
  93. package/dist/esm/index.js +44 -0
  94. package/dist/esm/index.js.map +1 -0
  95. package/dist/esm/package.json +4 -0
  96. package/effect/CompiledContractReflection/package.json +5 -0
  97. package/effect/ConfigCompilationError/package.json +5 -0
  98. package/effect/ConfigCompiler/package.json +5 -0
  99. package/effect/ConfigError/package.json +5 -0
  100. package/effect/index/package.json +5 -0
  101. package/effect/package.json +5 -0
  102. package/package.json +96 -4
@@ -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
+ import { FileSystem } from '@effect/platform';
16
+ import * as SigningKey from '@midnight-ntwrk/platform-js/effect/SigningKey';
17
+ import { ContractRuntimeError } from '@midnightntwrk/compact-js/effect';
18
+ import { Effect, Option } from 'effect';
19
+ import * as InternalArgs from './args.js';
20
+ import * as InternalCommand from './command.js';
21
+ import * as InternalMaintainCommand from './maintainCommand.js';
22
+ import * as InternalOptions from './options.js';
23
+ /** @internal */
24
+ export const Args = {
25
+ ...InternalMaintainCommand.Args,
26
+ newSigningKey: InternalArgs.signingKey
27
+ };
28
+ /** @internal */
29
+ export const Options = {
30
+ ...InternalMaintainCommand.Options,
31
+ signingKey: InternalOptions.signingKey,
32
+ signingKind: InternalOptions.signingKind,
33
+ newSigningKind: InternalOptions.newSigningKind
34
+ };
35
+ /**
36
+ * Builds the `maintain contract` handler for one era.
37
+ *
38
+ * @param ledger The era's `Ledger` facade. This command touches no compact-runtime API of its own —
39
+ * the executable does that behind the maintenance call — so it takes only the ledger half.
40
+ *
41
+ * @internal
42
+ */
43
+ export const makeHandler = (ledger) => {
44
+ const { tryLedger, newIntent, serializeIntent } = InternalCommand.makeIntents(ledger);
45
+ return ({ address, inputFilePath, newSigningKey, newSigningKind, outputFilePath }, moduleSpec) => Effect.gen(function* () {
46
+ const fs = yield* FileSystem.FileSystem;
47
+ const { module: { default: contractModule } } = moduleSpec;
48
+ const ledgerContractState = yield* fs
49
+ .readFile(inputFilePath)
50
+ .pipe(Effect.flatMap(ledger.contractStateFromBytes));
51
+ const result = yield* contractModule.contractExecutable.replaceContractMaintenanceAuthority(
52
+ // Era default rather than `SigningKey.make`'s own: an untagged key took platform-js's
53
+ // constant, installing a Schnorr authority for a caller rotating to ECDSA — a mismatch the
54
+ // raw bytes hide until an ECDSA-only signer fails to maintain the contract.
55
+ Option.some(SigningKey.make(newSigningKey, Option.getOrElse(newSigningKind, () => ledger.era.defaultCmaSignatureKind))), {
56
+ address,
57
+ contractState: yield* ledger.toRuntimeContractState(ledgerContractState)
58
+ });
59
+ const emptyIntent = yield* newIntent();
60
+ const intent = yield* tryLedger('Failed to add the maintenance update to the intent', () => emptyIntent.addMaintenanceUpdate(result.public.maintenanceUpdate));
61
+ yield* fs.writeFile(outputFilePath, yield* serializeIntent(intent));
62
+ }).pipe(Effect.mapError((err) => ContractRuntimeError.make('Failed to apply maintenance operation', err)));
63
+ };
64
+ //# sourceMappingURL=maintainContractCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maintainContractCommand.js","sourceRoot":"","sources":["../../../../src/effect/internal/maintainContractCommand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,UAAU,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,YAAY,MAAM,WA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2F;QAC3F,4EAA4E;QAC5E,MAAM,CAAC,IAAI,CACT,UAAU,CAAC,IAAI,CACb,aAAa,EACb,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAC3E,CACF,EACD;YACE,OAAO;YACP,aAAa,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,sBAAsB,CAAC,mBAA4B,CAAC;SAC7B,CACvD,CAAC;QACF,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,SAAS,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,SAAS,CAC7B,oDAAoD,EACpD,GAAG,EAAE,CAAC,WAAW,CAAC,oBAAoB,CAAC,MAAM,CAAC,MAAM,CAAC,iBAA0B,CAAC,CACjF,CAAC;QACF,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,CACjB,cAAc,EACd,KAAK,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAC/B,CAAC;IACJ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,uCAAuC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAC/G,CAAC,CAAC"}
@@ -0,0 +1,137 @@
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 { HelpDoc, Options, ValidationError } from '@effect/cli';
16
+ import { Path } from '@effect/platform';
17
+ import * as CoinPublicKey from '@midnight-ntwrk/platform-js/effect/CoinPublicKey';
18
+ import * as SigningKey from '@midnight-ntwrk/platform-js/effect/SigningKey';
19
+ import { ConfigProvider, Effect, Option, Schema } from 'effect';
20
+ import * as InternalEras from './era/eras.js';
21
+ /**
22
+ * Resolves an optional filesystem path against the platform `Path` service while preserving
23
+ * absence: `Option.none` stays `Option.none`, and `Option.some(p)` becomes `Option.some(<resolved
24
+ * p>)`. Shared by the optional path/directory options below.
25
+ *
26
+ * @internal
27
+ */
28
+ const resolveOptionalPath = (opt) => Option.match(opt, {
29
+ onSome: (filePath) => Path.Path.pipe(Effect.map((path) => Option.some(path.resolve(filePath)))),
30
+ onNone: () => Effect.succeed(Option.none())
31
+ });
32
+ /** @internal */
33
+ export const config = Options.file('config', { exists: 'either' }).pipe(Options.withAlias('c'), Options.withDefault('contract.config.ts'), Options.mapEffect((filePath) => Path.Path.pipe(Effect.map((path) => path.resolve(filePath)))));
34
+ /**
35
+ * Selects the ledger era an invocation targets — genuinely selects it, rather than checking it.
36
+ *
37
+ * @remarks
38
+ * The parsed value reaches `invocationHandler`, which resolves it through
39
+ * `internal/era/registry.ts` to that era's application of the four handler factories. Every ledger
40
+ * and compact-runtime call the chosen handler makes — intent construction, state decoding, the
41
+ * conversions, the cross-contract state provider — belongs to the era named here, because the
42
+ * handlers take their era as an argument the way `compact-js`'s `internal/executable.ts` does
43
+ * (midnight-sdk#387/#388).
44
+ *
45
+ * Selecting an era is only half of an invocation's era, and the CLI does not own the other half.
46
+ * The executable comes from the user's `contract.config.ts`, whose own import (`/v8/effect` or
47
+ * `/v9/effect`) fixes *its* era; `invocationHandler` compares the two and fails by name when they
48
+ * disagree, rather than letting the mismatch surface as a WASM rejection later on.
49
+ *
50
+ * An era outside {@link InternalEras.SELECTABLE_LEDGER_ERAS} is still rejected at parse time: this
51
+ * build has no facade for it, and quietly running some other era's execution is the mislabelling
52
+ * the era work exists to prevent.
53
+ *
54
+ * @internal
55
+ */
56
+ export const ledgerEra = Options.integer('ledger-era').pipe(Options.withDescription(`The ledger era to target (${InternalEras.SELECTABLE_LEDGER_ERAS.join(', ')}). Defaults to ` +
57
+ `${InternalEras.DEFAULT_LEDGER_ERA}, the era this build binds. The contract configuration's ` +
58
+ 'executable must be built for the same era.'), Options.mapEffect((era) => InternalEras.isSelectableLedgerEra(era)
59
+ ? Effect.succeed(era)
60
+ : Effect.fail(ValidationError.invalidValue(HelpDoc.p(`ledger era ${era} is not supported by this command; this build selects between ` +
61
+ `${InternalEras.SELECTABLE_LEDGER_ERAS.join(', ')}`)))), Options.withDefault(InternalEras.DEFAULT_LEDGER_ERA));
62
+ /** @internal */
63
+ export const coinPublicKey = Options.text('coin-public').pipe(Options.withAlias('p'), Options.withDescription('A user public key capable of receiving Zswap coins, hex or Bech32m encoded.'), Options.withSchema(Schema.Union(Schema.String.pipe(Schema.fromBrand(CoinPublicKey.Hex)), Schema.String.pipe(Schema.fromBrand(CoinPublicKey.Bech32m))).annotations({ title: 'coin-public' })), Options.optional);
64
+ /** @internal */
65
+ export const signingKey = Options.text('signing').pipe(Options.withAlias('s'), Options.withDescription('A secret signing key, hex encoded, for the signature scheme given by --signing-kind. Used to create, and ' +
66
+ 'later to sign for, the contract maintenance authority.'), Options.withSchema(Schema.String.pipe(Schema.fromBrand(SigningKey.Value)).annotations({ title: 'signing' })), Options.optional);
67
+ /**
68
+ * The signature scheme of the {@link signingKey}.
69
+ *
70
+ * @remarks
71
+ * Optional rather than defaulted on purpose: absence must reach the provider as a *missing* value
72
+ * so that `KEYS_SIGNING_KIND` and the contract configuration — both honoured by platform-js all
73
+ * along — are still consulted. A default here would silently outrank them.
74
+ *
75
+ * @internal
76
+ */
77
+ export const signingKind = Options.choice('signing-kind', SigningKey.SignatureKinds).pipe(Options.withDescription(`The signature scheme of the --signing key (${SigningKey.SignatureKinds.join(', ')}). Defaults to ` +
78
+ `'${SigningKey.DefaultSignatureKind}'. A scheme the selected ledger era does not admit for a maintenance ` +
79
+ 'authority is rejected by name.'), Options.optional);
80
+ /**
81
+ * The signature scheme of the *new* authority key `maintain contract` installs — a second key, and
82
+ * not necessarily the same scheme as the {@link signingKind} that signs the update.
83
+ *
84
+ * @remarks
85
+ * Absence resolves against the selected era's `defaultCmaSignatureKind` at the call rather than
86
+ * being defaulted here, so the key is never tagged with a scheme the era cannot verify.
87
+ *
88
+ * @internal
89
+ */
90
+ export const newSigningKind = Options.choice('new-signing-kind', SigningKey.SignatureKinds).pipe(Options.withDescription(`The signature scheme of the new authority key (${SigningKey.SignatureKinds.join(', ')}). Defaults to the ` +
91
+ "selected ledger era's own default, which is 'schnorr' for every era this build selects."), Options.optional);
92
+ /** @internal */
93
+ export const outputFilePath = Options.file('output', { exists: 'either' }).pipe(Options.withAlias('o'), Options.withDescription("A file path of where the generated 'Intent' data should be written."), Options.withDefault('output.bin'), Options.mapEffect((filePath) => Path.Path.pipe(Effect.map((path) => path.resolve(filePath)))));
94
+ /** @internal */
95
+ export const outputPublicFilePath = Options.file('output-oc', { exists: 'either' }).pipe(Options.withDescription("A file path of where the generated 'on-chain' (on-chain) data should be written."), Options.mapEffect((filePath) => Path.Path.pipe(Effect.map((path) => path.resolve(filePath)))), Options.optional);
96
+ /** @internal */
97
+ export const outputPrivateStateFilePath = Options.file('output-ps', { exists: 'either' }).pipe(Options.withDescription("A file path of where the generated 'PrivateState' data should be written."), Options.withDefault('output.ps.json'), Options.mapEffect((filePath) => Path.Path.pipe(Effect.map((path) => path.resolve(filePath)))));
98
+ /** @internal */
99
+ export const outputZswapLocalStateFilePath = Options.file('output-zswap', { exists: 'either' }).pipe(Options.withDescription("A file path of where the generated 'ZswapLocalState' data should be written."), Options.withDefault('zswap.json'), Options.mapEffect((filePath) => Path.Path.pipe(Effect.map((path) => path.resolve(filePath)))));
100
+ /** @internal */
101
+ export const outputZswapCallsFilePath = Options.file('output-zswap-calls', { exists: 'either' }).pipe(Options.withDescription("A file path where the 'ZswapLocalState' of every call should be written as JSON, callees first and " +
102
+ 'the root last. A callee\'s shielded coins appear only here, because --output-zswap holds the root\'s. ' +
103
+ 'A contract called more than once appears once per call, each time with all of its coins so far.'), Options.mapEffect((filePath) => Path.Path.pipe(Effect.map((path) => path.resolve(filePath)))), Options.optional);
104
+ /** @internal */
105
+ export const outputResultFilePath = Options.file('output-result', { exists: 'either' }).pipe(Options.withDescription('A file path of where the invoked circuit result data should be written.'), Options.withDefault('result.json'), Options.mapEffect((filePath) => Path.Path.pipe(Effect.map((path) => path.resolve(filePath)))));
106
+ /** @internal */
107
+ export const outputEventsFilePath = Options.file('output-events', { exists: 'either' }).pipe(Options.withDescription('A file path where contract log events emitted during circuit execution should be written as JSON.'), Options.mapEffect((filePath) => Path.Path.pipe(Effect.map((path) => path.resolve(filePath)))), Options.optional);
108
+ /** @internal */
109
+ export const inputFilePath = Options.file('input', { exists: 'either' }).pipe(Options.withAlias('i'), Options.withDescription('A file path of where the current onchain (or ledger), state data can be read.'), Options.mapEffect((filePath) => Path.Path.pipe(Effect.map((path) => path.resolve(filePath)))));
110
+ /** @internal */
111
+ export const inputPrivateStateFilePath = Options.file('input-ps', { exists: 'either' }).pipe(Options.withDescription('A file path of where the current private state data can be read.'), Options.mapEffect((filePath) => Path.Path.pipe(Effect.map((path) => path.resolve(filePath)))));
112
+ /** @internal */
113
+ export const inputZswapLocalStateFilePath = Options.file('input-zswap', { exists: 'either' }).pipe(Options.withDescription('A file path of where the current Zswap local state data can be read.'), Options.optional, Options.mapEffect(resolveOptionalPath));
114
+ /** @internal */
115
+ export const inputLedgerParamsFilePath = Options.file('input-ledger-params', { exists: 'either' }).pipe(Options.withDescription('A file path of where optional ledger parameters data can be read.'), Options.optional, Options.mapEffect(resolveOptionalPath));
116
+ /** @internal */
117
+ export const outputContractStatesDirPath = Options.directory('output-contract-states-dir', { exists: 'either' }).pipe(Options.withDescription('A directory into which the updated ledger state of each cross-contract callee is written, each file ' +
118
+ 'named by its contract address. The root contract\'s updated state is written via --output-oc instead. ' +
119
+ 'Lets state be threaded across cross-contract calls without applying the transaction (feed this directory ' +
120
+ 'back as --contract-states-dir). The directory is created if absent.'), Options.optional, Options.mapEffect(resolveOptionalPath));
121
+ /** @internal */
122
+ export const inputContractStatesDirPath = Options.directory('contract-states-dir', { exists: 'yes' }).pipe(Options.withDescription('A directory of ledger-serialized contract-state files, each named by its contract address, used to ' +
123
+ 'resolve the state of cross-contract call targets. Give this with --contract-modules-dir to let the ' +
124
+ 'invoked circuit call into other contracts; the resulting intent will include a call for each.'), Options.optional, Options.mapEffect(resolveOptionalPath));
125
+ /** @internal */
126
+ export const inputContractModulesDirPath = Options.directory('contract-modules-dir', { exists: 'yes' }).pipe(Options.withDescription('A directory of compiled contract directories, each named by its contract address, used to resolve the ' +
127
+ 'code of cross-contract call targets. Give this with --contract-states-dir. Node resolves each module\'s ' +
128
+ 'imports from its real location, so keep the directory inside the project, or fill it with symlinks to ' +
129
+ 'compiled directories there.'), Options.optional, Options.mapEffect(resolveOptionalPath));
130
+ export const asConfigProvider = (configurableOptions) => ConfigProvider.fromJson({
131
+ keys: {
132
+ coinPublic: Option.getOrUndefined(configurableOptions.coinPublicKey ?? Option.none()),
133
+ signing: Option.getOrUndefined(configurableOptions.signingKey ?? Option.none()),
134
+ signingKind: Option.getOrUndefined(configurableOptions.signingKind ?? Option.none())
135
+ }
136
+ });
137
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/effect/internal/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAgB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,aAAa,MAAM,kDAAkD,CAAC;AAClF,OAAO,KAAK,UAAU,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EA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D,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,SAAS,CAAC,mBAAmB,CAAC,CACvC,CAAC;AAkBF,MAAM,CAAC,MAAM,gBAAgB,GAEQ,CAAC,mBAAmB,EAAE,EAAE,CAC3D,cAAc,CAAC,QAAQ,CAAC;IACtB,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,CAAC,cAAc,CAAC,mBAAmB,CAAC,aAAa,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QACrF,OAAO,EAAE,MAAM,CAAC,cAAc,CAAC,mBAAmB,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAC/E,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC,mBAAmB,CAAC,WAAW,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;KACrF;CACF,CAAC,CAAC"}
@@ -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 { fileURLToPath } from 'node:url';
16
+ import { CliConfig, Command } from '@effect/cli';
17
+ import { NodeContext, NodeRuntime } from "@effect/platform-node";
18
+ import { Effect, Equal, Layer, Logger, LogLevel } from 'effect';
19
+ import { circuitCommand, ConfigCompiler, deployCommand, maintainCommand } from './effect/index.js';
20
+ // #region Entry Point
21
+ // This region of code hosts and executes the commands present in the package if this module was loaded
22
+ // as the root of the process.
23
+ const isProcessRootModule = () => {
24
+ try {
25
+ if (!import.meta.url.startsWith("file:")) {
26
+ return false;
27
+ }
28
+ const urlPath = fileURLToPath(import.meta.url);
29
+ return Equal.equals(urlPath, process.argv[1]) || urlPath.startsWith(process.argv[1]);
30
+ }
31
+ catch {
32
+ return false;
33
+ }
34
+ };
35
+ if (isProcessRootModule()) {
36
+ const cli = Command.run(Command.make('cptexec').pipe(Command.withDescription('Executes Compact compiled contracts from the command line.'), Command.withSubcommands([deployCommand, circuitCommand, maintainCommand])), {
37
+ name: 'Compact Contract Execute',
38
+ version: '0.0.0'
39
+ });
40
+ cli(process.argv).pipe(Logger.withMinimumLogLevel(LogLevel.None), Effect.provide(Layer.mergeAll(ConfigCompiler.layer.pipe(Layer.provideMerge(NodeContext.layer)), CliConfig.layer({ showBuiltIns: false }))), NodeRuntime.runMain({ disableErrorReporting: true }));
41
+ }
42
+ // #endregion
43
+ export * from './effect/index.js';
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAC,OAAO,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEnG,sBAAsB;AACtB,uGAAuG;AACvG,8BAA8B;AAC9B,MAAM,mBAAmB,GAAG,GAAG,EAAE;IAC/B,IAAI,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACzC,OAAO,KAAK,CAAC;QACf,CA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Effects": [],
3
+ "main": "../../dist/esm/effect/CompiledContractReflection.js",
4
+ "types": "../../dist/dts/effect/CompiledContractReflection.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../../dist/esm/effect/ConfigCompilationError.js",
4
+ "types": "../../dist/dts/effect/ConfigCompilationError.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../../dist/esm/effect/ConfigCompiler.js",
4
+ "types": "../../dist/dts/effect/ConfigCompiler.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../../dist/esm/effect/ConfigError.js",
4
+ "types": "../../dist/dts/effect/ConfigError.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../../dist/esm/effect/index.js",
4
+ "types": "../../dist/dts/effect/index.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "sideEffects": [],
3
+ "main": "../dist/esm/effect/index.js",
4
+ "types": "../dist/dts/effect/index.d.ts"
5
+ }
package/package.json CHANGED
@@ -1,6 +1,98 @@
1
1
  {
2
2
  "name": "@midnightntwrk/compact-js-command",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "4.0.0",
4
+ "description": "Command line utilities for working with smart contracts compiled with the Compact language",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/midnightntwrk/compact-js.git"
9
+ },
10
+ "sideEffects": [],
11
+ "author": "IOHK",
12
+ "dependencies": {
13
+ "@effect/cli": "^0.77.0",
14
+ "@effect/cluster": "^0.60.0",
15
+ "@effect/experimental": "^0.61.1",
16
+ "@effect/platform": "^0.97.0",
17
+ "@effect/platform-node": "^0.108.1",
18
+ "@effect/platform-node-shared": "^0.61.1",
19
+ "@effect/printer": "^0.51.0",
20
+ "@effect/printer-ansi": "^0.51.0",
21
+ "@effect/rpc": "^0.76.2",
22
+ "@effect/sql": "^0.52.1",
23
+ "@effect/typeclass": "^0.41.0",
24
+ "@effect/workflow": "^0.19.0",
25
+ "@midnight-ntwrk/platform-js": "^3.0.0",
26
+ "@midnightntwrk/compact-js": "^4.0.0",
27
+ "@midnightntwrk/compact-js-node": "^4.0.0",
28
+ "@midnightntwrk/wallet-sdk-address-format": "3.1.2",
29
+ "effect": "^3.22.1",
30
+ "json5": "^2.2.3",
31
+ "ts-node": "^10.9.2",
32
+ "tslib": "^2.8.1",
33
+ "typescript": ">=5.0.0 <7.0.0"
34
+ },
35
+ "main": "./dist/esm/index.js",
36
+ "types": "./dist/dts/index.d.ts",
37
+ "exports": {
38
+ "./package.json": "./package.json",
39
+ ".": {
40
+ "types": "./dist/dts/index.d.ts",
41
+ "default": "./dist/esm/index.js"
42
+ },
43
+ "./effect": {
44
+ "types": "./dist/dts/effect/index.d.ts",
45
+ "default": "./dist/esm/effect/index.js"
46
+ },
47
+ "./effect/CompiledContractReflection": {
48
+ "types": "./dist/dts/effect/CompiledContractReflection.d.ts",
49
+ "default": "./dist/esm/effect/CompiledContractReflection.js"
50
+ },
51
+ "./effect/ConfigCompilationError": {
52
+ "types": "./dist/dts/effect/ConfigCompilationError.d.ts",
53
+ "default": "./dist/esm/effect/ConfigCompilationError.js"
54
+ },
55
+ "./effect/ConfigCompiler": {
56
+ "types": "./dist/dts/effect/ConfigCompiler.d.ts",
57
+ "default": "./dist/esm/effect/ConfigCompiler.js"
58
+ },
59
+ "./effect/ConfigError": {
60
+ "types": "./dist/dts/effect/ConfigError.d.ts",
61
+ "default": "./dist/esm/effect/ConfigError.js"
62
+ },
63
+ "./effect/index": {
64
+ "types": "./dist/dts/effect/index.d.ts",
65
+ "default": "./dist/esm/effect/index.js"
66
+ }
67
+ },
68
+ "typesVersions": {
69
+ "*": {
70
+ "effect": [
71
+ "./dist/dts/effect/index.d.ts"
72
+ ],
73
+ "effect/CompiledContractReflection": [
74
+ "./dist/dts/effect/CompiledContractReflection.d.ts"
75
+ ],
76
+ "effect/ConfigCompilationError": [
77
+ "./dist/dts/effect/ConfigCompilationError.d.ts"
78
+ ],
79
+ "effect/ConfigCompiler": [
80
+ "./dist/dts/effect/ConfigCompiler.d.ts"
81
+ ],
82
+ "effect/ConfigError": [
83
+ "./dist/dts/effect/ConfigError.d.ts"
84
+ ],
85
+ "effect/index": [
86
+ "./dist/dts/effect/index.d.ts"
87
+ ]
88
+ }
89
+ },
90
+ "type": "module",
91
+ "files": [
92
+ "LICENSE",
93
+ "README.md",
94
+ "dist/",
95
+ "effect/",
96
+ "package.json"
97
+ ]
98
+ }