Skip to content

SubsquidExtension

This extension enables utilisation of Giant Squid indexes provided by Subsquid

Maintained by Polkascan Foundation.

Installation

1
pip install substrate-interface-subsquid

Initialization

1
2
3
4
5
6
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'))

Implemented extension calls

Filter events

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

Filter extrinsics

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

Search block number

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

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