Midnight.js v4.1.1 release notes
For the complete documentation index, see llms.txt
- Version: v4.1.1
- Date: June 2, 2026
- Node.js requirement: >=22
High-level summary
This release introduces breaking changes to error handling in the indexer public data provider and hardens security for key management and provider URL validation. It also adds qanet support in testkit-js and improves contract governance code organization and type safety.
Audience
This release note is most relevant for developers who:
- Use
IndexerFormattedError.causein error handling code (renamed to.errors). - Export or import signing keys through the Midnight.js key management APIs.
- Configure provider URLs for non-loopback environments.
- Run E2E tests against qanet using testkit-js.
Summary of updates
- Renamed
IndexerFormattedError.causeto.errorsfor ES2022Error.causecompatibility. - Applied full password policy to signing key and private state export operations.
- Emitted contract state for
blockHeightandblockHashconfigurations. - Hardened error handling in
indexer-public-data-providerwith structured error types. - Added signing key value validation on import.
- Added warnings for plain HTTP/WS on non-loopback provider URLs.
- Added qanet support via NIGHT/DUST faucet flow in testkit-js.
New features
Below is a detailed breakdown of the new capabilities introduced in this release.
qanet support in testkit-js
Testkit-js now supports qanet environments through a NIGHT/DUST faucet flow, enabling E2E testing against the qanet network. The keystore derives the waitForFunds address directly.
Parameterized compose image versions
Testkit-js compose configurations now accept parameterized image versions, enabling a nightly E2E matrix that tests against multiple component versions.
Breaking changes
Rename IndexerFormattedError.cause to .errors
The ES2022 Error.cause slot is contractually a single underlying error, not a collection. Shadowing it with an array of GraphQL errors broke Node's util.inspect causal chain, Sentry grouping, and structured loggers. This release renames the property to .errors to avoid the conflict.
Migration: Replace all references to IndexerFormattedError.cause with .errors.
Extracted correlateDeployTxId helper
This release extracts the contract-action / identifier correlation logic into a pure helper that takes narrow structural types. toFinalizedDeployTxData is now file-local and no longer exported. Use correlateDeployTxId instead.
Non-null assertions replaced with type predicates
Rx filter chains in contract action handling now use type predicates instead of non-null assertions, which may affect code that relied on the previous type narrowing behavior.
Bug fixes and quality improvements
This release includes the following bug fixes and quality improvements.
Full password policy on export operations
Export operations for signing keys and private states now enforce the same password policy as other key management operations, closing a security gap.
Contract state emission for block configurations
Contract state is now emitted for blockHeight and blockHash configurations, resolving cases where the system missed state updates.
Hardened indexer error handling
The indexer-public-data-provider now uses structured error types with proper error categorization, improving debuggability for GraphQL query failures.
Signing key validation on import
Imported signing key values are now validated before storage, preventing invalid keys from causing downstream failures.
Plain HTTP/WS warning for non-loopback URLs
Midnight.js now warns when provider URLs use plain HTTP or WebSocket protocols for non-loopback addresses, helping developers identify insecure configurations.
Known issues
No critical known issues exist at release time.
Links and references
- GitHub: Midnight.js repository
- API reference: Midnight.js API documentation
- Release: v4.1.1 on GitHub