Merge branch 'main' into rename-column

pull/1127/head
Andrey 2024-09-13 20:15:57 +03:00
commit 59063dcc66
25 zmienionych plików z 678 dodań i 6 usunięć

Wyświetl plik

@ -148,6 +148,8 @@ if [ ! -d "${SECRETS_DIR}" ]; then
echo -e "${PREFIX_WARN} Created new secrets directory"
fi
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}"
MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS=$(AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" aws ssm get-parameter --name "MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS" --output text --query Parameter.Value)
echo "MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS=$MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS" >> "${PARAMETERS_ENV_PATH}"
chmod 0640 "${PARAMETERS_ENV_PATH}"
echo

Wyświetl plik

@ -121,6 +121,8 @@ if [ ! -d "${SECRETS_DIR}" ]; then
echo -e "${PREFIX_WARN} Created new secrets directory"
fi
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}"
MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS=$(AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" aws ssm get-parameter --name "MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS" --output text --query Parameter.Value)
echo "MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS=$MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS" >> "${PARAMETERS_ENV_PATH}"
chmod 0640 "${PARAMETERS_ENV_PATH}"
echo

Wyświetl plik

@ -69,6 +69,8 @@ if [ ! -d "${SECRETS_DIR}" ]; then
echo -e "${PREFIX_WARN} Created new secrets directory"
fi
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}"
MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS=$(AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" aws ssm get-parameter --name "MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS" --output text --query Parameter.Value)
echo "MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS=$MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS" >> "${PARAMETERS_ENV_PATH}"
chmod 0640 "${PARAMETERS_ENV_PATH}"
echo

Wyświetl plik

@ -88,6 +88,8 @@ if [ ! -d "${SECRETS_DIR}" ]; then
echo -e "${PREFIX_WARN} Created new secrets directory"
fi
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}"
MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS=$(AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" aws ssm get-parameter --name "MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS" --output text --query Parameter.Value)
echo "MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS=$MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS" >> "${PARAMETERS_ENV_PATH}"
chmod 0640 "${PARAMETERS_ENV_PATH}"
echo

Wyświetl plik

@ -242,6 +242,8 @@ if [ ! -d "${SECRETS_DIR}" ]; then
echo -e "${PREFIX_WARN} Created new secrets directory"
fi
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}"
MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS=$(AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" aws ssm get-parameter --name "MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS" --output text --query Parameter.Value)
echo "MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS=$MOONSTREAM_DB_STATEMENT_TIMEOUT_MILLIS_CRAWLERS" >> "${PARAMETERS_ENV_PATH}"
chmod 0640 "${PARAMETERS_ENV_PATH}"
echo

Wyświetl plik

@ -40,6 +40,8 @@ export MOONSTREAM_MANTLE_SEPOLIA_WEB3_PROVIDER_URI="https://<connection_path_uri
export MOONSTREAM_IMX_ZKEVM_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_IMX_ZKEVM_SEPOLIA_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_B3_WEB3_PROVIDER_URI="https://<connection_path_uri_to_node>"
export MOONSTREAM_B3_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>"

Wyświetl plik

@ -293,6 +293,28 @@ CANONICAL_SUBSCRIPTION_TYPES = {
stripe_price_id=None,
active=True,
),
"b3_smartcontract": SubscriptionTypeResourceData(
id="b3_smartcontract",
name="B3 smartcontracts",
blockchain="b3",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of B3 blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/b3-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"b3_sepolia_smartcontract": SubscriptionTypeResourceData(
id="b3_sepolia_smartcontract",
name="B3 Sepolia smartcontracts",
blockchain="b3_sepolia",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of B3 Sepolia blockchain.",
icon_url="https://static.simiotics.com/moonstream/assets/b3-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"ethereum_blockchain": SubscriptionTypeResourceData(
id="ethereum_blockchain",
name="Ethereum transactions",

Wyświetl plik

@ -275,6 +275,16 @@ if MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI == "":
"MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI env variable is not set"
)
MOONSTREAM_B3_WEB3_PROVIDER_URI = os.environ.get("MOONSTREAM_B3_WEB3_PROVIDER_URI", "")
if MOONSTREAM_B3_WEB3_PROVIDER_URI == "":
raise Exception("MOONSTREAM_B3_WEB3_PROVIDER_URI env variable is not set")
MOONSTREAM_B3_SEPOLIA_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_B3_SEPOLIA_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_B3_SEPOLIA_WEB3_PROVIDER_URI == "":
raise Exception("MOONSTREAM_B3_SEPOLIA_WEB3_PROVIDER_URI env variable is not set")
## QueryAPI

Wyświetl plik

@ -2,4 +2,4 @@
Moonstream library and API version.
"""
MOONSTREAMAPI_VERSION = "0.4.8"
MOONSTREAMAPI_VERSION = "0.4.9"

Wyświetl plik

@ -37,6 +37,8 @@ from .settings import (
MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI,
MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI,
MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI,
MOONSTREAM_B3_WEB3_PROVIDER_URI,
MOONSTREAM_B3_SEPOLIA_WEB3_PROVIDER_URI,
NB_ACCESS_ID_HEADER,
multicall_contract_abi,
multicall_contracts,
@ -127,6 +129,10 @@ def connect(
web3_uri = MOONSTREAM_IMX_ZKEVM_SEPOLIA_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.GAME7_TESTNET:
web3_uri = MOONSTREAM_GAME7_TESTNET_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.B3:
web3_uri = MOONSTREAM_B3_WEB3_PROVIDER_URI
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
web3_uri = MOONSTREAM_B3_SEPOLIA_WEB3_PROVIDER_URI
else:
raise Exception("Wrong blockchain type provided for web3 URI")

Wyświetl plik

@ -38,7 +38,7 @@ Mako==1.2.3
MarkupSafe==2.1.1
moonstream==0.1.1
moonstreamdb==0.4.5
moonstreamdb-v3==0.0.16
moonstreamdb-v3==0.0.18
multiaddr==0.0.9
multidict==6.0.2
netaddr==0.8.0

Wyświetl plik

@ -17,7 +17,7 @@ setup(
"fastapi",
"moonstream",
"moonstreamdb>=0.4.5",
"moonstreamdb-v3>=0.0.16",
"moonstreamdb-v3>=0.0.18",
"humbug",
"pydantic==1.10.2",
"pyevmasm",

Wyświetl plik

@ -31,6 +31,8 @@ from moonstreamdbv3.models import (
ArbitrumSepoliaLabel,
AvalancheFujiLabel,
AvalancheLabel,
B3Label,
B3SepoliaLabel,
BaseLabel,
BlastLabel,
BlastSepoliaLabel,
@ -84,6 +86,8 @@ def include_symbol(tablename, schema):
MantleSepoliaLabel.__tablename__,
ImxZkevmLabel.__tablename__,
ImxZkevmSepoliaLabel.__tablename__,
B3Label.__tablename__,
B3SepoliaLabel.__tablename__,
}

Wyświetl plik

@ -0,0 +1,307 @@
"""add-b3
Revision ID: 1d53afc1eff4
Revises: db9559f9566c
Create Date: 2024-09-11 14:19:12.762655
"""
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 = "1d53afc1eff4"
down_revision: Union[str, None] = "db9559f9566c"
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(
"b3_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.LargeBinary(), nullable=True),
sa.Column("origin_address", sa.LargeBinary(), nullable=True),
sa.Column("address", sa.LargeBinary(), nullable=False),
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_b3_labels")),
sa.UniqueConstraint("id", name=op.f("uq_b3_labels_id")),
)
op.create_index(
"ix_b3_labels_addr_block_num",
"b3_labels",
["address", "block_number"],
unique=False,
)
op.create_index(
"ix_b3_labels_addr_block_ts",
"b3_labels",
["address", "block_timestamp"],
unique=False,
)
op.create_index(
op.f("ix_b3_labels_address"), "b3_labels", ["address"], unique=False
)
op.create_index(
op.f("ix_b3_labels_block_number"), "b3_labels", ["block_number"], unique=False
)
op.create_index(
op.f("ix_b3_labels_caller_address"),
"b3_labels",
["caller_address"],
unique=False,
)
op.create_index(op.f("ix_b3_labels_label"), "b3_labels", ["label"], unique=False)
op.create_index(
op.f("ix_b3_labels_label_name"), "b3_labels", ["label_name"], unique=False
)
op.create_index(
op.f("ix_b3_labels_label_type"), "b3_labels", ["label_type"], unique=False
)
op.create_index(
op.f("ix_b3_labels_origin_address"),
"b3_labels",
["origin_address"],
unique=False,
)
op.create_index(
op.f("ix_b3_labels_transaction_hash"),
"b3_labels",
["transaction_hash"],
unique=False,
)
op.create_index(
"uk_b3_labels_tx_hash_log_idx_evt",
"b3_labels",
["transaction_hash", "log_index"],
unique=True,
postgresql_where=sa.text("label='seer' and label_type='event'"),
)
op.create_index(
"uk_b3_labels_tx_hash_log_idx_evt_raw",
"b3_labels",
["transaction_hash", "log_index"],
unique=True,
postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
)
op.create_index(
"uk_b3_labels_tx_hash_tx_call",
"b3_labels",
["transaction_hash"],
unique=True,
postgresql_where=sa.text("label='seer' and label_type='tx_call'"),
)
op.create_index(
"uk_b3_labels_tx_hash_tx_call_raw",
"b3_labels",
["transaction_hash"],
unique=True,
postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
)
op.create_table(
"b3_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.LargeBinary(), nullable=True),
sa.Column("origin_address", sa.LargeBinary(), nullable=True),
sa.Column("address", sa.LargeBinary(), nullable=False),
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_b3_sepolia_labels")),
sa.UniqueConstraint("id", name=op.f("uq_b3_sepolia_labels_id")),
)
op.create_index(
"ix_b3_sepolia_labels_addr_block_num",
"b3_sepolia_labels",
["address", "block_number"],
unique=False,
)
op.create_index(
"ix_b3_sepolia_labels_addr_block_ts",
"b3_sepolia_labels",
["address", "block_timestamp"],
unique=False,
)
op.create_index(
op.f("ix_b3_sepolia_labels_address"),
"b3_sepolia_labels",
["address"],
unique=False,
)
op.create_index(
op.f("ix_b3_sepolia_labels_block_number"),
"b3_sepolia_labels",
["block_number"],
unique=False,
)
op.create_index(
op.f("ix_b3_sepolia_labels_caller_address"),
"b3_sepolia_labels",
["caller_address"],
unique=False,
)
op.create_index(
op.f("ix_b3_sepolia_labels_label"), "b3_sepolia_labels", ["label"], unique=False
)
op.create_index(
op.f("ix_b3_sepolia_labels_label_name"),
"b3_sepolia_labels",
["label_name"],
unique=False,
)
op.create_index(
op.f("ix_b3_sepolia_labels_label_type"),
"b3_sepolia_labels",
["label_type"],
unique=False,
)
op.create_index(
op.f("ix_b3_sepolia_labels_origin_address"),
"b3_sepolia_labels",
["origin_address"],
unique=False,
)
op.create_index(
op.f("ix_b3_sepolia_labels_transaction_hash"),
"b3_sepolia_labels",
["transaction_hash"],
unique=False,
)
op.create_index(
"uk_b3_sepolia_labels_tx_hash_log_idx_evt",
"b3_sepolia_labels",
["transaction_hash", "log_index"],
unique=True,
postgresql_where=sa.text("label='seer' and label_type='event'"),
)
op.create_index(
"uk_b3_sepolia_labels_tx_hash_log_idx_evt_raw",
"b3_sepolia_labels",
["transaction_hash", "log_index"],
unique=True,
postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
)
op.create_index(
"uk_b3_sepolia_labels_tx_hash_tx_call",
"b3_sepolia_labels",
["transaction_hash"],
unique=True,
postgresql_where=sa.text("label='seer' and label_type='tx_call'"),
)
op.create_index(
"uk_b3_sepolia_labels_tx_hash_tx_call_raw",
"b3_sepolia_labels",
["transaction_hash"],
unique=True,
postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
"uk_b3_sepolia_labels_tx_hash_tx_call_raw",
table_name="b3_sepolia_labels",
postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
)
op.drop_index(
"uk_b3_sepolia_labels_tx_hash_tx_call",
table_name="b3_sepolia_labels",
postgresql_where=sa.text("label='seer' and label_type='tx_call'"),
)
op.drop_index(
"uk_b3_sepolia_labels_tx_hash_log_idx_evt_raw",
table_name="b3_sepolia_labels",
postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
)
op.drop_index(
"uk_b3_sepolia_labels_tx_hash_log_idx_evt",
table_name="b3_sepolia_labels",
postgresql_where=sa.text("label='seer' and label_type='event'"),
)
op.drop_index(
op.f("ix_b3_sepolia_labels_transaction_hash"), table_name="b3_sepolia_labels"
)
op.drop_index(
op.f("ix_b3_sepolia_labels_origin_address"), table_name="b3_sepolia_labels"
)
op.drop_index(
op.f("ix_b3_sepolia_labels_label_type"), table_name="b3_sepolia_labels"
)
op.drop_index(
op.f("ix_b3_sepolia_labels_label_name"), table_name="b3_sepolia_labels"
)
op.drop_index(op.f("ix_b3_sepolia_labels_label"), table_name="b3_sepolia_labels")
op.drop_index(
op.f("ix_b3_sepolia_labels_caller_address"), table_name="b3_sepolia_labels"
)
op.drop_index(
op.f("ix_b3_sepolia_labels_block_number"), table_name="b3_sepolia_labels"
)
op.drop_index(op.f("ix_b3_sepolia_labels_address"), table_name="b3_sepolia_labels")
op.drop_index("ix_b3_sepolia_labels_addr_block_ts", table_name="b3_sepolia_labels")
op.drop_index("ix_b3_sepolia_labels_addr_block_num", table_name="b3_sepolia_labels")
op.drop_table("b3_sepolia_labels")
op.drop_index(
"uk_b3_labels_tx_hash_tx_call_raw",
table_name="b3_labels",
postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
)
op.drop_index(
"uk_b3_labels_tx_hash_tx_call",
table_name="b3_labels",
postgresql_where=sa.text("label='seer' and label_type='tx_call'"),
)
op.drop_index(
"uk_b3_labels_tx_hash_log_idx_evt_raw",
table_name="b3_labels",
postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
)
op.drop_index(
"uk_b3_labels_tx_hash_log_idx_evt",
table_name="b3_labels",
postgresql_where=sa.text("label='seer' and label_type='event'"),
)
op.drop_index(op.f("ix_b3_labels_transaction_hash"), table_name="b3_labels")
op.drop_index(op.f("ix_b3_labels_origin_address"), table_name="b3_labels")
op.drop_index(op.f("ix_b3_labels_label_type"), table_name="b3_labels")
op.drop_index(op.f("ix_b3_labels_label_name"), table_name="b3_labels")
op.drop_index(op.f("ix_b3_labels_label"), table_name="b3_labels")
op.drop_index(op.f("ix_b3_labels_caller_address"), table_name="b3_labels")
op.drop_index(op.f("ix_b3_labels_block_number"), table_name="b3_labels")
op.drop_index(op.f("ix_b3_labels_address"), table_name="b3_labels")
op.drop_index("ix_b3_labels_addr_block_ts", table_name="b3_labels")
op.drop_index("ix_b3_labels_addr_block_num", table_name="b3_labels")
op.drop_table("b3_labels")
# ### end Alembic commands ###

Wyświetl plik

@ -36,6 +36,10 @@ from moonstreamdbv3.models_indexes import (
ArbitrumSepoliaLogIndex,
ArbitrumSepoliaReorgs,
ArbitrumSepoliaTransactionIndex,
B3BlockIndex,
B3Reorgs,
B3SepoliaBlockIndex,
B3SepoliaReorgs,
EthereumBlockIndex,
EthereumLogIndex,
EthereumReorgs,
@ -131,6 +135,10 @@ def include_symbol(tablename, schema):
ImxZkevmSepoliaTransactionIndex.__tablename__,
ImxZkevmSepoliaLogIndex.__tablename__,
ImxZkevmSepoliaReorgs.__tablename__,
B3BlockIndex.__tablename__,
B3Reorgs.__tablename__,
B3SepoliaBlockIndex.__tablename__,
B3SepoliaReorgs.__tablename__,
}

Wyświetl plik

@ -0,0 +1,139 @@
"""add-b3
Revision ID: 25b339f55f8f
Revises: 48d2562504d1
Create Date: 2024-09-11 13:58:54.884367
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "25b339f55f8f"
down_revision: Union[str, None] = "48d2562504d1"
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(
"b3_blocks",
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("parent_hash", sa.VARCHAR(length=256), nullable=False),
sa.Column("row_id", sa.BigInteger(), nullable=False),
sa.Column("path", sa.Text(), nullable=False),
sa.Column("transactions_indexed_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("logs_indexed_at", sa.DateTime(timezone=True), nullable=True),
sa.Column(
"indexed_at",
sa.DateTime(timezone=True),
server_default=sa.text("TIMEZONE('utc', statement_timestamp())"),
nullable=False,
),
sa.PrimaryKeyConstraint("block_number", name=op.f("pk_b3_blocks")),
)
op.create_index(
op.f("ix_b3_blocks_block_number"), "b3_blocks", ["block_number"], unique=False
)
op.create_index(
op.f("ix_b3_blocks_block_timestamp"),
"b3_blocks",
["block_timestamp"],
unique=False,
)
op.create_table(
"b3_reorgs",
sa.Column("id", sa.UUID(), nullable=False),
sa.Column("block_number", sa.BigInteger(), nullable=False),
sa.Column("block_hash", sa.VARCHAR(length=256), nullable=False),
sa.PrimaryKeyConstraint("id", name=op.f("pk_b3_reorgs")),
)
op.create_index(
op.f("ix_b3_reorgs_block_hash"), "b3_reorgs", ["block_hash"], unique=False
)
op.create_index(
op.f("ix_b3_reorgs_block_number"), "b3_reorgs", ["block_number"], unique=False
)
op.create_table(
"b3_sepolia_blocks",
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("parent_hash", sa.VARCHAR(length=256), nullable=False),
sa.Column("row_id", sa.BigInteger(), nullable=False),
sa.Column("path", sa.Text(), nullable=False),
sa.Column("transactions_indexed_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("logs_indexed_at", sa.DateTime(timezone=True), nullable=True),
sa.Column(
"indexed_at",
sa.DateTime(timezone=True),
server_default=sa.text("TIMEZONE('utc', statement_timestamp())"),
nullable=False,
),
sa.PrimaryKeyConstraint("block_number", name=op.f("pk_b3_sepolia_blocks")),
)
op.create_index(
op.f("ix_b3_sepolia_blocks_block_number"),
"b3_sepolia_blocks",
["block_number"],
unique=False,
)
op.create_index(
op.f("ix_b3_sepolia_blocks_block_timestamp"),
"b3_sepolia_blocks",
["block_timestamp"],
unique=False,
)
op.create_table(
"b3_sepolia_reorgs",
sa.Column("id", sa.UUID(), nullable=False),
sa.Column("block_number", sa.BigInteger(), nullable=False),
sa.Column("block_hash", sa.VARCHAR(length=256), nullable=False),
sa.PrimaryKeyConstraint("id", name=op.f("pk_b3_sepolia_reorgs")),
)
op.create_index(
op.f("ix_b3_sepolia_reorgs_block_hash"),
"b3_sepolia_reorgs",
["block_hash"],
unique=False,
)
op.create_index(
op.f("ix_b3_sepolia_reorgs_block_number"),
"b3_sepolia_reorgs",
["block_number"],
unique=False,
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
op.f("ix_b3_sepolia_reorgs_block_number"), table_name="b3_sepolia_reorgs"
)
op.drop_index(
op.f("ix_b3_sepolia_reorgs_block_hash"), table_name="b3_sepolia_reorgs"
)
op.drop_table("b3_sepolia_reorgs")
op.drop_index(
op.f("ix_b3_sepolia_blocks_block_timestamp"), table_name="b3_sepolia_blocks"
)
op.drop_index(
op.f("ix_b3_sepolia_blocks_block_number"), table_name="b3_sepolia_blocks"
)
op.drop_table("b3_sepolia_blocks")
op.drop_index(op.f("ix_b3_reorgs_block_number"), table_name="b3_reorgs")
op.drop_index(op.f("ix_b3_reorgs_block_hash"), table_name="b3_reorgs")
op.drop_table("b3_reorgs")
op.drop_index(op.f("ix_b3_blocks_block_timestamp"), table_name="b3_blocks")
op.drop_index(op.f("ix_b3_blocks_block_number"), table_name="b3_blocks")
op.drop_table("b3_blocks")
# ### end Alembic commands ###

Wyświetl plik

@ -28,6 +28,8 @@ from .models import (
StarknetSepoliaLabel,
MantleLabel,
MantleSepoliaLabel,
B3Label,
B3SepoliaLabel,
)
@ -57,6 +59,8 @@ class AvailableBlockchainType(Enum):
MANTLE_SEPOLIA = "mantle_sepolia"
GAME7_ORBIT_ARBITRUM_SEPOLIA = "game7_orbit_arbitrum_sepolia"
GAME7_TESTNET = "game7_testnet"
B3 = "b3"
B3_SEPOLIA = "b3_sepolia"
def get_label_model(blockchain_type: AvailableBlockchainType) -> Type[
@ -86,6 +90,8 @@ def get_label_model(blockchain_type: AvailableBlockchainType) -> Type[
StarknetSepoliaLabel,
MantleLabel,
MantleSepoliaLabel,
B3Label,
B3SepoliaLabel,
]
]:
"""
@ -119,6 +125,8 @@ def get_label_model(blockchain_type: AvailableBlockchainType) -> Type[
StarknetSepoliaLabel,
MantleLabel,
MantleSepoliaLabel,
B3Label,
B3SepoliaLabel,
]
]
@ -170,6 +178,10 @@ def get_label_model(blockchain_type: AvailableBlockchainType) -> Type[
label_model = Game7OrbitArbitrumSepoliaLabel
elif blockchain_type == AvailableBlockchainType.GAME7_TESTNET:
label_model = Game7TestnetLabel
elif blockchain_type == AvailableBlockchainType.B3:
label_model = B3Label
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
label_model = B3SepoliaLabel
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")

Wyświetl plik

@ -1332,3 +1332,93 @@ class Game7TestnetLabel(EvmBasedLabel): # type: ignore
postgresql_where=text("label='seer-raw' and label_type='event'"),
),
)
class B3Label(EvmBasedLabel): # type: ignore
__tablename__ = "b3_labels"
__table_args__ = (
Index(
"ix_b3_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_b3_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
Index(
"uk_b3_labels_tx_hash_tx_call",
"transaction_hash",
unique=True,
postgresql_where=text("label='seer' and label_type='tx_call'"),
),
Index(
"uk_b3_labels_tx_hash_log_idx_evt",
"transaction_hash",
"log_index",
unique=True,
postgresql_where=text("label='seer' and label_type='event'"),
),
Index(
"uk_b3_labels_tx_hash_tx_call_raw",
"transaction_hash",
unique=True,
postgresql_where=text("label='seer-raw' and label_type='tx_call'"),
),
Index(
"uk_b3_labels_tx_hash_log_idx_evt_raw",
"transaction_hash",
"log_index",
unique=True,
postgresql_where=text("label='seer-raw' and label_type='event'"),
),
)
class B3SepoliaLabel(EvmBasedLabel): # type: ignore
__tablename__ = "b3_sepolia_labels"
__table_args__ = (
Index(
"ix_b3_sepolia_labels_addr_block_num",
"address",
"block_number",
unique=False,
),
Index(
"ix_b3_sepolia_labels_addr_block_ts",
"address",
"block_timestamp",
unique=False,
),
Index(
"uk_b3_sepolia_labels_tx_hash_tx_call",
"transaction_hash",
unique=True,
postgresql_where=text("label='seer' and label_type='tx_call'"),
),
Index(
"uk_b3_sepolia_labels_tx_hash_log_idx_evt",
"transaction_hash",
"log_index",
unique=True,
postgresql_where=text("label='seer' and label_type='event'"),
),
Index(
"uk_b3_sepolia_labels_tx_hash_tx_call_raw",
"transaction_hash",
unique=True,
postgresql_where=text("label='seer-raw' and label_type='tx_call'"),
),
Index(
"uk_b3_sepolia_labels_tx_hash_log_idx_evt_raw",
"transaction_hash",
"log_index",
unique=True,
postgresql_where=text("label='seer-raw' and label_type='event'"),
),
)

Wyświetl plik

@ -775,6 +775,22 @@ class Game7TestnetReorgs(EvmBasedReorgs):
__tablename__ = "game7_testnet_reorgs"
class B3BlockIndex(EvmBasedBlocks):
__tablename__ = "b3_blocks"
class B3Reorgs(EvmBasedReorgs):
__tablename__ = "b3_reorgs"
class B3SepoliaBlockIndex(EvmBasedBlocks):
__tablename__ = "b3_sepolia_blocks"
class B3SepoliaReorgs(EvmBasedReorgs):
__tablename__ = "b3_sepolia_reorgs"
### ABI Jobs

Wyświetl plik

@ -1 +1 @@
0.0.17
0.0.18

Wyświetl plik

@ -20,6 +20,8 @@ from moonstreamdb.models import (
AvalancheFujiTransaction,
AvalancheLabel,
AvalancheTransaction,
B3Block,
B3SepoliaBlock,
BlastBlock,
BlastLabel,
BlastSepoliaBlock,
@ -95,6 +97,8 @@ from moonstreamdbv3.models import XaiSepoliaLabel as XaiSepoliaLabelV3
from moonstreamdbv3.models import XDaiLabel as XDaiLabelV3
from moonstreamdbv3.models import ZkSyncEraLabel as ZkSyncEraLabelV3
from moonstreamdbv3.models import ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3
from moonstreamdbv3.models import B3Label as B3LabelV3
from moonstreamdbv3.models import B3SepoliaLabel as B3SepoliaLabelV3
class AvailableBlockchainType(Enum):
@ -127,6 +131,8 @@ class AvailableBlockchainType(Enum):
MANTLE_SEPOLIA = "mantle_sepolia"
IMX_ZKEVM = "imx_zkevm"
IMX_ZKEVM_SEPOLIA = "imx_zkevm_sepolia"
B3 = "b3"
B3_SEPOLIA = "b3_sepolia"
def get_block_model(
@ -154,6 +160,8 @@ def get_block_model(
ProofOfPlayApexBlock,
MantleBlock,
MantleSepoliaBlock,
B3Block,
B3SepoliaBlock,
]
]:
"""
@ -182,6 +190,8 @@ def get_block_model(
ProofOfPlayApexBlock,
MantleBlock,
MantleSepoliaBlock,
B3Block,
B3SepoliaBlock,
]
]
if blockchain_type == AvailableBlockchainType.ETHEREUM:
@ -226,6 +236,10 @@ def get_block_model(
block_model = MantleBlock
elif blockchain_type == AvailableBlockchainType.MANTLE_SEPOLIA:
block_model = MantleSepoliaBlock
elif blockchain_type == AvailableBlockchainType.B3:
block_model = B3Block
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
block_model = B3SepoliaBlock
else:
raise Exception("Unsupported blockchain type provided")
@ -285,6 +299,8 @@ def get_label_model(
MantleSepoliaLabelV3,
ImxZkevmLabelV3,
ImxZkevmSepoliaLabelV3,
B3LabelV3,
B3SepoliaLabelV3,
]
]:
"""
@ -344,6 +360,8 @@ def get_label_model(
MantleSepoliaLabelV3,
ImxZkevmLabelV3,
ImxZkevmSepoliaLabelV3,
B3LabelV3,
B3SepoliaLabelV3,
]
]
if version == 2:
@ -446,6 +464,10 @@ def get_label_model(
label_model = ImxZkevmLabelV3
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM_SEPOLIA:
label_model = ImxZkevmSepoliaLabelV3
elif blockchain_type == AvailableBlockchainType.B3:
label_model = B3LabelV3
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
label_model = B3SepoliaLabelV3
else:
raise Exception("Unsupported blockchain type provided")
else:

Wyświetl plik

@ -96,6 +96,8 @@ from moonstreamdbv3.models import XaiSepoliaLabel as XaiSepoliaLabelV3
from moonstreamdbv3.models import XDaiLabel as XDaiLabelV3
from moonstreamdbv3.models import ZkSyncEraLabel as ZkSyncEraLabelV3
from moonstreamdbv3.models import ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3
from moonstreamdbv3.models import B3Label as B3LabelV3
from moonstreamdbv3.models import B3SepoliaLabel as B3SepoliaLabelV3
from .blockchain import AvailableBlockchainType
@ -130,6 +132,8 @@ class Network(Enum):
mantle_sepolia = "mantle_sepolia"
imx_zkevm = "imx_zkevm"
imx_zkevm_sepolia = "imx_zkevm_sepolia"
b3 = "b3"
b3_sepolia = "b3_sepolia"
tx_raw_types = Union[
@ -346,6 +350,12 @@ MODELS_V3: Dict[Network, Dict[str, Base]] = {
Network.imx_zkevm_sepolia: {
"labels": ImxZkevmSepoliaLabelV3,
},
Network.b3: {
"labels": B3LabelV3,
},
Network.b3_sepolia: {
"labels": B3SepoliaLabelV3,
},
}
@ -411,5 +421,9 @@ def blockchain_type_to_network_type(
return Network.imx_zkevm
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM_SEPOLIA:
return Network.imx_zkevm_sepolia
elif blockchain_type == AvailableBlockchainType.B3:
return Network.b3
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
return Network.b3_sepolia
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")

Wyświetl plik

@ -35,6 +35,8 @@ class SubscriptionTypes(Enum):
MANTLE_SEPOLIA_BLOCKCHAIN = "mantle_sepolia_smartcontract"
IMX_ZKEVM_BLOCKCHAIN = "imx_zkevm_smartcontract"
IMX_ZKEVM_SEPOLIA_BLOCKCHAIN = "imx_zkevm_sepolia_smartcontract"
B3_BLOCKCHAIN = "b3_smartcontract"
B3_SEPOLIA_BLOCKCHAIN = "b3_sepolia_smartcontract"
def blockchain_type_to_subscription_type(
@ -98,6 +100,10 @@ def blockchain_type_to_subscription_type(
return SubscriptionTypes.IMX_ZKEVM_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM_SEPOLIA:
return SubscriptionTypes.IMX_ZKEVM_SEPOLIA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.B3:
return SubscriptionTypes.B3_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
return SubscriptionTypes.B3_SEPOLIA_BLOCKCHAIN
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
@ -132,6 +138,8 @@ subscription_id_by_blockchain = {
"mantle_sepolia": "mantle_sepolia_smartcontract",
"imx_zkevm": "imx_zkevm_smartcontract",
"imx_zkevm_sepolia": "imx_zkevm_sepolia_smartcontract",
"b3": "b3_smartcontract",
"b3_sepolia": "b3_sepolia_smartcontract",
}
blockchain_by_subscription_id = {
@ -192,4 +200,6 @@ blockchain_by_subscription_id = {
"mantle_sepolia_smartcontract": "mantle_sepolia",
"imx_zkevm_smartcontract": "imx_zkevm",
"imx_zkevm_sepolia_smartcontract": "imx_zkevm_sepolia",
"b3_smartcontract": "b3",
"b3_sepolia_smartcontract": "b3_sepolia",
}

Wyświetl plik

@ -1 +1 @@
0.0.6
0.0.7

Wyświetl plik

@ -34,7 +34,7 @@ setup(
zip_safe=False,
install_requires=[
"moonstreamdb>=0.4.5",
"moonstreamdb-v3>=0.0.16",
"moonstreamdb-v3>=0.0.18",
],
extras_require={
"dev": ["black", "isort", "mypy"],