Merge pull request #125 from moonstream-to/fix-moonstream-provider

Fix moonstream provider
main v0.9.2
Andrey Dolgolev 2024-06-24 16:07:46 +03:00 zatwierdzone przez GitHub
commit e84092518d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
3 zmienionych plików z 7 dodań i 10 usunięć

Wyświetl plik

@ -198,10 +198,7 @@ class FunctionCallCrawler:
method_id = transaction.get("input")[:10] method_id = transaction.get("input")[:10]
if method_id in self.whitelisted_methods: if method_id in self.whitelisted_methods:
self.process_transaction(transaction) self.process_transaction(transaction)
else:
print(
f"Function not in ABI, MethodID: {method_id} tx: {transaction['hash'].hex()}. Ignored."
)
self.state.state self.state.state
if flush_state: if flush_state:
self.state.flush() self.state.flush()

Wyświetl plik

@ -69,11 +69,9 @@ class MoonstreamEthereumStateProvider(EthereumStateProvider):
return last_block.block_number return last_block.block_number
@staticmethod @staticmethod
def _transform_to_w3_tx( def _transform_to_w3_tx(tx_raw: tx_raw_types, raw_block) -> Dict[str, Any]:
tx_raw: tx_raw_types,
) -> Dict[str, Any]:
tx = { tx = {
"blockHash": tx_raw.block_hash, "blockHash": raw_block.hash,
"blockNumber": tx_raw.block_number, "blockNumber": tx_raw.block_number,
"from": tx_raw.from_address, "from": tx_raw.from_address,
"gas": tx_raw.gas, "gas": tx_raw.gas,
@ -134,7 +132,9 @@ class MoonstreamEthereumStateProvider(EthereumStateProvider):
for block, txs in block_transactions.items(): for block, txs in block_transactions.items():
self.blocks_cache[block] = { self.blocks_cache[block] = {
"timestamp": blocks[block].timestamp, "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] return self.blocks_cache[block_number]

Wyświetl plik

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