From 816c198aa691c7037f9627fd5f9458b2610cc5fe Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Thu, 19 Sep 2024 01:45:52 +0200 Subject: [PATCH] -wip- apply to all Acala and Hydration routes --- packages/builder/src/fee/FeeBuilder.utils.ts | 4 ++-- packages/config/src/configs/acala.ts | 12 +++++++++--- packages/config/src/configs/hydration.ts | 20 +++++++++++++++----- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/packages/builder/src/fee/FeeBuilder.utils.ts b/packages/builder/src/fee/FeeBuilder.utils.ts index 7a3e4b8a..5b6af843 100644 --- a/packages/builder/src/fee/FeeBuilder.utils.ts +++ b/packages/builder/src/fee/FeeBuilder.utils.ts @@ -97,7 +97,7 @@ export async function getAssetIdType( return type; } -function getConcreteAssetId(): object { +function getConcreteNativeAssetId(): object { return { Concrete: { interior: { @@ -140,7 +140,7 @@ export async function getVersionedAssetId( asset: ChainAssetId, ): Promise { if (asset === moonChainNativeAssetId) { - return getConcreteAssetId(); + return getConcreteNativeAssetId(); } if (isHexString(asset)) { diff --git a/packages/config/src/configs/acala.ts b/packages/config/src/configs/acala.ts index 048db60a..d4bdd533 100644 --- a/packages/config/src/configs/acala.ts +++ b/packages/config/src/configs/acala.ts @@ -16,7 +16,9 @@ export const acalaConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), destination: moonbeam, destinationFee: { - amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), + amount: FeeBuilder() + .xcmPaymentApi() + .xcmPaymentFee({ isAssetReserveChain: false }), asset: aca, balance: BalanceBuilder().substrate().system().account(), }, @@ -27,7 +29,9 @@ export const acalaConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), + amount: FeeBuilder() + .xcmPaymentApi() + .xcmPaymentFee({ isAssetReserveChain: false }), asset: aseed, balance: BalanceBuilder().substrate().tokens().accounts(), }, @@ -61,7 +65,9 @@ export const acalaConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.005, + amount: FeeBuilder() + .xcmPaymentApi() + .xcmPaymentFee({ isAssetReserveChain: false }), asset: ldot, balance: BalanceBuilder().substrate().tokens().accounts(), }, diff --git a/packages/config/src/configs/hydration.ts b/packages/config/src/configs/hydration.ts index 0e745fe8..a28bde62 100644 --- a/packages/config/src/configs/hydration.ts +++ b/packages/config/src/configs/hydration.ts @@ -28,7 +28,9 @@ export const hydrationConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.01, + amount: FeeBuilder() + .xcmPaymentApi() + .xcmPaymentFee({ isAssetReserveChain: true }), asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, @@ -56,7 +58,9 @@ export const hydrationConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.08, + amount: FeeBuilder() + .xcmPaymentApi() + .xcmPaymentFee({ isAssetReserveChain: true }), asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, @@ -71,7 +75,9 @@ export const hydrationConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.08, + amount: FeeBuilder() + .xcmPaymentApi() + .xcmPaymentFee({ isAssetReserveChain: true }), asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, @@ -86,7 +92,9 @@ export const hydrationConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.08, + amount: FeeBuilder() + .xcmPaymentApi() + .xcmPaymentFee({ isAssetReserveChain: true }), asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, @@ -101,7 +109,9 @@ export const hydrationConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.08, + amount: FeeBuilder() + .xcmPaymentApi() + .xcmPaymentFee({ isAssetReserveChain: true }), asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), },