EnvVarRemoteTestEnvironment
Midnight.js API Reference v2.0.2
Midnight.js API Reference / @midnight-ntwrk/midnight-js-testing / EnvVarRemoteTestEnvironment
Class: EnvVarRemoteTestEnvironment
Test environment that configures services using environment variables. Allows specifying custom endpoints through environment variables.
Extendsβ
Constructorsβ
Constructorβ
new EnvVarRemoteTestEnvironment(
logger):EnvVarRemoteTestEnvironment
Creates a new TestEnvironment instance.
Parametersβ
loggerβ
Logger
Logger instance for recording operations
Returnsβ
EnvVarRemoteTestEnvironment
Inherited fromβ
RemoteTestEnvironment.constructor
Methodsβ
getEnvironmentConfiguration()β
getEnvironmentConfiguration():
EnvironmentConfiguration
Returns the configuration for environment services based on environment variables. Required environment variables:
- MN_TEST_INDEXER: GraphQL API endpoint for the indexer
- MN_TEST_INDEXER_WS: WebSocket endpoint for the indexer
- MN_TEST_NODE: RPC endpoint for the blockchain node Optional environment variables:
- MN_TEST_FAUCET: API endpoint for requesting test tokens
Returnsβ
Object containing service URLs from environment variables
Throwsβ
If any required environment variable is not set
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?β
Optional proof server container to use instead of creating a new one
Returnsβ
Promise<EnvironmentConfiguration>
The environment configuration
Inherited fromβ
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