Skip to content

Commit c12efbd

Browse files
nhussein11eshaben
andauthored
Apply suggestions from code review
Co-authored-by: Erin Shaben <[email protected]>
1 parent e50c0f2 commit c12efbd

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tutorials/interoperability/xcm-fee-estimation.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ description: This tutorial demonstrates how to estimate the fees for teleporting
77

88
## Introduction
99

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.
1111

1212
Sending cross-chain messages requires estimating the fees for the operation.
1313

1414
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.
1515

1616
## Fee Mechanism
1717

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:
1919

2020
- **Local execution fees**: Fees charged in the local chain for executing the message.
2121
- **Delivery fees**: Fees charged for delivering the message to the destination chain.
2222
- **Remote execution fees**: Fees charged in the destination chain for executing the message.
2323

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.
2525

2626
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:
2727

@@ -51,19 +51,19 @@ First, you need to set up your environment:
5151
npm init -y
5252
```
5353

54-
3. Install dev dependencies
54+
3. Install dev dependencies:
5555

5656
```bash
5757
npm install --save-dev @types/node@^22.12.0 ts-node@^10.9.2 typescript@^5.7.3
5858
```
5959

60-
4. Install dependencies
60+
4. Install dependencies:
6161

6262
```bash
6363
npm install --save @polkadot-labs/hdkd@^0.0.13 @polkadot-labs/hdkd-helpers@^0.0.13 [email protected]
6464
```
6565

66-
5. Create TypeScript configuration
66+
5. Create TypeScript configuration:
6767

6868
```bash
6969
npx tsc --init
@@ -104,15 +104,15 @@ All the following code explained in the subsequent sections must be added inside
104104

105105
## Client and API Setup
106106

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:
108108

109109
Create the API client. You will need to create a client for the Paseo Asset Hub parachain:
110110

111111
```typescript title="teleport-ah-to-bridge-hub.ts"
112112
--8<-- "code/tutorials/interoperability/xcm-fee-estimation/teleport-ah-to-bridge-hub.ts:218:222"
113113
```
114114

115-
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.
116116

117117
## Create the XCM Message
118118

@@ -146,7 +146,7 @@ First, you need to create the function that will estimate the fees for the telep
146146
--8<-- "code/tutorials/interoperability/xcm-fee-estimation/teleport-ah-to-bridge-hub.ts:119:174"
147147
```
148148
149-
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:
150150
151151
```typescript title="teleport-ah-to-bridge-hub.ts"
152152
--8<-- "code/tutorials/interoperability/xcm-fee-estimation/teleport-ah-to-bridge-hub.ts:176:197"
@@ -235,6 +235,6 @@ After running the script, you will see the following output:
235235
236236
## Conclusion
237237
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.
239239
240240
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

Comments
 (0)