The blockchainNetworkStatus
module is responsible for checking the health status of different Soroban blockchain networks. It provides an API endpoint to retrieve the status of the FutureNet, TestNet, and MainNet networks.
The BlockchainNetworkStatusController
handles incoming HTTP requests and returns the network status. It uses the BlockchainNetworkStatusService
to get the status of the networks.
- Endpoint:
GET /blockchain_network_status/soroban_network
- Response:
{ "futureNetwork": boolean, "testNetwork": boolean, "mainNetwork": boolean }
The BlockchainNetworkStatusService
contains the business logic to check the health status of the Soroban networks. It makes HTTP requests to the respective network endpoints and processes the responses.
- Method:
getNetworkStatus()
- Checks the status of FutureNet, TestNet, and MainNet.
- Returns a response indicating the health status of each network.
The BlockchainNetworkStatusModule
imports necessary dependencies and provides the controller and service.
- HttpModule: Used for making HTTP requests to the Soroban network endpoints.
- CommonModule: Provides common functionalities and services used across the application.
To use this module, ensure it is imported in your main application module. The controller will be available to handle requests to the /blockchain_network_status/soroban_network
endpoint.
Here is an example of how to call the endpoint and interpret the response:
curl -X GET http://your-api-url/blockchain_network_status/soroban_network
Response:
{
"futureNetwork": true,
"testNetwork": false,
"mainNetwork": true
}
In this example, the FutureNet and MainNet are healthy, while the TestNet is not.
The service includes error handling to ensure that if a network check fails, it returns false
for that network's status. This ensures that the API can still provide a response even if one or more network checks fail.
The blockchainNetworkStatus
module is a crucial part of the application, providing real-time health status of the Soroban blockchain networks. It is designed to be robust and handle errors gracefully, ensuring reliable information is always available.