mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-22 03:28:52 +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 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 ../io_interface as delegate_interface
|
||||||
|
|
||||||
import app/global/global_singleton
|
import app/global/global_singleton
|
||||||
@ -92,13 +92,6 @@ method viewDidLoad*(self: Module) =
|
|||||||
self.moduleLoaded = true
|
self.moduleLoaded = true
|
||||||
self.delegate.sendModuleDidLoad()
|
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 =
|
proc convertTransactionPathDtoV2ToPathItem(self: Module, txPath: TransactionPathDtoV2): PathItem =
|
||||||
var fromChainId = 0
|
var fromChainId = 0
|
||||||
var toChainid = 0
|
var toChainid = 0
|
||||||
@ -122,7 +115,12 @@ proc convertTransactionPathDtoV2ToPathItem(self: Module, txPath: TransactionPath
|
|||||||
amountIn = $txPath.amountIn,
|
amountIn = $txPath.amountIn,
|
||||||
amountInLocked = txPath.amountInLocked,
|
amountInLocked = txPath.amountInLocked,
|
||||||
amountOut = $txPath.amountOut,
|
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,
|
txNonce = $txPath.txNonce,
|
||||||
txMaxFeesPerGas = $txPath.txMaxFeesPerGas,
|
txMaxFeesPerGas = $txPath.txMaxFeesPerGas,
|
||||||
txBaseFee = $txPath.txBaseFee,
|
txBaseFee = $txPath.txBaseFee,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import NimQml
|
import NimQml
|
||||||
|
|
||||||
import app_service/common/wallet_constants
|
import app_service/common/wallet_constants
|
||||||
import ./max_fee_levels_item
|
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type PathItem* = ref object of QObject
|
type PathItem* = ref object of QObject
|
||||||
@ -13,7 +12,12 @@ QtObject:
|
|||||||
amountIn: string
|
amountIn: string
|
||||||
amountInLocked: bool
|
amountInLocked: bool
|
||||||
amountOut: string
|
amountOut: string
|
||||||
suggestedLevelsForMaxFeesPerGas: MaxFeeLevelsItem
|
suggestedMaxFeesPerGasLowLevel: string
|
||||||
|
suggestedMaxFeesPerGasMediumLevel: string
|
||||||
|
suggestedMaxFeesPerGasHighLevel: string
|
||||||
|
suggestedMinPriorityFee: string
|
||||||
|
suggestedMaxPriorityFee: string
|
||||||
|
currentBaseFee: string
|
||||||
txNonce: string
|
txNonce: string
|
||||||
txMaxFeesPerGas: string
|
txMaxFeesPerGas: string
|
||||||
txBaseFee: string
|
txBaseFee: string
|
||||||
@ -46,7 +50,12 @@ QtObject:
|
|||||||
amountIn: string,
|
amountIn: string,
|
||||||
amountInLocked: bool,
|
amountInLocked: bool,
|
||||||
amountOut: string,
|
amountOut: string,
|
||||||
suggestedLevelsForMaxFeesPerGas: MaxFeeLevelsItem,
|
suggestedMaxFeesPerGasLowLevel: string,
|
||||||
|
suggestedMaxFeesPerGasMediumLevel: string,
|
||||||
|
suggestedMaxFeesPerGasHighLevel: string,
|
||||||
|
suggestedMinPriorityFee: string,
|
||||||
|
suggestedMaxPriorityFee: string,
|
||||||
|
currentBaseFee: string,
|
||||||
txNonce: string,
|
txNonce: string,
|
||||||
txMaxFeesPerGas: string,
|
txMaxFeesPerGas: string,
|
||||||
txBaseFee: string,
|
txBaseFee: string,
|
||||||
@ -79,7 +88,12 @@ QtObject:
|
|||||||
self.amountIn = amountIn
|
self.amountIn = amountIn
|
||||||
self.amountInLocked = amountInLocked
|
self.amountInLocked = amountInLocked
|
||||||
self.amountOut = amountOut
|
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.txNonce = txNonce
|
||||||
self.txMaxFeesPerGas = txMaxFeesPerGas
|
self.txMaxFeesPerGas = txMaxFeesPerGas
|
||||||
self.txBaseFee = txBaseFee
|
self.txBaseFee = txBaseFee
|
||||||
@ -115,7 +129,12 @@ QtObject:
|
|||||||
amountIn: string,
|
amountIn: string,
|
||||||
amountInLocked: bool,
|
amountInLocked: bool,
|
||||||
amountOut: string,
|
amountOut: string,
|
||||||
suggestedLevelsForMaxFeesPerGas: MaxFeeLevelsItem,
|
suggestedMaxFeesPerGasLowLevel: string,
|
||||||
|
suggestedMaxFeesPerGasMediumLevel: string,
|
||||||
|
suggestedMaxFeesPerGasHighLevel: string,
|
||||||
|
suggestedMinPriorityFee: string,
|
||||||
|
suggestedMaxPriorityFee: string,
|
||||||
|
currentBaseFee: string,
|
||||||
txNonce: string,
|
txNonce: string,
|
||||||
txMaxFeesPerGas: string,
|
txMaxFeesPerGas: string,
|
||||||
txBaseFee: string,
|
txBaseFee: string,
|
||||||
@ -141,10 +160,11 @@ QtObject:
|
|||||||
): PathItem =
|
): PathItem =
|
||||||
new(result, delete)
|
new(result, delete)
|
||||||
result.setup(processorName, fromChain, toChain, fromToken, toToken, amountIn, amountInLocked, amountOut,
|
result.setup(processorName, fromChain, toChain, fromToken, toToken, amountIn, amountInLocked, amountOut,
|
||||||
suggestedLevelsForMaxFeesPerGas, txNonce, txMaxFeesPerGas, txBaseFee,txPriorityFee, txGasAmount, txBonderFees,
|
suggestedMaxFeesPerGasLowLevel, suggestedMaxFeesPerGasMediumLevel, suggestedMaxFeesPerGasHighLevel,
|
||||||
txTokenFees, txEstimatedTime, txFee, txL1Fee, txTotalFee, approvalRequired, approvalAmountRequired,
|
suggestedMinPriorityFee, suggestedMaxPriorityFee, currentBaseFee, txNonce, txMaxFeesPerGas, txBaseFee,
|
||||||
approvalContractAddress, approvalTxNonce, approvalMaxFeesPerGas, approvalBaseFee, approvalPriorityFee,
|
txPriorityFee, txGasAmount, txBonderFees, txTokenFees, txEstimatedTime, txFee, txL1Fee, txTotalFee,
|
||||||
approvalGasAmount, approvalEstimatedTime, approvalFee, approvalL1Fee)
|
approvalRequired, approvalAmountRequired, approvalContractAddress, approvalTxNonce, approvalMaxFeesPerGas,
|
||||||
|
approvalBaseFee, approvalPriorityFee, approvalGasAmount, approvalEstimatedTime, approvalFee, approvalL1Fee)
|
||||||
|
|
||||||
proc `$`*(self: PathItem): string =
|
proc `$`*(self: PathItem): string =
|
||||||
result = "PathItem("
|
result = "PathItem("
|
||||||
@ -156,7 +176,12 @@ QtObject:
|
|||||||
result &= "\namountIn: " & $self.amountIn
|
result &= "\namountIn: " & $self.amountIn
|
||||||
result &= "\namountInLocked: " & $self.amountInLocked
|
result &= "\namountInLocked: " & $self.amountInLocked
|
||||||
result &= "\namountOut: " & $self.amountOut
|
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 &= "\ntxNonce: " & $self.txNonce
|
||||||
result &= "\ntxMaxFeesPerGas: " & $self.txMaxFeesPerGas
|
result &= "\ntxMaxFeesPerGas: " & $self.txMaxFeesPerGas
|
||||||
result &= "\ntxBaseFee: " & $self.txBaseFee
|
result &= "\ntxBaseFee: " & $self.txBaseFee
|
||||||
@ -205,8 +230,23 @@ QtObject:
|
|||||||
proc amountOut*(self: PathItem): string =
|
proc amountOut*(self: PathItem): string =
|
||||||
return self.amountOut
|
return self.amountOut
|
||||||
|
|
||||||
proc suggestedLevelsForMaxFeesPerGas*(self: PathItem): MaxFeeLevelsItem =
|
proc suggestedMaxFeesPerGasLowLevel*(self: PathItem): string =
|
||||||
return self.suggestedLevelsForMaxFeesPerGas
|
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 =
|
proc txNonce*(self: PathItem): string =
|
||||||
return self.txNonce
|
return self.txNonce
|
||||||
|
@ -12,7 +12,12 @@ type
|
|||||||
AmountIn,
|
AmountIn,
|
||||||
AmountInLocked,
|
AmountInLocked,
|
||||||
AmountOut,
|
AmountOut,
|
||||||
SuggestedLevelsForMaxFeesPerGas,
|
SuggestedMaxFeesPerGasLowLevel,
|
||||||
|
SuggestedMaxFeesPerGasMediumLevel,
|
||||||
|
SuggestedMaxFeesPerGasHighLevel,
|
||||||
|
SuggestedMinPriorityFee,
|
||||||
|
SuggestedMaxPriorityFee,
|
||||||
|
CurrentBaseFee,
|
||||||
TxNonce,
|
TxNonce,
|
||||||
TxMaxFeesPerGas,
|
TxMaxFeesPerGas,
|
||||||
TxBaseFee,
|
TxBaseFee,
|
||||||
@ -70,7 +75,12 @@ QtObject:
|
|||||||
ModelRole.AmountIn.int: "amountIn",
|
ModelRole.AmountIn.int: "amountIn",
|
||||||
ModelRole.AmountInLocked.int: "amountInLocked",
|
ModelRole.AmountInLocked.int: "amountInLocked",
|
||||||
ModelRole.AmountOut.int: "amountOut",
|
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.TxNonce.int: "txNonce",
|
||||||
ModelRole.TxMaxFeesPerGas.int: "txMaxFeesPerGas",
|
ModelRole.TxMaxFeesPerGas.int: "txMaxFeesPerGas",
|
||||||
ModelRole.TxBaseFee.int: "txBaseFee",
|
ModelRole.TxBaseFee.int: "txBaseFee",
|
||||||
@ -128,8 +138,18 @@ QtObject:
|
|||||||
result = newQVariant(item.amountInLocked)
|
result = newQVariant(item.amountInLocked)
|
||||||
of ModelRole.AmountOut:
|
of ModelRole.AmountOut:
|
||||||
result = newQVariant(item.amountOut)
|
result = newQVariant(item.amountOut)
|
||||||
of ModelRole.SuggestedLevelsForMaxFeesPerGas:
|
of ModelRole.SuggestedMaxFeesPerGasLowLevel:
|
||||||
result = newQVariant(item.suggestedLevelsForMaxFeesPerGas)
|
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:
|
of ModelRole.TxNonce:
|
||||||
result = newQVariant(item.txNonce)
|
result = newQVariant(item.txNonce)
|
||||||
of ModelRole.TxMaxFeesPerGas:
|
of ModelRole.TxMaxFeesPerGas:
|
||||||
|
@ -32,6 +32,9 @@ type
|
|||||||
amountOut*: UInt256
|
amountOut*: UInt256
|
||||||
|
|
||||||
suggestedLevelsForMaxFeesPerGas*: SuggestedLevelsForMaxFeesPerGasDto
|
suggestedLevelsForMaxFeesPerGas*: SuggestedLevelsForMaxFeesPerGasDto
|
||||||
|
suggestedMinPriorityFee*: UInt256
|
||||||
|
suggestedMaxPriorityFee*: UInt256
|
||||||
|
currentBaseFee*: UInt256
|
||||||
|
|
||||||
txNonce*: UInt256
|
txNonce*: UInt256
|
||||||
txMaxFeesPerGas*: UInt256
|
txMaxFeesPerGas*: UInt256
|
||||||
@ -82,6 +85,9 @@ proc toTransactionPathDtoV2*(jsonObj: JsonNode): TransactionPathDtoV2 =
|
|||||||
discard jsonObj.getProp("AmountInLocked", result.amountInLocked)
|
discard jsonObj.getProp("AmountInLocked", result.amountInLocked)
|
||||||
result.amountOut = stint.fromHex(UInt256, jsonObj{"AmountOut"}.getStr)
|
result.amountOut = stint.fromHex(UInt256, jsonObj{"AmountOut"}.getStr)
|
||||||
result.suggestedLevelsForMaxFeesPerGas = jsonObj["SuggestedLevelsForMaxFeesPerGas"].toSuggestedLevelsForMaxFeesPerGasDto()
|
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.txNonce = stint.fromHex(UInt256, jsonObj{"TxNonce"}.getStr)
|
||||||
result.txMaxFeesPerGas = stint.fromHex(UInt256, jsonObj{"TxMaxFeesPerGas"}.getStr)
|
result.txMaxFeesPerGas = stint.fromHex(UInt256, jsonObj{"TxMaxFeesPerGas"}.getStr)
|
||||||
result.txBaseFee = stint.fromHex(UInt256, jsonObj{"TxBaseFee"}.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