@midnight-ntwrk/midnight-js-types 4.1.0 → 5.0.0-alpha.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.
@@ -1,4 +1,5 @@
1
1
  import { type ContractExecutable } from '@midnight-ntwrk/midnight-js-protocol/compact-js/effect';
2
+ import type { SigningKey } from '@midnight-ntwrk/midnight-js-protocol/compact-runtime';
2
3
  import { ContractAddress } from '@midnight-ntwrk/midnight-js-protocol/platform-js';
3
4
  import { type ConfigError, Exit, Option } from 'effect';
4
5
  import { type ManagedRuntime } from 'effect/ManagedRuntime';
@@ -10,7 +11,7 @@ export type ContractExecutableRuntimeOptions = {
10
11
  /** The current user's ZSwap public key. */
11
12
  readonly coinPublicKey: string;
12
13
  /** The signing key to add as the to-be-deployed contract's maintenance authority. */
13
- readonly signingKey?: string;
14
+ readonly signingKey?: SigningKey;
14
15
  };
15
16
  /**
16
17
  * Constructs an Effect managed runtime configured to execute contract executables.
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAeA,OAAO,EAAmC,KAAK,kBAAkB,EACpB,MAAM,wDAAwD,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAEnF,OAAO,EAAS,KAAK,WAAW,EAA0B,IAAI,EAAQ,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7F,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAkD7D;;GAEG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,2CAA2C;IAC3C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B,qFAAqF;IACrF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6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,gBAAgB,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,gCAAgC,KAAK,cAAc,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,WAAW,CAU/K,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAO7D,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,KAAK,OAAO,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAE/D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,eAAe,CAAC,eAC1B,CAAC"}
package/dist/errors.d.ts CHANGED
@@ -14,13 +14,13 @@ export declare class InvalidProtocolSchemeError extends Error {
14
14
  * An error thrown when exporting private states fails.
15
15
  */
16
16
  export declare class PrivateStateExportError extends Error {
17
- constructor(message: string);
17
+ constructor(message: string, options?: ErrorOptions);
18
18
  }
19
19
  /**
20
20
  * An error thrown when exporting signing keys fails.
21
21
  */
22
22
  export declare class SigningKeyExportError extends Error {
23
- constructor(message: string);
23
+ constructor(message: string, options?: ErrorOptions);
24
24
  }
25
25
  /**
26
26
  * Cause types for private state import errors.
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;aAMjC,aAAa,EAAE,MAAM;aACrB,gBAAgB,EAAE,MAAM,EAAE;IAN5C;;;OAGG;gBAEe,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM,EAAE;CAI7C;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,qBAAsB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AAK,CAAC,EAAE,4BAA4B,YAAA;CAKvD;AAED;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,uBAAuB;;CAQjE;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,uBAAuB;gBACvD,OAAO,SAA0B;CAI9C;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,uBAAuB;aAE5C,aAAa,EAAE,MAAM;gBAArB,aAAa,EAAE,MAAM,EACrC,UAAU,SAAkB;CAQ/B"}
package/dist/index.cjs CHANGED
@@ -73,7 +73,10 @@ const makeAdaptedRuntimeLayer = (zkConfigProvider, configMap) => effect$1.Layer.
73
73
  const makeContractExecutableRuntime = (zkConfigProvider, options) => {
74
74
  let config = [['KEYS_COIN_PUBLIC', options.coinPublicKey]];
75
75
  if (options.signingKey) {
76
- config = config.concat([['KEYS_SIGNING', options.signingKey]]);
76
+ config = config.concat([
77
+ ['KEYS_SIGNING', options.signingKey.value],
78
+ ['KEYS_SIGNING_KIND', options.signingKey.tag]
79
+ ]);
77
80
  }
78
81
  return effect.ContractExecutableRuntime.make(makeAdaptedRuntimeLayer(zkConfigProvider, new Map(config)));
79
82
  };
@@ -143,8 +146,8 @@ class InvalidProtocolSchemeError extends Error {
143
146
  * An error thrown when exporting private states fails.
144
147
  */
145
148
  class PrivateStateExportError extends Error {
146
- constructor(message) {
147
- super(message);
149
+ constructor(message, options) {
150
+ super(message, options);
148
151
  this.name = 'PrivateStateExportError';
149
152
  }
150
153
  }
@@ -152,8 +155,8 @@ class PrivateStateExportError extends Error {
152
155
  * An error thrown when exporting signing keys fails.
153
156
  */
154
157
  class SigningKeyExportError extends Error {
155
- constructor(message) {
156
- super(message);
158
+ constructor(message, options) {
159
+ super(message, options);
157
160
  this.name = 'SigningKeyExportError';
158
161
  }
159
162
  }
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;AAaG;AAWH;;;;;;;;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,cAAK,CAAC,OAAO,CACXC,sBAAe,CAAC,eAAe,EAC/BA,sBAAe,CAAC,e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AAE,GAAG,CAAC;QAClB,CAAC,CAAC,CACH;IACH;AAEA;;;AAGG;IACH,MAAM,GAAG,CAAC,SAAY,EAAA;QACpB,OAAO;YACL,SAAS;AACT,YAAA,SAAS,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;AAC7C,YAAA,WAAW,EAAE,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC;AACjD,YAAA,IAAI,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS;SACnC;IACH;IAEA,qBAAqB,GAAA;AACnB,QAAA,OAAO,IAA2B;IACpC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;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,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J/B;;;;;;;;;;;;;AAaG;AAgCH;;;AAGG;AACI,MAAM,iBAAiB,GAAG;AA4FjC;;;AAGG;AACI,MAAM,uBAAuB,GAAG;;ACjJvC;;;;;;;;;;;;;AAaG;AAwCH;;;;;;;AAOG;AACI,MAAM,mBAAmB,GAAG,CACjC,eAAgC,EAChC,SAAA,GAAuBC,gBAAS,CAAC,gBAAgB,EAAE,MAChC;IACnB,MAAM,OAAO,CAAC,UAA+B,EAAA;QAC3C,OAAO,UAAU,CAAC,KAAK,CAAC,eAAe,EAAE,SAAS,CAAC;IACrD;AACD,CAAA;;ACpED;;;;;;;;;;;;;AAaG;AAaH;;;;;;AAMG;MACmB,gBAAgB,CAAA;AAmBpC;;;AAGG;IACH,MAAM,eAAe,CAAC,UAAe,EAAA;AACnC,QAAA,OAAO,OAAO,CAAC,GAAG,CAChB,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,KAAI;YAC1B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;AACzC,YAAA,OAAO,CAAC,EAAE,EAAE,GAAG,CAAC;QAClB,CAAC,CAAC,CACH;IACH;AAEA;;;AAGG;IACH,MAAM,GAAG,CAAC,SAAY,EAAA;QACpB,OAAO;YACL,SAAS;AACT,YAAA,SAAS,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC;AAC7C,YAAA,WAAW,EAAE,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC;AACjD,YAAA,IAAI,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS;SACnC;IACH;IAEA,qBAAqB,GAAA;AACnB,QAAA,OAAO,IAA2B;IACpC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ContractExecutable } from '@midnight-ntwrk/midnight-js-protocol/compact-js/effect';
2
+ import { SigningKey, ContractAddress as ContractAddress$2, ContractState } from '@midnight-ntwrk/midnight-js-protocol/compact-runtime';
2
3
  import { ContractAddress as ContractAddress$1 } from '@midnight-ntwrk/midnight-js-protocol/platform-js';
3
4
  import { Option, Exit, ConfigError } from 'effect';
4
5
  import { ManagedRuntime } from 'effect/ManagedRuntime';
@@ -6,7 +7,6 @@ import { Contract } from '@midnight-ntwrk/midnight-js-protocol/compact-js';
6
7
  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';
7
8
  export { Transaction } from '@midnight-ntwrk/midnight-js-protocol/ledger';
8
9
  import { LogFn } from 'pino';
9
- import { ContractAddress as ContractAddress$2, SigningKey, ContractState } from '@midnight-ntwrk/midnight-js-protocol/compact-runtime';
10
10
  import { Observable } from 'rxjs';
11
11
 
12
12
  type AnyProvableCircuitId = Contract.ProvableCircuitId<Contract.Any>;
@@ -313,7 +313,7 @@ type ContractExecutableRuntimeOptions = {
313
313
  /** The current user's ZSwap public key. */
314
314
  readonly coinPublicKey: string;
315
315
  /** The signing key to add as the to-be-deployed contract's maintenance authority. */
316
- readonly signingKey?: string;
316
+ readonly signingKey?: SigningKey;
317
317
  };
318
318
  /**
319
319
  * Constructs an Effect managed runtime configured to execute contract executables.
@@ -362,13 +362,13 @@ declare class InvalidProtocolSchemeError extends Error {
362
362
  * An error thrown when exporting private states fails.
363
363
  */
364
364
  declare class PrivateStateExportError extends Error {
365
- constructor(message: string);
365
+ constructor(message: string, options?: ErrorOptions);
366
366
  }
367
367
  /**
368
368
  * An error thrown when exporting signing keys fails.
369
369
  */
370
370
  declare class SigningKeyExportError extends Error {
371
- constructor(message: string);
371
+ constructor(message: string, options?: ErrorOptions);
372
372
  }
373
373
  /**
374
374
  * Cause types for private state import errors.
@@ -643,6 +643,40 @@ interface PrivateStateProvider<PSI extends PrivateStateId = PrivateStateId, PS =
643
643
  * Retrieve the private state at the given private state ID.
644
644
  *
645
645
  * @param privateStateId The private state identifier.
646
+ * @returns The stored private state, or `null` if either:
647
+ * - the key is absent from the underlying store, or
648
+ * - the stored value deserializes to `undefined`.
649
+ *
650
+ * Callers should treat both `null` outcomes equivalently as "no usable
651
+ * value". The provider does not distinguish between an absent key and an
652
+ * explicitly-undefined stored value; if the distinction matters for your
653
+ * application, store a sentinel value instead.
654
+ *
655
+ * @throws If `setContractAddress` has not been called prior to invocation.
656
+ * @throws If the password returned by the configured password provider does
657
+ * not satisfy the minimum strength policy. Validation runs on every
658
+ * invocation against the password returned by the provider — it is not
659
+ * cached.
660
+ * @throws If decryption of the stored value fails (wrong password, salt
661
+ * mismatch, unsupported encryption version, or authentication tag
662
+ * mismatch). Decryption errors are propagated to the caller and do **not**
663
+ * collapse to `null`.
664
+ * @throws If a concurrent password rotation does not release its lock
665
+ * within the internal default timeout (5 minutes on the read path; the
666
+ * read path does not expose a configuration knob).
667
+ * @throws Underlying store I/O errors are propagated; callers should not
668
+ * include them in user-facing messages without redacting paths and
669
+ * OS-level metadata.
670
+ *
671
+ * @remarks
672
+ * Implementations may lazily migrate legacy or unencrypted entries on
673
+ * read, which means a successful logical read can trigger a write to the
674
+ * underlying store. In read-only environments (mounted-read-only file
675
+ * systems, quota-exhausted backends), `get` may reject with an I/O error
676
+ * even when the value is present and decryptable. The list of decryption
677
+ * failure modes above is illustrative, not exhaustive — payload
678
+ * encoding/parse errors, crypto-backend availability errors, and other
679
+ * corruption modes are also surfaced as throws rather than `null`.
646
680
  */
647
681
  get(privateStateId: PSI): Promise<PS | null>;
648
682
  /**
@@ -666,6 +700,41 @@ interface PrivateStateProvider<PSI extends PrivateStateId = PrivateStateId, PS =
666
700
  * Retrieve the signing key for a contract.
667
701
  *
668
702
  * @param address The address of the contract for which to get the signing key.
703
+ * @returns The stored signing key, or `null` if either:
704
+ * - no signing key is stored for the given address, or
705
+ * - the stored value deserializes to `undefined`.
706
+ *
707
+ * Callers should treat both `null` outcomes equivalently as "no usable
708
+ * value".
709
+ *
710
+ * @throws If the password returned by the configured password provider does
711
+ * not satisfy the minimum strength policy. Validation runs on every
712
+ * invocation against the password returned by the provider — it is not
713
+ * cached.
714
+ * @throws If decryption of the stored value fails (wrong password, salt
715
+ * mismatch, unsupported encryption version, or authentication tag
716
+ * mismatch). Decryption errors are propagated to the caller and do **not**
717
+ * collapse to `null`.
718
+ * @throws If a concurrent password rotation does not release its lock
719
+ * within the internal default timeout (5 minutes on the read path; the
720
+ * read path does not expose a configuration knob).
721
+ * @throws Underlying store I/O errors are propagated; callers should not
722
+ * include them in user-facing messages without redacting paths and
723
+ * OS-level metadata.
724
+ *
725
+ * @remarks
726
+ * Unlike {@link PrivateStateProvider.get}, this method does **not** require
727
+ * {@link PrivateStateProvider.setContractAddress} to have been called first —
728
+ * the contract address is supplied as an argument.
729
+ *
730
+ * Implementations may lazily migrate legacy or unencrypted entries on
731
+ * read, which means a successful logical read can trigger a write to the
732
+ * underlying store. In read-only environments, `getSigningKey` may reject
733
+ * with an I/O error even when the value is present and decryptable. The
734
+ * list of decryption failure modes above is illustrative, not exhaustive
735
+ * — payload encoding/parse errors, crypto-backend availability errors,
736
+ * and other corruption modes are also surfaced as throws rather than
737
+ * `null`.
669
738
  */
670
739
  getSigningKey(address: ContractAddress$2): Promise<SigningKey | null>;
671
740
  /**
@@ -685,7 +754,17 @@ interface PrivateStateProvider<PSI extends PrivateStateId = PrivateStateId, PS =
685
754
  *
686
755
  * @param options Export options including optional custom password and state limit.
687
756
  * @returns A JSON-serializable export structure that can be saved or transmitted.
688
- * @throws {PrivateStateExportError} If no states exist to export or limit exceeded.
757
+ * @throws {PrivateStateExportError} If no states exist to export, the state
758
+ * limit is exceeded, or a caller-supplied `options.password` does not
759
+ * satisfy the minimum-length policy.
760
+ * @throws If implementations require a scoped operating context (for
761
+ * example, an account or contract address) and that context is not set.
762
+ * @throws If the password returned by the configured password provider
763
+ * does not satisfy the minimum strength policy (validation runs on
764
+ * every invocation).
765
+ * @throws If reading existing entries fails for any of the reasons listed
766
+ * on {@link PrivateStateProvider.get} (decryption failure, rotation
767
+ * lock timeout, store I/O).
689
768
  */
690
769
  exportPrivateStates(options?: ExportPrivateStatesOptions): Promise<PrivateStateExport>;
691
770
  /**
@@ -697,6 +776,13 @@ interface PrivateStateProvider<PSI extends PrivateStateId = PrivateStateId, PS =
697
776
  * @throws {ExportDecryptionError} If decryption fails (wrong password or corrupted data).
698
777
  * @throws {InvalidExportFormatError} If the export format is invalid or unsupported.
699
778
  * @throws {ImportConflictError} If conflictStrategy is 'error' and conflicts exist.
779
+ * @throws {PrivateStateExportError} If a caller-supplied `options.password`
780
+ * does not satisfy the minimum-length policy.
781
+ * @throws If implementations require a scoped operating context (for
782
+ * example, an account or contract address) and that context is not set.
783
+ * @throws If reading or writing the underlying store fails for any of the
784
+ * reasons listed on {@link PrivateStateProvider.get} or
785
+ * {@link PrivateStateProvider.set}.
700
786
  */
701
787
  importPrivateStates(exportData: PrivateStateExport, options?: ImportPrivateStatesOptions): Promise<ImportPrivateStatesResult>;
702
788
  /**
@@ -704,7 +790,14 @@ interface PrivateStateProvider<PSI extends PrivateStateId = PrivateStateId, PS =
704
790
  *
705
791
  * @param options Export options including optional custom password and key limit.
706
792
  * @returns A JSON-serializable export structure that can be saved or transmitted.
707
- * @throws {SigningKeyExportError} If no keys exist to export or limit exceeded.
793
+ * @throws {SigningKeyExportError} If no keys exist to export, the key limit
794
+ * is exceeded, or a caller-supplied `options.password` does not satisfy
795
+ * the minimum-length policy.
796
+ * @throws If the password returned by the configured password provider
797
+ * does not satisfy the minimum strength policy (validation runs on
798
+ * every invocation).
799
+ * @throws If reading existing entries fails for any of the reasons listed
800
+ * on {@link PrivateStateProvider.getSigningKey}.
708
801
  */
709
802
  exportSigningKeys(options?: ExportSigningKeysOptions): Promise<SigningKeyExport>;
710
803
  /**
@@ -716,6 +809,11 @@ interface PrivateStateProvider<PSI extends PrivateStateId = PrivateStateId, PS =
716
809
  * @throws {ExportDecryptionError} If decryption fails (wrong password or corrupted data).
717
810
  * @throws {InvalidExportFormatError} If the export format is invalid or unsupported.
718
811
  * @throws {ImportConflictError} If conflictStrategy is 'error' and conflicts exist.
812
+ * @throws {SigningKeyExportError} If a caller-supplied `options.password`
813
+ * does not satisfy the minimum-length policy.
814
+ * @throws If reading or writing the underlying store fails for any of the
815
+ * reasons listed on {@link PrivateStateProvider.getSigningKey} or
816
+ * {@link PrivateStateProvider.setSigningKey}.
719
817
  */
720
818
  importSigningKeys(exportData: SigningKeyExport, options?: ImportSigningKeysOptions): Promise<ImportSigningKeysResult>;
721
819
  }
@@ -811,6 +909,179 @@ type ContractStateObservableConfig = ((TxIdConfig | BlockHashConfig | BlockHeigh
811
909
  */
812
910
  readonly inclusive?: boolean;
813
911
  }) | Latest | All;
912
+ /**
913
+ * The eleven contract event variants surfaced by the indexer (MIP-0002 public
914
+ * contract log emission). The variant *set* is identical to compact-js's
915
+ * `LogEventType`; only the string casing differs (PascalCase here, kebab-case
916
+ * in compact-js, SCREAMING_SNAKE on the indexer wire). Adding a variant is a
917
+ * breaking change — the mapping, filter translation, and exhaustiveness guards
918
+ * all key off this union.
919
+ */
920
+ type ContractEventType = 'ShieldedSpend' | 'ShieldedReceive' | 'ShieldedMint' | 'ShieldedBurn' | 'UnshieldedSpend' | 'UnshieldedReceive' | 'UnshieldedMint' | 'UnshieldedBurn' | 'Paused' | 'Unpaused' | 'Misc';
921
+ /**
922
+ * A `sender` / `recipient` on an unshielded event. The indexer returns a tagged
923
+ * union (`Either<ZswapCoinPublicKey, ContractAddress>`); this preserves the
924
+ * discriminator so consumers can tell a user address from a contract address
925
+ * rather than receiving a bare, ambiguous string.
926
+ */
927
+ interface ContractEventAddress {
928
+ /** Which kind of address `value` holds. */
929
+ readonly kind: 'user' | 'contract';
930
+ /** The hex-encoded address. */
931
+ readonly value: string;
932
+ }
933
+ /**
934
+ * Fields common to every {@link ContractEvent} variant, regardless of type.
935
+ */
936
+ interface ContractEventBase {
937
+ /**
938
+ * Monotonic indexer cursor for this event. Inclusive resumption point — to
939
+ * resume *after* this event, pass `{ fromId: id + 1 }`.
940
+ */
941
+ readonly id: number;
942
+ /**
943
+ * Highest event id the indexer currently knows (the chain tip for events).
944
+ * Compare against {@link id} to detect catch-up / whether more events exist.
945
+ */
946
+ readonly maxId: number;
947
+ /**
948
+ * Payload schema version — selects the (future) per-event payload decoder.
949
+ * Iteration-1 events are `version: 1`.
950
+ */
951
+ readonly version: number;
952
+ /** Address of the contract that emitted the event. */
953
+ readonly contractAddress: ContractAddress;
954
+ /**
955
+ * Indexer-internal `BIGSERIAL` row id of the emitting transaction — **not**
956
+ * the chain transaction hash. To fetch the chain transaction, issue a
957
+ * separate query. Note the asymmetry with {@link ContractEventFilterBase.transactionHash},
958
+ * which narrows by chain hash.
959
+ */
960
+ readonly transactionId: number;
961
+ /**
962
+ * Opaque hex `VersionedLogItem` bytes, carried verbatim. Never decoded or
963
+ * validated by this provider — the forward bridge to a future compact-js
964
+ * payload decoder.
965
+ */
966
+ readonly raw: string;
967
+ }
968
+ /**
969
+ * A decoded contract event. Discriminated union keyed on `eventType`; narrow on
970
+ * it to access the variant-specific payload fields.
971
+ *
972
+ * `amount` is always a `string` (encodes up to a 16-byte integer) — never round
973
+ * it through `Number()`. Absent nullable fields are normalized to `undefined`
974
+ * (never `null`).
975
+ */
976
+ type ContractEvent = (ContractEventBase & {
977
+ readonly eventType: 'ShieldedSpend';
978
+ readonly nullifier: string;
979
+ }) | (ContractEventBase & {
980
+ readonly eventType: 'ShieldedReceive';
981
+ readonly commitment: string;
982
+ readonly ciphertext?: string;
983
+ readonly receivingContractAddress?: string;
984
+ }) | (ContractEventBase & {
985
+ readonly eventType: 'ShieldedMint';
986
+ readonly commitment: string;
987
+ readonly domainSep: string;
988
+ readonly amount?: string;
989
+ }) | (ContractEventBase & {
990
+ readonly eventType: 'ShieldedBurn';
991
+ readonly nullifier: string;
992
+ readonly amount?: string;
993
+ }) | (ContractEventBase & {
994
+ readonly eventType: 'UnshieldedSpend';
995
+ readonly sender: ContractEventAddress;
996
+ readonly domainSep: string;
997
+ readonly tokenType: string;
998
+ readonly amount: string;
999
+ }) | (ContractEventBase & {
1000
+ readonly eventType: 'UnshieldedReceive';
1001
+ readonly recipient: ContractEventAddress;
1002
+ readonly domainSep: string;
1003
+ readonly tokenType: string;
1004
+ readonly amount: string;
1005
+ }) | (ContractEventBase & {
1006
+ readonly eventType: 'UnshieldedMint';
1007
+ readonly domainSep: string;
1008
+ readonly tokenType: string;
1009
+ readonly amount: string;
1010
+ }) | (ContractEventBase & {
1011
+ readonly eventType: 'UnshieldedBurn';
1012
+ readonly sender: ContractEventAddress;
1013
+ readonly tokenType: string;
1014
+ readonly amount: string;
1015
+ }) | (ContractEventBase & {
1016
+ readonly eventType: 'Paused';
1017
+ }) | (ContractEventBase & {
1018
+ readonly eventType: 'Unpaused';
1019
+ }) | (ContractEventBase & {
1020
+ readonly eventType: 'Misc';
1021
+ readonly name: string;
1022
+ readonly payload: string;
1023
+ });
1024
+ /**
1025
+ * A single prefix filter on an indexed field of a standard event. `prefix` is
1026
+ * hex-encoded; the empty string matches all values.
1027
+ */
1028
+ interface ContractEventFieldPrefix {
1029
+ readonly fieldName: string;
1030
+ readonly prefix: string;
1031
+ }
1032
+ /**
1033
+ * Filter fields shared by the query and the subscription.
1034
+ */
1035
+ interface ContractEventFilterBase {
1036
+ /** Required: the contract whose events to return. */
1037
+ readonly contractAddress: ContractAddress;
1038
+ /**
1039
+ * Optional subset of event types. Omit to mean "all types". An empty array
1040
+ * is rejected (it would silently match nothing).
1041
+ */
1042
+ readonly types?: ContractEventType[];
1043
+ /**
1044
+ * Optional prefix filters on indexed fields. Accepted only when every
1045
+ * filtered type is a standard (non-`Misc`) variant — see method docs.
1046
+ */
1047
+ readonly fieldPrefixes?: ContractEventFieldPrefix[];
1048
+ /** Optional: narrow to events emitted from the transaction with this chain hash. */
1049
+ readonly transactionHash?: string;
1050
+ }
1051
+ /**
1052
+ * Filter for {@link PublicDataProvider.queryContractEvents}. `fromBlock` /
1053
+ * `toBlock` are inclusive block-height bounds for a finite, point-in-time read.
1054
+ */
1055
+ interface ContractEventQueryFilter extends ContractEventFilterBase {
1056
+ readonly fromBlock?: number;
1057
+ readonly toBlock?: number;
1058
+ }
1059
+ /**
1060
+ * Filter for {@link PublicDataProvider.contractEventsObservable}. The stream
1061
+ * start is supplied separately via {@link ContractEventCursor}; `toBlock`
1062
+ * terminates the stream once the chain reaches that height.
1063
+ */
1064
+ interface ContractEventSubscriptionFilter extends ContractEventFilterBase {
1065
+ readonly toBlock?: number;
1066
+ }
1067
+ /**
1068
+ * Where a subscription begins. Exactly one addressing mode per call — two
1069
+ * competing start points are unrepresentable by construction.
1070
+ */
1071
+ type ContractEventCursor = {
1072
+ readonly fromId: number;
1073
+ } | {
1074
+ readonly fromBlock: number;
1075
+ };
1076
+ /**
1077
+ * Pagination window for {@link PublicDataProvider.queryContractEvents}.
1078
+ * `offset` is only stable within a window with a fixed upper bound — pin
1079
+ * `toBlock` for multi-page reads.
1080
+ */
1081
+ interface ContractEventsPage {
1082
+ readonly limit?: number;
1083
+ readonly offset?: number;
1084
+ }
814
1085
  /**
815
1086
  * Interface for a public data service. This service retrieves public data from the blockchain.
816
1087
  * TODO: Add timeouts or retry limits to 'watchFor' queries.
@@ -912,6 +1183,56 @@ interface PublicDataProvider {
912
1183
  * @return {Observable<UnshieldedBalances>} An observable that emits the unshielded balances for the provided address.
913
1184
  */
914
1185
  unshieldedBalancesObservable(address: ContractAddress, config: ContractStateObservableConfig): Observable<UnshieldedBalances>;
1186
+ /**
1187
+ * Queries contract events for a contract address — a finite, paginated,
1188
+ * point-in-time read.
1189
+ *
1190
+ * Results are returned in ascending `id` order. The result is a plain array
1191
+ * with no total count: detect the end via `result.length < limit`, and read
1192
+ * `maxId` on the last item to see how far the tip is.
1193
+ *
1194
+ * When `page.limit` is omitted an implementation-defined default page size is
1195
+ * applied (never an undocumented server default). `offset` is only stable
1196
+ * within a window with a fixed upper bound — pin `filter.toBlock` for
1197
+ * multi-page reads, or prefer the `getAllContractEvents` helper / the
1198
+ * subscription for tailing.
1199
+ *
1200
+ * Fails fast (synchronously, before any network call) on an invalid
1201
+ * `contractAddress`, an empty `types` array, `fieldPrefixes` combined with
1202
+ * `Misc` (or with `types` omitted), or an unknown `fieldName`. Network /
1203
+ * GraphQL errors reject the promise — an empty array always means "no
1204
+ * matching events", never a swallowed error.
1205
+ *
1206
+ * @param filter The events to return; `contractAddress` is required.
1207
+ * @param page Optional pagination window.
1208
+ */
1209
+ queryContractEvents(filter: ContractEventQueryFilter, page?: ContractEventsPage): Promise<ContractEvent[]>;
1210
+ /**
1211
+ * Streams contract events for a contract address — replay from a cursor, then
1212
+ * live, in one continuous stream.
1213
+ *
1214
+ * The start is supplied via `opts.startAt`: `{ fromId }` resumes inclusively
1215
+ * from a known event id, `{ fromBlock }` starts from a block height. Omitting
1216
+ * `startAt` streams from the start of history. The indexer replays historical
1217
+ * events from that point in monotonic `id` order, then continues live — there
1218
+ * is no separate backfill query and no client-side dedup.
1219
+ *
1220
+ * `{ fromId }` is **inclusive**; to resume *after* the last seen event pass
1221
+ * `{ fromId: lastSeenId + 1 }`.
1222
+ *
1223
+ * `filter.toBlock` completes the stream once the chain reaches that height;
1224
+ * without it the stream runs until unsubscribed or the provider is disposed.
1225
+ * Delivery is **at-least-once** across transport reconnects (the provider
1226
+ * does not advance the cursor) — persisting consumers should dedup by `id`.
1227
+ * Transport failures surface as an observable `error`, never a silent
1228
+ * completion.
1229
+ *
1230
+ * @param filter The events to stream; `contractAddress` is required.
1231
+ * @param opts Optional stream start.
1232
+ */
1233
+ contractEventsObservable(filter: ContractEventSubscriptionFilter, opts?: {
1234
+ startAt?: ContractEventCursor;
1235
+ }): Observable<ContractEvent>;
915
1236
  }
916
1237
 
917
1238
  /**
@@ -968,4 +1289,4 @@ interface MidnightProviders<PCK extends AnyProvableCircuitId = AnyProvableCircui
968
1289
  }
969
1290
 
970
1291
  export { ExportDecryptionError, FailEntirely, FailFallible, ImportConflictError, InvalidExportFormatError, InvalidProtocolSchemeError, LogLevel, MAX_EXPORT_SIGNING_KEYS, MAX_EXPORT_STATES, PrivateStateExportError, PrivateStateImportError, SegmentFail, SegmentSuccess, SigningKeyExportError, SucceedEntirely, ZKConfigProvider, asContractAddress, asEffectOption, createProofProvider, createProverKey, createVerifierKey, createZKIR, exitResultOrError, makeContractExecutableRuntime, zkConfigToProvingKeyMaterial };
971
- export type { All, AnyPrivateState, AnyProvableCircuitId, BlockHash, BlockHashConfig, BlockHeightConfig, 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 };
1292
+ export type { All, AnyPrivateState, AnyProvableCircuitId, BlockHash, BlockHashConfig, BlockHeightConfig, 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 };