You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: llms.txt
+22-16Lines changed: 22 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -357,14 +357,13 @@ Cross-chain asset transfers in the Polkadot ecosystem require careful planning a
357
357
358
358
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.
359
359
360
-
361
360
## Prerequisites
362
361
363
362
Before implementing asset teleports, ensure you have:
364
363
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}
368
367
369
368
## Teleporting an Asset
370
369
@@ -401,7 +400,7 @@ Here is an example flow of teleporting an asset from a parachain to Asset Hub.
401
400
402
401
M --> P[Local dry-run on <br/>source chain]
403
402
P --> Q{Local dry-run success?}
404
-
Q -->|No| R[Fix local issues<br/>- Insufficient balance<br/>- Invalid XCM construction]
@@ -476,7 +475,7 @@ Existential deposits vary by network and must be maintained to keep accounts act
476
475
- **Kusama**: 0.0033 KSM (3.3 * 10^10 planck)
477
476
- **Asset Hub**: 0.1 DOT (10^9 planck)
478
477
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.
480
479
481
480
## Fee Estimation and Coverage
482
481
@@ -485,6 +484,7 @@ For non-sufficient assets, ensure the destination account has sufficient native
485
484
Use proper runtime APIs for accurate fee estimation rather than hardcoded values:
486
485
487
486
[Transaction Payment API](https://paritytech.github.io/polkadot-sdk/master/pallet_transaction_payment_rpc/trait.TransactionPaymentRuntimeApi.html){target=\_blank} for local fees:
[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:
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:
536
538
537
539
1. **[Asset Conversion](/polkadot-protocol/architecture/system-chains/asset-hub/#non-sufficient-assets){target=\_blank}**: Convert part of the transfer amount to pay fees
538
540
2. **Separate Fee Payment**: Use a different sufficient asset for fees
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.
577
584
578
585
### Example Dry Run Implementation
579
586
@@ -598,15 +605,14 @@ import { createClient, Enum, FixedSizeBinary, type Transaction } from "polkadot-
598
605
import { getWsProvider } from "polkadot-api/ws-provider/web";
599
606
import { withPolkadotSdkCompat } from "polkadot-api/polkadot-sdk-compat";
@@ -35910,7 +35916,7 @@ async function teleport() {
35910
35916
35911
35917
console.log('Dry run result 2:', dryRunResult2);
35912
35918
35913
-
// Check if both dry runs were successful before proceeding
35919
+
// Log if both dry runs were successful before proceeding
35914
35920
console.log('Dry run results:');
35915
35921
console.log('Transaction 1:');
35916
35922
console.dir(dryRunResult1, { depth: null });
@@ -36305,7 +36311,7 @@ Unlock new possibilities by tapping into Polkadot’s system chains:
36305
36311
36306
36312
- **[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
36307
36313
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
36309
36315
36310
36316
- **[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
36311
36317
- **[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