lisk-framework
Version:
Lisk blockchain application platform
22 lines • 806 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseEvent = void 0;
const lisk_codec_1 = require("@liskhq/lisk-codec");
class BaseEvent {
get key() {
return Buffer.from(this._moduleName + this.name, 'utf-8');
}
get name() {
const name = this.constructor.name.replace('Event', '');
return name.charAt(0).toLowerCase() + name.substr(1);
}
constructor(moduleName) {
this.schema = lisk_codec_1.emptySchema;
this._moduleName = moduleName;
}
add(ctx, data, topics, noRevert) {
ctx.eventQueue.add(this._moduleName, this.name, this.schema ? lisk_codec_1.codec.encode(this.schema, data) : Buffer.alloc(0), topics, noRevert);
}
}
exports.BaseEvent = BaseEvent;
//# sourceMappingURL=base_event.js.map
;