Porównaj commity

...

26 Commity

Autor SHA1 Wiadomość Data
Sergei Sumarokov 50d7c826be
Merge pull request #1052 from moonstream-to/fix-mdbv3-init
Fix with init package installation
2024-04-11 15:26:28 +03:00
kompotkot ece119afdd Fix with init package installation 2024-04-11 12:16:20 +00:00
Sergei Sumarokov 13054433da
Merge pull request #1051 from moonstream-to/fix-checenv-restriction
Fix checkenv restriction
2024-04-10 17:31:55 +03:00
kompotkot 9bb392dc0b Lost moonstream package added 2024-04-10 14:31:22 +00:00
kompotkot df3365167a Fix checkenv restriction 2024-04-10 14:24:07 +00:00
Sergei Sumarokov becb5b8843
Merge pull request #1050 from moonstream-to/mapi-new-blockchains
Updated blockchains support list
2024-04-10 17:08:52 +03:00
kompotkot c4e313e15c Added lost variables for blockchains 2024-04-10 13:06:47 +00:00
kompotkot 2221b45bc9 Updated blockchains support list 2024-04-10 12:39:19 +00:00
Sergei Sumarokov 163049b9b6
Merge pull request #1049 from moonstream-to/blast-crawlers-init
Blast crawlers init
2024-04-10 14:54:46 +03:00
Sergei Sumarokov 7994da519b
Merge pull request #1048 from moonstream-to/blast-db-init
Blast and Blast Sepolia blockchains at database
2024-04-10 14:53:02 +03:00
kompotkot f84788a6c1 Deployment for blast blockchains 2024-04-10 11:34:10 +00:00
kompotkot 784ff2a740 Blast and Blast Sepolia crawling support 2024-04-10 11:22:25 +00:00
kompotkot 49b49153ac Blast and Blast Sepolia blockchains at database 2024-04-10 10:02:19 +00:00
Sergei Sumarokov 25fc91569d
Merge pull request #1047 from moonstream-to/fix-nb-env
Fix rewrite env params for nodebalancer
2024-04-10 11:06:08 +03:00
kompotkot c06d9df61b Fix rewrite env params for nodebalancer 2024-04-10 08:05:23 +00:00
Sergei Sumarokov 7ec2ee5003
Merge pull request #1046 from moonstream-to/mdbv3-pypi-release
Moonstream DB V3 release workflow
2024-04-08 17:25:13 +03:00
kompotkot 23b20284f9 Moonstream DB V3 release workflow 2024-04-08 14:24:20 +00:00
Sergei Sumarokov 1f31738b44
Merge pull request #1030 from moonstream-to/mdb-v3-init
Initial version of moonstreamdb-v3
2024-04-08 17:18:46 +03:00
kompotkot 640a8d12a0 Updated migration with starknet and avalanche 2024-04-01 13:17:50 +00:00
kompotkot d85870b525 Starknet models 2024-03-30 09:49:05 +03:00
kompotkot 5030865ef1 Allow to specify schema in engine 2024-03-28 08:20:41 +00:00
kompotkot 51f6e5d02e Alembic migrations in package 2024-03-26 09:38:40 +00:00
kompotkot 44b656fb9b Optimized db.py for future use 2024-03-25 10:58:54 +00:00
kompotkot d0cd24dd5f Fixed package import 2024-03-25 10:47:28 +00:00
kompotkot 650d45a334 Some fixes for correct packaging 2024-03-21 15:24:59 +00:00
kompotkot f913ec73ae Initial version of moonstreamdb-v3 2024-03-14 13:05:07 +00:00
79 zmienionych plików z 3021 dodań i 117 usunięć

Wyświetl plik

@ -0,0 +1,30 @@
name: Release moonstreamdbv3 package
on:
push:
tags:
- 'moonstreamdbv3/v*'
defaults:
run:
working-directory: moonstreamdb-v3
jobs:
publish:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[distribute]
- name: Build and publish
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_MOONSTREAMDBV3 }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*

Wyświetl plik

@ -0,0 +1,11 @@
[Unit]
Description=Fill missing blocks at Blast database
After=network.target
[Service]
Type=oneshot
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain blast -n
CPUWeight=50
SyslogIdentifier=blast-missing

Wyświetl plik

@ -0,0 +1,9 @@
[Unit]
Description=Fill missing blocks at Blast database
[Timer]
OnBootSec=120s
OnUnitActiveSec=15m
[Install]
WantedBy=timers.target

Wyświetl plik

@ -0,0 +1,17 @@
[Unit]
Description=Blast moonworm crawler
After=network.target
StartLimitIntervalSec=300
StartLimitBurst=3
[Service]
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
Restart=on-failure
RestartSec=15s
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b blast --confirmations 10 --min-blocks-batch 20
CPUWeight=70
SyslogIdentifier=blast-moonworm-crawler
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -0,0 +1,11 @@
[Unit]
Description=Fill missing blocks at Blast Sepolia database
After=network.target
[Service]
Type=oneshot
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain blast_sepolia -n
CPUWeight=50
SyslogIdentifier=blast-sepolia-missing

Wyświetl plik

@ -0,0 +1,9 @@
[Unit]
Description=Fill missing blocks at Blast Sepolia database
[Timer]
OnBootSec=120s
OnUnitActiveSec=15m
[Install]
WantedBy=timers.target

Wyświetl plik

@ -0,0 +1,17 @@
[Unit]
Description=Blast Sepolia moonworm crawler
After=network.target
StartLimitIntervalSec=300
StartLimitBurst=3
[Service]
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
Restart=on-failure
RestartSec=15s
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b blast_sepolia --confirmations 10 --min-blocks-batch 20
CPUWeight=70
SyslogIdentifier=blast-sepolia-moonworm-crawler
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -0,0 +1,17 @@
[Unit]
Description=Blast Sepolia block with transactions synchronizer
StartLimitIntervalSec=300
StartLimitBurst=3
After=network.target
[Service]
Restart=on-failure
RestartSec=15s
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain blast_sepolia -c 10 -j 2
CPUWeight=90
SyslogIdentifier=blast-sepolia-synchronize
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -0,0 +1,17 @@
[Unit]
Description=Blast block with transactions synchronizer
StartLimitIntervalSec=300
StartLimitBurst=3
After=network.target
[Service]
Restart=on-failure
RestartSec=15s
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain blast -c 10 -j 2
CPUWeight=90
SyslogIdentifier=blast-synchronize
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -93,6 +93,16 @@ AVALANCHE_FUJI_SYNCHRONIZE_SERVICE="avalanche-fuji-synchronize.service"
AVALANCHE_FUJI_MISSING_SERVICE_FILE="avalanche-fuji-missing.service"
AVALANCHE_FUJI_MISSING_TIMER_FILE="avalanche-fuji-missing.timer"
# Blast
BLAST_MISSING_SERVICE_FILE="blast-missing.service"
BLAST_MISSING_TIMER_FILE="blast-missing.timer"
BLAST_SYNCHRONIZE_SERVICE="blast-synchronize.service"
# Blast sepolia
BLAST_SEPOLIA_MISSING_SERVICE_FILE="blast-sepolia-missing.service"
BLAST_SEPOLIA_MISSING_TIMER_FILE="blast-sepolia-missing.timer"
BLAST_SEPOLIA_SYNCHRONIZE_SERVICE="blast-sepolia-synchronize.service"
set -eu
echo
@ -370,3 +380,39 @@ cp "${SCRIPT_DIR}/${AVALANCHE_FUJI_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/
cp "${SCRIPT_DIR}/${AVALANCHE_FUJI_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${AVALANCHE_FUJI_MISSING_TIMER_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AVALANCHE_FUJI_MISSING_TIMER_FILE}"
# Blast
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast block with transactions syncronizer service definition with ${BLAST_SYNCHRONIZE_SERVICE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_SYNCHRONIZE_SERVICE}"
cp "${SCRIPT_DIR}/${BLAST_SYNCHRONIZE_SERVICE}" "/home/ubuntu/.config/systemd/user/${BLAST_SYNCHRONIZE_SERVICE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_SYNCHRONIZE_SERVICE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast missing service and timer with: ${BLAST_MISSING_SERVICE_FILE}, ${BLAST_MISSING_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_MISSING_SERVICE_FILE}" "${SCRIPT_DIR}/${BLAST_MISSING_TIMER_FILE}"
cp "${SCRIPT_DIR}/${BLAST_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_MISSING_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${BLAST_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_MISSING_TIMER_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_MISSING_TIMER_FILE}"
# Blast sepolia
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast sepolia block with transactions syncronizer service definition with ${BLAST_SEPOLIA_SYNCHRONIZE_SERVICE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_SEPOLIA_SYNCHRONIZE_SERVICE}"
cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_SYNCHRONIZE_SERVICE}" "/home/ubuntu/.config/systemd/user/${BLAST_SEPOLIA_SYNCHRONIZE_SERVICE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_SEPOLIA_SYNCHRONIZE_SERVICE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast sepolia missing service and timer with: ${BLAST_SEPOLIA_MISSING_SERVICE_FILE}, ${BLAST_SEPOLIA_MISSING_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_SEPOLIA_MISSING_SERVICE_FILE}" "${SCRIPT_DIR}/${BLAST_SEPOLIA_MISSING_TIMER_FILE}"
cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_SEPOLIA_MISSING_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_SEPOLIA_MISSING_TIMER_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_SEPOLIA_MISSING_TIMER_FILE}"

Wyświetl plik

@ -37,6 +37,8 @@ XAI_MOONWORM_CRAWLER_SERVICE_FILE="xai-moonworm-crawler.service"
XAI_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE="xai-sepolia-moonworm-crawler.service"
AVALANCHE_MOONWORM_CRAWLER_SERVICE_FILE="avalanche-moonworm-crawler.service"
AVALANCHE_FUJI_MOONWORM_CRAWLER_SERVICE_FILE="avalanche-fuji-moonworm-crawler.service"
BLAST_MOONWORM_CRAWLER_SERVICE_FILE="blast-moonworm-crawler.service"
BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE="blast-sepolia-moonworm-crawler.service"
set -eu
@ -172,3 +174,19 @@ chmod 644 "${SCRIPT_DIR}/${AVALANCHE_FUJI_MOONWORM_CRAWLER_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${AVALANCHE_FUJI_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${AVALANCHE_FUJI_MOONWORM_CRAWLER_SERVICE_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AVALANCHE_FUJI_MOONWORM_CRAWLER_SERVICE_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast moonworm crawler service definition with ${BLAST_MOONWORM_CRAWLER_SERVICE_FILE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_MOONWORM_CRAWLER_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${BLAST_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_MOONWORM_CRAWLER_SERVICE_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_MOONWORM_CRAWLER_SERVICE_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast sepolia moonworm crawler service definition with ${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}"

Wyświetl plik

@ -139,18 +139,30 @@ XAI_SEPOLIA_MISSING_TIMER_FILE="xai-sepolia-missing.timer"
XAI_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE="xai-sepolia-moonworm-crawler.service"
XAI_SEPOLIA_SYNCHRONIZE_SERVICE="xai-sepolia-synchronize.service"
# Avalanche sepolia
# Avalanche
AVALANCHE_SYNCHRONIZE_SERVICE="avalanche-synchronize.service"
AVALANCHE_MISSING_SERVICE_FILE="avalanche-missing.service"
AVALANCHE_MISSING_TIMER_FILE="avalanche-missing.timer"
AVALANCHE_MOONWORM_CRAWLER_SERVICE_FILE="avalanche-moonworm-crawler.service"
# Avalanche Fuji sepolia
# Avalanche Fuji
AVALANCHE_FUJI_SYNCHRONIZE_SERVICE="avalanche-fuji-synchronize.service"
AVALANCHE_FUJI_MISSING_SERVICE_FILE="avalanche-fuji-missing.service"
AVALANCHE_FUJI_MISSING_TIMER_FILE="avalanche-fuji-missing.timer"
AVALANCHE_FUJI_MOONWORM_CRAWLER_SERVICE_FILE="avalanche-fuji-moonworm-crawler.service"
# Blast
BLAST_MISSING_SERVICE_FILE="blast-missing.service"
BLAST_MISSING_TIMER_FILE="blast-missing.timer"
BLAST_MOONWORM_CRAWLER_SERVICE_FILE="blast-moonworm-crawler.service"
BLAST_SYNCHRONIZE_SERVICE="blast-synchronize.service"
# Blast sepolia
BLAST_SEPOLIA_MISSING_SERVICE_FILE="blast-sepolia-missing.service"
BLAST_SEPOLIA_MISSING_TIMER_FILE="blast-sepolia-missing.timer"
BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE="blast-sepolia-moonworm-crawler.service"
BLAST_SEPOLIA_SYNCHRONIZE_SERVICE="blast-sepolia-synchronize.service"
set -eu
echo
@ -641,8 +653,6 @@ cp "${SCRIPT_DIR}/${ARBITRUM_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubun
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${ARBITRUM_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}"
# Xai
echo
echo
@ -747,3 +757,55 @@ chmod 644 "${SCRIPT_DIR}/${AVALANCHE_FUJI_MOONWORM_CRAWLER_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${AVALANCHE_FUJI_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${AVALANCHE_FUJI_MOONWORM_CRAWLER_SERVICE_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${AVALANCHE_FUJI_MOONWORM_CRAWLER_SERVICE_FILE}"
# Blast
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast block with transactions syncronizer service definition with ${BLAST_SYNCHRONIZE_SERVICE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_SYNCHRONIZE_SERVICE}"
cp "${SCRIPT_DIR}/${BLAST_SYNCHRONIZE_SERVICE}" "/home/ubuntu/.config/systemd/user/${BLAST_SYNCHRONIZE_SERVICE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_SYNCHRONIZE_SERVICE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast missing service and timer with: ${BLAST_MISSING_SERVICE_FILE}, ${BLAST_MISSING_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_MISSING_SERVICE_FILE}" "${SCRIPT_DIR}/${BLAST_MISSING_TIMER_FILE}"
cp "${SCRIPT_DIR}/${BLAST_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_MISSING_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${BLAST_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_MISSING_TIMER_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_MISSING_TIMER_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast moonworm crawler service definition with ${BLAST_MOONWORM_CRAWLER_SERVICE_FILE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_MOONWORM_CRAWLER_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${BLAST_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_MOONWORM_CRAWLER_SERVICE_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_MOONWORM_CRAWLER_SERVICE_FILE}"
# Blast sepolia
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast sepolia block with transactions syncronizer service definition with ${BLAST_SEPOLIA_SYNCHRONIZE_SERVICE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_SEPOLIA_SYNCHRONIZE_SERVICE}"
cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_SYNCHRONIZE_SERVICE}" "/home/ubuntu/.config/systemd/user/${BLAST_SEPOLIA_SYNCHRONIZE_SERVICE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_SEPOLIA_SYNCHRONIZE_SERVICE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast sepolia missing service and timer with: ${BLAST_SEPOLIA_MISSING_SERVICE_FILE}, ${BLAST_SEPOLIA_MISSING_TIMER_FILE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_SEPOLIA_MISSING_SERVICE_FILE}" "${SCRIPT_DIR}/${BLAST_SEPOLIA_MISSING_TIMER_FILE}"
cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_MISSING_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_SEPOLIA_MISSING_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_MISSING_TIMER_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_SEPOLIA_MISSING_TIMER_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_SEPOLIA_MISSING_TIMER_FILE}"
echo
echo
echo -e "${PREFIX_INFO} Replacing existing Blast sepolia moonworm crawler service definition with ${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}"
chmod 644 "${SCRIPT_DIR}/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}"
cp "${SCRIPT_DIR}/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}"
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart --no-block "${BLAST_SEPOLIA_MOONWORM_CRAWLER_SERVICE_FILE}"

Wyświetl plik

@ -26,6 +26,8 @@ from .settings import (
MOONSTREAM_NODE_ARBITRUM_SEPOLIA_A_EXTERNAL_URI,
MOONSTREAM_NODE_AVALANCHE_A_EXTERNAL_URI,
MOONSTREAM_NODE_AVALANCHE_FUJI_A_EXTERNAL_URI,
MOONSTREAM_NODE_BLAST_A_EXTERNAL_URI,
MOONSTREAM_NODE_BLAST_SEPOLIA_A_EXTERNAL_URI,
MOONSTREAM_NODE_ETHEREUM_A_EXTERNAL_URI,
MOONSTREAM_NODE_MUMBAI_A_EXTERNAL_URI,
MOONSTREAM_NODE_POLYGON_A_EXTERNAL_URI,
@ -82,6 +84,10 @@ def connect(
web3_uri = MOONSTREAM_NODE_AVALANCHE_A_EXTERNAL_URI
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
web3_uri = MOONSTREAM_NODE_AVALANCHE_FUJI_A_EXTERNAL_URI
elif blockchain_type == AvailableBlockchainType.BLAST:
web3_uri = MOONSTREAM_NODE_BLAST_A_EXTERNAL_URI
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
web3_uri = MOONSTREAM_NODE_BLAST_SEPOLIA_A_EXTERNAL_URI
else:
raise Exception("Wrong blockchain type provided for web3 URI")
@ -146,7 +152,7 @@ def add_block(db_session, block: Any, blockchain_type: AvailableBlockchainType)
)
if blockchain_type == AvailableBlockchainType.XDAI:
block_obj.author = block.author
if (
elif (
blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET
or blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA
or blockchain_type == AvailableBlockchainType.ZKSYNC_ERA
@ -163,7 +169,7 @@ def add_block(db_session, block: Any, blockchain_type: AvailableBlockchainType)
if block.get("l1BatchTimestamp") is not None
else None
)
if (
elif (
blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA
or blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA
):
@ -172,8 +178,7 @@ def add_block(db_session, block: Any, blockchain_type: AvailableBlockchainType)
block_obj.send_count = hex_to_int(block.get("sendCount"))
block_obj.send_root = block.get("sendRoot", "")
block_obj.mix_hash = block.get("mixHash", "")
if (
elif (
blockchain_type == AvailableBlockchainType.XAI
or blockchain_type == AvailableBlockchainType.XAI_SEPOLIA
):
@ -182,8 +187,7 @@ def add_block(db_session, block: Any, blockchain_type: AvailableBlockchainType)
block_obj.send_count = hex_to_int(block.get("sendCount"))
block_obj.send_root = block.get("sendRoot", "")
block_obj.mix_hash = block.get("mixHash", "")
if (
elif (
blockchain_type == AvailableBlockchainType.AVALANCHE
or blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI
):
@ -192,6 +196,13 @@ def add_block(db_session, block: Any, blockchain_type: AvailableBlockchainType)
block_obj.block_gas_cost = block.get("blockGasCost")
block_obj.ext_data_gas_used = block.get("extDataGasUsed", "")
block_obj.ext_data_hash = block.get("extDataHash", "")
elif (
blockchain_type == AvailableBlockchainType.BLAST
or blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA
):
block_obj.sha3_uncles = block.get("sha3Uncles", "")
block_obj.mix_hash = block.get("mixHash", "")
block_obj.withdrawals_root = block.get("withdrawalsRoot", "")
db_session.add(block_obj)

Wyświetl plik

@ -152,6 +152,10 @@ def continuous_crawler(
network = Network.avalanche
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
network = Network.avalanche_fuji
elif blockchain_type == AvailableBlockchainType.BLAST:
network = Network.blast
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
network = Network.blast_sepolia
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")

Wyświetl plik

@ -44,6 +44,8 @@ class SubscriptionTypes(Enum):
XAI_SEPOLIA_BLOCKCHAIN = "xai_sepolia_smartcontract"
AVALANCHE_BLOCKCHAIN = "avalanche_smartcontract"
AVALANCHE_FUJI_BLOCKCHAIN = "avalanche_fuji_smartcontract"
BLAST_BLOCKCHAIN = "blast_smartcontract"
BLAST_SEPOLIA_BLOCKCHAIN = "blast_sepolia_smartcontract"
def abi_input_signature(input_abi: Dict[str, Any]) -> str:
@ -166,6 +168,10 @@ def blockchain_type_to_subscription_type(
return SubscriptionTypes.AVALANCHE_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
return SubscriptionTypes.AVALANCHE_FUJI_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.BLAST:
return SubscriptionTypes.BLAST_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
return SubscriptionTypes.BLAST_SEPOLIA_BLOCKCHAIN
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")

Wyświetl plik

@ -72,6 +72,8 @@ def function_call_crawler(
network = Network.zksync_era_testnet
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
network = Network.zksync_era
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
network = Network.zksync_era_sepolia
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
network = Network.arbitrum_nova
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
@ -80,6 +82,14 @@ def function_call_crawler(
network = Network.xai
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
network = Network.xai_sepolia
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
network = Network.avalanche
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
network = Network.avalanche_fuji
elif blockchain_type == AvailableBlockchainType.BLAST:
network = Network.blast
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
network = Network.blast_sepolia
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")

Wyświetl plik

@ -66,6 +66,8 @@ def historical_crawler(
network = Network.zksync_era_testnet
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
network = Network.zksync_era
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
network = Network.zksync_era_sepolia
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
network = Network.arbitrum_nova
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
@ -74,6 +76,14 @@ def historical_crawler(
network = Network.xai
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
network = Network.xai_sepolia
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
network = Network.avalanche
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
network = Network.avalanche_fuji
elif blockchain_type == AvailableBlockchainType.BLAST:
network = Network.blast
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
network = Network.blast_sepolia
else:
raise Exception("Unsupported blockchain type provided")

Wyświetl plik

@ -160,6 +160,20 @@ if MOONSTREAM_NODE_AVALANCHE_FUJI_A_EXTERNAL_URI == "":
"MOONSTREAM_NODE_AVALANCHE_FUJI_A_EXTERNAL_URI env variable is not set"
)
MOONSTREAM_NODE_BLAST_A_EXTERNAL_URI = os.environ.get(
"MOONSTREAM_NODE_BLAST_A_EXTERNAL_URI", ""
)
if MOONSTREAM_NODE_BLAST_A_EXTERNAL_URI == "":
raise Exception("MOONSTREAM_NODE_BLAST_A_EXTERNAL_URI env variable is not set")
MOONSTREAM_NODE_BLAST_SEPOLIA_A_EXTERNAL_URI = os.environ.get(
"MOONSTREAM_NODE_BLAST_SEPOLIA_A_EXTERNAL_URI", ""
)
if MOONSTREAM_NODE_BLAST_SEPOLIA_A_EXTERNAL_URI == "":
raise Exception(
"MOONSTREAM_NODE_BLAST_SEPOLIA_A_EXTERNAL_URI env variable is not set"
)
MOONSTREAM_CRAWL_WORKERS = 4
MOONSTREAM_CRAWL_WORKERS_RAW = os.environ.get("MOONSTREAM_CRAWL_WORKERS")
try:

Wyświetl plik

@ -62,6 +62,8 @@ subscription_id_by_blockchain = {
"xai_sepolia": "xai_sepolia_smartcontract",
"avalanche": "avalanche_smartcontract",
"avalanche_fuji": "avalanche_fuji_smartcontract",
"blast": "blast_smartcontract",
"blast_sepolia": "blast_sepolia_smartcontract",
}
blockchain_by_subscription_id = {
@ -79,6 +81,8 @@ blockchain_by_subscription_id = {
"xai_sepolia_blockchain": "xai_sepolia",
"avalanche_blockchain": "avalanche",
"avalanche_fuji_blockchain": "avalanche_fuji",
"blast_blockchain": "blast",
"blast_sepolia_blockchain": "blast_sepolia",
"ethereum_smartcontract": "ethereum",
"polygon_smartcontract": "polygon",
"mumbai_smartcontract": "mumbai",
@ -93,6 +97,8 @@ blockchain_by_subscription_id = {
"xai_sepolia_smartcontract": "xai_sepolia",
"avalanche_smartcontract": "avalanche",
"avalanche_fuji_smartcontract": "avalanche_fuji",
"blast_smartcontract": "blast",
"blast_sepolia_smartcontract": "blast_sepolia",
}

Wyświetl plik

@ -11,3 +11,6 @@ ignore_missing_imports = True
[mypy-tqdm.*]
ignore_missing_imports = True
[mypy-moonworm.*]
ignore_missing_imports = True

Wyświetl plik

@ -33,6 +33,8 @@ export MOONSTREAM_NODE_XAI_A_EXTERNAL_URI="https://<connection_path_uri_to_node>
export MOONSTREAM_NODE_XAI_SEPOLIA_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_NODE_AVALANCHE_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_NODE_AVALANCHE_FUJI_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_NODE_BLAST_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_NODE_BLAST_SEPOLIA_A_EXTERNAL_URI="https://<connection_path_uri_to_node>"
# AWS environment variables
export MOONSTREAM_S3_SMARTCONTRACTS_BUCKET="<AWS_S3_bucket_for_smart_contracts>"

Wyświetl plik

@ -37,7 +37,7 @@ setup(
"bugout>=0.2.13",
"chardet",
"fastapi",
"moonstreamdb>=0.3.11",
"moonstreamdb>=0.3.12",
"moonstream>=0.1.1",
"moonworm[moonstream]>=0.6.2",
"humbug",

Wyświetl plik

@ -15,9 +15,27 @@ export MOONSTREAM_CRAWLERS_SERVER_PORT="<Moonstream_crawlers_server_port>"
# Blockchain, txpool, whalewatch data depends variables
export MOONSTREAM_DATA_JOURNAL_ID="<bugout_journal_id_to_store_blockchain_data>"
export HUMBUG_TXPOOL_CLIENT_ID="<Bugout_Humbug_client_id_for_txpool_transactions_in_journal>"
export MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI="https://<connection_path_uri_to_ethereum_node>"
export MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_POLYGON_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_XDAI_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_WYRM_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_ARBITRUM_SEPOLIA_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_XAI_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_XAI_SEPOLIA_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_AVALANCHE_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_AVALANCHE_FUJI_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_BLAST_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_QUERIES_JOURNAL_ID="<bugout_journal_id_where_store_queries_for_executing>"
export MOONSTREAM_USAGE_REPORTS_JOURNAL_ID="<bugout_journal_id_where_save_generated_reports>"
export MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN="<access_token>"
export MOONSTREAM_LEADERBOARD_GENERATOR_JOURNAL_ID="<journal_id>"
# Set following parameters if AWS node instance and S3 smartcontracts configured
export MOONSTREAM_S3_SMARTCONTRACTS_BUCKET="<AWS_S3_bucket_to_store_smart_contracts>"

Wyświetl plik

@ -47,7 +47,7 @@ echo
echo
echo -e "${PREFIX_INFO} Retrieving addition deployment parameters"
mkdir -p "${SECRETS_DIR}"
AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" /home/ubuntu/go/bin/checkenv show aws_ssm+moonstream:true > "${PARAMETERS_ENV_PATH}"
AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" CHECKENV_AWS_FETCH_LOOP_LIMIT=20 /home/ubuntu/go/bin/checkenv show aws_ssm+moonstream:true > "${PARAMETERS_ENV_PATH}"
echo
echo

Wyświetl plik

@ -4,12 +4,11 @@ import sys
from typing import List, Optional, Type, Union, cast
import pyevmasm
from moonstreamdb.db import yield_db_session
from moonstreamdb.models import ESDEventSignature, ESDFunctionSignature
from sqlalchemy.orm.session import Session
from sqlalchemy.sql.expression import text
from moonstreamdb.db import yield_db_session
from .data import ContractABI, EVMEventSignature, EVMFunctionSignature

Wyświetl plik

@ -12,10 +12,10 @@ from bugout.data import (
BugoutJournal,
BugoutJournals,
BugoutResource,
BugoutResourceHolder,
BugoutResources,
BugoutSearchResult,
BugoutSearchResults,
BugoutResourceHolder,
HolderType,
ResourcePermissions,
)
@ -58,11 +58,17 @@ blockchain_by_subscription_id = {
"mumbai_blockchain": "mumbai",
"xdai_blockchain": "xdai",
"wyrm_blockchain": "wyrm",
"zksync_era_testnet_blockchain": "zksync_era_testnet",
"zksync_era_blockchain": "zksync_era",
"zksync_era_sepolia_blockchain": "zksync_era_sepolia",
"arbitrum_nova_blockchain": "arbitrum_nova",
"arbitrum_sepolia_blockchain": "arbitrum_sepolia",
"xai_blockchain": "xai",
"zksync_era_testnet_blockchain": "zksync_era_testnet",
"zksync_era_blockchain": "zksync_era",
"xai_sepolia_blockchain": "xai_sepolia",
"avalanche_blockchain": "avalanche",
"avalanche_fuji_blockchain": "avalanche_fuji",
"blast_blockchain": "blast",
"blast_sepolia_blockchain": "blast_sepolia",
"ethereum_smartcontract": "ethereum",
"polygon_smartcontract": "polygon",
"mumbai_smartcontract": "mumbai",
@ -70,9 +76,15 @@ blockchain_by_subscription_id = {
"wyrm_smartcontract": "wyrm",
"zksync_era_testnet_smartcontract": "zksync_era_testnet",
"zksync_era_smartcontract": "zksync_era",
"zksync_era_sepolia_smartcontract": "zksync_era_sepolia",
"arbitrum_nova_smartcontract": "arbitrum_nova",
"arbitrum_sepolia_smartcontract": "arbitrum_sepolia",
"xai_smartcontract": "xai",
"xai_sepolia_smartcontract": "xai_sepolia",
"avalanche_smartcontract": "avalanche",
"avalanche_fuji_smartcontract": "avalanche_fuji",
"blast_smartcontract": "blast",
"blast_sepolia_smartcontract": "blast_sepolia",
}

Wyświetl plik

@ -7,11 +7,10 @@ import json
import logging
import os
from posix import listdir
from typing import Optional, List, Dict, Any, Union, Callable
from sqlalchemy.orm import with_expression
from typing import Any, Callable, Dict, List, Optional, Union
from moonstreamdb.db import SessionLocal
from sqlalchemy.orm import with_expression
from ..settings import (
BUGOUT_BROOD_URL,
@ -22,16 +21,14 @@ from ..settings import (
MOONSTREAM_USAGE_REPORTS_JOURNAL_ID,
)
from ..web3_provider import yield_web3_provider
from . import subscription_types, subscriptions, moonworm_tasks, queries, usage
from . import moonworm_tasks, queries, subscription_types, subscriptions, usage
from .migrations import (
checksum_address,
update_dashboard_subscription_key,
generate_entity_subscriptions,
add_selectors,
checksum_address,
generate_entity_subscriptions,
update_dashboard_subscription_key,
)
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

Wyświetl plik

@ -1,20 +1,20 @@
"""
Add selectors to all moonworm tasks.
"""
import logging
import json
import json
import logging
from bugout.exceptions import BugoutResponseException
from web3 import Web3
from ...actions import get_all_entries_from_search
from ...settings import (
BUGOUT_REQUEST_TIMEOUT_SECONDS,
MOONSTREAM_ADMIN_ACCESS_TOKEN,
MOONSTREAM_MOONWORM_TASKS_JOURNAL,
)
from ...settings import bugout_client as bc
from ...actions import get_all_entries_from_search
logger = logging.getLogger(__name__)

Wyświetl plik

@ -2,6 +2,7 @@
Convert all addresses in user subscriptions
and ethereum_labels column to checksum address.
"""
import logging
from typing import List

Wyświetl plik

@ -1,6 +1,7 @@
"""
Generate entity subscriptions from existing brood resources subscriptions
"""
import hashlib
import json
import logging
@ -691,9 +692,9 @@ def restore_dashboard_state():
f"Update dashboard {dashboard.id} with subscription {subscription_id} to old state"
)
dashboard_metadata[index][
"subscription_id"
] = user_entity_subscriptions[subscription_id]
dashboard_metadata[index]["subscription_id"] = (
user_entity_subscriptions[subscription_id]
)
bc.update_resource(
token=MOONSTREAM_ADMIN_ACCESS_TOKEN,

Wyświetl plik

@ -2,6 +2,7 @@
Convert all addresses in user subscriptions
and ethereum_labels column to checksum address.
"""
import logging
from typing import List

Wyświetl plik

@ -1,12 +1,11 @@
import logging
import json
import logging
import boto3 # type: ignore
from bugout.data import BugoutResource, BugoutResources
from bugout.exceptions import BugoutResponseException
from ..actions import get_all_entries_from_search, apply_moonworm_tasks
from ..actions import apply_moonworm_tasks, get_all_entries_from_search
from ..settings import MOONSTREAM_ADMIN_ACCESS_TOKEN, MOONSTREAM_MOONWORM_TASKS_JOURNAL
from ..settings import bugout_client as bc

Wyświetl plik

@ -24,7 +24,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="ethereum",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Ethereum blockchain",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/ethereum/eth-diamond-purple.png",
icon_url="https://static.simiotics.com/moonstream/assets/ethereum/eth-diamond-purple.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
@ -35,7 +35,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="polygon",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Polygon blockchain",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png",
icon_url="https://static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
@ -46,7 +46,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="mumbai",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Mumbai blockchain",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png",
icon_url="https://static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
@ -57,7 +57,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="xdai",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of XDai blockchain.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/xdai-token-logo.png",
icon_url="https://static.simiotics.com/moonstream/assets/xdai-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
@ -68,7 +68,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="wyrm",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Wyrm blockchain.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/great-wyrm-network-logo.png",
icon_url="https://static.simiotics.com/moonstream/assets/great-wyrm-network-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
@ -79,7 +79,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="zksync_era",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of zkSync Era blockchain.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/zksync-era-token-logo.png",
icon_url="https://static.simiotics.com/moonstream/assets/zksync-era-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
@ -90,7 +90,18 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="zksync_era_testnet",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of zkSync Era testnet blockchain.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/zksync-era-testnet-token-logo.png",
icon_url="https://static.simiotics.com/moonstream/assets/zksync-era-testnet-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"zksync_era_sepolia_smartcontract": SubscriptionTypeResourceData(
id="zksync_era_sepolia_smartcontract",
name="zkSync Era Sepolia smartcontract",
blockchain="zksync_era_sepolia",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of zkSync Era Sepolia blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/zksync-era-testnet-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
@ -101,7 +112,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="arbitrum_nova",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Arbitrum Nova blockchain.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/arbitrum-nova-token-logo.png",
icon_url="https://static.simiotics.com/moonstream/assets/arbitrum-nova-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
@ -112,7 +123,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="arbitrum_sepolia",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Arbitrum Sepolia blockchain.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/arbitrum-sepolia-token-logo.png",
icon_url="https://static.simiotics.com/moonstream/assets/arbitrum-sepolia-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
@ -123,7 +134,62 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="xai",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Xai blockchain.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/xai-token-logo.png",
icon_url="https://static.simiotics.com/moonstream/assets/xai-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"xai_sepolia_smartcontract": SubscriptionTypeResourceData(
id="xai_sepolia_smartcontract",
name="Xai Sepolia smartcontract",
blockchain="xai_sepolia",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Xai Sepolia blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/xai-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"avalanche_smartcontract": SubscriptionTypeResourceData(
id="avalanche_smartcontract",
name="Avalanche smartcontract",
blockchain="avalanche",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Avalanche blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/avalanche-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"avalanche_fuji_smartcontract": SubscriptionTypeResourceData(
id="avalanche_fuji_smartcontract",
name="Avalanche Fuji smartcontract",
blockchain="avalanche_fuji",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Avalanche Fuji blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/avalanche-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"blast_smartcontract": SubscriptionTypeResourceData(
id="blast_smartcontract",
name="Blast smartcontract",
blockchain="blast",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Blast blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/blast-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"blast_sepolia_smartcontract": SubscriptionTypeResourceData(
id="blast_sepolia_smartcontract",
name="Blast Sepolia smartcontract",
blockchain="blast_sepolia",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Blast Sepolia blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/blast-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
@ -134,7 +200,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="ethereum",
choices=["input:address", "tag:erc721"],
description="Transactions that have been mined into the Ethereum blockchain",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/ethereum/eth-diamond-purple.png",
icon_url="https://static.simiotics.com/moonstream/assets/ethereum/eth-diamond-purple.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
@ -145,7 +211,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="polygon",
choices=["input:address", "tag:erc721"],
description="Transactions that have been mined into the Polygon blockchain",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png",
icon_url="https://static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
@ -156,7 +222,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="mumbai",
choices=["input:address", "tag:erc721"],
description="Transactions that have been mined into the Mumbai blockchain",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png",
icon_url="https://static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
@ -167,7 +233,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="xdai",
choices=["input:address", "tag:erc721"],
description="Gnosis chain transactions subscription.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/xdai-token-logo.png",
icon_url="https://static.simiotics.com/moonstream/assets/xdai-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
@ -178,7 +244,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="wyrm",
choices=["input:address", "tag:erc721"],
description="Wyrm chain transactions subscription.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/great-wyrm-network-logo.png",
icon_url="https://static.simiotics.com/moonstream/assets/great-wyrm-network-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
@ -189,7 +255,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="zksync_era",
choices=["input:address", "tag:erc721"],
description="ZkSync Era chain transactions subscription.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/zksync-era-token-logo.png",
icon_url="https://static.simiotics.com/moonstream/assets/zksync-era-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
@ -200,7 +266,106 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="zksync_era_testnet",
choices=["input:address", "tag:erc721"],
description="ZkSync Era testnet chain transactions subscription.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/zksync-era-testnet-token-logo.png",
icon_url="https://static.simiotics.com/moonstream/assets/zksync-era-testnet-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"zksync_era_sepolia_blockchain": SubscriptionTypeResourceData(
id="zksync_era_sepolia_blockchain",
name="zkSync Era Sepolia transactions",
blockchain="zksync_era_sepolia",
choices=["input:address", "tag:erc721"],
description="ZkSync Era Sepolia chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/zksync-era-testnet-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"arbitrum_nova_blockchain": SubscriptionTypeResourceData(
id="arbitrum_nova_blockchain",
name="Arbitrum Nova transactions",
blockchain="arbitrum_nova",
choices=["input:address", "tag:erc721"],
description="Wyrm chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/arbitrum-nova-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"arbitrum_sepolia_blockchain": SubscriptionTypeResourceData(
id="arbitrum_sepolia_blockchain",
name="Arbitrum Sepolia transactions",
blockchain="arbitrum_sepolia",
choices=["input:address", "tag:erc721"],
description="Wyrm chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/arbitrum-sepolia-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"xai_blockchain": SubscriptionTypeResourceData(
id="xai_blockchain",
name="Xai smartcontract",
blockchain="xai",
choices=["input:address", "tag:erc721"],
description="Wyrm chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/xai-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"xai_sepolia_blockchain": SubscriptionTypeResourceData(
id="xai_sepolia_blockchain",
name="Xai Sepolia transactions",
blockchain="xai_sepolia",
choices=["input:address", "tag:erc721"],
description="Wyrm chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/xai-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"avalanche_blockchain": SubscriptionTypeResourceData(
id="avalanche_blockchain",
name="Avalanche transactions",
blockchain="avalanche",
choices=["input:address", "tag:erc721"],
description="Wyrm chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/avalanche-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"avalanche_fuji_blockchain": SubscriptionTypeResourceData(
id="avalanche_fuji_blockchain",
name="Avalanche Fuji transactions",
blockchain="avalanche_fuji",
choices=["input:address", "tag:erc721"],
description="Wyrm chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/avalanche-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"blast_blockchain": SubscriptionTypeResourceData(
id="blast_blockchain",
name="Blast transactions",
blockchain="blast",
choices=["input:address", "tag:erc721"],
description="Wyrm chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/blast-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
),
"blast_sepolia_blockchain": SubscriptionTypeResourceData(
id="blast_sepolia_blockchain",
name="Blast Sepolia transactions",
blockchain="blast_sepolia",
choices=["input:address", "tag:erc721"],
description="Wyrm chain transactions subscription.",
icon_url="https://static.simiotics.com/moonstream/assets/blast-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
@ -212,7 +377,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
description="Ethereum accounts that have experienced a lot of recent activity",
choices=[],
# Icon taken from: https://www.maxpixel.net/Whale-Cetacean-Wildlife-Symbol-Ocean-Sea-Black-99310
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/whalewatch.png",
icon_url="https://static.simiotics.com/moonstream/assets/whalewatch.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
@ -223,7 +388,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="ethereum",
description="Transactions that have been submitted into the Ethereum transaction pool but not necessarily mined yet",
choices=["input:address", "tag:erc721"],
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/ethereum/eth-diamond-rainbow.png",
icon_url="https://static.simiotics.com/moonstream/assets/ethereum/eth-diamond-rainbow.png",
stripe_product_id=None,
stripe_price_id=None,
active=False,
@ -234,7 +399,7 @@ CANONICAL_SUBSCRIPTION_TYPES = {
blockchain="Any",
description="Externally owned account",
choices=[],
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/ethereum/eth-diamond-rainbow.png",
icon_url="https://static.simiotics.com/moonstream/assets/ethereum/eth-diamond-rainbow.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,

Wyświetl plik

@ -1,6 +1,7 @@
"""
Utilities for managing subscription resources for a Moonstream application.
"""
import argparse
import json
from typing import Dict, List, Optional, Union

Wyświetl plik

@ -1,32 +1,26 @@
from typing import Optional, Dict, Any, Union, List
from datetime import datetime
import json
import logging
import textwrap
import time
import uuid
from datetime import datetime
from typing import Any, Dict, List, Optional, Union
import requests # type: ignore
import textwrap
from bugout.data import BugoutResourceHolders, HolderType, ResourcePermissions
from moonstream.client import ENDPOINT_QUERIES, Moonstream, MoonstreamQueryResultUrl
from web3 import Web3
from ..actions import get_all_entries_from_search
from ..settings import bugout_client as bc
from ..data import BUGOUT_RESOURCE_QUERY_RESOLVER
from ..settings import (
MOONSTREAM_ADMIN_ACCESS_TOKEN,
BUGOUT_REQUEST_TIMEOUT_SECONDS,
MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN,
MOONSTREAM_ADMIN_ACCESS_TOKEN,
MOONSTREAM_LEADERBOARD_GENERATOR_JOURNAL_ID,
MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN,
MOONSTREAM_USAGE_REPORTS_JOURNAL_ID,
)
from ..data import BUGOUT_RESOURCE_QUERY_RESOLVER
from bugout.data import BugoutResourceHolders, ResourcePermissions, HolderType
from web3 import Web3
from moonstream.client import (
Moonstream,
ENDPOINT_QUERIES,
MoonstreamQueryResultUrl,
)
from ..settings import bugout_client as bc
logger = logging.getLogger(__name__)

Wyświetl plik

@ -1,6 +1,7 @@
"""
The Moonstream HTTP API
"""
import logging
import time
from typing import Dict

Wyświetl plik

@ -1,6 +1,7 @@
"""
Pydantic schemas for the Moonstream HTTP API
"""
import json
from datetime import datetime
from enum import Enum

Wyświetl plik

@ -53,18 +53,30 @@ event_providers: Dict[str, Any] = {
moonworm_provider.XDaiMoonwormProvider.event_type: moonworm_provider.XDaiMoonwormProvider,
moonworm_provider.ZkSyncEraTestnetMoonwormProvider.event_type: moonworm_provider.ZkSyncEraTestnetMoonwormProvider,
moonworm_provider.ZkSyncEraMoonwormProvider.event_type: moonworm_provider.ZkSyncEraMoonwormProvider,
moonworm_provider.ZkSyncEraSepoliaMoonwormProvider.event_type: moonworm_provider.ZkSyncEraSepoliaMoonwormProvider,
moonworm_provider.ArbitrumNovaMoonwormProvider.event_type: moonworm_provider.ArbitrumNovaMoonwormProvider,
moonworm_provider.ArbitrumSepoliaMoonwormProvider.event_type: moonworm_provider.ArbitrumSepoliaMoonwormProvider,
moonworm_provider.XaiMoonwormProvider.event_type: moonworm_provider.XaiMoonwormProvider,
moonworm_provider.XaiSepoliaMoonwormProvider.event_type: moonworm_provider.XaiSepoliaMoonwormProvider,
moonworm_provider.AvalancheMoonwormProvider.event_type: moonworm_provider.AvalancheMoonwormProvider,
moonworm_provider.AvalancheFujiMoonwormProvider.event_type: moonworm_provider.AvalancheFujiMoonwormProvider,
moonworm_provider.BlastMoonwormProvider.event_type: moonworm_provider.BlastMoonwormProvider,
moonworm_provider.BlastSepoliaMoonwormProvider.event_type: moonworm_provider.BlastSepoliaMoonwormProvider,
transactions.EthereumTransactions.event_type: transactions.EthereumTransactions,
transactions.PolygonTransactions.event_type: transactions.PolygonTransactions,
transactions.MumbaiTransactions.event_type: transactions.MumbaiTransactions,
transactions.XDaiTransactions.event_type: transactions.XDaiTransactions,
transactions.ZkSyncEraTestnetTransactions.event_type: transactions.ZkSyncEraTestnetTransactions,
transactions.ZkSyncEraTransactions.event_type: transactions.ZkSyncEraTransactions,
transactions.ZkSyncEraSepoliaTransactions.event_type: transactions.ZkSyncEraSepoliaTransactions,
transactions.ArbitrumNovaTransactions.event_type: transactions.ArbitrumNovaTransactions,
transactions.ArbitrumSepoliaTransactions.event_type: transactions.ArbitrumSepoliaTransactions,
transactions.XaiTransactions.event_type: transactions.XaiTransactions,
transactions.XaiSepoliaTransactions.event_type: transactions.XaiSepoliaTransactions,
transactions.AvalancheTransactions.event_type: transactions.AvalancheTransactions,
transactions.AvalancheFujiTransactions.event_type: transactions.AvalancheFujiTransactions,
transactions.BlastTransactions.event_type: transactions.BlastTransactions,
transactions.BlastSepoliaTransactions.event_type: transactions.BlastSepoliaTransactions,
bugout.polygon_whalewatch_provider.event_type: bugout.polygon_whalewatch_provider,
bugout.ethereum_txpool_provider.event_type: bugout.ethereum_txpool_provider,
bugout.ethereum_whalewatch_provider.event_type: bugout.ethereum_whalewatch_provider,

Wyświetl plik

@ -1,6 +1,7 @@
"""
Event providers powered by Bugout journals.
"""
import json
import logging
from datetime import datetime
@ -155,7 +156,7 @@ class BugoutEventProvider:
timeout=self.timeout,
order=SearchOrder.DESCENDING,
)
events.extend([self.entry_event(entry) for entry in search_results.results]) # type: ignore
events.extend([self.entry_event(entry) for entry in search_results.results]) # type: ignore
offset = search_results.next_offset
return stream_boundary, events
@ -192,7 +193,7 @@ class BugoutEventProvider:
timeout=self.timeout,
order=SearchOrder.DESCENDING,
)
return [self.entry_event(entry) for entry in search_results.results] # type: ignore
return [self.entry_event(entry) for entry in search_results.results] # type: ignore
def next_event(
self,
@ -233,7 +234,7 @@ class BugoutEventProvider:
)
if not search_results.results:
return None
return self.entry_event(search_results.results[0]) # type: ignore
return self.entry_event(search_results.results[0]) # type: ignore
def previous_event(
self,
@ -274,7 +275,7 @@ class BugoutEventProvider:
)
if not search_results.results:
return None
return self.entry_event(search_results.results[0]) # type: ignore
return self.entry_event(search_results.results[0]) # type: ignore
class EthereumTXPoolProvider(BugoutEventProvider):

Wyświetl plik

@ -23,9 +23,16 @@ mumbai_event_type = "mumbai_blockchain"
xdai_event_type = "xdai_blockchain"
zksync_era_testnet_event_type = "zksync_era_testnet_blockchain"
zksync_era_event_type = "zksync_era_blockchain"
zksync_era_sepolia_event_type = "zksync_era_sepolia_blockchain"
arbitrum_nova_event_type = "arbitrum_nova_blockchain"
arbitrum_sepolia_event_type = "arbitrum_sepolia_blockchain"
xai_event_type = "xai_blockchain"
xai_sepolia_event_type = "xai_sepolia_blockchain"
avalanche_event_type = "avalanche_blockchain"
avalanche_fuji_sepolia_event_type = "avalanche_fuji_sepolia_blockchain"
blast_event_type = "blast_blockchain"
blast_sepolia_event_type = "blast_sepolia_blockchain"
allowed_tags = ["tag:erc721"]
description = f"""Event provider for transactions from the Ethereum blockchain.
@ -433,6 +440,13 @@ ZkSyncEraMoonwormProvider = MoonwormProvider(
streamboaundary_range_limit=2 * 60 * 60,
)
ZkSyncEraSepoliaMoonwormProvider = MoonwormProvider(
event_type="zksync_era_sepolia_smartcontract",
blockchain=AvailableBlockchainType("zksync_era_sepolia"),
description="Provider for reviving transactions from zkSync Era Sepolia tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
ArbitrumNovaMoonwormProvider = MoonwormProvider(
event_type="arbitrum_nova_smartcontract",
blockchain=AvailableBlockchainType("arbitrum_nova"),
@ -453,3 +467,38 @@ XaiMoonwormProvider = MoonwormProvider(
description="Provider for reviving transactions from Xai tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
XaiSepoliaMoonwormProvider = MoonwormProvider(
event_type="xai_sepolia_smartcontract",
blockchain=AvailableBlockchainType("xai_sepolia"),
description="Provider for reviving transactions from Xai Sepolia tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
AvalancheMoonwormProvider = MoonwormProvider(
event_type="avalanche_smartcontract",
blockchain=AvailableBlockchainType("avalanche"),
description="Provider for reviving transactions from Avalanche tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
AvalancheFujiMoonwormProvider = MoonwormProvider(
event_type="avalanche_fuji_smartcontract",
blockchain=AvailableBlockchainType("avalanche_fuji"),
description="Provider for reviving transactions from Avalanche Fuji tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
BlastMoonwormProvider = MoonwormProvider(
event_type="blast_smartcontract",
blockchain=AvailableBlockchainType("blast"),
description="Provider for reviving transactions from Blast tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
BlastSepoliaMoonwormProvider = MoonwormProvider(
event_type="blast_sepolia_smartcontract",
blockchain=AvailableBlockchainType("blast_sepolia"),
description="Provider for reviving transactions from Blast Sepolia tables.",
streamboaundary_range_limit=2 * 60 * 60,
)

Wyświetl plik

@ -490,6 +490,12 @@ ZkSyncEraTransactions = TransactionsProvider(
streamboaundary_range_limit=2 * 60 * 60,
)
ZkSyncEraSepoliaTransactions = TransactionsProvider(
event_type="zksync_era_sepolia_blockchain",
blockchain=AvailableBlockchainType("zksync_era_sepolia"),
description="Provider for resiving transactions from ZkSync Era Sepolia tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
ArbitrumNovaTransactions = TransactionsProvider(
event_type="arbitrum_nova_blockchain",
@ -511,3 +517,38 @@ XaiTransactions = TransactionsProvider(
description="Provider for resiving transactions from Xai tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
XaiSepoliaTransactions = TransactionsProvider(
event_type="xai_sepolia_blockchain",
blockchain=AvailableBlockchainType("xai_sepolia"),
description="Provider for resiving transactions from Xai Sepolia tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
AvalancheTransactions = TransactionsProvider(
event_type="avalanche_blockchain",
blockchain=AvailableBlockchainType("avalanche"),
description="Provider for resiving transactions from Avalanche tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
AvalancheFujiTransactions = TransactionsProvider(
event_type="avalanche_fuji_blockchain",
blockchain=AvailableBlockchainType("avalanche_fuji"),
description="Provider for resiving transactions from Avalanche Fuji tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
BlastTransactions = TransactionsProvider(
event_type="blast_blockchain",
blockchain=AvailableBlockchainType("blast"),
description="Provider for resiving transactions from Blast tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
BlastSepoliaTransactions = TransactionsProvider(
event_type="blast_sepolia_blockchain",
blockchain=AvailableBlockchainType("blast_sepolia"),
description="Provider for resiving transactions from Blast Sepolia tables.",
streamboaundary_range_limit=2 * 60 * 60,
)

Wyświetl plik

@ -2,11 +2,10 @@ import logging
from typing import Optional
from fastapi import APIRouter, Depends, Query
from moonstreamdb.db import yield_db_session
from sqlalchemy.orm import Session
from web3 import Web3
from moonstreamdb.db import yield_db_session
from .. import actions, data
from ..middleware import MoonstreamHTTPException
from ..web3_provider import yield_web3_provider

Wyświetl plik

@ -1,6 +1,7 @@
"""
The Moonstream queries HTTP API
"""
import logging
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple, Union, cast
@ -14,21 +15,22 @@ from bugout.data import (
BugoutSearchResult,
)
from bugout.exceptions import BugoutResponseException
from fastapi import APIRouter, Body, Path, Request, Query
from fastapi import APIRouter, Body, Path, Query, Request
from moonstreamdb.blockchain import AvailableBlockchainType
from sqlalchemy import text
from .. import data
from ..actions import (
NameNormalizationException,
create_resource_for_user,
generate_s3_access_links,
get_query_by_name,
name_normalization,
query_parameter_hash,
create_resource_for_user,
)
from ..middleware import MoonstreamHTTPException
from ..settings import (
BUGOUT_REQUEST_TIMEOUT_SECONDS,
MOONSTREAM_ADMIN_ACCESS_TOKEN,
MOONSTREAM_CRAWLERS_SERVER_PORT,
MOONSTREAM_CRAWLERS_SERVER_URL,
@ -37,7 +39,6 @@ from ..settings import (
MOONSTREAM_QUERY_TEMPLATE_CONTEXT_TYPE,
MOONSTREAM_S3_QUERIES_BUCKET,
MOONSTREAM_S3_QUERIES_BUCKET_PREFIX,
BUGOUT_REQUEST_TIMEOUT_SECONDS,
)
from ..settings import bugout_client as bc
@ -462,9 +463,9 @@ async def update_query_data_handler(
"query": content,
"params": request_update.params,
"file_type": file_type,
"blockchain": request_update.blockchain
if request_update.blockchain
else None,
"blockchain": (
request_update.blockchain if request_update.blockchain else None
),
},
timeout=MOONSTREAM_INTERNAL_REQUEST_TIMEOUT_SECONDS,
)

Wyświetl plik

@ -1,14 +1,14 @@
"""
The Moonstream subscriptions HTTP API
"""
import logging
from typing import Any, Dict, List, Optional
from bugout.data import BugoutResource
from fastapi import APIRouter, Depends, Query, Request
from sqlalchemy.orm import Session
from moonstreamdb import db
from sqlalchemy.orm import Session
from .. import data, stream_queries
from ..middleware import MoonstreamHTTPException

Wyświetl plik

@ -5,13 +5,13 @@ These endpoints enrich raw blockchain transactions (as well as pending transacti
transactions, etc.) with side information and return objects that are better suited for displaying to
end users.
"""
import logging
from typing import Optional
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from moonstreamdb.db import yield_db_session
from sqlalchemy.orm import Session
from .. import actions, data
from ..abi_decoder import decode_abi

Wyświetl plik

@ -1,6 +1,7 @@
"""
The Moonstream users HTTP API
"""
import logging
import uuid
from typing import Any, Dict, Optional

Wyświetl plik

@ -3,13 +3,13 @@ Moonstream's /whales endpoints.
These endpoints provide public access to whale watch summaries. No authentication required.
"""
import logging
from typing import Optional
from fastapi import APIRouter, Depends, Query
from sqlalchemy.orm import Session
from moonstreamdb import db
from sqlalchemy.orm import Session
from .. import data
from ..providers.bugout import ethereum_whalewatch_provider

Wyświetl plik

@ -144,6 +144,14 @@ MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI = os.environ.get(
if MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI == "":
raise Exception("MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI env variable is not set")
MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI == "":
raise Exception(
"MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI env variable is not set"
)
MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI", ""
)
@ -166,6 +174,40 @@ MOONSTREAM_XAI_WEB3_PROVIDER_URI = os.environ.get(
if MOONSTREAM_XAI_WEB3_PROVIDER_URI == "":
raise Exception("MOONSTREAM_XAI_WEB3_PROVIDER_URI env variable is not set")
MOONSTREAM_XAI_SEPOLIA_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_XAI_SEPOLIA_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_XAI_SEPOLIA_WEB3_PROVIDER_URI == "":
raise Exception("MOONSTREAM_XAI_SEPOLIA_WEB3_PROVIDER_URI env variable is not set")
MOONSTREAM_AVALANCHE_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_AVALANCHE_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_AVALANCHE_WEB3_PROVIDER_URI == "":
raise Exception("MOONSTREAM_AVALANCHE_WEB3_PROVIDER_URI env variable is not set")
MOONSTREAM_AVALANCHE_FUJI_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_AVALANCHE_FUJI_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_AVALANCHE_FUJI_WEB3_PROVIDER_URI == "":
raise Exception(
"MOONSTREAM_AVALANCHE_FUJI_WEB3_PROVIDER_URI env variable is not set"
)
MOONSTREAM_BLAST_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_BLAST_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_BLAST_WEB3_PROVIDER_URI == "":
raise Exception("MOONSTREAM_BLAST_WEB3_PROVIDER_URI env variable is not set")
MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI == "":
raise Exception(
"MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI env variable is not set"
)
## QueryAPI
MOONSTREAM_S3_QUERIES_BUCKET = os.environ.get("MOONSTREAM_S3_QUERIES_BUCKET", "")

Wyświetl plik

@ -1,6 +1,7 @@
"""
Utilities to work with stream boundaries.
"""
import time
from typing import Tuple

Wyświetl plik

@ -1,6 +1,7 @@
"""
Stream queries - data structure, and parser.
"""
import logging
from dataclasses import dataclass, field
from typing import List, Tuple, cast

Wyświetl plik

@ -1,6 +1,7 @@
"""
Tests for stream boundary utilities.
"""
import unittest
from . import stream_boundaries

Wyświetl plik

@ -2,4 +2,4 @@
Moonstream library and API version.
"""
MOONSTREAMAPI_VERSION = "0.3.5"
MOONSTREAMAPI_VERSION = "0.3.6"

Wyświetl plik

@ -1,33 +1,37 @@
import logging
from typing import Any, Callable, Dict, Optional, Union
from uuid import UUID
from typing import Any, Optional, Union, Callable, Dict
from web3 import Web3
from web3.middleware import geth_poa_middleware
from eth_abi import encode_single, decode_single
from eth_abi import decode_single, encode_single
from eth_utils import function_signature_to_4byte_selector
from moonstreamdb.blockchain import AvailableBlockchainType
from web3 import Web3
from web3.contract import ContractFunction
from web3.providers.rpc import HTTPProvider
from web3._utils.abi import normalize_event_input_types
from web3.contract import ContractFunction
from web3.middleware import geth_poa_middleware
from web3.providers.rpc import HTTPProvider
from .settings import (
MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI,
NB_ACCESS_ID_HEADER,
MOONSTREAM_POLYGON_WEB3_PROVIDER_URI,
MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI,
MOONSTREAM_XDAI_WEB3_PROVIDER_URI,
MOONSTREAM_WYRM_WEB3_PROVIDER_URI,
MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI,
MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI,
MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI,
MOONSTREAM_ARBITRUM_SEPOLIA_WEB3_PROVIDER_URI,
MOONSTREAM_AVALANCHE_FUJI_WEB3_PROVIDER_URI,
MOONSTREAM_AVALANCHE_WEB3_PROVIDER_URI,
MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI,
MOONSTREAM_BLAST_WEB3_PROVIDER_URI,
MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI,
MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI,
MOONSTREAM_POLYGON_WEB3_PROVIDER_URI,
MOONSTREAM_WYRM_WEB3_PROVIDER_URI,
MOONSTREAM_XAI_SEPOLIA_WEB3_PROVIDER_URI,
MOONSTREAM_XAI_WEB3_PROVIDER_URI,
multicall_contracts,
MOONSTREAM_XDAI_WEB3_PROVIDER_URI,
MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI,
MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI,
MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI,
NB_ACCESS_ID_HEADER,
multicall_contract_abi,
multicall_contracts,
)
from moonstreamdb.blockchain import AvailableBlockchainType
logger = logging.getLogger(__name__)
@ -78,12 +82,24 @@ def connect(
web3_uri = MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
web3_uri = MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_SEPOLIA:
web3_uri = MOONSTREAM_ZKSYNC_ERA_SEPOLIA_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.ARBITRUM_NOVA:
web3_uri = MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.ARBITRUM_SEPOLIA:
web3_uri = MOONSTREAM_ARBITRUM_SEPOLIA_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.XAI:
web3_uri = MOONSTREAM_XAI_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
web3_uri = MOONSTREAM_XAI_SEPOLIA_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.AVALANCHE:
web3_uri = MOONSTREAM_AVALANCHE_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
web3_uri = MOONSTREAM_AVALANCHE_FUJI_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.BLAST:
web3_uri = MOONSTREAM_BLAST_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
web3_uri = MOONSTREAM_BLAST_SEPOLIA_WEB3_PROVIDER_URI
else:
raise Exception("Wrong blockchain type provided for web3 URI")

Wyświetl plik

@ -36,7 +36,8 @@ jsonschema==4.17.0
lru-dict==1.1.8
Mako==1.2.3
MarkupSafe==2.1.1
moonstreamdb==0.3.8
moonstream==0.1.1
moonstreamdb==0.3.12
multiaddr==0.0.9
multidict==6.0.2
netaddr==0.8.0

Wyświetl plik

@ -15,7 +15,8 @@ setup(
"boto3",
"bugout>=0.2.15",
"fastapi",
"moonstreamdb>=0.3.8",
"moonstream",
"moonstreamdb>=0.3.12",
"humbug",
"pydantic==1.10.2",
"pyevmasm",

197
moonstreamdb-v3/.gitignore vendored 100644
Wyświetl plik

@ -0,0 +1,197 @@
# Created by https://www.toptal.com/developers/gitignore/api/python,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=python,visualstudiocode
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# End of https://www.toptal.com/developers/gitignore/api/python,visualstudiocode
# Envionments
.moonstream/
.moonstreamdb/
.moonstreamdb-v3/
.db/
.venv/
.env/
# Environment variables
dev.env
test.env
prod.env
moonstreamdb.env
moonstreamdb-v3.env
docker.env
docker.dev.env
docker.test.dev
docker.prod.env
docker.moonstreamdb-v3.env
.secrets/
# Alembic migrations
alembic.test.ini
alembic.dev.ini
alembic.prod.ini
alembic.moonstreamdb-v3.ini
alembic.docker.ini
# Schematic
srv/
.schematic.env
# Custom
scratch/

Wyświetl plik

@ -0,0 +1,3 @@
[settings]
profile = black
multi_line_output = 3

Wyświetl plik

@ -0,0 +1 @@
# moonstreamdb-v3

Wyświetl plik

@ -0,0 +1,116 @@
# A generic, single database configuration.
[alembic]
# path to migration scripts
script_location = moonstreamdbv3/alembic
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
# Uncomment the line below if you want the files to be prepended with date and time
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
# for all available tokens
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
# sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory.
prepend_sys_path = .
# timezone to use when rendering the date within the migration file
# as well as the filename.
# If specified, requires the python>=3.9 or backports.zoneinfo library.
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
# string value is passed to ZoneInfo()
# leave blank for localtime
# timezone =
# max length of characters to apply to the
# "slug" field
# truncate_slug_length = 40
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false
# version location specification; This defaults
# to alembic/versions. When using multiple version
# directories, initial revisions must be specified with --version-path.
# The path separator used here should be the separator specified by "version_path_separator" below.
# version_locations = %(here)s/bar:%(here)s/bat:alembic/versions
# version path separator; As mentioned above, this is the character used to split
# version_locations. The default within new alembic.ini files is "os", which uses os.pathsep.
# If this key is omitted entirely, it falls back to the legacy behavior of splitting on spaces and/or commas.
# Valid values for version_path_separator are:
#
# version_path_separator = :
# version_path_separator = ;
# version_path_separator = space
version_path_separator = os # Use os.pathsep. Default configuration used for new projects.
# set to 'true' to search source files recursively
# in each "version_locations" directory
# new in Alembic version 1.10
# recursive_version_locations = false
# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8
sqlalchemy.url = driver://user:pass@localhost/dbname
[post_write_hooks]
# post_write_hooks defines scripts or Python functions that are run
# on newly generated revision scripts. See the documentation for further
# detail and examples
# format using "black" - use the console_scripts runner, against the "black" entrypoint
# hooks = black
# black.type = console_scripts
# black.entrypoint = black
# black.options = -l 79 REVISION_SCRIPT_FILENAME
# lint with attempts to fix using "ruff" - use the exec runner, execute a binary
# hooks = ruff
# ruff.type = exec
# ruff.executable = %(here)s/.venv/bin/ruff
# ruff.options = --fix REVISION_SCRIPT_FILENAME
# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S

Wyświetl plik

@ -0,0 +1,3 @@
#!/usr/bin/env sh
PYTHONPATH=".:$PYTHONPATH" alembic "$@"

Wyświetl plik

@ -0,0 +1 @@
Generic single-database configuration.

Wyświetl plik

@ -0,0 +1,126 @@
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from alembic import context
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
if config.config_file_name is not None:
fileConfig(config.config_file_name)
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
from moonstreamdbv3.models import Base as MoonstreamBase
target_metadata = MoonstreamBase.metadata
# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
from moonstreamdbv3.models import (
EthereumLabel,
SepoliaLabel,
PolygonLabel,
MumbaiLabel,
XDaiLabel,
ZkSyncEraLabel,
ZkSyncEraSepoliaLabel,
BaseLabel,
ArbitrumNovaLabel,
ArbitrumSepoliaLabel,
XaiLabel,
XaiSepoliaLabel,
AvalancheLabel,
AvalancheFujiLabel,
StarknetLabel,
StarknetSepoliaLabel,
)
def include_symbol(tablename, schema):
return tablename in {
EthereumLabel.__tablename__,
SepoliaLabel.__tablename__,
PolygonLabel.__tablename__,
MumbaiLabel.__tablename__,
XDaiLabel.__tablename__,
ZkSyncEraLabel.__tablename__,
ZkSyncEraSepoliaLabel.__tablename__,
BaseLabel.__tablename__,
ArbitrumNovaLabel.__tablename__,
ArbitrumSepoliaLabel.__tablename__,
XaiLabel.__tablename__,
XaiSepoliaLabel.__tablename__,
AvalancheLabel.__tablename__,
AvalancheFujiLabel.__tablename__,
StarknetLabel.__tablename__,
StarknetSepoliaLabel.__tablename__,
}
def run_migrations_offline() -> None:
"""Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output.
"""
url = config.get_main_option("sqlalchemy.url")
context.configure(
url=url,
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
version_table="alembic_version",
include_schemas=True,
include_symbol=include_symbol,
)
with context.begin_transaction():
context.run_migrations()
def run_migrations_online() -> None:
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
connectable = engine_from_config(
config.get_section(config.config_ini_section, {}),
prefix="sqlalchemy.",
poolclass=pool.NullPool,
)
with connectable.connect() as connection:
context.configure(
connection=connection,
target_metadata=target_metadata,
version_table="alembic_version",
include_schemas=True,
include_symbol=include_symbol,
)
with context.begin_transaction():
context.run_migrations()
if context.is_offline_mode():
run_migrations_offline()
else:
run_migrations_online()

Wyświetl plik

@ -0,0 +1,26 @@
"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
# revision identifiers, used by Alembic.
revision: str = ${repr(up_revision)}
down_revision: Union[str, None] = ${repr(down_revision)}
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
def upgrade() -> None:
${upgrades if upgrades else "pass"}
def downgrade() -> None:
${downgrades if downgrades else "pass"}

Wyświetl plik

@ -0,0 +1,620 @@
"""Tables initial generation
Revision ID: 994e614b5500
Revises:
Create Date: 2024-03-14 07:03:35.586195
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '994e614b5500'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('arbitrum_nova_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_arbitrum_nova_labels')),
sa.UniqueConstraint('id', name=op.f('uq_arbitrum_nova_labels_id')),
)
op.create_index('ix_arbitrum_nova_labels_addr_block_num', 'arbitrum_nova_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_arbitrum_nova_labels_address'), 'arbitrum_nova_labels', ['address'], unique=False)
op.create_index(op.f('ix_arbitrum_nova_labels_block_number'), 'arbitrum_nova_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_arbitrum_nova_labels_caller_address'), 'arbitrum_nova_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_arbitrum_nova_labels_label'), 'arbitrum_nova_labels', ['label'], unique=False)
op.create_index(op.f('ix_arbitrum_nova_labels_label_name'), 'arbitrum_nova_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_arbitrum_nova_labels_label_type'), 'arbitrum_nova_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_arbitrum_nova_labels_origin_address'), 'arbitrum_nova_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_arbitrum_nova_labels_transaction_hash'), 'arbitrum_nova_labels', ['transaction_hash'], unique=False)
op.create_table('arbitrum_sepolia_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_arbitrum_sepolia_labels')),
sa.UniqueConstraint('id', name=op.f('uq_arbitrum_sepolia_labels_id'))
)
op.create_index('ix_arbitrum_sepolia_labels_addr_block_num', 'arbitrum_sepolia_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_labels_address'), 'arbitrum_sepolia_labels', ['address'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_labels_block_number'), 'arbitrum_sepolia_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_labels_caller_address'), 'arbitrum_sepolia_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_labels_label'), 'arbitrum_sepolia_labels', ['label'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_labels_label_name'), 'arbitrum_sepolia_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_labels_label_type'), 'arbitrum_sepolia_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_labels_origin_address'), 'arbitrum_sepolia_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_arbitrum_sepolia_labels_transaction_hash'), 'arbitrum_sepolia_labels', ['transaction_hash'], unique=False)
op.create_table('base_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_base_labels')),
sa.UniqueConstraint('id', name=op.f('uq_base_labels_id'))
)
op.create_index('ix_base_labels_addr_block_num', 'base_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_base_labels_address'), 'base_labels', ['address'], unique=False)
op.create_index(op.f('ix_base_labels_block_number'), 'base_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_base_labels_caller_address'), 'base_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_base_labels_label'), 'base_labels', ['label'], unique=False)
op.create_index(op.f('ix_base_labels_label_name'), 'base_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_base_labels_label_type'), 'base_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_base_labels_origin_address'), 'base_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_base_labels_transaction_hash'), 'base_labels', ['transaction_hash'], unique=False)
op.create_table('ethereum_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_ethereum_labels')),
sa.UniqueConstraint('id', name=op.f('uq_ethereum_labels_id'))
)
op.create_index('ix_ethereum_labels_addr_block_num', 'ethereum_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_ethereum_labels_address'), 'ethereum_labels', ['address'], unique=False)
op.create_index(op.f('ix_ethereum_labels_block_number'), 'ethereum_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_ethereum_labels_caller_address'), 'ethereum_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_ethereum_labels_label'), 'ethereum_labels', ['label'], unique=False)
op.create_index(op.f('ix_ethereum_labels_label_name'), 'ethereum_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_ethereum_labels_label_type'), 'ethereum_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_ethereum_labels_origin_address'), 'ethereum_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_ethereum_labels_transaction_hash'), 'ethereum_labels', ['transaction_hash'], unique=False)
op.create_table('mumbai_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_mumbai_labels')),
sa.UniqueConstraint('id', name=op.f('uq_mumbai_labels_id'))
)
op.create_index('ix_mumbai_labels_addr_block_num', 'mumbai_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_mumbai_labels_address'), 'mumbai_labels', ['address'], unique=False)
op.create_index(op.f('ix_mumbai_labels_block_number'), 'mumbai_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_mumbai_labels_caller_address'), 'mumbai_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_mumbai_labels_label'), 'mumbai_labels', ['label'], unique=False)
op.create_index(op.f('ix_mumbai_labels_label_name'), 'mumbai_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_mumbai_labels_label_type'), 'mumbai_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_mumbai_labels_origin_address'), 'mumbai_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_mumbai_labels_transaction_hash'), 'mumbai_labels', ['transaction_hash'], unique=False)
op.create_table('polygon_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_polygon_labels')),
sa.UniqueConstraint('id', name=op.f('uq_polygon_labels_id'))
)
op.create_index('ix_polygon_labels_addr_block_num', 'polygon_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_polygon_labels_address'), 'polygon_labels', ['address'], unique=False)
op.create_index(op.f('ix_polygon_labels_block_number'), 'polygon_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_polygon_labels_caller_address'), 'polygon_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_polygon_labels_label'), 'polygon_labels', ['label'], unique=False)
op.create_index(op.f('ix_polygon_labels_label_name'), 'polygon_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_polygon_labels_label_type'), 'polygon_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_polygon_labels_origin_address'), 'polygon_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_polygon_labels_transaction_hash'), 'polygon_labels', ['transaction_hash'], unique=False)
op.create_table('sepolia_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_sepolia_labels')),
sa.UniqueConstraint('id', name=op.f('uq_sepolia_labels_id'))
)
op.create_index('ix_sepolia_labels_addr_block_num', 'sepolia_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_sepolia_labels_address'), 'sepolia_labels', ['address'], unique=False)
op.create_index(op.f('ix_sepolia_labels_block_number'), 'sepolia_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_sepolia_labels_caller_address'), 'sepolia_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_sepolia_labels_label'), 'sepolia_labels', ['label'], unique=False)
op.create_index(op.f('ix_sepolia_labels_label_name'), 'sepolia_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_sepolia_labels_label_type'), 'sepolia_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_sepolia_labels_origin_address'), 'sepolia_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_sepolia_labels_transaction_hash'), 'sepolia_labels', ['transaction_hash'], unique=False)
op.create_table('xai_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_xai_labels')),
sa.UniqueConstraint('id', name=op.f('uq_xai_labels_id'))
)
op.create_index('ix_xai_labels_addr_block_num', 'xai_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_xai_labels_address'), 'xai_labels', ['address'], unique=False)
op.create_index(op.f('ix_xai_labels_block_number'), 'xai_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_xai_labels_caller_address'), 'xai_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_xai_labels_label'), 'xai_labels', ['label'], unique=False)
op.create_index(op.f('ix_xai_labels_label_name'), 'xai_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_xai_labels_label_type'), 'xai_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_xai_labels_origin_address'), 'xai_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_xai_labels_transaction_hash'), 'xai_labels', ['transaction_hash'], unique=False)
op.create_table('xai_sepolia_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_xai_sepolia_labels')),
sa.UniqueConstraint('id', name=op.f('uq_xai_sepolia_labels_id'))
)
op.create_index('ix_xai_sepolia_labels_addr_block_num', 'xai_sepolia_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_xai_sepolia_labels_address'), 'xai_sepolia_labels', ['address'], unique=False)
op.create_index(op.f('ix_xai_sepolia_labels_block_number'), 'xai_sepolia_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_xai_sepolia_labels_caller_address'), 'xai_sepolia_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_xai_sepolia_labels_label'), 'xai_sepolia_labels', ['label'], unique=False)
op.create_index(op.f('ix_xai_sepolia_labels_label_name'), 'xai_sepolia_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_xai_sepolia_labels_label_type'), 'xai_sepolia_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_xai_sepolia_labels_origin_address'), 'xai_sepolia_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_xai_sepolia_labels_transaction_hash'), 'xai_sepolia_labels', ['transaction_hash'], unique=False)
op.create_table('xdai_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_xdai_labels')),
sa.UniqueConstraint('id', name=op.f('uq_xdai_labels_id'))
)
op.create_index('ix_xdai_labels_addr_block_num', 'xdai_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_xdai_labels_address'), 'xdai_labels', ['address'], unique=False)
op.create_index(op.f('ix_xdai_labels_block_number'), 'xdai_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_xdai_labels_caller_address'), 'xdai_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_xdai_labels_label'), 'xdai_labels', ['label'], unique=False)
op.create_index(op.f('ix_xdai_labels_label_name'), 'xdai_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_xdai_labels_label_type'), 'xdai_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_xdai_labels_origin_address'), 'xdai_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_xdai_labels_transaction_hash'), 'xdai_labels', ['transaction_hash'], unique=False)
op.create_table('zksync_era_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_zksync_era_labels')),
sa.UniqueConstraint('id', name=op.f('uq_zksync_era_labels_id'))
)
op.create_index('ix_zksync_era_labels_addr_block_num', 'zksync_era_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_zksync_era_labels_address'), 'zksync_era_labels', ['address'], unique=False)
op.create_index(op.f('ix_zksync_era_labels_block_number'), 'zksync_era_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_zksync_era_labels_caller_address'), 'zksync_era_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_zksync_era_labels_label'), 'zksync_era_labels', ['label'], unique=False)
op.create_index(op.f('ix_zksync_era_labels_label_name'), 'zksync_era_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_zksync_era_labels_label_type'), 'zksync_era_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_zksync_era_labels_origin_address'), 'zksync_era_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_zksync_era_labels_transaction_hash'), 'zksync_era_labels', ['transaction_hash'], unique=False)
op.create_table('zksync_era_sepolia_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_zksync_era_sepolia_labels')),
sa.UniqueConstraint('id', name=op.f('uq_zksync_era_sepolia_labels_id'))
)
op.create_index('ix_zksync_era_sepolia_labels_addr_block_num', 'zksync_era_sepolia_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_zksync_era_sepolia_labels_address'), 'zksync_era_sepolia_labels', ['address'], unique=False)
op.create_index(op.f('ix_zksync_era_sepolia_labels_block_number'), 'zksync_era_sepolia_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_zksync_era_sepolia_labels_caller_address'), 'zksync_era_sepolia_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_zksync_era_sepolia_labels_label'), 'zksync_era_sepolia_labels', ['label'], unique=False)
op.create_index(op.f('ix_zksync_era_sepolia_labels_label_name'), 'zksync_era_sepolia_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_zksync_era_sepolia_labels_label_type'), 'zksync_era_sepolia_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_zksync_era_sepolia_labels_origin_address'), 'zksync_era_sepolia_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_zksync_era_sepolia_labels_transaction_hash'), 'zksync_era_sepolia_labels', ['transaction_hash'], unique=False)
op.create_table('avalanche_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_avalanche_labels')),
sa.UniqueConstraint('id', name=op.f('uq_avalanche_labels_id'))
)
op.create_index('ix_avalanche_labels_addr_block_num', 'avalanche_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_avalanche_labels_address'), 'avalanche_labels', ['address'], unique=False)
op.create_index(op.f('ix_avalanche_labels_block_number'), 'avalanche_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_avalanche_labels_caller_address'), 'avalanche_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_avalanche_labels_label'), 'avalanche_labels', ['label'], unique=False)
op.create_index(op.f('ix_avalanche_labels_label_name'), 'avalanche_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_avalanche_labels_label_type'), 'avalanche_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_avalanche_labels_origin_address'), 'avalanche_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_avalanche_labels_transaction_hash'), 'avalanche_labels', ['transaction_hash'], unique=False)
op.create_table('avalanche_fuji_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_avalanche_fuji_labels')),
sa.UniqueConstraint('id', name=op.f('uq_avalanche_fuji_labels_id'))
)
op.create_index('ix_avalanche_fuji_labels_addr_block_num', 'avalanche_fuji_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_avalanche_fuji_labels_address'), 'avalanche_fuji_labels', ['address'], unique=False)
op.create_index(op.f('ix_avalanche_fuji_labels_block_number'), 'avalanche_fuji_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_avalanche_fuji_labels_caller_address'), 'avalanche_fuji_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_avalanche_fuji_labels_label'), 'avalanche_fuji_labels', ['label'], unique=False)
op.create_index(op.f('ix_avalanche_fuji_labels_label_name'), 'avalanche_fuji_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_avalanche_fuji_labels_label_type'), 'avalanche_fuji_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_avalanche_fuji_labels_origin_address'), 'avalanche_fuji_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_avalanche_fuji_labels_transaction_hash'), 'avalanche_fuji_labels', ['transaction_hash'], unique=False)
op.create_table('starknet_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_starknet_labels')),
sa.UniqueConstraint('id', name=op.f('uq_starknet_labels_id'))
)
op.create_index('ix_starknet_labels_addr_block_num', 'starknet_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_starknet_labels_address'), 'starknet_labels', ['address'], unique=False)
op.create_index(op.f('ix_starknet_labels_block_number'), 'starknet_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_starknet_labels_caller_address'), 'starknet_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_starknet_labels_label'), 'starknet_labels', ['label'], unique=False)
op.create_index(op.f('ix_starknet_labels_label_name'), 'starknet_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_starknet_labels_label_type'), 'starknet_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_starknet_labels_origin_address'), 'starknet_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_starknet_labels_transaction_hash'), 'starknet_labels', ['transaction_hash'], unique=False)
op.create_table('starknet_sepolia_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('transaction_hash', sa.VARCHAR(length=128), nullable=False),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('caller_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('origin_address', sa.VARCHAR(length=64), nullable=True),
sa.Column('address', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_name', sa.Text(), nullable=True),
sa.Column('label_type', sa.VARCHAR(length=64), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_starknet_sepolia_labels')),
sa.UniqueConstraint('id', name=op.f('uq_starknet_sepolia_labels_id'))
)
op.create_index('ix_starknet_sepolia_labels_addr_block_num', 'starknet_sepolia_labels', ['address', 'block_number'], unique=False)
op.create_index(op.f('ix_starknet_sepolia_labels_address'), 'starknet_sepolia_labels', ['address'], unique=False)
op.create_index(op.f('ix_starknet_sepolia_labels_block_number'), 'starknet_sepolia_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_starknet_sepolia_labels_caller_address'), 'starknet_sepolia_labels', ['caller_address'], unique=False)
op.create_index(op.f('ix_starknet_sepolia_labels_label'), 'starknet_sepolia_labels', ['label'], unique=False)
op.create_index(op.f('ix_starknet_sepolia_labels_label_name'), 'starknet_sepolia_labels', ['label_name'], unique=False)
op.create_index(op.f('ix_starknet_sepolia_labels_label_type'), 'starknet_sepolia_labels', ['label_type'], unique=False)
op.create_index(op.f('ix_starknet_sepolia_labels_origin_address'), 'starknet_sepolia_labels', ['origin_address'], unique=False)
op.create_index(op.f('ix_starknet_sepolia_labels_transaction_hash'), 'starknet_sepolia_labels', ['transaction_hash'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_zksync_era_sepolia_labels_transaction_hash'), table_name='zksync_era_sepolia_labels')
op.drop_index(op.f('ix_zksync_era_sepolia_labels_origin_address'), table_name='zksync_era_sepolia_labels')
op.drop_index(op.f('ix_zksync_era_sepolia_labels_label_type'), table_name='zksync_era_sepolia_labels')
op.drop_index(op.f('ix_zksync_era_sepolia_labels_label_name'), table_name='zksync_era_sepolia_labels')
op.drop_index(op.f('ix_zksync_era_sepolia_labels_label'), table_name='zksync_era_sepolia_labels')
op.drop_index(op.f('ix_zksync_era_sepolia_labels_caller_address'), table_name='zksync_era_sepolia_labels')
op.drop_index(op.f('ix_zksync_era_sepolia_labels_block_number'), table_name='zksync_era_sepolia_labels')
op.drop_index(op.f('ix_zksync_era_sepolia_labels_address'), table_name='zksync_era_sepolia_labels')
op.drop_index('ix_zksync_era_sepolia_labels_addr_block_num', table_name='zksync_era_sepolia_labels')
op.drop_table('zksync_era_sepolia_labels')
op.drop_index(op.f('ix_zksync_era_labels_transaction_hash'), table_name='zksync_era_labels')
op.drop_index(op.f('ix_zksync_era_labels_origin_address'), table_name='zksync_era_labels')
op.drop_index(op.f('ix_zksync_era_labels_label_type'), table_name='zksync_era_labels')
op.drop_index(op.f('ix_zksync_era_labels_label_name'), table_name='zksync_era_labels')
op.drop_index(op.f('ix_zksync_era_labels_label'), table_name='zksync_era_labels')
op.drop_index(op.f('ix_zksync_era_labels_caller_address'), table_name='zksync_era_labels')
op.drop_index(op.f('ix_zksync_era_labels_block_number'), table_name='zksync_era_labels')
op.drop_index(op.f('ix_zksync_era_labels_address'), table_name='zksync_era_labels')
op.drop_index('ix_zksync_era_labels_addr_block_num', table_name='zksync_era_labels')
op.drop_table('zksync_era_labels')
op.drop_index(op.f('ix_xdai_labels_transaction_hash'), table_name='xdai_labels')
op.drop_index(op.f('ix_xdai_labels_origin_address'), table_name='xdai_labels')
op.drop_index(op.f('ix_xdai_labels_label_type'), table_name='xdai_labels')
op.drop_index(op.f('ix_xdai_labels_label_name'), table_name='xdai_labels')
op.drop_index(op.f('ix_xdai_labels_label'), table_name='xdai_labels')
op.drop_index(op.f('ix_xdai_labels_caller_address'), table_name='xdai_labels')
op.drop_index(op.f('ix_xdai_labels_block_number'), table_name='xdai_labels')
op.drop_index(op.f('ix_xdai_labels_address'), table_name='xdai_labels')
op.drop_index('ix_xdai_labels_addr_block_num', table_name='xdai_labels')
op.drop_table('xdai_labels')
op.drop_index(op.f('ix_xai_sepolia_labels_transaction_hash'), table_name='xai_sepolia_labels')
op.drop_index(op.f('ix_xai_sepolia_labels_origin_address'), table_name='xai_sepolia_labels')
op.drop_index(op.f('ix_xai_sepolia_labels_label_type'), table_name='xai_sepolia_labels')
op.drop_index(op.f('ix_xai_sepolia_labels_label_name'), table_name='xai_sepolia_labels')
op.drop_index(op.f('ix_xai_sepolia_labels_label'), table_name='xai_sepolia_labels')
op.drop_index(op.f('ix_xai_sepolia_labels_caller_address'), table_name='xai_sepolia_labels')
op.drop_index(op.f('ix_xai_sepolia_labels_block_number'), table_name='xai_sepolia_labels')
op.drop_index(op.f('ix_xai_sepolia_labels_address'), table_name='xai_sepolia_labels')
op.drop_index('ix_xai_sepolia_labels_addr_block_num', table_name='xai_sepolia_labels')
op.drop_table('xai_sepolia_labels')
op.drop_index(op.f('ix_xai_labels_transaction_hash'), table_name='xai_labels')
op.drop_index(op.f('ix_xai_labels_origin_address'), table_name='xai_labels')
op.drop_index(op.f('ix_xai_labels_label_type'), table_name='xai_labels')
op.drop_index(op.f('ix_xai_labels_label_name'), table_name='xai_labels')
op.drop_index(op.f('ix_xai_labels_label'), table_name='xai_labels')
op.drop_index(op.f('ix_xai_labels_caller_address'), table_name='xai_labels')
op.drop_index(op.f('ix_xai_labels_block_number'), table_name='xai_labels')
op.drop_index(op.f('ix_xai_labels_address'), table_name='xai_labels')
op.drop_index('ix_xai_labels_addr_block_num', table_name='xai_labels')
op.drop_table('xai_labels')
op.drop_index(op.f('ix_sepolia_labels_transaction_hash'), table_name='sepolia_labels')
op.drop_index(op.f('ix_sepolia_labels_origin_address'), table_name='sepolia_labels')
op.drop_index(op.f('ix_sepolia_labels_label_type'), table_name='sepolia_labels')
op.drop_index(op.f('ix_sepolia_labels_label_name'), table_name='sepolia_labels')
op.drop_index(op.f('ix_sepolia_labels_label'), table_name='sepolia_labels')
op.drop_index(op.f('ix_sepolia_labels_caller_address'), table_name='sepolia_labels')
op.drop_index(op.f('ix_sepolia_labels_block_number'), table_name='sepolia_labels')
op.drop_index(op.f('ix_sepolia_labels_address'), table_name='sepolia_labels')
op.drop_index('ix_sepolia_labels_addr_block_num', table_name='sepolia_labels')
op.drop_table('sepolia_labels')
op.drop_index(op.f('ix_polygon_labels_transaction_hash'), table_name='polygon_labels')
op.drop_index(op.f('ix_polygon_labels_origin_address'), table_name='polygon_labels')
op.drop_index(op.f('ix_polygon_labels_label_type'), table_name='polygon_labels')
op.drop_index(op.f('ix_polygon_labels_label_name'), table_name='polygon_labels')
op.drop_index(op.f('ix_polygon_labels_label'), table_name='polygon_labels')
op.drop_index(op.f('ix_polygon_labels_caller_address'), table_name='polygon_labels')
op.drop_index(op.f('ix_polygon_labels_block_number'), table_name='polygon_labels')
op.drop_index(op.f('ix_polygon_labels_address'), table_name='polygon_labels')
op.drop_index('ix_polygon_labels_addr_block_num', table_name='polygon_labels')
op.drop_table('polygon_labels')
op.drop_index(op.f('ix_mumbai_labels_transaction_hash'), table_name='mumbai_labels')
op.drop_index(op.f('ix_mumbai_labels_origin_address'), table_name='mumbai_labels')
op.drop_index(op.f('ix_mumbai_labels_label_type'), table_name='mumbai_labels')
op.drop_index(op.f('ix_mumbai_labels_label_name'), table_name='mumbai_labels')
op.drop_index(op.f('ix_mumbai_labels_label'), table_name='mumbai_labels')
op.drop_index(op.f('ix_mumbai_labels_caller_address'), table_name='mumbai_labels')
op.drop_index(op.f('ix_mumbai_labels_block_number'), table_name='mumbai_labels')
op.drop_index(op.f('ix_mumbai_labels_address'), table_name='mumbai_labels')
op.drop_index('ix_mumbai_labels_addr_block_num', table_name='mumbai_labels')
op.drop_table('mumbai_labels')
op.drop_index(op.f('ix_ethereum_labels_transaction_hash'), table_name='ethereum_labels')
op.drop_index(op.f('ix_ethereum_labels_origin_address'), table_name='ethereum_labels')
op.drop_index(op.f('ix_ethereum_labels_label_type'), table_name='ethereum_labels')
op.drop_index(op.f('ix_ethereum_labels_label_name'), table_name='ethereum_labels')
op.drop_index(op.f('ix_ethereum_labels_label'), table_name='ethereum_labels')
op.drop_index(op.f('ix_ethereum_labels_caller_address'), table_name='ethereum_labels')
op.drop_index(op.f('ix_ethereum_labels_block_number'), table_name='ethereum_labels')
op.drop_index(op.f('ix_ethereum_labels_address'), table_name='ethereum_labels')
op.drop_index('ix_ethereum_labels_addr_block_num', table_name='ethereum_labels')
op.drop_table('ethereum_labels')
op.drop_index(op.f('ix_base_labels_transaction_hash'), table_name='base_labels')
op.drop_index(op.f('ix_base_labels_origin_address'), table_name='base_labels')
op.drop_index(op.f('ix_base_labels_label_type'), table_name='base_labels')
op.drop_index(op.f('ix_base_labels_label_name'), table_name='base_labels')
op.drop_index(op.f('ix_base_labels_label'), table_name='base_labels')
op.drop_index(op.f('ix_base_labels_caller_address'), table_name='base_labels')
op.drop_index(op.f('ix_base_labels_block_number'), table_name='base_labels')
op.drop_index(op.f('ix_base_labels_address'), table_name='base_labels')
op.drop_index('ix_base_labels_addr_block_num', table_name='base_labels')
op.drop_table('base_labels')
op.drop_index(op.f('ix_arbitrum_sepolia_labels_transaction_hash'), table_name='arbitrum_sepolia_labels')
op.drop_index(op.f('ix_arbitrum_sepolia_labels_origin_address'), table_name='arbitrum_sepolia_labels')
op.drop_index(op.f('ix_arbitrum_sepolia_labels_label_type'), table_name='arbitrum_sepolia_labels')
op.drop_index(op.f('ix_arbitrum_sepolia_labels_label_name'), table_name='arbitrum_sepolia_labels')
op.drop_index(op.f('ix_arbitrum_sepolia_labels_label'), table_name='arbitrum_sepolia_labels')
op.drop_index(op.f('ix_arbitrum_sepolia_labels_caller_address'), table_name='arbitrum_sepolia_labels')
op.drop_index(op.f('ix_arbitrum_sepolia_labels_block_number'), table_name='arbitrum_sepolia_labels')
op.drop_index(op.f('ix_arbitrum_sepolia_labels_address'), table_name='arbitrum_sepolia_labels')
op.drop_index('ix_arbitrum_sepolia_labels_addr_block_num', table_name='arbitrum_sepolia_labels')
op.drop_table('arbitrum_sepolia_labels')
op.drop_index(op.f('ix_arbitrum_nova_labels_transaction_hash'), table_name='arbitrum_nova_labels')
op.drop_index(op.f('ix_arbitrum_nova_labels_origin_address'), table_name='arbitrum_nova_labels')
op.drop_index(op.f('ix_arbitrum_nova_labels_label_type'), table_name='arbitrum_nova_labels')
op.drop_index(op.f('ix_arbitrum_nova_labels_label_name'), table_name='arbitrum_nova_labels')
op.drop_index(op.f('ix_arbitrum_nova_labels_label'), table_name='arbitrum_nova_labels')
op.drop_index(op.f('ix_arbitrum_nova_labels_caller_address'), table_name='arbitrum_nova_labels')
op.drop_index(op.f('ix_arbitrum_nova_labels_block_number'), table_name='arbitrum_nova_labels')
op.drop_index(op.f('ix_arbitrum_nova_labels_address'), table_name='arbitrum_nova_labels')
op.drop_index('ix_arbitrum_nova_labels_addr_block_num', table_name='arbitrum_nova_labels')
op.drop_table('arbitrum_nova_labels')
op.drop_index(op.f('ix_avalanche_labels_transaction_hash'), table_name='avalanche_labels')
op.drop_index(op.f('ix_avalanche_labels_origin_address'), table_name='avalanche_labels')
op.drop_index(op.f('ix_avalanche_labels_label_type'), table_name='avalanche_labels')
op.drop_index(op.f('ix_avalanche_labels_label_name'), table_name='avalanche_labels')
op.drop_index(op.f('ix_avalanche_labels_label'), table_name='avalanche_labels')
op.drop_index(op.f('ix_avalanche_labels_caller_address'), table_name='avalanche_labels')
op.drop_index(op.f('ix_avalanche_labels_block_number'), table_name='avalanche_labels')
op.drop_index(op.f('ix_avalanche_labels_address'), table_name='avalanche_labels')
op.drop_index('ix_avalanche_labels_addr_block_num', table_name='avalanche_labels')
op.drop_table('avalanche_labels')
op.drop_index(op.f('ix_avalanche_fuji_labels_transaction_hash'), table_name='avalanche_fuji_labels')
op.drop_index(op.f('ix_avalanche_fuji_labels_origin_address'), table_name='avalanche_fuji_labels')
op.drop_index(op.f('ix_avalanche_fuji_labels_label_type'), table_name='avalanche_fuji_labels')
op.drop_index(op.f('ix_avalanche_fuji_labels_label_name'), table_name='avalanche_fuji_labels')
op.drop_index(op.f('ix_avalanche_fuji_labels_label'), table_name='avalanche_fuji_labels')
op.drop_index(op.f('ix_avalanche_fuji_labels_caller_address'), table_name='avalanche_fuji_labels')
op.drop_index(op.f('ix_avalanche_fuji_labels_block_number'), table_name='avalanche_fuji_labels')
op.drop_index(op.f('ix_avalanche_fuji_labels_address'), table_name='avalanche_fuji_labels')
op.drop_index('ix_avalanche_fuji_labels_addr_block_num', table_name='avalanche_fuji_labels')
op.drop_table('avalanche_fuji_labels')
op.drop_index(op.f('ix_starknet_labels_transaction_hash'), table_name='starknet_labels')
op.drop_index(op.f('ix_starknet_labels_origin_address'), table_name='starknet_labels')
op.drop_index(op.f('ix_starknet_labels_label_type'), table_name='starknet_labels')
op.drop_index(op.f('ix_starknet_labels_label_name'), table_name='starknet_labels')
op.drop_index(op.f('ix_starknet_labels_label'), table_name='starknet_labels')
op.drop_index(op.f('ix_starknet_labels_caller_address'), table_name='starknet_labels')
op.drop_index(op.f('ix_starknet_labels_block_number'), table_name='starknet_labels')
op.drop_index(op.f('ix_starknet_labels_address'), table_name='starknet_labels')
op.drop_index('ix_starknet_labels_addr_block_num', table_name='starknet_labels')
op.drop_table('starknet_labels')
op.drop_index(op.f('ix_starknet_sepolia_labels_transaction_hash'), table_name='starknet_sepolia_labels')
op.drop_index(op.f('ix_starknet_sepolia_labels_origin_address'), table_name='starknet_sepolia_labels')
op.drop_index(op.f('ix_starknet_sepolia_labels_label_type'), table_name='starknet_sepolia_labels')
op.drop_index(op.f('ix_starknet_sepolia_labels_label_name'), table_name='starknet_sepolia_labels')
op.drop_index(op.f('ix_starknet_sepolia_labels_label'), table_name='starknet_sepolia_labels')
op.drop_index(op.f('ix_starknet_sepolia_labels_caller_address'), table_name='starknet_sepolia_labels')
op.drop_index(op.f('ix_starknet_sepolia_labels_block_number'), table_name='starknet_sepolia_labels')
op.drop_index(op.f('ix_starknet_sepolia_labels_address'), table_name='starknet_sepolia_labels')
op.drop_index('ix_starknet_sepolia_labels_addr_block_num', table_name='starknet_sepolia_labels')
op.drop_table('starknet_sepolia_labels')
# ### end Alembic commands ###

Wyświetl plik

@ -0,0 +1,147 @@
"""
Moonstream database connection.
"""
import logging
import os
from contextlib import contextmanager
from typing import Generator, Optional
from sqlalchemy import create_engine
from sqlalchemy.orm import Session, sessionmaker
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
try:
MOONSTREAM_DB_URI = os.environ.get("MOONSTREAM_DB_URI")
if MOONSTREAM_DB_URI is None:
raise Warning("MOONSTREAM_DB_URI environment variable must be set")
MOONSTREAM_DB_URI_READ_ONLY = os.environ.get("MOONSTREAM_DB_URI_READ_ONLY")
if MOONSTREAM_DB_URI_READ_ONLY is None:
raise Warning("MOONSTREAM_DB_URI_READ_ONLY environment variable must be set")
MOONSTREAM_POOL_SIZE_RAW = os.environ.get("MOONSTREAM_POOL_SIZE")
MOONSTREAM_POOL_SIZE = 1
try:
if MOONSTREAM_POOL_SIZE_RAW is not None:
MOONSTREAM_POOL_SIZE = int(MOONSTREAM_POOL_SIZE_RAW)
except:
raise ValueError(
f"Could not parse MOONSTREAM_POOL_SIZE as int: {MOONSTREAM_POOL_SIZE_RAW}"
)
MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_RAW = os.environ.get(
"MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS"
)
MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS = 30000
try:
if MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_RAW is not None:
MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS = int(
MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_RAW
)
except:
raise ValueError(
f"MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS must be an integer: {MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_RAW}"
)
except ValueError as e:
raise ValueError(e)
except Warning:
logger.warning("Database variables not set")
def create_moonstream_engine(
url: str,
pool_size: int,
statement_timeout: int,
pool_pre_ping: bool = False,
schema: Optional[str] = None,
):
# Pooling: https://docs.sqlalchemy.org/en/14/core/pooling.html#sqlalchemy.pool.QueuePool
# Statement timeout: https://stackoverflow.com/a/44936982
options = f"-c statement_timeout={statement_timeout}"
if schema is not None:
options += f" -c search_path={schema}"
return create_engine(
url=url,
pool_pre_ping=pool_pre_ping,
pool_size=pool_size,
connect_args={"options": options},
)
class MoonstreamDBEngine:
def __init__(self, schema: Optional[str] = None) -> None:
self._engine = create_moonstream_engine(
url=MOONSTREAM_DB_URI, # type: ignore
pool_size=MOONSTREAM_POOL_SIZE,
statement_timeout=MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS,
schema=schema,
)
self._session_local = sessionmaker(bind=self.engine)
self._yield_db_session_ctx = contextmanager(self.yield_db_session)
@property
def engine(self):
return self._engine
@property
def session_local(self):
return self._session_local
@property
def yield_db_session_ctx(self):
return self._yield_db_session_ctx
def yield_db_session(
self,
) -> Generator[Session, None, None]:
"""
Yields a database connection (created using environment variables).
As per FastAPI docs:
https://fastapi.tiangolo.com/tutorial/sql-databases/#create-a-dependency
"""
session = self._session_local()
try:
yield session
finally:
session.close()
class MoonstreamDBEngineRO:
def __init__(self, schema: Optional[str] = None) -> None:
self._RO_engine = create_moonstream_engine(
url=MOONSTREAM_DB_URI_READ_ONLY, # type: ignore
pool_size=MOONSTREAM_POOL_SIZE,
statement_timeout=MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS,
schema=schema,
)
self._RO_session_local = sessionmaker(bind=self.RO_engine)
self._RO_yield_db_session_ctx = contextmanager(self.yield_db_read_only_session)
@property
def RO_engine(self):
return self._RO_engine
@property
def RO_session_local(self):
return self._RO_session_local
@property
def RO_yield_db_session_ctx(self):
return self._RO_yield_db_session_ctx
def yield_db_read_only_session(self) -> Generator[Session, None, None]:
"""
Yields read-only database connection (created using environment variables).
As per FastAPI docs:
https://fastapi.tiangolo.com/tutorial/sql-databases/#create-a-dependency
"""
session = self._RO_session_local()
try:
yield session
finally:
session.close()

Wyświetl plik

@ -0,0 +1,421 @@
"""
Moonstream database V3
Example of label_data column record:
{
"label": "ERC20",
"label_data": {
"name": "Uniswap",
"symbol": "UNI"
}
},
{
"label": "Exchange"
"label_data": {...}
}
"""
import uuid
from sqlalchemy import (
VARCHAR,
BigInteger,
Column,
DateTime,
Index,
Integer,
MetaData,
Text,
)
from sqlalchemy.dialects.postgresql import JSONB, UUID
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import expression
"""
Naming conventions doc
https://docs.sqlalchemy.org/en/20/core/constraints.html#configuring-constraint-naming-conventions
"""
convention = {
"ix": "ix_%(column_0_label)s",
"uq": "uq_%(table_name)s_%(column_0_name)s",
"ck": "ck_%(table_name)s_%(constraint_name)s",
"fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
"pk": "pk_%(table_name)s",
}
metadata = MetaData(naming_convention=convention)
Base = declarative_base(metadata=metadata)
"""
Creating a utcnow function which runs on the Posgres database server when created_at and updated_at
fields are populated.
Following:
1. https://docs.sqlalchemy.org/en/13/core/compiler.html#utc-timestamp-function
2. https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT
3. https://stackoverflow.com/a/33532154/13659585
"""
class utcnow(expression.FunctionElement):
type = DateTime # type: ignore
@compiles(utcnow, "postgresql")
def pg_utcnow(element, compiler, **kwargs):
return "TIMEZONE('utc', statement_timestamp())"
class EvmBasedLabel(Base): # type: ignore
__abstract__ = True
id = Column(
UUID(as_uuid=True),
primary_key=True,
default=uuid.uuid4,
unique=True,
nullable=False,
)
label = Column(VARCHAR(256), nullable=False, index=True)
transaction_hash = Column(
VARCHAR(128),
nullable=False,
index=True,
)
log_index = Column(Integer, nullable=True)
block_number = Column(
BigInteger,
nullable=False,
index=True,
)
block_hash = Column(VARCHAR(256), nullable=False)
block_timestamp = Column(BigInteger, nullable=False)
caller_address = Column(
VARCHAR(64),
nullable=True,
index=True,
)
origin_address = Column(
VARCHAR(64),
nullable=True,
index=True,
)
address = Column(
VARCHAR(64),
nullable=True,
index=True,
)
label_name = Column(Text, nullable=True, index=True)
label_type = Column(VARCHAR(64), nullable=True, index=True)
label_data = Column(JSONB, nullable=True)
created_at = Column(
DateTime(timezone=True), server_default=utcnow(), nullable=False
)
class EthereumLabel(EvmBasedLabel): # type: ignore
__tablename__ = "ethereum_labels"
__table_args__ = (
Index(
"ix_ethereum_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_ethereum_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class SepoliaLabel(EvmBasedLabel): # type: ignore
__tablename__ = "sepolia_labels"
__table_args__ = (
Index(
"ix_sepolia_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_sepolia_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class PolygonLabel(EvmBasedLabel): # type: ignore
__tablename__ = "polygon_labels"
__table_args__ = (
Index(
"ix_polygon_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_polygon_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class MumbaiLabel(EvmBasedLabel): # type: ignore
__tablename__ = "mumbai_labels"
__table_args__ = (
Index(
"ix_mumbai_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_mumbai_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class XDaiLabel(EvmBasedLabel): # type: ignore
__tablename__ = "xdai_labels"
__table_args__ = (
Index(
"ix_xdai_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_xdai_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class ZkSyncEraLabel(EvmBasedLabel): # type: ignore
__tablename__ = "zksync_era_labels"
__table_args__ = (
Index(
"ix_zksync_era_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_zksync_era_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class ZkSyncEraSepoliaLabel(EvmBasedLabel): # type: ignore
__tablename__ = "zksync_era_sepolia_labels"
__table_args__ = (
Index(
"ix_zksync_era_sepolia_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_zksync_era_sepolia_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class BaseLabel(EvmBasedLabel): # type: ignore
__tablename__ = "base_labels"
__table_args__ = (
Index(
"ix_base_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_base_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class ArbitrumNovaLabel(EvmBasedLabel): # type: ignore
__tablename__ = "arbitrum_nova_labels"
__table_args__ = (
Index(
"ix_arbitrum_nova_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_arbitrum_nova_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class ArbitrumSepoliaLabel(EvmBasedLabel): # type: ignore
__tablename__ = "arbitrum_sepolia_labels"
__table_args__ = (
Index(
"ix_arbitrum_sepolia_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_arbitrum_sepolia_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class XaiLabel(EvmBasedLabel): # type: ignore
__tablename__ = "xai_labels"
__table_args__ = (
Index(
"ix_xai_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_xai_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class XaiSepoliaLabel(EvmBasedLabel): # type: ignore
__tablename__ = "xai_sepolia_labels"
__table_args__ = (
Index(
"ix_xai_sepolia_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_xai_sepolia_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class AvalancheLabel(EvmBasedLabel): # type: ignore
__tablename__ = "avalanche_labels"
__table_args__ = (
Index(
"ix_avalanche_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_avalanche_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class AvalancheFujiLabel(EvmBasedLabel): # type: ignore
__tablename__ = "avalanche_fuji_labels"
__table_args__ = (
Index(
"ix_avalanche_fuji_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_avalanche_fuji_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class StarknetLabel(EvmBasedLabel): # type: ignore
__tablename__ = "starknet_labels"
__table_args__ = (
Index(
"ix_starknet_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_starknet_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)
class StarknetSepoliaLabel(EvmBasedLabel): # type: ignore
__tablename__ = "starknet_sepolia_labels"
__table_args__ = (
Index(
"ix_starknet_sepolia_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_starknet_sepolia_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
)

Wyświetl plik

@ -0,0 +1,11 @@
import os
VERSION = "UNKNOWN"
try:
PATH = os.path.abspath(os.path.dirname(__file__))
VERSION_FILE = os.path.join(PATH, "version.txt")
with open(VERSION_FILE) as ifp:
VERSION = ifp.read().strip()
except:
pass

Wyświetl plik

@ -0,0 +1 @@
0.0.2

Wyświetl plik

@ -0,0 +1,40 @@
from setuptools import find_packages, setup
from moonstreamdbv3.version import VERSION
long_description = ""
with open("README.md") as ifp:
long_description = ifp.read()
setup(
name="moonstreamdb-v3",
version=VERSION,
author="Bugout.dev",
author_email="engineers@bugout.dev",
license="Apache License 2.0",
description="Moonstream V3 database",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/bugout-dev/moonstream",
platforms="all",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
],
python_requires=">=3.8",
packages=find_packages(),
package_data={"moonstreamdbv3": ["py.typed"]},
zip_safe=False,
install_requires=["alembic", "psycopg2-binary", "sqlalchemy>=2.0.4"],
extras_require={
"dev": ["black", "isort", "mypy"],
"distribute": ["setuptools", "twine", "wheel"],
},
)

Wyświetl plik

@ -70,6 +70,12 @@ from moonstreamdb.models import (
ZkSyncEraTestnetLabel,
ZkSyncEraTestnetTransaction,
ZkSyncEraTransaction,
BlastBlock,
BlastLabel,
BlastTransaction,
BlastSepoliaBlock,
BlastSepoliaLabel,
BlastSepoliaTransaction,
)
@ -120,6 +126,12 @@ def include_symbol(tablename, schema):
AvalancheFujiTransaction.__tablename__,
AvalancheLabel.__tablename__,
AvalancheTransaction.__tablename__,
BlastBlock.__tablename__,
BlastLabel.__tablename__,
BlastTransaction.__tablename__,
BlastSepoliaBlock.__tablename__,
BlastSepoliaLabel.__tablename__,
BlastSepoliaTransaction.__tablename__,
}

Wyświetl plik

@ -0,0 +1,214 @@
"""Blast blockchain
Revision ID: 181c5800cb1b
Revises: 295ce155c811
Create Date: 2024-04-10 09:49:54.778860
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '181c5800cb1b'
down_revision = '295ce155c811'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('blast_blocks',
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('difficulty', sa.BigInteger(), nullable=True),
sa.Column('extra_data', sa.VARCHAR(length=128), nullable=True),
sa.Column('gas_limit', sa.BigInteger(), nullable=True),
sa.Column('gas_used', sa.BigInteger(), nullable=True),
sa.Column('base_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('hash', sa.VARCHAR(length=256), nullable=True),
sa.Column('logs_bloom', sa.VARCHAR(length=1024), nullable=True),
sa.Column('miner', sa.VARCHAR(length=256), nullable=True),
sa.Column('nonce', sa.VARCHAR(length=256), nullable=True),
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=True),
sa.Column('receipt_root', sa.VARCHAR(length=256), nullable=True),
sa.Column('uncles', sa.VARCHAR(length=256), nullable=True),
sa.Column('size', sa.Integer(), nullable=True),
sa.Column('state_root', sa.VARCHAR(length=256), nullable=True),
sa.Column('timestamp', sa.BigInteger(), nullable=True),
sa.Column('total_difficulty', sa.VARCHAR(length=256), nullable=True),
sa.Column('transactions_root', sa.VARCHAR(length=256), nullable=True),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.Column('sha3_uncles', sa.VARCHAR(length=256), nullable=True),
sa.Column('withdrawals_root', sa.VARCHAR(length=256), nullable=True),
sa.Column('mix_hash', sa.VARCHAR(length=256), nullable=True),
sa.PrimaryKeyConstraint('block_number', name=op.f('pk_blast_blocks'))
)
op.create_index(op.f('ix_blast_blocks_block_number'), 'blast_blocks', ['block_number'], unique=True)
op.create_index(op.f('ix_blast_blocks_hash'), 'blast_blocks', ['hash'], unique=False)
op.create_index(op.f('ix_blast_blocks_timestamp'), 'blast_blocks', ['timestamp'], unique=False)
op.create_table('blast_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=True),
sa.Column('address', sa.VARCHAR(length=256), nullable=True),
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('block_timestamp', sa.BigInteger(), nullable=True),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_blast_labels')),
sa.UniqueConstraint('id', name=op.f('uq_blast_labels_id'))
)
op.create_index(op.f('ix_blast_labels_address'), 'blast_labels', ['address'], unique=False)
op.create_index('ix_blast_labels_address_block_number', 'blast_labels', ['address', 'block_number'], unique=False)
op.create_index('ix_blast_labels_address_block_timestamp', 'blast_labels', ['address', 'block_timestamp'], unique=False)
op.create_index(op.f('ix_blast_labels_block_number'), 'blast_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_blast_labels_block_timestamp'), 'blast_labels', ['block_timestamp'], unique=False)
op.create_index(op.f('ix_blast_labels_label'), 'blast_labels', ['label'], unique=False)
op.create_index(op.f('ix_blast_labels_transaction_hash'), 'blast_labels', ['transaction_hash'], unique=False)
op.create_table('blast_sepolia_blocks',
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('difficulty', sa.BigInteger(), nullable=True),
sa.Column('extra_data', sa.VARCHAR(length=128), nullable=True),
sa.Column('gas_limit', sa.BigInteger(), nullable=True),
sa.Column('gas_used', sa.BigInteger(), nullable=True),
sa.Column('base_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('hash', sa.VARCHAR(length=256), nullable=True),
sa.Column('logs_bloom', sa.VARCHAR(length=1024), nullable=True),
sa.Column('miner', sa.VARCHAR(length=256), nullable=True),
sa.Column('nonce', sa.VARCHAR(length=256), nullable=True),
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=True),
sa.Column('receipt_root', sa.VARCHAR(length=256), nullable=True),
sa.Column('uncles', sa.VARCHAR(length=256), nullable=True),
sa.Column('size', sa.Integer(), nullable=True),
sa.Column('state_root', sa.VARCHAR(length=256), nullable=True),
sa.Column('timestamp', sa.BigInteger(), nullable=True),
sa.Column('total_difficulty', sa.VARCHAR(length=256), nullable=True),
sa.Column('transactions_root', sa.VARCHAR(length=256), nullable=True),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.Column('sha3_uncles', sa.VARCHAR(length=256), nullable=True),
sa.Column('withdrawals_root', sa.VARCHAR(length=256), nullable=True),
sa.Column('mix_hash', sa.VARCHAR(length=256), nullable=True),
sa.PrimaryKeyConstraint('block_number', name=op.f('pk_blast_sepolia_blocks'))
)
op.create_index(op.f('ix_blast_sepolia_blocks_block_number'), 'blast_sepolia_blocks', ['block_number'], unique=True)
op.create_index(op.f('ix_blast_sepolia_blocks_hash'), 'blast_sepolia_blocks', ['hash'], unique=False)
op.create_index(op.f('ix_blast_sepolia_blocks_timestamp'), 'blast_sepolia_blocks', ['timestamp'], unique=False)
op.create_table('blast_sepolia_labels',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('label', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=True),
sa.Column('address', sa.VARCHAR(length=256), nullable=True),
sa.Column('transaction_hash', sa.VARCHAR(length=256), nullable=True),
sa.Column('label_data', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('block_timestamp', sa.BigInteger(), nullable=True),
sa.Column('log_index', sa.Integer(), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_blast_sepolia_labels')),
sa.UniqueConstraint('id', name=op.f('uq_blast_sepolia_labels_id'))
)
op.create_index(op.f('ix_blast_sepolia_labels_address'), 'blast_sepolia_labels', ['address'], unique=False)
op.create_index('ix_blast_sepolia_labels_address_block_number', 'blast_sepolia_labels', ['address', 'block_number'], unique=False)
op.create_index('ix_blast_sepolia_labels_address_block_timestamp', 'blast_sepolia_labels', ['address', 'block_timestamp'], unique=False)
op.create_index(op.f('ix_blast_sepolia_labels_block_number'), 'blast_sepolia_labels', ['block_number'], unique=False)
op.create_index(op.f('ix_blast_sepolia_labels_block_timestamp'), 'blast_sepolia_labels', ['block_timestamp'], unique=False)
op.create_index(op.f('ix_blast_sepolia_labels_label'), 'blast_sepolia_labels', ['label'], unique=False)
op.create_index(op.f('ix_blast_sepolia_labels_transaction_hash'), 'blast_sepolia_labels', ['transaction_hash'], unique=False)
op.create_table('blast_sepolia_transactions',
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('from_address', sa.VARCHAR(length=256), nullable=True),
sa.Column('to_address', sa.VARCHAR(length=256), nullable=True),
sa.Column('gas', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('gas_price', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('max_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('max_priority_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('input', sa.Text(), nullable=True),
sa.Column('nonce', sa.VARCHAR(length=256), nullable=True),
sa.Column('transaction_index', sa.BigInteger(), nullable=True),
sa.Column('transaction_type', sa.Integer(), nullable=True),
sa.Column('value', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.Column('y_parity', sa.BigInteger(), nullable=True),
sa.ForeignKeyConstraint(['block_number'], ['blast_sepolia_blocks.block_number'], name=op.f('fk_blast_sepolia_transactions_block_number_blast_sepolia_blocks'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('hash', name=op.f('pk_blast_sepolia_transactions'))
)
op.create_index(op.f('ix_blast_sepolia_transactions_block_number'), 'blast_sepolia_transactions', ['block_number'], unique=False)
op.create_index(op.f('ix_blast_sepolia_transactions_from_address'), 'blast_sepolia_transactions', ['from_address'], unique=False)
op.create_index(op.f('ix_blast_sepolia_transactions_gas'), 'blast_sepolia_transactions', ['gas'], unique=False)
op.create_index(op.f('ix_blast_sepolia_transactions_gas_price'), 'blast_sepolia_transactions', ['gas_price'], unique=False)
op.create_index(op.f('ix_blast_sepolia_transactions_hash'), 'blast_sepolia_transactions', ['hash'], unique=True)
op.create_index(op.f('ix_blast_sepolia_transactions_to_address'), 'blast_sepolia_transactions', ['to_address'], unique=False)
op.create_index(op.f('ix_blast_sepolia_transactions_value'), 'blast_sepolia_transactions', ['value'], unique=False)
op.create_table('blast_transactions',
sa.Column('hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('from_address', sa.VARCHAR(length=256), nullable=True),
sa.Column('to_address', sa.VARCHAR(length=256), nullable=True),
sa.Column('gas', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('gas_price', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('max_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('max_priority_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('input', sa.Text(), nullable=True),
sa.Column('nonce', sa.VARCHAR(length=256), nullable=True),
sa.Column('transaction_index', sa.BigInteger(), nullable=True),
sa.Column('transaction_type', sa.Integer(), nullable=True),
sa.Column('value', sa.Numeric(precision=78, scale=0), nullable=True),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.Column('y_parity', sa.BigInteger(), nullable=True),
sa.ForeignKeyConstraint(['block_number'], ['blast_blocks.block_number'], name=op.f('fk_blast_transactions_block_number_blast_blocks'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('hash', name=op.f('pk_blast_transactions'))
)
op.create_index(op.f('ix_blast_transactions_block_number'), 'blast_transactions', ['block_number'], unique=False)
op.create_index(op.f('ix_blast_transactions_from_address'), 'blast_transactions', ['from_address'], unique=False)
op.create_index(op.f('ix_blast_transactions_gas'), 'blast_transactions', ['gas'], unique=False)
op.create_index(op.f('ix_blast_transactions_gas_price'), 'blast_transactions', ['gas_price'], unique=False)
op.create_index(op.f('ix_blast_transactions_hash'), 'blast_transactions', ['hash'], unique=True)
op.create_index(op.f('ix_blast_transactions_to_address'), 'blast_transactions', ['to_address'], unique=False)
op.create_index(op.f('ix_blast_transactions_value'), 'blast_transactions', ['value'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_blast_transactions_value'), table_name='blast_transactions')
op.drop_index(op.f('ix_blast_transactions_to_address'), table_name='blast_transactions')
op.drop_index(op.f('ix_blast_transactions_hash'), table_name='blast_transactions')
op.drop_index(op.f('ix_blast_transactions_gas_price'), table_name='blast_transactions')
op.drop_index(op.f('ix_blast_transactions_gas'), table_name='blast_transactions')
op.drop_index(op.f('ix_blast_transactions_from_address'), table_name='blast_transactions')
op.drop_index(op.f('ix_blast_transactions_block_number'), table_name='blast_transactions')
op.drop_table('blast_transactions')
op.drop_index(op.f('ix_blast_sepolia_transactions_value'), table_name='blast_sepolia_transactions')
op.drop_index(op.f('ix_blast_sepolia_transactions_to_address'), table_name='blast_sepolia_transactions')
op.drop_index(op.f('ix_blast_sepolia_transactions_hash'), table_name='blast_sepolia_transactions')
op.drop_index(op.f('ix_blast_sepolia_transactions_gas_price'), table_name='blast_sepolia_transactions')
op.drop_index(op.f('ix_blast_sepolia_transactions_gas'), table_name='blast_sepolia_transactions')
op.drop_index(op.f('ix_blast_sepolia_transactions_from_address'), table_name='blast_sepolia_transactions')
op.drop_index(op.f('ix_blast_sepolia_transactions_block_number'), table_name='blast_sepolia_transactions')
op.drop_table('blast_sepolia_transactions')
op.drop_index(op.f('ix_blast_sepolia_labels_transaction_hash'), table_name='blast_sepolia_labels')
op.drop_index(op.f('ix_blast_sepolia_labels_label'), table_name='blast_sepolia_labels')
op.drop_index(op.f('ix_blast_sepolia_labels_block_timestamp'), table_name='blast_sepolia_labels')
op.drop_index(op.f('ix_blast_sepolia_labels_block_number'), table_name='blast_sepolia_labels')
op.drop_index('ix_blast_sepolia_labels_address_block_timestamp', table_name='blast_sepolia_labels')
op.drop_index('ix_blast_sepolia_labels_address_block_number', table_name='blast_sepolia_labels')
op.drop_index(op.f('ix_blast_sepolia_labels_address'), table_name='blast_sepolia_labels')
op.drop_table('blast_sepolia_labels')
op.drop_index(op.f('ix_blast_sepolia_blocks_timestamp'), table_name='blast_sepolia_blocks')
op.drop_index(op.f('ix_blast_sepolia_blocks_hash'), table_name='blast_sepolia_blocks')
op.drop_index(op.f('ix_blast_sepolia_blocks_block_number'), table_name='blast_sepolia_blocks')
op.drop_table('blast_sepolia_blocks')
op.drop_index(op.f('ix_blast_labels_transaction_hash'), table_name='blast_labels')
op.drop_index(op.f('ix_blast_labels_label'), table_name='blast_labels')
op.drop_index(op.f('ix_blast_labels_block_timestamp'), table_name='blast_labels')
op.drop_index(op.f('ix_blast_labels_block_number'), table_name='blast_labels')
op.drop_index('ix_blast_labels_address_block_timestamp', table_name='blast_labels')
op.drop_index('ix_blast_labels_address_block_number', table_name='blast_labels')
op.drop_index(op.f('ix_blast_labels_address'), table_name='blast_labels')
op.drop_table('blast_labels')
op.drop_index(op.f('ix_blast_blocks_timestamp'), table_name='blast_blocks')
op.drop_index(op.f('ix_blast_blocks_hash'), table_name='blast_blocks')
op.drop_index(op.f('ix_blast_blocks_block_number'), table_name='blast_blocks')
op.drop_table('blast_blocks')
# ### end Alembic commands ###

Wyświetl plik

@ -14,6 +14,12 @@ from .models import (
AvalancheFujiTransaction,
AvalancheLabel,
AvalancheTransaction,
BlastBlock,
BlastLabel,
BlastSepoliaBlock,
BlastSepoliaLabel,
BlastSepoliaTransaction,
BlastTransaction,
EthereumBlock,
EthereumLabel,
EthereumTransaction,
@ -62,6 +68,8 @@ class AvailableBlockchainType(Enum):
XAI_SEPOLIA = "xai_sepolia"
AVALANCHE = "avalanche"
AVALANCHE_FUJI = "avalanche_fuji"
BLAST = "blast"
BLAST_SEPOLIA = "blast_sepolia"
def get_block_model(
@ -82,6 +90,8 @@ def get_block_model(
XaiSepoliaBlock,
AvalancheBlock,
AvalancheFujiBlock,
BlastBlock,
BlastSepoliaBlock,
]
]:
"""
@ -104,6 +114,8 @@ def get_block_model(
XaiSepoliaBlock,
AvalancheBlock,
AvalancheFujiBlock,
BlastBlock,
BlastSepoliaBlock,
]
]
if blockchain_type == AvailableBlockchainType.ETHEREUM:
@ -134,6 +146,10 @@ def get_block_model(
block_model = AvalancheBlock
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
block_model = AvalancheFujiBlock
elif blockchain_type == AvailableBlockchainType.BLAST:
block_model = BlastBlock
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
block_model = BlastSepoliaBlock
else:
raise Exception("Unsupported blockchain type provided")
@ -158,6 +174,8 @@ def get_label_model(
XaiSepoliaLabel,
AvalancheLabel,
AvalancheFujiLabel,
BlastLabel,
BlastSepoliaLabel,
]
]:
"""
@ -180,6 +198,8 @@ def get_label_model(
XaiSepoliaLabel,
AvalancheLabel,
AvalancheFujiLabel,
BlastLabel,
BlastSepoliaLabel,
]
]
if blockchain_type == AvailableBlockchainType.ETHEREUM:
@ -210,6 +230,10 @@ def get_label_model(
label_model = AvalancheLabel
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
label_model = AvalancheFujiLabel
elif blockchain_type == AvailableBlockchainType.BLAST:
label_model = BlastLabel
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
label_model = BlastSepoliaLabel
else:
raise Exception("Unsupported blockchain type provided")
@ -234,6 +258,8 @@ def get_transaction_model(
XaiSepoliaTransaction,
AvalancheTransaction,
AvalancheFujiTransaction,
BlastTransaction,
BlastSepoliaTransaction,
]
]:
"""
@ -256,6 +282,8 @@ def get_transaction_model(
XaiSepoliaTransaction,
AvalancheTransaction,
AvalancheFujiTransaction,
BlastTransaction,
BlastSepoliaTransaction,
]
]
if blockchain_type == AvailableBlockchainType.ETHEREUM:
@ -286,6 +314,10 @@ def get_transaction_model(
transaction_model = AvalancheTransaction
elif blockchain_type == AvailableBlockchainType.AVALANCHE_FUJI:
transaction_model = AvalancheFujiTransaction
elif blockchain_type == AvailableBlockchainType.BLAST:
transaction_model = BlastTransaction
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
transaction_model = BlastSepoliaTransaction
else:
raise Exception("Unsupported blockchain type provided")

Wyświetl plik

@ -1603,6 +1603,232 @@ class AvalancheFujiLabel(Base): # type: ignore
)
class BlastBlock(Base): # type: ignore
__tablename__ = "blast_blocks"
block_number = Column(
BigInteger, primary_key=True, unique=True, nullable=False, index=True
)
difficulty = Column(BigInteger)
extra_data = Column(VARCHAR(128))
gas_limit = Column(BigInteger)
gas_used = Column(BigInteger)
base_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
hash = Column(VARCHAR(256), index=True)
logs_bloom = Column(VARCHAR(1024))
miner = Column(VARCHAR(256))
nonce = Column(VARCHAR(256))
parent_hash = Column(VARCHAR(256))
receipt_root = Column(VARCHAR(256))
uncles = Column(VARCHAR(256))
size = Column(Integer)
state_root = Column(VARCHAR(256))
timestamp = Column(BigInteger, index=True)
total_difficulty = Column(VARCHAR(256))
transactions_root = Column(VARCHAR(256))
indexed_at = Column(
DateTime(timezone=True), server_default=utcnow(), nullable=False
)
sha3_uncles = Column(VARCHAR(256), nullable=True)
withdrawals_root = Column(VARCHAR(256), nullable=True)
mix_hash = Column(VARCHAR(256), nullable=True)
class BlastTransaction(Base): # type: ignore
__tablename__ = "blast_transactions"
hash = Column(
VARCHAR(256), primary_key=True, unique=True, nullable=False, index=True
)
block_number = Column(
BigInteger,
ForeignKey("blast_blocks.block_number", ondelete="CASCADE"),
nullable=False,
index=True,
)
from_address = Column(VARCHAR(256), index=True)
to_address = Column(VARCHAR(256), 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
)
y_parity = Column(BigInteger, nullable=True)
class BlastLabel(Base): # type: ignore
__tablename__ = "blast_labels"
__table_args__ = (
Index(
"ix_blast_labels_address_block_number",
"address",
"block_number",
unique=False,
),
Index(
"ix_blast_labels_address_block_timestamp",
"address",
"block_timestamp",
unique=False,
),
)
id = Column(
UUID(as_uuid=True),
primary_key=True,
default=uuid.uuid4,
unique=True,
nullable=False,
)
label = Column(VARCHAR(256), nullable=False, index=True)
block_number = Column(
BigInteger,
nullable=True,
index=True,
)
address = Column(
VARCHAR(256),
nullable=True,
index=True,
)
transaction_hash = Column(
VARCHAR(256),
nullable=True,
index=True,
)
label_data = Column(JSONB, nullable=True)
block_timestamp = Column(BigInteger, index=True)
log_index = Column(Integer, nullable=True)
created_at = Column(
DateTime(timezone=True), server_default=utcnow(), nullable=False
)
class BlastSepoliaBlock(Base): # type: ignore
__tablename__ = "blast_sepolia_blocks"
block_number = Column(
BigInteger, primary_key=True, unique=True, nullable=False, index=True
)
difficulty = Column(BigInteger)
extra_data = Column(VARCHAR(128))
gas_limit = Column(BigInteger)
gas_used = Column(BigInteger)
base_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
hash = Column(VARCHAR(256), index=True)
logs_bloom = Column(VARCHAR(1024))
miner = Column(VARCHAR(256))
nonce = Column(VARCHAR(256))
parent_hash = Column(VARCHAR(256))
receipt_root = Column(VARCHAR(256))
uncles = Column(VARCHAR(256))
size = Column(Integer)
state_root = Column(VARCHAR(256))
timestamp = Column(BigInteger, index=True)
total_difficulty = Column(VARCHAR(256))
transactions_root = Column(VARCHAR(256))
indexed_at = Column(
DateTime(timezone=True), server_default=utcnow(), nullable=False
)
sha3_uncles = Column(VARCHAR(256), nullable=True)
withdrawals_root = Column(VARCHAR(256), nullable=True)
mix_hash = Column(VARCHAR(256), nullable=True)
class BlastSepoliaTransaction(Base): # type: ignore
__tablename__ = "blast_sepolia_transactions"
hash = Column(
VARCHAR(256), primary_key=True, unique=True, nullable=False, index=True
)
block_number = Column(
BigInteger,
ForeignKey("blast_sepolia_blocks.block_number", ondelete="CASCADE"),
nullable=False,
index=True,
)
from_address = Column(VARCHAR(256), index=True)
to_address = Column(VARCHAR(256), 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
)
y_parity = Column(BigInteger, nullable=True)
class BlastSepoliaLabel(Base): # type: ignore
__tablename__ = "blast_sepolia_labels"
__table_args__ = (
Index(
"ix_blast_sepolia_labels_address_block_number",
"address",
"block_number",
unique=False,
),
Index(
"ix_blast_sepolia_labels_address_block_timestamp",
"address",
"block_timestamp",
unique=False,
),
)
id = Column(
UUID(as_uuid=True),
primary_key=True,
default=uuid.uuid4,
unique=True,
nullable=False,
)
label = Column(VARCHAR(256), nullable=False, index=True)
block_number = Column(
BigInteger,
nullable=True,
index=True,
)
address = Column(
VARCHAR(256),
nullable=True,
index=True,
)
transaction_hash = Column(
VARCHAR(256),
nullable=True,
index=True,
)
label_data = Column(JSONB, nullable=True)
block_timestamp = Column(BigInteger, index=True)
log_index = Column(Integer, nullable=True)
created_at = Column(
DateTime(timezone=True), server_default=utcnow(), nullable=False
)
class ESDFunctionSignature(Base): # type: ignore
"""
Function signature from blockchain (Ethereum/Polygon) Signature Database.

Wyświetl plik

@ -15,6 +15,12 @@ from .models import (
AvalancheLabel,
AvalancheTransaction,
Base,
BlastBlock,
BlastLabel,
BlastSepoliaBlock,
BlastSepoliaLabel,
BlastSepoliaTransaction,
BlastTransaction,
EthereumBlock,
EthereumLabel,
EthereumTransaction,
@ -63,6 +69,8 @@ class Network(Enum):
xai_sepolia = "xai_sepolia"
avalanche = "avalanche"
avalanche_fuji = "avalanche_fuji"
blast = "blast"
blast_sepolia = "blast_sepolia"
tx_raw_types = Union[
@ -80,6 +88,8 @@ tx_raw_types = Union[
XaiSepoliaTransaction,
AvalancheTransaction,
AvalancheFujiTransaction,
BlastTransaction,
BlastSepoliaTransaction,
]
MODELS: Dict[Network, Dict[str, Base]] = {
@ -153,4 +163,14 @@ MODELS: Dict[Network, Dict[str, Base]] = {
"labels": AvalancheFujiLabel,
"transactions": AvalancheFujiTransaction,
},
Network.blast: {
"blocks": BlastBlock,
"labels": BlastLabel,
"transactions": BlastTransaction,
},
Network.blast_sepolia: {
"blocks": BlastSepoliaBlock,
"labels": BlastSepoliaLabel,
"transactions": BlastSepoliaTransaction,
},
}

Wyświetl plik

@ -2,4 +2,4 @@
Moonstream database version.
"""
MOONSTREAMDB_VERSION = "0.3.11"
MOONSTREAMDB_VERSION = "0.3.12"

Wyświetl plik

@ -30,6 +30,11 @@ echo
echo -e "${PREFIX_INFO} Install checkenv"
HOME=/home/ubuntu /usr/local/go/bin/go install github.com/bugout-dev/checkenv@latest
echo
echo
echo -e "${PREFIX_INFO} Add instance local IP to parameters"
echo "AWS_LOCAL_IPV4=$(ec2metadata --local-ipv4)" > "${PARAMETERS_ENV_PATH}"
echo
echo
echo -e "${PREFIX_INFO} Retrieving addition deployment parameters"
@ -39,11 +44,6 @@ if [ ! -d "${SECRETS_DIR}" ]; then
fi
AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" /home/ubuntu/go/bin/checkenv show aws_ssm+nodebalancer:true >> "${PARAMETERS_ENV_PATH}"
echo
echo
echo -e "${PREFIX_INFO} Add instance local IP to parameters"
echo "AWS_LOCAL_IPV4=$(ec2metadata --local-ipv4)" >> "${PARAMETERS_ENV_PATH}"
echo
echo
echo -e "${PREFIX_INFO} Building executable load balancer for nodes script with Go"