Skip to content

Commit

Permalink
fix: formatted bridge fee amount (#3165)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigboydiamonds authored Sep 23, 2024
1 parent 1de17e0 commit b6651b1
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions packages/rest-api/src/controllers/bridgeController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,24 @@ export const bridgeController = async (req, res) => {
toToken,
amountInWei
)
const payload = resp.map((quote) => ({
...quote,
maxAmountOutStr: formatBNToString(
quote.maxAmountOut,
toTokenInfo.decimals
),
bridgeFeeFormatted: formatBNToString(
quote.feeAmount,
toTokenInfo.decimals
),
}))

const payload = resp.map((quote) => {
const originQueryTokenOutInfo = tokenAddressToToken(
fromChain.toString(),
quote.originQuery.tokenOut
)
return {
...quote,
maxAmountOutStr: formatBNToString(
quote.maxAmountOut,
toTokenInfo.decimals
),
bridgeFeeFormatted: formatBNToString(
quote.feeAmount,
originQueryTokenOutInfo.decimals
),
}
})
res.json(payload)
} catch (err) {
res.status(500).json({
Expand Down

0 comments on commit b6651b1

Please sign in to comment.