Merge pull request #1138 from moonstream-to/add-raw-transactions

Add raw transactions
pull/1176/head
Andrey Dolgolev 2025-03-04 16:28:50 +02:00 zatwierdzone przez GitHub
commit 49bf3b7f29
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
4 zmienionych plików z 1402 dodań i 1 usunięć

Wyświetl plik

@ -27,72 +27,128 @@ target_metadata = MoonstreamBase.metadata
from moonstreamdbv3.models import (
MOONSTREAM_DB_V3_SCHEMA_NAME,
AmoyLabel,
AmoyTransaction,
ArbitrumNovaLabel,
ArbitrumNovaTransaction,
ArbitrumOneLabel,
ArbitrumOneTransaction,
ArbitrumSepoliaLabel,
ArbitrumSepoliaTransaction,
AvalancheFujiLabel,
AvalancheFujiTransaction,
AvalancheLabel,
AvalancheTransaction,
B3Label,
B3Transaction,
B3SepoliaLabel,
B3SepoliaTransaction,
BaseLabel,
BaseTransaction,
BlastLabel,
BlastTransaction,
BlastSepoliaLabel,
BlastSepoliaTransaction,
EthereumLabel,
EthereumTransaction,
Game7Label,
Game7Transaction,
Game7OrbitArbitrumSepoliaLabel,
Game7OrbitArbitrumSepoliaTransaction,
Game7TestnetLabel,
Game7TestnetTransaction,
ImxZkevmLabel,
ImxZkevmTransaction,
ImxZkevmSepoliaLabel,
ImxZkevmSepoliaTransaction,
MantleLabel,
MantleTransaction,
MantleSepoliaLabel,
MantleSepoliaTransaction,
MumbaiLabel,
MumbaiTransaction,
PolygonLabel,
PolygonTransaction,
ProofOfPlayApexLabel,
ProofOfPlayApexTransaction,
RoninLabel,
RoninSaigonLabel,
SepoliaLabel,
SepoliaTransaction,
StarknetLabel,
StarknetSepoliaLabel,
XaiLabel,
XaiTransaction,
XaiSepoliaLabel,
XaiSepoliaTransaction,
XDaiLabel,
XDaiTransaction,
ZkSyncEraLabel,
ZkSyncEraTransaction,
ZkSyncEraSepoliaLabel,
ZkSyncEraSepoliaTransaction,
)
def include_symbol(tablename, schema):
return tablename in {
EthereumLabel.__tablename__,
EthereumTransaction.__tablename__,
SepoliaLabel.__tablename__,
SepoliaTransaction.__tablename__,
PolygonLabel.__tablename__,
PolygonTransaction.__tablename__,
MumbaiLabel.__tablename__,
MumbaiTransaction.__tablename__,
AmoyLabel.__tablename__,
AmoyTransaction.__tablename__,
XDaiLabel.__tablename__,
XDaiTransaction.__tablename__,
ZkSyncEraLabel.__tablename__,
ZkSyncEraTransaction.__tablename__,
ZkSyncEraSepoliaLabel.__tablename__,
ZkSyncEraSepoliaTransaction.__tablename__,
BaseLabel.__tablename__,
BaseTransaction.__tablename__,
ArbitrumNovaLabel.__tablename__,
ArbitrumNovaTransaction.__tablename__,
ArbitrumOneLabel.__tablename__,
ArbitrumOneTransaction.__tablename__,
ArbitrumSepoliaLabel.__tablename__,
ArbitrumSepoliaTransaction.__tablename__,
Game7Label.__tablename__,
Game7Transaction.__tablename__,
Game7OrbitArbitrumSepoliaLabel.__tablename__,
Game7OrbitArbitrumSepoliaTransaction.__tablename__,
Game7TestnetLabel.__tablename__,
Game7TestnetTransaction.__tablename__,
XaiLabel.__tablename__,
XaiTransaction.__tablename__,
XaiSepoliaLabel.__tablename__,
XaiSepoliaTransaction.__tablename__,
AvalancheLabel.__tablename__,
AvalancheTransaction.__tablename__,
AvalancheFujiLabel.__tablename__,
AvalancheFujiTransaction.__tablename__,
BlastLabel.__tablename__,
BlastTransaction.__tablename__,
BlastSepoliaLabel.__tablename__,
BlastSepoliaTransaction.__tablename__,
ProofOfPlayApexLabel.__tablename__,
ProofOfPlayApexTransaction.__tablename__,
StarknetLabel.__tablename__,
StarknetSepoliaLabel.__tablename__,
MantleLabel.__tablename__,
MantleTransaction.__tablename__,
MantleSepoliaLabel.__tablename__,
MantleSepoliaTransaction.__tablename__,
ImxZkevmLabel.__tablename__,
ImxZkevmTransaction.__tablename__,
ImxZkevmSepoliaLabel.__tablename__,
ImxZkevmSepoliaTransaction.__tablename__,
B3Label.__tablename__,
B3Transaction.__tablename__,
B3SepoliaLabel.__tablename__,
B3SepoliaTransaction.__tablename__,
RoninLabel.__tablename__,
RoninSaigonLabel.__tablename__,
}

Wyświetl plik

@ -27,6 +27,7 @@ from sqlalchemy import (
Integer,
LargeBinary,
MetaData,
Numeric,
Text,
)
from sqlalchemy.dialects.postgresql import JSONB, UUID
@ -160,6 +161,38 @@ class EvmBasedLabel(Base): # type: ignore
)
class EvmBasedTransaction(Base): # type: ignore
__abstract__ = True
hash = Column(
VARCHAR(256), primary_key=True, unique=True, nullable=False, index=True
)
block_number = Column(
BigInteger,
nullable=False,
index=True,
)
block_timestamp = Column(BigInteger, nullable=False, index=True)
block_hash = Column(VARCHAR(256), nullable=False, index=True)
from_address = Column(LargeBinary, index=True)
to_address = Column(LargeBinary, index=True)
gas = Column(Numeric(precision=78, scale=0), index=True)
gas_price = Column(Numeric(precision=78, scale=0), index=True)
max_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
max_priority_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
input = Column(Text)
nonce = Column(VARCHAR(256))
transaction_index = Column(BigInteger)
transaction_type = Column(Integer, nullable=True)
value = Column(Numeric(precision=78, scale=0), index=True)
indexed_at = Column(
DateTime(timezone=True), server_default=utcnow(), nullable=False
)
## Labels
class EthereumLabel(EvmBasedLabel): # type: ignore
__tablename__ = "ethereum_labels"
@ -256,3 +289,138 @@ class RoninLabel(EvmBasedLabel): # type: ignore
class RoninSaigonLabel(EvmBasedLabel): # type: ignore
__tablename__ = "ronin_saigon_labels"
## Transactions
class EthereumTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "ethereum_transactions"
class SepoliaTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "sepolia_transactions"
class PolygonTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "polygon_transactions"
class MumbaiTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "mumbai_transactions"
class AmoyTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "amoy_transactions"
class XDaiTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "xdai_transactions"
class ZkSyncEraTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "zksync_era_transactions"
class ZkSyncEraSepoliaTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "zksync_era_sepolia_transactions"
class BaseTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "base_transactions"
class ArbitrumNovaTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "arbitrum_nova_transactions"
l1_block_number = Column(BigInteger, nullable=True)
class ArbitrumOneTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "arbitrum_one_transactions"
l1_block_number = Column(BigInteger, nullable=True)
class ArbitrumSepoliaTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "arbitrum_sepolia_transactions"
l1_block_number = Column(BigInteger, nullable=True)
class Game7OrbitArbitrumSepoliaTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "game7_orbit_arbitrum_sepolia_transactions"
l1_block_number = Column(BigInteger, nullable=True)
class XaiTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "xai_transactions"
l1_block_number = Column(BigInteger, nullable=True)
class XaiSepoliaTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "xai_sepolia_transactions"
l1_block_number = Column(BigInteger, nullable=True)
class AvalancheTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "avalanche_transactions"
class AvalancheFujiTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "avalanche_fuji_transactions"
class BlastTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "blast_transactions"
class BlastSepoliaTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "blast_sepolia_transactions"
class ProofOfPlayApexTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "proofofplay_apex_transactions"
l1_block_number = Column(BigInteger, nullable=True)
class MantleTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "mantle_transactions"
class MantleSepoliaTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "mantle_sepolia_transactions"
class ImxZkevmTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "imx_zkevm_transactions"
class ImxZkevmSepoliaTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "imx_zkevm_sepolia_transactions"
class Game7Transaction(EvmBasedTransaction): # type: ignore
__tablename__ = "game7_transactions"
l1_block_number = Column(BigInteger, nullable=True)
class Game7TestnetTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "game7_testnet_transactions"
l1_block_number = Column(BigInteger, nullable=True)
class B3Transaction(EvmBasedTransaction): # type: ignore
__tablename__ = "b3_transactions"
class B3SepoliaTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "b3_sepolia_transactions"
class RoninTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "ronin_transactions"
class RoninSaigonTransaction(EvmBasedTransaction): # type: ignore
__tablename__ = "ronin_saigon_transactions"

Wyświetl plik

@ -1 +1 @@
0.1.5
0.1.6