kopia lustrzana https://github.com/bugout-dev/moonstream
Support of xdai blockchain for subscriptions and dashboards
rodzic
e39b4c6ea3
commit
30d2269d69
|
@ -48,6 +48,8 @@ blockchain_by_subscription_id = {
|
|||
"polygon_blockchain": "polygon",
|
||||
"ethereum_smartcontract": "ethereum",
|
||||
"polygon_smartcontract": "polygon",
|
||||
"xdai_blockchain": "xdai",
|
||||
"xdai_smartcontract": "xdai",
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ This CLI is configured to work with the following API URLs:
|
|||
)
|
||||
|
||||
parser_subscription_types_update = subcommands_subscription_types.add_parser(
|
||||
"update", description="Create subscription type"
|
||||
"update", description="Update subscription type"
|
||||
)
|
||||
parser_subscription_types_update.add_argument(
|
||||
"-i", "--id", required=True, type=str, help="ID for the subscription type"
|
||||
|
|
|
@ -37,6 +37,16 @@ CANONICAL_SUBSCRIPTION_TYPES = {
|
|||
stripe_price_id=None,
|
||||
active=True,
|
||||
),
|
||||
"xdai_smartcontract": SubscriptionTypeResourceData(
|
||||
id="xdai_smartcontract",
|
||||
name="XDai smartcontract",
|
||||
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",
|
||||
stripe_product_id=None,
|
||||
stripe_price_id=None,
|
||||
active=True,
|
||||
),
|
||||
"ethereum_blockchain": SubscriptionTypeResourceData(
|
||||
id="ethereum_blockchain",
|
||||
name="Ethereum transactions",
|
||||
|
@ -57,6 +67,16 @@ CANONICAL_SUBSCRIPTION_TYPES = {
|
|||
stripe_price_id=None,
|
||||
active=True,
|
||||
),
|
||||
"xdai_blockchain": SubscriptionTypeResourceData(
|
||||
id="xdai_blockchain",
|
||||
name="XDai transactions",
|
||||
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",
|
||||
stripe_product_id=None,
|
||||
stripe_price_id=None,
|
||||
active=True,
|
||||
),
|
||||
"ethereum_whalewatch": SubscriptionTypeResourceData(
|
||||
id="ethereum_whalewatch",
|
||||
name="Ethereum whale watch",
|
||||
|
|
|
@ -49,8 +49,10 @@ class ReceivingEventsException(Exception):
|
|||
event_providers: Dict[str, Any] = {
|
||||
moonworm_provider.EthereumMoonwormProvider.event_type: moonworm_provider.EthereumMoonwormProvider,
|
||||
moonworm_provider.PolygonMoonwormProvider.event_type: moonworm_provider.PolygonMoonwormProvider,
|
||||
moonworm_provider.XDaiMoonwormProvider.event_type: moonworm_provider.XDaiMoonwormProvider,
|
||||
transactions.EthereumTransactions.event_type: transactions.EthereumTransactions,
|
||||
transactions.PolygonTransactions.event_type: transactions.PolygonTransactions,
|
||||
transactions.XDaiTransactions.event_type: transactions.XDaiTransactions,
|
||||
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,
|
||||
|
|
|
@ -19,6 +19,7 @@ logger.setLevel(logging.WARN)
|
|||
|
||||
ethereum_event_type = "ethereum_blockchain"
|
||||
polygon_event_type = "polygon_blockchain"
|
||||
xdai_event_type = "xdai_blockchain"
|
||||
allowed_tags = ["tag:erc721"]
|
||||
|
||||
description = f"""Event provider for transactions from the Ethereum blockchain.
|
||||
|
@ -402,3 +403,10 @@ PolygonMoonwormProvider = MoonwormProvider(
|
|||
description="Provider for resiving transactions from Polygon tables.",
|
||||
streamboaundary_range_limit=2 * 60 * 60,
|
||||
)
|
||||
|
||||
XDaiMoonwormProvider = MoonwormProvider(
|
||||
event_type="xdai_smartcontract",
|
||||
blockchain=AvailableBlockchainType("xdai"),
|
||||
description="Provider for resiving transactions from XDai tables.",
|
||||
streamboaundary_range_limit=2 * 60 * 60,
|
||||
)
|
||||
|
|
|
@ -461,3 +461,10 @@ PolygonTransactions = TransactionsProvider(
|
|||
description="Provider for resiving transactions from Polygon tables.",
|
||||
streamboaundary_range_limit=2 * 60 * 60,
|
||||
)
|
||||
|
||||
XDaiTransactions = TransactionsProvider(
|
||||
event_type="xdai_blockchain",
|
||||
blockchain=AvailableBlockchainType("xdai"),
|
||||
description="Provider for resiving transactions from XDai tables.",
|
||||
streamboaundary_range_limit=2 * 60 * 60,
|
||||
)
|
||||
|
|
|
@ -34,14 +34,6 @@ BUGOUT_RESOURCE_TYPE_DASHBOARD = "dashboards"
|
|||
BUGOUT_RESOURCE_TYPE_SUBSCRIPTION = "subscription"
|
||||
|
||||
|
||||
blockchain_by_subscription_id = {
|
||||
"ethereum_blockchain": "ethereum",
|
||||
"polygon_blockchain": "polygon",
|
||||
"ethereum_smartcontract": "ethereum",
|
||||
"polygon_smartcontract": "polygon",
|
||||
}
|
||||
|
||||
|
||||
@router.post("/", tags=["dashboards"], response_model=BugoutResource)
|
||||
async def add_dashboard_handler(
|
||||
request: Request,
|
||||
|
@ -419,7 +411,7 @@ async def get_dashboard_data_links_handler(
|
|||
stats[subscription.id] = {}
|
||||
for timescale in available_timescales:
|
||||
try:
|
||||
result_key = f'{MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX}/{blockchain_by_subscription_id[subscription.resource_data["subscription_type_id"]]}/contracts_data/{subscription.resource_data["address"]}/{dashboard_id}/v1/{timescale}.json'
|
||||
result_key = f'{MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX}/{actions.blockchain_by_subscription_id[subscription.resource_data["subscription_type_id"]]}/contracts_data/{subscription.resource_data["address"]}/{dashboard_id}/v1/{timescale}.json'
|
||||
stats_presigned_url = s3_client.generate_presigned_url(
|
||||
"get_object",
|
||||
Params={
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
Moonstream library and API version.
|
||||
"""
|
||||
|
||||
MOONSTREAMAPI_VERSION = "0.1.3"
|
||||
MOONSTREAMAPI_VERSION = "0.1.4"
|
||||
|
|
|
@ -15,7 +15,7 @@ setup(
|
|||
"boto3",
|
||||
"bugout>=0.1.19",
|
||||
"fastapi",
|
||||
"moonstreamdb>=0.2.3",
|
||||
"moonstreamdb>=0.2.4",
|
||||
"humbug",
|
||||
"pydantic",
|
||||
"pyevmasm",
|
||||
|
|
Ładowanie…
Reference in New Issue