UNPKG

lisk-framework

Version:

Lisk blockchain application platform

35 lines 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MethodContext = exports.createImmutableMethodContext = exports.createNewMethodContext = exports.createMethodContext = void 0; const event_queue_1 = require("./event_queue"); const prefixed_state_read_writer_1 = require("./prefixed_state_read_writer"); const createMethodContext = (params) => new MethodContext(params); exports.createMethodContext = createMethodContext; const createNewMethodContext = (db) => new MethodContext({ stateStore: new prefixed_state_read_writer_1.PrefixedStateReadWriter(db), eventQueue: new event_queue_1.EventQueue(0), contextStore: new Map(), }); exports.createNewMethodContext = createNewMethodContext; const createImmutableMethodContext = (immutableSubstoreGetter) => ({ getStore: (moduleID, storePrefix) => immutableSubstoreGetter.getStore(moduleID, storePrefix), }); exports.createImmutableMethodContext = createImmutableMethodContext; class MethodContext { constructor(params) { this._eventQueue = params.eventQueue; this._stateStore = params.stateStore; this._contextStore = params.contextStore; } getStore(moduleID, storePrefix) { return this._stateStore.getStore(moduleID, storePrefix); } get contextStore() { return this._contextStore; } get eventQueue() { return this._eventQueue; } } exports.MethodContext = MethodContext; //# sourceMappingURL=method_context.js.map