diff --git a/packages/config/src/mrl-configs/fantomTestnet.ts b/packages/config/src/mrl-configs/fantomTestnet.ts index 14ffb23c..c8c22ee1 100644 --- a/packages/config/src/mrl-configs/fantomTestnet.ts +++ b/packages/config/src/mrl-configs/fantomTestnet.ts @@ -119,7 +119,7 @@ export const fantomTestnetRoutes = new MrlChainRoutes({ balance: BalanceBuilder().evm().erc20(), fee: { asset: ftmwh, - amount: 0.01, + amount: 0, }, }, mrl: { @@ -150,7 +150,7 @@ export const fantomTestnetRoutes = new MrlChainRoutes({ balance: BalanceBuilder().substrate().system().account(), fee: { asset: dev, - amount: 0.01, + amount: 0, }, }, mrl: { diff --git a/packages/mrl/src/getTransferData/getTransferData.ts b/packages/mrl/src/getTransferData/getTransferData.ts index 088a2935..af2975aa 100644 --- a/packages/mrl/src/getTransferData/getTransferData.ts +++ b/packages/mrl/src/getTransferData/getTransferData.ts @@ -32,12 +32,14 @@ interface GetTransferDataParams { route: MrlAssetRoute; sourceAddress: string; destinationAddress: string; + isAutomatic: boolean; } export async function getTransferData({ route, sourceAddress, destinationAddress, + isAutomatic, }: GetTransferDataParams): Promise { if (!route.mrl) { throw new Error( @@ -98,6 +100,7 @@ export async function getTransferData({ destinationData, moonChainData, sourceData, + isAutomatic, }), moonChain: moonChainData, source: sourceData, diff --git a/packages/mrl/src/getTransferData/getTransferData.utils.ts b/packages/mrl/src/getTransferData/getTransferData.utils.ts index d9223a44..23bfafd7 100644 --- a/packages/mrl/src/getTransferData/getTransferData.utils.ts +++ b/packages/mrl/src/getTransferData/getTransferData.utils.ts @@ -46,6 +46,7 @@ interface DataParams { destinationData: DestinationChainTransferData; moonChainData: MoonChainTransferData; sourceData: SourceTransferData; + isAutomatic?: boolean; } export function getMoonChainFeeValueOnSource({ @@ -74,6 +75,7 @@ export function getMrlMin({ destinationData, moonChainData, sourceData, + isAutomatic, }: DataParams): AssetAmount { const minInDestination = getMin(destinationData); const min = AssetAmount.fromChainAsset( @@ -87,9 +89,10 @@ export function getMrlMin({ moonChainData, sourceData, }); - const relayerFee = sourceData.relayerFee?.amount - ? sourceData.relayerFee.toBig() - : Big(0); + const relayerFee = + sourceData.relayerFee?.amount && isAutomatic + ? sourceData.relayerFee.toBig() + : Big(0); return min.copyWith({ amount: BigInt(min.toBig().add(moonChainFee).add(relayerFee).toFixed()), diff --git a/packages/mrl/src/mrl.ts b/packages/mrl/src/mrl.ts index 33c5c26e..43f1b8a0 100644 --- a/packages/mrl/src/mrl.ts +++ b/packages/mrl/src/mrl.ts @@ -39,20 +39,24 @@ export function Mrl(options?: MrlOptions) { source, destination, }); - return { - setAddresses({ - sourceAddress, - destinationAddress, - }: { - sourceAddress: string; - destinationAddress: string; - }) { - return getTransferData({ - route, - sourceAddress, - destinationAddress, - }); + setIsAutomatic(isAutomatic: boolean) { + return { + setAddresses({ + sourceAddress, + destinationAddress, + }: { + sourceAddress: string; + destinationAddress: string; + }) { + return getTransferData({ + route, + sourceAddress, + destinationAddress, + isAutomatic, + }); + }, + }; }, }; },