mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-21 19:18:53 +00:00
feat(wallet): estimated time added to transaction settings
This commit is contained in:
parent
808ebe85e6
commit
fe1bae0a3a
@ -116,6 +116,9 @@ proc setCustomTxDetails*(self: Controller, nonce: int, gasAmount: int, maxFeesPe
|
||||
return self.transactionService.setCustomTxDetails(nonce, gasAmount, maxFeesPerGas, priorityFee, routerInputParamsUuid,
|
||||
pathName, chainId, isApprovalTx, communityId)
|
||||
|
||||
proc getEstimatedTime*(self: Controller, chainId: int, maxFeesPerGas: string, priorityFee: string): int =
|
||||
self.transactionService.getEstimatedTimeV2(chainId, maxFeesPerGas, priorityFee)
|
||||
|
||||
proc getCurrentNetworks*(self: Controller): seq[NetworkItem] =
|
||||
return self.networkService.getCurrentNetworks()
|
||||
|
||||
|
@ -52,6 +52,9 @@ method setCustomTxDetails*(self: AccessInterface, nonce: int, gasAmount: int, ma
|
||||
routerInputParamsUuid: string, pathName: string, chainId: int, isApprovalTx: bool, communityId: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method getEstimatedTime*(self: AccessInterface, chainId: int, maxFeesPerGas: string, priorityFee: string): int {.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")
|
||||
|
||||
|
@ -118,10 +118,13 @@ proc convertTransactionPathDtoV2ToPathItem(self: Module, txPath: TransactionPath
|
||||
amountOut = $txPath.amountOut,
|
||||
suggestedMaxFeesPerGasLowLevel = $txPath.suggestedLevelsForMaxFeesPerGas.low,
|
||||
suggestedPriorityFeePerGasLowLevel = $txPath.suggestedLevelsForMaxFeesPerGas.lowPriority,
|
||||
suggestedEstimatedTimeLowLevel = txPath.suggestedLevelsForMaxFeesPerGas.lowEstimatedTime,
|
||||
suggestedMaxFeesPerGasMediumLevel = $txPath.suggestedLevelsForMaxFeesPerGas.medium,
|
||||
suggestedPriorityFeePerGasMediumLevel = $txPath.suggestedLevelsForMaxFeesPerGas.mediumPriority,
|
||||
suggestedEstimatedTimeMediumLevel = txPath.suggestedLevelsForMaxFeesPerGas.mediumEstimatedTime,
|
||||
suggestedMaxFeesPerGasHighLevel = $txPath.suggestedLevelsForMaxFeesPerGas.high,
|
||||
suggestedPriorityFeePerGasHighLevel = $txPath.suggestedLevelsForMaxFeesPerGas.highPriority,
|
||||
suggestedEstimatedTimeHighLevel = txPath.suggestedLevelsForMaxFeesPerGas.highEstimatedTime,
|
||||
suggestedMinPriorityFee = $txPath.suggestedMinPriorityFee,
|
||||
suggestedMaxPriorityFee = $txPath.suggestedMaxPriorityFee,
|
||||
currentBaseFee = $txPath.currentBaseFee,
|
||||
@ -341,4 +344,7 @@ method setCustomTxDetails*(self: Module, nonce: int, gasAmount: int, maxFeesPerG
|
||||
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)
|
||||
self.events.emit(SIGNAL_DISPLAY_APP_NOTIFICATION, data)
|
||||
|
||||
method getEstimatedTime*(self: Module, chainId: int, maxFeesPerGas: string, priorityFee: string): int =
|
||||
return self.controller.getEstimatedTime(chainId, maxFeesPerGas, priorityFee)
|
@ -14,10 +14,13 @@ QtObject:
|
||||
amountOut: string
|
||||
suggestedMaxFeesPerGasLowLevel: string
|
||||
suggestedPriorityFeePerGasLowLevel: string
|
||||
suggestedEstimatedTimeLowLevel: int
|
||||
suggestedMaxFeesPerGasMediumLevel: string
|
||||
suggestedPriorityFeePerGasMediumLevel: string
|
||||
suggestedEstimatedTimeMediumLevel: int
|
||||
suggestedMaxFeesPerGasHighLevel: string
|
||||
suggestedPriorityFeePerGasHighLevel: string
|
||||
suggestedEstimatedTimeHighLevel: int
|
||||
suggestedMinPriorityFee: string
|
||||
suggestedMaxPriorityFee: string
|
||||
currentBaseFee: string
|
||||
@ -61,10 +64,13 @@ QtObject:
|
||||
amountOut: string,
|
||||
suggestedMaxFeesPerGasLowLevel: string,
|
||||
suggestedPriorityFeePerGasLowLevel: string,
|
||||
suggestedEstimatedTimeLowLevel: int,
|
||||
suggestedMaxFeesPerGasMediumLevel: string,
|
||||
suggestedPriorityFeePerGasMediumLevel: string,
|
||||
suggestedEstimatedTimeMediumLevel: int,
|
||||
suggestedMaxFeesPerGasHighLevel: string,
|
||||
suggestedPriorityFeePerGasHighLevel: string,
|
||||
suggestedEstimatedTimeHighLevel: int,
|
||||
suggestedMinPriorityFee: string,
|
||||
suggestedMaxPriorityFee: string,
|
||||
currentBaseFee: string,
|
||||
@ -108,10 +114,13 @@ QtObject:
|
||||
self.amountOut = amountOut
|
||||
self.suggestedMaxFeesPerGasLowLevel = suggestedMaxFeesPerGasLowLevel
|
||||
self.suggestedPriorityFeePerGasLowLevel = suggestedPriorityFeePerGasLowLevel
|
||||
self.suggestedEstimatedTimeLowLevel = suggestedEstimatedTimeLowLevel
|
||||
self.suggestedMaxFeesPerGasMediumLevel = suggestedMaxFeesPerGasMediumLevel
|
||||
self.suggestedPriorityFeePerGasMediumLevel = suggestedPriorityFeePerGasMediumLevel
|
||||
self.suggestedEstimatedTimeMediumLevel = suggestedEstimatedTimeMediumLevel
|
||||
self.suggestedMaxFeesPerGasHighLevel = suggestedMaxFeesPerGasHighLevel
|
||||
self.suggestedPriorityFeePerGasHighLevel = suggestedPriorityFeePerGasHighLevel
|
||||
self.suggestedEstimatedTimeHighLevel = suggestedEstimatedTimeHighLevel
|
||||
self.suggestedMinPriorityFee = suggestedMinPriorityFee
|
||||
self.suggestedMaxPriorityFee = suggestedMaxPriorityFee
|
||||
self.currentBaseFee = currentBaseFee
|
||||
@ -158,10 +167,13 @@ QtObject:
|
||||
amountOut: string,
|
||||
suggestedMaxFeesPerGasLowLevel: string,
|
||||
suggestedPriorityFeePerGasLowLevel: string,
|
||||
suggestedEstimatedTimeLowLevel: int,
|
||||
suggestedMaxFeesPerGasMediumLevel: string,
|
||||
suggestedPriorityFeePerGasMediumLevel: string,
|
||||
suggestedEstimatedTimeMediumLevel: int,
|
||||
suggestedMaxFeesPerGasHighLevel: string,
|
||||
suggestedPriorityFeePerGasHighLevel: string,
|
||||
suggestedEstimatedTimeHighLevel: int,
|
||||
suggestedMinPriorityFee: string,
|
||||
suggestedMaxPriorityFee: string,
|
||||
currentBaseFee: string,
|
||||
@ -195,14 +207,54 @@ QtObject:
|
||||
approvalL1Fee: string
|
||||
): PathItem =
|
||||
new(result, delete)
|
||||
result.setup(processorName, fromChain, toChain, fromToken, toToken, amountIn, amountInLocked, amountOut,
|
||||
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, approvalGasFeeMode,
|
||||
approvalMaxFeesPerGas, approvalBaseFee, approvalPriorityFee, approvalGasAmount, approvalEstimatedTime, approvalFee,
|
||||
result.setup(
|
||||
processorName,
|
||||
fromChain,
|
||||
toChain,
|
||||
fromToken,
|
||||
toToken,
|
||||
amountIn,
|
||||
amountInLocked,
|
||||
amountOut,
|
||||
suggestedMaxFeesPerGasLowLevel,
|
||||
suggestedPriorityFeePerGasLowLevel,
|
||||
suggestedEstimatedTimeLowLevel,
|
||||
suggestedMaxFeesPerGasMediumLevel,
|
||||
suggestedPriorityFeePerGasMediumLevel,
|
||||
suggestedEstimatedTimeMediumLevel,
|
||||
suggestedMaxFeesPerGasHighLevel,
|
||||
suggestedPriorityFeePerGasHighLevel,
|
||||
suggestedEstimatedTimeHighLevel,
|
||||
suggestedMinPriorityFee,
|
||||
suggestedMaxPriorityFee,
|
||||
currentBaseFee,
|
||||
suggestedTxNonce,
|
||||
suggestedTxGasAmount,
|
||||
suggestedApprovalTxNonce,
|
||||
suggestedApprovalGasAmount,
|
||||
txNonce,
|
||||
txGasFeeMode,
|
||||
txMaxFeesPerGas,
|
||||
txBaseFee,
|
||||
txPriorityFee,
|
||||
txGasAmount,
|
||||
txBonderFees,
|
||||
txTokenFees,
|
||||
txEstimatedTime,
|
||||
txFee,
|
||||
txL1Fee,
|
||||
txTotalFee,
|
||||
approvalRequired,
|
||||
approvalAmountRequired,
|
||||
approvalContractAddress,
|
||||
approvalTxNonce,
|
||||
approvalGasFeeMode,
|
||||
approvalMaxFeesPerGas,
|
||||
approvalBaseFee,
|
||||
approvalPriorityFee,
|
||||
approvalGasAmount,
|
||||
approvalEstimatedTime,
|
||||
approvalFee,
|
||||
approvalL1Fee)
|
||||
|
||||
proc `$`*(self: PathItem): string =
|
||||
@ -217,10 +269,13 @@ QtObject:
|
||||
result &= "\namountOut: " & $self.amountOut
|
||||
result &= "\nsuggestedMaxFeesPerGasLowLevel: " & $self.suggestedMaxFeesPerGasLowLevel
|
||||
result &= "\nsuggestedPriorityFeePerGasLowLevel: " & $self.suggestedPriorityFeePerGasLowLevel
|
||||
result &= "\nsuggestedEstimatedTimeLowLevel: " & $self.suggestedEstimatedTimeLowLevel
|
||||
result &= "\nsuggestedMaxFeesPerGasMediumLevel: " & $self.suggestedMaxFeesPerGasMediumLevel
|
||||
result &= "\nsuggestedPriorityFeePerGasMediumLevel: " & $self.suggestedPriorityFeePerGasMediumLevel
|
||||
result &= "\nsuggestedEstimatedTimeMediumLevel: " & $self.suggestedEstimatedTimeMediumLevel
|
||||
result &= "\nsuggestedMaxFeesPerGasHighLevel: " & $self.suggestedMaxFeesPerGasHighLevel
|
||||
result &= "\nsuggestedPriorityFeePerGasHighLevel: " & $self.suggestedPriorityFeePerGasHighLevel
|
||||
result &= "\nsuggestedEstimatedTimeHighLevel: " & $self.suggestedEstimatedTimeHighLevel
|
||||
result &= "\nsuggestedMinPriorityFee: " & $self.suggestedMinPriorityFee
|
||||
result &= "\nsuggestedMaxPriorityFee: " & $self.suggestedMaxPriorityFee
|
||||
result &= "\ncurrentBaseFee: " & $self.currentBaseFee
|
||||
@ -284,18 +339,27 @@ QtObject:
|
||||
proc suggestedPriorityFeePerGasLowLevel*(self: PathItem): string =
|
||||
return self.suggestedPriorityFeePerGasLowLevel
|
||||
|
||||
proc suggestedEstimatedTimeLowLevel*(self: PathItem): int =
|
||||
return self.suggestedEstimatedTimeLowLevel
|
||||
|
||||
proc suggestedMaxFeesPerGasMediumLevel*(self: PathItem): string =
|
||||
return self.suggestedMaxFeesPerGasMediumLevel
|
||||
|
||||
proc suggestedPriorityFeePerGasMediumLevel*(self: PathItem): string =
|
||||
return self.suggestedPriorityFeePerGasMediumLevel
|
||||
|
||||
proc suggestedEstimatedTimeMediumLevel*(self: PathItem): int =
|
||||
return self.suggestedEstimatedTimeMediumLevel
|
||||
|
||||
proc suggestedMaxFeesPerGasHighLevel*(self: PathItem): string =
|
||||
return self.suggestedMaxFeesPerGasHighLevel
|
||||
|
||||
proc suggestedPriorityFeePerGasHighLevel*(self: PathItem): string =
|
||||
return self.suggestedPriorityFeePerGasHighLevel
|
||||
|
||||
proc suggestedEstimatedTimeHighLevel*(self: PathItem): int =
|
||||
return self.suggestedEstimatedTimeHighLevel
|
||||
|
||||
proc suggestedMinPriorityFee*(self: PathItem): string =
|
||||
return self.suggestedMinPriorityFee
|
||||
|
||||
|
@ -17,10 +17,13 @@ type
|
||||
AmountOut,
|
||||
SuggestedMaxFeesPerGasLowLevel,
|
||||
SuggestedPriorityFeePerGasLowLevel,
|
||||
SuggestedEstimatedTimeLowLevel,
|
||||
SuggestedMaxFeesPerGasMediumLevel,
|
||||
SuggestedPriorityFeePerGasMediumLevel,
|
||||
SuggestedEstimatedTimeMediumLevel,
|
||||
SuggestedMaxFeesPerGasHighLevel,
|
||||
SuggestedPriorityFeePerGasHighLevel,
|
||||
SuggestedEstimatedTimeHighLevel,
|
||||
SuggestedMinPriorityFee,
|
||||
SuggestedMaxPriorityFee,
|
||||
CurrentBaseFee,
|
||||
@ -90,10 +93,13 @@ QtObject:
|
||||
ModelRole.AmountOut.int: "amountOut",
|
||||
ModelRole.SuggestedMaxFeesPerGasLowLevel.int: "suggestedMaxFeesPerGasLowLevel",
|
||||
ModelRole.SuggestedPriorityFeePerGasLowLevel.int: "suggestedPriorityFeePerGasLowLevel",
|
||||
ModelRole.SuggestedEstimatedTimeLowLevel.int: "suggestedEstimatedTimeLowLevel",
|
||||
ModelRole.SuggestedMaxFeesPerGasMediumLevel.int: "suggestedMaxFeesPerGasMediumLevel",
|
||||
ModelRole.SuggestedPriorityFeePerGasMediumLevel.int: "suggestedPriorityFeePerGasMediumLevel",
|
||||
ModelRole.SuggestedEstimatedTimeMediumLevel.int: "suggestedEstimatedTimeMediumLevel",
|
||||
ModelRole.SuggestedMaxFeesPerGasHighLevel.int: "suggestedMaxFeesPerGasHighLevel",
|
||||
ModelRole.SuggestedPriorityFeePerGasHighLevel.int: "suggestedPriorityFeePerGasHighLevel",
|
||||
ModelRole.SuggestedEstimatedTimeHighLevel.int: "suggestedEstimatedTimeHighLevel",
|
||||
ModelRole.SuggestedMinPriorityFee.int: "suggestedMinPriorityFee",
|
||||
ModelRole.SuggestedMaxPriorityFee.int: "suggestedMaxPriorityFee",
|
||||
ModelRole.CurrentBaseFee.int: "currentBaseFee",
|
||||
@ -166,14 +172,20 @@ QtObject:
|
||||
result = newQVariant(item.suggestedMaxFeesPerGasLowLevel)
|
||||
of ModelRole.SuggestedPriorityFeePerGasLowLevel:
|
||||
result = newQVariant(item.suggestedPriorityFeePerGasLowLevel)
|
||||
of ModelRole.SuggestedEstimatedTimeLowLevel:
|
||||
result = newQVariant(item.suggestedEstimatedTimeLowLevel)
|
||||
of ModelRole.SuggestedMaxFeesPerGasMediumLevel:
|
||||
result = newQVariant(item.suggestedMaxFeesPerGasMediumLevel)
|
||||
of ModelRole.SuggestedPriorityFeePerGasMediumLevel:
|
||||
result = newQVariant(item.suggestedPriorityFeePerGasMediumLevel)
|
||||
of ModelRole.SuggestedEstimatedTimeMediumLevel:
|
||||
result = newQVariant(item.suggestedEstimatedTimeMediumLevel)
|
||||
of ModelRole.SuggestedMaxFeesPerGasHighLevel:
|
||||
result = newQVariant(item.suggestedMaxFeesPerGasHighLevel)
|
||||
of ModelRole.SuggestedPriorityFeePerGasHighLevel:
|
||||
result = newQVariant(item.suggestedPriorityFeePerGasHighLevel)
|
||||
of ModelRole.SuggestedEstimatedTimeHighLevel:
|
||||
result = newQVariant(item.suggestedEstimatedTimeHighLevel)
|
||||
of ModelRole.SuggestedMinPriorityFee:
|
||||
result = newQVariant(item.suggestedMinPriorityFee)
|
||||
of ModelRole.SuggestedMaxPriorityFee:
|
||||
|
@ -99,4 +99,7 @@ QtObject:
|
||||
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)
|
||||
chainId, isApprovalTx, communityId)
|
||||
|
||||
proc getEstimatedTime*(self: View, chainId: int, maxFeesPerGas: string, priorityFee: string): int {.slot.} =
|
||||
return self.delegate.getEstimatedTime(chainId, maxFeesPerGas, priorityFee)
|
@ -17,10 +17,13 @@ type
|
||||
SuggestedLevelsForMaxFeesPerGasDto* = ref object
|
||||
low*: UInt256
|
||||
lowPriority*: UInt256
|
||||
lowEstimatedTime*: int
|
||||
medium*: UInt256
|
||||
mediumPriority*: UInt256
|
||||
mediumEstimatedTime*: int
|
||||
high*: UInt256
|
||||
highPriority*: UInt256
|
||||
highEstimatedTime*: int
|
||||
|
||||
type
|
||||
TransactionPathDtoV2* = ref object
|
||||
@ -81,14 +84,17 @@ proc toSuggestedLevelsForMaxFeesPerGasDto*(jsonObj: JsonNode): SuggestedLevelsFo
|
||||
result.low = stint.fromHex(UInt256, $value)
|
||||
if jsonObj.getProp("lowPriority", value):
|
||||
result.lowPriority = stint.fromHex(UInt256, $value)
|
||||
discard jsonObj.getProp("lowEstimatedTime", result.lowEstimatedTime)
|
||||
if jsonObj.getProp("medium", value):
|
||||
result.medium = stint.fromHex(UInt256, $value)
|
||||
if jsonObj.getProp("mediumPriority", value):
|
||||
result.mediumPriority = stint.fromHex(UInt256, $value)
|
||||
discard jsonObj.getProp("mediumEstimatedTime", result.mediumEstimatedTime)
|
||||
if jsonObj.getProp("high", value):
|
||||
result.high = stint.fromHex(UInt256, $value)
|
||||
if jsonObj.getProp("highPriority", value):
|
||||
result.highPriority = stint.fromHex(UInt256, $value)
|
||||
discard jsonObj.getProp("highEstimatedTime", result.highEstimatedTime)
|
||||
|
||||
proc toTransactionPathDtoV2*(jsonObj: JsonNode): TransactionPathDtoV2 =
|
||||
result = TransactionPathDtoV2()
|
||||
|
@ -519,6 +519,18 @@ QtObject:
|
||||
error "Error estimating transaction time", message = e.msg
|
||||
return EstimatedTime.Unknown
|
||||
|
||||
proc getEstimatedTimeV2*(self: Service, chainId: int, maxFeePerGas: string, priorityFee: string): int =
|
||||
try:
|
||||
let
|
||||
bigMaxFeePerGas = common_utils.stringToUint256(maxFeePerGas)
|
||||
bigPriorityFee = common_utils.stringToUint256(priorityFee)
|
||||
maxFeePerGasHex = "0x" & eth_utils.stripLeadingZeros(bigMaxFeePerGas.toHex)
|
||||
priorityFeeHex = "0x" & eth_utils.stripLeadingZeros(bigPriorityFee.toHex)
|
||||
return backend.getTransactionEstimatedTimeV2(chainId, maxFeePerGasHex, priorityFeeHex).result.getInt
|
||||
except Exception as e:
|
||||
error "Error estimating transaction time", message = e.msg
|
||||
return 0
|
||||
|
||||
proc getLatestBlockNumber*(self: Service, chainId: int): string =
|
||||
try:
|
||||
let response = eth.getBlockByNumber(chainId, "latest")
|
||||
|
@ -114,6 +114,11 @@ rpc(getTransactionEstimatedTime, "wallet"):
|
||||
chainId: int
|
||||
maxFeePerGas: string
|
||||
|
||||
rpc(getTransactionEstimatedTimeV2, "wallet"):
|
||||
chainId: int
|
||||
maxFeePerGas: string
|
||||
maxPriorityFeePerGas: string
|
||||
|
||||
rpc(fetchPrices, "wallet"):
|
||||
symbols: seq[string]
|
||||
currencies: seq[string]
|
||||
|
@ -75,6 +75,10 @@ Item {
|
||||
return "0.25 USD"
|
||||
}
|
||||
|
||||
fnGetEstimatedTime: function(feeInWei) {
|
||||
return 0
|
||||
}
|
||||
|
||||
fiatFees: "1.54 EUR"
|
||||
cryptoFees: "0.001 ETH"
|
||||
estimatedTime: qsTr("> 5 minutes")
|
||||
|
@ -77,6 +77,13 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
function formatEstimatedTime(estimatedTime) {
|
||||
if (estimatedTime == 0 || estimatedTime >= 60) {
|
||||
return qsTr(">60s")
|
||||
}
|
||||
return qsTr("~%1").arg(estimatedTime)
|
||||
}
|
||||
|
||||
function getRouterErrorBasedOnCode(code) {
|
||||
if (code === "") {
|
||||
return ""
|
||||
|
@ -11,6 +11,7 @@ import StatusQ.Components 0.1
|
||||
import AppLayouts.Wallet.panels 1.0
|
||||
import AppLayouts.Wallet.views 1.0
|
||||
import AppLayouts.Wallet.popups 1.0
|
||||
import AppLayouts.Wallet 1.0
|
||||
|
||||
import utils 1.0
|
||||
|
||||
@ -113,6 +114,8 @@ SignTransactionModalBase {
|
||||
|
||||
/** required function which receives fee in wei and recalculate it currency selected currency and format to locale string **/
|
||||
required property var fnGetPriceInCurrencyForFee
|
||||
/** required function which receives base fee and priority fee in wei and returns estimated time in seconds **/
|
||||
required property var fnGetEstimatedTime
|
||||
|
||||
/** Signal to updated tx settings **/
|
||||
signal updateTxSettings(int selectedFeeMode, string customNonce, string customGasAmount, string maxFeesPerGas, string priorityFee)
|
||||
@ -234,6 +237,7 @@ SignTransactionModalBase {
|
||||
property Component internalPopup: TransactionSettings {
|
||||
|
||||
fnGetPriceInCurrencyForFee: root.fnGetPriceInCurrencyForFee
|
||||
fnGetEstimatedTime: root.fnGetEstimatedTime
|
||||
|
||||
selectedFeeMode: root.selectedFeeMode
|
||||
|
||||
@ -244,11 +248,11 @@ SignTransactionModalBase {
|
||||
currentNonce: root.currentNonce
|
||||
|
||||
normalPrice: root.normalPrice
|
||||
normalTime: root.normalTime
|
||||
normalTime: WalletUtils.formatEstimatedTime(root.normalTime)
|
||||
fastPrice: root.fastPrice
|
||||
fastTime: root.fastTime
|
||||
fastTime: WalletUtils.formatEstimatedTime(root.fastTime)
|
||||
urgentPrice: root.urgentPrice
|
||||
urgentTime: root.urgentTime
|
||||
urgentTime: WalletUtils.formatEstimatedTime(root.urgentTime)
|
||||
|
||||
function updateCustomFields() {
|
||||
// by default custom follows normal fee option
|
||||
|
@ -33,6 +33,10 @@ QtObject {
|
||||
_walletSectionSendInst.setCustomTxDetails(nonce, gasAmount, maxFeesPerGas, priorityFee, routerInputParamsUuid, pathName, chainId, isApprovalTx, communityId)
|
||||
}
|
||||
|
||||
function getEstimatedTime(chainId, baseFeeInWei, priorityFeeInWei) {
|
||||
return _walletSectionSendInst.getEstimatedTime(chainId, baseFeeInWei, priorityFeeInWei)
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
_walletSectionSendInst.suggestedRoutesReady.connect(suggestedRoutesReady)
|
||||
_walletSectionSendInst.transactionSent.connect(transactionSent)
|
||||
|
@ -8,6 +8,8 @@ import StatusQ.Controls.Validators 0.1
|
||||
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
import AppLayouts.Wallet 1.0
|
||||
|
||||
import shared.controls 1.0
|
||||
import shared.popups 1.0
|
||||
import utils 1.0
|
||||
@ -42,6 +44,7 @@ Rectangle {
|
||||
required property int selectedFeeMode
|
||||
|
||||
required property var fnGetPriceInCurrencyForFee
|
||||
required property var fnGetEstimatedTime
|
||||
|
||||
signal confirmClicked()
|
||||
signal cancelClicked()
|
||||
@ -106,7 +109,9 @@ Rectangle {
|
||||
const priorityFeeWei = Utils.gweiToWei(customPriorityFeeInput.text)
|
||||
const totalFee = SQUtils.AmountsArithmetic.sum(baseFeeWei, priorityFeeWei)
|
||||
const feeInWei = SQUtils.AmountsArithmetic.times(totalFee, SQUtils.AmountsArithmetic.fromString(customGasAmountInput.text)).toFixed()
|
||||
const estimatedTime = root.fnGetEstimatedTime(totalFee.toFixed(), priorityFeeWei.toFixed())
|
||||
optionCustom.subText = root.fnGetPriceInCurrencyForFee(feeInWei)
|
||||
optionCustom.additionalText = WalletUtils.formatEstimatedTime(estimatedTime)
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,7 +179,7 @@ Rectangle {
|
||||
type: StatusFeeOption.Type.Normal
|
||||
selected: root.selectedFeeMode === StatusFeeOption.Type.Normal
|
||||
showSubText: true
|
||||
// showAdditionalText: true // TODO: temoporary disabled until we figure out how to estimate time more granularly
|
||||
showAdditionalText: true
|
||||
|
||||
onClicked: root.selectedFeeMode = StatusFeeOption.Type.Normal
|
||||
}
|
||||
@ -184,7 +189,7 @@ Rectangle {
|
||||
type: StatusFeeOption.Type.Fast
|
||||
selected: root.selectedFeeMode === StatusFeeOption.Type.Fast
|
||||
showSubText: true
|
||||
// showAdditionalText: true // TODO: temoporary disabled until we figure out how to estimate time more granularly
|
||||
showAdditionalText: true
|
||||
|
||||
onClicked: root.selectedFeeMode = StatusFeeOption.Type.Fast
|
||||
}
|
||||
@ -194,7 +199,7 @@ Rectangle {
|
||||
type: StatusFeeOption.Type.Urgent
|
||||
selected: root.selectedFeeMode === StatusFeeOption.Type.Urgent
|
||||
showSubText: true
|
||||
// showAdditionalText: true // TODO: temoporary disabled until we figure out how to estimate time more granularly
|
||||
showAdditionalText: true
|
||||
|
||||
onClicked: root.selectedFeeMode = StatusFeeOption.Type.Urgent
|
||||
}
|
||||
@ -204,7 +209,7 @@ Rectangle {
|
||||
type: StatusFeeOption.Type.Custom
|
||||
selected: root.selectedFeeMode === StatusFeeOption.Type.Custom
|
||||
showSubText: !!selected
|
||||
// showAdditionalText: !!selected // TODO: temoporary disabled until we figure out how to estimate time more granularly
|
||||
showAdditionalText: !!selected
|
||||
unselectedText: "Set your own fees & nonce"
|
||||
|
||||
onClicked: root.selectedFeeMode = StatusFeeOption.Type.Custom
|
||||
|
@ -863,6 +863,14 @@ QtObject {
|
||||
return root.fnFormatCurrencyAmount(ethFiatValue*feesEth, root.currentCurrency).toString()
|
||||
}
|
||||
|
||||
fnGetEstimatedTime: function(baseFeeInWei, priorityFeeInWei) {
|
||||
if (!txPathUnderReviewEntry.item) {
|
||||
return ""
|
||||
}
|
||||
const chainId = txPathUnderReviewEntry.item.fromChain
|
||||
return root.transactionStoreNew.getEstimatedTime(chainId, baseFeeInWei, priorityFeeInWei)
|
||||
}
|
||||
|
||||
normalPrice: {
|
||||
if (!!txPathUnderReviewEntry.item) {
|
||||
if (handler.reviewApprovalForTxPathUnderReview) {
|
||||
@ -883,7 +891,7 @@ QtObject {
|
||||
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
|
||||
normalTime: !!txPathUnderReviewEntry.item? txPathUnderReviewEntry.item.suggestedEstimatedTimeLowLevel : ""
|
||||
|
||||
fastPrice: {
|
||||
if (!!txPathUnderReviewEntry.item) {
|
||||
@ -905,7 +913,7 @@ QtObject {
|
||||
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
|
||||
fastTime: !!txPathUnderReviewEntry.item? txPathUnderReviewEntry.item.suggestedEstimatedTimeMediumLevel : ""
|
||||
|
||||
urgentPrice: {
|
||||
if (!!txPathUnderReviewEntry.item) {
|
||||
@ -927,7 +935,7 @@ QtObject {
|
||||
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
|
||||
urgentTime: !!txPathUnderReviewEntry.item? txPathUnderReviewEntry.item.suggestedEstimatedTimeHighLevel : ""
|
||||
|
||||
customBaseFee: {
|
||||
if (!!txPathUnderReviewEntry.item) {
|
||||
|
2
vendor/status-go
vendored
2
vendor/status-go
vendored
@ -1 +1 @@
|
||||
Subproject commit 1bfb0cef022afc1484a410cb3e0097e7523bb705
|
||||
Subproject commit 0bf60488017885b840615533bd475b94e4072f8a
|
Loading…
x
Reference in New Issue
Block a user