diff --git a/src.ts/providers/format.ts b/src.ts/providers/format.ts index 36ef9828c..c401f66e0 100644 --- a/src.ts/providers/format.ts +++ b/src.ts/providers/format.ts @@ -129,9 +129,12 @@ const _formatBlock = object({ excessBlobGas: allowNull(getBigInt, null), miner: allowNull(getAddress), + prevRandao: allowNull(formatHash, null), extraData: formatData, baseFeePerGas: allowNull(getBigInt) +}, { + prevRandao: [ "mixHash" ] }); export function formatBlock(value: any): BlockParams { diff --git a/src.ts/providers/formatting.ts b/src.ts/providers/formatting.ts index d345ff944..ecae5937a 100644 --- a/src.ts/providers/formatting.ts +++ b/src.ts/providers/formatting.ts @@ -83,6 +83,12 @@ export interface BlockParams { */ miner: string; + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + prevRandao?: null | string; + /** * Additional data the miner choose to include. */ diff --git a/src.ts/providers/provider.ts b/src.ts/providers/provider.ts index 8256505e2..10efd906f 100644 --- a/src.ts/providers/provider.ts +++ b/src.ts/providers/provider.ts @@ -542,6 +542,12 @@ export class Block implements BlockParams, Iterable { */ readonly miner!: string; + /** + * The latest RANDAO mix of the post beacon state of + * the previous block. + */ + readonly prevRandao!: null | string; + /** * Any extra data the validator wished to include. */ @@ -592,6 +598,7 @@ export class Block implements BlockParams, Iterable { blobGasUsed: block.blobGasUsed, excessBlobGas: block.excessBlobGas, miner: block.miner, + prevRandao: getValue(block.prevRandao), extraData: block.extraData, baseFeePerGas: getValue(block.baseFeePerGas), @@ -640,7 +647,7 @@ export class Block implements BlockParams, Iterable { toJSON(): any { const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, - miner, nonce, number, parentHash, parentBeaconBlockRoot, + miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this; @@ -653,7 +660,7 @@ export class Block implements BlockParams, Iterable { gasUsed: toJson(gasUsed), blobGasUsed: toJson(this.blobGasUsed), excessBlobGas: toJson(this.excessBlobGas), - hash, miner, nonce, number, parentHash, timestamp, + hash, miner, prevRandao, nonce, number, parentHash, timestamp, parentBeaconBlockRoot, stateRoot, receiptsRoot, transactions, };