From 820ddd6fed869ff834c8ccc43d4aab20b673849d Mon Sep 17 00:00:00 2001 From: rianhughes Date: Thu, 12 Oct 2023 16:24:16 +0300 Subject: [PATCH] rpcv05 Update Block header and pending block header --- rpc/types_block.go | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/rpc/types_block.go b/rpc/types_block.go index 143ee34a..3e30a92c 100644 --- a/rpc/types_block.go +++ b/rpc/types_block.go @@ -89,14 +89,8 @@ type Block struct { } type PendingBlock struct { - // ParentHash The hash of this block's parent - ParentHash *felt.Felt `json:"parent_hash"` - // Timestamp the time in which the block was created, encoded in Unix time - Timestamp uint64 `json:"timestamp"` - // SequencerAddress the StarkNet identity of the sequencer submitting this block - SequencerAddress *felt.Felt `json:"sequencer_address"` - // Transactions The transactions in this block - Transactions BlockTransactions `json:"transactions"` + PendingBlockHeader PendingBlockHeader + BlockTransactions BlockTransactions } type BlockTxHashes struct { @@ -107,14 +101,8 @@ type BlockTxHashes struct { } type PendingBlockTxHashes struct { - // ParentHash The hash of this block's parent - ParentHash *felt.Felt `json:"parent_hash"` - // Timestamp the time in which the block was created, encoded in Unix time - Timestamp uint64 `json:"timestamp"` - // SequencerAddress the StarkNet identity of the sequencer submitting this block - SequencerAddress *felt.Felt `json:"sequencer_address"` - // Transactions The hashes of the transactions included in this block - Transactions []*felt.Felt `json:"transactions"` + PendingBlockHeader PendingBlockHeader + BlockTxHashes BlockTxHashes } type BlockHeader struct { @@ -130,4 +118,28 @@ type BlockHeader struct { Timestamp uint64 `json:"timestamp"` // SequencerAddress the StarkNet identity of the sequencer submitting this block SequencerAddress *felt.Felt `json:"sequencer_address"` + // The price of l1 gas in the block + L1GasPrice ResourcePrice `json:"l1_gas_price"` + // Semver of the current Starknet protocol + StarknetVersion string `json:"starknet_version"` +} + +type PendingBlockHeader struct { + // ParentHash The hash of this block's parent + ParentHash *felt.Felt `json:"parent_hash"` + // Timestamp the time in which the block was created, encoded in Unix time + Timestamp uint64 `json:"timestamp"` + // SequencerAddress the StarkNet identity of the sequencer submitting this block + SequencerAddress *felt.Felt `json:"sequencer_address"` + // The price of l1 gas in the block + L1GasPrice ResourcePrice `json:"l1_gas_price"` + // Semver of the current Starknet protocol + StarknetVersion string `json:"starknet_version"` +} + +type ResourcePrice struct { + // The price of one unit of the given resource, denominated in strk + PriceInStrk NumAsHex `json:"price_in_strk,omitempty"` + // The price of one unit of the given resource, denominated in wei + PriceInWei string `json:"price_in_wei"` }