From fbc992f787e0ab9ee6f33d0b957da2ba565ebeea Mon Sep 17 00:00:00 2001 From: SorinC6 Date: Fri, 13 Oct 2023 16:42:22 +0300 Subject: [PATCH] fix entry --- .../src/features/Swap/common/helpers.ts | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/apps/wallet-mobile/src/features/Swap/common/helpers.ts b/apps/wallet-mobile/src/features/Swap/common/helpers.ts index 4ad44c6095..98c711f057 100644 --- a/apps/wallet-mobile/src/features/Swap/common/helpers.ts +++ b/apps/wallet-mobile/src/features/Swap/common/helpers.ts @@ -10,19 +10,22 @@ export const createYoroiEntry = ( ): YoroiEntry => { const amountEntry = {} - const tokenId = createOrder.amounts.sell.tokenId - if (tokenId != null && createOrder.amounts.sell.quantity !== undefined) { - if (tokenId === wallet.primaryTokenInfo.id) { - amountEntry[tokenId] = Quantities.sum([ - createOrder.selectedPool.deposit.quantity, - createOrder.selectedPool.batcherFee.quantity, - createOrder.amounts.sell.quantity, - ]) - } else { - amountEntry[''] = createOrder.selectedPool.deposit.quantity - amountEntry[tokenId] = createOrder.amounts.sell.quantity - } + const sellTokenId = createOrder.amounts.sell.tokenId + // summing fees is missing the frontend fee + if (sellTokenId === wallet.primaryTokenInfo.id) { + amountEntry[sellTokenId] = Quantities.sum([ + createOrder.selectedPool.deposit.quantity, + createOrder.selectedPool.batcherFee.quantity, + createOrder.amounts.sell.quantity, + ]) + } else { + amountEntry[wallet.primaryTokenInfo.id] = Quantities.sum([ + createOrder.selectedPool.deposit.quantity, + createOrder.selectedPool.batcherFee.quantity, + ]) + amountEntry[sellTokenId] = createOrder.amounts.sell.quantity } + return { address: address, amounts: amountEntry,