-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4db4225
commit 8e22535
Showing
4 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,47 @@ | ||
import { Request, Response } from 'express'; | ||
import { Request, Response } from "express"; | ||
import { connect, resetClient } from "../client"; | ||
import { checkForWarning, format } from "../utils"; | ||
import { FeeResponse, ServerInfoResponse } from "xrpl"; | ||
|
||
export default async function(req: Request, res: Response) {} | ||
export default async function (req: Request, res: Response) { | ||
let client = await connect(); | ||
try { | ||
const serverInfo: ServerInfoResponse = await client.request({ | ||
command: "server_info", | ||
}); | ||
checkForWarning(serverInfo.result); | ||
|
||
const feeInfo: FeeResponse = await client.request({ | ||
command: "fee", | ||
}); | ||
checkForWarning(feeInfo.result); | ||
|
||
const processUptime = process.uptime(); | ||
|
||
const text = `*XRP Test Net Faucet:* https://xrpl.org/xrp-testnet-faucet.html | ||
*Uptime:* ${format(processUptime)} | ||
*rippled* buildVersion: ${serverInfo.result.info.build_version} | ||
> completeLedgers: ${serverInfo.result.info.complete_ledgers} | ||
> loadFactor: ${serverInfo.result.info.load_factor} | ||
> peers: ${serverInfo.result.info.peers} | ||
> serverState: ${serverInfo.result.info.server_state} | ||
> validatedLedger.ledgerVersion: ${ | ||
serverInfo.result.info.validated_ledger.seq | ||
} | ||
> hostID: ${serverInfo.result.info.hostid} | ||
> open_ledger_fee: ${feeInfo.result.drops.open_ledger_fee} drops | ||
> expected_ledger_size: ${feeInfo.result.expected_ledger_size} | ||
Full info: https://faucet.altnet.rippletest.net/info`; | ||
|
||
res.send({ | ||
response_type: "in_channel", | ||
text: text, | ||
}); | ||
} catch (error) { | ||
console.log("/status error:", error); | ||
res.status(500).send({ | ||
error: "Server load is too high. Request status later", | ||
}); | ||
await resetClient("status"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters