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: tutorials/interoperability/xcm-fee-estimation.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,21 +7,21 @@ description: This tutorial demonstrates how to estimate the fees for teleporting
7
7
8
8
## Introduction
9
9
10
-
When sending cross-chain messages, you need to make sure that the transaction will be successful not only in the local chain but also in the destination, or even in the intermediate chains.
10
+
When sending cross-chain messages, ensure that the transaction will be successful not only in the local chain but also in the destination chain and any intermediate chains.
11
11
12
12
Sending cross-chain messages requires estimating the fees for the operation.
13
13
14
14
This tutorial will demonstrate how to dry-run and estimate the fees for teleporting assets from the Paseo Asset Hub parachain to the Paseo Bridge Hub chain.
15
15
16
16
## Fee Mechanism
17
17
18
-
There are 3 types of fees that can be charged when sending a cross-chain message:
18
+
There are three types of fees that can be charged when sending a cross-chain message:
19
19
20
20
-**Local execution fees**: Fees charged in the local chain for executing the message.
21
21
-**Delivery fees**: Fees charged for delivering the message to the destination chain.
22
22
-**Remote execution fees**: Fees charged in the destination chain for executing the message.
23
23
24
-
If there are multiple intermediate chains, the delivery fees and remote execution fees will be charged for each intermediate chain.
24
+
If there are multiple intermediate chains, delivery fees and remote execution fees will be charged for each one.
25
25
26
26
In this example, you will estimate the fees for teleporting assets from the Paseo Asset Hub parachain to the Paseo Bridge Hub chain. The fee structure will be as follows:
27
27
@@ -51,19 +51,19 @@ First, you need to set up your environment:
@@ -104,15 +104,15 @@ All the following code explained in the subsequent sections must be added inside
104
104
105
105
## Client and API Setup
106
106
107
-
Now you are ready to start implementing the logic for the fee estimation for the teleport you want to perform. In this step you will create the client for the Paseo Asset Hub parachain and generate the typed API to interact with the chain. Follow the steps below:
107
+
Now you are ready to start implementing the logic for the fee estimation for the teleport you want to perform. In this step, you will create the client for the Paseo Asset Hub parachain and generate the typed API to interact with the chain. Follow the steps below:
108
108
109
109
Create the API client. You will need to create a client for the Paseo Asset Hub parachain:
Make sure to replace the endpoint URLs with the actual WebSocket endpoints. This example uses local chopsticks endpoints, but you can use public endpoints or run local nodes.
115
+
Ensure that you replace the endpoint URLs with the actual WebSocket endpoints. This example uses local chopsticks endpoints, but you can use public endpoints or run local nodes.
116
116
117
117
## Create the XCM Message
118
118
@@ -146,7 +146,7 @@ First, you need to create the function that will estimate the fees for the telep
3. **Remote execution fees on Bridge Hub**: Connect to Bridge Hub, re-compute the forwarded XCM weight there, and convert weight to PAS (`parents: 0, interior: Here`). Add the code to the function:
149
+
3. **Remote execution fees on Bridge Hub**: Connect to Bridge Hub, recompute the forwarded XCM weight there, and convert weight to PAS (`parents: 0, interior: Here`). Add the code to the function:
@@ -235,6 +235,6 @@ After running the script, you will see the following output:
235
235
236
236
## Conclusion
237
237
238
-
This approach provides accurate fee estimation for XCM teleports from Asset Hub to Bridge Hub Chain by properly simulating the execution on both chains and using the dedicated runtime APIs for fee calculation. The fee breakdown helps you understand the cost structure of reverse cross-chain operations (parachain → bridge hub chain) and ensures your transactions have sufficient funds to complete successfully.
238
+
This approach provides accurate fee estimation for XCM teleports from Asset Hub to Bridge Hub Chain by properly simulating execution on both chains and utilizing dedicated runtime APIs for fee calculation. The fee breakdown helps you understand the cost structure of reverse cross-chain operations (parachain → bridge hub chain) and ensures your transactions have sufficient funds to complete successfully.
239
239
240
240
The key insight is understanding how asset references change based on the perspective of each chain in the XCM ecosystem, which is crucial for proper fee estimation and XCM construction.
0 commit comments