From c256ac0ac2b5c54f0d548874b8f448f277979b27 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Tue, 15 Nov 2022 12:22:03 +0100 Subject: [PATCH] fix(@desktop/wallet): Fix for send transaction USDC error fixes #8224 --- ui/imports/shared/stores/TransactionStore.qml | 8 ++++---- ui/imports/shared/views/NetworkCardsComponent.qml | 2 +- ui/imports/shared/views/NetworkSelector.qml | 6 +++--- .../shared/views/NetworksAdvancedCustomRoutingView.qml | 4 +++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ui/imports/shared/stores/TransactionStore.qml b/ui/imports/shared/stores/TransactionStore.qml index f1f6f435ed..dbd41a7b6b 100644 --- a/ui/imports/shared/stores/TransactionStore.qml +++ b/ui/imports/shared/stores/TransactionStore.qml @@ -114,12 +114,12 @@ QtObject { mainModuleInst.resolveENS(value, "") } - function getWei2Eth(wei) { - return globalUtils.wei2Eth(wei,18) + function getWei2Eth(wei, decimals) { + return globalUtils.wei2Eth(wei, decimals) } - function getEth2Wei(eth) { - return globalUtils.eth2Wei(eth, 18) + function getEth2Wei(eth, decimals) { + return globalUtils.eth2Wei(eth, decimals) } function plainText(text) { diff --git a/ui/imports/shared/views/NetworkCardsComponent.qml b/ui/imports/shared/views/NetworkCardsComponent.qml index f407bfa7ef..a7b73a586b 100644 --- a/ui/imports/shared/views/NetworkCardsComponent.qml +++ b/ui/imports/shared/views/NetworkCardsComponent.qml @@ -33,7 +33,7 @@ Item { property bool interactive: true property var weiToEth: function(wei) {} - signal reCalculateSuggestedRoute() + property var reCalculateSuggestedRoute: function() {} QtObject { id: d diff --git a/ui/imports/shared/views/NetworkSelector.qml b/ui/imports/shared/views/NetworkSelector.qml index 027b55fbd9..61fb53e2f3 100644 --- a/ui/imports/shared/views/NetworkSelector.qml +++ b/ui/imports/shared/views/NetworkSelector.qml @@ -79,7 +79,7 @@ Item { amountToSend: root.amountToSend isLoading: root.isLoading weiToEth: function(wei) { - return "%1 %2".arg(LocaleUtils.numberToLocaleString(parseFloat(store.getWei2Eth(wei)))).arg(selectedAsset.symbol) + return "%1 %2".arg(LocaleUtils.numberToLocaleString(parseFloat(store.getWei2Eth(wei, selectedAsset.decimals)))).arg(selectedAsset.symbol) } } } @@ -103,7 +103,7 @@ Item { isLoading: root.isLoading interactive: root.interactive weiToEth: function(wei) { - return parseFloat(store.getWei2Eth(wei)) + return parseFloat(store.getWei2Eth(wei, selectedAsset.decimals)) } } } @@ -128,7 +128,7 @@ Item { isLoading: root.isLoading interactive: root.interactive weiToEth: function(wei) { - return parseFloat(store.getWei2Eth(wei)) + return parseFloat(store.getWei2Eth(wei, selectedAsset.decimals)) } } } diff --git a/ui/imports/shared/views/NetworksAdvancedCustomRoutingView.qml b/ui/imports/shared/views/NetworksAdvancedCustomRoutingView.qml index 3aee9d6f41..1a9f8a4d94 100644 --- a/ui/imports/shared/views/NetworksAdvancedCustomRoutingView.qml +++ b/ui/imports/shared/views/NetworksAdvancedCustomRoutingView.qml @@ -87,7 +87,9 @@ ColumnLayout { customMode: root.customMode requiredGasInEth: root.requiredGasInEth selectedAsset: root.selectedAsset - onReCalculateSuggestedRoute: root.reCalculateSuggestedRoute() + reCalculateSuggestedRoute: function() { + root.reCalculateSuggestedRoute() + } bestRoutes: root.bestRoutes weiToEth: root.weiToEth interactive: root.interactive