fix(wallet): Fill bridge tx type (#16162)

This commit is contained in:
Cuteivist 2024-08-21 14:49:12 +02:00 committed by GitHub
parent f3a33f414d
commit 67cf522f0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 9 deletions

View File

@ -383,6 +383,8 @@ QtObject:
return transactions.MultiTransactionType.MultiTransactionSwap
of SendType.Approve:
return transactions.MultiTransactionType.MultiTransactionApprove
of SendType.Bridge:
return transactions.MultiTransactionType.MultiTransactionBridge
else:
return transactions.MultiTransactionType.MultiTransactionSend

View File

@ -345,7 +345,6 @@ StatusMenu {
StatusAction {
id: sendToAddressAction
enabled: false
visibleOnDisabled: true
text: {
switch(d.addressType) {
case TransactionAddressMenu.AddressType.Sender:

View File

@ -101,7 +101,7 @@ Item {
return outSymbol || !transaction.tokenOutAddress ? formatted : "%1 (%2)".arg(formatted).arg(Utils.compactAddress(transaction.tokenOutAddress, 4))
}
readonly property real feeEthValue: d.details ? RootStore.getFeeEthValue(d.details.totalFees) : 0
readonly property real feeFiatValue: d.isTransactionValid ? RootStore.getFiatValue(d.feeEthValue, Constants.ethToken) : 0
readonly property real feeFiatValue: RootStore.getFiatValue(d.feeEthValue, Constants.ethToken)
readonly property int transactionType: d.isTransactionValid ? WalletStores.RootStore.transactionType(transaction) : Constants.TransactionType.Send
readonly property bool isBridge: d.transactionType === Constants.TransactionType.Bridge
@ -289,7 +289,7 @@ Item {
case Constants.TransactionType.Swap:
return Constants.tokenIcon(d.inSymbol)
case Constants.TransactionType.Bridge:
return Style.svg(RootStore.Icon(d.transaction.chainIdIn)) ?? Style.svg("network/Network=Custom")
return Style.svg(ModelUtils.getByKey(RootStore.flatNetworks, "chainId", d.transaction.chainIdIn, "iconUrl")) ?? Style.svg("network/Network=Custom")
default:
return ""
}

View File

@ -61,8 +61,6 @@ StatusListItem {
readonly property double inFiatValue: isModelDataValid && isMultiTransaction ? rootStore.getFiatValue(inCryptoValue, modelData.inSymbol): 0.0
readonly property double outCryptoValue: isModelDataValid ? modelData.outAmount : 0.0
readonly property double outFiatValue: isModelDataValid && isMultiTransaction ? rootStore.getFiatValue(outCryptoValue, modelData.outSymbol): 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 ? SQUtils.ModelUtils.getByKey(rootStore.flatNetworks, "chainId", modelData.chainId, "chainColor") : ""
readonly property string networkName: isModelDataValid ? SQUtils.ModelUtils.getByKey(rootStore.flatNetworks, "chainId", modelData.chainId, "chainName") : ""
readonly property string networkNameIn: isMultiTransaction ? SQUtils.ModelUtils.getByKey(rootStore.flatNetworks, "chainId", modelData.chainIdIn, "chainName") : ""
@ -589,8 +587,8 @@ StatusListItem {
return qsTr("%1 to %2 on %3").arg(outTransactionValue).arg(inTransactionValue).arg(networkName)
case Constants.TransactionType.Bridge:
if (allAccounts)
return qsTr("%1 from %2 to %3 in %4").arg(inTransactionValue).arg(networkNameOut).arg(networkNameIn).arg(fromAddress)
return qsTr("%1 from %2 to %3").arg(inTransactionValue).arg(networkNameOut).arg(networkNameIn)
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)
case Constants.TransactionType.ContractDeployment:
const name = addressNameTo || addressNameFrom
return qsTr("Via %1 on %2").arg(name).arg(networkName)
@ -807,7 +805,6 @@ StatusListItem {
.arg(Theme.palette.successColor1)
.arg(inValue)
case Constants.TransactionType.Bridge:
return "" + root.rootStore.formatCurrencyAmount(feeCryptoValue, modelData.symbol)
case Constants.TransactionType.Approve:
default:
return ""
@ -853,7 +850,6 @@ StatusListItem {
return "-%1 / +%2".arg(root.rootStore.formatCurrencyAmount(root.outFiatValue, root.currentCurrency))
.arg(root.rootStore.formatCurrencyAmount(root.inFiatValue, root.currentCurrency))
case Constants.TransactionType.Bridge:
return "" + root.rootStore.formatCurrencyAmount(root.feeFiatValue, root.currentCurrency)
case Constants.TransactionType.Approve:
default:
return ""