@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
22 lines • 723 B
JavaScript
import { GENESIS_SLOT } from "@lodestar/params";
import { Bucket } from "../buckets.js";
export class PreGenesisState {
constructor(config, db) {
this.config = config;
this.db = db;
this.bucket = Bucket.phase0_preGenesisState;
this.key = new Uint8Array([this.bucket]);
this.type = this.config.getForkTypes(GENESIS_SLOT).BeaconState;
}
async put(value) {
await this.db.put(this.key, value.serialize());
}
async get() {
const value = await this.db.get(this.key);
return value ? this.type.deserializeToViewDU(value) : null;
}
async delete() {
await this.db.delete(this.key);
}
}
//# sourceMappingURL=preGenesisState.js.map