"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("..");
const csp_1 = require("./api/csp");
const event_adapter_1 = require("./api/event-adapter");
const xrp_routes_1 = require("./api/xrp-routes");
const p2p_1 = require("./p2p");
const verification_1 = require("./p2p/verification");
class XRPModule extends __1.BaseModule {
    constructor(services, chain, network, _config) {
        super(services);
        services.CSP.registerService(chain, network, new csp_1.RippleStateProvider());
        services.Api.app.use(xrp_routes_1.XrpRoutes);
        services.P2P.register(chain, network, p2p_1.XrpP2pWorker);
        services.Verification.register(chain, network, verification_1.XrpVerificationPeer);
        if (!XRPModule.startMonitor) {
            const adapter = new event_adapter_1.RippleEventAdapter(services, network);
            XRPModule.startMonitor = services.Event.events.on('start', async () => {
                await adapter.start();
            });
            XRPModule.endMonitor = services.Event.events.on('stop', async () => {
                await adapter.stop();
            });
        }
    }
}
exports.default = XRPModule;
//# sourceMappingURL=index.js.map