feat(wallet): transaction settings added to sign send modal

This commit is contained in:
Sale Djenic 2025-01-23 11:52:16 +01:00
parent 73d4f30dc4
commit 808ebe85e6
18 changed files with 737 additions and 17 deletions

View File

@ -1725,6 +1725,9 @@ method displayEphemeralNotification*[T](self: Module[T], title: string, subTitle
elif details.notificationType == NotificationType.CommunityMemberUnbanned:
self.displayEphemeralWithActionNotification(title, "Visit community" , "communities", "", false, EphemeralNotificationType.Success.int, EphemeralActionType.NavigateToCommunityAdmin.int, details.sectionId)
else:
self.displayEphemeralNotification(title, subTitle, "", false, EphemeralNotificationType.Default.int, "", details)
method removeEphemeralNotification*[T](self: Module[T], id: int64) =
self.view.ephemeralNotificationModel().removeItemWithId(id)

View File

@ -49,7 +49,7 @@ proc delete*(self: Controller) =
proc init*(self: Controller) =
self.events.on(SIGNAL_TRANSACTION_SENT) do(e:Args):
let args = TransactionArgs(e)
var
var
txHash = ""
isApprovalTx = false
if not args.sentTransaction.isNil:
@ -107,6 +107,15 @@ proc suggestedRoutes*(self: Controller,
proc stopSuggestedRoutesAsyncCalculation*(self: Controller) =
self.transactionService.stopSuggestedRoutesAsyncCalculation()
proc setFeeMode*(self: Controller, feeMode: int, routerInputParamsUuid: string, pathName: string, chainId: int,
isApprovalTx: bool, communityId: string): string =
return self.transactionService.setFeeMode(feeMode, routerInputParamsUuid, pathName, chainId, isApprovalTx, communityId)
proc setCustomTxDetails*(self: Controller, nonce: int, gasAmount: int, maxFeesPerGas: string, priorityFee: string,
routerInputParamsUuid: string, pathName: string, chainId: int, isApprovalTx: bool, communityId: string): string =
return self.transactionService.setCustomTxDetails(nonce, gasAmount, maxFeesPerGas, priorityFee, routerInputParamsUuid,
pathName, chainId, isApprovalTx, communityId)
proc getCurrentNetworks*(self: Controller): seq[NetworkItem] =
return self.networkService.getCurrentNetworks()

View File

@ -44,6 +44,14 @@ method onUserAuthenticated*(self: AccessInterface, password: string, pin: string
method suggestedRoutesReady*(self: AccessInterface, uuid: string, routes: seq[TransactionPathDtoV2], errCode: string, errDescription: string) {.base.} =
raise newException(ValueError, "No implementation available")
method setFeeMode*(self: AccessInterface, feeMode: int, routerInputParamsUuid: string, pathName: string, chainId: int,
isApprovalTx: bool, communityId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method setCustomTxDetails*(self: AccessInterface, nonce: int, gasAmount: int, maxFeesPerGas: string, priorityFee: string,
routerInputParamsUuid: string, pathName: string, chainId: int, isApprovalTx: bool, communityId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method transactionWasSent*(self: AccessInterface, uuid: string, chainId: int = 0, approvalTx: bool = false, txHash: string = "", error: string = "") {.base.} =
raise newException(ValueError, "No implementation available")
@ -63,4 +71,4 @@ method onTransactionSigned*(self: AccessInterface, keycardFlowType: string, keyc
raise newException(ValueError, "No implementation available")
method transactionSendingComplete*(self: AccessInterface, txHash: string, status: string) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -5,6 +5,7 @@ import ../io_interface as delegate_interface
import app/global/global_singleton
import app/core/eventemitter
import app/core/notifications/notifications_manager
import app_service/common/utils
import app_service/common/wallet_constants
@ -116,12 +117,20 @@ proc convertTransactionPathDtoV2ToPathItem(self: Module, txPath: TransactionPath
amountInLocked = txPath.amountInLocked,
amountOut = $txPath.amountOut,
suggestedMaxFeesPerGasLowLevel = $txPath.suggestedLevelsForMaxFeesPerGas.low,
suggestedPriorityFeePerGasLowLevel = $txPath.suggestedLevelsForMaxFeesPerGas.lowPriority,
suggestedMaxFeesPerGasMediumLevel = $txPath.suggestedLevelsForMaxFeesPerGas.medium,
suggestedPriorityFeePerGasMediumLevel = $txPath.suggestedLevelsForMaxFeesPerGas.mediumPriority,
suggestedMaxFeesPerGasHighLevel = $txPath.suggestedLevelsForMaxFeesPerGas.high,
suggestedPriorityFeePerGasHighLevel = $txPath.suggestedLevelsForMaxFeesPerGas.highPriority,
suggestedMinPriorityFee = $txPath.suggestedMinPriorityFee,
suggestedMaxPriorityFee = $txPath.suggestedMaxPriorityFee,
currentBaseFee = $txPath.currentBaseFee,
suggestedTxNonce = $txPath.suggestedTxNonce,
suggestedTxGasAmount = $txPath.suggestedTxGasAmount,
suggestedApprovalTxNonce = $txPath.suggestedApprovalTxNonce,
suggestedApprovalGasAmount = $txPath.suggestedApprovalGasAmount,
txNonce = $txPath.txNonce,
txGasFeeMode = txPath.txGasFeeMode,
txMaxFeesPerGas = $txPath.txMaxFeesPerGas,
txBaseFee = $txPath.txBaseFee,
txPriorityFee = $txPath.txPriorityFee,
@ -135,6 +144,7 @@ proc convertTransactionPathDtoV2ToPathItem(self: Module, txPath: TransactionPath
approvalAmountRequired = $txPath.approvalAmountRequired,
approvalContractAddress = txPath.approvalContractAddress,
approvalTxNonce = $txPath.approvalTxNonce,
approvalGasFeeMode = txPath.approvalGasFeeMode,
approvalMaxFeesPerGas = $txPath.approvalMaxFeesPerGas,
approvalBaseFee = $txPath.approvalBaseFee,
approvalPriorityFee = $txPath.approvalPriorityFee,
@ -315,3 +325,20 @@ method stopUpdatesForSuggestedRoute*(self: Module) =
method transactionSendingComplete*(self: Module, txHash: string, status: string) =
self.view.sendtransactionSendingCompleteSignal(txHash, status)
method setFeeMode*(self: Module, feeMode: int, routerInputParamsUuid: string, pathName: string, chainId: int,
isApprovalTx: bool, communityId: string) =
let err = self.controller.setFeeMode(feeMode, routerInputParamsUuid, pathName, chainId, isApprovalTx, communityId)
if err.len > 0:
# TODO: translate this, or find a better way to display error at this step (maybe within the popup)
var data = NotificationArgs(title: "Setting fee mode", message: err)
self.events.emit(SIGNAL_DISPLAY_APP_NOTIFICATION, data)
method setCustomTxDetails*(self: Module, nonce: int, gasAmount: int, maxFeesPerGas: string, priorityFee: string,
routerInputParamsUuid: string, pathName: string, chainId: int, isApprovalTx: bool, communityId: string) =
let err = self.controller.setCustomTxDetails(nonce, gasAmount, maxFeesPerGas, priorityFee, routerInputParamsUuid, pathName,
chainId, isApprovalTx, communityId)
if err.len > 0:
# TODO: translate this, or find a better way to display error at this step (maybe within the popup)
var data = NotificationArgs(title: "Setting custom fee", message: err)
self.events.emit(SIGNAL_DISPLAY_APP_NOTIFICATION, data)

View File

@ -13,12 +13,20 @@ QtObject:
amountInLocked: bool
amountOut: string
suggestedMaxFeesPerGasLowLevel: string
suggestedPriorityFeePerGasLowLevel: string
suggestedMaxFeesPerGasMediumLevel: string
suggestedPriorityFeePerGasMediumLevel: string
suggestedMaxFeesPerGasHighLevel: string
suggestedPriorityFeePerGasHighLevel: string
suggestedMinPriorityFee: string
suggestedMaxPriorityFee: string
currentBaseFee: string
suggestedTxNonce: string
suggestedTxGasAmount: string
suggestedApprovalTxNonce: string
suggestedApprovalGasAmount: string
txNonce: string
txGasFeeMode: int
txMaxFeesPerGas: string
txBaseFee: string
txPriorityFee: string
@ -33,6 +41,7 @@ QtObject:
approvalAmountRequired : string
approvalContractAddress: string
approvalTxNonce: string
approvalGasFeeMode: int
approvalMaxFeesPerGas: string
approvalBaseFee: string
approvalPriorityFee: string
@ -51,12 +60,20 @@ QtObject:
amountInLocked: bool,
amountOut: string,
suggestedMaxFeesPerGasLowLevel: string,
suggestedPriorityFeePerGasLowLevel: string,
suggestedMaxFeesPerGasMediumLevel: string,
suggestedPriorityFeePerGasMediumLevel: string,
suggestedMaxFeesPerGasHighLevel: string,
suggestedPriorityFeePerGasHighLevel: string,
suggestedMinPriorityFee: string,
suggestedMaxPriorityFee: string,
currentBaseFee: string,
suggestedTxNonce: string,
suggestedTxGasAmount: string,
suggestedApprovalTxNonce: string,
suggestedApprovalGasAmount: string,
txNonce: string,
txGasFeeMode: int,
txMaxFeesPerGas: string,
txBaseFee: string,
txPriorityFee: string,
@ -71,6 +88,7 @@ QtObject:
approvalAmountRequired: string,
approvalContractAddress: string,
approvalTxNonce: string,
approvalGasFeeMode: int,
approvalMaxFeesPerGas: string,
approvalBaseFee: string,
approvalPriorityFee: string,
@ -89,12 +107,20 @@ QtObject:
self.amountInLocked = amountInLocked
self.amountOut = amountOut
self.suggestedMaxFeesPerGasLowLevel = suggestedMaxFeesPerGasLowLevel
self.suggestedPriorityFeePerGasLowLevel = suggestedPriorityFeePerGasLowLevel
self.suggestedMaxFeesPerGasMediumLevel = suggestedMaxFeesPerGasMediumLevel
self.suggestedPriorityFeePerGasMediumLevel = suggestedPriorityFeePerGasMediumLevel
self.suggestedMaxFeesPerGasHighLevel = suggestedMaxFeesPerGasHighLevel
self.suggestedPriorityFeePerGasHighLevel = suggestedPriorityFeePerGasHighLevel
self.suggestedMinPriorityFee = suggestedMinPriorityFee
self.suggestedMaxPriorityFee = suggestedMaxPriorityFee
self.currentBaseFee = currentBaseFee
self.suggestedTxNonce = suggestedTxNonce
self.suggestedTxGasAmount = suggestedTxGasAmount
self.suggestedApprovalTxNonce = suggestedApprovalTxNonce
self.suggestedApprovalGasAmount = suggestedApprovalGasAmount
self.txNonce = txNonce
self.txGasFeeMode = txGasFeeMode
self.txMaxFeesPerGas = txMaxFeesPerGas
self.txBaseFee = txBaseFee
self.txPriorityFee = txPriorityFee
@ -109,6 +135,7 @@ QtObject:
self.approvalAmountRequired = approvalAmountRequired
self.approvalContractAddress = approvalContractAddress
self.approvalTxNonce = approvalTxNonce
self.approvalGasFeeMode = approvalGasFeeMode
self.approvalMaxFeesPerGas = approvalMaxFeesPerGas
self.approvalBaseFee = approvalBaseFee
self.approvalPriorityFee = approvalPriorityFee
@ -130,12 +157,20 @@ QtObject:
amountInLocked: bool,
amountOut: string,
suggestedMaxFeesPerGasLowLevel: string,
suggestedPriorityFeePerGasLowLevel: string,
suggestedMaxFeesPerGasMediumLevel: string,
suggestedPriorityFeePerGasMediumLevel: string,
suggestedMaxFeesPerGasHighLevel: string,
suggestedPriorityFeePerGasHighLevel: string,
suggestedMinPriorityFee: string,
suggestedMaxPriorityFee: string,
currentBaseFee: string,
suggestedTxNonce: string,
suggestedTxGasAmount: string,
suggestedApprovalTxNonce: string,
suggestedApprovalGasAmount: string,
txNonce: string,
txGasFeeMode: int,
txMaxFeesPerGas: string,
txBaseFee: string,
txPriorityFee: string,
@ -150,6 +185,7 @@ QtObject:
approvalAmountRequired: string,
approvalContractAddress: string,
approvalTxNonce: string,
approvalGasFeeMode: int,
approvalMaxFeesPerGas: string,
approvalBaseFee: string,
approvalPriorityFee: string,
@ -160,11 +196,14 @@ QtObject:
): PathItem =
new(result, delete)
result.setup(processorName, fromChain, toChain, fromToken, toToken, amountIn, amountInLocked, amountOut,
suggestedMaxFeesPerGasLowLevel, suggestedMaxFeesPerGasMediumLevel, suggestedMaxFeesPerGasHighLevel,
suggestedMinPriorityFee, suggestedMaxPriorityFee, currentBaseFee, txNonce, txMaxFeesPerGas, txBaseFee,
suggestedMaxFeesPerGasLowLevel, suggestedPriorityFeePerGasLowLevel, suggestedMaxFeesPerGasMediumLevel,
suggestedPriorityFeePerGasMediumLevel, suggestedMaxFeesPerGasHighLevel, suggestedPriorityFeePerGasHighLevel,
suggestedMinPriorityFee, suggestedMaxPriorityFee, currentBaseFee, suggestedTxNonce, suggestedTxGasAmount,
suggestedApprovalTxNonce, suggestedApprovalGasAmount, txNonce, txGasFeeMode, txMaxFeesPerGas, txBaseFee,
txPriorityFee, txGasAmount, txBonderFees, txTokenFees, txEstimatedTime, txFee, txL1Fee, txTotalFee,
approvalRequired, approvalAmountRequired, approvalContractAddress, approvalTxNonce, approvalMaxFeesPerGas,
approvalBaseFee, approvalPriorityFee, approvalGasAmount, approvalEstimatedTime, approvalFee, approvalL1Fee)
approvalRequired, approvalAmountRequired, approvalContractAddress, approvalTxNonce, approvalGasFeeMode,
approvalMaxFeesPerGas, approvalBaseFee, approvalPriorityFee, approvalGasAmount, approvalEstimatedTime, approvalFee,
approvalL1Fee)
proc `$`*(self: PathItem): string =
result = "PathItem("
@ -177,12 +216,20 @@ QtObject:
result &= "\namountInLocked: " & $self.amountInLocked
result &= "\namountOut: " & $self.amountOut
result &= "\nsuggestedMaxFeesPerGasLowLevel: " & $self.suggestedMaxFeesPerGasLowLevel
result &= "\nsuggestedPriorityFeePerGasLowLevel: " & $self.suggestedPriorityFeePerGasLowLevel
result &= "\nsuggestedMaxFeesPerGasMediumLevel: " & $self.suggestedMaxFeesPerGasMediumLevel
result &= "\nsuggestedPriorityFeePerGasMediumLevel: " & $self.suggestedPriorityFeePerGasMediumLevel
result &= "\nsuggestedMaxFeesPerGasHighLevel: " & $self.suggestedMaxFeesPerGasHighLevel
result &= "\nsuggestedPriorityFeePerGasHighLevel: " & $self.suggestedPriorityFeePerGasHighLevel
result &= "\nsuggestedMinPriorityFee: " & $self.suggestedMinPriorityFee
result &= "\nsuggestedMaxPriorityFee: " & $self.suggestedMaxPriorityFee
result &= "\ncurrentBaseFee: " & $self.currentBaseFee
result &= "\nsuggestedTxNonce: " & $self.suggestedTxNonce
result &= "\nsuggestedTxGasAmount: " & $self.suggestedTxGasAmount
result &= "\nsuggestedApprovalTxNonce: " & $self.suggestedApprovalTxNonce
result &= "\nsuggestedApprovalGasAmount: " & $self.suggestedApprovalGasAmount
result &= "\ntxNonce: " & $self.txNonce
result &= "\ntxGasFeeMode: " & $self.txGasFeeMode
result &= "\ntxMaxFeesPerGas: " & $self.txMaxFeesPerGas
result &= "\ntxBaseFee: " & $self.txBaseFee
result &= "\ntxPriorityFee: " & $self.txPriorityFee
@ -197,6 +244,7 @@ QtObject:
result &= "\napprovalAmountRequired: " & $self.approvalAmountRequired
result &= "\napprovalContractAddress: " & $self.approvalContractAddress
result &= "\napprovalTxNonce: " & $self.approvalTxNonce
result &= "\napprovalGasFeeMode: " & $self.approvalGasFeeMode
result &= "\napprovalMaxFeesPerGas: " & $self.approvalMaxFeesPerGas
result &= "\napprovalBaseFee: " & $self.approvalBaseFee
result &= "\napprovalPriorityFee: " & $self.approvalPriorityFee
@ -233,12 +281,21 @@ QtObject:
proc suggestedMaxFeesPerGasLowLevel*(self: PathItem): string =
return self.suggestedMaxFeesPerGasLowLevel
proc suggestedPriorityFeePerGasLowLevel*(self: PathItem): string =
return self.suggestedPriorityFeePerGasLowLevel
proc suggestedMaxFeesPerGasMediumLevel*(self: PathItem): string =
return self.suggestedMaxFeesPerGasMediumLevel
proc suggestedPriorityFeePerGasMediumLevel*(self: PathItem): string =
return self.suggestedPriorityFeePerGasMediumLevel
proc suggestedMaxFeesPerGasHighLevel*(self: PathItem): string =
return self.suggestedMaxFeesPerGasHighLevel
proc suggestedPriorityFeePerGasHighLevel*(self: PathItem): string =
return self.suggestedPriorityFeePerGasHighLevel
proc suggestedMinPriorityFee*(self: PathItem): string =
return self.suggestedMinPriorityFee
@ -248,9 +305,24 @@ QtObject:
proc currentBaseFee*(self: PathItem): string =
return self.currentBaseFee
proc suggestedTxNonce*(self: PathItem): string =
return self.suggestedTxNonce
proc suggestedTxGasAmount*(self: PathItem): string =
return self.suggestedTxGasAmount
proc suggestedApprovalTxNonce*(self: PathItem): string =
return self.suggestedApprovalTxNonce
proc suggestedApprovalGasAmount*(self: PathItem): string =
return self.suggestedApprovalGasAmount
proc txNonce*(self: PathItem): string =
return self.txNonce
proc txGasFeeMode*(self: PathItem): int =
return self.txGasFeeMode
proc txMaxFeesPerGas*(self: PathItem): string =
return self.txMaxFeesPerGas
@ -293,6 +365,9 @@ QtObject:
proc approvalTxNonce*(self: PathItem): string =
return self.approvalTxNonce
proc approvalGasFeeMode*(self: PathItem): int =
return self.approvalGasFeeMode
proc approvalMaxFeesPerGas*(self: PathItem): string =
return self.approvalMaxFeesPerGas

View File

@ -16,12 +16,20 @@ type
AmountInLocked,
AmountOut,
SuggestedMaxFeesPerGasLowLevel,
SuggestedPriorityFeePerGasLowLevel,
SuggestedMaxFeesPerGasMediumLevel,
SuggestedPriorityFeePerGasMediumLevel,
SuggestedMaxFeesPerGasHighLevel,
SuggestedPriorityFeePerGasHighLevel,
SuggestedMinPriorityFee,
SuggestedMaxPriorityFee,
CurrentBaseFee,
SuggestedTxNonce,
SuggestedTxGasAmount,
SuggestedApprovalTxNonce,
SuggestedApprovalGasAmount,
TxNonce,
TxGasFeeMode,
TxMaxFeesPerGas,
TxBaseFee,
TxPriorityFee,
@ -36,6 +44,7 @@ type
ApprovalAmountRequired,
ApprovalContractAddress,
ApprovalTxNonce,
ApprovalGasFeeMode,
ApprovalMaxFeesPerGas,
ApprovalBaseFee,
ApprovalPriorityFee,
@ -80,12 +89,20 @@ QtObject:
ModelRole.AmountInLocked.int: "amountInLocked",
ModelRole.AmountOut.int: "amountOut",
ModelRole.SuggestedMaxFeesPerGasLowLevel.int: "suggestedMaxFeesPerGasLowLevel",
ModelRole.SuggestedPriorityFeePerGasLowLevel.int: "suggestedPriorityFeePerGasLowLevel",
ModelRole.SuggestedMaxFeesPerGasMediumLevel.int: "suggestedMaxFeesPerGasMediumLevel",
ModelRole.SuggestedPriorityFeePerGasMediumLevel.int: "suggestedPriorityFeePerGasMediumLevel",
ModelRole.SuggestedMaxFeesPerGasHighLevel.int: "suggestedMaxFeesPerGasHighLevel",
ModelRole.SuggestedPriorityFeePerGasHighLevel.int: "suggestedPriorityFeePerGasHighLevel",
ModelRole.SuggestedMinPriorityFee.int: "suggestedMinPriorityFee",
ModelRole.SuggestedMaxPriorityFee.int: "suggestedMaxPriorityFee",
ModelRole.CurrentBaseFee.int: "currentBaseFee",
ModelRole.SuggestedTxNonce.int: "suggestedTxNonce",
ModelRole.SuggestedTxGasAmount.int: "suggestedTxGasAmount",
ModelRole.SuggestedApprovalTxNonce.int: "suggestedApprovalTxNonce",
ModelRole.SuggestedApprovalGasAmount.int: "suggestedApprovalGasAmount",
ModelRole.TxNonce.int: "txNonce",
ModelRole.TxGasFeeMode.int: "txGasFeeMode",
ModelRole.TxMaxFeesPerGas.int: "txMaxFeesPerGas",
ModelRole.TxBaseFee.int: "txBaseFee",
ModelRole.TxPriorityFee.int: "txPriorityFee",
@ -100,6 +117,7 @@ QtObject:
ModelRole.ApprovalAmountRequired.int: "approvalAmountRequired",
ModelRole.ApprovalContractAddress.int: "approvalContractAddress",
ModelRole.ApprovalTxNonce.int: "approvalTxNonce",
ModelRole.ApprovalGasFeeMode.int: "approvalGasFeeMode",
ModelRole.ApprovalMaxFeesPerGas.int: "approvalMaxFeesPerGas",
ModelRole.ApprovalBaseFee.int: "approvalBaseFee",
ModelRole.ApprovalPriorityFee.int: "approvalPriorityFee",
@ -146,18 +164,34 @@ QtObject:
result = newQVariant(item.amountOut)
of ModelRole.SuggestedMaxFeesPerGasLowLevel:
result = newQVariant(item.suggestedMaxFeesPerGasLowLevel)
of ModelRole.SuggestedPriorityFeePerGasLowLevel:
result = newQVariant(item.suggestedPriorityFeePerGasLowLevel)
of ModelRole.SuggestedMaxFeesPerGasMediumLevel:
result = newQVariant(item.suggestedMaxFeesPerGasMediumLevel)
of ModelRole.SuggestedPriorityFeePerGasMediumLevel:
result = newQVariant(item.suggestedPriorityFeePerGasMediumLevel)
of ModelRole.SuggestedMaxFeesPerGasHighLevel:
result = newQVariant(item.suggestedMaxFeesPerGasHighLevel)
of ModelRole.SuggestedPriorityFeePerGasHighLevel:
result = newQVariant(item.suggestedPriorityFeePerGasHighLevel)
of ModelRole.SuggestedMinPriorityFee:
result = newQVariant(item.suggestedMinPriorityFee)
of ModelRole.SuggestedMaxPriorityFee:
result = newQVariant(item.suggestedMaxPriorityFee)
of ModelRole.CurrentBaseFee:
result = newQVariant(item.currentBaseFee)
of ModelRole.SuggestedTxNonce:
result = newQVariant(item.suggestedTxNonce)
of ModelRole.SuggestedTxGasAmount:
result = newQVariant(item.suggestedTxGasAmount)
of ModelRole.SuggestedApprovalTxNonce:
result = newQVariant(item.suggestedApprovalTxNonce)
of ModelRole.SuggestedApprovalGasAmount:
result = newQVariant(item.suggestedApprovalGasAmount)
of ModelRole.TxNonce:
result = newQVariant(item.txNonce)
of ModelRole.TxGasFeeMode:
result = newQVariant(item.txGasFeeMode)
of ModelRole.TxMaxFeesPerGas:
result = newQVariant(item.txMaxFeesPerGas)
of ModelRole.TxBaseFee:
@ -186,6 +220,8 @@ QtObject:
result = newQVariant(item.approvalContractAddress)
of ModelRole.ApprovalTxNonce:
result = newQVariant(item.approvalTxNonce)
of ModelRole.ApprovalGasFeeMode:
result = newQVariant(item.approvalGasFeeMode)
of ModelRole.ApprovalMaxFeesPerGas:
result = newQVariant(item.approvalMaxFeesPerGas)
of ModelRole.ApprovalBaseFee:

View File

@ -74,7 +74,8 @@ QtObject:
proc authenticateAndTransfer*(self: View, uuid: string, fromAddr: string, slippagePercentageString: string) {.slot.} =
var slippagePercentage: float
try:
slippagePercentage = slippagePercentageString.parseFloat()
if slippagePercentageString.len > 0:
slippagePercentage = slippagePercentageString.parseFloat()
except:
error "parsing slippage failed", slippage=slippagePercentageString
self.delegate.authenticateAndTransfer(uuid, fromAddr, slippagePercentage)
@ -90,3 +91,12 @@ QtObject:
proc transactionSent*(self: View, uuid: string, chainId: int, approvalTx: bool, txHash: string, error: string) {.signal.}
proc sendTransactionSentSignal*(self: View, uuid: string, chainId: int, approvalTx: bool, txHash: string, error: string) =
self.transactionSent(uuid, chainId, approvalTx, txHash, error)
proc setFeeMode*(self: View, feeMode: int, routerInputParamsUuid: string, pathName: string, chainId: int,
isApprovalTx: bool, communityId: string) {.slot.} =
self.delegate.setFeeMode(feeMode, routerInputParamsUuid, pathName, chainId, isApprovalTx, communityId)
proc setCustomTxDetails*(self: View, nonce: int, gasAmount: int, maxFeesPerGas: string, priorityFee: string,
routerInputParamsUuid: string, pathName: string, chainId: int, isApprovalTx: bool, communityId: string) {.slot.} =
self.delegate.setCustomTxDetails(nonce, gasAmount, maxFeesPerGas, priorityFee, routerInputParamsUuid, pathName,
chainId, isApprovalTx, communityId)

View File

@ -16,8 +16,11 @@ import backend/network_types, ../token/dto
type
SuggestedLevelsForMaxFeesPerGasDto* = ref object
low*: UInt256
lowPriority*: UInt256
medium*: UInt256
mediumPriority*: UInt256
high*: UInt256
highPriority*: UInt256
type
TransactionPathDtoV2* = ref object
@ -36,9 +39,14 @@ type
suggestedMinPriorityFee*: UInt256
suggestedMaxPriorityFee*: UInt256
currentBaseFee*: UInt256
suggestedTxNonce*: UInt256
suggestedTxGasAmount*: uint64
suggestedApprovalTxNonce*: UInt256
suggestedApprovalGasAmount*: uint64
usedContractAddress*: string
txNonce*: UInt256
txGasFeeMode*: int
txMaxFeesPerGas*: UInt256
txBaseFee*: UInt256
txPriorityFee*: UInt256
@ -54,6 +62,7 @@ type
approvalAmountRequired*: UInt256
approvalContractAddress*: string
approvalTxNonce*: UInt256
approvalGasFeeMode*: int
approvalMaxFeesPerGas*: UInt256
approvalBaseFee*: UInt256
approvalPriorityFee*: UInt256
@ -70,10 +79,16 @@ proc toSuggestedLevelsForMaxFeesPerGasDto*(jsonObj: JsonNode): SuggestedLevelsFo
var value: string
if jsonObj.getProp("low", value):
result.low = stint.fromHex(UInt256, $value)
if jsonObj.getProp("lowPriority", value):
result.lowPriority = stint.fromHex(UInt256, $value)
if jsonObj.getProp("medium", value):
result.medium = stint.fromHex(UInt256, $value)
if jsonObj.getProp("mediumPriority", value):
result.mediumPriority = stint.fromHex(UInt256, $value)
if jsonObj.getProp("high", value):
result.high = stint.fromHex(UInt256, $value)
if jsonObj.getProp("highPriority", value):
result.highPriority = stint.fromHex(UInt256, $value)
proc toTransactionPathDtoV2*(jsonObj: JsonNode): TransactionPathDtoV2 =
result = TransactionPathDtoV2()
@ -91,8 +106,13 @@ proc toTransactionPathDtoV2*(jsonObj: JsonNode): TransactionPathDtoV2 =
result.suggestedMinPriorityFee = stint.fromHex(UInt256, jsonObj{"SuggestedMinPriorityFee"}.getStr)
result.suggestedMaxPriorityFee = stint.fromHex(UInt256, jsonObj{"SuggestedMaxPriorityFee"}.getStr)
result.currentBaseFee = stint.fromHex(UInt256, jsonObj{"CurrentBaseFee"}.getStr)
result.suggestedTxNonce = stint.fromHex(UInt256, jsonObj{"SuggestedTxNonce"}.getStr)
discard jsonObj.getProp("SuggestedTxGasAmount", result.suggestedTxGasAmount)
result.suggestedApprovalTxNonce = stint.fromHex(UInt256, jsonObj{"SuggestedApprovalTxNonce"}.getStr)
discard jsonObj.getProp("SuggestedApprovalGasAmount", result.suggestedApprovalGasAmount)
discard jsonObj.getProp("UsedContractAddress", result.usedContractAddress)
result.txNonce = stint.fromHex(UInt256, jsonObj{"TxNonce"}.getStr)
discard jsonObj.getProp("TxGasFeeMode", result.txGasFeeMode)
result.txMaxFeesPerGas = stint.fromHex(UInt256, jsonObj{"TxMaxFeesPerGas"}.getStr)
result.txBaseFee = stint.fromHex(UInt256, jsonObj{"TxBaseFee"}.getStr)
result.txPriorityFee = stint.fromHex(UInt256, jsonObj{"TxPriorityFee"}.getStr)
@ -106,6 +126,7 @@ proc toTransactionPathDtoV2*(jsonObj: JsonNode): TransactionPathDtoV2 =
result.approvalAmountRequired = stint.fromHex(UInt256, jsonObj{"ApprovalAmountRequired"}.getStr)
discard jsonObj.getProp("ApprovalContractAddress", result.approvalContractAddress)
result.approvalTxNonce = stint.fromHex(UInt256, jsonObj{"ApprovalTxNonce"}.getStr)
discard jsonObj.getProp("ApprovalGasFeeMode", result.approvalGasFeeMode)
result.approvalMaxFeesPerGas = stint.fromHex(UInt256, jsonObj{"ApprovalMaxFeesPerGas"}.getStr)
result.approvalBaseFee = stint.fromHex(UInt256, jsonObj{"ApprovalBaseFee"}.getStr)
result.approvalPriorityFee = stint.fromHex(UInt256, jsonObj{"ApprovalPriorityFee"}.getStr)

View File

@ -282,7 +282,7 @@ QtObject:
transactionType = parseEnum[PendingTransactionTypeDto](watchTxResult["trxType"].getStr)
except:
discard
self.events.emit(transactionType.event, ev)
transactions.checkRecentHistory(@[chainId], @[address])
@ -484,6 +484,33 @@ QtObject:
except CatchableError as e:
error "stopSuggestedRoutesAsyncCalculation", exception=e.msg
proc setFeeMode*(self: Service, feeMode: int, routerInputParamsUuid: string, pathName: string, chainId: int,
isApprovalTx: bool, communityId: string): string =
try:
let err = wallet.setFeeMode(feeMode, routerInputParamsUuid, pathName, chainId, isApprovalTx, communityId)
if err.len > 0:
raise newException(CatchableError, err)
except CatchableError as e:
error "setFeeMode", exception=e.msg
return e.msg
proc setCustomTxDetails*(self: Service, nonce: int, gasAmount: int, maxFeesPerGas: string, priorityFee: string,
routerInputParamsUuid: string, pathName: string, chainId: int, isApprovalTx: bool, communityId: string): string =
try:
let
bigMaxFeesPerGas = common_utils.stringToUint256(maxFeesPerGas)
bigPriorityFee = common_utils.stringToUint256(priorityFee)
maxFeesPerGasHex = "0x" & eth_utils.stripLeadingZeros(bigMaxFeesPerGas.toHex)
priorityFeeHex = "0x" & eth_utils.stripLeadingZeros(bigPriorityFee.toHex)
let err = wallet.setCustomTxDetails(nonce, gasAmount, maxFeesPerGasHex, priorityFeeHex, routerInputParamsUuid, pathName,
chainId, isApprovalTx, communityId)
if err.len > 0:
raise newException(CatchableError, err)
except CatchableError as e:
error "setCustomTxDetails", exception=e.msg
return e.msg
proc getEstimatedTime*(self: Service, chainId: int, maxFeePerGas: string): EstimatedTime =
try:
let response = backend.getTransactionEstimatedTime(chainId, maxFeePerGas).result.getInt

View File

@ -13,6 +13,7 @@ const
GasFeeLow* = 0
GasFeeMedium* = 1
GasFeeHigh* = 2
GasFeeCustom* = 3
const
ExtraKeyUsername* = "username"
@ -148,7 +149,7 @@ proc prepareDataForSuggestedRoutes(
"toTokenID": toToken,
"disabledFromChainIDs": disabledFromChainIDs,
"disabledToChainIDs": disabledToChainIDs,
"gasFeeMode": GasFeeMedium,
"gasFeeMode": GasFeeLow,
"fromLockedAmount": lockedInAmounts,
"communityRouteInputParams": communityRouteInputParameters,
}
@ -202,5 +203,68 @@ proc suggestedRoutesAsyncForCommunities*(uuid: string, sendType: int, accountFro
proc stopSuggestedRoutesAsyncCalculation*(): string {.raises: [RpcException].} =
let rpcResponse = core.callPrivateRPC("wallet_stopSuggestedRoutesAsyncCalculation")
if isErrorResponse(rpcResponse):
return rpcResponse.error.message
## Sets the fee mode for the provided path (should not be user for custom fee mode)
## `feeMode` is the fee mode to set for the path, corresponds to the status go `fees.GasFeeMode` type (0: GasFeeLow, 1: GasFeeMedium, 2: GasFeeHigh and 3: GasFeeCustom)
## `routerInputParamsUuid` is the uuid of the router input params
## `pathName` is the name of the path
## `chainId` is the chain id of the network
## `isApprovalTx` is a flag that indicates if the tx is an approval tx - optional
## `communityId` is the id of the community - optional
## returns the error message if any, or an empty string
proc setFeeMode*(feeMode: int, routerInputParamsUuid: string, pathName: string, chainId: int, isApprovalTx: bool = false,
communityId: string = ""): string {.raises: [RpcException].} =
var pathTxIdentity = %* {
"routerInputParamsUuid": routerInputParamsUuid,
"pathName": pathName,
"chainID": chainId,
}
if isApprovalTx:
pathTxIdentity["isApprovalTx"] = %* true
if communityId != "":
pathTxIdentity["communityID"] = %* communityId
let payload = %* [pathTxIdentity, feeMode]
let rpcResponse = core.callPrivateRPC("wallet_setFeeMode", payload)
if isErrorResponse(rpcResponse):
return rpcResponse.error.message
## Sets the fee mode for the provided path (should not be user for any but the custom fee mode)
## `nonce` is the nonce of the tx
## `gasAmount` is the gas amount of the tx
## `maxFeesPerGas` is the max fees per gas of the tx
## `priorityFee` is the priority fee of the tx
## `routerInputParamsUuid` is the uuid of the router input params
## `pathName` is the name of the path
## `chainId` is the chain id of the network
## `isApprovalTx` is a flag that indicates if the tx is an approval tx - optional
## `communityId` is the id of the community - optional
## returns the error message if any, or an empty string
proc setCustomTxDetails*(nonce: int, gasAmount: int, maxFeesPerGas: string, priorityFee: string,
routerInputParamsUuid: string, pathName: string, chainId: int, isApprovalTx: bool = false,
communityId: string = ""): string {.raises: [RpcException].} =
let pathTxCustomParams = %* {
"gasFeeMode": GasFeeCustom,
"nonce": nonce,
"gasAmount": gasAmount,
"maxFeesPerGas": maxFeesPerGas,
"priorityFee": priorityFee,
}
var pathTxIdentity = %* {
"routerInputParamsUuid": routerInputParamsUuid,
"pathName": pathName,
"chainID": chainId,
}
if isApprovalTx:
pathTxIdentity["isApprovalTx"] = %* true
if communityId != "":
pathTxIdentity["communityID"] = %* communityId
let payload = %* [pathTxIdentity, pathTxCustomParams]
let rpcResponse = core.callPrivateRPC("wallet_setCustomTxDetails", payload)
if isErrorResponse(rpcResponse):
return rpcResponse.error.message

View File

@ -7,6 +7,7 @@ import Models 1.0
import StatusQ.Core.Utils 0.1 as SQUtils
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import AppLayouts.Wallet.popups.simpleSend 1.0
@ -44,6 +45,36 @@ Item {
networkIconPath: Theme.svg("network/Network=Ethereum")
networkBlockExplorerUrl: "https://etherscan.io/"
currentBaseFee: "8.2"
currentSuggestedMinPriorityFee: "0.06"
currentSuggestedMaxPriorityFee: "5.1"
currentGasAmount: "31500"
currentNonce: 21
normalPrice: "1.45 EUR"
normalBaseFee: "10000"
normalPriorityFee: "1000"
normalTime: "~60s"
fastPrice: "1.65 EUR"
fastBaseFee: "100000"
fastPriorityFee: "10000"
fastTime: "~40s"
urgentPrice: "1.85 EUR"
urgentBaseFee: "1000000"
urgentPriorityFee: "100000"
urgentTime: "~15s"
customBaseFee: "10000"
customPriorityFee: "1000"
customGasAmount: "35000"
customNonce: 22
selectedFeeMode: StatusFeeOption.Type.Normal
fnGetPriceInCurrencyForFee: function(feeInWei) {
return "0.25 USD"
}
fiatFees: "1.54 EUR"
cryptoFees: "0.001 ETH"
estimatedTime: qsTr("> 5 minutes")

View File

@ -14,6 +14,13 @@ Rectangle {
property alias leftComponent: leftComponentLoader.sourceComponent
property bool internalPopupActive
property color internalOverlayColor
property int popupFullHeight
property Component internalPopupComponent
signal closeInternalPopup()
color: Theme.palette.statusModal.backgroundColor
radius: 8
@ -73,4 +80,29 @@ Rectangle {
samples: 37
color: Theme.palette.dropShadow
}
Rectangle {
id: internalOverlay
anchors.fill: parent
anchors.bottomMargin: -1 * root.popupFullHeight + root.height
visible: root.internalPopupActive
radius: root.radius
color: root.internalOverlayColor
MouseArea {
anchors.fill: parent
anchors.bottomMargin: popupLoader.height
onClicked: {
root.closeInternalPopup()
}
}
}
Loader {
id: popupLoader
anchors.bottom: parent.bottom
anchors.bottomMargin: internalOverlay.anchors.bottomMargin
active: root.internalPopupActive
sourceComponent: root.internalPopupComponent
}
}

View File

@ -281,6 +281,7 @@
<file>assets/img/icons/security.svg</file>
<file>assets/img/icons/seed-phrase.svg</file>
<file>assets/img/icons/send.svg</file>
<file>assets/img/icons/settings-advance.svg</file>
<file>assets/img/icons/settings-advanced.svg</file>
<file>assets/img/icons/settings.svg</file>
<file>assets/img/icons/share-android.svg</file>

View File

@ -0,0 +1,6 @@
<svg width="21" height="18" viewBox="0 0 21 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="Icon">
<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M4.25 1C4.25 0.585786 3.91421 0.25 3.5 0.25C3.08579 0.25 2.75 0.585786 2.75 1V1.67793C2.75 1.91298 2.5847 2.11267 2.3624 2.18903C0.987848 2.6612 0 3.96524 0 5.5C0 7.03476 0.987848 8.3388 2.3624 8.81097C2.5847 8.88733 2.75 9.08703 2.75 9.32207V17C2.75 17.4142 3.08579 17.75 3.5 17.75C3.91421 17.75 4.25 17.4142 4.25 17V9.32207C4.25 9.08703 4.4153 8.88733 4.6376 8.81097C6.01215 8.3388 7 7.03476 7 5.5C7 3.96524 6.01215 2.6612 4.6376 2.18903C4.4153 2.11267 4.25 1.91297 4.25 1.67793V1ZM3.5 7.5C4.60457 7.5 5.5 6.60457 5.5 5.5C5.5 4.39543 4.60457 3.5 3.5 3.5C2.39543 3.5 1.5 4.39543 1.5 5.5C1.5 6.60457 2.39543 7.5 3.5 7.5ZM18.25 1C18.25 0.585786 17.9142 0.25 17.5 0.25C17.0858 0.25 16.75 0.585786 16.75 1V1.67793C16.75 1.91298 16.5847 2.11267 16.3624 2.18903C14.9878 2.6612 14 3.96524 14 5.5C14 7.03476 14.9878 8.3388 16.3624 8.81097C16.5847 8.88733 16.75 9.08703 16.75 9.32207V17C16.75 17.4142 17.0858 17.75 17.5 17.75C17.9142 17.75 18.25 17.4142 18.25 17V9.32207C18.25 9.08703 18.4153 8.88733 18.6376 8.81097C20.0122 8.3388 21 7.03476 21 5.5C21 3.96524 20.0122 2.6612 18.6376 2.18903C18.4153 2.11267 18.25 1.91297 18.25 1.67793V1ZM17.5 7.5C18.6046 7.5 19.5 6.60457 19.5 5.5C19.5 4.39543 18.6046 3.5 17.5 3.5C16.3954 3.5 15.5 4.39543 15.5 5.5C15.5 6.60457 16.3954 7.5 17.5 7.5Z" fill="black"/>
<path id="Union_2" fill-rule="evenodd" clip-rule="evenodd" d="M10.5 0.25C10.9142 0.25 11.25 0.585786 11.25 1V7.67793C11.25 7.91298 11.4153 8.11267 11.6376 8.18903C13.0122 8.6612 14 9.96524 14 11.5C14 13.1493 12.8592 14.5321 11.3237 14.9025C11.2796 14.9132 11.25 14.9546 11.25 15V17C11.25 17.4142 10.9142 17.75 10.5 17.75C10.0858 17.75 9.75 17.4142 9.75 17V15C9.75 14.9546 9.72043 14.9132 9.6763 14.9025C8.14076 14.5321 7 13.1493 7 11.5C7 9.96524 7.98785 8.6612 9.3624 8.18903C9.5847 8.11267 9.75 7.91298 9.75 7.67793V1C9.75 0.585786 10.0858 0.25 10.5 0.25ZM12.5 11.5C12.5 12.6046 11.6046 13.5 10.5 13.5C9.39543 13.5 8.5 12.6046 8.5 11.5C8.5 10.3954 9.39543 9.5 10.5 9.5C11.6046 9.5 12.5 10.3954 12.5 11.5Z" fill="black"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -100,6 +100,12 @@ StatusDialog {
default property alias contents: contentsLayout.data
property bool internalPopupActive: false
property color internalOverlayColor: Theme.palette.backdropColor
property Component internalPopupComponent
signal closeInternalPopup()
width: 480
padding: 0
@ -117,6 +123,13 @@ StatusDialog {
actions.closeButton.onClicked: root.close()
leftComponent: root.headerIconComponent
internalPopupActive: root.internalPopupActive
internalOverlayColor: root.internalOverlayColor
popupFullHeight: root.height
internalPopupComponent: root.internalPopupComponent
onCloseInternalPopup: root.closeInternalPopup()
}
footer: StatusDialogFooter {

View File

@ -9,6 +9,7 @@ import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import AppLayouts.Wallet.panels 1.0
import AppLayouts.Wallet.views 1.0
import AppLayouts.Wallet.popups 1.0
import utils 1.0
@ -81,6 +82,52 @@ SignTransactionModalBase {
/** Input property holding function openSea explorer url for the collectible **/
required property var fnGetOpenSeaExplorerUrl
/** Transaction settings related parameters **/
required property int selectedFeeMode
required property string currentBaseFee
required property string currentSuggestedMinPriorityFee
required property string currentSuggestedMaxPriorityFee
required property string currentGasAmount
required property int currentNonce
required property string normalPrice
required property string normalBaseFee
required property string normalPriorityFee
required property string normalTime
required property string fastPrice
required property string fastTime
required property string fastBaseFee
required property string fastPriorityFee
required property string urgentPrice
required property string urgentTime
required property string urgentBaseFee
required property string urgentPriorityFee
required property string customBaseFee
required property string customPriorityFee
required property string customGasAmount
required property int customNonce
/** required function which receives fee in wei and recalculate it currency selected currency and format to locale string **/
required property var fnGetPriceInCurrencyForFee
/** Signal to updated tx settings **/
signal updateTxSettings(int selectedFeeMode, string customNonce, string customGasAmount, string maxFeesPerGas, string priorityFee)
/** Recalculates all values currently displayed in the transaction settings panel **/
function refreshTxSettings() {
d.refreshTxSettings()
}
QtObject {
id: d
signal refreshTxSettings()
}
title: qsTr("Sign Send")
//: e.g. (Send) 100 DAI to batista.eth
subtitle: {
@ -173,9 +220,124 @@ SignTransactionModalBase {
loading: root.feesLoading
}
}
StatusFlatButton {
tooltip.text: qsTr("Edit transaction settings")
icon.name: "settings-advance"
textColor: hovered? Theme.palette.directColor1 : Theme.palette.baseColor1
onClicked: {
root.internalPopupActive = true
}
}
}
}
property Component internalPopup: TransactionSettings {
fnGetPriceInCurrencyForFee: root.fnGetPriceInCurrencyForFee
selectedFeeMode: root.selectedFeeMode
currentBaseFee: root.currentBaseFee
currentSuggestedMinPriorityFee: root.currentSuggestedMinPriorityFee
currentSuggestedMaxPriorityFee: root.currentSuggestedMaxPriorityFee
currentGasAmount: root.currentGasAmount
currentNonce: root.currentNonce
normalPrice: root.normalPrice
normalTime: root.normalTime
fastPrice: root.fastPrice
fastTime: root.fastTime
urgentPrice: root.urgentPrice
urgentTime: root.urgentTime
function updateCustomFields() {
// by default custom follows normal fee option
if (selectedFeeMode !== StatusFeeOption.Type.Custom) {
customBaseFee = ""
customPriorityFee = ""
customGasAmount = ""
customNonce = ""
return
}
if (!customBaseFeeDirty) {
if (selectedFeeMode === root.selectedFeeMode) {
customBaseFee = !!root.customBaseFee? Utils.weiToGWei(root.customBaseFee).toFixed() : "0"
} else {
customBaseFee = Utils.weiToGWei(root.normalBaseFee).toFixed()
}
customBaseFeeDirty = false
}
if (!customPriorityFeeDirty) {
if (selectedFeeMode === root.selectedFeeMode) {
customPriorityFee = !!root.customPriorityFee? Utils.weiToGWei(root.customPriorityFee).toFixed() : "0"
} else {
customPriorityFee = Utils.weiToGWei(root.normalPriorityFee).toFixed()
}
customPriorityFeeDirty = false
}
if (!customGasAmountDirty) {
if (selectedFeeMode === root.selectedFeeMode) {
customGasAmount = root.customGasAmount
} else {
customGasAmount = root.currentGasAmount
}
customGasAmountDirty = false
}
if (!customNonceDirty) {
if (selectedFeeMode === root.selectedFeeMode) {
customNonce = root.customNonce
} else {
customNonce = root.currentNonce
}
customNonceDirty = false
}
}
Component.onCompleted: {
d.refreshTxSettings.connect(updateCustomFields)
if (root.selectedFeeMode === StatusFeeOption.Type.Custom) {
updateCustomFields()
recalculateCustomPrice()
}
}
onSelectedFeeModeChanged: {
updateCustomFields()
}
onCancelClicked: {
root.internalPopupActive = false
}
onConfirmClicked: {
let priorityFee = ""
let maxFeesPerGas = ""
if (selectedFeeMode === StatusFeeOption.Type.Custom) {
if (!!customPriorityFee && !!customBaseFee) {
const baseFeeWei = Utils.gweiToWei(customBaseFee)
const priorityFeeWei = Utils.gweiToWei(customPriorityFee)
priorityFee = priorityFeeWei.toFixed()
maxFeesPerGas = SQUtils.AmountsArithmetic.sum(baseFeeWei, priorityFeeWei).toFixed()
}
}
root.updateTxSettings(selectedFeeMode, customNonce, customGasAmount, maxFeesPerGas, priorityFee)
root.internalPopupActive = false
}
}
internalPopupComponent: internalPopup
onCloseInternalPopup: {
root.internalPopupActive = false
}
// Send Asset
SignInfoBox {
objectName: "sendAssetBox"
@ -203,6 +365,7 @@ SignTransactionModalBase {
}
]
visible: !root.isCollectible
enabled: !root.internalPopupActive
}
// Send Collectible
@ -229,6 +392,7 @@ SignTransactionModalBase {
onOpenLink: (link) => root.openLinkWithConfirmation(link)
}
visible: root.isCollectible
enabled: !root.internalPopupActive
}
// From
@ -268,6 +432,7 @@ SignTransactionModalBase {
onOpenLink: (link) => root.openLinkWithConfirmation(link)
}
]
enabled: !root.internalPopupActive
}
// Network

View File

@ -25,6 +25,14 @@ QtObject {
_walletSectionSendInst.stopUpdatesForSuggestedRoute()
}
function setFeeMode(feeMode, routerInputParamsUuid, pathName, chainId, isApprovalTx, communityId) {
_walletSectionSendInst.setFeeMode(feeMode, routerInputParamsUuid, pathName, chainId, isApprovalTx, communityId)
}
function setCustomTxDetails(nonce, gasAmount, maxFeesPerGas, priorityFee, routerInputParamsUuid, pathName, chainId, isApprovalTx, communityId) {
_walletSectionSendInst.setCustomTxDetails(nonce, gasAmount, maxFeesPerGas, priorityFee, routerInputParamsUuid, pathName, chainId, isApprovalTx, communityId)
}
Component.onCompleted: {
_walletSectionSendInst.suggestedRoutesReady.connect(suggestedRoutesReady)
_walletSectionSendInst.transactionSent.connect(transactionSent)

View File

@ -7,6 +7,7 @@ import StatusQ 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1 as SQUtils
import StatusQ.Controls 0.1
import AppLayouts.Wallet.stores 1.0 as WalletStores
import AppLayouts.Wallet.popups.simpleSend 1.0
@ -470,7 +471,7 @@ QtObject {
}
if(isValidParameter(root.simpleSendParams.stickersPackId)) {
stickersPackId = root.simpleSendParams.stickersPackId
}
}
if(isValidParameter(root.simpleSendParams.transferOwnership)) {
transferOwnership = root.simpleSendParams.transferOwnership
}
@ -564,6 +565,8 @@ QtObject {
property string uuid
property var fetchedPathModel
signal refreshTxSettings()
readonly property string extraParamsJson: {
if (!!simpleSendModal.stickersPackId) {
return JSON.stringify({[Constants.suggestedRoutesExtraParamsProperties.packId]: simpleSendModal.stickersPackId})
@ -611,6 +614,7 @@ QtObject {
simpleSendModal.routerErrorDetails = "%1 - %2".arg(errCode).arg(
WalletUtils.getRouterErrorDetailsOnCode(errCode, errDescription))
fetchedPathModel = pathModel
handler.refreshTxSettings()
}
function transactionSent(returnedUuid, chainId, approvalTx, txHash, error) {
@ -817,18 +821,163 @@ QtObject {
networkIconPath: Theme.svg(signSendAdaptor.selectedNetwork.iconUrl)
networkBlockExplorerUrl: signSendAdaptor.selectedNetwork.blockExplorerURL
readonly property var totalFeesEth: {
let tatlFeeInWei = "0"
selectedFeeMode: {
if (!!txPathUnderReviewEntry.item) {
if (handler.reviewApprovalForTxPathUnderReview) {
tatlFeeInWei = SQUtils.AmountsArithmetic.sum(SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.approvalFee),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.approvalL1Fee))
return txPathUnderReviewEntry.item.approvalGasFeeMode
}
return txPathUnderReviewEntry.item.txGasFeeMode
}
return StatusFeeOption.Type.Normal
}
currentBaseFee: !!txPathUnderReviewEntry.item? txPathUnderReviewEntry.item.currentBaseFee : ""
currentSuggestedMinPriorityFee: !!txPathUnderReviewEntry.item? txPathUnderReviewEntry.item.suggestedMinPriorityFee : ""
currentSuggestedMaxPriorityFee: !!txPathUnderReviewEntry.item? txPathUnderReviewEntry.item.suggestedMaxPriorityFee : ""
currentGasAmount: {
if (!!txPathUnderReviewEntry.item) {
if (handler.reviewApprovalForTxPathUnderReview) {
return txPathUnderReviewEntry.item.suggestedApprovalGasAmount
}
return txPathUnderReviewEntry.item.suggestedTxGasAmount
}
return ""
}
currentNonce: {
if (!!txPathUnderReviewEntry.item) {
if (handler.reviewApprovalForTxPathUnderReview) {
return txPathUnderReviewEntry.item.suggestedApprovalTxNonce
}
return txPathUnderReviewEntry.item.suggestedTxNonce
}
return 0
}
fnGetPriceInCurrencyForFee: function(feeInWei) {
if (!feeInWei) {
return ""
}
const feesEth = Utils.weiToEth(feeInWei)
const ethToken = SQUtils.ModelUtils.getByKey(root.plainTokensBySymbolModel, "key", Constants.ethToken)
const ethFiatValue = !!ethToken ? ethToken.marketDetails.currencyPrice.amount: 1
return root.fnFormatCurrencyAmount(ethFiatValue*feesEth, root.currentCurrency).toString()
}
normalPrice: {
if (!!txPathUnderReviewEntry.item) {
if (handler.reviewApprovalForTxPathUnderReview) {
const feeInWei = SQUtils.AmountsArithmetic.times(
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedMaxFeesPerGasLowLevel),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.approvalGasAmount)).toFixed()
return fnGetPriceInCurrencyForFee(feeInWei)
}
const feeInWei = SQUtils.AmountsArithmetic.times(
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedMaxFeesPerGasLowLevel),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.txGasAmount)).toFixed()
return fnGetPriceInCurrencyForFee(feeInWei)
}
return ""
}
normalBaseFee: !!txPathUnderReviewEntry.item?
SQUtils.AmountsArithmetic.sub(SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedMaxFeesPerGasLowLevel),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedPriorityFeePerGasLowLevel)).toFixed()
: ""
normalPriorityFee: !!txPathUnderReviewEntry.item? txPathUnderReviewEntry.item.suggestedPriorityFeePerGasLowLevel : ""
normalTime: "~60s" // TODO: update this when we figure out how to estimate time more granularly
fastPrice: {
if (!!txPathUnderReviewEntry.item) {
if (handler.reviewApprovalForTxPathUnderReview) {
const feeInWei = SQUtils.AmountsArithmetic.times(
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedMaxFeesPerGasMediumLevel),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.approvalGasAmount)).toFixed()
return fnGetPriceInCurrencyForFee(feeInWei)
}
const feeInWei = SQUtils.AmountsArithmetic.times(
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedMaxFeesPerGasMediumLevel),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.txGasAmount)).toFixed()
return fnGetPriceInCurrencyForFee(feeInWei)
}
return ""
}
fastBaseFee: !!txPathUnderReviewEntry.item?
SQUtils.AmountsArithmetic.sub(SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedMaxFeesPerGasMediumLevel),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedPriorityFeePerGasMediumLevel)).toFixed()
: ""
fastPriorityFee: !!txPathUnderReviewEntry.item? txPathUnderReviewEntry.item.suggestedPriorityFeePerGasMediumLevel : ""
fastTime: "~40s" // TODO: update this when we figure out how to estimate time more granularly
urgentPrice: {
if (!!txPathUnderReviewEntry.item) {
if (handler.reviewApprovalForTxPathUnderReview) {
const feeInWei = SQUtils.AmountsArithmetic.times(
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedMaxFeesPerGasHighLevel),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.approvalGasAmount)).toFixed()
return fnGetPriceInCurrencyForFee(feeInWei)
}
const feeInWei = SQUtils.AmountsArithmetic.times(
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedMaxFeesPerGasHighLevel),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.txGasAmount)).toFixed()
return fnGetPriceInCurrencyForFee(feeInWei)
}
return ""
}
urgentBaseFee: !!txPathUnderReviewEntry.item?
SQUtils.AmountsArithmetic.sub(SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedMaxFeesPerGasHighLevel),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.suggestedPriorityFeePerGasHighLevel)).toFixed()
: ""
urgentPriorityFee: !!txPathUnderReviewEntry.item? txPathUnderReviewEntry.item.suggestedPriorityFeePerGasHighLevel : ""
urgentTime: "~15s" // TODO: update this when we figure out how to estimate time more granularly
customBaseFee: {
if (!!txPathUnderReviewEntry.item) {
if (handler.reviewApprovalForTxPathUnderReview) {
return txPathUnderReviewEntry.item.approvalBaseFee
}
return txPathUnderReviewEntry.item.txBaseFee
}
return ""
}
customPriorityFee: {
if (!!txPathUnderReviewEntry.item) {
if (handler.reviewApprovalForTxPathUnderReview) {
return txPathUnderReviewEntry.item.approvalPriorityFee
}
return txPathUnderReviewEntry.item.txPriorityFee
}
return ""
}
customGasAmount: {
if (!!txPathUnderReviewEntry.item) {
if (handler.reviewApprovalForTxPathUnderReview) {
return txPathUnderReviewEntry.item.approvalGasAmount
}
return txPathUnderReviewEntry.item.txGasAmount
}
return ""
}
customNonce: {
if (!!txPathUnderReviewEntry.item) {
if (handler.reviewApprovalForTxPathUnderReview) {
return txPathUnderReviewEntry.item.approvalTxNonce
}
return txPathUnderReviewEntry.item.txNonce
}
return ""
}
readonly property var totalFeesEth: {
let totalFeeInWei = "0"
if (!!txPathUnderReviewEntry.item) {
if (handler.reviewApprovalForTxPathUnderReview) {
totalFeeInWei = SQUtils.AmountsArithmetic.sum(SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.approvalFee),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.approvalL1Fee)).toFixed()
} else {
tatlFeeInWei = SQUtils.AmountsArithmetic.sum(SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.txFee),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.txL1Fee))
totalFeeInWei = SQUtils.AmountsArithmetic.sum(SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.txFee),
SQUtils.AmountsArithmetic.fromString(txPathUnderReviewEntry.item.txL1Fee)).toFixed()
}
}
return SQUtils.AmountsArithmetic.div(SQUtils.AmountsArithmetic.fromString(tatlFeeInWei), SQUtils.AmountsArithmetic.fromNumber(1, Constants.ethTokenDecimals))
return Utils.weiToEth(totalFeeInWei)
}
fiatFees: {
@ -865,11 +1014,46 @@ QtObject {
fnGetOpenSeaExplorerUrl: root.fnGetOpenSeaUrl
Component.onCompleted: {
handler.refreshTxSettings.connect(refreshTxSettings)
}
onOpened: handler.sendMetricsEvent("sign modal opened")
onRejected:{
handler.sendMetricsEvent("sign modal rejected")
handler.handleReject()
}
onUpdateTxSettings: {
let pathName = ""
let chainId = 0
if (!!txPathUnderReviewEntry.item) {
pathName = txPathUnderReviewEntry.item.processorName
chainId = txPathUnderReviewEntry.item.fromChain
}
if (selectedFeeMode === StatusFeeOption.Type.Custom) {
root.transactionStoreNew.setCustomTxDetails(customNonce,
customGasAmount,
maxFeesPerGas,
priorityFee,
handler.uuid,
pathName,
chainId,
handler.reviewApprovalForTxPathUnderReview,
"")
return
}
root.transactionStoreNew.setFeeMode(selectedFeeMode,
handler.uuid,
pathName,
chainId,
handler.reviewApprovalForTxPathUnderReview,
"")
}
onAccepted: {
handler.sendMetricsEvent("sign modal accepted")
if (handler.reviewingLastTxPath) {