Last active
April 10, 2025 21:20
-
-
Save muddlebee/6bbf5d6b3a1f21986bf25fc6e2d3fd6b to your computer and use it in GitHub Desktop.
sample xcm message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const message = XcmVersionedXcm.V4([ | |
| // 1. Withdraw DOT from Asset Hub | |
| XcmV4Instruction.WithdrawAsset([dotAsset]), | |
| // 2. Deposit to HydraDX with instructions | |
| XcmV4Instruction.DepositReserveAsset({ | |
| assets: dotAssetFilter, | |
| dest: hydradxDest, | |
| xcm: [ | |
| // 2a. Pay for execution on HydraDX | |
| XcmV4Instruction.BuyExecution({ | |
| fees: dotFeeAsset, | |
| weight_limit: XcmV3WeightLimit.Unlimited() | |
| }), | |
| // 2b. Exchange DOT for USDT | |
| XcmV4Instruction.ExchangeAsset({ | |
| give: dotAssetSwapFilter, | |
| want: [usdtAsset], | |
| maximal: true | |
| }), | |
| // 2c. Send swapped assets (USDT) back to Asset Hub | |
| XcmV4Instruction.InitiateReserveWithdraw({ | |
| assets: XcmV4AssetAssetFilter.Wild( | |
| XcmV4AssetWildAsset.All() | |
| ), | |
| reserve: assetHubDest, | |
| xcm: [ | |
| XcmV4Instruction.BuyExecution({ | |
| fees: dotFeeAsset, | |
| weight_limit: XcmV3WeightLimit.Unlimited() | |
| }), | |
| XcmV4Instruction.DepositAsset({ | |
| assets: XcmV4AssetAssetFilter.Wild( | |
| XcmV4AssetWildAsset.All() | |
| ), | |
| beneficiary: beneficiary(bobKeyPair) | |
| }) | |
| ] | |
| }), | |
| ] | |
| }) | |
| ]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment