From aca22d840c0a4a5522d08d9bcf89288eb25d6112 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Wed, 21 Aug 2024 18:57:02 +0200 Subject: [PATCH] fix(@desktop/wallet): fix sending erc1155 --- src/app_service/service/transaction/dto_conversion.nim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app_service/service/transaction/dto_conversion.nim b/src/app_service/service/transaction/dto_conversion.nim index 1e72c04350..8ab71aedac 100644 --- a/src/app_service/service/transaction/dto_conversion.nim +++ b/src/app_service/service/transaction/dto_conversion.nim @@ -11,6 +11,7 @@ proc sortAsc[T](t1, t2: T): int = proc convertToOldRoute*(route: seq[TransactionPathDtoV2]): seq[TransactionPathDto] = const + defaultDecimals = 1 gweiDecimals = 9 ethDecimals = 18 for p in route: @@ -43,9 +44,12 @@ proc convertToOldRoute*(route: seq[TransactionPathDtoV2]): seq[TransactionPathDt trPath.toToken = p.toToken trPath.gasFees = fees # trPath.cost = not in use for old approach in the desktop app - value = conversion.wei2Eth(input = p.txTokenFees, decimals = p.fromToken.decimals) + var decimals = defaultDecimals + if(p.fromToken.decimals != 0): + decimals = p.fromToken.decimals + value = conversion.wei2Eth(input = p.txTokenFees, decimals = decimals) trPath.tokenFees = parseFloat(value) - value = conversion.wei2Eth(input = p.txBonderFees, decimals = p.fromToken.decimals) + value = conversion.wei2Eth(input = p.txBonderFees, decimals = decimals) trPath.bonderFees = value trPath.txBonderFees = p.txBonderFees trPath.tokenFees += parseFloat(value) # we add bonder fees to the token fees cause in the UI, atm, we show only token fees