fix(wallet): fixed precision loss for balance amount in nimqml

fixed currency amount property type to be handled by QMetatype properly
This commit is contained in:
Ivan Belyakov 2024-04-11 19:27:04 +02:00 committed by Iuri Matias
parent b810687049
commit 4c041e763b
3 changed files with 4 additions and 6 deletions

View File

@ -39,13 +39,11 @@ QtObject:
stripTrailingZeroes: {self.stripTrailingZeroes}
)"""
proc getAmount*(self: CurrencyAmount): float64 =
proc getAmount*(self: CurrencyAmount): float {.slot.} =
return self.amount
proc getAmountFloat*(self: CurrencyAmount): float {.slot.} =
return self.amount
QtProperty[float] amount:
read = getAmountFloat
read = getAmount
proc getSymbol*(self: CurrencyAmount): string {.slot.} =
return self.symbol

View File

@ -1362,7 +1362,7 @@ QtObject:
dataToEmit.errorCode = ComputeFeeErrorCode.Balance # set total error code to balance error
var args = self.createComputeFeeArgsFromEthAndBalance(ethValue, balance)
totalEthVal = totalEthVal + ethValue
totalFiatVal = totalFiatVal + args.fiatCurrency.getAmountFloat()
totalFiatVal = totalFiatVal + args.fiatCurrency.getAmount()
args.contractUniqueKey = common_utils.contractUniqueKey(collectibleAndAmount.communityToken.chainId, collectibleAndAmount.communityToken.address)
allComputeFeeArgs.add(args)

2
vendor/nimqml vendored

@ -1 +1 @@
Subproject commit 13a8890db484d3ff40b410c2ff4b3e3bd2e0e880
Subproject commit 20d4db12bb40dcf1c549ab3149ca0b4b791e90b7