@midnight-ntwrk/midnight-js-types 5.0.0-alpha.1 → 5.0.0-beta.1
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/dist/index.cjs +139 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +83 -3
- package/dist/index.d.mts +83 -3
- package/dist/index.d.ts +83 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +127 -1
- package/dist/index.mjs.map +1 -1
- package/dist/public-data-provider.d.ts +20 -0
- package/dist/public-data-provider.d.ts.map +1 -1
- package/dist/zk-config-registry.d.ts +62 -0
- package/dist/zk-config-registry.d.ts.map +1 -0
- package/dist/zk-key-location.d.ts +12 -0
- package/dist/zk-key-location.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,7 @@ var platformJs = require('@midnight-ntwrk/midnight-js-protocol/platform-js');
|
|
|
5
5
|
var Configuration = require('@midnight-ntwrk/midnight-js-protocol/platform-js/effect/Configuration');
|
|
6
6
|
var effect$1 = require('effect');
|
|
7
7
|
var ledger = require('@midnight-ntwrk/midnight-js-protocol/ledger');
|
|
8
|
+
var compactJs = require('@midnight-ntwrk/midnight-js-protocol/compact-js');
|
|
8
9
|
|
|
9
10
|
function _interopNamespaceDefault(e) {
|
|
10
11
|
var n = Object.create(null);
|
|
@@ -413,10 +414,146 @@ class ZKConfigProvider {
|
|
|
413
414
|
}
|
|
414
415
|
}
|
|
415
416
|
|
|
417
|
+
/*
|
|
418
|
+
* This file is part of midnight-js.
|
|
419
|
+
* Copyright (C) 2025-2026 Midnight Foundation
|
|
420
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
421
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
422
|
+
* You may not use this file except in compliance with the License.
|
|
423
|
+
* You may obtain a copy of the License at
|
|
424
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
425
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
426
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
427
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
428
|
+
* See the License for the specific language governing permissions and
|
|
429
|
+
* limitations under the License.
|
|
430
|
+
*/
|
|
431
|
+
/**
|
|
432
|
+
* Thrown when a contract key location parses but no artifact source contains a bundle whose
|
|
433
|
+
* verifier key matches the deployed one — i.e. the local artifacts have drifted from (or were
|
|
434
|
+
* never compiled for) the deployed contract.
|
|
435
|
+
*/
|
|
436
|
+
class ZKArtifactNotFoundError extends Error {
|
|
437
|
+
keyLocation;
|
|
438
|
+
constructor(keyLocation) {
|
|
439
|
+
super(`No ZK artifact bundle matches the deployed verifier key for contract ` +
|
|
440
|
+
`'${keyLocation.contractAddress}', circuit '${keyLocation.circuitId}'. The local compiled ` +
|
|
441
|
+
`artifacts are missing or stale with respect to the deployed contract.`);
|
|
442
|
+
this.keyLocation = keyLocation;
|
|
443
|
+
this.name = 'ZKArtifactNotFoundError';
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Resolves canonical contract key locations to ZK artifacts across a *set* of compiled-contract
|
|
448
|
+
* artifact sources.
|
|
449
|
+
*
|
|
450
|
+
* A cross-contract call transaction carries one proof per contract in the call tree, so proving
|
|
451
|
+
* requires artifacts for several compiled contracts, keyed by `(contractAddress, circuitId)`. No
|
|
452
|
+
* registration of addresses is required: the binding is *derived* by joining on the verifier key.
|
|
453
|
+
* Each location embeds the SHA-256 of the call's deployed verifier key (known at transaction
|
|
454
|
+
* assembly from the contract's resolved on-chain state), and resolution selects the source whose
|
|
455
|
+
* local verifier key for the circuit matches. The join is sound because it is the predicate the
|
|
456
|
+
* chain itself enforces — a proof must verify against the deployed key — and it makes the
|
|
457
|
+
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
458
|
+
* collisions across contracts.
|
|
459
|
+
*
|
|
460
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs;
|
|
461
|
+
* resolutions are memoized per location.
|
|
462
|
+
*/
|
|
463
|
+
class ZKConfigRegistry {
|
|
464
|
+
sources;
|
|
465
|
+
resolved = new Map();
|
|
466
|
+
/**
|
|
467
|
+
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
468
|
+
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
469
|
+
*/
|
|
470
|
+
constructor(sources) {
|
|
471
|
+
this.sources = [...sources];
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Resolves the ZK artifacts for a structured contract key.
|
|
475
|
+
*
|
|
476
|
+
* @param location The contract address, circuit, and deployed verifier key hash to resolve.
|
|
477
|
+
* @throws ZKArtifactNotFoundError If no source's verifier key for the circuit matches.
|
|
478
|
+
*/
|
|
479
|
+
get(location) {
|
|
480
|
+
return this.resolve(compactJs.encodeContractKeyLocation(location), location);
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Resolves the ZK artifacts for a key-location string from a proof preimage.
|
|
484
|
+
*
|
|
485
|
+
* @param keyLocation The key-location string.
|
|
486
|
+
* @returns The matched artifacts, or `undefined` if `keyLocation` is not a contract key
|
|
487
|
+
* location (for example, a `midnight/` protocol builtin, which provers resolve elsewhere).
|
|
488
|
+
* @throws ZKArtifactNotFoundError If `keyLocation` is a contract key location but no source's
|
|
489
|
+
* verifier key for the circuit matches the embedded hash.
|
|
490
|
+
*/
|
|
491
|
+
async resolveKeyLocation(keyLocation) {
|
|
492
|
+
const parsed = compactJs.parseContractKeyLocation(keyLocation);
|
|
493
|
+
if (parsed === undefined) {
|
|
494
|
+
return undefined;
|
|
495
|
+
}
|
|
496
|
+
return this.resolve(keyLocation, parsed);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Adapts this registry to the DApp connector's {@link KeyMaterialProvider}, allowing a wallet
|
|
500
|
+
* to resolve the key locations of a transaction assembled by this application.
|
|
501
|
+
*/
|
|
502
|
+
asKeyMaterialProvider() {
|
|
503
|
+
const resolve = async (circuitKeyLocation) => {
|
|
504
|
+
const config = await this.resolveKeyLocation(circuitKeyLocation);
|
|
505
|
+
if (config === undefined) {
|
|
506
|
+
throw new Error(`'${circuitKeyLocation}' is not a contract key location`);
|
|
507
|
+
}
|
|
508
|
+
return config;
|
|
509
|
+
};
|
|
510
|
+
return {
|
|
511
|
+
getZKIR: (circuitKeyLocation) => resolve(circuitKeyLocation).then((config) => config.zkir),
|
|
512
|
+
getProverKey: (circuitKeyLocation) => resolve(circuitKeyLocation).then((config) => config.proverKey),
|
|
513
|
+
getVerifierKey: (circuitKeyLocation) => resolve(circuitKeyLocation).then((config) => config.verifierKey)
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
async resolve(keyLocation, parsed) {
|
|
517
|
+
const memoized = this.resolved.get(keyLocation);
|
|
518
|
+
if (memoized !== undefined) {
|
|
519
|
+
return memoized;
|
|
520
|
+
}
|
|
521
|
+
for (const source of this.sources) {
|
|
522
|
+
let verifierKey;
|
|
523
|
+
try {
|
|
524
|
+
verifierKey = await source.getVerifierKey(parsed.circuitId);
|
|
525
|
+
}
|
|
526
|
+
catch {
|
|
527
|
+
// The source has no circuit by this name; try the next one.
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
if (compactJs.hashVerifierKey(verifierKey) !== parsed.verifierKeyHash) {
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
const config = await source.get(parsed.circuitId);
|
|
534
|
+
this.resolved.set(keyLocation, config);
|
|
535
|
+
return config;
|
|
536
|
+
}
|
|
537
|
+
throw new ZKArtifactNotFoundError(parsed);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
416
541
|
Object.defineProperty(exports, "Transaction", {
|
|
417
542
|
enumerable: true,
|
|
418
543
|
get: function () { return ledger.Transaction; }
|
|
419
544
|
});
|
|
545
|
+
Object.defineProperty(exports, "encodeContractKeyLocation", {
|
|
546
|
+
enumerable: true,
|
|
547
|
+
get: function () { return compactJs.encodeContractKeyLocation; }
|
|
548
|
+
});
|
|
549
|
+
Object.defineProperty(exports, "hashVerifierKey", {
|
|
550
|
+
enumerable: true,
|
|
551
|
+
get: function () { return compactJs.hashVerifierKey; }
|
|
552
|
+
});
|
|
553
|
+
Object.defineProperty(exports, "parseContractKeyLocation", {
|
|
554
|
+
enumerable: true,
|
|
555
|
+
get: function () { return compactJs.parseContractKeyLocation; }
|
|
556
|
+
});
|
|
420
557
|
exports.ExportDecryptionError = ExportDecryptionError;
|
|
421
558
|
exports.FailEntirely = FailEntirely;
|
|
422
559
|
exports.FailFallible = FailFallible;
|
|
@@ -431,7 +568,9 @@ exports.SegmentFail = SegmentFail;
|
|
|
431
568
|
exports.SegmentSuccess = SegmentSuccess;
|
|
432
569
|
exports.SigningKeyExportError = SigningKeyExportError;
|
|
433
570
|
exports.SucceedEntirely = SucceedEntirely;
|
|
571
|
+
exports.ZKArtifactNotFoundError = ZKArtifactNotFoundError;
|
|
434
572
|
exports.ZKConfigProvider = ZKConfigProvider;
|
|
573
|
+
exports.ZKConfigRegistry = ZKConfigRegistry;
|
|
435
574
|
exports.asContractAddress = asContractAddress;
|
|
436
575
|
exports.asEffectOption = asEffectOption;
|
|
437
576
|
exports.createProofProvider = createProofProvider;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/contract.ts","../src/errors.ts","../src/logger-provider.ts","../src/midnight-types.ts","../src/private-state-provider.ts","../src/proof-provider.ts","../src/zk-config-provider.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":["Effect","Option","Contract","ZKConfigurationReadError","Layer","ZKConfiguration","Configuration","ConfigProvider","ContractExecutableRuntime","Exit","Cause","ContractAddress","LogLevel","CostModel"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/contract.ts","../src/errors.ts","../src/logger-provider.ts","../src/midnight-types.ts","../src/private-state-provider.ts","../src/proof-provider.ts","../src/zk-config-provider.ts","../src/zk-config-registry.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":["Effect","Option","Contract","ZKConfigurationReadError","Layer","ZKConfiguration","Configuration","ConfigProvider","ContractExecutableRuntime","Exit","Cause","ContractAddress","LogLevel","CostModel","encodeContractKeyLocation","parseContractKeyLocation","hashVerifierKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;AAaG;AAYH;;;;;;;;AAQG;AACH,MAAM,iBAAiB,GAAG,CAAsC,gBAA0C,KACxG,CAAC,gBAA0D,KACzDA,eAAM,CAAC,GAAG,CAAC,aAAS;;;IAGlB,MAAM,cAAc,GAAG,CAAC,iBAAgD,KACtEA,eAAM,CAAC,UAAU,CAAC;AAChB,QAAA,GAAG,EAAE,MAAM,gBAAgB,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,KAAKC,eAAM,CAAC,IAAI,CAACC,eAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AACnI,QAAA,KAAK,EAAE,CAAC,GAAY,KAAKC,+BAAwB,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG;AACpH,KAAA,CAAC;IACJ,OAAO;QACL,cAAc;QACd,eAAe,EAAE,CAAC,kBAAkB,KAClCH,eAAM,CAAC,OAAO,CACZ,kBAAkB,EAClB,CAAC,iBAAiB,KAChB,cAAc,CAAC,iBAAiB,CAAC,CAAC,IAAI,CACpCA,eAAM,CAAC,GAAG,CAAC,CAAC,WAAW,KAAK,CAAC,iBAAiB,EAAE,WAAW,CAAU,CAAC,CACvE,EACH,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE;KAEO;AAC3D,CAAC,CAAC;AAEN,MAAM,uBAAuB,GAAG,CAAC,gBAA0C,EAAE,SAA8B,KACzGI,cAAK,CAAC,QAAQ,CACZA,cAA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AAC;AAC/C,QAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;AAC1B,YAAA,OAAO,QAAQ;QACjB;AACA,QAAA,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;AACjC,YAAA,IAAI,WAAuB;AAC3B,YAAA,IAAI;gBACF,WAAW,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC;YAC7D;AAAE,YAAA,MAAM;;gBAEN;YACF;YACA,IAAIC,yBAAe,CAAC,WAAW,CAAC,KAAK,MAAM,CAAC,eAAe,EAAE;gBAC3D;YACF;YACA,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;YACjD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC;AACtC,YAAA,OAAO,MAAM;QACf;AACA,QAAA,MAAM,IAAI,uBAAuB,CAAC,MAAM,CAAC;IAC3C;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,8 @@ import { SigningKey, ContractAddress as ContractAddress$2, ContractState } from
|
|
|
3
3
|
import { ContractAddress as ContractAddress$1 } from '@midnight-ntwrk/midnight-js-protocol/platform-js';
|
|
4
4
|
import { Option, Exit, ConfigError } from 'effect';
|
|
5
5
|
import { ManagedRuntime } from 'effect/ManagedRuntime';
|
|
6
|
-
import { Contract } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
6
|
+
import { Contract, ContractKeyLocation } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
7
|
+
export { ContractKeyLocation, encodeContractKeyLocation, hashVerifierKey, parseContractKeyLocation } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
7
8
|
import { Transaction, SignatureEnabled, Proof, Binding, TransactionId, TransactionHash, ContractAddress, IntentHash, RawTokenType, FinalizedTransaction, UnprovenTransaction, PreBinding, ProvingProvider, CostModel, ZswapChainState, LedgerParameters, CoinPublicKey, EncPublicKey } from '@midnight-ntwrk/midnight-js-protocol/ledger';
|
|
8
9
|
export { Transaction } from '@midnight-ntwrk/midnight-js-protocol/ledger';
|
|
9
10
|
import { LogFn } from 'pino';
|
|
@@ -896,6 +897,19 @@ type BlockHashConfig = {
|
|
|
896
897
|
*/
|
|
897
898
|
readonly blockHash: string;
|
|
898
899
|
};
|
|
900
|
+
/**
|
|
901
|
+
* Minimal identifying information for a block.
|
|
902
|
+
*/
|
|
903
|
+
type BlockInfo = {
|
|
904
|
+
/**
|
|
905
|
+
* The hex-encoded block hash.
|
|
906
|
+
*/
|
|
907
|
+
readonly hash: string;
|
|
908
|
+
/**
|
|
909
|
+
* The block height.
|
|
910
|
+
*/
|
|
911
|
+
readonly height: number;
|
|
912
|
+
};
|
|
899
913
|
/**
|
|
900
914
|
* The configuration for a contract state observable. The corresponding observables may begin at different
|
|
901
915
|
* places (e.g. after a specific transaction identifier / block height) depending on the configuration, but
|
|
@@ -1087,6 +1101,13 @@ interface ContractEventsPage {
|
|
|
1087
1101
|
* TODO: Add timeouts or retry limits to 'watchFor' queries.
|
|
1088
1102
|
*/
|
|
1089
1103
|
interface PublicDataProvider {
|
|
1104
|
+
/**
|
|
1105
|
+
* Retrieves a block. If no block hash or block height is provided, the latest block is returned.
|
|
1106
|
+
* Immediately returns null if no matching block is found.
|
|
1107
|
+
* @param config The configuration of the query identifying the block of interest.
|
|
1108
|
+
* If `undefined` returns the latest block.
|
|
1109
|
+
*/
|
|
1110
|
+
queryBlock(config?: BlockHeightConfig | BlockHashConfig): Promise<BlockInfo | null>;
|
|
1090
1111
|
/**
|
|
1091
1112
|
* Retrieves the on-chain state of a contract. If no block hash or block height are provided, the
|
|
1092
1113
|
* contract state at the address in the latest block is returned.
|
|
@@ -1288,5 +1309,64 @@ interface MidnightProviders<PCK extends AnyProvableCircuitId = AnyProvableCircui
|
|
|
1288
1309
|
readonly loggerProvider?: LoggerProvider;
|
|
1289
1310
|
}
|
|
1290
1311
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1312
|
+
/**
|
|
1313
|
+
* Thrown when a contract key location parses but no artifact source contains a bundle whose
|
|
1314
|
+
* verifier key matches the deployed one — i.e. the local artifacts have drifted from (or were
|
|
1315
|
+
* never compiled for) the deployed contract.
|
|
1316
|
+
*/
|
|
1317
|
+
declare class ZKArtifactNotFoundError extends Error {
|
|
1318
|
+
readonly keyLocation: ContractKeyLocation;
|
|
1319
|
+
constructor(keyLocation: ContractKeyLocation);
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Resolves canonical contract key locations to ZK artifacts across a *set* of compiled-contract
|
|
1323
|
+
* artifact sources.
|
|
1324
|
+
*
|
|
1325
|
+
* A cross-contract call transaction carries one proof per contract in the call tree, so proving
|
|
1326
|
+
* requires artifacts for several compiled contracts, keyed by `(contractAddress, circuitId)`. No
|
|
1327
|
+
* registration of addresses is required: the binding is *derived* by joining on the verifier key.
|
|
1328
|
+
* Each location embeds the SHA-256 of the call's deployed verifier key (known at transaction
|
|
1329
|
+
* assembly from the contract's resolved on-chain state), and resolution selects the source whose
|
|
1330
|
+
* local verifier key for the circuit matches. The join is sound because it is the predicate the
|
|
1331
|
+
* chain itself enforces — a proof must verify against the deployed key — and it makes the
|
|
1332
|
+
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
1333
|
+
* collisions across contracts.
|
|
1334
|
+
*
|
|
1335
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs;
|
|
1336
|
+
* resolutions are memoized per location.
|
|
1337
|
+
*/
|
|
1338
|
+
declare class ZKConfigRegistry {
|
|
1339
|
+
private readonly sources;
|
|
1340
|
+
private readonly resolved;
|
|
1341
|
+
/**
|
|
1342
|
+
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
1343
|
+
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
1344
|
+
*/
|
|
1345
|
+
constructor(sources: Iterable<ZKConfigProvider<string>>);
|
|
1346
|
+
/**
|
|
1347
|
+
* Resolves the ZK artifacts for a structured contract key.
|
|
1348
|
+
*
|
|
1349
|
+
* @param location The contract address, circuit, and deployed verifier key hash to resolve.
|
|
1350
|
+
* @throws ZKArtifactNotFoundError If no source's verifier key for the circuit matches.
|
|
1351
|
+
*/
|
|
1352
|
+
get(location: ContractKeyLocation): Promise<ZKConfig<string>>;
|
|
1353
|
+
/**
|
|
1354
|
+
* Resolves the ZK artifacts for a key-location string from a proof preimage.
|
|
1355
|
+
*
|
|
1356
|
+
* @param keyLocation The key-location string.
|
|
1357
|
+
* @returns The matched artifacts, or `undefined` if `keyLocation` is not a contract key
|
|
1358
|
+
* location (for example, a `midnight/` protocol builtin, which provers resolve elsewhere).
|
|
1359
|
+
* @throws ZKArtifactNotFoundError If `keyLocation` is a contract key location but no source's
|
|
1360
|
+
* verifier key for the circuit matches the embedded hash.
|
|
1361
|
+
*/
|
|
1362
|
+
resolveKeyLocation(keyLocation: string): Promise<ZKConfig<string> | undefined>;
|
|
1363
|
+
/**
|
|
1364
|
+
* Adapts this registry to the DApp connector's {@link KeyMaterialProvider}, allowing a wallet
|
|
1365
|
+
* to resolve the key locations of a transaction assembled by this application.
|
|
1366
|
+
*/
|
|
1367
|
+
asKeyMaterialProvider(): KeyMaterialProvider;
|
|
1368
|
+
private resolve;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
export { ExportDecryptionError, FailEntirely, FailFallible, ImportConflictError, InvalidExportFormatError, InvalidProtocolSchemeError, LogLevel, MAX_EXPORT_SIGNING_KEYS, MAX_EXPORT_STATES, PrivateStateExportError, PrivateStateImportError, SegmentFail, SegmentSuccess, SigningKeyExportError, SucceedEntirely, ZKArtifactNotFoundError, ZKConfigProvider, ZKConfigRegistry, asContractAddress, asEffectOption, createProofProvider, createProverKey, createVerifierKey, createZKIR, exitResultOrError, makeContractExecutableRuntime, zkConfigToProvingKeyMaterial };
|
|
1372
|
+
export type { All, AnyPrivateState, AnyProvableCircuitId, BlockHash, BlockHashConfig, BlockHeightConfig, BlockInfo, ContractEvent, ContractEventAddress, ContractEventBase, ContractEventCursor, ContractEventFieldPrefix, ContractEventFilterBase, ContractEventQueryFilter, ContractEventSubscriptionFilter, ContractEventType, ContractEventsPage, ContractExecutableRuntimeOptions, ContractStateObservableConfig, ExportPrivateStatesOptions, ExportSigningKeysOptions, Fees, FinalizedTxData, ImportPrivateStatesOptions, ImportPrivateStatesResult, ImportSigningKeysOptions, ImportSigningKeysResult, KeyMaterialProvider, Latest, LoggerProvider, MidnightProvider, MidnightProviders, PrivateStateExport, PrivateStateId, PrivateStateImportErrorCause, PrivateStateProvider, ProofProvider, ProveTxConfig, ProverKey, PublicDataProvider, SegmentStatus, SigningKeyExport, TxIdConfig, TxStatus, UnboundTransaction, UnshieldedBalance, UnshieldedBalances, UnshieldedUtxo, UnshieldedUtxos, VerifierKey, WalletProvider, ZKConfig, ZKIR };
|
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,8 @@ import { SigningKey, ContractAddress as ContractAddress$2, ContractState } from
|
|
|
3
3
|
import { ContractAddress as ContractAddress$1 } from '@midnight-ntwrk/midnight-js-protocol/platform-js';
|
|
4
4
|
import { Option, Exit, ConfigError } from 'effect';
|
|
5
5
|
import { ManagedRuntime } from 'effect/ManagedRuntime';
|
|
6
|
-
import { Contract } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
6
|
+
import { Contract, ContractKeyLocation } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
7
|
+
export { ContractKeyLocation, encodeContractKeyLocation, hashVerifierKey, parseContractKeyLocation } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
7
8
|
import { Transaction, SignatureEnabled, Proof, Binding, TransactionId, TransactionHash, ContractAddress, IntentHash, RawTokenType, FinalizedTransaction, UnprovenTransaction, PreBinding, ProvingProvider, CostModel, ZswapChainState, LedgerParameters, CoinPublicKey, EncPublicKey } from '@midnight-ntwrk/midnight-js-protocol/ledger';
|
|
8
9
|
export { Transaction } from '@midnight-ntwrk/midnight-js-protocol/ledger';
|
|
9
10
|
import { LogFn } from 'pino';
|
|
@@ -896,6 +897,19 @@ type BlockHashConfig = {
|
|
|
896
897
|
*/
|
|
897
898
|
readonly blockHash: string;
|
|
898
899
|
};
|
|
900
|
+
/**
|
|
901
|
+
* Minimal identifying information for a block.
|
|
902
|
+
*/
|
|
903
|
+
type BlockInfo = {
|
|
904
|
+
/**
|
|
905
|
+
* The hex-encoded block hash.
|
|
906
|
+
*/
|
|
907
|
+
readonly hash: string;
|
|
908
|
+
/**
|
|
909
|
+
* The block height.
|
|
910
|
+
*/
|
|
911
|
+
readonly height: number;
|
|
912
|
+
};
|
|
899
913
|
/**
|
|
900
914
|
* The configuration for a contract state observable. The corresponding observables may begin at different
|
|
901
915
|
* places (e.g. after a specific transaction identifier / block height) depending on the configuration, but
|
|
@@ -1087,6 +1101,13 @@ interface ContractEventsPage {
|
|
|
1087
1101
|
* TODO: Add timeouts or retry limits to 'watchFor' queries.
|
|
1088
1102
|
*/
|
|
1089
1103
|
interface PublicDataProvider {
|
|
1104
|
+
/**
|
|
1105
|
+
* Retrieves a block. If no block hash or block height is provided, the latest block is returned.
|
|
1106
|
+
* Immediately returns null if no matching block is found.
|
|
1107
|
+
* @param config The configuration of the query identifying the block of interest.
|
|
1108
|
+
* If `undefined` returns the latest block.
|
|
1109
|
+
*/
|
|
1110
|
+
queryBlock(config?: BlockHeightConfig | BlockHashConfig): Promise<BlockInfo | null>;
|
|
1090
1111
|
/**
|
|
1091
1112
|
* Retrieves the on-chain state of a contract. If no block hash or block height are provided, the
|
|
1092
1113
|
* contract state at the address in the latest block is returned.
|
|
@@ -1288,5 +1309,64 @@ interface MidnightProviders<PCK extends AnyProvableCircuitId = AnyProvableCircui
|
|
|
1288
1309
|
readonly loggerProvider?: LoggerProvider;
|
|
1289
1310
|
}
|
|
1290
1311
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1312
|
+
/**
|
|
1313
|
+
* Thrown when a contract key location parses but no artifact source contains a bundle whose
|
|
1314
|
+
* verifier key matches the deployed one — i.e. the local artifacts have drifted from (or were
|
|
1315
|
+
* never compiled for) the deployed contract.
|
|
1316
|
+
*/
|
|
1317
|
+
declare class ZKArtifactNotFoundError extends Error {
|
|
1318
|
+
readonly keyLocation: ContractKeyLocation;
|
|
1319
|
+
constructor(keyLocation: ContractKeyLocation);
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Resolves canonical contract key locations to ZK artifacts across a *set* of compiled-contract
|
|
1323
|
+
* artifact sources.
|
|
1324
|
+
*
|
|
1325
|
+
* A cross-contract call transaction carries one proof per contract in the call tree, so proving
|
|
1326
|
+
* requires artifacts for several compiled contracts, keyed by `(contractAddress, circuitId)`. No
|
|
1327
|
+
* registration of addresses is required: the binding is *derived* by joining on the verifier key.
|
|
1328
|
+
* Each location embeds the SHA-256 of the call's deployed verifier key (known at transaction
|
|
1329
|
+
* assembly from the contract's resolved on-chain state), and resolution selects the source whose
|
|
1330
|
+
* local verifier key for the circuit matches. The join is sound because it is the predicate the
|
|
1331
|
+
* chain itself enforces — a proof must verify against the deployed key — and it makes the
|
|
1332
|
+
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
1333
|
+
* collisions across contracts.
|
|
1334
|
+
*
|
|
1335
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs;
|
|
1336
|
+
* resolutions are memoized per location.
|
|
1337
|
+
*/
|
|
1338
|
+
declare class ZKConfigRegistry {
|
|
1339
|
+
private readonly sources;
|
|
1340
|
+
private readonly resolved;
|
|
1341
|
+
/**
|
|
1342
|
+
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
1343
|
+
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
1344
|
+
*/
|
|
1345
|
+
constructor(sources: Iterable<ZKConfigProvider<string>>);
|
|
1346
|
+
/**
|
|
1347
|
+
* Resolves the ZK artifacts for a structured contract key.
|
|
1348
|
+
*
|
|
1349
|
+
* @param location The contract address, circuit, and deployed verifier key hash to resolve.
|
|
1350
|
+
* @throws ZKArtifactNotFoundError If no source's verifier key for the circuit matches.
|
|
1351
|
+
*/
|
|
1352
|
+
get(location: ContractKeyLocation): Promise<ZKConfig<string>>;
|
|
1353
|
+
/**
|
|
1354
|
+
* Resolves the ZK artifacts for a key-location string from a proof preimage.
|
|
1355
|
+
*
|
|
1356
|
+
* @param keyLocation The key-location string.
|
|
1357
|
+
* @returns The matched artifacts, or `undefined` if `keyLocation` is not a contract key
|
|
1358
|
+
* location (for example, a `midnight/` protocol builtin, which provers resolve elsewhere).
|
|
1359
|
+
* @throws ZKArtifactNotFoundError If `keyLocation` is a contract key location but no source's
|
|
1360
|
+
* verifier key for the circuit matches the embedded hash.
|
|
1361
|
+
*/
|
|
1362
|
+
resolveKeyLocation(keyLocation: string): Promise<ZKConfig<string> | undefined>;
|
|
1363
|
+
/**
|
|
1364
|
+
* Adapts this registry to the DApp connector's {@link KeyMaterialProvider}, allowing a wallet
|
|
1365
|
+
* to resolve the key locations of a transaction assembled by this application.
|
|
1366
|
+
*/
|
|
1367
|
+
asKeyMaterialProvider(): KeyMaterialProvider;
|
|
1368
|
+
private resolve;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
export { ExportDecryptionError, FailEntirely, FailFallible, ImportConflictError, InvalidExportFormatError, InvalidProtocolSchemeError, LogLevel, MAX_EXPORT_SIGNING_KEYS, MAX_EXPORT_STATES, PrivateStateExportError, PrivateStateImportError, SegmentFail, SegmentSuccess, SigningKeyExportError, SucceedEntirely, ZKArtifactNotFoundError, ZKConfigProvider, ZKConfigRegistry, asContractAddress, asEffectOption, createProofProvider, createProverKey, createVerifierKey, createZKIR, exitResultOrError, makeContractExecutableRuntime, zkConfigToProvingKeyMaterial };
|
|
1372
|
+
export type { All, AnyPrivateState, AnyProvableCircuitId, BlockHash, BlockHashConfig, BlockHeightConfig, BlockInfo, ContractEvent, ContractEventAddress, ContractEventBase, ContractEventCursor, ContractEventFieldPrefix, ContractEventFilterBase, ContractEventQueryFilter, ContractEventSubscriptionFilter, ContractEventType, ContractEventsPage, ContractExecutableRuntimeOptions, ContractStateObservableConfig, ExportPrivateStatesOptions, ExportSigningKeysOptions, Fees, FinalizedTxData, ImportPrivateStatesOptions, ImportPrivateStatesResult, ImportSigningKeysOptions, ImportSigningKeysResult, KeyMaterialProvider, Latest, LoggerProvider, MidnightProvider, MidnightProviders, PrivateStateExport, PrivateStateId, PrivateStateImportErrorCause, PrivateStateProvider, ProofProvider, ProveTxConfig, ProverKey, PublicDataProvider, SegmentStatus, SigningKeyExport, TxIdConfig, TxStatus, UnboundTransaction, UnshieldedBalance, UnshieldedBalances, UnshieldedUtxo, UnshieldedUtxos, VerifierKey, WalletProvider, ZKConfig, ZKIR };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { SigningKey, ContractAddress as ContractAddress$2, ContractState } from
|
|
|
3
3
|
import { ContractAddress as ContractAddress$1 } from '@midnight-ntwrk/midnight-js-protocol/platform-js';
|
|
4
4
|
import { Option, Exit, ConfigError } from 'effect';
|
|
5
5
|
import { ManagedRuntime } from 'effect/ManagedRuntime';
|
|
6
|
-
import { Contract } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
6
|
+
import { Contract, ContractKeyLocation } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
7
|
+
export { ContractKeyLocation, encodeContractKeyLocation, hashVerifierKey, parseContractKeyLocation } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
7
8
|
import { Transaction, SignatureEnabled, Proof, Binding, TransactionId, TransactionHash, ContractAddress, IntentHash, RawTokenType, FinalizedTransaction, UnprovenTransaction, PreBinding, ProvingProvider, CostModel, ZswapChainState, LedgerParameters, CoinPublicKey, EncPublicKey } from '@midnight-ntwrk/midnight-js-protocol/ledger';
|
|
8
9
|
export { Transaction } from '@midnight-ntwrk/midnight-js-protocol/ledger';
|
|
9
10
|
import { LogFn } from 'pino';
|
|
@@ -896,6 +897,19 @@ type BlockHashConfig = {
|
|
|
896
897
|
*/
|
|
897
898
|
readonly blockHash: string;
|
|
898
899
|
};
|
|
900
|
+
/**
|
|
901
|
+
* Minimal identifying information for a block.
|
|
902
|
+
*/
|
|
903
|
+
type BlockInfo = {
|
|
904
|
+
/**
|
|
905
|
+
* The hex-encoded block hash.
|
|
906
|
+
*/
|
|
907
|
+
readonly hash: string;
|
|
908
|
+
/**
|
|
909
|
+
* The block height.
|
|
910
|
+
*/
|
|
911
|
+
readonly height: number;
|
|
912
|
+
};
|
|
899
913
|
/**
|
|
900
914
|
* The configuration for a contract state observable. The corresponding observables may begin at different
|
|
901
915
|
* places (e.g. after a specific transaction identifier / block height) depending on the configuration, but
|
|
@@ -1087,6 +1101,13 @@ interface ContractEventsPage {
|
|
|
1087
1101
|
* TODO: Add timeouts or retry limits to 'watchFor' queries.
|
|
1088
1102
|
*/
|
|
1089
1103
|
interface PublicDataProvider {
|
|
1104
|
+
/**
|
|
1105
|
+
* Retrieves a block. If no block hash or block height is provided, the latest block is returned.
|
|
1106
|
+
* Immediately returns null if no matching block is found.
|
|
1107
|
+
* @param config The configuration of the query identifying the block of interest.
|
|
1108
|
+
* If `undefined` returns the latest block.
|
|
1109
|
+
*/
|
|
1110
|
+
queryBlock(config?: BlockHeightConfig | BlockHashConfig): Promise<BlockInfo | null>;
|
|
1090
1111
|
/**
|
|
1091
1112
|
* Retrieves the on-chain state of a contract. If no block hash or block height are provided, the
|
|
1092
1113
|
* contract state at the address in the latest block is returned.
|
|
@@ -1288,5 +1309,64 @@ interface MidnightProviders<PCK extends AnyProvableCircuitId = AnyProvableCircui
|
|
|
1288
1309
|
readonly loggerProvider?: LoggerProvider;
|
|
1289
1310
|
}
|
|
1290
1311
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1312
|
+
/**
|
|
1313
|
+
* Thrown when a contract key location parses but no artifact source contains a bundle whose
|
|
1314
|
+
* verifier key matches the deployed one — i.e. the local artifacts have drifted from (or were
|
|
1315
|
+
* never compiled for) the deployed contract.
|
|
1316
|
+
*/
|
|
1317
|
+
declare class ZKArtifactNotFoundError extends Error {
|
|
1318
|
+
readonly keyLocation: ContractKeyLocation;
|
|
1319
|
+
constructor(keyLocation: ContractKeyLocation);
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Resolves canonical contract key locations to ZK artifacts across a *set* of compiled-contract
|
|
1323
|
+
* artifact sources.
|
|
1324
|
+
*
|
|
1325
|
+
* A cross-contract call transaction carries one proof per contract in the call tree, so proving
|
|
1326
|
+
* requires artifacts for several compiled contracts, keyed by `(contractAddress, circuitId)`. No
|
|
1327
|
+
* registration of addresses is required: the binding is *derived* by joining on the verifier key.
|
|
1328
|
+
* Each location embeds the SHA-256 of the call's deployed verifier key (known at transaction
|
|
1329
|
+
* assembly from the contract's resolved on-chain state), and resolution selects the source whose
|
|
1330
|
+
* local verifier key for the circuit matches. The join is sound because it is the predicate the
|
|
1331
|
+
* chain itself enforces — a proof must verify against the deployed key — and it makes the
|
|
1332
|
+
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
1333
|
+
* collisions across contracts.
|
|
1334
|
+
*
|
|
1335
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs;
|
|
1336
|
+
* resolutions are memoized per location.
|
|
1337
|
+
*/
|
|
1338
|
+
declare class ZKConfigRegistry {
|
|
1339
|
+
private readonly sources;
|
|
1340
|
+
private readonly resolved;
|
|
1341
|
+
/**
|
|
1342
|
+
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
1343
|
+
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
1344
|
+
*/
|
|
1345
|
+
constructor(sources: Iterable<ZKConfigProvider<string>>);
|
|
1346
|
+
/**
|
|
1347
|
+
* Resolves the ZK artifacts for a structured contract key.
|
|
1348
|
+
*
|
|
1349
|
+
* @param location The contract address, circuit, and deployed verifier key hash to resolve.
|
|
1350
|
+
* @throws ZKArtifactNotFoundError If no source's verifier key for the circuit matches.
|
|
1351
|
+
*/
|
|
1352
|
+
get(location: ContractKeyLocation): Promise<ZKConfig<string>>;
|
|
1353
|
+
/**
|
|
1354
|
+
* Resolves the ZK artifacts for a key-location string from a proof preimage.
|
|
1355
|
+
*
|
|
1356
|
+
* @param keyLocation The key-location string.
|
|
1357
|
+
* @returns The matched artifacts, or `undefined` if `keyLocation` is not a contract key
|
|
1358
|
+
* location (for example, a `midnight/` protocol builtin, which provers resolve elsewhere).
|
|
1359
|
+
* @throws ZKArtifactNotFoundError If `keyLocation` is a contract key location but no source's
|
|
1360
|
+
* verifier key for the circuit matches the embedded hash.
|
|
1361
|
+
*/
|
|
1362
|
+
resolveKeyLocation(keyLocation: string): Promise<ZKConfig<string> | undefined>;
|
|
1363
|
+
/**
|
|
1364
|
+
* Adapts this registry to the DApp connector's {@link KeyMaterialProvider}, allowing a wallet
|
|
1365
|
+
* to resolve the key locations of a transaction assembled by this application.
|
|
1366
|
+
*/
|
|
1367
|
+
asKeyMaterialProvider(): KeyMaterialProvider;
|
|
1368
|
+
private resolve;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
export { ExportDecryptionError, FailEntirely, FailFallible, ImportConflictError, InvalidExportFormatError, InvalidProtocolSchemeError, LogLevel, MAX_EXPORT_SIGNING_KEYS, MAX_EXPORT_STATES, PrivateStateExportError, PrivateStateImportError, SegmentFail, SegmentSuccess, SigningKeyExportError, SucceedEntirely, ZKArtifactNotFoundError, ZKConfigProvider, ZKConfigRegistry, asContractAddress, asEffectOption, createProofProvider, createProverKey, createVerifierKey, createZKIR, exitResultOrError, makeContractExecutableRuntime, zkConfigToProvingKeyMaterial };
|
|
1372
|
+
export type { All, AnyPrivateState, AnyProvableCircuitId, BlockHash, BlockHashConfig, BlockHeightConfig, BlockInfo, ContractEvent, ContractEventAddress, ContractEventBase, ContractEventCursor, ContractEventFieldPrefix, ContractEventFilterBase, ContractEventQueryFilter, ContractEventSubscriptionFilter, ContractEventType, ContractEventsPage, ContractExecutableRuntimeOptions, ContractStateObservableConfig, ExportPrivateStatesOptions, ExportSigningKeysOptions, Fees, FinalizedTxData, ImportPrivateStatesOptions, ImportPrivateStatesResult, ImportSigningKeysOptions, ImportSigningKeysResult, KeyMaterialProvider, Latest, LoggerProvider, MidnightProvider, MidnightProviders, PrivateStateExport, PrivateStateId, PrivateStateImportErrorCause, PrivateStateProvider, ProofProvider, ProveTxConfig, ProverKey, PublicDataProvider, SegmentStatus, SigningKeyExport, TxIdConfig, TxStatus, UnboundTransaction, UnshieldedBalance, UnshieldedBalances, UnshieldedUtxo, UnshieldedUtxos, VerifierKey, WalletProvider, ZKConfig, ZKIR };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,8 @@ import * as Configuration from '@midnight-ntwrk/midnight-js-protocol/platform-js
|
|
|
4
4
|
import { Exit, Cause, Option, Layer, ConfigProvider, Effect } from 'effect';
|
|
5
5
|
import { CostModel } from '@midnight-ntwrk/midnight-js-protocol/ledger';
|
|
6
6
|
export { Transaction } from '@midnight-ntwrk/midnight-js-protocol/ledger';
|
|
7
|
+
import { encodeContractKeyLocation, parseContractKeyLocation, hashVerifierKey } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
8
|
+
export { encodeContractKeyLocation, hashVerifierKey, parseContractKeyLocation } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
7
9
|
|
|
8
10
|
/*
|
|
9
11
|
* This file is part of midnight-js.
|
|
@@ -393,5 +395,129 @@ class ZKConfigProvider {
|
|
|
393
395
|
}
|
|
394
396
|
}
|
|
395
397
|
|
|
396
|
-
|
|
398
|
+
/*
|
|
399
|
+
* This file is part of midnight-js.
|
|
400
|
+
* Copyright (C) 2025-2026 Midnight Foundation
|
|
401
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
402
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
403
|
+
* You may not use this file except in compliance with the License.
|
|
404
|
+
* You may obtain a copy of the License at
|
|
405
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
406
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
407
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
408
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
409
|
+
* See the License for the specific language governing permissions and
|
|
410
|
+
* limitations under the License.
|
|
411
|
+
*/
|
|
412
|
+
/**
|
|
413
|
+
* Thrown when a contract key location parses but no artifact source contains a bundle whose
|
|
414
|
+
* verifier key matches the deployed one — i.e. the local artifacts have drifted from (or were
|
|
415
|
+
* never compiled for) the deployed contract.
|
|
416
|
+
*/
|
|
417
|
+
class ZKArtifactNotFoundError extends Error {
|
|
418
|
+
keyLocation;
|
|
419
|
+
constructor(keyLocation) {
|
|
420
|
+
super(`No ZK artifact bundle matches the deployed verifier key for contract ` +
|
|
421
|
+
`'${keyLocation.contractAddress}', circuit '${keyLocation.circuitId}'. The local compiled ` +
|
|
422
|
+
`artifacts are missing or stale with respect to the deployed contract.`);
|
|
423
|
+
this.keyLocation = keyLocation;
|
|
424
|
+
this.name = 'ZKArtifactNotFoundError';
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Resolves canonical contract key locations to ZK artifacts across a *set* of compiled-contract
|
|
429
|
+
* artifact sources.
|
|
430
|
+
*
|
|
431
|
+
* A cross-contract call transaction carries one proof per contract in the call tree, so proving
|
|
432
|
+
* requires artifacts for several compiled contracts, keyed by `(contractAddress, circuitId)`. No
|
|
433
|
+
* registration of addresses is required: the binding is *derived* by joining on the verifier key.
|
|
434
|
+
* Each location embeds the SHA-256 of the call's deployed verifier key (known at transaction
|
|
435
|
+
* assembly from the contract's resolved on-chain state), and resolution selects the source whose
|
|
436
|
+
* local verifier key for the circuit matches. The join is sound because it is the predicate the
|
|
437
|
+
* chain itself enforces — a proof must verify against the deployed key — and it makes the
|
|
438
|
+
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
439
|
+
* collisions across contracts.
|
|
440
|
+
*
|
|
441
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs;
|
|
442
|
+
* resolutions are memoized per location.
|
|
443
|
+
*/
|
|
444
|
+
class ZKConfigRegistry {
|
|
445
|
+
sources;
|
|
446
|
+
resolved = new Map();
|
|
447
|
+
/**
|
|
448
|
+
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
449
|
+
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
450
|
+
*/
|
|
451
|
+
constructor(sources) {
|
|
452
|
+
this.sources = [...sources];
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Resolves the ZK artifacts for a structured contract key.
|
|
456
|
+
*
|
|
457
|
+
* @param location The contract address, circuit, and deployed verifier key hash to resolve.
|
|
458
|
+
* @throws ZKArtifactNotFoundError If no source's verifier key for the circuit matches.
|
|
459
|
+
*/
|
|
460
|
+
get(location) {
|
|
461
|
+
return this.resolve(encodeContractKeyLocation(location), location);
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Resolves the ZK artifacts for a key-location string from a proof preimage.
|
|
465
|
+
*
|
|
466
|
+
* @param keyLocation The key-location string.
|
|
467
|
+
* @returns The matched artifacts, or `undefined` if `keyLocation` is not a contract key
|
|
468
|
+
* location (for example, a `midnight/` protocol builtin, which provers resolve elsewhere).
|
|
469
|
+
* @throws ZKArtifactNotFoundError If `keyLocation` is a contract key location but no source's
|
|
470
|
+
* verifier key for the circuit matches the embedded hash.
|
|
471
|
+
*/
|
|
472
|
+
async resolveKeyLocation(keyLocation) {
|
|
473
|
+
const parsed = parseContractKeyLocation(keyLocation);
|
|
474
|
+
if (parsed === undefined) {
|
|
475
|
+
return undefined;
|
|
476
|
+
}
|
|
477
|
+
return this.resolve(keyLocation, parsed);
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Adapts this registry to the DApp connector's {@link KeyMaterialProvider}, allowing a wallet
|
|
481
|
+
* to resolve the key locations of a transaction assembled by this application.
|
|
482
|
+
*/
|
|
483
|
+
asKeyMaterialProvider() {
|
|
484
|
+
const resolve = async (circuitKeyLocation) => {
|
|
485
|
+
const config = await this.resolveKeyLocation(circuitKeyLocation);
|
|
486
|
+
if (config === undefined) {
|
|
487
|
+
throw new Error(`'${circuitKeyLocation}' is not a contract key location`);
|
|
488
|
+
}
|
|
489
|
+
return config;
|
|
490
|
+
};
|
|
491
|
+
return {
|
|
492
|
+
getZKIR: (circuitKeyLocation) => resolve(circuitKeyLocation).then((config) => config.zkir),
|
|
493
|
+
getProverKey: (circuitKeyLocation) => resolve(circuitKeyLocation).then((config) => config.proverKey),
|
|
494
|
+
getVerifierKey: (circuitKeyLocation) => resolve(circuitKeyLocation).then((config) => config.verifierKey)
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
async resolve(keyLocation, parsed) {
|
|
498
|
+
const memoized = this.resolved.get(keyLocation);
|
|
499
|
+
if (memoized !== undefined) {
|
|
500
|
+
return memoized;
|
|
501
|
+
}
|
|
502
|
+
for (const source of this.sources) {
|
|
503
|
+
let verifierKey;
|
|
504
|
+
try {
|
|
505
|
+
verifierKey = await source.getVerifierKey(parsed.circuitId);
|
|
506
|
+
}
|
|
507
|
+
catch {
|
|
508
|
+
// The source has no circuit by this name; try the next one.
|
|
509
|
+
continue;
|
|
510
|
+
}
|
|
511
|
+
if (hashVerifierKey(verifierKey) !== parsed.verifierKeyHash) {
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
const config = await source.get(parsed.circuitId);
|
|
515
|
+
this.resolved.set(keyLocation, config);
|
|
516
|
+
return config;
|
|
517
|
+
}
|
|
518
|
+
throw new ZKArtifactNotFoundError(parsed);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export { ExportDecryptionError, FailEntirely, FailFallible, ImportConflictError, InvalidExportFormatError, InvalidProtocolSchemeError, LogLevel, MAX_EXPORT_SIGNING_KEYS, MAX_EXPORT_STATES, PrivateStateExportError, PrivateStateImportError, SegmentFail, SegmentSuccess, SigningKeyExportError, SucceedEntirely, ZKArtifactNotFoundError, ZKConfigProvider, ZKConfigRegistry, asContractAddress, asEffectOption, createProofProvider, createProverKey, createVerifierKey, createZKIR, exitResultOrError, makeContractExecutableRuntime, zkConfigToProvingKeyMaterial };
|
|
397
523
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/contract.ts","../src/errors.ts","../src/logger-provider.ts","../src/midnight-types.ts","../src/private-state-provider.ts","../src/proof-provider.ts","../src/zk-config-provider.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/contract.ts","../src/errors.ts","../src/logger-provider.ts","../src/midnight-types.ts","../src/private-state-provider.ts","../src/proof-provider.ts","../src/zk-config-provider.ts","../src/zk-config-registry.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;AAaG;AAYH;;;;;;;;AAQG;AACH,MAAM,iBAAiB,GAAG,CAAsC,gBAA0C,KACxG,CAAC,gBAA0D,KACzD,MAAM,CAAC,GAAG,CAAC,aAAS;;;IAGlB,MAAM,cAAc,GAAG,CAAC,iBAAgD,KACtE,MAAM,CAAC,UAAU,CAAC;AAChB,QAAA,GAAG,EAAE,MAAM,gBAAgB,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AACnI,QAAA,KAAK,EAAE,CAAC,GAAY,KAAK,wBAAwB,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG;AACpH,KAAA,CAAC;IACJ,OAAO;QACL,cAAc;QACd,eAAe,EAAE,CAAC,kBAAkB,KAClC,MAAM,CAAC,OAAO,CACZ,kBAAkB,EAClB,CAAC,iBAAiB,KAChB,cAAc,CAAC,iBAAiB,CAAC,CAAC,IAAI,CACpC,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,KAAK,CAAC,iBAAiB,EAAE,WAAW,CAAU,CAAC,CACvE,EACH,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE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AAE,MAA2B,EAAA;QACpE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC;AAC/C,QAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;AAC1B,YAAA,OAAO,QAAQ;QACjB;AACA,QAAA,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;AACjC,YAAA,IAAI,WAAuB;AAC3B,YAAA,IAAI;gBACF,WAAW,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC;YAC7D;AAAE,YAAA,MAAM;;gBAEN;YACF;YACA,IAAI,eAAe,CAAC,WAAW,CAAC,KAAK,MAAM,CAAC,eAAe,EAAE;gBAC3D;YACF;YACA,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;YACjD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC;AACtC,YAAA,OAAO,MAAM;QACf;AACA,QAAA,MAAM,IAAI,uBAAuB,CAAC,MAAM,CAAC;IAC3C;AACD;;;;"}
|
|
@@ -45,6 +45,19 @@ export type BlockHashConfig = {
|
|
|
45
45
|
*/
|
|
46
46
|
readonly blockHash: string;
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Minimal identifying information for a block.
|
|
50
|
+
*/
|
|
51
|
+
export type BlockInfo = {
|
|
52
|
+
/**
|
|
53
|
+
* The hex-encoded block hash.
|
|
54
|
+
*/
|
|
55
|
+
readonly hash: string;
|
|
56
|
+
/**
|
|
57
|
+
* The block height.
|
|
58
|
+
*/
|
|
59
|
+
readonly height: number;
|
|
60
|
+
};
|
|
48
61
|
/**
|
|
49
62
|
* The configuration for a contract state observable. The corresponding observables may begin at different
|
|
50
63
|
* places (e.g. after a specific transaction identifier / block height) depending on the configuration, but
|
|
@@ -236,6 +249,13 @@ export interface ContractEventsPage {
|
|
|
236
249
|
* TODO: Add timeouts or retry limits to 'watchFor' queries.
|
|
237
250
|
*/
|
|
238
251
|
export interface PublicDataProvider {
|
|
252
|
+
/**
|
|
253
|
+
* Retrieves a block. If no block hash or block height is provided, the latest block is returned.
|
|
254
|
+
* Immediately returns null if no matching block is found.
|
|
255
|
+
* @param config The configuration of the query identifying the block of interest.
|
|
256
|
+
* If `undefined` returns the latest block.
|
|
257
|
+
*/
|
|
258
|
+
queryBlock(config?: BlockHeightConfig | BlockHashConfig): Promise<BlockInfo | null>;
|
|
239
259
|
/**
|
|
240
260
|
* Retrieves the on-chain state of a contract. If no block hash or block height are provided, the
|
|
241
261
|
* contract state at the address in the latest block is returned.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-data-provider.d.ts","sourceRoot":"","sources":["../src/public-data-provider.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sDAAsD,CAAC;AAC1F,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACrI,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG;IAChB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;CACtB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACzB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;CAC9B,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B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;;;;OAMG;IACH,uBAAuB,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,6BAA6B,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAEpH;;;;;;OAMG;IACH,4BAA4B,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,6BAA6B,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAE9H;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,mBAAmB,CAAC,MAAM,EAAE,wBAAwB,EAAE,IAAI,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAE3G;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,wBAAwB,CACtB,MAAM,EAAE,+BAA+B,EACvC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,mBAAmB,CAAA;KAAE,GACvC,UAAU,CAAC,aAAa,CAAC,CAAC;CAC9B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ZKConfig } from './midnight-types';
|
|
2
|
+
import type { KeyMaterialProvider, ZKConfigProvider } from './zk-config-provider';
|
|
3
|
+
import { type ContractKeyLocation } from './zk-key-location';
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when a contract key location parses but no artifact source contains a bundle whose
|
|
6
|
+
* verifier key matches the deployed one — i.e. the local artifacts have drifted from (or were
|
|
7
|
+
* never compiled for) the deployed contract.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ZKArtifactNotFoundError extends Error {
|
|
10
|
+
readonly keyLocation: ContractKeyLocation;
|
|
11
|
+
constructor(keyLocation: ContractKeyLocation);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolves canonical contract key locations to ZK artifacts across a *set* of compiled-contract
|
|
15
|
+
* artifact sources.
|
|
16
|
+
*
|
|
17
|
+
* A cross-contract call transaction carries one proof per contract in the call tree, so proving
|
|
18
|
+
* requires artifacts for several compiled contracts, keyed by `(contractAddress, circuitId)`. No
|
|
19
|
+
* registration of addresses is required: the binding is *derived* by joining on the verifier key.
|
|
20
|
+
* Each location embeds the SHA-256 of the call's deployed verifier key (known at transaction
|
|
21
|
+
* assembly from the contract's resolved on-chain state), and resolution selects the source whose
|
|
22
|
+
* local verifier key for the circuit matches. The join is sound because it is the predicate the
|
|
23
|
+
* chain itself enforces — a proof must verify against the deployed key — and it makes the
|
|
24
|
+
* resolution immune to redeploys, multiple deployments of one contract, and circuit-name
|
|
25
|
+
* collisions across contracts.
|
|
26
|
+
*
|
|
27
|
+
* The sources are the per-contract {@link ZKConfigProvider}s the application already constructs;
|
|
28
|
+
* resolutions are memoized per location.
|
|
29
|
+
*/
|
|
30
|
+
export declare class ZKConfigRegistry {
|
|
31
|
+
private readonly sources;
|
|
32
|
+
private readonly resolved;
|
|
33
|
+
/**
|
|
34
|
+
* @param sources The compiled-contract artifact sources to resolve against — one per compiled
|
|
35
|
+
* contract the application can call (its own contracts and any cross-contract call targets).
|
|
36
|
+
*/
|
|
37
|
+
constructor(sources: Iterable<ZKConfigProvider<string>>);
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the ZK artifacts for a structured contract key.
|
|
40
|
+
*
|
|
41
|
+
* @param location The contract address, circuit, and deployed verifier key hash to resolve.
|
|
42
|
+
* @throws ZKArtifactNotFoundError If no source's verifier key for the circuit matches.
|
|
43
|
+
*/
|
|
44
|
+
get(location: ContractKeyLocation): Promise<ZKConfig<string>>;
|
|
45
|
+
/**
|
|
46
|
+
* Resolves the ZK artifacts for a key-location string from a proof preimage.
|
|
47
|
+
*
|
|
48
|
+
* @param keyLocation The key-location string.
|
|
49
|
+
* @returns The matched artifacts, or `undefined` if `keyLocation` is not a contract key
|
|
50
|
+
* location (for example, a `midnight/` protocol builtin, which provers resolve elsewhere).
|
|
51
|
+
* @throws ZKArtifactNotFoundError If `keyLocation` is a contract key location but no source's
|
|
52
|
+
* verifier key for the circuit matches the embedded hash.
|
|
53
|
+
*/
|
|
54
|
+
resolveKeyLocation(keyLocation: string): Promise<ZKConfig<string> | undefined>;
|
|
55
|
+
/**
|
|
56
|
+
* Adapts this registry to the DApp connector's {@link KeyMaterialProvider}, allowing a wallet
|
|
57
|
+
* to resolve the key locations of a transaction assembled by this application.
|
|
58
|
+
*/
|
|
59
|
+
asKeyMaterialProvider(): KeyMaterialProvider;
|
|
60
|
+
private resolve;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=zk-config-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zk-config-registry.d.ts","sourceRoot":"","sources":["../src/zk-config-registry.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,KAAK,mBAAmB,EAAwE,MAAM,mBAAmB,CAAC;AAEnI;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IACpC,QAAQ,CAAC,WAAW,EAAE,mBAAmB;gBAAhC,WAAW,EAAE,mBAAmB;CAQtD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsC;IAE9D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuC;IAEhE;;;OAGG;gBACS,OAAO,EAAE,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAIvD;;;;;OAKG;IACH,GAAG,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAI7D;;;;;;;;OAQG;IACG,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAQpF;;;OAGG;IACH,qBAAqB,IAAI,mBAAmB;YAe9B,OAAO;CAsBtB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canonical key-location grammar for contract calls.
|
|
3
|
+
*
|
|
4
|
+
* The grammar is defined once, upstream, in `@midnight-ntwrk/compact-js` (the
|
|
5
|
+
* `ContractKeyLocation` module) so that every transaction assembler and prover shares a single
|
|
6
|
+
* definition; this module re-exports it. See the upstream module for the full specification:
|
|
7
|
+
* each contract call's proof preimage carries the canonical, self-describing location
|
|
8
|
+
* `contract:<address-hex>/<circuitId>?vk=<sha-256 of the deployed verifier key>`, which provers
|
|
9
|
+
* resolve by verifier-key content rather than by circuit name (see `ZKConfigRegistry`).
|
|
10
|
+
*/
|
|
11
|
+
export { type ContractKeyLocation, encodeContractKeyLocation, hashVerifierKey, parseContractKeyLocation } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
|
|
12
|
+
//# sourceMappingURL=zk-key-location.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zk-key-location.d.ts","sourceRoot":"","sources":["../src/zk-key-location.ts"],"names":[],"mappings":"AAeA;;;;;;;;;GASG;AACH,OAAO,EACL,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EACzB,MAAM,iDAAiD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midnight-ntwrk/midnight-js-types",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-beta.1",
|
|
4
4
|
"description": "Shared data types and interfaces for MidnightJS modules",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dist/"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@midnight-ntwrk/midnight-js-protocol": "5.0.0-
|
|
32
|
+
"@midnight-ntwrk/midnight-js-protocol": "5.0.0-beta.1",
|
|
33
33
|
"effect": "^3.20.0",
|
|
34
34
|
"pino": "^10.3.1",
|
|
35
35
|
"rxjs": "^7.8.2"
|