Skip to content

Commit

Permalink
fix entry
Browse files Browse the repository at this point in the history
  • Loading branch information
SorinC6 committed Oct 13, 2023
1 parent 24b8dcc commit fbc992f
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions apps/wallet-mobile/src/features/Swap/common/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fbc992f

Please sign in to comment.