Skip to content

Conversation

@brunopgalvao
Copy link
Contributor

📝 Description

Add comprehensive guide for calling runtime APIs using PAPI, Polkadot.js, Dedot, Python Substrate Interface, and Subxt.

Examples demonstrate AccountNonceApi and Metadata runtime API calls with complete, tested code snippets for each SDK.

🔍 Review Preference

Choose one:

  • ✅ I have time to handle formatting/style feedback myself
  • ⚡ Docs team handles formatting (check "Allow edits from maintainers")

🤖 AI-Ready Docs

If content changed, regenerate AI files:

  • ✅ I ran python3 scripts/generate_llms.py
  • ⚡ Docs team will regenerate (check "Allow edits from maintainers")

✅ Checklist

Add comprehensive guide for calling runtime APIs using PAPI,
Polkadot.js, Dedot, Python Substrate Interface, and Subxt.

Examples demonstrate AccountNonceApi and Metadata runtime API
calls with complete, tested code snippets for each SDK.
@brunopgalvao brunopgalvao self-assigned this Dec 11, 2025
@brunopgalvao brunopgalvao added B0 - Needs Review Pull request is ready for review C1 - Medium Medium priority task A0 - New Content Pull request contains new content pages labels Dec 11, 2025
@brunopgalvao brunopgalvao marked this pull request as ready for review December 11, 2025 09:32
@brunopgalvao brunopgalvao requested a review from a team as a code owner December 11, 2025 09:32
Copy link
Collaborator

@nhussein11 nhussein11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. We agreed on using paseo asset hub for the chain interaction tutorials. Could you please refactor this guide where needed?

- Update all examples to use Paseo Asset Hub endpoint (wss://asset-hub-paseo.dotters.network)
- Change PAPI types generation to use polkadotTestNet descriptor
- Update console output messages to show "Connected to Polkadot Hub TestNet"
- Update HTML output snippets to reflect testnet connection
- Update Python output to show asset-hub-paseo spec name
@brunopgalvao
Copy link
Contributor Author

Overall looks good. We agreed on using paseo asset hub for the chain interaction tutorials. Could you please refactor this guide where needed?

Updated.

Copy link
Collaborator

@nhussein11 nhussein11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brunopgalvao approved, left some minor comments. Many thanks!

- **[Python Substrate Interface](/reference/tools/py-substrate-interface/){target=\_blank}** - Python library for Substrate chains
- **[Subxt](/reference/tools/subxt/){target=\_blank}** - Rust library with compile-time type safety

Select your preferred SDK below to see complete, runnable examples that query Polkadot Hub TestNet (Paseo Asset Hub) for account nonces and metadata information.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Select your preferred SDK below to see complete, runnable examples that query Polkadot Hub TestNet (Paseo Asset Hub) for account nonces and metadata information.
Select your preferred SDK below to see complete, runnable examples that query Polkadot Hub TestNet for account nonces and metadata information.

import { withPolkadotSdkCompat } from 'polkadot-api/polkadot-sdk-compat';
import { polkadotTestNet } from '@polkadot-api/descriptors';

const ASSET_HUB_RPC = 'INSERT_WS_ENDPOINT';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be "POLKADOT_TESTNET_RPC"

@@ -0,0 +1,34 @@
import { ApiPromise, WsProvider } from '@polkadot/api';

const ASSET_HUB_RPC = 'INSERT_WS_ENDPOINT';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here



def main():
# Connect to Polkadot Hub TestNet (Paseo Asset Hub)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Connect to Polkadot Hub TestNet (Paseo Asset Hub)
# Connect to Polkadot Hub TestNet

@@ -0,0 +1,33 @@
from substrateinterface import SubstrateInterface

ASSET_HUB_RPC = "INSERT_WS_ENDPOINT"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

3. Download the Polkadot Hub TestNet metadata:

```bash
subxt metadata --url INSERT_WS_ENDPOINT -o asset_hub_metadata.scale
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this should be something like: polkadot_testnet_metadata.scale but I failed to do that in other tests, any idea what might be the reason?

subxt metadata --url INSERT_WS_ENDPOINT -o asset_hub_metadata.scale
```

Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, such as `wss://asset-hub-paseo.dotters.network` for Polkadot Hub TestNet (Paseo Asset Hub).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, such as `wss://asset-hub-paseo.dotters.network` for Polkadot Hub TestNet (Paseo Asset Hub).
Ensure to replace `INSERT_WS_ENDPOINT` with the proper WebSocket endpoint, such as `wss://asset-hub-paseo.dotters.network` for Polkadot Hub TestNet.

import { DedotClient, WsProvider } from 'dedot';
import type { PolkadotAssetHubApi } from '@dedot/chaintypes';

const ASSET_HUB_RPC = 'INSERT_WS_ENDPOINT';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

const ADDRESS = 'INSERT_ADDRESS';

async function main() {
// Initialize provider and client with Asset Hub types
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Initialize provider and client with Asset Hub types
// Initialize provider and client with Polkadot TestNet types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A0 - New Content Pull request contains new content pages B0 - Needs Review Pull request is ready for review C1 - Medium Medium priority task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants