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
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.
@@ -31337,7 +31337,9 @@ Ensure that you replace the endpoint URLs with the actual WebSocket endpoints. T
31337
31337
Now, you can construct a proper XCM message using the new XCM V5 instructions for teleporting from Asset Hub to the Bridge Hub Chain:
async function estimateXcmFeesFromAssetHubToBridgeHub(
31402
+
xcm: any,
31403
+
assetHubApi: any,
31402
31404
) {
31403
-
console.log('=== Fee Estimation Process (Asset Hub → Bridge Hub) ===');
31404
31405
// Code will go here
31405
31406
}
31406
31407
```
31407
31408
31408
31409
1. **Local execution fees on Asset Hub**: Compute the XCM weight locally, then convert that weight to PAS using Asset Hub's view of PAS (`parents: 1, interior: Here`). Add the code to the function:
console.log('=== Fee Estimation Process (Asset Hub → Bridge Hub) ===');
31413
+
31414
+
// 1. LOCAL EXECUTION FEES on Asset Hub
31412
31415
console.log('1. Calculating local execution fees on Asset Hub...');
31413
31416
let localExecutionFees = 0n;
31414
31417
@@ -31434,12 +31437,8 @@ First, you need to create the function that will estimate the fees for the telep
31434
31437
localExecutionFees.toString(),
31435
31438
'PAS units',
31436
31439
);
31437
-
```
31438
-
31439
-
2. **Dry-run and delivery fees to Bridge Hub**: Dry-run the XCM on Asset Hub to capture forwarded messages, locate the one targeting Bridge Hub (`parents: 1, interior: Here`), and ask for delivery fees. Add the code to the function:
@@ -31450,8 +31449,12 @@ First, you need to create the function that will estimate the fees for the telep
31450
31449
weightResult.value,
31451
31450
);
31452
31451
}
31452
+
```
31453
31453
31454
-
// 2. DELIVERY FEES + REMOTE EXECUTION FEES
31454
+
2. **Dry-run and delivery fees to Bridge Hub**: Dry-run the XCM on Asset Hub to capture forwarded messages, locate the one targeting Bridge Hub (`parents: 1, interior: Here`), and ask for delivery fees. Add the code to the function:
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:
@@ -31516,16 +31517,16 @@ First, you need to create the function that will estimate the fees for the telep
31516
31517
} else {
31517
31518
console.log('✗ Failed to calculate delivery fees:', deliveryFeesResult);
31518
31519
}
31519
-
31520
-
// 3. REMOTE EXECUTION FEES on Bridge Hub
31521
-
console.log('\n3. Calculating remote execution fees on Bridge Hub');
31522
-
try {
31523
31520
```
31524
31521
31525
-
4. **Sum and return totals**: Aggregate all parts, print a short summary, and return a structured result. Add the code to the function:
31522
+
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:
0 commit comments