Skip to main content

Midnight.js API Reference v1.0.0


Midnight.js API Reference / @midnight-ntwrk/midnight-js-testing / QanetTestEnvironment

Class: QanetTestEnvironment

Test environment configuration for the Midnight QA network. Provides URLs and endpoints for QA network services.

Extends

Constructors

Constructor

new QanetTestEnvironment(logger): QanetTestEnvironment

Creates a new TestEnvironment instance.

Parameters

logger

Logger

Logger instance for recording operations

Returns

QanetTestEnvironment

Inherited from

RemoteTestEnvironment.constructor

Methods

getEnvironmentConfiguration()

getEnvironmentConfiguration(): EnvironmentConfiguration

Returns the configuration for the QA network environment services.

Returns

EnvironmentConfiguration

Object containing URLs for QA network services:

  • indexer: GraphQL API endpoint for the indexer
  • indexerWS: WebSocket endpoint for the indexer
  • node: RPC endpoint for the blockchain node
  • faucet: API endpoint for requesting test tokens
  • proofServer: URL for the proof generation server

Overrides

RemoteTestEnvironment.getEnvironmentConfiguration


getMidnightWalletProvider()

getMidnightWalletProvider(): Promise<MidnightWalletProvider>

Starts a single wallet instance.

Returns

Promise<MidnightWalletProvider>

A promise that resolves to the started wallet

Throws

If no wallet could be started

Inherited from

RemoteTestEnvironment.getMidnightWalletProvider


healthCheck()

healthCheck(): Promise<void>

Performs a health check for the environment. Checks the health of the node, indexer, and optionally the faucet services.

Returns

Promise<void>

A promise that resolves when the health check is complete.

Inherited from

RemoteTestEnvironment.healthCheck


shutdown()

shutdown(saveWalletState?): Promise<void>

Shuts down the test environment by closing all walletProviders and stopping the proof server.

Parameters

saveWalletState?

boolean

Returns

Promise<void>

Inherited from

RemoteTestEnvironment.shutdown


start()

start(maybeProofServerContainer?): Promise<EnvironmentConfiguration>

Starts the test environment by initializing the proof server and environment configuration.

Parameters

maybeProofServerContainer?

ProofServerContainer

Optional proof server container to use instead of creating a new one

Returns

Promise<EnvironmentConfiguration>

The environment configuration

Inherited from

RemoteTestEnvironment.start


startMidnightWalletProviders()

startMidnightWalletProviders(amount, seeds): Promise<MidnightWalletProvider[]>

Creates and starts the specified number of wallet providers.

Parameters

amount

number = 1

seeds

undefined | string[]

Returns

Promise<MidnightWalletProvider[]>

Array of started wallet providers

Inherited from

RemoteTestEnvironment.startMidnightWalletProviders