lisk-framework
Version:
Lisk blockchain application platform
51 lines • 2.43 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidatorsModule = void 0;
const base_module_1 = require("../base_module");
const method_1 = require("./method");
const endpoint_1 = require("./endpoint");
const schemas_1 = require("./schemas");
const validator_keys_1 = require("./stores/validator_keys");
const bls_keys_1 = require("./stores/bls_keys");
const generator_key_registration_1 = require("./events/generator_key_registration");
const bls_key_registration_1 = require("./events/bls_key_registration");
const validators_params_1 = require("./stores/validators_params");
class ValidatorsModule extends base_module_1.BaseModule {
constructor() {
super();
this.method = new method_1.ValidatorsMethod(this.stores, this.events);
this.endpoint = new endpoint_1.ValidatorsEndpoint(this.stores, this.offchainStores);
this.stores.register(validator_keys_1.ValidatorKeysStore, new validator_keys_1.ValidatorKeysStore(this.name, 0));
this.stores.register(validators_params_1.ValidatorsParamsStore, new validators_params_1.ValidatorsParamsStore(this.name, 1));
this.stores.register(bls_keys_1.BLSKeyStore, new bls_keys_1.BLSKeyStore(this.name, 2));
this.events.register(generator_key_registration_1.GeneratorKeyRegistrationEvent, new generator_key_registration_1.GeneratorKeyRegistrationEvent(this.name));
this.events.register(bls_key_registration_1.BlsKeyRegistrationEvent, new bls_key_registration_1.BlsKeyRegistrationEvent(this.name));
}
metadata() {
return {
...this.baseMetadata(),
endpoints: [
{
name: this.endpoint.validateBLSKey.name,
request: schemas_1.validateBLSKeyRequestSchema,
response: schemas_1.validateBLSKeyResponseSchema,
},
{
name: this.endpoint.getValidator.name,
request: schemas_1.getValidatorRequestSchema,
response: schemas_1.getValidatorResponseSchema,
},
],
};
}
async init(args) {
this._blockTime = args.genesisConfig.blockTime;
this.method.init({
config: {
blockTime: this._blockTime,
},
});
}
}
exports.ValidatorsModule = ValidatorsModule;
//# sourceMappingURL=module.js.map