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: develop/toolkit/interoperability/paraspell-xcm-sdk/transfer-tokens-between-parachains.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ description: A step-by-step guide to building, verifying, and executing a transf
9
9
10
10
This guide walks you through transferring tokens between two parachains using the [ParaSpell XCM SDK](https://paraspell.github.io/docs/){target=\_blank}. This example uses [Asset Hub](/polkadot-protocol/architecture/system-chains/asset-hub/){target=\_blank} and the [People Chain](/polkadot-protocol/architecture/system-chains/people/){target=\_blank}, but the same approach applies to transfers between any parachain.
11
11
12
-
For development purposes, this guide will use the [Paseo TestNet](/develop/networks/#paseo){target=\_blank}, so the token transfer will be from Paseo's Asset Hub to Paseo's People Chain.
12
+
For development purposes, this guide will use the [Polkadot TestNet](/develop/networks/#paseo){target=\_blank}, so the transferred token will be PAS.
13
13
14
14
You’ll learn how to:
15
15
@@ -21,8 +21,10 @@ You’ll learn how to:
21
21
22
22
### Prerequisites
23
23
24
-
- Basic familiarity with JavaScript/TypeScript
25
24
- Knowledge of the [fundamentals of Polkadot](/polkadot-protocol/parachain-basics/){target=\_blank}
25
+
- Basic understanding of [XCM](/develop/interoperability/intro-to-xcm/){target=\_blank}
26
+
- Basic familiarity with JavaScript/TypeScript
27
+
- Install [bun](https://bun.com/docs/installation){target=\_blank}, a fast JavaScript/TypeScript runtime and package manager
26
28
27
29
## Initialize Your Project
28
30
@@ -51,7 +53,7 @@ Now add the following setup code to `index.ts`:
Replace the `INSERT_YOUR_SEED_PHRASE` with the seed phrase from your Polkadot development account.
56
+
Replace the `INSERT_YOUR_SEED_PHRASE` with the seed phrase from your Polkadot development account.
55
57
56
58
Be sure to fund this account with some PAS tokens on Paseo's Asset Hub using the [Polkadot Faucet](https://faucet.polkadot.io/?parachain=1000){target=\_blank}.
57
59
@@ -62,7 +64,7 @@ Be sure to fund this account with some PAS tokens on Paseo's Asset Hub using the
62
64
63
65
The next step is to build the transaction that you intend to execute.
64
66
65
-
In this example, you will teleport 10 PAS tokens from Paseo's Asset Hub to Paseo's People Chain system parachain.
67
+
In this example, you will transfer 10 PAS tokens from Paseo's Asset Hub to Paseo's People Chain system parachain.
66
68
67
69
Add the ParaSpell transaction code to your `index.ts` file:
68
70
@@ -98,7 +100,7 @@ Check if the recipient account meets the [Existential Deposit (ED)](/polkadot-pr
- Read the Docs: Dive deeper into the features of the [ParaSpell XCM SDK](https://paraspell.github.io/docs/sdk/getting-started.html){target=\_blank} documentation.
@@ -17260,7 +17260,7 @@ description: A step-by-step guide to building, verifying, and executing a transf
17260
17260
17261
17261
This guide walks you through transferring tokens between two parachains using the [ParaSpell XCM SDK](https://paraspell.github.io/docs/){target=\_blank}. This example uses [Asset Hub](/polkadot-protocol/architecture/system-chains/asset-hub/){target=\_blank} and the [People Chain](/polkadot-protocol/architecture/system-chains/people/){target=\_blank}, but the same approach applies to transfers between any parachain.
17262
17262
17263
-
For development purposes, this guide will use the [Paseo TestNet](/develop/networks/#paseo){target=\_blank}, so the token transfer will be from Paseo's Asset Hub to Paseo's People Chain.
17263
+
For development purposes, this guide will use the [Polkadot TestNet](/develop/networks/#paseo){target=\_blank}, so the transferred token will be PAS.
17264
17264
17265
17265
You’ll learn how to:
17266
17266
@@ -17272,8 +17272,10 @@ You’ll learn how to:
17272
17272
17273
17273
### Prerequisites
17274
17274
17275
-
- Basic familiarity with JavaScript/TypeScript
17276
17275
- Knowledge of the [fundamentals of Polkadot](/polkadot-protocol/parachain-basics/){target=\_blank}
17276
+
- Basic understanding of [XCM](/develop/interoperability/intro-to-xcm/){target=\_blank}
17277
+
- Basic familiarity with JavaScript/TypeScript
17278
+
- Install [bun](https://bun.com/docs/installation){target=\_blank}, a fast JavaScript/TypeScript runtime and package manager
17277
17279
17278
17280
## Initialize Your Project
17279
17281
@@ -17309,7 +17311,7 @@ import { getPolkadotSigner } from 'polkadot-api/signer';
17309
17311
import { sr25519CreateDerive } from '@polkadot-labs/hdkd';
Replace the `INSERT_YOUR_SEED_PHRASE` with the seed phrase from your Polkadot development account.
17333
+
Replace the `INSERT_YOUR_SEED_PHRASE` with the seed phrase from your Polkadot development account.
17332
17334
17333
17335
Be sure to fund this account with some PAS tokens on Paseo's Asset Hub using the [Polkadot Faucet](https://faucet.polkadot.io/?parachain=1000){target=\_blank}.
17334
17336
@@ -17339,7 +17341,7 @@ Be sure to fund this account with some PAS tokens on Paseo's Asset Hub using the
17339
17341
17340
17342
The next step is to build the transaction that you intend to execute.
17341
17343
17342
-
In this example, you will teleport 10 PAS tokens from Paseo's Asset Hub to Paseo's People Chain system parachain.
17344
+
In this example, you will transfer 10 PAS tokens from Paseo's Asset Hub to Paseo's People Chain system parachain.
17343
17345
17344
17346
Add the ParaSpell transaction code to your `index.ts` file:
17345
17347
@@ -17554,7 +17556,7 @@ async function verifyED() {
17554
17556
17555
17557
verifyED();
17556
17558
```
17557
-
Execute the code by running:
17559
+
Comment out the `dryRunTransfer()` and execute the code by running:
17558
17560
17559
17561
```bash
17560
17562
bun run index.ts
@@ -17592,7 +17594,7 @@ async function XcmTransferInfo() {
17592
17594
XcmTransferInfo();
17593
17595
```
17594
17596
17595
-
Go ahead and execute the script:
17597
+
Comment out the `verifyED()` and execute the script:
17596
17598
17597
17599
```bash
17598
17600
bun run index.ts
@@ -17656,21 +17658,21 @@ Now that you have:
17656
17658
- Verified the existential deposit on the recipient account
17657
17659
- Obtained an estimate of the associated XCM fees
17658
17660
17659
-
Now you can execute the teleport function by adding the following statement:
17661
+
Now you can execute the transfer function by adding the following statement:
17660
17662
17661
17663
Add the following code:
17662
17664
17663
17665
```typescript title="index.ts"
17664
17666
transfer();
17665
17667
```
17666
17668
17667
-
And execute your teleport:
17669
+
Comment out the `XcmTransferInfo()` and execute the transfer:
17668
17670
17669
17671
```bash
17670
17672
bun run index.ts
17671
17673
```
17672
17674
17673
-
Your `teleport` function will submit the transaction, and you will get the following output:
17675
+
Your `transfer` function will submit the transaction, and you will get the following output:
17674
17676
17675
17677
<div id="termynal" data-termynal>
17676
17678
<span data-ty="input"><span class="file-path"></span>bun run index.ts</span>
@@ -18004,6 +18006,115 @@ You should see:
18004
18006
18005
18007
You have now successfully created and sent a cross-chain transfer using the ParaSpell XCM SDK!
18006
18008
18009
+
???- code "Full Code"
18010
+
18011
+
```typescript title="index.ts"
18012
+
import { Builder, hasDryRunSupport } from '@paraspell/sdk';
18013
+
import {
18014
+
entropyToMiniSecret,
18015
+
mnemonicToEntropy,
18016
+
ss58Address,
18017
+
} from '@polkadot-labs/hdkd-helpers';
18018
+
import { getPolkadotSigner } from 'polkadot-api/signer';
18019
+
import { sr25519CreateDerive } from '@polkadot-labs/hdkd';
- Read the Docs: Dive deeper into the features of the [ParaSpell XCM SDK](https://paraspell.github.io/docs/sdk/getting-started.html){target=\_blank} documentation.
0 commit comments