Skip to content

Commit bf8abea

Browse files
committed
python3 scripts/generate_llms.py
1 parent 02b7d4b commit bf8abea

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

llms.txt

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,13 @@ Cross-chain asset transfers in the Polkadot ecosystem require careful planning a
357357

358358
This comprehensive guide outlines essential best practices for teleporting assets using XCM, from pre-flight checks to transaction execution. You'll learn how to avoid common pitfalls, implement proper validation, and ensure your cross-chain transfers succeed reliably.
359359

360-
361360
## Prerequisites
362361

363362
Before implementing asset teleports, ensure you have:
364363

365-
- Strong knowledge of [XCM (Cross-Consensus Messaging)](/develop/interoperability/intro-to-xcm/){target=_blank}
366-
- Firm understanding of [sufficient and non-sufficient assets](/polkadot-protocol/architecture/system-chains/asset-hub/#sufficient-and-non-sufficient-assets){target=_blank}
367-
- Understanding of [existential deposits](/polkadot-protocol/glossary/#existential-deposit){target=_blank} and the [Substrate account model](/polkadot-protocol/parachain-basics/accounts/){target=_blank}
364+
- Strong knowledge of [XCM (Cross-Consensus Messaging)](/develop/interoperability/intro-to-xcm/){target=\_blank}
365+
- Firm understanding of [sufficient and non-sufficient assets](/polkadot-protocol/architecture/system-chains/asset-hub/#sufficient-and-non-sufficient-assets){target=\_blank}
366+
- Understanding the concept of [existential deposits](/polkadot-protocol/glossary/#existential-deposit){target=\_blank} and the [Polkadot SDK account model](/polkadot-protocol/parachain-basics/accounts/){target=\_blank}
368367

369368
## Teleporting an Asset
370369

@@ -401,7 +400,7 @@ Here is an example flow of teleporting an asset from a parachain to Asset Hub.
401400

402401
M --> P[Local dry-run on <br/>source chain]
403402
P --> Q{Local dry-run success?}
404-
Q -->|No| R[Fix local issues<br/>- Insufficient balance<br/>- Invalid XCM construction]
403+
Q -->|No| R[Fix local issues, e.g.:<br/>- Insufficient balance<br/>- Invalid XCM construction]
405404
Q -->|Yes| S[Remote dry-run on <br/>Asset Hub]
406405

407406
R --> P
@@ -476,7 +475,7 @@ Existential deposits vary by network and must be maintained to keep accounts act
476475
- **Kusama**: 0.0033 KSM (3.3 * 10^10 planck)
477476
- **Asset Hub**: 0.1 DOT (10^9 planck)
478477

479-
For non-sufficient assets, ensure the destination account has sufficient native token or sufficient asset to maintain the ED, or include asset conversion instructions in the XCM.
478+
For non-sufficient assets, make sure the destination account has enough native tokens or assets to maintain the ED; otherwise, include asset conversion instructions in the XCM.
480479

481480
## Fee Estimation and Coverage
482481

@@ -485,6 +484,7 @@ For non-sufficient assets, ensure the destination account has sufficient native
485484
Use proper runtime APIs for accurate fee estimation rather than hardcoded values:
486485

487486
[Transaction Payment API](https://paritytech.github.io/polkadot-sdk/master/pallet_transaction_payment_rpc/trait.TransactionPaymentRuntimeApi.html){target=\_blank} for local fees:
487+
488488
```typescript
489489
import { dot } from "@polkadot-api/descriptors";
490490
import { createClient } from "polkadot-api";
@@ -500,6 +500,7 @@ const feeDetails = await api.apis.TransactionPaymentApi.query_fee_details(
500500
```
501501

502502
[XCM Payment API](https://paritytech.github.io/polkadot-sdk/master/xcm_runtime_apis/fees/trait.XcmPaymentApi.html){target=\_blank} for cross-chain delivery fees:
503+
503504
```typescript
504505
import { dot } from "@polkadot-api/descriptors";
505506
import { createClient } from "polkadot-api";
@@ -515,6 +516,7 @@ const deliveryFees = await api.apis.XcmPaymentApi.query_delivery_fees(
515516
```
516517

517518
[Asset Conversion API](https://paritytech.github.io/polkadot-sdk/master/pallet_asset_conversion/trait.AssetConversionApi.html){target=\_blank} (available on Asset Hub) for fee conversion:
519+
518520
```typescript
519521
import { ah } from "@polkadot-api/descriptors";
520522
import { createClient } from "polkadot-api";
@@ -532,7 +534,7 @@ const feeInAsset = await api.apis.AssetConversionApi.quote_price_exact_tokens_fo
532534

533535
### Multi-Asset Fee Handling
534536

535-
For non-sufficient assets, implement fee payment strategies:
537+
For dealing with non-sufficient assets and fees, there are different fee payment strategies you can implement:
536538

537539
1. **[Asset Conversion](/polkadot-protocol/architecture/system-chains/asset-hub/#non-sufficient-assets){target=\_blank}**: Convert part of the transfer amount to pay fees
538540
2. **Separate Fee Payment**: Use a different sufficient asset for fees
@@ -573,7 +575,12 @@ For non-sufficient assets, implement fee payment strategies:
573575

574576
## Comprehensive Dry Run Testing
575577

576-
Dry run testing represents the most critical step in preventing asset loss during teleportation. Execute dry runs on both the source and destination chains to validate every aspect of the transfer before committing to the actual transaction. Local dry runs on the source chain validate transaction construction correctness, sufficient balance for transfer and fees, and proper XCM message generation. Remote dry runs on the destination chain verify that the XCM message will execute successfully, including asset reception and processing, account creation or balance updates, and proper fee deduction. This two-phase validation approach catches the majority of potential issues before they can cause problems in production.
578+
Dry run testing represents the most critical step in preventing asset loss during teleportation. Execute dry runs on both the source and destination chains to validate every aspect of the transfer before committing to the actual transaction. You can perform local dry runs or remote dry runs:
579+
580+
- Local dry runs on the source chain validate transaction construction correctness, sufficient balance for transfer and fees, and proper XCM message generation.
581+
- Remote dry runs on the destination chain verify that the XCM message will execute successfully, including asset reception and processing, account creation or balance updates, and proper fee deduction.
582+
583+
This two-phase validation approach catches the majority of potential issues before they can cause problems in production.
577584

578585
### Example Dry Run Implementation
579586

@@ -598,15 +605,14 @@ import { createClient, Enum, FixedSizeBinary, type Transaction } from "polkadot-
598605
import { getWsProvider } from "polkadot-api/ws-provider/web";
599606
import { withPolkadotSdkCompat } from "polkadot-api/polkadot-sdk-compat";
600607

601-
// Some constants.
602-
// For Asset Hub.
608+
// Asset Hub constants.
603609
const ASSET_HUB_WS_URL = "ws://localhost:8000";
604610
const ASSET_HUB_PARA_ID = 1000;
605611
const ASSET_HUB_ACCOUNT = "15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5";
606612
const DOT_UNITS = 10_000_000_000n; // 10 decimals.
607613
const DOT_CENTS = DOT_UNITS / 100n;
608614

609-
// For Mythos.
615+
// Mythos constants.
610616
const MYTHOS_WS_URL = "ws://localhost:8001";
611617
const MYTHOS_PARA_ID = 3369;
612618
const MYTHOS_ACCOUNT = "0x69CF15A9393A0869A7fE535eCFe2C3CbaC127A40";
@@ -680,7 +686,7 @@ async function dryRun(call: Transaction<any, any, any, any>['decodedCall']) {
680686
const assetHubClient = createClient(getWsProvider(ASSET_HUB_WS_URL));
681687
const ahApi = assetHubClient.getTypedApi(ah);
682688

683-
// We need to make sure it's V4 because V5 is not supported by asset hub.
689+
// We need to ensure it's V4 because V5 is not supported by Asset Hub at the time of writing.
684690
// We get the supported versions directly from the descriptors.
685691
if (messageToAh.type === 'V4') {
686692
console.log('Dry running on Asset Hub...');
@@ -35867,7 +35873,7 @@ It is best practice to conduct dry run tests before execution of a cross-chain t
3586735873

3586835874
// Paseo has 10 decimals, we use this to simplify.
3586935875
const PAS_UNITS = 10_000_000_000;
35870-
// The RPC endpoints to connect to Paseo.
35876+
// The RPC endpoints to connect to Paseo Asset Hub.
3587135877
// Not needed if using Polkadot.
3587235878
const PASEO_AH_RPC = 'wss://asset-hub-paseo.dotters.network';
3587335879

@@ -35877,7 +35883,7 @@ async function teleport() {
3587735883
const senderAddress = '15whavTNSyceP8SL3Z1JukFcUPzmeR26RxKXkfQiPhsykg7s';
3587835884
const recipientAddress = '14E5nqKAp3oAJcmzgZhUD2RcptBeUBScxKHgJKU4HPNcKVf3';
3587935885

35880-
// Check if dry run is supported on AssetHubPolkadot
35886+
// Check if dry run is supported on Polkadot Asset Hub
3588135887
const supportsDryRun = hasDryRunSupport('AssetHubPolkadot');
3588235888
console.log(`AssetHubPolkadot supports dry run: ${supportsDryRun}`);
3588335889

@@ -35910,7 +35916,7 @@ async function teleport() {
3591035916

3591135917
console.log('Dry run result 2:', dryRunResult2);
3591235918

35913-
// Check if both dry runs were successful before proceeding
35919+
// Log if both dry runs were successful before proceeding
3591435920
console.log('Dry run results:');
3591535921
console.log('Transaction 1:');
3591635922
console.dir(dryRunResult1, { depth: null });
@@ -36305,7 +36311,7 @@ Unlock new possibilities by tapping into Polkadot’s system chains:
3630536311

3630636312
- **[Convert Assets](/tutorials/polkadot-sdk/system-chains/asset-hub/asset-conversion/)** - use Asset Hub's AMM functionality to swap between different assets, provide liquidity to pools, and manage LP tokens
3630736313

36308-
Learn how to leverage sufficent and non-sufficient assets to create a seamless experience for end users
36314+
Learn how to leverage sufficient and non-sufficient assets to create a seamless experience for end users
3630936315

3631036316
- **[Teleport an Asset to Asset Hub](/tutorials/polkadot-sdk/system-chains/asset-hub/teleport-an-asset-to-asset-hub/)** - construct a teleport to send a non-sufficient asset from a Parachain to Asset Hub
3631136317
- **[Teleport an Asset from Asset Hub to a Parachain](/tutorials/polkadot-sdk/system-chains/asset-hub/teleport-an-asset-from-asset-hub/)** - construct a teleport to send a sufficient asset from Asset Hub to a Parachain.

0 commit comments

Comments
 (0)