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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

substrate_interface_subsquid-0.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file substrate-interface-subsquid-0.1.tar.gz.

File metadata

File hashes

Hashes for substrate-interface-subsquid-0.1.tar.gz
Algorithm Hash digest
SHA256 6c835ad6ed6b4063af7c0804631c45ea3f2d306a7d086e39c23e894b7f0b0840
MD5 afb55166e3702a73e69508d30d46d4b9
BLAKE2b-256 9a2a4a1ba141818d288fd4d7d6cbf9d543fc0d76f35295714364f6def7994fe5

See more details on using hashes here.

File details

Details for the file substrate_interface_subsquid-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for substrate_interface_subsquid-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ae6f5ef523780bc69a335b17709040dc3eed9020a736e04f98945ad90670470
MD5 00b64d10eaa65ed05045881311f52c4f
BLAKE2b-256 1a304fa51bef47346f959801a910634307f2a4a0df0ae1698a429ead0a5ea9fe

See more details on using hashes here.

Supported by

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