UNPKG

@lodestar/beacon-node

Version:

A Typescript implementation of the beacon chain

28 lines 989 B
import { BUCKET_LENGTH, Repository, encodeKey as encodeDbKey } from "@lodestar/db"; import { ssz } from "@lodestar/types"; import { bytesToInt } from "@lodestar/utils"; import { Bucket, getBucketNameByValue } from "../buckets.js"; /** * Used to store finalized `SignedExecutionPayloadEnvelope` * * Indexed by slot for chronological archival */ export class ExecutionPayloadEnvelopeArchiveRepository extends Repository { constructor(config, db) { const bucket = Bucket.gloas_executionPayloadEnvelopeArchive; super(config, db, bucket, ssz.gloas.SignedExecutionPayloadEnvelope, getBucketNameByValue(bucket)); } /** * Id is the slot from the envelope */ getId(value) { return value.message.payload.slotNumber; } encodeKey(id) { return encodeDbKey(this.bucket, id); } decodeKey(data) { return bytesToInt(data.subarray(BUCKET_LENGTH), "be"); } } //# sourceMappingURL=executionPayloadEnvelopeArchive.js.map