Skip to main content

py-substrate-interface extension to utilize Subsquid indexes

Project description

Python Substrate Interface: Subsquid Extension

Latest Version Supported Python versions License

Description

This extension enables Substrate Interface to use Giant Squid indexes provided by Subsquid

Installation

pip install substrate-interface-subsquid

Initialization

from substrateinterface import SubstrateInterface
from substrateinterface_subsquid.extensions import SubsquidExtension

substrate = SubstrateInterface(url="wss://rpc.polkadot.io")

substrate.register_extension(SubsquidExtension(url='https://squid.subsquid.io/gs-explorer-polkadot/graphql'))

Usage

Filter events

events = substrate.extensions.filter_events(
    pallet_name="Balances", event_name="Transfer", account_id="12L9MSmxHY8YvtZKpA7Vpvac2pwf4wrT3gd2Tx78sCctoXSE", 
    page_size=25
)

Filter extrinsics

extrinsics = substrate.extensions.filter_extrinsics(
    ss58_address="12L9MSmxHY8YvtZKpA7Vpvac2pwf4wrT3gd2Tx78sCctoXSE",
    pallet_name="Balances", call_name="transfer_keep_alive", page_size=25
)

Search block number

block_datetime = datetime(2020, 7, 12, 0, 0, 0, tzinfo=timezone.utc)

block_number = substrate.extensions.search_block_number(block_datetime=block_datetime)

License

https://github.com/polkascan/py-substrate-interface-extension-subsquid/blob/master/LICENSE

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

substrate-interface-subsquid-0.1.tar.gz (10.8 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page