mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-22 19:48:52 +00:00
chore(@desktop/wallet): Unify transaction enums (#11034)
This commit is contained in:
parent
fe491aba6e
commit
31f59a2e81
@ -58,8 +58,8 @@ SplitView {
|
|||||||
bridgeNetworkName: "Mainnet"
|
bridgeNetworkName: "Mainnet"
|
||||||
feeFiatValue: 10.34
|
feeFiatValue: 10.34
|
||||||
feeCryptoValue: 0.013
|
feeCryptoValue: 0.013
|
||||||
transactionStatus: TransactionDelegate.Pending
|
transactionStatus: Constants.TransactionStatus.Pending
|
||||||
transactionType: TransactionDelegate.Send
|
transactionType: Constants.TransactionType.Send
|
||||||
formatCurrencyAmount: function(amount, symbol, options = null, locale = null) {
|
formatCurrencyAmount: function(amount, symbol, options = null, locale = null) {
|
||||||
const currencyAmount = {
|
const currencyAmount = {
|
||||||
amount: amount,
|
amount: amount,
|
||||||
@ -115,13 +115,13 @@ SplitView {
|
|||||||
textRole: "name"
|
textRole: "name"
|
||||||
valueRole: "type"
|
valueRole: "type"
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
ListElement { name: "Sent"; type: TransactionDelegate.Send }
|
ListElement { name: "Sent"; type: Constants.TransactionType.Send }
|
||||||
ListElement { name: "Receive"; type: TransactionDelegate.Receive }
|
ListElement { name: "Receive"; type: Constants.TransactionType.Receive }
|
||||||
ListElement { name: "Buy"; type: TransactionDelegate.Buy }
|
ListElement { name: "Buy"; type: Constants.TransactionType.Buy }
|
||||||
ListElement { name: "Sell"; type: TransactionDelegate.Sell }
|
ListElement { name: "Sell"; type: Constants.TransactionType.Sell }
|
||||||
ListElement { name: "Destroy"; type: TransactionDelegate.Destroy }
|
ListElement { name: "Destroy"; type: Constants.TransactionType.Destroy }
|
||||||
ListElement { name: "Swap"; type: TransactionDelegate.Swap }
|
ListElement { name: "Swap"; type: Constants.TransactionType.Swap }
|
||||||
ListElement { name: "Bridge"; type: TransactionDelegate.Bridge }
|
ListElement { name: "Bridge"; type: Constants.TransactionType.Bridge }
|
||||||
}
|
}
|
||||||
onActivated: delegate.transactionType = model.get(currentIndex).type
|
onActivated: delegate.transactionType = model.get(currentIndex).type
|
||||||
}
|
}
|
||||||
@ -137,10 +137,10 @@ SplitView {
|
|||||||
textRole: "name"
|
textRole: "name"
|
||||||
valueRole: "type"
|
valueRole: "type"
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
ListElement { name: "Pending"; status: TransactionDelegate.Pending }
|
ListElement { name: "Pending"; status: Constants.TransactionStatus.Pending }
|
||||||
ListElement { name: "Failed"; status: TransactionDelegate.Failed }
|
ListElement { name: "Failed"; status: Constants.TransactionStatus.Failed }
|
||||||
ListElement { name: "Verified"; status: TransactionDelegate.Verified }
|
ListElement { name: "Complete"; status: Constants.TransactionStatus.Complete }
|
||||||
ListElement { name: "Finished"; status: TransactionDelegate.Finished }
|
ListElement { name: "Finished"; status: Constants.TransactionStatus.Finished }
|
||||||
}
|
}
|
||||||
onActivated: delegate.transactionStatus = model.get(currentIndex).status
|
onActivated: delegate.transactionStatus = model.get(currentIndex).status
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ Item {
|
|||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
|
|
||||||
modelData: transaction
|
modelData: transaction
|
||||||
transactionType: d.isIncoming ? TransactionDelegate.Receive : TransactionDelegate.Send
|
transactionType: d.isIncoming ? Constants.TransactionType.Receive : Constants.TransactionType.Send
|
||||||
currentCurrency: RootStore.currentCurrency
|
currentCurrency: RootStore.currentCurrency
|
||||||
cryptoValue: d.cryptoValue
|
cryptoValue: d.cryptoValue
|
||||||
fiatValue: d.fiatValue
|
fiatValue: d.fiatValue
|
||||||
@ -116,7 +116,7 @@ Item {
|
|||||||
WalletTxProgressBlock {
|
WalletTxProgressBlock {
|
||||||
id: progressBlock
|
id: progressBlock
|
||||||
width: Math.min(513, root.width)
|
width: Math.min(513, root.width)
|
||||||
error: transactionHeader.transactionStatus === TransactionDelegate.TransactionStatus.Failed
|
error: transactionHeader.transactionStatus === Constants.TransactionStatus.Failed
|
||||||
isLayer1: RootStore.getNetworkLayer(root.transaction.chainId) == 1
|
isLayer1: RootStore.getNetworkLayer(root.transaction.chainId) == 1
|
||||||
confirmations: root.isTransactionValid ? Math.abs(WalletStores.RootStore.getLatestBlockNumber(root.transaction.chainId) - d.blockNumber): 0
|
confirmations: root.isTransactionValid ? Math.abs(WalletStores.RootStore.getLatestBlockNumber(root.transaction.chainId) - d.blockNumber): 0
|
||||||
chainName: d.networkFullName
|
chainName: d.networkFullName
|
||||||
@ -132,7 +132,7 @@ Item {
|
|||||||
width: Math.min(304, progressBlock.width)
|
width: Math.min(304, progressBlock.width)
|
||||||
nftName: root.isTransactionValid ? transaction.nftName : ""
|
nftName: root.isTransactionValid ? transaction.nftName : ""
|
||||||
nftUrl: root.isTransactionValid && !!transaction.nftImageUrl ? transaction.nftImageUrl : ""
|
nftUrl: root.isTransactionValid && !!transaction.nftImageUrl ? transaction.nftImageUrl : ""
|
||||||
strikethrough: transactionHeader.transactionType === TransactionDelegate.Destroy
|
strikethrough: transactionHeader.transactionType === Constants.TransactionType.Destroy
|
||||||
tokenId: root.isTransactionValid ? transaction.tokenID : ""
|
tokenId: root.isTransactionValid ? transaction.tokenID : ""
|
||||||
contractAddress: root.isTransactionValid ? transaction.contract : ""
|
contractAddress: root.isTransactionValid ? transaction.contract : ""
|
||||||
}
|
}
|
||||||
@ -167,9 +167,9 @@ Item {
|
|||||||
title: qsTr("From")
|
title: qsTr("From")
|
||||||
subTitle: {
|
subTitle: {
|
||||||
switch(transactionHeader.transactionType) {
|
switch(transactionHeader.transactionType) {
|
||||||
case TransactionDelegate.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return d.symbol
|
return d.symbol
|
||||||
case TransactionDelegate.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return d.networkFullName
|
return d.networkFullName
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -177,9 +177,9 @@ Item {
|
|||||||
}
|
}
|
||||||
asset.name: {
|
asset.name: {
|
||||||
switch(transactionHeader.transactionType) {
|
switch(transactionHeader.transactionType) {
|
||||||
case TransactionDelegate.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return !!d.symbol ? Style.png("tokens/%1".arg(d.symbol)) : ""
|
return !!d.symbol ? Style.png("tokens/%1".arg(d.symbol)) : ""
|
||||||
case TransactionDelegate.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return !!d.networkIcon ? Style.svg(d.networkIcon) : ""
|
return !!d.networkIcon ? Style.svg(d.networkIcon) : ""
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -194,9 +194,9 @@ Item {
|
|||||||
title: qsTr("To")
|
title: qsTr("To")
|
||||||
subTitle: {
|
subTitle: {
|
||||||
switch(transactionHeader.transactionType) {
|
switch(transactionHeader.transactionType) {
|
||||||
case TransactionDelegate.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return d.swapSymbol
|
return d.swapSymbol
|
||||||
case TransactionDelegate.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return d.bridgeNetworkFullname
|
return d.bridgeNetworkFullname
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -204,9 +204,9 @@ Item {
|
|||||||
}
|
}
|
||||||
asset.name: {
|
asset.name: {
|
||||||
switch(transactionHeader.transactionType) {
|
switch(transactionHeader.transactionType) {
|
||||||
case TransactionDelegate.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return !!d.swapSymbol ? Style.png("tokens/%1".arg(d.swapSymbol)) : ""
|
return !!d.swapSymbol ? Style.png("tokens/%1".arg(d.swapSymbol)) : ""
|
||||||
case TransactionDelegate.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return !!d.bridgeNetworkIcon ? Style.svg(d.bridgeNetworkIcon) : ""
|
return !!d.bridgeNetworkIcon ? Style.svg(d.bridgeNetworkIcon) : ""
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -217,13 +217,13 @@ Item {
|
|||||||
}
|
}
|
||||||
TransactionAddressTile {
|
TransactionAddressTile {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
title: transactionHeader.transactionType === TransactionDelegate.Swap || transactionHeader.transactionType === TransactionDelegate.Bridge ?
|
title: transactionHeader.transactionType === Constants.TransactionType.Swap || transactionHeader.transactionType === Constants.TransactionType.Bridge ?
|
||||||
qsTr("In") : qsTr("From")
|
qsTr("In") : qsTr("From")
|
||||||
addresses: root.isTransactionValid ? [root.transaction.from] : []
|
addresses: root.isTransactionValid ? [root.transaction.from] : []
|
||||||
contactsStore: root.contactsStore
|
contactsStore: root.contactsStore
|
||||||
rootStore: WalletStores.RootStore
|
rootStore: WalletStores.RootStore
|
||||||
onButtonClicked: {
|
onButtonClicked: {
|
||||||
if (transactionHeader.transactionType === TransactionDelegate.Swap || transactionHeader.transactionType === TransactionDelegate.Bridge) {
|
if (transactionHeader.transactionType === Constants.TransactionType.Swap || transactionHeader.transactionType === Constants.TransactionType.Bridge) {
|
||||||
addressMenu.openEthAddressMenu(this, addresses[0], d.networkShortName)
|
addressMenu.openEthAddressMenu(this, addresses[0], d.networkShortName)
|
||||||
} else {
|
} else {
|
||||||
addressMenu.openSenderMenu(this, addresses[0], d.networkShortName)
|
addressMenu.openSenderMenu(this, addresses[0], d.networkShortName)
|
||||||
@ -237,7 +237,7 @@ Item {
|
|||||||
contactsStore: root.contactsStore
|
contactsStore: root.contactsStore
|
||||||
rootStore: WalletStores.RootStore
|
rootStore: WalletStores.RootStore
|
||||||
onButtonClicked: addressMenu.openReceiverMenu(this, addresses[0], d.networkShortName)
|
onButtonClicked: addressMenu.openReceiverMenu(this, addresses[0], d.networkShortName)
|
||||||
visible: transactionHeader.transactionType !== TransactionDelegate.Swap && transactionHeader.transactionType !== TransactionDelegate.Bridge && transactionHeader.transactionType !== TransactionDelegate.Destroy
|
visible: transactionHeader.transactionType !== Constants.TransactionType.Swap && transactionHeader.transactionType !== Constants.TransactionType.Bridge && transactionHeader.transactionType !== Constants.TransactionType.Destroy
|
||||||
}
|
}
|
||||||
TransactionDataTile {
|
TransactionDataTile {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -272,7 +272,7 @@ Item {
|
|||||||
symbol: "" // TODO fill protocol name for Bridge and Swap
|
symbol: "" // TODO fill protocol name for Bridge and Swap
|
||||||
networkName: d.networkFullName
|
networkName: d.networkFullName
|
||||||
shortNetworkName: d.networkShortName
|
shortNetworkName: d.networkShortName
|
||||||
visible: !!subTitle && (transactionHeader.transactionType === TransactionDelegate.Bridge || transactionHeader.transactionType === TransactionDelegate.Swap)
|
visible: !!subTitle && (transactionHeader.transactionType === Constants.TransactionType.Bridge || transactionHeader.transactionType === Constants.TransactionType.Swap)
|
||||||
}
|
}
|
||||||
TransactionContractTile {
|
TransactionContractTile {
|
||||||
// Used to display contract address for any network
|
// Used to display contract address for any network
|
||||||
@ -287,7 +287,7 @@ Item {
|
|||||||
symbol: "" // TODO fill protocol name for Bridge
|
symbol: "" // TODO fill protocol name for Bridge
|
||||||
networkName: d.bridgeNetworkFullname
|
networkName: d.bridgeNetworkFullname
|
||||||
shortNetworkName: d.bridgeNetworkShortName
|
shortNetworkName: d.bridgeNetworkShortName
|
||||||
visible: !!subTitle && transactionHeader.transactionType === TransactionDelegate.Bridge
|
visible: !!subTitle && transactionHeader.transactionType === Constants.TransactionType.Bridge
|
||||||
}
|
}
|
||||||
TransactionContractTile {
|
TransactionContractTile {
|
||||||
// Used for Bridge and Swap to display 'To' network token contract address
|
// Used for Bridge and Swap to display 'To' network token contract address
|
||||||
@ -295,9 +295,9 @@ Item {
|
|||||||
if (!root.isTransactionValid)
|
if (!root.isTransactionValid)
|
||||||
return ""
|
return ""
|
||||||
switch(transactionHeader.transactionType) {
|
switch(transactionHeader.transactionType) {
|
||||||
case TransactionDelegate.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return transaction.contract
|
return transaction.contract
|
||||||
case TransactionDelegate.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return "" // TODO fill swap token's contract address for 'to' network for Bridge
|
return "" // TODO fill swap token's contract address for 'to' network for Bridge
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -307,9 +307,9 @@ Item {
|
|||||||
if (!root.isTransactionValid)
|
if (!root.isTransactionValid)
|
||||||
return ""
|
return ""
|
||||||
switch(transactionHeader.transactionType) {
|
switch(transactionHeader.transactionType) {
|
||||||
case TransactionDelegate.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return d.swapSymbol
|
return d.swapSymbol
|
||||||
case TransactionDelegate.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return transaction.value.symbol.toUpperCase()
|
return transaction.value.symbol.toUpperCase()
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -366,7 +366,7 @@ Item {
|
|||||||
subTitle: d.networkFullName
|
subTitle: d.networkFullName
|
||||||
asset.name: !!d.networkIcon ? Style.svg("%1".arg(d.networkIcon)) : ""
|
asset.name: !!d.networkIcon ? Style.svg("%1".arg(d.networkIcon)) : ""
|
||||||
smallIcon: true
|
smallIcon: true
|
||||||
visible: transactionHeader.transactionType !== TransactionDelegate.Bridge
|
visible: transactionHeader.transactionType !== Constants.TransactionType.Bridge
|
||||||
}
|
}
|
||||||
TransactionDataTile {
|
TransactionDataTile {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
@ -442,9 +442,9 @@ Item {
|
|||||||
if (d.isNFT)
|
if (d.isNFT)
|
||||||
return false
|
return false
|
||||||
switch(transactionHeader.transactionType) {
|
switch(transactionHeader.transactionType) {
|
||||||
case TransactionDelegate.Send:
|
case Constants.TransactionType.Send:
|
||||||
case TransactionDelegate.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
case TransactionDelegate.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
@ -453,14 +453,14 @@ Item {
|
|||||||
}
|
}
|
||||||
TransactionDataTile {
|
TransactionDataTile {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
title: transactionHeader.transactionStatus === TransactionDelegate.Pending ? qsTr("Amount to receive") : qsTr("Amount received")
|
title: transactionHeader.transactionStatus === Constants.TransactionType.Pending ? qsTr("Amount to receive") : qsTr("Amount received")
|
||||||
subTitle: {
|
subTitle: {
|
||||||
if (d.isNFT)
|
if (d.isNFT)
|
||||||
return ""
|
return ""
|
||||||
const type = transactionHeader.transactionType
|
const type = transactionHeader.transactionType
|
||||||
if (type === TransactionDelegate.Swap) {
|
if (type === Constants.TransactionType.Swap) {
|
||||||
return RootStore.formatCurrencyAmount(d.swapCryptoValue, d.swapSymbol)
|
return RootStore.formatCurrencyAmount(d.swapCryptoValue, d.swapSymbol)
|
||||||
} else if (type === TransactionDelegate.Bridge) {
|
} else if (type === Constants.TransactionType.Bridge) {
|
||||||
// Reduce crypto value by fee value
|
// Reduce crypto value by fee value
|
||||||
const valueInCrypto = RootStore.getCryptoValue(d.fiatValue - d.feeFiatValue, d.symbol, RootStore.currentCurrency)
|
const valueInCrypto = RootStore.getCryptoValue(d.fiatValue - d.feeFiatValue, d.symbol, RootStore.currentCurrency)
|
||||||
return RootStore.formatCurrencyAmount(valueInCrypto, d.symbol)
|
return RootStore.formatCurrencyAmount(valueInCrypto, d.symbol)
|
||||||
@ -469,9 +469,9 @@ Item {
|
|||||||
}
|
}
|
||||||
tertiaryTitle: {
|
tertiaryTitle: {
|
||||||
const type = transactionHeader.transactionType
|
const type = transactionHeader.transactionType
|
||||||
if (type === TransactionDelegate.Swap) {
|
if (type === Constants.TransactionType.Swap) {
|
||||||
return RootStore.formatCurrencyAmount(d.swapCryptoValue, d.swapSymbol)
|
return RootStore.formatCurrencyAmount(d.swapCryptoValue, d.swapSymbol)
|
||||||
} else if (type === TransactionDelegate.Bridge) {
|
} else if (type === Constants.TransactionType.Bridge) {
|
||||||
return RootStore.formatCurrencyAmount(d.fiatValue - d.feeFiatValue, RootStore.currentCurrency)
|
return RootStore.formatCurrencyAmount(d.fiatValue - d.feeFiatValue, RootStore.currentCurrency)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@ -485,9 +485,9 @@ Item {
|
|||||||
if (!root.isTransactionValid || d.isNFT)
|
if (!root.isTransactionValid || d.isNFT)
|
||||||
return ""
|
return ""
|
||||||
switch(transactionHeader.transactionType) {
|
switch(transactionHeader.transactionType) {
|
||||||
case TransactionDelegate.Send:
|
case Constants.TransactionType.Send:
|
||||||
case TransactionDelegate.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
case TransactionDelegate.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return LocaleUtils.currencyAmountToLocaleString(root.transaction.totalFees)
|
return LocaleUtils.currencyAmountToLocaleString(root.transaction.totalFees)
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -499,14 +499,14 @@ Item {
|
|||||||
TransactionDataTile {
|
TransactionDataTile {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
// Using fees in this tile because of same higlight and color settings as Total
|
// Using fees in this tile because of same higlight and color settings as Total
|
||||||
title: transactionHeader.transactionType === TransactionDelegate.Destroy || d.isNFT ? qsTr("Fees") : qsTr("Total")
|
title: transactionHeader.transactionType === Constants.TransactionType.Destroy || d.isNFT ? qsTr("Fees") : qsTr("Total")
|
||||||
subTitle: {
|
subTitle: {
|
||||||
if (d.isNFT && d.isIncoming)
|
if (d.isNFT && d.isIncoming)
|
||||||
return ""
|
return ""
|
||||||
const type = transactionHeader.transactionType
|
const type = transactionHeader.transactionType
|
||||||
if (type === TransactionDelegate.Destroy || d.isNFT) {
|
if (type === Constants.TransactionType.Destroy || d.isNFT) {
|
||||||
return RootStore.formatCurrencyAmount(d.feeEthValue, "ETH")
|
return RootStore.formatCurrencyAmount(d.feeEthValue, "ETH")
|
||||||
} else if (type === TransactionDelegate.Receive || (type === TransactionDelegate.Buy && progressBlock.isLayer1)) {
|
} else if (type === Constants.TransactionType.Receive || (type === Constants.TransactionType.Buy && progressBlock.isLayer1)) {
|
||||||
return d.cryptoValueFormatted
|
return d.cryptoValueFormatted
|
||||||
}
|
}
|
||||||
return "%1 + %2".arg(d.cryptoValueFormatted).arg(RootStore.formatCurrencyAmount(d.feeEthValue, "ETH"))
|
return "%1 + %2".arg(d.cryptoValueFormatted).arg(RootStore.formatCurrencyAmount(d.feeEthValue, "ETH"))
|
||||||
@ -515,9 +515,9 @@ Item {
|
|||||||
if (d.isNFT && d.isIncoming)
|
if (d.isNFT && d.isIncoming)
|
||||||
return ""
|
return ""
|
||||||
const type = transactionHeader.transactionType
|
const type = transactionHeader.transactionType
|
||||||
if (type === TransactionDelegate.Destroy || d.isNFT) {
|
if (type === Constants.TransactionType.Destroy || d.isNFT) {
|
||||||
return RootStore.formatCurrencyAmount(d.feeFiatValue, RootStore.currentCurrency)
|
return RootStore.formatCurrencyAmount(d.feeFiatValue, RootStore.currentCurrency)
|
||||||
} else if (type === TransactionDelegate.Receive || (type === TransactionDelegate.Buy && progressBlock.isLayer1)) {
|
} else if (type === Constants.TransactionType.Receive || (type === Constants.TransactionType.Buy && progressBlock.isLayer1)) {
|
||||||
return d.fiatValueFormatted
|
return d.fiatValueFormatted
|
||||||
}
|
}
|
||||||
return RootStore.formatCurrencyAmount(d.fiatValue + d.feeFiatValue, RootStore.currentCurrency)
|
return RootStore.formatCurrencyAmount(d.fiatValue + d.feeFiatValue, RootStore.currentCurrency)
|
||||||
|
@ -55,7 +55,7 @@ StatusListItem {
|
|||||||
property string symbol
|
property string symbol
|
||||||
property string swapSymbol // TODO fill when swap data is implemented
|
property string swapSymbol // TODO fill when swap data is implemented
|
||||||
property int transactionType
|
property int transactionType
|
||||||
property int transactionStatus: transferStatus === 0 ? TransactionDelegate.TransactionStatus.Pending : TransactionDelegate.TransactionStatus.Finished
|
property int transactionStatus: transferStatus === 0 ? Constants.TransactionStatus.Pending : Constants.TransactionStatus.Finished
|
||||||
property string currentCurrency
|
property string currentCurrency
|
||||||
property int transferStatus
|
property int transferStatus
|
||||||
property double cryptoValue
|
property double cryptoValue
|
||||||
@ -129,13 +129,13 @@ StatusListItem {
|
|||||||
color: "transparent"
|
color: "transparent"
|
||||||
name: {
|
name: {
|
||||||
switch(root.transactionStatus) {
|
switch(root.transactionStatus) {
|
||||||
case TransactionDelegate.TransactionStatus.Pending:
|
case Constants.TransactionStatus.Pending:
|
||||||
return Style.svg("transaction/pending")
|
return Style.svg("transaction/pending")
|
||||||
case TransactionDelegate.TransactionStatus.Verified:
|
case Constants.TransactionStatus.Complete:
|
||||||
return Style.svg("transaction/verified")
|
return Style.svg("transaction/verified")
|
||||||
case TransactionDelegate.TransactionStatus.Finished:
|
case Constants.TransactionStatus.Finished:
|
||||||
return Style.svg("transaction/finished")
|
return Style.svg("transaction/finished")
|
||||||
case TransactionDelegate.TransactionStatus.Failed:
|
case Constants.TransactionStatus.Failed:
|
||||||
return Style.svg("transaction/failed")
|
return Style.svg("transaction/failed")
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -155,23 +155,6 @@ StatusListItem {
|
|||||||
isLetterIdenticon: loading
|
isLetterIdenticon: loading
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TransactionType {
|
|
||||||
Send,
|
|
||||||
Receive,
|
|
||||||
Buy,
|
|
||||||
Sell,
|
|
||||||
Destroy,
|
|
||||||
Swap,
|
|
||||||
Bridge
|
|
||||||
}
|
|
||||||
|
|
||||||
enum TransactionStatus {
|
|
||||||
Pending,
|
|
||||||
Failed,
|
|
||||||
Verified,
|
|
||||||
Finished
|
|
||||||
}
|
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
|
||||||
@ -194,18 +177,18 @@ StatusListItem {
|
|||||||
isLetterIdenticon: loading
|
isLetterIdenticon: loading
|
||||||
name: {
|
name: {
|
||||||
switch(root.transactionType) {
|
switch(root.transactionType) {
|
||||||
case TransactionDelegate.TransactionType.Send:
|
case Constants.TransactionType.Send:
|
||||||
return "send"
|
return "send"
|
||||||
case TransactionDelegate.TransactionType.Receive:
|
case Constants.TransactionType.Receive:
|
||||||
return "receive"
|
return "receive"
|
||||||
case TransactionDelegate.TransactionType.Buy:
|
case Constants.TransactionType.Buy:
|
||||||
case TransactionDelegate.TransactionType.Sell:
|
case Constants.TransactionType.Sell:
|
||||||
return "token"
|
return "token"
|
||||||
case TransactionDelegate.TransactionType.Destroy:
|
case Constants.TransactionType.Destroy:
|
||||||
return "destroy"
|
return "destroy"
|
||||||
case TransactionDelegate.TransactionType.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return "swap"
|
return "swap"
|
||||||
case TransactionDelegate.TransactionType.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return "bridge"
|
return "bridge"
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -237,22 +220,22 @@ StatusListItem {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
const isPending = root.transactionStatus === TransactionDelegate.TransactionStatus.Pending
|
const isPending = root.transactionStatus === Constants.TransactionStatus.Pending
|
||||||
const failed = root.transactionStatus === TransactionDelegate.TransactionStatus.Failed
|
const failed = root.transactionStatus === Constants.TransactionStatus.Failed
|
||||||
switch(root.transactionType) {
|
switch(root.transactionType) {
|
||||||
case TransactionDelegate.TransactionType.Send:
|
case Constants.TransactionType.Send:
|
||||||
return failed ? qsTr("Send failed") : (isPending ? qsTr("Sending") : qsTr("Sent"))
|
return failed ? qsTr("Send failed") : (isPending ? qsTr("Sending") : qsTr("Sent"))
|
||||||
case TransactionDelegate.TransactionType.Receive:
|
case Constants.TransactionType.Receive:
|
||||||
return failed ? qsTr("Receive failed") : (isPending ? qsTr("Receiving") : qsTr("Received"))
|
return failed ? qsTr("Receive failed") : (isPending ? qsTr("Receiving") : qsTr("Received"))
|
||||||
case TransactionDelegate.TransactionType.Buy:
|
case Constants.TransactionType.Buy:
|
||||||
return failed ? qsTr("Buy failed") : (isPending ? qsTr("Buying") : qsTr("Bought"))
|
return failed ? qsTr("Buy failed") : (isPending ? qsTr("Buying") : qsTr("Bought"))
|
||||||
case TransactionDelegate.TransactionType.Sell:
|
case Constants.TransactionType.Sell:
|
||||||
return failed ? qsTr("Sell failed") : (isPending ? qsTr("Selling") : qsTr("Sold"))
|
return failed ? qsTr("Sell failed") : (isPending ? qsTr("Selling") : qsTr("Sold"))
|
||||||
case TransactionDelegate.TransactionType.Destroy:
|
case Constants.TransactionType.Destroy:
|
||||||
return failed ? qsTr("Destroy failed") : (isPending ? qsTr("Destroying") : qsTr("Destroyed"))
|
return failed ? qsTr("Destroy failed") : (isPending ? qsTr("Destroying") : qsTr("Destroyed"))
|
||||||
case TransactionDelegate.TransactionType.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return failed ? qsTr("Swap failed") : (isPending ? qsTr("Swapping") : qsTr("Swapped"))
|
return failed ? qsTr("Swap failed") : (isPending ? qsTr("Swapping") : qsTr("Swapped"))
|
||||||
case TransactionDelegate.TransactionType.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return failed ? qsTr("Bridge failed") : (isPending ? qsTr("Bridging") : qsTr("Bridged"))
|
return failed ? qsTr("Bridge failed") : (isPending ? qsTr("Bridging") : qsTr("Bridged"))
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -275,7 +258,7 @@ StatusListItem {
|
|||||||
}
|
}
|
||||||
StatusRoundIcon {
|
StatusRoundIcon {
|
||||||
id: swapTokenImage
|
id: swapTokenImage
|
||||||
visible: !root.isNFT && !!root.swapTokenImage && root.transactionType === TransactionDelegate.TransactionType.Swap
|
visible: !root.isNFT && !!root.swapTokenImage && root.transactionType === Constants.TransactionType.Swap
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
asset: StatusAssetSettings {
|
asset: StatusAssetSettings {
|
||||||
width: root.tokenIconAsset.width
|
width: root.tokenIconAsset.width
|
||||||
@ -308,16 +291,16 @@ StatusListItem {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
switch(root.transactionType) {
|
switch(root.transactionType) {
|
||||||
case TransactionDelegate.TransactionType.Receive:
|
case Constants.TransactionType.Receive:
|
||||||
return qsTr("%1 from %2 via %3").arg(transactionValue).arg(fromAddress).arg(networkName)
|
return qsTr("%1 from %2 via %3").arg(transactionValue).arg(fromAddress).arg(networkName)
|
||||||
case TransactionDelegate.TransactionType.Buy:
|
case Constants.TransactionType.Buy:
|
||||||
case TransactionDelegate.TransactionType.Sell:
|
case Constants.TransactionType.Sell:
|
||||||
return qsTr("%1 on %2 via %3").arg(transactionValue).arg(toAddress).arg(networkName)
|
return qsTr("%1 on %2 via %3").arg(transactionValue).arg(toAddress).arg(networkName)
|
||||||
case TransactionDelegate.TransactionType.Destroy:
|
case Constants.TransactionType.Destroy:
|
||||||
return qsTr("%1 at %2 via %3").arg(transactionValue).arg(toAddress).arg(networkName)
|
return qsTr("%1 at %2 via %3").arg(transactionValue).arg(toAddress).arg(networkName)
|
||||||
case TransactionDelegate.TransactionType.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return qsTr("%1 to %2 via %3").arg(transactionValue).arg(swapTransactionValue).arg(networkName)
|
return qsTr("%1 to %2 via %3").arg(transactionValue).arg(swapTransactionValue).arg(networkName)
|
||||||
case TransactionDelegate.TransactionType.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return qsTr("%1 from %2 to %3").arg(transactionValue).arg(bridgeNetworkName).arg(networkName)
|
return qsTr("%1 from %2 to %3").arg(transactionValue).arg(bridgeNetworkName).arg(networkName)
|
||||||
default:
|
default:
|
||||||
return qsTr("%1 to %2 via %3").arg(transactionValue).arg(toAddress).arg(networkName)
|
return qsTr("%1 to %2 via %3").arg(transactionValue).arg(toAddress).arg(networkName)
|
||||||
@ -344,20 +327,20 @@ StatusListItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch(root.transactionType) {
|
switch(root.transactionType) {
|
||||||
case TransactionDelegate.TransactionType.Send:
|
case Constants.TransactionType.Send:
|
||||||
case TransactionDelegate.TransactionType.Sell:
|
case Constants.TransactionType.Sell:
|
||||||
return "-" + root.transactionValue
|
return "-" + root.transactionValue
|
||||||
case TransactionDelegate.TransactionType.Buy:
|
case Constants.TransactionType.Buy:
|
||||||
case TransactionDelegate.TransactionType.Receive:
|
case Constants.TransactionType.Receive:
|
||||||
return "+" + root.transactionValue
|
return "+" + root.transactionValue
|
||||||
case TransactionDelegate.TransactionType.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return "<font color=\"%1\">-%2</font> <font color=\"%3\">/</font> <font color=\"%4\">+%5</font>"
|
return "<font color=\"%1\">-%2</font> <font color=\"%3\">/</font> <font color=\"%4\">+%5</font>"
|
||||||
.arg(Theme.palette.directColor1)
|
.arg(Theme.palette.directColor1)
|
||||||
.arg(root.transactionValue)
|
.arg(root.transactionValue)
|
||||||
.arg(Theme.palette.baseColor1)
|
.arg(Theme.palette.baseColor1)
|
||||||
.arg(Theme.palette.successColor1)
|
.arg(Theme.palette.successColor1)
|
||||||
.arg(root.swapTransactionValue)
|
.arg(root.swapTransactionValue)
|
||||||
case TransactionDelegate.TransactionType.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return "-" + root.formatCurrencyAmount(feeCryptoValue, root.symbol)
|
return "-" + root.formatCurrencyAmount(feeCryptoValue, root.symbol)
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -368,9 +351,9 @@ StatusListItem {
|
|||||||
font.pixelSize: root.loading ? d.loadingPixelSize : 13
|
font.pixelSize: root.loading ? d.loadingPixelSize : 13
|
||||||
customColor: {
|
customColor: {
|
||||||
switch(root.transactionType) {
|
switch(root.transactionType) {
|
||||||
case TransactionDelegate.TransactionType.Receive:
|
case Constants.TransactionType.Receive:
|
||||||
case TransactionDelegate.TransactionType.Buy:
|
case Constants.TransactionType.Buy:
|
||||||
case TransactionDelegate.TransactionType.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return Theme.palette.successColor1
|
return Theme.palette.successColor1
|
||||||
default:
|
default:
|
||||||
return Theme.palette.directColor1
|
return Theme.palette.directColor1
|
||||||
@ -390,16 +373,16 @@ StatusListItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch(root.transactionType) {
|
switch(root.transactionType) {
|
||||||
case TransactionDelegate.TransactionType.Send:
|
case Constants.TransactionType.Send:
|
||||||
case TransactionDelegate.TransactionType.Sell:
|
case Constants.TransactionType.Sell:
|
||||||
case TransactionDelegate.TransactionType.Buy:
|
case Constants.TransactionType.Buy:
|
||||||
return "-" + root.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
return "-" + root.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
||||||
case TransactionDelegate.TransactionType.Receive:
|
case Constants.TransactionType.Receive:
|
||||||
return "+" + root.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
return "+" + root.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
||||||
case TransactionDelegate.TransactionType.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return "-%1 / +%2".arg(root.formatCurrencyAmount(root.fiatValue, root.currentCurrency))
|
return "-%1 / +%2".arg(root.formatCurrencyAmount(root.fiatValue, root.currentCurrency))
|
||||||
.arg(root.formatCurrencyAmount(root.swapFiatValue, root.currentCurrency))
|
.arg(root.formatCurrencyAmount(root.swapFiatValue, root.currentCurrency))
|
||||||
case TransactionDelegate.TransactionType.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
return "-" + root.formatCurrencyAmount(root.feeFiatValue, root.currentCurrency)
|
return "-" + root.formatCurrencyAmount(root.feeFiatValue, root.currentCurrency)
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
@ -440,7 +423,7 @@ StatusListItem {
|
|||||||
text: qsTr("Retry")
|
text: qsTr("Retry")
|
||||||
size: StatusButton.Small
|
size: StatusButton.Small
|
||||||
type: StatusButton.Primary
|
type: StatusButton.Primary
|
||||||
visible: !root.loading && root.transactionStatus === TransactionDelegate.Failed
|
visible: !root.loading && root.transactionStatus === Constants.TransactionType.Failed
|
||||||
onClicked: root.retryClicked()
|
onClicked: root.retryClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +466,7 @@ StatusListItem {
|
|||||||
}
|
}
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: root.asset
|
target: root.asset
|
||||||
bgBorderWidth: root.transactionStatus === TransactionDelegate.Failed ? 0 : 1
|
bgBorderWidth: root.transactionStatus === Constants.TransactionType.Failed ? 0 : 1
|
||||||
width: 34
|
width: 34
|
||||||
height: 34
|
height: 34
|
||||||
bgWidth: 56
|
bgWidth: 56
|
||||||
|
@ -28,23 +28,6 @@ Control {
|
|||||||
property var assetsModel: null
|
property var assetsModel: null
|
||||||
property bool assetsLoading: true
|
property bool assetsLoading: true
|
||||||
|
|
||||||
// Mirrors src/backend/activity.nim ActivityType
|
|
||||||
enum ActivityType {
|
|
||||||
Send,
|
|
||||||
Receive,
|
|
||||||
Buy,
|
|
||||||
Swap,
|
|
||||||
Bridge
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mirrors src/backend/activity.nim ActivityStatus
|
|
||||||
enum ActivityStatus {
|
|
||||||
Failed,
|
|
||||||
Pending,
|
|
||||||
Complete,
|
|
||||||
Finalized
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "white"
|
color: "white"
|
||||||
@ -369,10 +352,10 @@ Control {
|
|||||||
text: `{${
|
text: `{${
|
||||||
function() {
|
function() {
|
||||||
switch (entry.status) {
|
switch (entry.status) {
|
||||||
case ActivityView.ActivityStatus.Failed: return "F";
|
case Constants.TransactionStatus.Failed: return "F";
|
||||||
case ActivityView.ActivityStatus.Pending: return "P";
|
case Constants.TransactionStatus.Pending: return "P";
|
||||||
case ActivityView.ActivityStatus.Complete: return "C";
|
case Constants.TransactionStatus.Complete: return "C";
|
||||||
case ActivityView.ActivityStatus.Finalized: return "FZ";
|
case Constants.TransactionStatus.Finalized: return "FZ";
|
||||||
}
|
}
|
||||||
return "-"
|
return "-"
|
||||||
}()}}`
|
}()}}`
|
||||||
|
@ -195,7 +195,7 @@ ColumnLayout {
|
|||||||
TransactionDelegate {
|
TransactionDelegate {
|
||||||
width: ListView.view.width
|
width: ListView.view.width
|
||||||
modelData: model
|
modelData: model
|
||||||
transactionType: isModelDataValid && modelData.to.toLowerCase() === root.overview.mixedcaseAddress.toLowerCase() ? TransactionDelegate.Receive : TransactionDelegate.Send
|
transactionType: isModelDataValid && modelData.to.toLowerCase() === root.overview.mixedcaseAddress.toLowerCase() ? Constants.TransactionType.Receive : Constants.TransactionType.Send
|
||||||
currentCurrency: RootStore.currentCurrency
|
currentCurrency: RootStore.currentCurrency
|
||||||
cryptoValue: isModelDataValid ? modelData.value.amount : 0.0
|
cryptoValue: isModelDataValid ? modelData.value.amount : 0.0
|
||||||
fiatValue: isModelDataValid ? RootStore.getFiatValue(cryptoValue, symbol, currentCurrency): 0.0
|
fiatValue: isModelDataValid ? RootStore.getFiatValue(cryptoValue, symbol, currentCurrency): 0.0
|
||||||
|
@ -876,11 +876,6 @@ QtObject {
|
|||||||
|
|
||||||
readonly property int minPasswordLength: 10
|
readonly property int minPasswordLength: 10
|
||||||
|
|
||||||
enum TransactionStatus {
|
|
||||||
Failure = 0,
|
|
||||||
Success = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
enum SendType {
|
enum SendType {
|
||||||
Transfer,
|
Transfer,
|
||||||
ENSRegister,
|
ENSRegister,
|
||||||
@ -939,6 +934,25 @@ QtObject {
|
|||||||
ERC721 = 2
|
ERC721 = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mirrors src/backend/activity.nim ActivityStatus
|
||||||
|
enum TransactionStatus {
|
||||||
|
Failed,
|
||||||
|
Pending,
|
||||||
|
Complete,
|
||||||
|
Finished
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mirrors src/backend/activity.nim ActivityType
|
||||||
|
enum TransactionType {
|
||||||
|
Send,
|
||||||
|
Receive,
|
||||||
|
Buy,
|
||||||
|
Swap,
|
||||||
|
Bridge,
|
||||||
|
Sell, // TODO update value when added to backend
|
||||||
|
Destroy // TODO update value when added to backend
|
||||||
|
}
|
||||||
|
|
||||||
readonly property QtObject walletSection: QtObject {
|
readonly property QtObject walletSection: QtObject {
|
||||||
readonly property string cancelledMessage: "cancelled"
|
readonly property string cancelledMessage: "cancelled"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user