Add fix for moonworm provider.

pull/125/head
Andrey 2024-06-18 13:33:20 +03:00
rodzic 0a0054e529
commit f4a11c2d6e
2 zmienionych plików z 8 dodań i 6 usunięć

Wyświetl plik

@ -69,11 +69,9 @@ class MoonstreamEthereumStateProvider(EthereumStateProvider):
return last_block.block_number
@staticmethod
def _transform_to_w3_tx(
tx_raw: tx_raw_types,
) -> Dict[str, Any]:
def _transform_to_w3_tx(tx_raw: tx_raw_types, raw_block) -> Dict[str, Any]:
tx = {
"blockHash": tx_raw.block_hash,
"blockHash": raw_block.hash,
"blockNumber": tx_raw.block_number,
"from": tx_raw.from_address,
"gas": tx_raw.gas,
@ -121,8 +119,10 @@ class MoonstreamEthereumStateProvider(EthereumStateProvider):
block_transactions = {}
for raw_tx in raw_block_transactions:
if block_transactions.get(raw_tx.block_number) is None:
block_transactions[raw_tx.block_number] = []
block_transactions[raw_tx.block_number].append(raw_tx)
if block_transactions.get(block_number) is None:
@ -134,7 +134,9 @@ class MoonstreamEthereumStateProvider(EthereumStateProvider):
for block, txs in block_transactions.items():
self.blocks_cache[block] = {
"timestamp": blocks[block].timestamp,
"transactions": [self._transform_to_w3_tx(tx) for tx in txs],
"transactions": [
self._transform_to_w3_tx(tx, blocks[block]) for tx in txs
],
}
return self.blocks_cache[block_number]

Wyświetl plik

@ -1 +1 @@
MOONWORM_VERSION = "0.9.1"
MOONWORM_VERSION = "0.9.2"