mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-21 02:58:55 +00:00
feat(wallet): added suggested min and max priority fee and current base fee to the path v2 dto
The following properties added to the path v2 dto: - suggestedMinPriorityFee - suggestedMaxPriorityFee - currentBaseFee Path model of the new send modal updated with those properties. Closes #17037
This commit is contained in:
parent
040c15260c
commit
dcd7dec04d
@ -1,50 +0,0 @@
|
||||
import NimQml
|
||||
|
||||
QtObject:
|
||||
type MaxFeeLevelsItem* = ref object of QObject
|
||||
low: string
|
||||
medium: string
|
||||
high: string
|
||||
|
||||
proc setup*(self: MaxFeeLevelsItem,
|
||||
low: string,
|
||||
medium: string,
|
||||
high: string
|
||||
) =
|
||||
self.QObject.setup
|
||||
self.low = low
|
||||
self.medium = medium
|
||||
self.high = high
|
||||
|
||||
proc delete*(self: MaxFeeLevelsItem) =
|
||||
self.QObject.delete
|
||||
|
||||
proc newMaxFeeLevelsItem*(
|
||||
low: string,
|
||||
medium: string,
|
||||
high: string
|
||||
): MaxFeeLevelsItem =
|
||||
new(result, delete)
|
||||
result.setup(low, medium, high)
|
||||
|
||||
proc `$`*(self: MaxFeeLevelsItem): string =
|
||||
result = "MaxFeeLevelsItem("
|
||||
result = result & "\low: " & $self.low
|
||||
result = result & "\nmedium " & $self.medium
|
||||
result = result & "\nhigh: " & $self.high
|
||||
result = result & ")"
|
||||
|
||||
proc getLow*(self: MaxFeeLevelsItem): string {.slot.} =
|
||||
return self.low
|
||||
QtProperty[string] low:
|
||||
read = getLow
|
||||
|
||||
proc getMedium*(self: MaxFeeLevelsItem): string {.slot.} =
|
||||
return self.medium
|
||||
QtProperty[string] medium:
|
||||
read = getMedium
|
||||
|
||||
proc getHigh*(self: MaxFeeLevelsItem): string {.slot.} =
|
||||
return self.high
|
||||
QtProperty[string] high:
|
||||
read = getHigh
|
@ -1,6 +1,6 @@
|
||||
import tables, NimQml, sequtils, sugar, strutils, chronicles, stint
|
||||
|
||||
import ./io_interface, ./view, ./controller, ./max_fee_levels_item, ./path_item
|
||||
import ./io_interface, ./view, ./controller, ./path_item
|
||||
import ../io_interface as delegate_interface
|
||||
|
||||
import app/global/global_singleton
|
||||
@ -92,13 +92,6 @@ method viewDidLoad*(self: Module) =
|
||||
self.moduleLoaded = true
|
||||
self.delegate.sendModuleDidLoad()
|
||||
|
||||
proc convertFeeLevelsDtoToMaxFeeLevelsItem(self: Module, feeLevels: SuggestedLevelsForMaxFeesPerGasDto): MaxFeeLevelsItem =
|
||||
result = newMaxFeeLevelsItem(
|
||||
low = $feeLevels.low,
|
||||
medium = $feeLevels.medium,
|
||||
high = $feeLevels.high
|
||||
)
|
||||
|
||||
proc convertTransactionPathDtoV2ToPathItem(self: Module, txPath: TransactionPathDtoV2): PathItem =
|
||||
var fromChainId = 0
|
||||
var toChainid = 0
|
||||
@ -122,7 +115,12 @@ proc convertTransactionPathDtoV2ToPathItem(self: Module, txPath: TransactionPath
|
||||
amountIn = $txPath.amountIn,
|
||||
amountInLocked = txPath.amountInLocked,
|
||||
amountOut = $txPath.amountOut,
|
||||
suggestedLevelsForMaxFeesPerGas = self.convertFeeLevelsDtoToMaxFeeLevelsItem(txPath.suggestedLevelsForMaxFeesPerGas),
|
||||
suggestedMaxFeesPerGasLowLevel = $txPath.suggestedLevelsForMaxFeesPerGas.low,
|
||||
suggestedMaxFeesPerGasMediumLevel = $txPath.suggestedLevelsForMaxFeesPerGas.medium,
|
||||
suggestedMaxFeesPerGasHighLevel = $txPath.suggestedLevelsForMaxFeesPerGas.high,
|
||||
suggestedMinPriorityFee = $txPath.suggestedMinPriorityFee,
|
||||
suggestedMaxPriorityFee = $txPath.suggestedMaxPriorityFee,
|
||||
currentBaseFee = $txPath.currentBaseFee,
|
||||
txNonce = $txPath.txNonce,
|
||||
txMaxFeesPerGas = $txPath.txMaxFeesPerGas,
|
||||
txBaseFee = $txPath.txBaseFee,
|
||||
|
@ -1,7 +1,6 @@
|
||||
import NimQml
|
||||
|
||||
import app_service/common/wallet_constants
|
||||
import ./max_fee_levels_item
|
||||
|
||||
QtObject:
|
||||
type PathItem* = ref object of QObject
|
||||
@ -13,7 +12,12 @@ QtObject:
|
||||
amountIn: string
|
||||
amountInLocked: bool
|
||||
amountOut: string
|
||||
suggestedLevelsForMaxFeesPerGas: MaxFeeLevelsItem
|
||||
suggestedMaxFeesPerGasLowLevel: string
|
||||
suggestedMaxFeesPerGasMediumLevel: string
|
||||
suggestedMaxFeesPerGasHighLevel: string
|
||||
suggestedMinPriorityFee: string
|
||||
suggestedMaxPriorityFee: string
|
||||
currentBaseFee: string
|
||||
txNonce: string
|
||||
txMaxFeesPerGas: string
|
||||
txBaseFee: string
|
||||
@ -46,7 +50,12 @@ QtObject:
|
||||
amountIn: string,
|
||||
amountInLocked: bool,
|
||||
amountOut: string,
|
||||
suggestedLevelsForMaxFeesPerGas: MaxFeeLevelsItem,
|
||||
suggestedMaxFeesPerGasLowLevel: string,
|
||||
suggestedMaxFeesPerGasMediumLevel: string,
|
||||
suggestedMaxFeesPerGasHighLevel: string,
|
||||
suggestedMinPriorityFee: string,
|
||||
suggestedMaxPriorityFee: string,
|
||||
currentBaseFee: string,
|
||||
txNonce: string,
|
||||
txMaxFeesPerGas: string,
|
||||
txBaseFee: string,
|
||||
@ -79,7 +88,12 @@ QtObject:
|
||||
self.amountIn = amountIn
|
||||
self.amountInLocked = amountInLocked
|
||||
self.amountOut = amountOut
|
||||
self.suggestedLevelsForMaxFeesPerGas = suggestedLevelsForMaxFeesPerGas
|
||||
self.suggestedMaxFeesPerGasLowLevel = suggestedMaxFeesPerGasLowLevel
|
||||
self.suggestedMaxFeesPerGasMediumLevel = suggestedMaxFeesPerGasMediumLevel
|
||||
self.suggestedMaxFeesPerGasHighLevel = suggestedMaxFeesPerGasHighLevel
|
||||
self.suggestedMinPriorityFee = suggestedMinPriorityFee
|
||||
self.suggestedMaxPriorityFee = suggestedMaxPriorityFee
|
||||
self.currentBaseFee = currentBaseFee
|
||||
self.txNonce = txNonce
|
||||
self.txMaxFeesPerGas = txMaxFeesPerGas
|
||||
self.txBaseFee = txBaseFee
|
||||
@ -115,7 +129,12 @@ QtObject:
|
||||
amountIn: string,
|
||||
amountInLocked: bool,
|
||||
amountOut: string,
|
||||
suggestedLevelsForMaxFeesPerGas: MaxFeeLevelsItem,
|
||||
suggestedMaxFeesPerGasLowLevel: string,
|
||||
suggestedMaxFeesPerGasMediumLevel: string,
|
||||
suggestedMaxFeesPerGasHighLevel: string,
|
||||
suggestedMinPriorityFee: string,
|
||||
suggestedMaxPriorityFee: string,
|
||||
currentBaseFee: string,
|
||||
txNonce: string,
|
||||
txMaxFeesPerGas: string,
|
||||
txBaseFee: string,
|
||||
@ -141,10 +160,11 @@ QtObject:
|
||||
): PathItem =
|
||||
new(result, delete)
|
||||
result.setup(processorName, fromChain, toChain, fromToken, toToken, amountIn, amountInLocked, amountOut,
|
||||
suggestedLevelsForMaxFeesPerGas, txNonce, txMaxFeesPerGas, txBaseFee,txPriorityFee, txGasAmount, txBonderFees,
|
||||
txTokenFees, txEstimatedTime, txFee, txL1Fee, txTotalFee, approvalRequired, approvalAmountRequired,
|
||||
approvalContractAddress, approvalTxNonce, approvalMaxFeesPerGas, approvalBaseFee, approvalPriorityFee,
|
||||
approvalGasAmount, approvalEstimatedTime, approvalFee, approvalL1Fee)
|
||||
suggestedMaxFeesPerGasLowLevel, suggestedMaxFeesPerGasMediumLevel, suggestedMaxFeesPerGasHighLevel,
|
||||
suggestedMinPriorityFee, suggestedMaxPriorityFee, currentBaseFee, txNonce, txMaxFeesPerGas, txBaseFee,
|
||||
txPriorityFee, txGasAmount, txBonderFees, txTokenFees, txEstimatedTime, txFee, txL1Fee, txTotalFee,
|
||||
approvalRequired, approvalAmountRequired, approvalContractAddress, approvalTxNonce, approvalMaxFeesPerGas,
|
||||
approvalBaseFee, approvalPriorityFee, approvalGasAmount, approvalEstimatedTime, approvalFee, approvalL1Fee)
|
||||
|
||||
proc `$`*(self: PathItem): string =
|
||||
result = "PathItem("
|
||||
@ -156,7 +176,12 @@ QtObject:
|
||||
result &= "\namountIn: " & $self.amountIn
|
||||
result &= "\namountInLocked: " & $self.amountInLocked
|
||||
result &= "\namountOut: " & $self.amountOut
|
||||
result &= "\nsuggestedLevelsForMaxFeesPerGas: " & $self.suggestedLevelsForMaxFeesPerGas
|
||||
result &= "\nsuggestedMaxFeesPerGasLowLevel: " & $self.suggestedMaxFeesPerGasLowLevel
|
||||
result &= "\nsuggestedMaxFeesPerGasMediumLevel: " & $self.suggestedMaxFeesPerGasMediumLevel
|
||||
result &= "\nsuggestedMaxFeesPerGasHighLevel: " & $self.suggestedMaxFeesPerGasHighLevel
|
||||
result &= "\nsuggestedMinPriorityFee: " & $self.suggestedMinPriorityFee
|
||||
result &= "\nsuggestedMaxPriorityFee: " & $self.suggestedMaxPriorityFee
|
||||
result &= "\ncurrentBaseFee: " & $self.currentBaseFee
|
||||
result &= "\ntxNonce: " & $self.txNonce
|
||||
result &= "\ntxMaxFeesPerGas: " & $self.txMaxFeesPerGas
|
||||
result &= "\ntxBaseFee: " & $self.txBaseFee
|
||||
@ -205,8 +230,23 @@ QtObject:
|
||||
proc amountOut*(self: PathItem): string =
|
||||
return self.amountOut
|
||||
|
||||
proc suggestedLevelsForMaxFeesPerGas*(self: PathItem): MaxFeeLevelsItem =
|
||||
return self.suggestedLevelsForMaxFeesPerGas
|
||||
proc suggestedMaxFeesPerGasLowLevel*(self: PathItem): string =
|
||||
return self.suggestedMaxFeesPerGasLowLevel
|
||||
|
||||
proc suggestedMaxFeesPerGasMediumLevel*(self: PathItem): string =
|
||||
return self.suggestedMaxFeesPerGasMediumLevel
|
||||
|
||||
proc suggestedMaxFeesPerGasHighLevel*(self: PathItem): string =
|
||||
return self.suggestedMaxFeesPerGasHighLevel
|
||||
|
||||
proc suggestedMinPriorityFee*(self: PathItem): string =
|
||||
return self.suggestedMinPriorityFee
|
||||
|
||||
proc suggestedMaxPriorityFee*(self: PathItem): string =
|
||||
return self.suggestedMaxPriorityFee
|
||||
|
||||
proc currentBaseFee*(self: PathItem): string =
|
||||
return self.currentBaseFee
|
||||
|
||||
proc txNonce*(self: PathItem): string =
|
||||
return self.txNonce
|
||||
|
@ -12,7 +12,12 @@ type
|
||||
AmountIn,
|
||||
AmountInLocked,
|
||||
AmountOut,
|
||||
SuggestedLevelsForMaxFeesPerGas,
|
||||
SuggestedMaxFeesPerGasLowLevel,
|
||||
SuggestedMaxFeesPerGasMediumLevel,
|
||||
SuggestedMaxFeesPerGasHighLevel,
|
||||
SuggestedMinPriorityFee,
|
||||
SuggestedMaxPriorityFee,
|
||||
CurrentBaseFee,
|
||||
TxNonce,
|
||||
TxMaxFeesPerGas,
|
||||
TxBaseFee,
|
||||
@ -70,7 +75,12 @@ QtObject:
|
||||
ModelRole.AmountIn.int: "amountIn",
|
||||
ModelRole.AmountInLocked.int: "amountInLocked",
|
||||
ModelRole.AmountOut.int: "amountOut",
|
||||
ModelRole.SuggestedLevelsForMaxFeesPerGas.int: "suggestedLevelsForMaxFeesPerGas",
|
||||
ModelRole.SuggestedMaxFeesPerGasLowLevel.int: "suggestedMaxFeesPerGasLowLevel",
|
||||
ModelRole.SuggestedMaxFeesPerGasMediumLevel.int: "suggestedMaxFeesPerGasMediumLevel",
|
||||
ModelRole.SuggestedMaxFeesPerGasHighLevel.int: "suggestedMaxFeesPerGasHighLevel",
|
||||
ModelRole.SuggestedMinPriorityFee.int: "suggestedMinPriorityFee",
|
||||
ModelRole.SuggestedMaxPriorityFee.int: "suggestedMaxPriorityFee",
|
||||
ModelRole.CurrentBaseFee.int: "currentBaseFee",
|
||||
ModelRole.TxNonce.int: "txNonce",
|
||||
ModelRole.TxMaxFeesPerGas.int: "txMaxFeesPerGas",
|
||||
ModelRole.TxBaseFee.int: "txBaseFee",
|
||||
@ -128,8 +138,18 @@ QtObject:
|
||||
result = newQVariant(item.amountInLocked)
|
||||
of ModelRole.AmountOut:
|
||||
result = newQVariant(item.amountOut)
|
||||
of ModelRole.SuggestedLevelsForMaxFeesPerGas:
|
||||
result = newQVariant(item.suggestedLevelsForMaxFeesPerGas)
|
||||
of ModelRole.SuggestedMaxFeesPerGasLowLevel:
|
||||
result = newQVariant(item.suggestedMaxFeesPerGasLowLevel)
|
||||
of ModelRole.SuggestedMaxFeesPerGasMediumLevel:
|
||||
result = newQVariant(item.suggestedMaxFeesPerGasMediumLevel)
|
||||
of ModelRole.SuggestedMaxFeesPerGasHighLevel:
|
||||
result = newQVariant(item.suggestedMaxFeesPerGasHighLevel)
|
||||
of ModelRole.SuggestedMinPriorityFee:
|
||||
result = newQVariant(item.suggestedMinPriorityFee)
|
||||
of ModelRole.SuggestedMaxPriorityFee:
|
||||
result = newQVariant(item.suggestedMaxPriorityFee)
|
||||
of ModelRole.CurrentBaseFee:
|
||||
result = newQVariant(item.currentBaseFee)
|
||||
of ModelRole.TxNonce:
|
||||
result = newQVariant(item.txNonce)
|
||||
of ModelRole.TxMaxFeesPerGas:
|
||||
|
@ -32,6 +32,9 @@ type
|
||||
amountOut*: UInt256
|
||||
|
||||
suggestedLevelsForMaxFeesPerGas*: SuggestedLevelsForMaxFeesPerGasDto
|
||||
suggestedMinPriorityFee*: UInt256
|
||||
suggestedMaxPriorityFee*: UInt256
|
||||
currentBaseFee*: UInt256
|
||||
|
||||
txNonce*: UInt256
|
||||
txMaxFeesPerGas*: UInt256
|
||||
@ -82,6 +85,9 @@ proc toTransactionPathDtoV2*(jsonObj: JsonNode): TransactionPathDtoV2 =
|
||||
discard jsonObj.getProp("AmountInLocked", result.amountInLocked)
|
||||
result.amountOut = stint.fromHex(UInt256, jsonObj{"AmountOut"}.getStr)
|
||||
result.suggestedLevelsForMaxFeesPerGas = jsonObj["SuggestedLevelsForMaxFeesPerGas"].toSuggestedLevelsForMaxFeesPerGasDto()
|
||||
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.txNonce = stint.fromHex(UInt256, jsonObj{"TxNonce"}.getStr)
|
||||
result.txMaxFeesPerGas = stint.fromHex(UInt256, jsonObj{"TxMaxFeesPerGas"}.getStr)
|
||||
result.txBaseFee = stint.fromHex(UInt256, jsonObj{"TxBaseFee"}.getStr)
|
||||
|
2
vendor/status-go
vendored
2
vendor/status-go
vendored
@ -1 +1 @@
|
||||
Subproject commit 90ce72a2d58cb1aa5823025f7f7585f9b9beccfb
|
||||
Subproject commit bb7b1f246dc6db3cd3ca460009048b49c8f14d0f
|
Loading…
x
Reference in New Issue
Block a user