# Midnight.js v4.1.1 release notes

> For the complete documentation index, see [llms.txt](https://docs.midnight.network/llms.txt)

* **Version**: v4.1.1
* **Date**: June 2, 2026
* **Node.js requirement**: >=22

***

## High-level summary[​](#high-level-summary "Direct link to 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[​](#audience "Direct link to Audience")

This release note is most relevant for developers who:

* Use `IndexerFormattedError.cause` in 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[​](#summary-of-updates "Direct link to Summary of updates")

* Renamed `IndexerFormattedError.cause` to `.errors` for ES2022 `Error.cause` compatibility.
* Applied full password policy to signing key and private state export operations.
* Emitted contract state for `blockHeight` and `blockHash` configurations.
* Hardened error handling in `indexer-public-data-provider` with 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[​](#new-features "Direct link to New features")

Below is a detailed breakdown of the new capabilities introduced in this release.

### qanet support in testkit-js[​](#qanet-support-in-testkit-js "Direct link to 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[​](#parameterized-compose-image-versions "Direct link to 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[​](#breaking-changes "Direct link to Breaking changes")

### Rename `IndexerFormattedError.cause` to `.errors`[​](#rename-indexerformattederrorcause-to-errors "Direct link to rename-indexerformattederrorcause-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[​](#extracted-correlatedeploytxid-helper "Direct link to 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[​](#non-null-assertions-replaced-with-type-predicates "Direct link to 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[​](#bug-fixes-and-quality-improvements "Direct link to Bug fixes and quality improvements")

This release includes the following bug fixes and quality improvements.

### Full password policy on export operations[​](#full-password-policy-on-export-operations "Direct link to 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-emission-for-block-configurations "Direct link to 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[​](#hardened-indexer-error-handling "Direct link to 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[​](#signing-key-validation-on-import "Direct link to 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[​](#plain-httpws-warning-for-non-loopback-urls "Direct link to 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[​](#known-issues "Direct link to Known issues")

No critical known issues exist at release time.

***

## Links and references[​](#links-and-references "Direct link to Links and references")

* **GitHub**: [Midnight.js repository](https://github.com/midnightntwrk/midnight-js)
* **API reference**: [Midnight.js API documentation](https://docs.midnight.network/api-reference/midnight-js/packages.md)
* **Release**: [v4.1.1 on GitHub](https://github.com/midnightntwrk/midnight-js/releases/tag/v4.1.1)
