fix(wallet): Validate decimals for crypto when sending (#15523)
This commit is contained in:
parent
ec86a30d6e
commit
55b2224593
|
@ -117,6 +117,10 @@ ColumnLayout {
|
||||||
input.validate()
|
input.validate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSelectedHoldingChanged: {
|
||||||
|
input.validate()
|
||||||
|
}
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
text: root.caption
|
text: root.caption
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
|
@ -145,9 +149,17 @@ ColumnLayout {
|
||||||
errorMessage: ""
|
errorMessage: ""
|
||||||
|
|
||||||
validate: (text) => {
|
validate: (text) => {
|
||||||
var num = LocaleUtils.numberFromLocaleString(topAmountToSendInput.text,
|
const num = LocaleUtils.numberFromLocaleString(topAmountToSendInput.text,
|
||||||
topAmountToSendInput.locale)
|
topAmountToSendInput.locale)
|
||||||
return !isNaN(num) && num > 0 && num <= root.maxInputBalance
|
if (isNaN(num) || num <= 0 || num > root.maxInputBalance) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if(!root.selectedHolding || !root.selectedHolding.marketDetails || !root.selectedHolding.marketDetails.currencyPrice) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const cryptoValueToSend = root.inputIsFiat ? num / root.selectedHolding.marketDetails.currencyPrice.amount : num
|
||||||
|
const cryptoValueToSendRaw = SQUtils.AmountsArithmetic.fromNumber(cryptoValueToSend, root.multiplierIndex).toString()
|
||||||
|
return cryptoValueToSendRaw >= 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue