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
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
|
import shared 1.0
|
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
|
2023-06-13 08:18:53 +00:00
|
|
|
|
rootStore: RootStore
|
2023-06-30 15:07:53 +00:00
|
|
|
|
walletRootStore: WalletStore.RootStore
|
|
|
|
|
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) : ""
|
|
|
|
|
|
|
|
|
|
required property var rootStore
|
|
|
|
|
required property var 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
|
|
|
|
|
|
|
|
|
readonly property int transactionStatus: isModelDataValid ? modelData.status : Constants.TransactionStatus.Pending
|
|
|
|
|
readonly property bool isMultiTransaction: isModelDataValid && modelData.isMultiTransaction
|
|
|
|
|
readonly property string currentCurrency: rootStore.currentCurrency
|
|
|
|
|
readonly property double cryptoValue: isModelDataValid && !isMultiTransaction ? modelData.amount : 0.0
|
|
|
|
|
readonly property double fiatValue: isModelDataValid && !isMultiTransaction ? rootStore.getFiatValue(cryptoValue, modelData.symbol, currentCurrency) : 0.0
|
|
|
|
|
readonly property double inCryptoValue: isModelDataValid ? modelData.inAmount : 0.0
|
|
|
|
|
readonly property double inFiatValue: isModelDataValid && isMultiTransaction ? rootStore.getFiatValue(inCryptoValue, modelData.inSymbol, currentCurrency): 0.0
|
|
|
|
|
readonly property double outCryptoValue: isModelDataValid ? modelData.outAmount : 0.0
|
|
|
|
|
readonly property double outFiatValue: isModelDataValid && isMultiTransaction ? rootStore.getFiatValue(outCryptoValue, modelData.outSymbol, currentCurrency): 0.0
|
|
|
|
|
readonly property double feeCryptoValue: 0.0 // TODO fill when bridge data is implemented
|
|
|
|
|
readonly property double feeFiatValue: 0.0 // TODO fill when bridge data is implemented
|
|
|
|
|
readonly property string networkColor: isModelDataValid ? rootStore.getNetworkColor(modelData.chainId) : ""
|
|
|
|
|
readonly property string networkName: isModelDataValid ? rootStore.getNetworkFullName(modelData.chainId) : ""
|
|
|
|
|
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
|
2023-06-30 15:07:53 +00:00
|
|
|
|
|
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) {
|
|
|
|
|
return modelData.nftName ? modelData.nftName : "#" + modelData.tokenID
|
2023-05-10 11:54:06 +00:00
|
|
|
|
}
|
2023-06-30 15:07:53 +00:00
|
|
|
|
return root.rootStore.formatCurrencyAmount(cryptoValue, modelData.symbol)
|
2023-05-10 11:54:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-30 15:07:53 +00:00
|
|
|
|
readonly property string inTransactionValue: isModelDataValid && isMultiTransaction ? rootStore.formatCurrencyAmount(inCryptoValue, modelData.inSymbol) : qsTr("N/A")
|
|
|
|
|
readonly property string outTransactionValue: isModelDataValid && isMultiTransaction ? rootStore.formatCurrencyAmount(outCryptoValue, modelData.outSymbol) : qsTr("N/A")
|
|
|
|
|
|
2023-05-10 11:54:06 +00:00
|
|
|
|
readonly property string tokenImage: {
|
|
|
|
|
if (!isModelDataValid)
|
|
|
|
|
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:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return Style.svg("transaction/pending")
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionStatus.Complete:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return Style.svg("transaction/verified")
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionStatus.Finished:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return Style.svg("transaction/finished")
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionStatus.Failed:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return Style.svg("transaction/failed")
|
|
|
|
|
default:
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
property StatusAssetSettings tokenIconAsset: StatusAssetSettings {
|
|
|
|
|
width: 18
|
|
|
|
|
height: 18
|
|
|
|
|
bgWidth: width
|
|
|
|
|
bgHeight: height
|
|
|
|
|
bgColor: "transparent"
|
|
|
|
|
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-06-13 08:18:53 +00:00
|
|
|
|
function getDetailsString() {
|
|
|
|
|
let details = ""
|
|
|
|
|
const endl = "\n"
|
|
|
|
|
const endl2 = endl + endl
|
2023-06-15 13:09:35 +00:00
|
|
|
|
const type = modelData.txType
|
2023-06-30 15:07:53 +00:00
|
|
|
|
const feeEthValue = rootStore.getGasEthValue(modelData.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
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
details += qsTr("Summary") + endl
|
2023-06-15 13:09:35 +00:00
|
|
|
|
switch(modelData.txType) {
|
|
|
|
|
case Constants.TransactionType.Buy:
|
|
|
|
|
case Constants.TransactionType.Sell:
|
|
|
|
|
case Constants.TransactionType.Destroy:
|
|
|
|
|
case Constants.TransactionType.Swap:
|
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += subTitle + endl2
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
details += qsTr("%1 from %2 to %3 via %4").arg(transactionValue).arg(fromAddress).arg(toAddress).arg(networkName) + endl2
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (root.isNFT) {
|
|
|
|
|
details += qsTr("Token ID") + endl + modelData.tokenID + endl2
|
|
|
|
|
details += qsTr("Token name") + endl + modelData.nftName + endl2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PROGRESS
|
|
|
|
|
const isLayer1 = rootStore.getNetworkLayer(modelData.chainId) === 1
|
|
|
|
|
// A block on layer1 is every 12s
|
|
|
|
|
const confirmationTimeStamp = isLayer1 ? modelData.timestamp + 12 * 4 : modelData.timestamp
|
|
|
|
|
// A block on layer1 is every 12s
|
|
|
|
|
const finalisationTimeStamp = isLayer1 ? modelData.timestamp + 12 * 64 : modelData.timestamp + 604800 // 7 days in seconds
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionStatus.Verified: {
|
2023-06-13 08:18:53 +00:00
|
|
|
|
const timestampString = LocaleUtils.formatDateTime(modelData.timestamp * 1000, Locale.LongFormat)
|
|
|
|
|
details += qsTr("Status") + endl
|
|
|
|
|
const epoch = parseFloat(Math.abs(walletRootStore.getLatestBlockNumber(modelData.chainId) - rootStore.hex2Dec(modelData.blockNumber)).toFixed(0)).toLocaleString()
|
|
|
|
|
details += qsTr("Finalised in epoch %1").arg(epoch.toFixed(0)) + endl2
|
|
|
|
|
details += qsTr("Signed") + endl + root.timestampString + endl2
|
|
|
|
|
details += qsTr("Confirmed") + endl
|
|
|
|
|
details += LocaleUtils.formatDateTime(confirmationTimeStamp * 1000, Locale.LongFormat) + endl2
|
|
|
|
|
break
|
|
|
|
|
}
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionStatus.Finished: {
|
2023-06-13 08:18:53 +00:00
|
|
|
|
const timestampString = LocaleUtils.formatDateTime(modelData.timestamp * 1000, Locale.LongFormat)
|
|
|
|
|
details += qsTr("Status") + endl
|
|
|
|
|
const epoch = Math.abs(walletRootStore.getLatestBlockNumber(modelData.chainId) - rootStore.hex2Dec(modelData.blockNumber))
|
|
|
|
|
details += qsTr("Finalised in epoch %1").arg(epoch.toFixed(0)) + endl2
|
|
|
|
|
details += qsTr("Signed") + endl + timestampString + endl2
|
|
|
|
|
details += qsTr("Confirmed") + endl
|
|
|
|
|
details += LocaleUtils.formatDateTime(confirmationTimeStamp * 1000, Locale.LongFormat) + endl2
|
|
|
|
|
details += qsTr("Finalised") + endl
|
|
|
|
|
details += LocaleUtils.formatDateTime(finalisationTimeStamp * 1000, Locale.LongFormat) + endl2
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SUMMARY ADRESSES
|
2023-06-30 15:07:53 +00:00
|
|
|
|
const toNetworkName = "" // TODO fill when bridge data is implemented
|
2023-06-13 08:18:53 +00:00
|
|
|
|
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-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("In") + endl + root.fromAddress + endl2
|
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("From") + endl + root.networkName + endl2
|
2023-06-30 15:07:53 +00:00
|
|
|
|
details += qsTr("To") + endl + toNetworkName + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("In") + endl + modelData.from + endl2
|
|
|
|
|
break
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
const protocolName = "" // TODO fill protocol name for Bridge and Swap
|
|
|
|
|
if (!!protocolName) {
|
|
|
|
|
details += qsTr("Using") + endl + protocolName + endl2
|
|
|
|
|
}
|
|
|
|
|
if (!!modelData.txHash) {
|
|
|
|
|
details += qsTr("%1 Tx hash").arg(root.networkName) + endl + modelData.txHash + endl2
|
|
|
|
|
}
|
|
|
|
|
const bridgeTxHash = "" // TODO fill tx hash for Bridge
|
|
|
|
|
if (!!bridgeTxHash) {
|
2023-06-30 15:07:53 +00:00
|
|
|
|
details += qsTr("%1 Tx hash").arg(toNetworkName) + endl + bridgeTxHash + endl2
|
2023-06-13 08:18:53 +00:00
|
|
|
|
}
|
|
|
|
|
const protocolFromContractAddress = "" // TODO fill protocol contract address for 'from' network for Bridge and Swap
|
|
|
|
|
if (!!protocolName && !!protocolFromContractAddress) {
|
|
|
|
|
details += qsTr("%1 %2 contract address").arg(root.networkName).arg(protocolName) + endl
|
|
|
|
|
details += protocolFromContractAddress + endl2
|
|
|
|
|
}
|
|
|
|
|
if (!!modelData.contract) {
|
2023-06-30 15:07:53 +00:00
|
|
|
|
details += qsTr("%1 %2 contract address").arg(root.networkName).arg(modelData.symbol) + endl
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += modelData.contract + endl2
|
|
|
|
|
}
|
|
|
|
|
const protocolToContractAddress = "" // TODO fill protocol contract address for 'to' network for Bridge
|
|
|
|
|
if (!!protocolToContractAddress && !!protocolName) {
|
2023-06-30 15:07:53 +00:00
|
|
|
|
details += qsTr("%1 %2 contract address").arg(toNetworkName).arg(protocolName) + endl
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += protocolToContractAddress + endl2
|
|
|
|
|
}
|
|
|
|
|
const swapContractAddress = "" // TODO fill swap contract address for Swap
|
|
|
|
|
const bridgeContractAddress = "" // TODO fill token's contract address for 'to' network for Bridge
|
|
|
|
|
switch (type) {
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Swap:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
if (!!swapContractAddress) {
|
2023-06-30 15:07:53 +00:00
|
|
|
|
details += qsTr("%1 %2 contract address").arg(root.networkName).arg(modelData.toSymbol) + endl
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += swapContractAddress + endl2
|
|
|
|
|
}
|
|
|
|
|
break
|
2023-06-15 13:09:35 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
if (!!bridgeContractAddress) {
|
2023-06-30 15:07:53 +00:00
|
|
|
|
details += qsTr("%1 %2 contract address").arg(toNetworkName).arg(modelData.symbol) + endl
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += bridgeContractAddress + endl2
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
details += qsTr("Token format") + endl + modelData.type.toUpperCase() + endl2
|
|
|
|
|
details += qsTr("Nonce") + endl + rootStore.hex2Dec(modelData.nonce) + endl2
|
2023-06-15 13:09:35 +00:00
|
|
|
|
if (type === Constants.TransactionType.Bridge) {
|
2023-06-13 08:18:53 +00:00
|
|
|
|
details += qsTr("Included in Block on %1").arg(networkName) + endl
|
|
|
|
|
details += rootStore.hex2Dec(modelData.blockNumber) + endl2
|
2023-06-30 15:07:53 +00:00
|
|
|
|
details += qsTr("Included in Block on %1").arg(toNetworkName) + endl
|
2023-06-13 08:18:53 +00:00
|
|
|
|
const bridgeBlockNumber = 0 // TODO fill when bridge data is implemented
|
|
|
|
|
details += rootStore.hex2Dec(bridgeBlockNumber) + endl2
|
|
|
|
|
} else {
|
|
|
|
|
details += qsTr("Included in Block") + endl + rootStore.hex2Dec(modelData.blockNumber) + endl2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// VALUES
|
2023-06-30 15:07:53 +00:00
|
|
|
|
const fiatTransactionValue = rootStore.formatCurrencyAmount(isMultiTransaction ? root.outFiatValue : root.fiatValue, root.currentCurrency)
|
2023-06-13 08:18:53 +00:00
|
|
|
|
const feeFiatValue = rootStore.getFiatValue(feeEthValue, "ETH", root.currentCurrency)
|
|
|
|
|
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) {
|
2023-06-30 15:07:53 +00:00
|
|
|
|
const crypto = rootStore.formatCurrencyAmount(root.inCryptoValue, modelData.inSymbol)
|
|
|
|
|
const fiat = rootStore.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
|
2023-06-30 15:07:53 +00:00
|
|
|
|
const valueInCrypto = rootStore.getCryptoValue(root.fiatValue - feeFiatValue, modelData.inSymbol, root.currentCurrency)
|
|
|
|
|
const crypto = rootStore.formatCurrencyAmount(valueInCrypto, modelData.inSymbol)
|
2023-06-13 08:18:53 +00:00
|
|
|
|
const fiat = rootStore.formatCurrencyAmount(root.fiatValue - feeFiatValue, root.currentCurrency)
|
|
|
|
|
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-06-13 08:18:53 +00:00
|
|
|
|
const feeValue = LocaleUtils.currencyAmountToLocaleString(modelData.totalFees)
|
|
|
|
|
const feeFiat = rootStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
|
|
|
|
|
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) {
|
2023-06-13 08:18:53 +00:00
|
|
|
|
const feeCrypto = rootStore.formatCurrencyAmount(feeEthValue, "ETH")
|
|
|
|
|
const feeFiat = rootStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
|
|
|
|
|
valuesString += qsTr("Fees %1 (%2)").arg(feeCrypto).arg(feeFiat) + endl2
|
2023-06-15 13:09:35 +00:00
|
|
|
|
} else if (type === Constants.TransactionType.Receive || (type === Constants.TransactionType.Buy && isLayer1)) {
|
2023-06-13 08:18:53 +00:00
|
|
|
|
valuesString += qsTr("Total %1 (%2)").arg(root.transactionValue).arg(fiatTransactionValue) + endl2
|
|
|
|
|
} else {
|
|
|
|
|
const feeEth = rootStore.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
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove locale specific number separator
|
|
|
|
|
details = details.replace(/\ /, ' ')
|
|
|
|
|
// Remove empty new lines at the end
|
|
|
|
|
return details.replace(/[\r\n\s]*$/, '')
|
|
|
|
|
}
|
|
|
|
|
|
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
|
2023-06-16 09:37:17 +00:00
|
|
|
|
color: sensor.containsMouse ? Theme.palette.baseColor5 : Style.current.transparent
|
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 ""
|
|
|
|
|
|
|
|
|
|
switch(modelData.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-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"
|
|
|
|
|
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
|
2023-06-15 13:09:35 +00:00
|
|
|
|
switch(modelData.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"))
|
|
|
|
|
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 {
|
|
|
|
|
visible: !root.loading
|
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
|
|
|
|
|
visible: root.isModelDataValid && !root.isNFT && !!root.inTokenImage &&modelData.txType === Constants.TransactionType.Swap
|
2023-05-10 11:54:06 +00:00
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
asset: StatusAssetSettings {
|
|
|
|
|
width: root.tokenIconAsset.width
|
|
|
|
|
height: root.tokenIconAsset.height
|
|
|
|
|
bgWidth: width + 2
|
|
|
|
|
bgHeight: height + 2
|
|
|
|
|
bgRadius: bgWidth / 2
|
|
|
|
|
bgColor: root.color
|
|
|
|
|
isImage:root.tokenIconAsset.isImage
|
|
|
|
|
color: root.tokenIconAsset.color
|
2023-06-30 15:07:53 +00:00
|
|
|
|
name: root.inTokenImage
|
2023-05-10 11:54:06 +00:00
|
|
|
|
isLetterIdenticon: root.tokenIconAsset.isLetterIdenticon
|
2022-09-01 15:34:27 +00:00
|
|
|
|
}
|
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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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-06-15 13:09:35 +00:00
|
|
|
|
switch(modelData.txType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Receive:
|
2023-05-19 09:51:47 +00:00
|
|
|
|
return qsTr("%1 from %2 via %3").arg(transactionValue).arg(fromAddress).arg(networkName)
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Buy:
|
|
|
|
|
case Constants.TransactionType.Sell:
|
2023-05-10 11:54:06 +00:00
|
|
|
|
return qsTr("%1 on %2 via %3").arg(transactionValue).arg(toAddress).arg(networkName)
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Destroy:
|
2023-06-30 15:07:53 +00:00
|
|
|
|
return qsTr("%1 at %2 via %3").arg(inTransactionValue).arg(toAddress).arg(networkName)
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Swap:
|
2023-06-30 15:07:53 +00:00
|
|
|
|
return qsTr("%1 to %2 via %3").arg(outTransactionValue).arg(inTransactionValue).arg(networkName)
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-06-30 15:07:53 +00:00
|
|
|
|
let toNetworkName = "" // TODO fill when Bridge data is implemented
|
|
|
|
|
return qsTr("%1 from %2 to %3").arg(inTransactionValue).arg(networkName).arg(toNetworkName)
|
2023-05-10 11:54:06 +00:00
|
|
|
|
default:
|
|
|
|
|
return qsTr("%1 to %2 via %3").arg(transactionValue).arg(toAddress).arg(networkName)
|
|
|
|
|
}
|
|
|
|
|
}
|
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 {
|
|
|
|
|
active: !headerStatusLoader.active
|
|
|
|
|
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 ""
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-15 13:09:35 +00:00
|
|
|
|
switch(modelData.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:
|
2023-06-30 15:07:53 +00:00
|
|
|
|
return "−" + root.rootStore.formatCurrencyAmount(feeCryptoValue, modelData.symbol)
|
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 ""
|
|
|
|
|
|
|
|
|
|
switch(modelData.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"
|
|
|
|
|
} else if (!root.isModelDataValid || root.isNFT) {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
2023-01-12 23:26:48 +00:00
|
|
|
|
|
2023-06-15 13:09:35 +00:00
|
|
|
|
switch(modelData.txType) {
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Send:
|
|
|
|
|
case Constants.TransactionType.Sell:
|
|
|
|
|
case Constants.TransactionType.Buy:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
return "−" + root.rootStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Receive:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
return "+" + root.rootStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Swap:
|
2023-06-30 15:07:53 +00:00
|
|
|
|
return "-%1 / +%2".arg(root.rootStore.formatCurrencyAmount(root.outFiatValue, root.currentCurrency))
|
|
|
|
|
.arg(root.rootStore.formatCurrencyAmount(root.inFiatValue, root.currentCurrency))
|
2023-06-12 13:04:39 +00:00
|
|
|
|
case Constants.TransactionType.Bridge:
|
2023-06-13 08:18:53 +00:00
|
|
|
|
return "−" + root.rootStore.formatCurrencyAmount(root.feeFiatValue, root.currentCurrency)
|
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-06-18 12:47:24 +00:00
|
|
|
|
visible: !root.loading && root.transactionStatus === Constants.TransactionStatus.Failed
|
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
|
|
|
|
|
}
|
|
|
|
|
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-06-18 12:47:24 +00:00
|
|
|
|
bgBorderWidth: root.transactionStatus === Constants.TransactionStatus.Failed ? 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
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
2023-05-10 11:54:06 +00:00
|
|
|
|
target: root.tokenIconAsset
|
|
|
|
|
width: 20
|
|
|
|
|
height: 20
|
2022-09-05 09:15:47 +00:00
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
2023-05-10 11:54:06 +00:00
|
|
|
|
target: d
|
|
|
|
|
titlePixelSize: 17
|
|
|
|
|
datePixelSize: 13
|
|
|
|
|
subtitlePixelSize: 15
|
|
|
|
|
loadingPixelSize: 14
|
2022-09-05 09:15:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
2021-10-05 20:50:22 +00:00
|
|
|
|
}
|