Table of Contents
Starknet node
DipDup can connect to Starknet nodes via JSON-RPC. It can be used as a last mile datasource for Starknet indexes (data that is not in Subsquid Network yet) or as a standalone datasource for handlers and hooks.
The example below shows how to connect to Alchemy node for Starknet mainnet, but you can use any as long as it has all the necessary data.
dipdup.yaml
datasources:
url: ${SUBSQUID_URL:-https://v2.archive.subsquid.io/network/starknet-mainnet}
node:
kind: starknet.node
Then, add it to Starknet index definitions:
dipdup.yaml
indexes:
starknet_usdt_events:
kind: starknet.events
datasources:
- subsquid
- node
handlers:
- callback: on_transfer
contract: stark_usdt
name: Transfer
starknetpy
client
starknetpy
clientDipDup uses patched starknetpy
client to interact with Starknet nodes. You can use it in your handlers and hooks to fetch additional data from Starknet.
from dipdup.datasources.starknet_node import StarknetNodeDatasource
# Get Starknet node datasource
node = ctx.get_datasource('node', StarknetNodeDatasource)
# Perform arbitrary call with starknetpy
chain_id = await node.starknetpy.get_chain_id()
Avoid initializing starknetpy
clients manually. Instead, add a datasource to your project configuration and use the client instance attached to it.
Help and tips -> Join our Discord
Ideas or suggestions -> Issue Tracker
GraphQL IDE -> Open Playground