2024-10-15 19:26:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Controls 2.15
|
2023-05-31 09:25:16 +00:00
|
|
|
import QtGraphicalEffects 1.15
|
2022-09-05 09:15:47 +00:00
|
|
|
|
2024-08-27 14:35:52 +00:00
|
|
|
import StatusQ 0.1
|
2022-09-05 09:15:47 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Core 0.1
|
2024-03-13 17:38:16 +00:00
|
|
|
import StatusQ.Core.Utils 0.1
|
2022-09-05 09:15:47 +00:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
import shared.controls 1.0
|
2023-05-31 09:25:16 +00:00
|
|
|
import shared.panels 1.0
|
2023-10-03 12:15:11 +00:00
|
|
|
import shared.stores 1.0
|
2022-09-05 09:15:47 +00:00
|
|
|
import utils 1.0
|
2023-09-27 13:41:55 +00:00
|
|
|
import shared.popups.send 1.0
|
2022-09-05 09:15:47 +00:00
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
import AppLayouts.Communities.stores 1.0
|
|
|
|
import AppLayouts.Profile.stores 1.0 as ProfileStores
|
|
|
|
|
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
|
2024-09-24 10:16:40 +00:00
|
|
|
property RootStore rootStore
|
2024-09-24 11:51:22 +00:00
|
|
|
property CurrenciesStore currenciesStore
|
2024-05-22 08:13:39 +00:00
|
|
|
property ProfileStores.ContactsStore contactsStore
|
|
|
|
property CommunitiesStore communitiesStore
|
|
|
|
property NetworkConnectionStore networkConnectionStore
|
2024-02-29 14:53:08 +00:00
|
|
|
property var controller
|
2022-09-05 09:15:47 +00:00
|
|
|
property var sendModal
|
2023-07-26 11:50:27 +00:00
|
|
|
property bool showAllAccounts: false
|
2022-09-05 09:15:47 +00:00
|
|
|
|
2024-02-29 14:53:08 +00:00
|
|
|
readonly property alias transaction: d.transaction
|
2024-02-14 10:49:22 +00:00
|
|
|
|
2023-08-29 18:57:38 +00:00
|
|
|
Component.onCompleted: d.updateTransactionDetails()
|
2023-06-07 14:16:23 +00:00
|
|
|
|
2022-09-05 09:15:47 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
2023-08-30 12:10:59 +00:00
|
|
|
|
2024-02-29 14:53:08 +00:00
|
|
|
readonly property var transaction: root.controller.activityEntry
|
|
|
|
readonly property bool isTransactionValid: transaction !== undefined && !!transaction
|
|
|
|
|
|
|
|
onTransactionChanged: {
|
|
|
|
d.reEvaluateSender = !d.reEvaluateSender
|
|
|
|
d.reEvaluateRecipient = !d.reEvaluateRecipient
|
|
|
|
d.reEvaluateSender = !d.reEvaluateSender
|
|
|
|
d.reEvaluateRecipient = !d.reEvaluateRecipient
|
|
|
|
|
|
|
|
d.updateTransactionDetails()
|
|
|
|
}
|
|
|
|
|
2024-02-14 10:49:22 +00:00
|
|
|
property bool reEvaluateSender: true
|
|
|
|
property bool reEvaluateRecipient: true
|
|
|
|
|
2024-02-29 14:53:08 +00:00
|
|
|
property var details: root.controller.activityDetails
|
2023-08-30 12:10:59 +00:00
|
|
|
readonly property bool isDetailsValid: details !== undefined && !!details
|
2024-02-29 14:53:08 +00:00
|
|
|
|
|
|
|
onDetailsChanged: {
|
|
|
|
if (!!d.details && !!d.details.input && d.details.input !== "0x") {
|
|
|
|
d.loadingInputDate = true
|
2024-10-02 07:50:10 +00:00
|
|
|
WalletStores.RootStore.fetchDecodedTxData(d.details.txHashOut, d.details.input)
|
2024-02-29 14:53:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-21 06:58:44 +00:00
|
|
|
readonly property bool isIncoming: transactionType === Constants.TransactionType.Received || transactionType === Constants.TransactionType.ContractDeployment
|
2024-09-24 10:16:40 +00:00
|
|
|
readonly property string networkShortName: d.isTransactionValid ? ModelUtils.getByKey(root.rootStore.flatNetworks, "chainId", transaction.chainId, "shortName") : ""
|
|
|
|
readonly property string networkIcon: isTransactionValid ? ModelUtils.getByKey(root.rootStore.flatNetworks, "chainId", transaction.chainId, "iconUrl") : "network/Network=Custom"
|
2023-08-30 12:10:59 +00:00
|
|
|
readonly property int blockNumber: isDetailsValid ? details.blockNumber : 0
|
2023-12-01 14:31:47 +00:00
|
|
|
readonly property int blockNumberIn: isDetailsValid ? details.blockNumberIn : 0
|
|
|
|
readonly property int blockNumberOut: isDetailsValid ? details.blockNumberOut : 0
|
2023-08-18 08:56:57 +00:00
|
|
|
readonly property string networkShortNameOut: networkShortName
|
2024-09-24 10:16:40 +00:00
|
|
|
readonly property string networkShortNameIn: transactionHeader.isMultiTransaction ? ModelUtils.getByKey(root.rootStore.flatNetworks, "chainId", transaction.chainIdIn, "shortName") : ""
|
2023-06-30 15:07:53 +00:00
|
|
|
readonly property string symbol: isTransactionValid ? transaction.symbol : ""
|
|
|
|
readonly property string inSymbol: isTransactionValid ? transaction.inSymbol : ""
|
|
|
|
readonly property string outSymbol: isTransactionValid ? transaction.outSymbol : ""
|
2023-05-31 09:25:16 +00:00
|
|
|
readonly property var multichainNetworks: [] // TODO fill icon for networks for multichain
|
2023-07-18 14:05:22 +00:00
|
|
|
readonly property string fiatValueFormatted: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid || transactionHeader.isMultiTransaction || !symbol)
|
2023-07-18 14:05:22 +00:00
|
|
|
return ""
|
2024-09-24 11:51:22 +00:00
|
|
|
return root.currenciesStore.formatCurrencyAmount(transactionHeader.fiatValue, root.currenciesStore.currentCurrency)
|
2023-07-18 14:05:22 +00:00
|
|
|
}
|
|
|
|
readonly property string cryptoValueFormatted: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid || transactionHeader.isMultiTransaction)
|
2023-07-18 14:05:22 +00:00
|
|
|
return ""
|
2024-09-24 11:51:22 +00:00
|
|
|
const formatted = root.currenciesStore.formatCurrencyAmount(transaction.amount, transaction.symbol)
|
2023-08-30 12:10:59 +00:00
|
|
|
return symbol || (!d.isDetailsValid || !d.details.contract) ? formatted : "%1 (%2)".arg(formatted).arg(Utils.compactAddress(transaction.tokenAddress, 4))
|
2023-07-18 14:05:22 +00:00
|
|
|
}
|
|
|
|
readonly property string outFiatValueFormatted: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid || !transactionHeader.isMultiTransaction || !outSymbol)
|
2023-07-18 14:05:22 +00:00
|
|
|
return ""
|
2024-09-24 11:51:22 +00:00
|
|
|
return root.currenciesStore.formatCurrencyAmount(transactionHeader.outFiatValue, root.currenciesStore.currentCurrency)
|
2023-07-18 14:05:22 +00:00
|
|
|
}
|
|
|
|
readonly property string outCryptoValueFormatted: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid || !transactionHeader.isMultiTransaction)
|
2023-07-18 14:05:22 +00:00
|
|
|
return ""
|
2024-09-24 11:51:22 +00:00
|
|
|
const formatted = root.currenciesStore.formatCurrencyAmount(transaction.outAmount, transaction.outSymbol)
|
2023-08-02 04:36:54 +00:00
|
|
|
return outSymbol || !transaction.tokenOutAddress ? formatted : "%1 (%2)".arg(formatted).arg(Utils.compactAddress(transaction.tokenOutAddress, 4))
|
2023-07-18 14:05:22 +00:00
|
|
|
}
|
2024-09-24 11:51:22 +00:00
|
|
|
readonly property real feeEthValue: d.details ? root.currenciesStore.getFeeEthValue(d.details.totalFees) : 0
|
|
|
|
readonly property real feeFiatValue: root.currenciesStore.getFiatValue(d.feeEthValue, Constants.ethToken)
|
2024-07-08 08:28:04 +00:00
|
|
|
readonly property int transactionType: d.isTransactionValid ? WalletStores.RootStore.transactionType(transaction) : Constants.TransactionType.Send
|
2023-09-04 10:19:02 +00:00
|
|
|
readonly property bool isBridge: d.transactionType === Constants.TransactionType.Bridge
|
2022-09-05 09:15:47 +00:00
|
|
|
|
2023-06-07 14:16:23 +00:00
|
|
|
property string decodedInputData: ""
|
2023-07-10 13:36:29 +00:00
|
|
|
property bool loadingInputDate: false
|
2023-06-07 14:16:23 +00:00
|
|
|
|
2023-05-31 09:25:16 +00:00
|
|
|
function retryTransaction() {
|
|
|
|
// TODO handle failed transaction retry
|
|
|
|
}
|
2023-08-29 18:57:38 +00:00
|
|
|
|
|
|
|
function updateTransactionDetails() {
|
|
|
|
d.decodedInputData = ""
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.transaction)
|
2023-08-29 18:57:38 +00:00
|
|
|
return
|
|
|
|
|
2024-02-29 14:53:08 +00:00
|
|
|
root.controller.fetchExtraTxDetails()
|
2023-08-29 18:57:38 +00:00
|
|
|
}
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
|
2023-06-07 14:16:23 +00:00
|
|
|
Connections {
|
2024-10-02 07:50:10 +00:00
|
|
|
target: WalletStores.RootStore.walletSectionInst
|
2023-06-07 14:16:23 +00:00
|
|
|
function onTxDecoded(txHash: string, dataDecoded: string) {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid || (d.isDetailsValid && txHash !== d.details.txHashOut))
|
2023-06-07 14:16:23 +00:00
|
|
|
return
|
2023-07-10 13:36:29 +00:00
|
|
|
if (!dataDecoded) {
|
|
|
|
d.loadingInputDate = false
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-06-07 14:16:23 +00:00
|
|
|
try {
|
|
|
|
const decodedObject = JSON.parse(dataDecoded)
|
|
|
|
let text = qsTr("Function: %1").arg(decodedObject.signature)
|
|
|
|
text += "\n" + qsTr("MethodID: %1").arg(decodedObject.id)
|
|
|
|
for (const [key, value] of Object.entries(decodedObject.inputs)) {
|
|
|
|
text += "\n[%1]: %2".arg(key).arg(value)
|
|
|
|
}
|
|
|
|
d.decodedInputData = text
|
|
|
|
} catch(e) {
|
|
|
|
console.error("Failed to parse decoded tx data. Data:", dataDecoded)
|
|
|
|
}
|
2023-07-10 13:36:29 +00:00
|
|
|
d.loadingInputDate = false
|
2023-06-07 14:16:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-05 09:15:47 +00:00
|
|
|
StatusScrollView {
|
2023-05-31 09:25:16 +00:00
|
|
|
id: scrollView
|
2023-05-31 20:58:23 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
contentWidth: availableWidth
|
2022-09-05 09:15:47 +00:00
|
|
|
|
|
|
|
Column {
|
|
|
|
id: column
|
2023-05-31 20:58:23 +00:00
|
|
|
width: scrollView.availableWidth
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.xlPadding + Theme.halfPadding
|
2022-09-05 09:15:47 +00:00
|
|
|
|
2023-05-31 09:25:16 +00:00
|
|
|
Column {
|
2022-09-05 09:15:47 +00:00
|
|
|
width: parent.width
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.bigPadding
|
2023-05-31 09:25:16 +00:00
|
|
|
|
|
|
|
TransactionDelegate {
|
|
|
|
id: transactionHeader
|
|
|
|
objectName: "transactionDetailHeader"
|
|
|
|
width: parent.width
|
|
|
|
leftPadding: 0
|
2023-06-30 15:07:53 +00:00
|
|
|
sensor.enabled: false
|
|
|
|
color: Theme.palette.transparent
|
|
|
|
state: "header"
|
2023-05-31 09:25:16 +00:00
|
|
|
|
2023-07-26 11:50:27 +00:00
|
|
|
showAllAccounts: root.showAllAccounts
|
2023-05-31 09:25:16 +00:00
|
|
|
modelData: transaction
|
2024-02-29 14:53:08 +00:00
|
|
|
timeStampText: d.isTransactionValid ? qsTr("Signed at %1").arg(LocaleUtils.formatDateTime(transaction.timestamp * 1000, Locale.LongFormat)): ""
|
2024-09-24 11:51:22 +00:00
|
|
|
flatNetworks: root.rootStore.flatNetworks
|
|
|
|
currenciesStore: root.currenciesStore
|
2023-06-13 08:18:53 +00:00
|
|
|
walletRootStore: WalletStores.RootStore
|
2024-02-22 14:41:19 +00:00
|
|
|
community: isModelDataValid && communityId && communitiesStore ? communitiesStore.getCommunityDetailsAsJson(communityId) : null
|
2023-06-30 15:07:53 +00:00
|
|
|
|
2023-05-31 09:25:16 +00:00
|
|
|
onRetryClicked: d.retryTransaction()
|
2023-05-10 11:54:06 +00:00
|
|
|
}
|
2023-05-31 09:25:16 +00:00
|
|
|
|
|
|
|
Separator { }
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
|
|
|
|
2023-05-16 08:25:40 +00:00
|
|
|
WalletTxProgressBlock {
|
2023-05-31 09:25:16 +00:00
|
|
|
id: progressBlock
|
2023-05-16 08:25:40 +00:00
|
|
|
width: Math.min(513, root.width)
|
2024-02-29 14:53:08 +00:00
|
|
|
readonly property int latestBlockNumber: d.isTransactionValid && !pending && !error ? WalletStores.RootStore.getEstimatedLatestBlockNumber(d.transaction.chainId) : 0
|
|
|
|
readonly property int latestBlockNumberIn: d.isTransactionValid && !pending && !error && transactionHeader.isMultiTransaction && d.isBridge ? WalletStores.RootStore.getEstimatedLatestBlockNumber(d.transaction.chainIdIn) : 0
|
2023-06-12 13:04:39 +00:00
|
|
|
error: transactionHeader.transactionStatus === Constants.TransactionStatus.Failed
|
2023-08-02 04:36:54 +00:00
|
|
|
pending: transactionHeader.transactionStatus === Constants.TransactionStatus.Pending
|
2024-09-24 10:16:40 +00:00
|
|
|
outNetworkLayer: d.isTransactionValid ? Number(ModelUtils.getByKey(root.rootStore.flatNetworks, "chainId", transactionHeader.isMultiTransaction ? d.transaction.chainIdOut : d.transaction.chainId, "layer")) : 0
|
2024-03-13 17:38:16 +00:00
|
|
|
inNetworkLayer: d.isTransactionValid && transactionHeader.isMultiTransaction && d.isBridge ?
|
2024-09-24 10:16:40 +00:00
|
|
|
ModelUtils.getByKey(root.rootStore.flatNetworks, "chainId", d.transaction.chainIdIn, "layer") : 0
|
2024-02-29 14:53:08 +00:00
|
|
|
outNetworkTimestamp: d.isTransactionValid ? d.transaction.timestamp : 0
|
|
|
|
inNetworkTimestamp: d.isTransactionValid ? d.transaction.timestamp : 0
|
2023-09-04 10:19:02 +00:00
|
|
|
outChainName: transactionHeader.isMultiTransaction ? transactionHeader.networkNameOut : transactionHeader.networkName
|
|
|
|
inChainName: transactionHeader.isMultiTransaction && d.isBridge ? transactionHeader.networkNameIn : ""
|
2024-02-29 14:53:08 +00:00
|
|
|
outNetworkConfirmations: d.isTransactionValid && latestBlockNumber > 0 ? latestBlockNumber - d.blockNumberOut : 0
|
|
|
|
inNetworkConfirmations: d.isTransactionValid && latestBlockNumberIn > 0 ? latestBlockNumberIn - d.blockNumberIn : 0
|
2023-05-16 08:25:40 +00:00
|
|
|
}
|
|
|
|
|
2023-05-31 09:25:16 +00:00
|
|
|
Separator {
|
|
|
|
width: progressBlock.width
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
|
2023-06-02 08:29:40 +00:00
|
|
|
WalletNftPreview {
|
2024-02-29 14:53:08 +00:00
|
|
|
visible: d.isTransactionValid && transactionHeader.isNFT && !!transaction.nftImageUrl
|
2023-06-02 08:29:40 +00:00
|
|
|
width: Math.min(304, progressBlock.width)
|
2024-02-29 14:53:08 +00:00
|
|
|
nftName: d.isTransactionValid ? transaction.nftName : ""
|
|
|
|
nftUrl: d.isTransactionValid && !!transaction.nftImageUrl ? transaction.nftImageUrl : ""
|
2023-06-15 13:09:35 +00:00
|
|
|
strikethrough: d.transactionType === Constants.TransactionType.Destroy
|
2024-02-29 14:53:08 +00:00
|
|
|
tokenId: d.isTransactionValid ? transaction.tokenID : ""
|
|
|
|
tokenAddress: d.isTransactionValid ? transaction.tokenAddress : ""
|
2023-09-21 06:58:44 +00:00
|
|
|
areTestNetworksEnabled: WalletStores.RootStore.areTestNetworksEnabled
|
2024-02-20 09:31:04 +00:00
|
|
|
isGoerliEnabled: WalletStores.RootStore.isGoerliEnabled
|
2023-06-02 08:29:40 +00:00
|
|
|
}
|
|
|
|
|
2023-05-31 09:25:16 +00:00
|
|
|
Column {
|
|
|
|
width: progressBlock.width
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
width: parent.width
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor5
|
|
|
|
text: qsTr("Transaction summary")
|
|
|
|
elide: Text.ElideRight
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
2023-05-31 09:25:16 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
width: parent.width
|
2024-10-15 19:26:12 +00:00
|
|
|
height: Theme.smallPadding
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
|
|
|
|
2023-05-31 09:25:16 +00:00
|
|
|
DetailsPanel {
|
|
|
|
RowLayout {
|
|
|
|
spacing: 0
|
|
|
|
width: parent.width
|
2023-06-30 15:07:53 +00:00
|
|
|
height: fromNetworkTile.visible || toNetworkTile.visible ? 85 : 0
|
2023-05-31 09:25:16 +00:00
|
|
|
TransactionDataTile {
|
|
|
|
id: fromNetworkTile
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
title: qsTr("From")
|
|
|
|
subTitle: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid)
|
2023-08-18 08:56:57 +00:00
|
|
|
return ""
|
2023-06-15 13:09:35 +00:00
|
|
|
switch(d.transactionType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Swap:
|
2023-08-02 04:36:54 +00:00
|
|
|
return !!d.outSymbol ? d.outSymbol : " "
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Bridge:
|
2023-08-18 08:56:57 +00:00
|
|
|
return transactionHeader.networkNameOut
|
2023-05-31 09:25:16 +00:00
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
asset.name: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid)
|
2023-08-18 08:56:57 +00:00
|
|
|
return ""
|
2023-06-15 13:09:35 +00:00
|
|
|
switch(d.transactionType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Swap:
|
2023-08-02 04:36:54 +00:00
|
|
|
return Constants.tokenIcon(d.outSymbol)
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Bridge:
|
2024-10-15 19:26:12 +00:00
|
|
|
return Theme.svg(ModelUtils.getByKey(root.rootStore.flatNetworks, "chainId", d.transaction.chainIdOut, "iconUrl")) ?? Theme.svg("network/Network=Custom")
|
2023-05-31 09:25:16 +00:00
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
visible: !!subTitle
|
|
|
|
}
|
|
|
|
TransactionDataTile {
|
|
|
|
id: toNetworkTile
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
title: qsTr("To")
|
|
|
|
subTitle: {
|
2023-06-15 13:09:35 +00:00
|
|
|
switch(d.transactionType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Swap:
|
2023-08-02 04:36:54 +00:00
|
|
|
return !!d.inSymbol ? d.inSymbol : " "
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Bridge:
|
2023-08-18 08:56:57 +00:00
|
|
|
return transactionHeader.networkNameIn ?? " "
|
2023-05-31 09:25:16 +00:00
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
asset.name: {
|
2023-06-15 13:09:35 +00:00
|
|
|
switch(d.transactionType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Swap:
|
2023-08-02 04:36:54 +00:00
|
|
|
return Constants.tokenIcon(d.inSymbol)
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Bridge:
|
2024-10-15 19:26:12 +00:00
|
|
|
return Theme.svg(ModelUtils.getByKey(root.rootStore.flatNetworks, "chainId", d.transaction.chainIdIn, "iconUrl")) ?? Theme.svg("network/Network=Custom")
|
2023-05-31 09:25:16 +00:00
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
visible: !!subTitle
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TransactionAddressTile {
|
|
|
|
width: parent.width
|
2023-06-15 13:09:35 +00:00
|
|
|
title: d.transactionType === Constants.TransactionType.Swap || d.transactionType === Constants.TransactionType.Bridge ?
|
2023-05-31 09:25:16 +00:00
|
|
|
qsTr("In") : qsTr("From")
|
2024-03-20 17:45:30 +00:00
|
|
|
addresses: d.isTransactionValid && d.reEvaluateSender? [d.transaction.sender] : []
|
2023-05-31 09:25:16 +00:00
|
|
|
contactsStore: root.contactsStore
|
|
|
|
rootStore: WalletStores.RootStore
|
|
|
|
onButtonClicked: {
|
2023-06-15 13:09:35 +00:00
|
|
|
if (d.transactionType === Constants.TransactionType.Swap || d.transactionType === Constants.TransactionType.Bridge) {
|
2023-09-22 10:03:15 +00:00
|
|
|
addressMenu.openEthAddressMenu(this, addresses[0], [d.networkShortNameIn, d.networkShortNameOut])
|
2023-05-31 09:25:16 +00:00
|
|
|
} else {
|
2023-09-22 10:03:15 +00:00
|
|
|
addressMenu.openSenderMenu(this, addresses[0], [d.networkShortName])
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-24 11:18:42 +00:00
|
|
|
TransactionDataTile {
|
|
|
|
id: contractDeploymentTile
|
2023-12-01 14:31:47 +00:00
|
|
|
readonly property bool hasValue: d.isDetailsValid && !!d.details.contractOut
|
2023-07-24 11:18:42 +00:00
|
|
|
&& transactionHeader.transactionStatus !== Constants.TransactionStatus.Pending
|
|
|
|
&& transactionHeader.transactionStatus !== Constants.TransactionStatus.Failed
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("To")
|
|
|
|
visible: d.transactionType === Constants.TransactionType.ContractDeployment
|
|
|
|
subTitle: {
|
|
|
|
if (transactionHeader.transactionStatus === Constants.TransactionStatus.Failed) {
|
|
|
|
return qsTr("Contract address not created")
|
|
|
|
} else if (!hasValue) {
|
|
|
|
return qsTr("Awaiting contract address...")
|
|
|
|
}
|
2023-08-30 12:10:59 +00:00
|
|
|
return qsTr("Contract created") + "\n" + d.details.contract
|
2023-07-24 11:18:42 +00:00
|
|
|
}
|
|
|
|
buttonIconName: hasValue ? "more" : ""
|
|
|
|
statusListItemSubTitle.customColor: hasValue ? Theme.palette.directColor1 : Theme.palette.directColor5
|
2023-09-22 10:03:15 +00:00
|
|
|
onButtonClicked: addressMenu.openContractMenu(this, d.details.contract, [d.networkShortName], d.symbol)
|
2023-07-24 11:18:42 +00:00
|
|
|
components: [
|
|
|
|
Loader {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.verticalCenterOffset: Theme.halfPadding
|
2023-07-24 11:18:42 +00:00
|
|
|
active: transactionHeader.transactionStatus === Constants.TransactionStatus.Pending
|
|
|
|
width: active ? implicitWidth : 0
|
|
|
|
sourceComponent: StatusLoadingIndicator { }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2023-05-31 09:25:16 +00:00
|
|
|
TransactionAddressTile {
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("To")
|
2024-03-20 17:45:30 +00:00
|
|
|
addresses: d.isTransactionValid && visible && d.reEvaluateRecipient? [d.transaction.recipient] : []
|
2023-05-31 09:25:16 +00:00
|
|
|
contactsStore: root.contactsStore
|
|
|
|
rootStore: WalletStores.RootStore
|
2023-09-22 10:03:15 +00:00
|
|
|
onButtonClicked: addressMenu.openReceiverMenu(this, addresses[0], [d.networkShortName])
|
2023-07-24 11:18:42 +00:00
|
|
|
visible: d.transactionType !== Constants.TransactionType.ContractDeployment && d.transactionType !== Constants.TransactionType.Swap && d.transactionType !== Constants.TransactionType.Bridge && d.transactionType !== Constants.TransactionType.Destroy
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
|
|
|
TransactionDataTile {
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("Using")
|
2023-08-30 12:10:59 +00:00
|
|
|
subTitle: d.isDetailsValid ? d.details.protocol : ""
|
2024-10-15 19:26:12 +00:00
|
|
|
asset.name: d.isDetailsValid && d.details.protocol ? Theme.svg("protocol/Protocol=%1".arg(d.details.protocol)) : Theme.svg("network/Network=Custom")
|
2023-08-30 12:10:59 +00:00
|
|
|
iconSettings.bgRadius: iconSettings.bgWidth / 2
|
|
|
|
// buttonIconName: "external" // TODO handle external link #11982
|
2023-05-31 09:25:16 +00:00
|
|
|
visible: !!subTitle
|
|
|
|
}
|
|
|
|
TransactionDataTile {
|
|
|
|
width: parent.width
|
2023-06-30 15:07:53 +00:00
|
|
|
title: qsTr("%1 Tx hash").arg(transactionHeader.networkName)
|
2023-12-06 10:59:32 +00:00
|
|
|
subTitle: d.isDetailsValid ? d.details.txHash : ""
|
|
|
|
visible: !!subTitle && !transactionHeader.isMultiTransaction
|
2023-05-31 09:25:16 +00:00
|
|
|
buttonIconName: "more"
|
2023-09-22 10:03:15 +00:00
|
|
|
onButtonClicked: addressMenu.openTxMenu(this, subTitle, [d.networkShortName])
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
2023-12-06 10:59:32 +00:00
|
|
|
TransactionDataTile {
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("%1 Tx hash").arg(transactionHeader.networkNameOut)
|
|
|
|
subTitle: d.isDetailsValid ? d.details.txHashOut : ""
|
|
|
|
visible: !!subTitle && transactionHeader.isMultiTransaction
|
|
|
|
buttonIconName: "more"
|
|
|
|
onButtonClicked: addressMenu.openTxMenu(this, subTitle, [d.networkShortNameOut])
|
|
|
|
}
|
2023-05-31 09:25:16 +00:00
|
|
|
TransactionDataTile {
|
|
|
|
width: parent.width
|
2023-08-18 08:56:57 +00:00
|
|
|
title: qsTr("%1 Tx hash").arg(transactionHeader.networkNameIn)
|
2023-12-01 14:31:47 +00:00
|
|
|
subTitle: d.isDetailsValid ? d.details.txHashIn : ""
|
2023-12-06 10:59:32 +00:00
|
|
|
visible: !!subTitle && transactionHeader.isMultiTransaction
|
2023-05-31 09:25:16 +00:00
|
|
|
buttonIconName: "more"
|
2023-09-22 10:03:15 +00:00
|
|
|
onButtonClicked: addressMenu.openTxMenu(this, subTitle, [d.networkShortNameIn])
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
2023-12-01 14:31:47 +00:00
|
|
|
// TransactionContractTile {
|
|
|
|
// // Used for Bridge and Swap to display 'From' network Protocol contract address
|
|
|
|
// address: "" // TODO fill protocol contract address for 'from' network for Bridge and Swap
|
|
|
|
// symbol: "" // TODO fill protocol name for Bridge and Swap
|
|
|
|
// networkName: transactionHeader.networkName
|
|
|
|
// shortNetworkName: d.networkShortName
|
|
|
|
// visible: !!subTitle && (d.transactionType === Constants.TransactionType.Bridge || d.transactionType === Constants.TransactionType.Swap)
|
|
|
|
// }
|
2023-05-31 09:25:16 +00:00
|
|
|
TransactionContractTile {
|
|
|
|
// Used to display contract address for any network
|
2023-12-01 14:31:47 +00:00
|
|
|
address: d.isDetailsValid ? d.details.contractIn : ""
|
2023-07-18 14:05:22 +00:00
|
|
|
symbol: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid)
|
2023-07-18 14:05:22 +00:00
|
|
|
return ""
|
2023-08-02 04:36:54 +00:00
|
|
|
return d.symbol ? d.symbol : "(%1)".arg(Utils.compactAddress(transaction.tokenAddress, 4))
|
2023-07-18 14:05:22 +00:00
|
|
|
}
|
2023-06-30 15:07:53 +00:00
|
|
|
networkName: transactionHeader.networkName
|
2023-05-31 09:25:16 +00:00
|
|
|
shortNetworkName: d.networkShortName
|
2023-07-24 11:18:42 +00:00
|
|
|
visible: !!subTitle && d.transactionType !== Constants.TransactionType.ContractDeployment
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
2023-12-01 14:31:47 +00:00
|
|
|
// TransactionContractTile {
|
|
|
|
// // Used for Bridge to display 'To' network Protocol contract address
|
|
|
|
// address: "" // TODO fill protocol contract address for 'to' network for Bridge
|
|
|
|
// symbol: "" // TODO fill protocol name for Bridge
|
|
|
|
// networkName: transactionHeader.networkNameOut
|
|
|
|
// shortNetworkName: d.networkShortNameOut
|
|
|
|
// visible: !!subTitle && d.transactionType === Constants.TransactionType.Bridge
|
|
|
|
// }
|
2023-05-31 09:25:16 +00:00
|
|
|
TransactionContractTile {
|
|
|
|
// Used for Bridge and Swap to display 'To' network token contract address
|
|
|
|
address: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid)
|
2023-05-31 09:25:16 +00:00
|
|
|
return ""
|
2023-06-15 13:09:35 +00:00
|
|
|
switch(d.transactionType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Swap:
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-12-01 14:31:47 +00:00
|
|
|
return d.isDetailsValid ? d.details.contractOut : ""
|
2023-05-31 09:25:16 +00:00
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
symbol: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid)
|
2023-05-31 09:25:16 +00:00
|
|
|
return ""
|
2023-06-15 13:09:35 +00:00
|
|
|
switch(d.transactionType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Swap:
|
2023-06-30 15:07:53 +00:00
|
|
|
return d.inSymbol
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Bridge:
|
2023-06-30 15:07:53 +00:00
|
|
|
return d.outSymbol
|
2023-05-31 09:25:16 +00:00
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
2023-08-18 08:56:57 +00:00
|
|
|
networkName: transactionHeader.networkNameIn
|
|
|
|
shortNetworkName: d.networkShortNameIn
|
2024-02-29 14:53:08 +00:00
|
|
|
visible: d.isTransactionValid && !!subTitle
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
|
2023-05-31 09:25:16 +00:00
|
|
|
Item {
|
|
|
|
width: parent.width
|
2024-10-15 19:26:12 +00:00
|
|
|
height: Theme.bigPadding
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DetailsPanel {
|
|
|
|
width: progressBlock.width
|
|
|
|
RowLayout {
|
|
|
|
width: parent.width
|
2023-07-10 13:36:29 +00:00
|
|
|
height: networkNameTile.statusListItemSubTitle.lineCount > 1 ? 85 : 70
|
2023-05-31 09:25:16 +00:00
|
|
|
spacing: 0
|
|
|
|
TransactionDataTile {
|
|
|
|
id: multichainNetworksTile
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
title: qsTr("Networks")
|
|
|
|
visible: d.multichainNetworks.length > 0
|
|
|
|
Row {
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
topMargin: multichainNetworksTile.statusListItemTitleArea.height + multichainNetworksTile.topPadding
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: multichainNetworksTile.leftPadding
|
|
|
|
}
|
|
|
|
spacing: -4
|
|
|
|
Repeater {
|
|
|
|
model: d.multichainNetworks
|
|
|
|
delegate: StatusRoundedImage {
|
|
|
|
width: 20
|
|
|
|
height: 20
|
|
|
|
visible: image.source !== ""
|
|
|
|
border.width: index === 0 ? 0 : 1
|
|
|
|
border.color: Theme.palette.white
|
2024-10-15 19:26:12 +00:00
|
|
|
image.source: Theme.svg("tiny/" + modelData)
|
2023-05-31 09:25:16 +00:00
|
|
|
z: index + 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TransactionDataTile {
|
2023-07-10 13:36:29 +00:00
|
|
|
id: networkNameTile
|
2023-05-31 09:25:16 +00:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
title: qsTr("Network")
|
2023-06-30 15:07:53 +00:00
|
|
|
subTitle: transactionHeader.networkName
|
2024-10-15 19:26:12 +00:00
|
|
|
asset.name: !!d.networkIcon ? Theme.svg(d.networkIcon) : ""
|
2023-07-10 13:36:29 +00:00
|
|
|
subTitleBadgeLoaderAlignment: Qt.AlignTop
|
2023-05-31 09:25:16 +00:00
|
|
|
smallIcon: true
|
2023-08-02 04:36:54 +00:00
|
|
|
visible: !!subTitle && d.transactionType !== Constants.TransactionType.Bridge
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
|
|
|
TransactionDataTile {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
title: qsTr("Token format")
|
2023-10-26 08:01:52 +00:00
|
|
|
subTitle: d.isDetailsValid ? d.details.tokenType.toUpperCase() : ""
|
2023-05-31 09:25:16 +00:00
|
|
|
visible: !!subTitle
|
|
|
|
}
|
|
|
|
TransactionDataTile {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
title: qsTr("Nonce")
|
2023-08-30 12:10:59 +00:00
|
|
|
subTitle: d.isDetailsValid ? d.details.nonce : ""
|
2023-05-31 09:25:16 +00:00
|
|
|
visible: !!subTitle
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TransactionDataTile {
|
|
|
|
width: parent.width
|
2023-07-10 13:36:29 +00:00
|
|
|
height: d.loadingInputDate ? 112 : Math.min(implicitHeight + bottomPadding, 112)
|
2023-05-31 09:25:16 +00:00
|
|
|
title: qsTr("Input data")
|
2023-07-10 13:36:29 +00:00
|
|
|
// Input string can be really long. Getting substring just for 3+ lines to speedup formatting.
|
2023-06-07 14:16:23 +00:00
|
|
|
subTitle: {
|
2023-07-10 13:36:29 +00:00
|
|
|
if (d.loadingInputDate) {
|
|
|
|
return ""
|
|
|
|
} else if (!!d.decodedInputData) {
|
2023-07-19 14:16:45 +00:00
|
|
|
return d.decodedInputData.substring(0, 200)
|
2023-08-30 12:10:59 +00:00
|
|
|
} else if (d.isDetailsValid) {
|
|
|
|
return String(d.details.input).substring(0, 200)
|
2023-06-07 14:16:23 +00:00
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
2023-07-10 13:36:29 +00:00
|
|
|
visible: !!subTitle || d.loadingInputDate
|
|
|
|
buttonIconName: d.loadingInputDate ? "" : "more"
|
2023-06-07 14:16:23 +00:00
|
|
|
statusListItemSubTitle.maximumLineCount: 4
|
|
|
|
statusListItemSubTitle.lineHeight: 1.21
|
|
|
|
statusListItemSubTitle.layer.enabled: statusListItemSubTitle.lineCount > 3
|
|
|
|
statusListItemSubTitle.layer.effect: OpacityMask {
|
|
|
|
maskSource: Rectangle {
|
|
|
|
width: 10
|
|
|
|
height: 10
|
|
|
|
gradient: Gradient {
|
|
|
|
GradientStop { position: 0.0; color: "#f00" }
|
|
|
|
GradientStop { position: 0.4; color: "#a0ff0000" }
|
|
|
|
GradientStop { position: 0.75; color: "#00ff0000" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-10 13:36:29 +00:00
|
|
|
tertiaryTitle: !d.loadingInputDate && !d.decodedInputData ? qsTr("Data could not be decoded") : ""
|
2023-08-16 14:06:56 +00:00
|
|
|
statusListItemTertiaryTitle.anchors.top: undefined
|
2023-07-10 13:36:29 +00:00
|
|
|
statusListItemTertiaryTitle.anchors.baseline: statusListItemTitle.baseline
|
|
|
|
statusListItemTertiaryTitle.font: statusListItemTitle.font
|
2023-08-30 12:10:59 +00:00
|
|
|
onButtonClicked: addressMenu.openInputDataMenu(this, !!d.decodedInputData ? d.decodedInputData : d.details.input)
|
2023-07-10 13:36:29 +00:00
|
|
|
|
|
|
|
Loader {
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
bottom: parent.bottom
|
|
|
|
right: parent.right
|
|
|
|
margins: 12
|
|
|
|
}
|
|
|
|
active: d.loadingInputDate
|
|
|
|
sourceComponent: Column {
|
|
|
|
spacing: 10
|
|
|
|
Repeater {
|
|
|
|
model: 3
|
|
|
|
LoadingComponent {
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
right: index === 2 ? parent.horizontalCenter : parent.right
|
|
|
|
}
|
|
|
|
height: 11
|
|
|
|
radius: 4
|
|
|
|
enabled: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
|
|
|
TransactionDataTile {
|
2023-12-01 14:31:47 +00:00
|
|
|
// Tile used only for multiTx
|
2023-05-31 09:25:16 +00:00
|
|
|
width: parent.width
|
2023-12-01 14:31:47 +00:00
|
|
|
title: !!transactionHeader.networkNameOut ? qsTr("Included in Block on %1").arg(transactionHeader.networkNameOut) : qsTr("Included on Block")
|
|
|
|
subTitle: d.blockNumberOut
|
2024-02-29 14:53:08 +00:00
|
|
|
tertiaryTitle: d.isTransactionValid ? LocaleUtils.formatDateTime(transaction.timestamp * 1000, Locale.LongFormat) : ""
|
2023-12-01 14:31:47 +00:00
|
|
|
visible: d.blockNumberOut > 0 && transactionHeader.isMultiTransaction
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
|
|
|
TransactionDataTile {
|
2023-12-01 14:31:47 +00:00
|
|
|
// Tile used for multiTx and normal tx
|
2023-05-31 09:25:16 +00:00
|
|
|
width: parent.width
|
2023-12-01 14:31:47 +00:00
|
|
|
readonly property int blockNumber: transactionHeader.isMultiTransaction ? d.blockNumberIn : d.blockNumber
|
|
|
|
readonly property string networkName: transactionHeader.isMultiTransaction ? transactionHeader.networkNameIn : transactionHeader.networkName
|
|
|
|
title: !!networkName ? qsTr("Included in Block on %1").arg(networkName) : qsTr("Included on Block")
|
|
|
|
subTitle: blockNumber
|
2024-02-29 14:53:08 +00:00
|
|
|
tertiaryTitle: d.isTransactionValid ? LocaleUtils.formatDateTime(transaction.timestamp * 1000, Locale.LongFormat) : ""
|
2023-12-01 14:31:47 +00:00
|
|
|
visible: blockNumber > 0
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
|
|
|
|
2023-06-05 06:22:30 +00:00
|
|
|
Column {
|
|
|
|
width: progressBlock.width
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.smallPadding
|
2023-06-30 15:07:53 +00:00
|
|
|
visible: !(transactionHeader.isNFT && d.isIncoming)
|
2022-09-05 09:15:47 +00:00
|
|
|
|
2023-06-05 06:22:30 +00:00
|
|
|
RowLayout {
|
|
|
|
width: parent.width
|
2023-09-21 06:58:44 +00:00
|
|
|
visible: amountSentTile.visible || amountReceiveTile.visible || feesTile.visible || totalTile.visible
|
2023-06-05 06:22:30 +00:00
|
|
|
StatusBaseText {
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor5
|
|
|
|
text: qsTr("Values")
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
|
2023-06-05 06:22:30 +00:00
|
|
|
StatusBaseText {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor5
|
2024-02-29 14:53:08 +00:00
|
|
|
text: d.isTransactionValid ? qsTr("as of %1").arg(LocaleUtils.formatDateTime(transaction.timestamp * 1000, Locale.LongFormat)) : ""
|
2023-06-05 06:22:30 +00:00
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
2023-06-05 06:22:30 +00:00
|
|
|
|
|
|
|
DetailsPanel {
|
|
|
|
TransactionDataTile {
|
2023-09-21 06:58:44 +00:00
|
|
|
id: amountSentTile
|
2023-06-05 06:22:30 +00:00
|
|
|
width: parent.width
|
|
|
|
title: qsTr("Amount sent")
|
2023-06-30 15:07:53 +00:00
|
|
|
subTitle: transactionHeader.isMultiTransaction ? d.outCryptoValueFormatted : d.cryptoValueFormatted
|
|
|
|
tertiaryTitle: transactionHeader.isMultiTransaction ? d.outFiatValueFormatted : d.fiatValueFormatted
|
2023-06-05 06:22:30 +00:00
|
|
|
visible: {
|
2023-06-30 15:07:53 +00:00
|
|
|
if (transactionHeader.isNFT)
|
2023-06-05 06:22:30 +00:00
|
|
|
return false
|
2023-06-15 13:09:35 +00:00
|
|
|
switch(d.transactionType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Send:
|
|
|
|
case Constants.TransactionType.Swap:
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-06-05 06:22:30 +00:00
|
|
|
return true
|
|
|
|
default:
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TransactionDataTile {
|
2023-09-21 06:58:44 +00:00
|
|
|
id: amountReceiveTile
|
2023-06-05 06:22:30 +00:00
|
|
|
width: parent.width
|
2023-07-24 11:18:42 +00:00
|
|
|
title: transactionHeader.transactionStatus === Constants.TransactionStatus.Pending ? qsTr("Amount to receive") : qsTr("Amount received")
|
2023-06-05 06:22:30 +00:00
|
|
|
subTitle: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid || transactionHeader.isNFT)
|
2023-06-05 06:22:30 +00:00
|
|
|
return ""
|
2023-06-15 13:09:35 +00:00
|
|
|
const type = d.transactionType
|
2023-06-12 13:04:39 +00:00
|
|
|
if (type === Constants.TransactionType.Swap) {
|
2024-09-24 11:51:22 +00:00
|
|
|
return root.currenciesStore.formatCurrencyAmount(transactionHeader.inCryptoValue, d.inSymbol)
|
2023-06-12 13:04:39 +00:00
|
|
|
} else if (type === Constants.TransactionType.Bridge) {
|
2023-06-05 06:22:30 +00:00
|
|
|
// Reduce crypto value by fee value
|
2024-09-24 11:51:22 +00:00
|
|
|
const valueInCrypto = root.currenciesStore.getCryptoValue(transactionHeader.outFiatValue - d.feeFiatValue, d.inSymbol)
|
|
|
|
return root.currenciesStore.formatCurrencyAmount(valueInCrypto, d.inSymbol)
|
2023-06-05 06:22:30 +00:00
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
tertiaryTitle: {
|
2023-06-15 13:09:35 +00:00
|
|
|
const type = d.transactionType
|
2023-06-12 13:04:39 +00:00
|
|
|
if (type === Constants.TransactionType.Swap) {
|
2024-09-24 11:51:22 +00:00
|
|
|
return root.currenciesStore.formatCurrencyAmount(transactionHeader.inFiatValue, root.currenciesStore.currentCurrency)
|
2023-06-12 13:04:39 +00:00
|
|
|
} else if (type === Constants.TransactionType.Bridge) {
|
2024-09-24 11:51:22 +00:00
|
|
|
return root.currenciesStore.formatCurrencyAmount(transactionHeader.outFiatValue - d.feeFiatValue, root.currenciesStore.currentCurrency)
|
2023-06-05 06:22:30 +00:00
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
visible: !!subTitle
|
|
|
|
}
|
|
|
|
TransactionDataTile {
|
2023-09-21 06:58:44 +00:00
|
|
|
id: feesTile
|
2023-06-05 06:22:30 +00:00
|
|
|
width: parent.width
|
2023-07-18 14:05:22 +00:00
|
|
|
title: d.symbol ? qsTr("Fees") : qsTr("Estimated max fee")
|
2023-06-05 06:22:30 +00:00
|
|
|
subTitle: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid || transactionHeader.isNFT || !d.isDetailsValid)
|
2023-06-05 06:22:30 +00:00
|
|
|
return ""
|
2023-07-18 14:05:22 +00:00
|
|
|
if (!d.symbol) {
|
2024-09-24 11:51:22 +00:00
|
|
|
const maxFeeEth = root.currenciesStore.getFeeEthValue(d.details.maxTotalFees)
|
|
|
|
return root.currenciesStore.formatCurrencyAmount(maxFeeEth, Constants.ethToken)
|
2023-07-18 14:05:22 +00:00
|
|
|
}
|
|
|
|
|
2023-06-15 13:09:35 +00:00
|
|
|
switch(d.transactionType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
case Constants.TransactionType.Send:
|
|
|
|
case Constants.TransactionType.Swap:
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-09-11 10:08:21 +00:00
|
|
|
return LocaleUtils.currencyAmountToLocaleString(d.details.totalFees)
|
2023-06-05 06:22:30 +00:00
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
2023-07-18 14:05:22 +00:00
|
|
|
tertiaryTitle: {
|
|
|
|
if (!subTitle)
|
|
|
|
return ""
|
|
|
|
let fiatValue
|
|
|
|
if (!d.symbol) {
|
2024-09-24 11:51:22 +00:00
|
|
|
const maxFeeEth = root.currenciesStore.getFeeEthValue(d.details.maxTotalFees)
|
|
|
|
fiatValue = root.currenciesStore.getFiatValue(maxFeeEth, Constants.ethToken)
|
2023-07-18 14:05:22 +00:00
|
|
|
} else {
|
|
|
|
fiatValue = d.feeFiatValue
|
|
|
|
}
|
2024-09-24 11:51:22 +00:00
|
|
|
return root.currenciesStore.formatCurrencyAmount(fiatValue, root.currenciesStore.currentCurrency)
|
2023-07-18 14:05:22 +00:00
|
|
|
}
|
2023-06-05 06:22:30 +00:00
|
|
|
visible: !!subTitle
|
|
|
|
}
|
|
|
|
TransactionDataTile {
|
2023-09-21 06:58:44 +00:00
|
|
|
id: totalTile
|
2023-06-05 06:22:30 +00:00
|
|
|
width: parent.width
|
2023-07-24 11:18:42 +00:00
|
|
|
readonly property bool fieldIsHidden: (transactionHeader.isNFT && d.isIncoming) || !d.symbol
|
|
|
|
readonly property bool showMaxFee: d.transactionType === Constants.TransactionType.ContractDeployment && transactionHeader.transactionStatus === Constants.TransactionStatus.Pending
|
|
|
|
readonly property bool showFee: d.transactionType === Constants.TransactionType.Destroy || transactionHeader.isNFT || d.transactionType === Constants.TransactionType.ContractDeployment
|
|
|
|
readonly property bool showValue: d.transactionType === Constants.TransactionType.Receive || (d.transactionType === Constants.TransactionType.Buy && progressBlock.isLayer1)
|
|
|
|
// NOTE Using fees in this tile because of same higlight and color settings as Total
|
|
|
|
title: {
|
|
|
|
if (showMaxFee) {
|
|
|
|
return qsTr("Estimated max fee")
|
|
|
|
} else if (showFee) {
|
|
|
|
return qsTr("Fees")
|
|
|
|
}
|
|
|
|
return qsTr("Total")
|
|
|
|
}
|
2023-06-05 06:22:30 +00:00
|
|
|
subTitle: {
|
2023-07-24 11:18:42 +00:00
|
|
|
if (fieldIsHidden)
|
2023-06-05 06:22:30 +00:00
|
|
|
return ""
|
2023-07-24 11:18:42 +00:00
|
|
|
if (showMaxFee) {
|
2024-09-24 11:51:22 +00:00
|
|
|
const maxFeeEth = root.currenciesStore.getFeeEthValue(d.details.maxTotalFees)
|
|
|
|
return root.currenciesStore.formatCurrencyAmount(maxFeeEth, Constants.ethToken)
|
2023-07-24 11:18:42 +00:00
|
|
|
} else if (showFee) {
|
2024-09-24 11:51:22 +00:00
|
|
|
return root.currenciesStore.formatCurrencyAmount(d.feeEthValue, Constants.ethToken)
|
2023-07-24 11:18:42 +00:00
|
|
|
} else if (showValue) {
|
2023-06-05 06:22:30 +00:00
|
|
|
return d.cryptoValueFormatted
|
|
|
|
}
|
2023-06-30 15:07:53 +00:00
|
|
|
const cryptoValue = transactionHeader.isMultiTransaction ? d.outCryptoValueFormatted : d.cryptoValueFormatted
|
2024-09-24 11:51:22 +00:00
|
|
|
return "%1 + %2".arg(cryptoValue).arg(root.currenciesStore.formatCurrencyAmount(d.feeEthValue, Constants.ethToken))
|
2023-06-05 06:22:30 +00:00
|
|
|
}
|
|
|
|
tertiaryTitle: {
|
2023-07-24 11:18:42 +00:00
|
|
|
if (fieldIsHidden)
|
2023-06-05 06:22:30 +00:00
|
|
|
return ""
|
2023-07-24 11:18:42 +00:00
|
|
|
if (showMaxFee) {
|
2024-09-24 11:51:22 +00:00
|
|
|
const maxFeeEth = root.currenciesStore.getFeeEthValue(d.details.maxTotalFees)
|
|
|
|
const maxFeeFiat = root.currenciesStore.getFiatValue(d.feeEthValue, Constants.ethToken)
|
|
|
|
return root.currenciesStore.formatCurrencyAmount(maxFeeFiat, root.currenciesStore.currentCurrency)
|
2023-07-24 11:18:42 +00:00
|
|
|
} else if (showFee) {
|
2024-09-24 11:51:22 +00:00
|
|
|
return root.currenciesStore.formatCurrencyAmount(d.feeFiatValue, root.currenciesStore.currentCurrency)
|
2023-07-24 11:18:42 +00:00
|
|
|
} else if (showValue) {
|
2023-06-05 06:22:30 +00:00
|
|
|
return d.fiatValueFormatted
|
|
|
|
}
|
2023-06-30 15:07:53 +00:00
|
|
|
const fiatValue = transactionHeader.isMultiTransaction ? transactionHeader.outFiatValue : transactionHeader.fiatValue
|
2024-09-24 11:51:22 +00:00
|
|
|
return root.currenciesStore.formatCurrencyAmount(fiatValue + d.feeFiatValue, root.currenciesStore.currentCurrency)
|
2023-06-05 06:22:30 +00:00
|
|
|
}
|
|
|
|
visible: !!subTitle
|
|
|
|
highlighted: true
|
|
|
|
statusListItemTertiaryTitle.customColor: Theme.palette.directColor1
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
|
|
|
}
|
2023-09-27 13:41:55 +00:00
|
|
|
|
2023-06-13 08:18:53 +00:00
|
|
|
Separator {
|
|
|
|
width: progressBlock.width
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
width: progressBlock.width
|
2024-02-29 14:53:08 +00:00
|
|
|
visible: d.isTransactionValid
|
2023-06-13 08:18:53 +00:00
|
|
|
spacing: 8
|
|
|
|
StatusButton {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: copyDetailsButton.height
|
|
|
|
text: qsTr("Repeat transaction")
|
|
|
|
size: StatusButton.Small
|
2023-09-27 13:41:55 +00:00
|
|
|
|
2024-02-29 14:53:08 +00:00
|
|
|
property alias tx: d.transaction
|
2023-09-27 13:41:55 +00:00
|
|
|
|
|
|
|
visible: {
|
2024-07-31 11:58:05 +00:00
|
|
|
if (!d.isTransactionValid || root.overview.isWatchOnlyAccount || root.overview.isAllAccounts)
|
2023-09-27 13:41:55 +00:00
|
|
|
return false
|
|
|
|
|
|
|
|
return WalletStores.RootStore.isTxRepeatable(tx)
|
|
|
|
}
|
2023-06-13 08:18:53 +00:00
|
|
|
onClicked: {
|
2023-09-27 13:41:55 +00:00
|
|
|
let asset = WalletStores.RootStore.getAssetForSendTx(tx)
|
2024-07-02 11:19:37 +00:00
|
|
|
const req = Helpers.lookupAddressesForSendModal(WalletStores.RootStore.accounts,
|
|
|
|
WalletStores.RootStore.savedAddresses,
|
|
|
|
tx.sender,
|
|
|
|
tx.recipient,
|
|
|
|
asset,
|
|
|
|
tx.isNFT,
|
2024-07-31 11:58:05 +00:00
|
|
|
tx.amount,
|
|
|
|
tx.chainId)
|
2023-09-27 13:41:55 +00:00
|
|
|
|
2024-07-17 14:49:42 +00:00
|
|
|
root.sendModal.preSelectedAccountAddress = req.preSelectedAccount.address
|
2023-09-27 13:41:55 +00:00
|
|
|
root.sendModal.preSelectedRecipient = req.preSelectedRecipient
|
|
|
|
root.sendModal.preSelectedRecipientType = req.preSelectedRecipientType
|
|
|
|
root.sendModal.preSelectedHoldingID = req.preSelectedHoldingID
|
|
|
|
root.sendModal.preSelectedHoldingType = req.preSelectedHoldingType
|
|
|
|
root.sendModal.preSelectedSendType = req.preSelectedSendType
|
|
|
|
root.sendModal.preDefinedAmountToSend = req.preDefinedAmountToSend
|
2024-07-31 11:58:05 +00:00
|
|
|
root.sendModal.preSelectedChainId = req.preSelectedChainId
|
2023-09-27 13:41:55 +00:00
|
|
|
root.sendModal.onlyAssets = false
|
|
|
|
root.sendModal.open()
|
2023-06-13 08:18:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
StatusButton {
|
|
|
|
id: copyDetailsButton
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: qsTr("Copy details")
|
|
|
|
icon.name: "copy"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 20
|
|
|
|
size: StatusButton.Small
|
2024-08-27 14:35:52 +00:00
|
|
|
onClicked: ClipboardUtils.setText(transactionHeader.getDetailsString(d.details))
|
2023-06-13 08:18:53 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
|
|
|
}
|
2023-05-23 08:44:35 +00:00
|
|
|
|
|
|
|
TransactionAddressMenu {
|
|
|
|
id: addressMenu
|
|
|
|
|
2023-07-21 10:55:36 +00:00
|
|
|
areTestNetworksEnabled: WalletStores.RootStore.areTestNetworksEnabled
|
2024-02-20 09:31:04 +00:00
|
|
|
isGoerliEnabled: WalletStores.RootStore.isGoerliEnabled
|
2023-05-23 08:44:35 +00:00
|
|
|
contactsStore: root.contactsStore
|
2024-02-02 09:55:56 +00:00
|
|
|
networkConnectionStore: root.networkConnectionStore
|
2023-05-23 08:44:35 +00:00
|
|
|
onOpenSendModal: (address) => root.sendModal.open(address)
|
|
|
|
}
|
2023-05-31 09:25:16 +00:00
|
|
|
|
|
|
|
component DetailsPanel: Item {
|
|
|
|
width: parent.width
|
2023-06-30 15:07:53 +00:00
|
|
|
height: {
|
|
|
|
// Using childrenRect and transactionvalid properties to refresh this binding
|
2024-02-29 14:53:08 +00:00
|
|
|
if (!d.isTransactionValid || detailsColumn.childrenRect.height === 0)
|
2023-06-30 15:07:53 +00:00
|
|
|
return 0
|
|
|
|
|
|
|
|
// Height is calculated from visible children because Column doesn't handle
|
|
|
|
// visibility change properly and childrenRect.height gives different values
|
|
|
|
// comparing to manual check
|
|
|
|
var visibleHeight = 0
|
|
|
|
for (var i = 0 ; i < detailsColumn.children.length ; i++) {
|
|
|
|
if (detailsColumn.children[i].visible)
|
|
|
|
visibleHeight += detailsColumn.children[i].height
|
|
|
|
}
|
|
|
|
return visibleHeight
|
|
|
|
}
|
|
|
|
|
2023-05-31 09:25:16 +00:00
|
|
|
default property alias content: detailsColumn.children
|
2023-06-16 09:37:17 +00:00
|
|
|
|
2023-05-31 09:25:16 +00:00
|
|
|
Rectangle {
|
|
|
|
id: tileBackground
|
|
|
|
anchors.fill: parent
|
2024-10-15 19:26:12 +00:00
|
|
|
color: Theme.palette.transparent
|
2023-05-31 09:25:16 +00:00
|
|
|
radius: 8
|
|
|
|
border.width: 1
|
2024-10-15 19:26:12 +00:00
|
|
|
border.color: Theme.palette.separator
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: detailsColumn
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 1
|
|
|
|
spacing: 0
|
|
|
|
layer.enabled: true
|
|
|
|
layer.effect: OpacityMask {
|
2023-06-16 09:37:17 +00:00
|
|
|
// Separate rectangle is used as mask because background rectangle must be transaprent
|
|
|
|
maskSource: Rectangle {
|
|
|
|
width: tileBackground.width
|
|
|
|
height: tileBackground.height
|
|
|
|
radius: tileBackground.radius
|
|
|
|
}
|
2023-05-31 09:25:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
component TransactionContractTile: TransactionDataTile {
|
|
|
|
property string networkName: ""
|
|
|
|
property string symbol: ""
|
|
|
|
property string address: ""
|
|
|
|
property string shortNetworkName: ""
|
|
|
|
width: parent.width
|
2023-06-30 15:07:53 +00:00
|
|
|
title: visible ? qsTr("%1 %2 contract address").arg(networkName).arg(symbol) : ""
|
2023-05-31 09:25:16 +00:00
|
|
|
subTitle: !!address && !/0x0+$/.test(address) ? address : ""
|
|
|
|
buttonIconName: "more"
|
|
|
|
visible: !!subTitle
|
|
|
|
onButtonClicked: addressMenu.openContractMenu(this, address, shortNetworkName, symbol)
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|