2023-04-05 11:42:12 +00:00
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
import QtQml 2.15
|
2022-09-01 15:34:27 +00:00
|
|
|
|
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
import StatusQ.Core 0.1
|
2023-01-12 23:26:48 +00:00
|
|
|
|
import StatusQ.Controls 0.1
|
2024-03-13 17:38:16 +00:00
|
|
|
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
2023-09-04 10:19:02 +00:00
|
|
|
|
import AppLayouts.Wallet 1.0
|
2024-05-22 08:13:39 +00:00
|
|
|
|
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
2023-09-04 10:19:02 +00:00
|
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
|
import shared 1.0
|
2024-05-22 08:13:39 +00:00
|
|
|
|
import shared.stores 1.0 as SharedStores
|
2023-05-10 11:54:06 +00:00
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\qmltype TransactionDelegate
|
|
|
|
|
\inherits StatusListItem
|
|
|
|
|
\inqmlmodule shared.controls
|
|
|
|
|
\since shared.controls 1.0
|
|
|
|
|
\brief Delegate for transaction activity list
|
|
|
|
|
|
|
|
|
|
Delegate to display transaction activity data.
|
|
|
|
|
|
|
|
|
|
\qml
|
|
|
|
|
TransactionDelegate {
|
|
|
|
|
id: delegate
|
|
|
|
|
width: ListView.view.width
|
2023-06-30 15:07:53 +00:00
|
|
|
|
modelData: model.activityEntry
|
2024-09-24 11:51:22 +00:00
|
|
|
|
flatNetworks: root.flatNetworks
|
|
|
|
|
currenciesStore: root.currencyStore
|
2024-05-22 08:13:39 +00:00
|
|
|
|
walletRootStore: WalletStores.RootStore
|
2023-06-30 15:07:53 +00:00
|
|
|
|
loading: isModelDataValid
|
2023-05-10 11:54:06 +00:00
|
|
|
|
}
|
|
|
|
|
\endqml
|
|
|
|
|
|
|
|
|
|
Additional usages should be handled using states.
|
|
|
|
|
*/
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
2022-09-01 15:34:27 +00:00
|
|
|
|
StatusListItem {
|
|
|
|
|
id: root
|
|
|
|
|
|
2023-05-10 11:54:06 +00:00
|
|
|
|
signal retryClicked()
|
2023-01-12 23:26:48 +00:00
|
|
|
|
|
2022-09-01 15:34:27 +00:00
|
|
|
|
property var modelData
|
2023-06-30 15:07:53 +00:00
|
|
|
|
property string timeStampText: isModelDataValid ? LocaleUtils.formatRelativeTimestamp(modelData.timestamp * 1000) : ""
|
2023-07-26 11:50:27 +00:00
|
|
|
|
property bool showAllAccounts: false
|
2024-02-19 08:40:16 +00:00
|
|
|
|
property bool displayValues: true
|
2023-06-30 15:07:53 +00:00
|
|
|
|
|
2024-09-24 11:51:22 +00:00
|
|
|
|
required property var flatNetworks
|
|
|
|
|
|
|
|
|
|
required property SharedStores.CurrenciesStore currenciesStore
|
2024-05-22 08:13:39 +00:00
|
|
|
|
required property WalletStores.RootStore walletRootStore
|
2022-09-01 15:34:27 +00:00
|
|
|
|
|
2023-02-28 17:15:22 +00:00
|
|
|
|
readonly property bool isModelDataValid: modelData !== undefined && !!modelData
|
2023-06-30 15:07:53 +00:00
|
|
|
|
|
2024-02-29 14:53:08 +00:00
|
|
|
|
readonly property string txID: isModelDataValid ? modelData.id : "INVALID"
|
2023-06-30 15:07:53 +00:00
|
|
|
|
readonly property int transactionStatus: isModelDataValid ? modelData.status : Constants.TransactionStatus.Pending
|
|
|
|
|
readonly property bool isMultiTransaction: isModelDataValid && modelData.isMultiTransaction
|
2024-09-24 11:51:22 +00:00
|
|
|
|
readonly property string currentCurrency: currenciesStore.currentCurrency
|
2023-10-26 08:01:52 +00:00
|
|
|
|
readonly property double cryptoValue: isModelDataValid ? modelData.amount : 0.0
|
2024-09-24 11:51:22 +00:00
|
|
|
|
readonly property double fiatValue: isModelDataValid && !isMultiTransaction ? currenciesStore.getFiatValue(cryptoValue, modelData.symbol) : 0.0
|
2023-06-30 15:07:53 +00:00
|
|
|
|
readonly property double inCryptoValue: isModelDataValid ? modelData.inAmount : 0.0
|
2024-09-24 11:51:22 +00:00
|
|
|
|
readonly property double inFiatValue: isModelDataValid && isMultiTransaction ? currenciesStore.getFiatValue(inCryptoValue, modelData.inSymbol): 0.0
|
2023-06-30 15:07:53 +00:00
|
|
|
|
readonly property double outCryptoValue: isModelDataValid ? modelData.outAmount : 0.0
|
2024-09-24 11:51:22 +00:00
|
|
|
|
readonly property double outFiatValue: isModelDataValid && isMultiTransaction ? currenciesStore.getFiatValue(outCryptoValue, modelData.outSymbol): 0.0
|
|
|
|
|
readonly property string networkColor: isModelDataValid ? SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainId, "chainColor") : ""
|
|
|
|
|
readonly property string networkName: isModelDataValid ? SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainId, "chainName") : ""
|
|
|
|
|
readonly property string networkNameIn: isMultiTransaction ? SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainIdIn, "chainName") : ""
|
|
|
|
|
readonly property string networkNameOut: isMultiTransaction ? SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainIdOut, "chainName") : ""
|
2023-06-30 15:07:53 +00:00
|
|
|
|
readonly property string addressNameTo: isModelDataValid ? walletRootStore.getNameForAddress(modelData.recipient) : ""
|
|
|
|
|
readonly property string addressNameFrom: isModelDataValid ? walletRootStore.getNameForAddress(modelData.sender) : ""
|
2023-02-28 17:15:22 +00:00
|
|
|
|
readonly property bool isNFT: isModelDataValid && modelData.isNFT
|
2024-07-08 08:28:04 +00:00
|
|
|
|
readonly property bool isCommunityAssetViaAirdrop: isModelDataValid && !!communityId && d.txType === Constants.TransactionType.Mint
|
2024-02-22 14:41:19 +00:00
|
|
|
|
readonly property string communityId: isModelDataValid && modelData.communityId ? modelData.communityId : ""
|
|
|
|
|
property var community: null
|
|
|
|
|
readonly property bool isCommunityToken: !!community && Object.keys(community).length > 0
|
|
|
|
|
readonly property string communityImage: isCommunityToken ? community.image : ""
|
|
|
|
|
readonly property string communityName: isCommunityToken ? community.name : ""
|
2023-06-30 15:07:53 +00:00
|
|
|
|
|
2024-07-17 08:16:02 +00:00
|
|
|
|
readonly property var dAppDetails: {
|
|
|
|
|
if (!isModelDataValid) {
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
if (modelData.txType === Constants.TransactionType.Approve) {
|
|
|
|
|
return walletRootStore.getDappDetails(modelData.chainId, modelData.approvalSpender)
|
|
|
|
|
}
|
|
|
|
|
if (modelData.txType === Constants.TransactionType.Swap) {
|
|
|
|
|
return walletRootStore.getDappDetails(modelData.chainId, modelData.interactedContractAddress)
|
|
|
|
|
}
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readonly property string dAppIcon: dAppDetails ? dAppDetails.icon : ""
|
|
|
|
|
readonly property string dAppUrl: dAppDetails ? dAppDetails.url : ""
|
|
|
|
|
readonly property string dAppName: dAppDetails ? dAppDetails.name : ""
|
|
|
|
|
|
2023-05-10 11:54:06 +00:00
|
|
|
|
readonly property string transactionValue: {
|
|
|
|
|
if (!isModelDataValid) {
|
|
|
|
|
return qsTr("N/A")
|
2023-06-30 15:07:53 +00:00
|
|
|
|
} else if (root.isNFT) {
|
2024-07-24 19:19:51 +00:00
|
|
|
|
let value = ""
|
|
|
|
|
if (d.txType === Constants.TransactionType.Mint) {
|
|
|
|
|
value += modelData.amount + " "
|
|
|
|
|
}
|
|
|
|
|
value += (modelData.nftName ? modelData.nftName : "#" + modelData.tokenID)
|
|
|
|
|
return value
|
2023-08-02 04:36:54 +00:00
|
|
|
|
} else if (!modelData.symbol && !!modelData.tokenAddress) {
|
2024-09-24 11:51:22 +00:00
|
|
|
|
return "%1 (%2)".arg(root.currenciesStore.formatCurrencyAmount(cryptoValue, "")).arg(Utils.compactAddress(modelData.tokenAddress, 4))
|
2023-05-10 11:54:06 +00:00
|
|
|
|
}
|
2024-09-24 11:51:22 +00:00
|
|
|
|
return root.currenciesStore.formatCurrencyAmount(cryptoValue, modelData.symbol)
|
2023-05-10 11:54:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-08-02 04:36:54 +00:00
|
|
|
|
readonly property string inTransactionValue: {
|
|
|
|
|
if (!isModelDataValid || !isMultiTransaction) {
|
|
|
|
|
return qsTr("N/A")
|
|
|
|
|
} else if (!modelData.inSymbol && !!modelData.tokenInAddress) {
|
2024-09-24 11:51:22 +00:00
|
|
|
|
return "%1 (%2)".arg(root.currenciesStore.formatCurrencyAmount(inCryptoValue, "")).arg(Utils.compactAddress(modelData.tokenInAddress, 4))
|
2023-08-02 04:36:54 +00:00
|
|
|
|
}
|
2024-09-24 11:51:22 +00:00
|
|
|
|
return currenciesStore.formatCurrencyAmount(inCryptoValue, modelData.inSymbol)
|
2023-08-02 04:36:54 +00:00
|
|
|
|
}
|
|
|
|
|
readonly property string outTransactionValue: {
|
|
|
|
|
if (!isModelDataValid || !isMultiTransaction) {
|
|
|
|
|
return qsTr("N/A")
|
|
|
|
|
} else if (!modelData.outSymbol && !!modelData.tokenOutAddress) {
|
2024-09-24 11:51:22 +00:00
|
|
|
|
return "%1 (%2)".arg(root.currenciesStore.formatCurrencyAmount(outCryptoValue, "")).arg(Utils.compactAddress(modelData.tokenOutAddress, 4))
|
2023-08-02 04:36:54 +00:00
|
|
|
|
}
|
2024-09-24 11:51:22 +00:00
|
|
|
|
return currenciesStore.formatCurrencyAmount(outCryptoValue, modelData.outSymbol)
|
2023-08-02 04:36:54 +00:00
|
|
|
|
}
|
2023-06-30 15:07:53 +00:00
|
|
|
|
|
2023-05-10 11:54:06 +00:00
|
|
|
|
readonly property string tokenImage: {
|
2024-07-08 08:28:04 +00:00
|
|
|
|
if (!isModelDataValid || d.txType === Constants.TransactionType.ContractDeployment)
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return ""
|
|
|
|
|
if (root.isNFT) {
|
|
|
|
|
return modelData.nftImageUrl ? modelData.nftImageUrl : ""
|
|
|
|
|
} else {
|
2023-06-30 15:07:53 +00:00
|
|
|
|
return Constants.tokenIcon(isMultiTransaction ? modelData.outSymbol : modelData.symbol)
|
2023-05-10 11:54:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-30 15:07:53 +00:00
|
|
|
|
readonly property string inTokenImage: isModelDataValid ? Constants.tokenIcon(modelData.inSymbol) : ""
|
2023-05-10 11:54:06 +00:00
|
|
|
|
|
|
|
|
|
readonly property string toAddress: !!addressNameTo ?
|
|
|
|
|
addressNameTo :
|
2023-02-28 17:15:22 +00:00
|
|
|
|
isModelDataValid ?
|
2023-06-15 13:09:35 +00:00
|
|
|
|
Utils.compactAddress(modelData.recipient, 4) :
|
2023-02-28 17:15:22 +00:00
|
|
|
|
""
|
|
|
|
|
|
2023-05-10 11:54:06 +00:00
|
|
|
|
readonly property string fromAddress: !!addressNameFrom ?
|
|
|
|
|
addressNameFrom :
|
2023-02-28 17:15:22 +00:00
|
|
|
|
isModelDataValid ?
|
2023-06-15 13:09:35 +00:00
|
|
|
|
Utils.compactAddress(modelData.sender, 4) :
|
2023-02-28 17:15:22 +00:00
|
|
|
|
""
|
2023-05-10 11:54:06 +00:00
|
|
|
|
|
|
|
|
|
property StatusAssetSettings statusIconAsset: StatusAssetSettings {
|
|
|
|
|
width: 12
|
|
|
|
|
height: 12
|
|
|
|
|
bgWidth: width + 2
|
|
|
|
|
bgHeight: bgWidth
|
|
|
|
|
bgRadius: bgWidth / 2
|
|
|
|
|
bgColor: root.color
|
|
|
|
|
color: "transparent"
|
|
|
|
|
name: {
|
|
|
|
|
switch(root.transactionStatus) {
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionStatus.Pending:
|
2024-10-15 19:26:12 +00:00
|
|
|
|
return Theme.svg("transaction/pending")
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionStatus.Complete:
|
2024-10-15 19:26:12 +00:00
|
|
|
|
return Theme.svg("transaction/confirmed")
|
2023-09-04 10:19:02 +00:00
|
|
|
|
case Constants.TransactionStatus.Finalised:
|
2024-10-15 19:26:12 +00:00
|
|
|
|
return Theme.svg("transaction/finished")
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionStatus.Failed:
|
2024-10-15 19:26:12 +00:00
|
|
|
|
return Theme.svg("transaction/failed")
|
2023-05-10 11:54:06 +00:00
|
|
|
|
default:
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
property StatusAssetSettings tokenIconAsset: StatusAssetSettings {
|
2023-08-30 12:10:59 +00:00
|
|
|
|
width: 20
|
|
|
|
|
height: 20
|
|
|
|
|
bgWidth: width + 2
|
|
|
|
|
bgHeight: height + 2
|
|
|
|
|
bgRadius: bgWidth / 2
|
2024-02-08 12:49:12 +00:00
|
|
|
|
bgColor: d.lightTheme && Constants.isDefaultTokenIcon(root.tokenImage) ?
|
2023-08-30 12:10:59 +00:00
|
|
|
|
Theme.palette.white : "transparent"
|
2023-05-10 11:54:06 +00:00
|
|
|
|
color: "transparent"
|
|
|
|
|
isImage: !loading
|
|
|
|
|
name: root.tokenImage
|
|
|
|
|
isLetterIdenticon: loading
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
|
id: d
|
|
|
|
|
|
|
|
|
|
property int loadingPixelSize: 13
|
|
|
|
|
property int datePixelSize: 12
|
|
|
|
|
property int titlePixelSize: 15
|
|
|
|
|
property int subtitlePixelSize: 13
|
2023-08-02 04:36:54 +00:00
|
|
|
|
property bool showRetryButton: false
|
2024-02-08 12:49:12 +00:00
|
|
|
|
|
2024-10-15 19:26:12 +00:00
|
|
|
|
readonly property bool isLightTheme: Theme.palette.name === Constants.lightThemeName
|
2024-02-08 12:49:12 +00:00
|
|
|
|
property color animatedBgColor
|
2024-07-31 11:58:05 +00:00
|
|
|
|
property int txType: walletRootStore.transactionType(root.modelData)
|
2024-07-08 08:28:04 +00:00
|
|
|
|
|
2024-07-17 08:16:02 +00:00
|
|
|
|
readonly property var secondIconAsset: StatusAssetSettings {
|
|
|
|
|
width: root.tokenIconAsset.width
|
|
|
|
|
height: root.tokenIconAsset.height
|
|
|
|
|
bgWidth: width + 2
|
|
|
|
|
bgHeight: height + 2
|
|
|
|
|
bgRadius: bgWidth / 2
|
|
|
|
|
bgColor: Theme.palette.white
|
|
|
|
|
isImage: root.tokenIconAsset.isImage
|
|
|
|
|
color: root.tokenIconAsset.color
|
|
|
|
|
name: d.secondIconSource
|
|
|
|
|
isLetterIdenticon: root.tokenIconAsset.isLetterIdenticon
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readonly property string secondIconSource: {
|
|
|
|
|
if (!root.isModelDataValid || root.isNFT) {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (modelData.txType === Constants.TransactionType.Swap) {
|
|
|
|
|
return root.inTokenImage
|
|
|
|
|
} else if (modelData.txType === Constants.TransactionType.Approve) {
|
|
|
|
|
return root.dAppIcon
|
|
|
|
|
}
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
readonly property bool isSecondIconVisible: secondIconSource !== ""
|
2023-05-10 11:54:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-08-30 12:10:59 +00:00
|
|
|
|
function getDetailsString(detailsObj) {
|
2023-06-13 08:18:53 +00:00
|
|
|
|
let details = ""
|
|
|
|
|
const endl = "\n"
|
|
|
|
|
const endl2 = endl + endl
|
2024-07-08 08:28:04 +00:00
|
|
|
|
const type = d.txType
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const feeEthValue = currenciesStore.getGasEthValue(detailsObj.totalFees.amount, 1)
|
2023-06-13 08:18:53 +00:00
|
|
|
|
|
|
|
|
|
// TITLE
|
|
|
|
|
switch (type) {
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Send:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Send transaction details" + endl2)
|
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Receive:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Receive transaction details") + endl2
|
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Buy:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Buy transaction details") + endl2
|
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Sell:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Sell transaction details") + endl2
|
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Destroy:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Destroy transaction details") + endl2
|
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Swap:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Swap transaction details") + endl2
|
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Bridge transaction details") + endl2
|
|
|
|
|
break
|
2023-07-24 11:18:42 +00:00
|
|
|
|
case Constants.TransactionType.ContractDeployment:
|
|
|
|
|
details += qsTr("Contract deployment details") + endl2
|
|
|
|
|
break
|
2023-08-04 10:47:45 +00:00
|
|
|
|
case Constants.TransactionType.Mint:
|
|
|
|
|
if (isNFT)
|
|
|
|
|
details += qsTr("Mint collectible details") + endl2
|
|
|
|
|
else
|
|
|
|
|
details += qsTr("Mint token details") + endl2
|
|
|
|
|
break
|
2024-07-17 08:16:02 +00:00
|
|
|
|
case Constants.TransactionType.Approve:
|
|
|
|
|
details += qsTr("Set spending cap transaction details") + endl2
|
|
|
|
|
break
|
2023-06-13 08:18:53 +00:00
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
details += qsTr("Summary") + endl
|
2024-07-08 08:28:04 +00:00
|
|
|
|
switch(type) {
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Buy:
|
|
|
|
|
case Constants.TransactionType.Sell:
|
|
|
|
|
case Constants.TransactionType.Destroy:
|
|
|
|
|
case Constants.TransactionType.Swap:
|
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-07-24 11:18:42 +00:00
|
|
|
|
case Constants.TransactionType.ContractDeployment:
|
2023-08-04 10:47:45 +00:00
|
|
|
|
case Constants.TransactionType.Mint:
|
2024-07-17 08:16:02 +00:00
|
|
|
|
case Constants.TransactionType.Approve:
|
2024-02-22 14:41:19 +00:00
|
|
|
|
details += getSubtitle(true, true) + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
break
|
|
|
|
|
default:
|
2024-07-08 08:28:04 +00:00
|
|
|
|
if (networkNameIn != networkNameOut) { // cross chain Send/Receive that involves bridging
|
|
|
|
|
details += getSubtitle(true, true) + endl2
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
details += qsTr("%1 from %2 to %3 via %4").arg(transactionValue).arg(fromAddress).arg(toAddress).arg(networkName) + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (root.isNFT) {
|
|
|
|
|
details += qsTr("Token ID") + endl + modelData.tokenID + endl2
|
2023-09-04 10:19:02 +00:00
|
|
|
|
if (!!modelData.nftName) {
|
|
|
|
|
details += qsTr("Token name") + endl + modelData.nftName + endl2
|
|
|
|
|
}
|
2023-06-13 08:18:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PROGRESS
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const networkLayer = SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainId, "layer")
|
2023-09-11 08:08:53 +00:00
|
|
|
|
|
|
|
|
|
const isBridge = type === Constants.TransactionType.Bridge
|
2023-06-13 08:18:53 +00:00
|
|
|
|
switch(transactionStatus) {
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionStatus.Pending:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Status") + endl
|
|
|
|
|
details += qsTr("Pending on %1").arg(root.networkName) + endl2
|
2023-09-11 08:08:53 +00:00
|
|
|
|
if (isBridge) {
|
|
|
|
|
details += qsTr("Pending on %1").arg(root.networkNameIn) + endl2
|
|
|
|
|
}
|
2023-06-13 08:18:53 +00:00
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionStatus.Failed:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Status") + endl
|
|
|
|
|
details += qsTr("Failed on %1").arg(root.networkName) + endl2
|
2023-09-11 08:08:53 +00:00
|
|
|
|
if (isBridge) {
|
|
|
|
|
details += qsTr("Failed on %1").arg(root.networkNameIn) + endl2
|
|
|
|
|
}
|
2023-06-13 08:18:53 +00:00
|
|
|
|
break
|
2023-09-04 10:19:02 +00:00
|
|
|
|
case Constants.TransactionStatus.Complete: {
|
2023-09-11 08:08:53 +00:00
|
|
|
|
const confirmationTimeStamp = WalletUtils.calculateConfirmationTimestamp(networkLayer, modelData.timestamp)
|
2023-06-13 08:18:53 +00:00
|
|
|
|
const timestampString = LocaleUtils.formatDateTime(modelData.timestamp * 1000, Locale.LongFormat)
|
|
|
|
|
details += qsTr("Status") + endl
|
2023-09-11 08:08:53 +00:00
|
|
|
|
details += qsTr("Signed on %1").arg(root.networkName) + endl + timestampString + endl2
|
|
|
|
|
details += qsTr("Confirmed on %1").arg(root.networkName) + endl
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += LocaleUtils.formatDateTime(confirmationTimeStamp * 1000, Locale.LongFormat) + endl2
|
2023-09-11 08:08:53 +00:00
|
|
|
|
if (isBridge) {
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const networkInLayer = SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainIdIn, "layer")
|
2023-09-11 08:08:53 +00:00
|
|
|
|
const confirmationTimeStampIn = WalletUtils.calculateConfirmationTimestamp(networkInLayer, modelData.timestamp)
|
|
|
|
|
details += qsTr("Signed on %1").arg(root.networkNameIn) + endl + timestampString + endl2
|
|
|
|
|
details += qsTr("Confirmed on %1").arg(root.networkNameIn) + endl
|
|
|
|
|
details += LocaleUtils.formatDateTime(confirmationTimeStampIn * 1000, Locale.LongFormat) + endl2
|
|
|
|
|
}
|
2023-06-13 08:18:53 +00:00
|
|
|
|
break
|
|
|
|
|
}
|
2023-09-04 10:19:02 +00:00
|
|
|
|
case Constants.TransactionStatus.Finalised: {
|
2023-06-13 08:18:53 +00:00
|
|
|
|
const timestampString = LocaleUtils.formatDateTime(modelData.timestamp * 1000, Locale.LongFormat)
|
2023-09-11 08:08:53 +00:00
|
|
|
|
const confirmationTimeStamp = WalletUtils.calculateConfirmationTimestamp(networkLayer, modelData.timestamp)
|
|
|
|
|
const finalisationTimeStamp = WalletUtils.calculateFinalisationTimestamp(networkLayer, modelData.timestamp)
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Status") + endl
|
2023-12-01 14:31:47 +00:00
|
|
|
|
const epoch = Math.abs(walletRootStore.getEstimatedLatestBlockNumber(modelData.chainId) - detailsObj.blockNumberOut)
|
2023-09-11 08:08:53 +00:00
|
|
|
|
details += qsTr("Finalised in epoch %1 on %2").arg(epoch.toFixed(0)).arg(root.networkName) + endl2
|
|
|
|
|
details += qsTr("Signed on %1").arg(root.networkName) + endl + timestampString + endl2
|
|
|
|
|
details += qsTr("Confirmed on %1").arg(root.networkName) + endl
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += LocaleUtils.formatDateTime(confirmationTimeStamp * 1000, Locale.LongFormat) + endl2
|
2023-09-11 08:08:53 +00:00
|
|
|
|
details += qsTr("Finalised on %1").arg(root.networkName) + endl
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += LocaleUtils.formatDateTime(finalisationTimeStamp * 1000, Locale.LongFormat) + endl2
|
2023-09-11 08:08:53 +00:00
|
|
|
|
if (isBridge) {
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const networkInLayer = SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainIdIn, "layer")
|
2023-09-11 08:08:53 +00:00
|
|
|
|
const confirmationTimeStampIn = WalletUtils.calculateConfirmationTimestamp(networkInLayer, modelData.timestamp)
|
|
|
|
|
const finalisationTimeStampIn = WalletUtils.calculateFinalisationTimestamp(networkInLayer, modelData.timestamp)
|
2023-12-01 14:31:47 +00:00
|
|
|
|
const epochIn = Math.abs(walletRootStore.getEstimatedLatestBlockNumber(modelData.chainIdIn) - detailsObj.blockNumberIn)
|
2023-09-11 08:08:53 +00:00
|
|
|
|
details += qsTr("Finalised in epoch %1 on %2").arg(epochIn.toFixed(0)).arg(root.networkNameIn) + endl2
|
|
|
|
|
details += qsTr("Signed on %1").arg(root.networkNameIn) + endl + timestampString + endl2
|
|
|
|
|
details += qsTr("Confirmed on %1").arg(root.networkNameIn) + endl
|
|
|
|
|
details += LocaleUtils.formatDateTime(confirmationTimeStampIn * 1000, Locale.LongFormat) + endl2
|
|
|
|
|
details += qsTr("Finalised on %1").arg(root.networkNameIn) + endl
|
|
|
|
|
details += LocaleUtils.formatDateTime(finalisationTimeStampIn * 1000, Locale.LongFormat) + endl2
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-13 08:18:53 +00:00
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SUMMARY ADRESSES
|
|
|
|
|
switch (type) {
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Swap:
|
2023-06-30 15:07:53 +00:00
|
|
|
|
details += qsTr("From") + endl + modelData.outSymbol + endl2
|
|
|
|
|
details += qsTr("To") + endl + modelData.inSymbol + endl2
|
2023-08-18 08:56:57 +00:00
|
|
|
|
details += qsTr("In") + endl + modelData.sender + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-08-18 08:56:57 +00:00
|
|
|
|
details += qsTr("From") + endl + networkNameOut + endl2
|
|
|
|
|
details += qsTr("To") + endl + networkNameIn + endl2
|
|
|
|
|
details += qsTr("In") + endl + modelData.sender + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
break
|
2023-07-24 11:18:42 +00:00
|
|
|
|
case Constants.TransactionType.ContractDeployment:
|
|
|
|
|
details += qsTr("From") + endl + modelData.sender + endl2
|
|
|
|
|
const failed = root.transactionStatus === Constants.TransactionStatus.Failed
|
|
|
|
|
const isPending = root.transactionStatus === Constants.TransactionStatus.Pending || !modelData.contract
|
|
|
|
|
if (failed) {
|
|
|
|
|
details += qsTr("To\nContract address not created")
|
|
|
|
|
} else if (isPending) {
|
|
|
|
|
details += qsTr("To\nAwaiting contract address...")
|
|
|
|
|
} else {
|
|
|
|
|
details += qsTr("To\nContract created") + endl + modelData.contract + endl2
|
|
|
|
|
}
|
|
|
|
|
break
|
2023-06-13 08:18:53 +00:00
|
|
|
|
default:
|
2023-06-30 15:07:53 +00:00
|
|
|
|
details += qsTr("From") + endl + modelData.sender + endl2
|
|
|
|
|
details += qsTr("To") + endl + modelData.recipient + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
break
|
|
|
|
|
}
|
2023-08-30 12:10:59 +00:00
|
|
|
|
if (!!detailsObj.protocol) {
|
|
|
|
|
details += qsTr("Using") + endl + detailsObj.protocol + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
}
|
2023-12-06 10:59:32 +00:00
|
|
|
|
if (root.isMultiTransaction) {
|
|
|
|
|
if (!!detailsObj.txHashOut) {
|
|
|
|
|
details += qsTr("%1 Tx hash").arg(root.networkNameOut) + endl + detailsObj.txHashOut + endl2
|
|
|
|
|
}
|
|
|
|
|
if (!!detailsObj.txHashIn) {
|
|
|
|
|
details += qsTr("%1 Tx hash").arg(root.networkNameIn) + endl + detailsObj.txHashIn + endl2
|
|
|
|
|
}
|
|
|
|
|
} else if (!!detailsObj.txHash) {
|
|
|
|
|
details += qsTr("%1 Tx hash").arg(root.networkName) + endl + detailsObj.txHash + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
}
|
2023-12-06 10:59:32 +00:00
|
|
|
|
|
2023-06-13 08:18:53 +00:00
|
|
|
|
const protocolFromContractAddress = "" // TODO fill protocol contract address for 'from' network for Bridge and Swap
|
2023-08-30 12:10:59 +00:00
|
|
|
|
if (!!detailsObj.protocol && !!protocolFromContractAddress) {
|
|
|
|
|
details += qsTr("%1 %2 contract address").arg(root.networkName).arg(detailsObj.protocol) + endl
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += protocolFromContractAddress + endl2
|
|
|
|
|
}
|
2023-08-30 12:10:59 +00:00
|
|
|
|
if (!!detailsObj.contract && type !== Constants.TransactionType.ContractDeployment && !/0x0+$/.test(detailsObj.contract)) {
|
2023-08-02 04:36:54 +00:00
|
|
|
|
let symbol = !!modelData.symbol || !modelData.tokenAddress ? modelData.symbol : "(%1)".arg(Utils.compactAddress(modelData.tokenAddress, 4))
|
2023-07-18 14:05:22 +00:00
|
|
|
|
details += qsTr("%1 %2 contract address").arg(root.networkName).arg(symbol) + endl
|
2023-08-30 12:10:59 +00:00
|
|
|
|
details += detailsObj.contract + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
}
|
|
|
|
|
const protocolToContractAddress = "" // TODO fill protocol contract address for 'to' network for Bridge
|
2023-08-30 12:10:59 +00:00
|
|
|
|
if (!!protocolToContractAddress && !!detailsObj.protocol) {
|
|
|
|
|
details += qsTr("%1 %2 contract address").arg(networkNameOut).arg(detailsObj.protocol) + endl
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += protocolToContractAddress + endl2
|
|
|
|
|
}
|
|
|
|
|
switch (type) {
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Swap:
|
2023-12-01 14:31:47 +00:00
|
|
|
|
if (!!detailsObj.contractOut) {
|
2023-06-30 15:07:53 +00:00
|
|
|
|
details += qsTr("%1 %2 contract address").arg(root.networkName).arg(modelData.toSymbol) + endl
|
2023-12-01 14:31:47 +00:00
|
|
|
|
details += detailsObj.contractOut + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-12-01 14:31:47 +00:00
|
|
|
|
if (!!detailsObj.contractOut) {
|
2023-08-18 08:56:57 +00:00
|
|
|
|
details += qsTr("%1 %2 contract address").arg(networkNameOut).arg(modelData.symbol) + endl
|
2023-12-01 14:31:47 +00:00
|
|
|
|
details += detailsObj.contractOut + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SUMMARY DATA
|
2023-06-15 13:09:35 +00:00
|
|
|
|
if (type !== Constants.TransactionType.Bridge) {
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Network") + endl + networkName + endl2
|
|
|
|
|
}
|
2023-09-11 08:08:53 +00:00
|
|
|
|
if (!!detailsObj.tokenType) {
|
|
|
|
|
details += qsTr("Token format") + endl + detailsObj.tokenType.toUpperCase() + endl2
|
|
|
|
|
}
|
2023-08-30 12:10:59 +00:00
|
|
|
|
details += qsTr("Nonce") + endl + detailsObj.nonce + endl2
|
2023-06-15 13:09:35 +00:00
|
|
|
|
if (type === Constants.TransactionType.Bridge) {
|
2023-12-06 10:59:32 +00:00
|
|
|
|
details += qsTr("Included in Block on %1").arg(networkNameOut) + endl
|
2023-12-01 14:31:47 +00:00
|
|
|
|
details += detailsObj.blockNumberOut + endl2
|
|
|
|
|
if (detailsObj.blockNumberIn > 0) {
|
2023-12-06 10:59:32 +00:00
|
|
|
|
details += qsTr("Included in Block on %1").arg(networkNameIn) + endl
|
2023-12-01 14:31:47 +00:00
|
|
|
|
details += detailsObj.blockNumberIn + endl2
|
2023-08-30 12:10:59 +00:00
|
|
|
|
}
|
2023-06-13 08:18:53 +00:00
|
|
|
|
} else {
|
2023-12-01 14:31:47 +00:00
|
|
|
|
details += qsTr("Included in Block") + endl + detailsObj.blockNumberOut + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// VALUES
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const fiatTransactionValue = currenciesStore.formatCurrencyAmount(isMultiTransaction ? root.outFiatValue : root.fiatValue, root.currentCurrency)
|
|
|
|
|
const feeFiatValue = currenciesStore.getFiatValue(feeEthValue, Constants.ethToken)
|
2023-06-13 08:18:53 +00:00
|
|
|
|
let valuesString = ""
|
|
|
|
|
if (!root.isNFT) {
|
|
|
|
|
switch(type) {
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Send:
|
2023-06-30 15:07:53 +00:00
|
|
|
|
valuesString += qsTr("Amount sent %1 (%2)").arg(root.transactionValue).arg(fiatTransactionValue) + endl2
|
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Swap:
|
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-06-30 15:07:53 +00:00
|
|
|
|
valuesString += qsTr("Amount sent %1 (%2)").arg(root.outTransactionValue).arg(fiatTransactionValue) + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
2023-06-15 13:09:35 +00:00
|
|
|
|
if (type === Constants.TransactionType.Swap) {
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const crypto = currenciesStore.formatCurrencyAmount(root.inCryptoValue, modelData.inSymbol)
|
|
|
|
|
const fiat = currenciesStore.formatCurrencyAmount(root.inCryptoValue, modelData.inSymbol)
|
2023-06-13 08:18:53 +00:00
|
|
|
|
valuesString += qsTr("Amount received %1 (%2)").arg(crypto).arg(fiat) + endl2
|
2023-06-15 13:09:35 +00:00
|
|
|
|
} else if (type === Constants.TransactionType.Bridge) {
|
2023-06-13 08:18:53 +00:00
|
|
|
|
// Reduce crypto value by fee value
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const valueInCrypto = currenciesStore.getCryptoValue(root.fiatValue - feeFiatValue, modelData.inSymbol)
|
|
|
|
|
const crypto = currenciesStore.formatCurrencyAmount(valueInCrypto, modelData.inSymbol)
|
|
|
|
|
const fiat = currenciesStore.formatCurrencyAmount(root.fiatValue - feeFiatValue, root.currentCurrency)
|
2023-06-13 08:18:53 +00:00
|
|
|
|
valuesString += qsTr("Amount received %1 (%2)").arg(crypto).arg(fiat) + endl2
|
|
|
|
|
}
|
|
|
|
|
switch(type) {
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Send:
|
|
|
|
|
case Constants.TransactionType.Swap:
|
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-08-29 17:27:04 +00:00
|
|
|
|
const feeValue = LocaleUtils.currencyAmountToLocaleString(detailsObj.totalFees)
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const feeFiat = currenciesStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
|
2023-06-13 08:18:53 +00:00
|
|
|
|
valuesString += qsTr("Fees %1 (%2)").arg(feeValue).arg(feeFiat) + endl2
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-15 13:09:35 +00:00
|
|
|
|
if (!root.isNFT || type !== Constants.TransactionType.Receive) {
|
|
|
|
|
if (type === Constants.TransactionType.Destroy || root.isNFT) {
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const feeCrypto = currenciesStore.formatCurrencyAmount(feeEthValue, "ETH")
|
|
|
|
|
const feeFiat = currenciesStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
|
2023-06-13 08:18:53 +00:00
|
|
|
|
valuesString += qsTr("Fees %1 (%2)").arg(feeCrypto).arg(feeFiat) + endl2
|
2023-09-04 10:19:02 +00:00
|
|
|
|
} else if (type === Constants.TransactionType.Receive || (type === Constants.TransactionType.Buy && networkLayer === 1)) {
|
2023-06-13 08:18:53 +00:00
|
|
|
|
valuesString += qsTr("Total %1 (%2)").arg(root.transactionValue).arg(fiatTransactionValue) + endl2
|
2023-07-24 11:18:42 +00:00
|
|
|
|
} else if (type === Constants.TransactionType.ContractDeployment) {
|
|
|
|
|
const isPending = root.transactionStatus === Constants.TransactionStatus.Pending
|
|
|
|
|
if (isPending) {
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const maxFeeEthValue = currenciesStore.getFeeEthValue(detailsObj.maxTotalFees.amount)
|
|
|
|
|
const maxFeeCrypto = currenciesStore.formatCurrencyAmount(maxFeeEthValue, "ETH")
|
|
|
|
|
const maxFeeFiat = currenciesStore.formatCurrencyAmount(maxFeeCrypto, root.currentCurrency)
|
2023-07-24 11:18:42 +00:00
|
|
|
|
valuesString += qsTr("Estimated max fee %1 (%2)").arg(maxFeeCrypto).arg(maxFeeFiat) + endl2
|
|
|
|
|
} else {
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const feeCrypto = currenciesStore.formatCurrencyAmount(feeEthValue, "ETH")
|
|
|
|
|
const feeFiat = currenciesStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
|
2023-07-24 11:18:42 +00:00
|
|
|
|
valuesString += qsTr("Fees %1 (%2)").arg(feeCrypto).arg(feeFiat) + endl2
|
|
|
|
|
}
|
2023-06-13 08:18:53 +00:00
|
|
|
|
} else {
|
2024-09-24 11:51:22 +00:00
|
|
|
|
const feeEth = currenciesStore.formatCurrencyAmount(feeEthValue, "ETH")
|
2023-06-30 15:07:53 +00:00
|
|
|
|
const txValue = isMultiTransaction ? root.inTransactionValue : root.transactionValue
|
|
|
|
|
valuesString += qsTr("Total %1 + %2 (%3)").arg(txValue).arg(feeEth).arg(fiatTransactionValue) + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (valuesString !== "") {
|
|
|
|
|
const timestampString = LocaleUtils.formatDateTime(modelData.timestamp * 1000, Locale.LongFormat)
|
|
|
|
|
details += qsTr("Values at %1").arg(timestampString) + endl2
|
|
|
|
|
details += valuesString + endl2
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-18 08:56:57 +00:00
|
|
|
|
// Remove no-break space
|
|
|
|
|
details = details.replace(/[\xA0]/g, " ");
|
2023-06-13 08:18:53 +00:00
|
|
|
|
// Remove empty new lines at the end
|
|
|
|
|
return details.replace(/[\r\n\s]*$/, '')
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-22 14:41:19 +00:00
|
|
|
|
function getSubtitle(allAccounts, description) {
|
|
|
|
|
if (root.isCommunityAssetViaAirdrop) {
|
|
|
|
|
let communityInfo = ""
|
|
|
|
|
if (!description) {
|
|
|
|
|
// Showing image only in delegate. In description url shouldn't be showed
|
|
|
|
|
communityInfo += "<img src='" + root.communityImage + "' width='18' height='18' </img> "
|
|
|
|
|
}
|
|
|
|
|
communityInfo += root.communityName
|
|
|
|
|
return qsTr("%1 (community asset) from %2 via %3").arg(root.transactionValue).arg(communityInfo).arg(root.networkName)
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-08 08:28:04 +00:00
|
|
|
|
switch(d.txType) {
|
2023-07-26 11:50:27 +00:00
|
|
|
|
case Constants.TransactionType.Receive:
|
2024-07-08 08:28:04 +00:00
|
|
|
|
// Cross chain receive. Use bridge pattern
|
2024-07-23 09:51:11 +00:00
|
|
|
|
if (root.networkNameIn != root.networkNameOut && root.networkNameIn && root.networkNameOut) {
|
2024-07-08 08:28:04 +00:00
|
|
|
|
if (allAccounts)
|
|
|
|
|
return qsTr("%1 from %2 to %3 via %4 and %5").arg(inTransactionValue).arg(fromAddress).arg(toAddress).arg(networkNameOut).arg(networkNameIn)
|
|
|
|
|
return qsTr("%1 from %2 via %3 and %4").arg(inTransactionValue).arg(toAddress).arg(networkNameOut).arg(networkNameIn)
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-26 11:50:27 +00:00
|
|
|
|
if (allAccounts)
|
|
|
|
|
return qsTr("%1 from %2 to %3 via %4").arg(transactionValue).arg(fromAddress).arg(toAddress).arg(networkName)
|
|
|
|
|
return qsTr("%1 from %2 via %3").arg(transactionValue).arg(fromAddress).arg(networkName)
|
|
|
|
|
case Constants.TransactionType.Buy:
|
|
|
|
|
let protocol = "" // TODO fill data for buy
|
|
|
|
|
if (allAccounts)
|
|
|
|
|
return qsTr("%1 on %2 via %3 in %4").arg(transactionValue).arg(protocol).arg(networkName).arg(toAddress)
|
|
|
|
|
return qsTr("%1 on %2 via %3").arg(transactionValue).arg(protocol).arg(networkName)
|
|
|
|
|
case Constants.TransactionType.Destroy:
|
|
|
|
|
if (allAccounts)
|
|
|
|
|
return qsTr("%1 at %2 via %3 in %4").arg(inTransactionValue).arg(toAddress).arg(networkName).arg(toAddress)
|
|
|
|
|
return qsTr("%1 at %2 via %3").arg(inTransactionValue).arg(toAddress).arg(networkName)
|
|
|
|
|
case Constants.TransactionType.Swap:
|
2024-07-17 08:16:02 +00:00
|
|
|
|
if (root.dAppName !== "") {
|
|
|
|
|
if (allAccounts)
|
|
|
|
|
return qsTr("%1 to %2 using %3 on %4 in %5").arg(outTransactionValue).arg(inTransactionValue).arg(root.dAppName).arg(networkName).arg(fromAddress)
|
|
|
|
|
return qsTr("%1 to %2 using %3 on %4").arg(outTransactionValue).arg(inTransactionValue).arg(root.dAppName).arg(networkName)
|
|
|
|
|
}
|
2023-07-26 11:50:27 +00:00
|
|
|
|
if (allAccounts)
|
2024-07-17 08:16:02 +00:00
|
|
|
|
return qsTr("%1 to %2 on %3 in %4").arg(outTransactionValue).arg(inTransactionValue).arg(networkName).arg(fromAddress)
|
|
|
|
|
return qsTr("%1 to %2 on %3").arg(outTransactionValue).arg(inTransactionValue).arg(networkName)
|
2023-07-26 11:50:27 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
|
|
|
|
if (allAccounts)
|
2024-08-21 12:49:12 +00:00
|
|
|
|
return qsTr("%1 from %2 to %3 in %4").arg(outTransactionValue).arg(networkNameOut).arg(networkNameIn).arg(fromAddress)
|
|
|
|
|
return qsTr("%1 from %2 to %3").arg(outTransactionValue).arg(networkNameOut).arg(networkNameIn)
|
2023-07-26 11:50:27 +00:00
|
|
|
|
case Constants.TransactionType.ContractDeployment:
|
|
|
|
|
const name = addressNameTo || addressNameFrom
|
2023-08-30 12:10:59 +00:00
|
|
|
|
return qsTr("Via %1 on %2").arg(name).arg(networkName)
|
2023-08-04 10:47:45 +00:00
|
|
|
|
case Constants.TransactionType.Mint:
|
|
|
|
|
if (allAccounts)
|
2023-09-21 06:58:44 +00:00
|
|
|
|
return qsTr("%1 via %2 in %3").arg(transactionValue).arg(networkName).arg(toAddress)
|
|
|
|
|
return qsTr("%1 via %2").arg(transactionValue).arg(networkName)
|
2024-07-17 08:16:02 +00:00
|
|
|
|
case Constants.TransactionType.Approve:
|
|
|
|
|
if (root.dAppUrl !== "") {
|
|
|
|
|
if (allAccounts)
|
|
|
|
|
return qsTr("%1 in %2 for %3 on %4").arg(transactionValue).arg(toAddress).arg(dAppUrl).arg(networkName)
|
|
|
|
|
return qsTr("%1 for %2 on %3").arg(transactionValue).arg(dAppUrl).arg(networkName)
|
|
|
|
|
}
|
|
|
|
|
if (allAccounts)
|
|
|
|
|
return qsTr("%1 in %2 on %3").arg(transactionValue).arg(toAddress).arg(networkName)
|
|
|
|
|
return qsTr("%1 on %2").arg(transactionValue).arg(networkName)
|
2023-07-26 11:50:27 +00:00
|
|
|
|
default:
|
2024-07-08 08:28:04 +00:00
|
|
|
|
// Cross chain send. Use bridge pattern
|
2024-07-23 09:51:11 +00:00
|
|
|
|
if (root.networkNameIn != root.networkNameOut && root.networkNameIn && root.networkNameOut) {
|
2024-07-08 08:28:04 +00:00
|
|
|
|
if (allAccounts)
|
|
|
|
|
return qsTr("%1 from %2 to %3 via %4 and %5").arg(inTransactionValue).arg(fromAddress).arg(toAddress).arg(networkNameOut).arg(networkNameIn)
|
|
|
|
|
return qsTr("%1 to %2 via %3 and %4").arg(inTransactionValue).arg(toAddress).arg(networkNameOut).arg(networkNameIn)
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-26 11:50:27 +00:00
|
|
|
|
if (allAccounts)
|
|
|
|
|
return qsTr("%1 from %2 to %3 via %4").arg(transactionValue).arg(fromAddress).arg(toAddress).arg(networkName)
|
|
|
|
|
return qsTr("%1 to %2 via %3").arg(transactionValue).arg(toAddress).arg(networkName)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-10 11:54:06 +00:00
|
|
|
|
rightPadding: 16
|
2023-04-07 11:03:59 +00:00
|
|
|
|
enabled: !loading
|
2023-06-30 15:07:53 +00:00
|
|
|
|
loading: !isModelDataValid
|
2024-02-08 12:49:12 +00:00
|
|
|
|
color: {
|
|
|
|
|
if (bgColorAnimation.running) {
|
|
|
|
|
return d.animatedBgColor
|
|
|
|
|
}
|
2024-10-15 19:26:12 +00:00
|
|
|
|
return sensor.containsMouse ? Theme.palette.baseColor5 : Theme.palette.transparent
|
2024-02-08 12:49:12 +00:00
|
|
|
|
}
|
2023-05-10 11:54:06 +00:00
|
|
|
|
|
|
|
|
|
statusListItemIcon.active: (loading || root.asset.name)
|
|
|
|
|
asset {
|
|
|
|
|
width: 24
|
|
|
|
|
height: 24
|
|
|
|
|
isImage: false
|
|
|
|
|
imgIsIdenticon: true
|
|
|
|
|
isLetterIdenticon: loading
|
|
|
|
|
name: {
|
2023-06-15 13:09:35 +00:00
|
|
|
|
if (!root.isModelDataValid)
|
|
|
|
|
return ""
|
|
|
|
|
|
2024-07-08 08:28:04 +00:00
|
|
|
|
switch(d.txType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Send:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return "send"
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Receive:
|
2023-06-07 08:38:44 +00:00
|
|
|
|
return "receive"
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Buy:
|
|
|
|
|
case Constants.TransactionType.Sell:
|
2023-08-04 10:47:45 +00:00
|
|
|
|
case Constants.TransactionType.Mint:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return "token"
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Destroy:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return "destroy"
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Swap:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return "swap"
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return "bridge"
|
2023-07-24 11:18:42 +00:00
|
|
|
|
case Constants.TransactionType.ContractDeployment:
|
|
|
|
|
return "contract_deploy"
|
2024-07-17 08:16:02 +00:00
|
|
|
|
case Constants.TransactionType.Approve:
|
|
|
|
|
return "approve"
|
2023-05-10 11:54:06 +00:00
|
|
|
|
default:
|
|
|
|
|
return ""
|
2023-01-12 23:26:48 +00:00
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
|
}
|
2023-05-10 11:54:06 +00:00
|
|
|
|
bgColor: "transparent"
|
2023-05-16 08:25:40 +00:00
|
|
|
|
color: Theme.palette.directColor1
|
2023-05-10 11:54:06 +00:00
|
|
|
|
bgBorderWidth: 1
|
|
|
|
|
bgBorderColor: Theme.palette.primaryColor3
|
2023-01-12 23:26:48 +00:00
|
|
|
|
}
|
2023-05-10 11:54:06 +00:00
|
|
|
|
|
|
|
|
|
sensor.children: [
|
|
|
|
|
StatusRoundIcon {
|
|
|
|
|
id: leftIconStatusIcon
|
|
|
|
|
visible: !root.loading
|
|
|
|
|
anchors {
|
|
|
|
|
right: root.statusListItemIcon.right
|
|
|
|
|
bottom: root.statusListItemIcon.bottom
|
|
|
|
|
}
|
|
|
|
|
asset: root.statusIconAsset
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
// Title
|
|
|
|
|
title: {
|
|
|
|
|
if (root.loading) {
|
|
|
|
|
return "dummmy"
|
|
|
|
|
} else if (!root.isModelDataValid) {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-12 13:04:39 +00:00
|
|
|
|
const isPending = root.transactionStatus === Constants.TransactionStatus.Pending
|
|
|
|
|
const failed = root.transactionStatus === Constants.TransactionStatus.Failed
|
2024-07-08 08:28:04 +00:00
|
|
|
|
switch(d.txType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Send:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return failed ? qsTr("Send failed") : (isPending ? qsTr("Sending") : qsTr("Sent"))
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Receive:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return failed ? qsTr("Receive failed") : (isPending ? qsTr("Receiving") : qsTr("Received"))
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Buy:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return failed ? qsTr("Buy failed") : (isPending ? qsTr("Buying") : qsTr("Bought"))
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Sell:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return failed ? qsTr("Sell failed") : (isPending ? qsTr("Selling") : qsTr("Sold"))
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Destroy:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return failed ? qsTr("Destroy failed") : (isPending ? qsTr("Destroying") : qsTr("Destroyed"))
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Swap:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return failed ? qsTr("Swap failed") : (isPending ? qsTr("Swapping") : qsTr("Swapped"))
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return failed ? qsTr("Bridge failed") : (isPending ? qsTr("Bridging") : qsTr("Bridged"))
|
2023-07-24 11:18:42 +00:00
|
|
|
|
case Constants.TransactionType.ContractDeployment:
|
|
|
|
|
return failed ? qsTr("Contract deployment failed") : (isPending ? qsTr("Deploying contract") : qsTr("Contract deployed"))
|
2023-08-04 10:47:45 +00:00
|
|
|
|
case Constants.TransactionType.Mint:
|
|
|
|
|
if (isNFT)
|
|
|
|
|
return failed ? qsTr("Collectible minting failed") : (isPending ? qsTr("Minting collectible") : qsTr("Collectible minted"))
|
|
|
|
|
return failed ? qsTr("Token minting failed") : (isPending ? qsTr("Minting token") : qsTr("Token minted"))
|
2024-07-17 08:16:02 +00:00
|
|
|
|
case Constants.TransactionType.Approve:
|
|
|
|
|
return failed ? qsTr("Failed to set spending cap") : (isPending ? qsTr("Setting spending cap") : qsTr("Spending cap set"))
|
2023-05-10 11:54:06 +00:00
|
|
|
|
default:
|
|
|
|
|
return ""
|
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
|
}
|
2023-05-10 11:54:06 +00:00
|
|
|
|
statusListItemTitleArea.anchors.rightMargin: root.rightPadding
|
|
|
|
|
statusListItemTitle.font.weight: Font.DemiBold
|
|
|
|
|
statusListItemTitle.font.pixelSize: root.loading ? d.loadingPixelSize : d.titlePixelSize
|
|
|
|
|
|
|
|
|
|
// title icons and date
|
|
|
|
|
statusListItemTitleIcons.sourceComponent: Row {
|
|
|
|
|
spacing: 8
|
|
|
|
|
Row {
|
2023-07-24 11:18:42 +00:00
|
|
|
|
id: tokenImagesRow
|
|
|
|
|
visible: !root.loading && !!root.tokenIconAsset.name
|
2023-06-30 15:07:53 +00:00
|
|
|
|
spacing: secondTokenImage.visible ? -tokenImage.width * 0.2 : 0
|
2023-05-10 11:54:06 +00:00
|
|
|
|
StatusRoundIcon {
|
|
|
|
|
id: tokenImage
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
asset: root.tokenIconAsset
|
|
|
|
|
}
|
|
|
|
|
StatusRoundIcon {
|
2023-06-30 15:07:53 +00:00
|
|
|
|
id: secondTokenImage
|
2024-07-17 08:16:02 +00:00
|
|
|
|
visible: d.isSecondIconVisible
|
2023-05-10 11:54:06 +00:00
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2024-07-17 08:16:02 +00:00
|
|
|
|
asset: d.secondIconAsset
|
2023-05-10 11:54:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
StatusTextWithLoadingState {
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
text: root.loading ? root.title : root.timeStampText
|
|
|
|
|
verticalAlignment: Qt.AlignVCenter
|
|
|
|
|
font.pixelSize: root.loading ? d.loadingPixelSize : d.datePixelSize
|
|
|
|
|
visible: !!text
|
|
|
|
|
loading: root.loading
|
|
|
|
|
customColor: Theme.palette.baseColor1
|
2023-07-24 11:18:42 +00:00
|
|
|
|
leftPadding: tokenImagesRow.visible ? 0 : parent.spacing
|
2023-05-10 11:54:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// subtitle
|
|
|
|
|
subTitle: {
|
2023-06-30 13:50:06 +00:00
|
|
|
|
if (root.loading) {
|
|
|
|
|
return "dummy text dummy text dummy text dummy text dummy text dummy text"
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-10 11:54:06 +00:00
|
|
|
|
if (!root.isModelDataValid) {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
2023-07-26 11:50:27 +00:00
|
|
|
|
|
2024-02-22 14:41:19 +00:00
|
|
|
|
return getSubtitle(root.showAllAccounts, false)
|
2023-05-10 11:54:06 +00:00
|
|
|
|
}
|
2024-02-22 14:41:19 +00:00
|
|
|
|
statusListItemSubTitle.textFormat: root.isCommunityAssetViaAirdrop ? Text.RichText : Text.AutoText
|
2023-06-30 13:50:06 +00:00
|
|
|
|
statusListItemSubTitle.maximumLoadingStateWidth: 400
|
2023-05-10 11:54:06 +00:00
|
|
|
|
statusListItemSubTitle.customColor: Theme.palette.directColor1
|
|
|
|
|
statusListItemSubTitle.font.pixelSize: root.loading ? d.loadingPixelSize : d.subtitlePixelSize
|
|
|
|
|
statusListItemTagsRowLayout.anchors.topMargin: 4 // Spacing between title row nad subtitle row
|
|
|
|
|
|
|
|
|
|
// Right side components
|
|
|
|
|
components: [
|
|
|
|
|
Loader {
|
2024-02-19 08:40:16 +00:00
|
|
|
|
active: root.displayValues && !headerStatusLoader.active
|
2023-05-10 11:54:06 +00:00
|
|
|
|
visible: active
|
|
|
|
|
sourceComponent: ColumnLayout {
|
2023-01-12 23:26:48 +00:00
|
|
|
|
StatusTextWithLoadingState {
|
2022-09-05 09:15:47 +00:00
|
|
|
|
id: cryptoValueText
|
2023-05-10 11:54:06 +00:00
|
|
|
|
text: {
|
|
|
|
|
if (root.loading) {
|
|
|
|
|
return "dummy text"
|
|
|
|
|
} else if (!root.isModelDataValid || root.isNFT) {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-08 08:28:04 +00:00
|
|
|
|
switch(d.txType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Send:
|
|
|
|
|
case Constants.TransactionType.Sell:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
return "−" + root.transactionValue
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Buy:
|
|
|
|
|
case Constants.TransactionType.Receive:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return "+" + root.transactionValue
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Swap:
|
2023-06-30 15:07:53 +00:00
|
|
|
|
let outValue = root.outTransactionValue
|
|
|
|
|
outValue = outValue.replace('<', '<')
|
|
|
|
|
let inValue = root.inTransactionValue
|
|
|
|
|
inValue = inValue.replace('<', '<')
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return "<font color=\"%1\">-%2</font> <font color=\"%3\">/</font> <font color=\"%4\">+%5</font>"
|
|
|
|
|
.arg(Theme.palette.directColor1)
|
2023-06-30 15:07:53 +00:00
|
|
|
|
.arg(outValue)
|
2023-05-10 11:54:06 +00:00
|
|
|
|
.arg(Theme.palette.baseColor1)
|
|
|
|
|
.arg(Theme.palette.successColor1)
|
2023-06-30 15:07:53 +00:00
|
|
|
|
.arg(inValue)
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
2024-07-17 08:16:02 +00:00
|
|
|
|
case Constants.TransactionType.Approve:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
default:
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
horizontalAlignment: Qt.AlignRight
|
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
|
font.pixelSize: root.loading ? d.loadingPixelSize : 13
|
|
|
|
|
customColor: {
|
2023-06-15 13:09:35 +00:00
|
|
|
|
if (!root.isModelDataValid)
|
|
|
|
|
return ""
|
|
|
|
|
|
2024-07-08 08:28:04 +00:00
|
|
|
|
switch(d.txType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Receive:
|
|
|
|
|
case Constants.TransactionType.Buy:
|
|
|
|
|
case Constants.TransactionType.Swap:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return Theme.palette.successColor1
|
|
|
|
|
default:
|
|
|
|
|
return Theme.palette.directColor1
|
|
|
|
|
}
|
2023-04-05 11:42:12 +00:00
|
|
|
|
}
|
2023-01-12 23:26:48 +00:00
|
|
|
|
loading: root.loading
|
2021-10-05 20:50:22 +00:00
|
|
|
|
}
|
2023-05-10 11:54:06 +00:00
|
|
|
|
StatusTextWithLoadingState {
|
|
|
|
|
id: fiatValueText
|
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
|
horizontalAlignment: Qt.AlignRight
|
|
|
|
|
text: {
|
|
|
|
|
if (root.loading) {
|
|
|
|
|
return "dummy text"
|
2023-07-18 14:05:22 +00:00
|
|
|
|
} else if (!root.isModelDataValid || root.isNFT || !modelData.symbol) {
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return ""
|
|
|
|
|
}
|
2023-01-12 23:26:48 +00:00
|
|
|
|
|
2024-07-08 08:28:04 +00:00
|
|
|
|
switch(d.txType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Send:
|
|
|
|
|
case Constants.TransactionType.Sell:
|
|
|
|
|
case Constants.TransactionType.Buy:
|
2024-09-24 11:51:22 +00:00
|
|
|
|
return "−" + root.currenciesStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Receive:
|
2024-09-24 11:51:22 +00:00
|
|
|
|
return "+" + root.currenciesStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Swap:
|
2024-09-24 11:51:22 +00:00
|
|
|
|
return "-%1 / +%2".arg(root.currenciesStore.formatCurrencyAmount(root.outFiatValue, root.currentCurrency))
|
|
|
|
|
.arg(root.currenciesStore.formatCurrencyAmount(root.inFiatValue, root.currentCurrency))
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
2024-07-17 08:16:02 +00:00
|
|
|
|
case Constants.TransactionType.Approve:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
default:
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
font.pixelSize: root.loading ? d.loadingPixelSize : 12
|
|
|
|
|
customColor: Theme.palette.baseColor1
|
|
|
|
|
loading: root.loading
|
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
|
}
|
2023-05-10 11:54:06 +00:00
|
|
|
|
},
|
|
|
|
|
Loader {
|
|
|
|
|
id: headerStatusLoader
|
|
|
|
|
active: false
|
|
|
|
|
visible: active
|
|
|
|
|
sourceComponent: Rectangle {
|
|
|
|
|
id: statusRect
|
|
|
|
|
width: transactionTypeIcon.width + (retryButton.visible ? retryButton.width + 5 : 0)
|
|
|
|
|
height: transactionTypeIcon.height
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
color: "transparent"
|
|
|
|
|
radius: 100
|
|
|
|
|
border {
|
|
|
|
|
width: retryButton.visible ? 1 : 0
|
|
|
|
|
color: root.asset.bgBorderColor
|
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
2023-05-10 11:54:06 +00:00
|
|
|
|
StatusButton {
|
|
|
|
|
id: retryButton
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
anchors.leftMargin: 10
|
|
|
|
|
radius: height / 2
|
|
|
|
|
height: parent.height * 0.7
|
|
|
|
|
verticalPadding: 0
|
|
|
|
|
horizontalPadding: radius
|
|
|
|
|
text: qsTr("Retry")
|
|
|
|
|
size: StatusButton.Small
|
|
|
|
|
type: StatusButton.Primary
|
2023-08-02 04:36:54 +00:00
|
|
|
|
visible: d.showRetryButton
|
2023-05-10 11:54:06 +00:00
|
|
|
|
onClicked: root.retryClicked()
|
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
2023-05-10 11:54:06 +00:00
|
|
|
|
StatusSmartIdenticon {
|
|
|
|
|
id: transactionTypeIcon
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
enabled: false
|
|
|
|
|
asset: root.asset
|
|
|
|
|
active: !!root.asset.name
|
|
|
|
|
loading: root.loading
|
|
|
|
|
name: root.title
|
|
|
|
|
}
|
2023-08-02 04:36:54 +00:00
|
|
|
|
|
2023-05-10 11:54:06 +00:00
|
|
|
|
StatusRoundIcon {
|
|
|
|
|
visible: !root.loading
|
|
|
|
|
anchors {
|
|
|
|
|
right: transactionTypeIcon.right
|
|
|
|
|
bottom: transactionTypeIcon.bottom
|
|
|
|
|
}
|
|
|
|
|
asset: root.statusIconAsset
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
|
}
|
2023-05-10 11:54:06 +00:00
|
|
|
|
]
|
2022-09-05 09:15:47 +00:00
|
|
|
|
|
|
|
|
|
states: [
|
|
|
|
|
State {
|
2023-05-10 11:54:06 +00:00
|
|
|
|
name: "header"
|
2022-09-05 09:15:47 +00:00
|
|
|
|
PropertyChanges {
|
2023-05-10 11:54:06 +00:00
|
|
|
|
target: headerStatusLoader
|
|
|
|
|
active: true
|
2022-09-05 09:15:47 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
2023-05-10 11:54:06 +00:00
|
|
|
|
target: leftIconStatusIcon
|
|
|
|
|
visible: false
|
2022-09-05 09:15:47 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
2023-05-10 11:54:06 +00:00
|
|
|
|
target: root.statusListItemIcon
|
|
|
|
|
active: false
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: root.asset
|
2023-08-02 04:36:54 +00:00
|
|
|
|
bgBorderWidth: d.showRetryButton ? 0 : 1
|
2023-05-10 11:54:06 +00:00
|
|
|
|
width: 34
|
|
|
|
|
height: 34
|
|
|
|
|
bgWidth: 56
|
|
|
|
|
bgHeight: 56
|
2022-09-05 09:15:47 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
2023-05-10 11:54:06 +00:00
|
|
|
|
target: root.statusIconAsset
|
|
|
|
|
width: 17
|
|
|
|
|
height: 17
|
2022-09-05 09:15:47 +00:00
|
|
|
|
}
|
2024-04-25 10:01:26 +00:00
|
|
|
|
// PropertyChanges { // TODO uncomment when retry failed tx is implemented
|
|
|
|
|
// target: d
|
|
|
|
|
// titlePixelSize: 17
|
|
|
|
|
// datePixelSize: 13
|
|
|
|
|
// subtitlePixelSize: 15
|
|
|
|
|
// loadingPixelSize: 14
|
|
|
|
|
// showRetryButton: (!root.loading && root.transactionStatus === Constants.TransactionStatus.Failed && walletRootStore.isOwnedAccount(modelData.sender))
|
|
|
|
|
// }
|
2022-09-05 09:15:47 +00:00
|
|
|
|
}
|
|
|
|
|
]
|
2024-02-08 12:49:12 +00:00
|
|
|
|
|
|
|
|
|
ColorAnimation {
|
|
|
|
|
id: bgColorAnimation
|
|
|
|
|
|
|
|
|
|
target: d
|
|
|
|
|
property: "animatedBgColor"
|
|
|
|
|
from: d.isLightTheme ? "#33869eff" : "#1a4360df"
|
|
|
|
|
to: "transparent"
|
|
|
|
|
duration: 1000
|
|
|
|
|
alwaysRunToEnd: true
|
|
|
|
|
|
|
|
|
|
onStopped: {
|
|
|
|
|
modelData.doneHighlighting()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Add a delay before the animation to make it easier to notice when scrolling
|
|
|
|
|
Timer {
|
|
|
|
|
id: delayAnimation
|
|
|
|
|
interval: 250
|
|
|
|
|
running: root.visible && isModelDataValid && modelData.highlight
|
|
|
|
|
repeat: false
|
|
|
|
|
onTriggered: {
|
|
|
|
|
bgColorAnimation.start()
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
|
}
|