mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-22 11:38:57 +00:00
fix(@desktop/wallet): Wrong decimal place calculation on bridging
fixes #8660
This commit is contained in:
parent
5d318d0304
commit
5b423a6dbd
@ -67,7 +67,7 @@ StatusDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
property var recalculateRoutesAndFees: Backpressure.debounce(popup, 600, function() {
|
property var recalculateRoutesAndFees: Backpressure.debounce(popup, 600, function() {
|
||||||
if(!!popup.selectedAccount && !!assetSelector.selectedAsset) {
|
if(!!popup.selectedAccount && !!assetSelector.selectedAsset && d.recipientReady) {
|
||||||
popup.isLoading = true
|
popup.isLoading = true
|
||||||
let amount = parseFloat(amountToSendInput.text) * Math.pow(10, assetSelector.selectedAsset.decimals)
|
let amount = parseFloat(amountToSendInput.text) * Math.pow(10, assetSelector.selectedAsset.decimals)
|
||||||
popup.store.suggestedRoutes(popup.selectedAccount.address, amount.toString(16), assetSelector.selectedAsset.symbol,
|
popup.store.suggestedRoutes(popup.selectedAccount.address, amount.toString(16), assetSelector.selectedAsset.symbol,
|
||||||
@ -113,7 +113,8 @@ StatusDialog {
|
|||||||
} else {
|
} else {
|
||||||
let chainColor = popup.store.allNetworks.getNetworkColor(splitWords[i])
|
let chainColor = popup.store.allNetworks.getNetworkColor(splitWords[i])
|
||||||
if(!!chainColor) {
|
if(!!chainColor) {
|
||||||
store.addPreferredChain(popup.store.allNetworks.getNetworkChainId(splitWords[i]))
|
if(!isBridgeTx)
|
||||||
|
store.addPreferredChain(popup.store.allNetworks.getNetworkChainId(splitWords[i]))
|
||||||
editedText += `<span style='color: %1'>%2</span>`.arg(chainColor).arg(splitWords[i])+':'
|
editedText += `<span style='color: %1'>%2</span>`.arg(chainColor).arg(splitWords[i])+':'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,8 +137,10 @@ StatusDialog {
|
|||||||
onSelectedAccountChanged: popup.recalculateRoutesAndFees()
|
onSelectedAccountChanged: popup.recalculateRoutesAndFees()
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
store.addPreferredChain(popup.store.getMainnetChainId())
|
if(!isBridgeTx) {
|
||||||
store.addUnpreferredChainsToDisabledChains()
|
store.addPreferredChain(popup.store.getMainnetChainId())
|
||||||
|
store.addUnpreferredChainsToDisabledChains()
|
||||||
|
}
|
||||||
|
|
||||||
amountToSendInput.input.edit.forceActiveFocus()
|
amountToSendInput.input.edit.forceActiveFocus()
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ QtObject {
|
|||||||
|
|
||||||
function addRemoveDisabledFromChain(chainID, isDisabled) {
|
function addRemoveDisabledFromChain(chainID, isDisabled) {
|
||||||
if(isDisabled) {
|
if(isDisabled) {
|
||||||
disabledChainIdsFromList.push(chainID)
|
if(!root.disabledChainIdsFromList.includes(chainID))
|
||||||
|
disabledChainIdsFromList.push(chainID)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(var i = 0; i < disabledChainIdsFromList.length;i++) {
|
for(var i = 0; i < disabledChainIdsFromList.length;i++) {
|
||||||
@ -40,7 +41,8 @@ QtObject {
|
|||||||
|
|
||||||
function addRemoveDisabledToChain(chainID, isDisabled) {
|
function addRemoveDisabledToChain(chainID, isDisabled) {
|
||||||
if(isDisabled) {
|
if(isDisabled) {
|
||||||
root.disabledChainIdsToList.push(chainID)
|
if(!root.disabledChainIdsToList.includes(chainID))
|
||||||
|
root.disabledChainIdsToList.push(chainID)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(var i = 0; i < root.disabledChainIdsToList.length;i++) {
|
for(var i = 0; i < root.disabledChainIdsToList.length;i++) {
|
||||||
|
@ -80,6 +80,8 @@ Item {
|
|||||||
amountToSend: root.amountToSend
|
amountToSend: root.amountToSend
|
||||||
isLoading: root.isLoading
|
isLoading: root.isLoading
|
||||||
store: root.store
|
store: root.store
|
||||||
|
selectedAsset: root.selectedAsset
|
||||||
|
selectedAccount: root.selectedAccount
|
||||||
weiToEth: function(wei) {
|
weiToEth: function(wei) {
|
||||||
return "%1 %2".arg(LocaleUtils.numberToLocaleString(parseFloat(store.getWei2Eth(wei, selectedAsset.decimals)))).arg(selectedAsset.symbol)
|
return "%1 %2".arg(LocaleUtils.numberToLocaleString(parseFloat(store.getWei2Eth(wei, selectedAsset.decimals)))).arg(selectedAsset.symbol)
|
||||||
}
|
}
|
||||||
@ -107,6 +109,7 @@ Item {
|
|||||||
bestRoutes: root.bestRoutes
|
bestRoutes: root.bestRoutes
|
||||||
isLoading: root.isLoading
|
isLoading: root.isLoading
|
||||||
interactive: root.interactive
|
interactive: root.interactive
|
||||||
|
isBridgeTx: root.isBridgeTx
|
||||||
weiToEth: function(wei) {
|
weiToEth: function(wei) {
|
||||||
return parseFloat(store.getWei2Eth(wei, selectedAsset.decimals))
|
return parseFloat(store.getWei2Eth(wei, selectedAsset.decimals))
|
||||||
}
|
}
|
||||||
@ -132,6 +135,7 @@ Item {
|
|||||||
bestRoutes: root.bestRoutes
|
bestRoutes: root.bestRoutes
|
||||||
isLoading: root.isLoading
|
isLoading: root.isLoading
|
||||||
interactive: root.interactive
|
interactive: root.interactive
|
||||||
|
isBridgeTx: root.isBridgeTx
|
||||||
weiToEth: function(wei) {
|
weiToEth: function(wei) {
|
||||||
return parseFloat(store.getWei2Eth(wei, selectedAsset.decimals))
|
return parseFloat(store.getWei2Eth(wei, selectedAsset.decimals))
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ ColumnLayout {
|
|||||||
property bool errorMode: networksLoader.item ? networksLoader.item.errorMode : false
|
property bool errorMode: networksLoader.item ? networksLoader.item.errorMode : false
|
||||||
property var weiToEth: function(wei) {}
|
property var weiToEth: function(wei) {}
|
||||||
property bool interactive: true
|
property bool interactive: true
|
||||||
|
property bool isBridgeTx: false
|
||||||
|
|
||||||
signal reCalculateSuggestedRoute()
|
signal reCalculateSuggestedRoute()
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ ColumnLayout {
|
|||||||
icon.width: 16
|
icon.width: 16
|
||||||
text: checked ? qsTr("Hide Unpreferred Networks"): qsTr("Show Unpreferred Networks")
|
text: checked ? qsTr("Hide Unpreferred Networks"): qsTr("Show Unpreferred Networks")
|
||||||
onToggled: if(!checked) store.addUnpreferredChainsToDisabledChains()
|
onToggled: if(!checked) store.addUnpreferredChainsToDisabledChains()
|
||||||
|
visible: !isBridgeTx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
|
@ -20,6 +20,8 @@ RowLayout {
|
|||||||
property double amountToSend: 0
|
property double amountToSend: 0
|
||||||
property bool isLoading: false
|
property bool isLoading: false
|
||||||
property bool isBridgeTx: false
|
property bool isBridgeTx: false
|
||||||
|
property var selectedAsset
|
||||||
|
property var selectedAccount
|
||||||
property var weiToEth: function(wei) {}
|
property var weiToEth: function(wei) {}
|
||||||
property var reCalculateSuggestedRoute: function() {}
|
property var reCalculateSuggestedRoute: function() {}
|
||||||
|
|
||||||
@ -114,7 +116,8 @@ RowLayout {
|
|||||||
rightPadding: 5
|
rightPadding: 5
|
||||||
implicitWidth: 150
|
implicitWidth: 150
|
||||||
title: chainName
|
title: chainName
|
||||||
subTitle: root.weiToEth(balance)
|
subTitle: selectedAccount && selectedAccount!== undefined && selectedAsset!== undefined ?
|
||||||
|
selectedAccount.getTokenBalanceOnChain(chainId, selectedAsset.symbol) : ""
|
||||||
statusListItemSubTitle.color: Theme.palette.primaryColor1
|
statusListItemSubTitle.color: Theme.palette.primaryColor1
|
||||||
asset.width: 32
|
asset.width: 32
|
||||||
asset.height: 32
|
asset.height: 32
|
||||||
|
Loading…
x
Reference in New Issue
Block a user