Updated blockchains support list

pull/1050/head
kompotkot 2024-04-10 12:39:19 +00:00
rodzic 163049b9b6
commit 2221b45bc9
30 zmienionych plików z 375 dodań i 98 usunięć

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.AvalancheFujiSepoliaTransactions.event_type: transactions.AvalancheFujiSepoliaTransactions,
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

@ -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,31 @@
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_ETHEREUM_WEB3_PROVIDER_URI,
MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI,
MOONSTREAM_POLYGON_WEB3_PROVIDER_URI,
MOONSTREAM_WYRM_WEB3_PROVIDER_URI,
MOONSTREAM_XAI_WEB3_PROVIDER_URI,
multicall_contracts,
MOONSTREAM_XDAI_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__)

Wyświetl plik

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

Wyświetl plik

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