2022-09-05 09:15:47 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Window 2.12
|
|
|
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
import shared.controls 1.0
|
|
|
|
import utils 1.0
|
2023-01-19 21:14:23 +00:00
|
|
|
import shared.stores 1.0
|
2022-09-05 09:15:47 +00:00
|
|
|
|
|
|
|
import "../controls"
|
2023-05-23 08:44:35 +00:00
|
|
|
import "../popups"
|
2023-02-20 10:57:45 +00:00
|
|
|
import "../stores" as WalletStores
|
|
|
|
import ".."
|
2023-05-16 08:25:40 +00:00
|
|
|
import "../panels"
|
2022-09-05 09:15:47 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
2023-04-25 16:54:50 +00:00
|
|
|
property var overview: WalletStores.RootStore.overview
|
2022-09-05 09:15:47 +00:00
|
|
|
property var contactsStore
|
|
|
|
property var transaction
|
|
|
|
property var sendModal
|
2023-01-17 20:05:21 +00:00
|
|
|
readonly property bool isTransactionValid: transaction !== undefined && !!transaction
|
2022-09-05 09:15:47 +00:00
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
2023-05-10 11:54:06 +00:00
|
|
|
readonly property bool isIncoming: root.isTransactionValid ? root.transaction.to.toLowerCase() === root.overview.mixedcaseAddress.toLowerCase() : false
|
2023-02-28 17:15:22 +00:00
|
|
|
readonly property bool isNFT: root.isTransactionValid ? root.transaction.isNFT : false
|
2023-01-17 20:05:21 +00:00
|
|
|
readonly property string savedAddressNameTo: root.isTransactionValid ? d.getNameForSavedWalletAddress(transaction.to) : ""
|
|
|
|
readonly property string savedAddressNameFrom: root.isTransactionValid ? d.getNameForSavedWalletAddress(transaction.from): ""
|
|
|
|
readonly property string from: root.isTransactionValid ? !!savedAddressNameFrom ? savedAddressNameFrom : Utils.compactAddress(transaction.from, 4): ""
|
|
|
|
readonly property string to: root.isTransactionValid ? !!savedAddressNameTo ? savedAddressNameTo : Utils.compactAddress(transaction.to, 4): ""
|
2023-04-04 12:09:36 +00:00
|
|
|
readonly property string savedAddressEns: root.isTransactionValid ? RootStore.getEnsForSavedWalletAddress(isIncoming ? transaction.from : transaction.to) : ""
|
|
|
|
readonly property string savedAddressChains: root.isTransactionValid ? RootStore.getChainShortNamesForSavedWalletAddress(isIncoming ? transaction.from : transaction.to) : ""
|
2022-09-05 09:15:47 +00:00
|
|
|
|
|
|
|
function getNameForSavedWalletAddress(address) {
|
|
|
|
return RootStore.getNameForSavedWalletAddress(address)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StatusScrollView {
|
2022-09-27 08:30:18 +00:00
|
|
|
anchors.top: parent.top
|
2022-09-05 09:15:47 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
|
|
|
contentHeight: column.height
|
|
|
|
contentWidth: parent.width
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: column
|
|
|
|
width: parent.width - Style.current.xlPadding
|
|
|
|
|
|
|
|
spacing: Style.current.bigPadding
|
|
|
|
|
|
|
|
TransactionDelegate {
|
2023-05-10 11:54:06 +00:00
|
|
|
id: transactionHeader
|
2022-09-20 12:27:52 +00:00
|
|
|
objectName: "transactionDetailHeader"
|
2022-09-05 09:15:47 +00:00
|
|
|
width: parent.width
|
2023-05-16 08:25:40 +00:00
|
|
|
leftPadding: 0
|
2022-09-05 09:15:47 +00:00
|
|
|
|
|
|
|
modelData: transaction
|
2023-05-10 11:54:06 +00:00
|
|
|
transactionType: d.isIncoming ? TransactionDelegate.Receive : TransactionDelegate.Send
|
2023-02-17 12:56:31 +00:00
|
|
|
currentCurrency: RootStore.currentCurrency
|
|
|
|
cryptoValue: root.isTransactionValid ? transaction.value.amount: 0.0
|
|
|
|
fiatValue: root.isTransactionValid ? RootStore.getFiatValue(cryptoValue, symbol, currentCurrency): 0.0
|
2023-01-17 20:05:21 +00:00
|
|
|
networkIcon: root.isTransactionValid ? RootStore.getNetworkIcon(transaction.chainId): ""
|
|
|
|
networkColor: root.isTransactionValid ? RootStore.getNetworkColor(transaction.chainId): ""
|
2023-05-10 11:54:06 +00:00
|
|
|
networkName: root.isTransactionValid ? RootStore.getNetworkFullName(transaction.chainId): ""
|
2023-01-17 20:05:21 +00:00
|
|
|
symbol: root.isTransactionValid ? transaction.symbol : ""
|
|
|
|
transferStatus: root.isTransactionValid ? RootStore.hex2Dec(transaction.txStatus): ""
|
2023-05-10 11:54:06 +00:00
|
|
|
timeStampText: root.isTransactionValid ? qsTr("Signed at %1").arg(LocaleUtils.formatDateTime(transaction.timestamp * 1000, Locale.LongFormat)): ""
|
|
|
|
addressNameTo: root.isTransactionValid ? WalletStores.RootStore.getNameForAddress(transaction.to): ""
|
|
|
|
addressNameFrom: root.isTransactionValid ? WalletStores.RootStore.getNameForAddress(transaction.from): ""
|
2022-09-05 09:15:47 +00:00
|
|
|
sensor.enabled: false
|
2023-05-10 11:54:06 +00:00
|
|
|
formatCurrencyAmount: RootStore.formatCurrencyAmount
|
2023-05-16 08:25:40 +00:00
|
|
|
color: Theme.palette.transparent
|
2023-05-10 11:54:06 +00:00
|
|
|
state: "header"
|
|
|
|
|
|
|
|
onRetryClicked: {
|
|
|
|
// TODO handle failed transaction retry
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
|
|
|
|
2023-05-16 08:25:40 +00:00
|
|
|
WalletTxProgressBlock {
|
|
|
|
width: Math.min(513, root.width)
|
|
|
|
error: transactionHeader.transactionStatus === TransactionDelegate.TransactionStatus.Failed
|
2023-05-24 06:22:29 +00:00
|
|
|
isLayer1: RootStore.getNetworkLayer(root.transaction.chainId) == 1
|
|
|
|
confirmations: root.isTransactionValid ? Math.abs(WalletStores.RootStore.getLatestBlockNumber(root.transaction.chainId) - RootStore.hex2Dec(root.transaction.blockNumber)): 0
|
|
|
|
chainName: root.isTransactionValid ? RootStore.getNetworkFullName(root.transaction.chainId): ""
|
|
|
|
timeStamp: root.isTransactionValid ? transaction.timestamp: ""
|
2023-05-16 08:25:40 +00:00
|
|
|
}
|
|
|
|
|
2022-09-05 09:15:47 +00:00
|
|
|
SavedAddressesDelegate {
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
name: d.isIncoming ? d.savedAddressNameFrom : d.savedAddressNameTo
|
2023-01-17 20:05:21 +00:00
|
|
|
address: root.isTransactionValid ? d.isIncoming ? transaction.from : transaction.to : ""
|
2023-02-20 10:57:45 +00:00
|
|
|
ens: d.savedAddressEns
|
|
|
|
chainShortNames: d.savedAddressChains
|
2022-09-05 09:15:47 +00:00
|
|
|
title: d.isIncoming ? d.from : d.to
|
2023-01-17 20:05:21 +00:00
|
|
|
subTitle: root.isTransactionValid ? d.isIncoming ? !!d.savedAddressNameFrom ? Utils.compactAddress(transaction.from, 4) : "" : !!d.savedAddressNameTo ? Utils.compactAddress(transaction.to, 4) : "": ""
|
2023-02-20 10:57:45 +00:00
|
|
|
store: WalletStores.RootStore
|
2022-09-05 09:15:47 +00:00
|
|
|
contactsStore: root.contactsStore
|
|
|
|
onOpenSendModal: root.sendModal.open(address);
|
2023-02-20 10:57:45 +00:00
|
|
|
saveAddress: function(name, address, favourite, chainShortNames, ens) {
|
|
|
|
RootStore.createOrUpdateSavedAddress(name, address, favourite, chainShortNames, ens)
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
2023-02-20 10:57:45 +00:00
|
|
|
deleteSavedAddress: function(address, ens) {
|
|
|
|
RootStore.deleteSavedAddress(address, ens)
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusExpandableItem {
|
|
|
|
width: parent.width
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
type: StatusExpandableItem.Type.Tertiary
|
|
|
|
expandable: true
|
|
|
|
primaryText: qsTr("Transaction summary")
|
|
|
|
expandableComponent: transactionSummary
|
|
|
|
separatorVisible: false
|
|
|
|
expanded: true
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusExpandableItem {
|
|
|
|
width: parent.width
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
type: StatusExpandableItem.Type.Tertiary
|
|
|
|
expandable: true
|
|
|
|
primaryText: qsTr("Fees")
|
|
|
|
expandableComponent: fees
|
|
|
|
expanded: true
|
|
|
|
}
|
|
|
|
|
2023-02-20 12:55:39 +00:00
|
|
|
InformationTile {
|
|
|
|
maxWidth: parent.width
|
|
|
|
primaryText: qsTr("Data")
|
|
|
|
secondaryText: root.isTransactionValid ? root.transaction.input : ""
|
|
|
|
copy: true
|
|
|
|
onCopyClicked: RootStore.copyToClipboard(textToCopy)
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: transactionSummary
|
|
|
|
Column {
|
|
|
|
id: column
|
|
|
|
width: parent.width
|
|
|
|
spacing: 8
|
|
|
|
TransactionDelegate {
|
|
|
|
width: parent.width
|
|
|
|
modelData: transaction
|
2023-05-10 11:54:06 +00:00
|
|
|
transactionType: d.isIncoming ? TransactionDelegate.Receive : TransactionDelegate.Send
|
2023-02-17 12:56:31 +00:00
|
|
|
currentCurrency: RootStore.currentCurrency
|
|
|
|
cryptoValue: root.isTransactionValid ? transaction.value.amount: 0.0
|
|
|
|
fiatValue: root.isTransactionValid ? RootStore.getFiatValue(cryptoValue, symbol, currentCurrency): 0.0
|
2023-01-17 20:05:21 +00:00
|
|
|
networkIcon: root.isTransactionValid ? RootStore.getNetworkIcon(transaction.chainId) : ""
|
|
|
|
networkColor: root.isTransactionValid ? RootStore.getNetworkColor(transaction.chainId): ""
|
|
|
|
networkName: root.isTransactionValid ? RootStore.getNetworkShortName(transaction.chainId): ""
|
|
|
|
symbol: root.isTransactionValid ? transaction.symbol : ""
|
|
|
|
transferStatus: root.isTransactionValid ? RootStore.hex2Dec(transaction.txStatus): ""
|
2023-05-10 11:54:06 +00:00
|
|
|
timeStampText: root.isTransactionValid ? LocaleUtils.formatTime(transaction.timestamp * 1000, Locale.ShortFormat): ""
|
|
|
|
addressNameTo: root.isTransactionValid ? RootStore.getNameForSavedWalletAddress(transaction.to): ""
|
|
|
|
addressNameFrom: root.isTransactionValid ? RootStore.getNameForSavedWalletAddress(transaction.from): ""
|
|
|
|
formatCurrencyAmount: RootStore.formatCurrencyAmount
|
2022-09-05 09:15:47 +00:00
|
|
|
sensor.enabled: false
|
|
|
|
color: Theme.palette.statusListItem.backgroundColor
|
|
|
|
border.width: 1
|
|
|
|
border.color: Theme.palette.directColor8
|
|
|
|
}
|
|
|
|
Row {
|
|
|
|
spacing: 8
|
|
|
|
InformationTile {
|
|
|
|
maxWidth: parent.width
|
|
|
|
primaryText: qsTr("Time")
|
|
|
|
secondaryText: root.transaction !== undefined && !!root.transaction ? qsTr("%1 <font color=\"#939BA1\">on</font> %2").
|
2023-01-12 22:39:46 +00:00
|
|
|
arg(LocaleUtils.formatTime(transaction.timestamp * 1000, Locale.ShortFormat)).
|
|
|
|
arg(LocaleUtils.formatDate(transaction.timestamp * 1000, Locale.ShortFormat)): ""
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
|
|
|
InformationTile {
|
|
|
|
maxWidth: parent.width
|
|
|
|
primaryText: qsTr("Confirmations")
|
|
|
|
secondaryText: {
|
2023-01-17 20:05:21 +00:00
|
|
|
if(root.isTransactionValid)
|
2023-05-24 06:22:29 +00:00
|
|
|
return Math.abs(WalletStores.RootStore.getLatestBlockNumber(root.transaction.chainId) - RootStore.hex2Dec(root.transaction.blockNumber))
|
2022-09-05 09:15:47 +00:00
|
|
|
else
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
InformationTile {
|
|
|
|
maxWidth: parent.width
|
|
|
|
primaryText: qsTr("Nonce")
|
2023-01-17 20:05:21 +00:00
|
|
|
secondaryText: root.isTransactionValid ? RootStore.hex2Dec(root.transaction.nonce) : ""
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
2023-02-28 17:15:22 +00:00
|
|
|
InformationTile {
|
|
|
|
maxWidth: parent.width
|
|
|
|
primaryText: qsTr("TokenID")
|
|
|
|
secondaryText: root.isTransactionValid ? root.transaction.tokenID : ""
|
|
|
|
visible: root.isTransactionValid && d.isNFT
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: fees
|
|
|
|
Column {
|
|
|
|
width: parent.width
|
|
|
|
spacing: 8
|
|
|
|
Row {
|
|
|
|
spacing: 8
|
|
|
|
InformationTile {
|
|
|
|
id: baseFee
|
|
|
|
maxWidth: parent.width
|
|
|
|
primaryText: qsTr("Base fee")
|
2023-01-17 20:05:21 +00:00
|
|
|
secondaryText: root.isTransactionValid ? qsTr("%1").arg(LocaleUtils.currencyAmountToLocaleString(root.transaction.baseGasFees)) : ""
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
|
|
|
InformationTile {
|
|
|
|
maxWidth: parent.width
|
|
|
|
primaryText: qsTr("Tip")
|
2023-01-17 20:05:21 +00:00
|
|
|
secondaryText: root.isTransactionValid ? "%1 <font color=\"%2\">• ".
|
|
|
|
arg(LocaleUtils.currencyAmountToLocaleString(root.transaction.maxPriorityFeePerGas)).
|
|
|
|
arg(Theme.palette.baseColor1) +
|
|
|
|
qsTr("Max: %1").
|
|
|
|
arg(LocaleUtils.currencyAmountToLocaleString(root.transaction.maxFeePerGas)) +
|
|
|
|
"</font>" : ""
|
2022-09-05 09:15:47 +00:00
|
|
|
secondaryLabel.textFormat: Text.RichText
|
|
|
|
}
|
|
|
|
}
|
|
|
|
InformationTile {
|
|
|
|
maxWidth: parent.width
|
|
|
|
primaryText: qsTr("Total fee")
|
2023-01-17 20:05:21 +00:00
|
|
|
secondaryText: root.isTransactionValid ? "%1 <font color=\"%2\">• ".
|
|
|
|
arg(LocaleUtils.currencyAmountToLocaleString(root.transaction.totalFees)).
|
|
|
|
arg(Theme.palette.baseColor1) +
|
|
|
|
qsTr("Max: %1").
|
|
|
|
arg(LocaleUtils.currencyAmountToLocaleString(root.transaction.maxTotalFees)) +
|
|
|
|
"</font>" : ""
|
2022-09-05 09:15:47 +00:00
|
|
|
secondaryLabel.textFormat: Text.RichText
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-05-23 08:44:35 +00:00
|
|
|
|
|
|
|
TransactionAddressMenu {
|
|
|
|
id: addressMenu
|
|
|
|
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
onOpenSendModal: (address) => root.sendModal.open(address)
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|