diff --git a/packages/web3-eth/src/schemas.ts b/packages/web3-eth/src/schemas.ts index 89e23459fac..244e1260b53 100644 --- a/packages/web3-eth/src/schemas.ts +++ b/packages/web3-eth/src/schemas.ts @@ -236,46 +236,55 @@ export const transactionInfoSchema = { }, }; -export const blockSchema = { +export const withdrawalsSchema = { type: 'object', properties: { - parentHash: { - format: 'bytes32', - }, - sha3Uncles: { - format: 'bytes32', + index: { + format: 'uint', }, - miner: { - format: 'bytes', + validatorIndex: { + format: 'uint', }, - stateRoot: { - format: 'bytes32', + address: { + format: 'address', }, - transactionsRoot: { - format: 'bytes32', + amount: { + format: 'uint', }, - receiptsRoot: { - format: 'bytes32', + }, +}; + +export const blockSchema = { + type: 'object', + properties: { + baseFeePerGas: { + format: 'uint', }, - logsBloom: { - format: 'bytes256', + blobGasUsed: { + format: 'uint', }, difficulty: { format: 'uint', }, - number: { + excessBlobGas: { format: 'uint', }, + extraData: { + format: 'bytes', + }, gasLimit: { format: 'uint', }, gasUsed: { format: 'uint', }, - timestamp: { - format: 'uint', + hash: { + format: 'bytes32', }, - extraData: { + logsBloom: { + format: 'bytes256', + }, + miner: { format: 'bytes', }, mixHash: { @@ -284,15 +293,33 @@ export const blockSchema = { nonce: { format: 'uint', }, - totalDifficulty: { + number: { format: 'uint', }, - baseFeePerGas: { - format: 'uint', + parentBeaconBlockRoot: { + format: 'bytes32', + }, + parentHash: { + format: 'bytes32', + }, + receiptsRoot: { + format: 'bytes32', + }, + sha3Uncles: { + format: 'bytes32', }, size: { format: 'uint', }, + stateRoot: { + format: 'bytes32', + }, + timestamp: { + format: 'uint', + }, + totalDifficulty: { + format: 'uint', + }, transactions: { oneOf: [ { @@ -309,89 +336,83 @@ export const blockSchema = { }, ], }, + transactionsRoot: { + format: 'bytes32', + }, uncles: { type: 'array', items: { format: 'bytes32', }, }, - hash: { + withdrawals: { + type: 'array', + items: { + ...withdrawalsSchema, + }, + }, + withdrawalsRoot: { format: 'bytes32', }, }, }; -export const withdrawalsSchema = { +export const blockHeaderSchema = { type: 'object', properties: { - index: { - format: 'uint', + author: { + format: 'bytes32', }, - validatorIndex: { + excessDataGas: { format: 'uint', }, - address: { - format: 'address', - }, - amount: { + baseFeePerGas: { format: 'uint', }, - }, -}; - -export const blockHeaderSchema = { - type: 'object', - properties: { - author: { - format: 'bytes32', - }, - hash: { - format: 'bytes32', + blobGasUsed: { + format: 'uint', }, - parentHash: { - format: 'bytes32', + difficulty: { + format: 'uint', }, - receiptsRoot: { - format: 'bytes32', + excessBlobGas: { + format: 'uint', }, - miner: { + extraData: { format: 'bytes', }, - stateRoot: { - format: 'bytes32', + gasLimit: { + format: 'uint', }, - transactionsRoot: { - format: 'bytes32', + gasUsed: { + format: 'uint', }, - withdrawalsRoot: { + hash: { format: 'bytes32', }, logsBloom: { format: 'bytes256', }, - difficulty: { - format: 'uint', - }, - totalDifficulty: { - format: 'uint', + miner: { + format: 'bytes', }, - number: { - format: 'uint', + mixHash: { + format: 'bytes32', }, - gasLimit: { + nonce: { format: 'uint', }, - gasUsed: { + number: { format: 'uint', }, - timestamp: { - format: 'uint', + parentBeaconBlockRoot: { + format: 'bytes32', }, - extraData: { - format: 'bytes', + parentHash: { + format: 'bytes32', }, - nonce: { - format: 'uint', + receiptsRoot: { + format: 'bytes32', }, sha3Uncles: { format: 'bytes32', @@ -399,14 +420,14 @@ export const blockHeaderSchema = { size: { format: 'uint', }, - baseFeePerGas: { - format: 'uint', + stateRoot: { + format: 'bytes32', }, - excessDataGas: { + timestamp: { format: 'uint', }, - mixHash: { - format: 'bytes32', + totalDifficulty: { + format: 'uint', }, transactions: { type: 'array', @@ -414,18 +435,24 @@ export const blockHeaderSchema = { format: 'bytes32', }, }, + transactionsRoot: { + format: 'bytes32', + }, uncles: { type: 'array', items: { format: 'bytes32', }, }, - withdrawals: { + withdrawals: { type: 'array', items: { ...withdrawalsSchema, }, }, + withdrawalsRoot: { + format: 'bytes32', + }, }, }; diff --git a/packages/web3-types/src/eth_types.ts b/packages/web3-types/src/eth_types.ts index cae32515332..5c628994c8d 100644 --- a/packages/web3-types/src/eth_types.ts +++ b/packages/web3-types/src/eth_types.ts @@ -130,9 +130,16 @@ export interface BlockInput { readonly baseFeePerGas?: HexString; } +export interface Withdrawals { + readonly index: Numbers; + readonly validatorIndex: Numbers; + readonly address: Address; + readonly amount: Numbers; +} + export interface BlockOutput { - readonly gasLimit: bigint | number; - readonly gasUsed: bigint | number; + readonly gasLimit: bigint | number; + readonly gasUsed: bigint | number; readonly size: bigint | number; readonly timestamp: bigint | number; readonly number?: bigint | number; @@ -142,44 +149,57 @@ export interface BlockOutput { readonly miner?: HexString; readonly baseFeePerGas?: bigint | number; readonly parentHash?: HexString32Bytes; -} -export interface Withdrawals { - readonly index: Numbers; - readonly validatorIndex: Numbers; - readonly address: Address; - readonly amount: Numbers; + // Added properties + readonly blobGasUsed?: bigint | number; + readonly excessBlobGas?: bigint | number; + readonly extraData?: Bytes; + readonly hash?: HexString32Bytes; + readonly logsBloom?: Bytes; + readonly nonce?: bigint | number; + readonly parentBeaconBlockRoot?: HexString32Bytes; + readonly receiptsRoot?: HexString32Bytes; + readonly sha3Uncles: HexString32Bytes[]; + readonly stateRoot?: HexString32Bytes; + readonly transactionsRoot?: HexString32Bytes; + readonly withdrawalsRoot?: HexString32Bytes; + readonly mixHash?: HexString32Bytes; + readonly uncles?: Uncles; + readonly withdrawals?: Withdrawals[]; } export interface BlockHeaderOutput { - readonly hash?: HexString32Bytes; - readonly parentHash?: HexString32Bytes; - readonly receiptsRoot?: HexString32Bytes; - readonly miner?: HexString; - readonly stateRoot?: HexString32Bytes; - readonly transactionsRoot?: HexString32Bytes; - readonly withdrawalsRoot?: HexString32Bytes; - readonly logsBloom?: Bytes; - readonly difficulty?: Numbers; - readonly number?: Numbers; - readonly gasLimit: Numbers; - readonly gasUsed: Numbers; - readonly timestamp: Numbers; - readonly extraData?: Bytes; - readonly nonce?: Numbers; - readonly sha3Uncles: HexString32Bytes[]; - readonly baseFeePerGas?: Numbers; - - // These fields are returned when the RPC client is Nethermind, - // but aren't available in other clients such as Geth - readonly author?: Address; - readonly totalDifficulty?: Numbers; - readonly size?: Numbers; - readonly excessDataGas?: Numbers; - readonly mixHash?: HexString32Bytes; - readonly transactions?: TransactionOutput[]; - readonly uncles?: Uncles; - readonly withdrawals?: Withdrawals[]; + readonly baseFeePerGas?: Numbers; + readonly blobGasUsed?: Numbers; + readonly difficulty?: Numbers; + readonly excessBlobGas?: Numbers; + readonly extraData?: Bytes; + readonly gasLimit: Numbers; + readonly gasUsed: Numbers; + readonly hash?: HexString32Bytes; + readonly logsBloom?: Bytes; + readonly miner?: HexString; + readonly nonce?: Numbers; + readonly number?: Numbers; + readonly parentBeaconBlockRoot?: HexString32Bytes; + readonly parentHash?: HexString32Bytes; + readonly receiptsRoot?: HexString32Bytes; + readonly sha3Uncles: HexString32Bytes[]; + readonly stateRoot?: HexString32Bytes; + readonly timestamp: Numbers; + readonly transactionsRoot?: HexString32Bytes; + readonly withdrawalsRoot?: HexString32Bytes; + + // These fields are returned when the RPC client is Nethermind, + // but aren't available in other clients such as Geth + readonly author?: Address; + readonly totalDifficulty?: Numbers; + readonly size?: Numbers; + readonly excessDataGas?: Numbers; + readonly mixHash?: HexString32Bytes; + readonly transactions?: TransactionOutput[]; + readonly uncles?: Uncles; + readonly withdrawals?: Withdrawals[]; } export interface ReceiptInput { diff --git a/yarn.lock b/yarn.lock index bc653ed8db7..b0c3fe19f17 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12855,4 +12855,4 @@ yocto-queue@^0.1.0: zod@^3.21.4: version "3.22.3" resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.3.tgz#2fbc96118b174290d94e8896371c95629e87a060" - integrity sha512-EjIevzuJRiRPbVH4mGc8nApb/lVLKVpmUhAaR5R5doKGfAnGJ6Gr3CViAVjP+4FWSxCsybeWQdcgCtbX+7oZug== + integrity sha512-EjIevzuJRiRPbVH4mGc8nApb/lVLKVpmUhAaR5R5doKGfAnGJ6Gr3CViAVjP+4FWSxCsybeWQdcgCtbX+7oZug== \ No newline at end of file