From 5834723a19a310314dd18a96368f08252cdaee96 Mon Sep 17 00:00:00 2001
From: Mario J Maurello <marioj@purestake.com>
Date: Tue, 24 Sep 2024 18:48:55 +0200
Subject: [PATCH] add asset ordering param to ibtc and kbtc

---
 packages/builder/src/fee/FeeBuilder.interfaces.ts | 2 +-
 packages/builder/src/fee/FeeBuilder.ts            | 4 ++--
 packages/config/src/xcm-configs/interlay.ts       | 7 ++++---
 packages/config/src/xcm-configs/kintsugi.ts       | 7 ++++---
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/packages/builder/src/fee/FeeBuilder.interfaces.ts b/packages/builder/src/fee/FeeBuilder.interfaces.ts
index cebddcce..911acc67 100644
--- a/packages/builder/src/fee/FeeBuilder.interfaces.ts
+++ b/packages/builder/src/fee/FeeBuilder.interfaces.ts
@@ -20,7 +20,7 @@ export interface FeeConfigBuilderPrams {
 
 export interface XcmPaymentFeeProps {
   isAssetReserveChain: boolean;
-  shouldTransferAssetPrecedeAsset?: boolean;
+  shouldTransferAssetPrecedeFeeAsset?: boolean;
 }
 
 export interface MoonbeamRuntimeXcmConfigAssetType extends Enum {
diff --git a/packages/builder/src/fee/FeeBuilder.ts b/packages/builder/src/fee/FeeBuilder.ts
index 44b101d0..eccc1c84 100644
--- a/packages/builder/src/fee/FeeBuilder.ts
+++ b/packages/builder/src/fee/FeeBuilder.ts
@@ -28,7 +28,7 @@ function xcmPaymentApi() {
   return {
     xcmPaymentFee: ({
       isAssetReserveChain,
-      shouldTransferAssetPrecedeAsset = false,
+      shouldTransferAssetPrecedeFeeAsset = false,
     }: XcmPaymentFeeProps): FeeConfigBuilder => ({
       build: ({
         address,
@@ -50,7 +50,7 @@ function xcmPaymentApi() {
               transferAsset,
               chain,
             );
-            const versionedAssets = shouldTransferAssetPrecedeAsset
+            const versionedAssets = shouldTransferAssetPrecedeFeeAsset
               ? [versionedTransferAssetId, versionedAssetId]
               : [versionedAssetId, versionedTransferAssetId];
 
diff --git a/packages/config/src/xcm-configs/interlay.ts b/packages/config/src/xcm-configs/interlay.ts
index f8dd779a..8b3f52b3 100644
--- a/packages/config/src/xcm-configs/interlay.ts
+++ b/packages/config/src/xcm-configs/interlay.ts
@@ -48,9 +48,10 @@ export const interlayRoutes = new ChainRoutes({
         chain: moonbeam,
         balance: BalanceBuilder().substrate().assets().account(),
         fee: {
-          amount: FeeBuilder()
-            .xcmPaymentApi()
-            .xcmPaymentFee({ isAssetReserveChain: false }),
+          amount: FeeBuilder().xcmPaymentApi().xcmPaymentFee({
+            isAssetReserveChain: false,
+            shouldTransferAssetPrecedeFeeAsset: true,
+          }),
           asset: intr,
         },
       },
diff --git a/packages/config/src/xcm-configs/kintsugi.ts b/packages/config/src/xcm-configs/kintsugi.ts
index 5202ea0f..568e9a3b 100644
--- a/packages/config/src/xcm-configs/kintsugi.ts
+++ b/packages/config/src/xcm-configs/kintsugi.ts
@@ -48,9 +48,10 @@ export const kintsugiRoutes = new ChainRoutes({
         chain: moonriver,
         balance: BalanceBuilder().substrate().assets().account(),
         fee: {
-          amount: FeeBuilder()
-            .xcmPaymentApi()
-            .xcmPaymentFee({ isAssetReserveChain: false }),
+          amount: FeeBuilder().xcmPaymentApi().xcmPaymentFee({
+            isAssetReserveChain: false,
+            shouldTransferAssetPrecedeFeeAsset: true,
+          }),
           asset: kint,
         },
       },