"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.XrpRoutes = void 0;
const express_1 = require("express");
const logger_1 = __importDefault(require("../../../logger"));
const csp_1 = require("./csp");
exports.XrpRoutes = (0, express_1.Router)();
exports.XrpRoutes.get('/api/XRP/:network/address/:address/txs/count', async (req, res) => {
    const { network, address } = req.params;
    try {
        const nonce = await csp_1.XRP.getAccountNonce(network, address);
        res.json({ nonce });
    }
    catch (err) {
        logger_1.default.error('Error getting XRP account nonce: %o', err.stack || err.message || err);
        res.status(500).send(err.message || err);
    }
});
exports.XrpRoutes.get('/api/XRP/:network/address/:address/flags', async (req, res) => {
    const { address, network } = req.params;
    try {
        const flags = await csp_1.XRP.getAccountFlags(network, address);
        res.json({ flags });
    }
    catch (err) {
        logger_1.default.error('Error getting XRP account flags: %o', err.stack || err.message || err);
        res.status(500).send(err.message || err);
    }
});
exports.XrpRoutes.get('/api/XRP/:network/reserve', async (req, res) => {
    const { network } = req.params;
    try {
        const reserve = await csp_1.XRP.getReserve(network);
        res.json({ reserve });
    }
    catch (err) {
        logger_1.default.error('Error getting XRP reserve: %o', err.stack || err.message || err);
        res.status(500).send(err.message || err);
    }
});
//# sourceMappingURL=xrp-routes.js.map