mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-10 14:26:34 +00:00
chore(wallet): aligning to the changes done on the statusgo side for setting custom fees
Setting custom fees feature is not part of these changes, will be developed later.
This commit is contained in:
parent
febe08882d
commit
630c75401f
@ -123,24 +123,28 @@ proc convertTransactionPathDtoV2ToPathItem(self: Module, txPath: TransactionPath
|
||||
amountInLocked = txPath.amountInLocked,
|
||||
amountOut = $txPath.amountOut,
|
||||
suggestedLevelsForMaxFeesPerGas = self.convertFeeLevelsDtoToMaxFeeLevelsItem(txPath.suggestedLevelsForMaxFeesPerGas),
|
||||
maxFeesPerGas = $txPath.maxFeesPerGas,
|
||||
txNonce = $txPath.txNonce,
|
||||
txMaxFeesPerGas = $txPath.txMaxFeesPerGas,
|
||||
txBaseFee = $txPath.txBaseFee,
|
||||
txPriorityFee = $txPath.txPriorityFee,
|
||||
txGasAmount = $txPath.txGasAmount,
|
||||
txBonderFees = $txPath.txBonderFees,
|
||||
txTokenFees = $txPath.txTokenFees,
|
||||
txEstimatedTime = txPath.txEstimatedTime,
|
||||
txFee = $txPath.txFee,
|
||||
txL1Fee = $txPath.txL1Fee,
|
||||
approvalRequired = txPath.approvalRequired,
|
||||
approvalAmountRequired = $txPath.approvalAmountRequired,
|
||||
approvalContractAddress = txPath.approvalContractAddress,
|
||||
approvalTxNonce = $txPath.approvalTxNonce,
|
||||
approvalMaxFeesPerGas = $txPath.approvalMaxFeesPerGas,
|
||||
approvalBaseFee = $txPath.approvalBaseFee,
|
||||
approvalPriorityFee = $txPath.approvalPriorityFee,
|
||||
approvalGasAmount = $txPath.approvalGasAmount,
|
||||
approvalEstimatedTime = txPath.approvalEstimatedTime,
|
||||
approvalFee = $txPath.approvalFee,
|
||||
approvalL1Fee = $txPath.approvalL1Fee,
|
||||
txTotalFee = $txPath.txTotalFee,
|
||||
estimatedTime = txPath.estimatedTime
|
||||
txTotalFee = $txPath.txTotalFee
|
||||
)
|
||||
|
||||
proc buildTransactionsFromRoute(self: Module) =
|
||||
|
@ -1,5 +1,6 @@
|
||||
import NimQml
|
||||
|
||||
import app_service/common/wallet_constants
|
||||
import ./max_fee_levels_item
|
||||
|
||||
QtObject:
|
||||
@ -13,22 +14,26 @@ QtObject:
|
||||
amountInLocked: bool
|
||||
amountOut: string
|
||||
suggestedLevelsForMaxFeesPerGas: MaxFeeLevelsItem
|
||||
maxFeesPerGas: string
|
||||
txNonce: string
|
||||
txMaxFeesPerGas: string
|
||||
txBaseFee: string
|
||||
txPriorityFee: string
|
||||
txGasAmount: string
|
||||
txBonderFees: string
|
||||
txTokenFees: string
|
||||
txEstimatedTime: int
|
||||
txFee: string
|
||||
txL1Fee: string
|
||||
txTotalFee: string
|
||||
estimatedTime: int
|
||||
approvalRequired: bool
|
||||
approvalAmountRequired : string
|
||||
approvalContractAddress: string
|
||||
approvalTxNonce: string
|
||||
approvalMaxFeesPerGas: string
|
||||
approvalBaseFee: string
|
||||
approvalPriorityFee: string
|
||||
approvalGasAmount: string
|
||||
approvalEstimatedTime: int
|
||||
approvalFee: string
|
||||
approvalL1Fee: string
|
||||
|
||||
@ -42,22 +47,26 @@ QtObject:
|
||||
amountInLocked: bool,
|
||||
amountOut: string,
|
||||
suggestedLevelsForMaxFeesPerGas: MaxFeeLevelsItem,
|
||||
maxFeesPerGas: string,
|
||||
txNonce: string,
|
||||
txMaxFeesPerGas: string,
|
||||
txBaseFee: string,
|
||||
txPriorityFee: string,
|
||||
txGasAmount: string,
|
||||
txBonderFees: string,
|
||||
txTokenFees: string,
|
||||
txEstimatedTime: int,
|
||||
txFee: string,
|
||||
txL1Fee: string,
|
||||
txTotalFee: string,
|
||||
estimatedTime: int,
|
||||
approvalRequired: bool,
|
||||
approvalAmountRequired: string,
|
||||
approvalContractAddress: string,
|
||||
approvalTxNonce: string,
|
||||
approvalMaxFeesPerGas: string,
|
||||
approvalBaseFee: string,
|
||||
approvalPriorityFee: string,
|
||||
approvalGasAmount: string,
|
||||
approvalEstimatedTime: int,
|
||||
approvalFee: string,
|
||||
approvalL1Fee: string
|
||||
) =
|
||||
@ -71,22 +80,26 @@ QtObject:
|
||||
self.amountInLocked = amountInLocked
|
||||
self.amountOut = amountOut
|
||||
self.suggestedLevelsForMaxFeesPerGas = suggestedLevelsForMaxFeesPerGas
|
||||
self.maxFeesPerGas = maxFeesPerGas
|
||||
self.txNonce = txNonce
|
||||
self.txMaxFeesPerGas = txMaxFeesPerGas
|
||||
self.txBaseFee = txBaseFee
|
||||
self.txPriorityFee = txPriorityFee
|
||||
self.txGasAmount = txGasAmount
|
||||
self.txBonderFees = txBonderFees
|
||||
self.txTokenFees = txTokenFees
|
||||
self.txEstimatedTime = txEstimatedTime
|
||||
self.txFee = txFee
|
||||
self.txL1Fee = txL1Fee
|
||||
self.txTotalFee = txTotalFee
|
||||
self.estimatedTime = estimatedTime
|
||||
self.approvalRequired = approvalRequired
|
||||
self.approvalAmountRequired = approvalAmountRequired
|
||||
self.approvalContractAddress = approvalContractAddress
|
||||
self.approvalTxNonce = approvalTxNonce
|
||||
self.approvalMaxFeesPerGas = approvalMaxFeesPerGas
|
||||
self.approvalBaseFee = approvalBaseFee
|
||||
self.approvalPriorityFee = approvalPriorityFee
|
||||
self.approvalGasAmount = approvalGasAmount
|
||||
self.approvalEstimatedTime = approvalEstimatedTime
|
||||
self.approvalFee = approvalFee
|
||||
self.approvalL1Fee = approvalL1Fee
|
||||
|
||||
@ -103,32 +116,35 @@ QtObject:
|
||||
amountInLocked: bool,
|
||||
amountOut: string,
|
||||
suggestedLevelsForMaxFeesPerGas: MaxFeeLevelsItem,
|
||||
maxFeesPerGas: string,
|
||||
txNonce: string,
|
||||
txMaxFeesPerGas: string,
|
||||
txBaseFee: string,
|
||||
txPriorityFee: string,
|
||||
txGasAmount: string,
|
||||
txBonderFees: string,
|
||||
txTokenFees: string,
|
||||
txEstimatedTime: int,
|
||||
txFee: string,
|
||||
txL1Fee: string,
|
||||
txTotalFee: string,
|
||||
estimatedTime: int,
|
||||
approvalRequired: bool,
|
||||
approvalAmountRequired: string,
|
||||
approvalContractAddress: string,
|
||||
approvalTxNonce: string,
|
||||
approvalMaxFeesPerGas: string,
|
||||
approvalBaseFee: string,
|
||||
approvalPriorityFee: string,
|
||||
approvalGasAmount: string,
|
||||
approvalEstimatedTime: int,
|
||||
approvalFee: string,
|
||||
approvalL1Fee: string
|
||||
): PathItem =
|
||||
new(result, delete)
|
||||
result.setup(processorName, fromChain, toChain, fromToken, toToken,
|
||||
amountIn, amountInLocked, amountOut, suggestedLevelsForMaxFeesPerGas,
|
||||
maxFeesPerGas, txBaseFee,txPriorityFee, txGasAmount, txBonderFees,
|
||||
txTokenFees, txFee, txL1Fee, txTotalFee, estimatedTime, approvalRequired,
|
||||
approvalAmountRequired, approvalContractAddress, approvalBaseFee,
|
||||
approvalPriorityFee, approvalGasAmount, approvalFee, approvalL1Fee)
|
||||
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)
|
||||
|
||||
proc `$`*(self: PathItem): string =
|
||||
result = "PathItem("
|
||||
@ -141,22 +157,26 @@ QtObject:
|
||||
result &= "\namountInLocked: " & $self.amountInLocked
|
||||
result &= "\namountOut: " & $self.amountOut
|
||||
result &= "\nsuggestedLevelsForMaxFeesPerGas: " & $self.suggestedLevelsForMaxFeesPerGas
|
||||
result &= "\nmaxFeesPerGas: " & $self.maxFeesPerGas
|
||||
result &= "\ntxNonce: " & $self.txNonce
|
||||
result &= "\ntxMaxFeesPerGas: " & $self.txMaxFeesPerGas
|
||||
result &= "\ntxBaseFee: " & $self.txBaseFee
|
||||
result &= "\ntxPriorityFee: " & $self.txPriorityFee
|
||||
result &= "\ntxGasAmount: " & $self.txGasAmount
|
||||
result &= "\ntxBonderFees: " & $self.txBonderFees
|
||||
result &= "\ntxTokenFees: " & $self.txTokenFees
|
||||
result &= "\ntxEstimatedTime: " & $self.txEstimatedTime
|
||||
result &= "\ntxFee: " & $self.txFee
|
||||
result &= "\ntxL1Fee: " & $self.txL1Fee
|
||||
result &= "\ntxTotalFee: " & $self.txTotalFee
|
||||
result &= "\nestimatedTime: " & $self.estimatedTime
|
||||
result &= "\napprovalRequired: " & $self.approvalRequired
|
||||
result &= "\napprovalAmountRequired: " & $self.approvalAmountRequired
|
||||
result &= "\napprovalContractAddress: " & $self.approvalContractAddress
|
||||
result &= "\napprovalTxNonce: " & $self.approvalTxNonce
|
||||
result &= "\napprovalMaxFeesPerGas: " & $self.approvalMaxFeesPerGas
|
||||
result &= "\napprovalBaseFee: " & $self.approvalBaseFee
|
||||
result &= "\napprovalPriorityFee: " & $self.approvalPriorityFee
|
||||
result &= "\napprovalGasAmount: " & $self.approvalGasAmount
|
||||
result &= "\napprovalEstimatedTime: " & $self.approvalEstimatedTime
|
||||
result &= "\napprovalFee: " & $self.approvalFee
|
||||
result &= "\napprovalL1Fee: " & $self.approvalL1Fee
|
||||
result &= ")"
|
||||
@ -188,8 +208,11 @@ QtObject:
|
||||
proc suggestedLevelsForMaxFeesPerGas*(self: PathItem): MaxFeeLevelsItem =
|
||||
return self.suggestedLevelsForMaxFeesPerGas
|
||||
|
||||
proc maxFeesPerGas*(self: PathItem): string =
|
||||
return self.maxFeesPerGas
|
||||
proc txNonce*(self: PathItem): string =
|
||||
return self.txNonce
|
||||
|
||||
proc txMaxFeesPerGas*(self: PathItem): string =
|
||||
return self.txMaxFeesPerGas
|
||||
|
||||
proc txBaseFee*(self: PathItem): string =
|
||||
return self.txBaseFee
|
||||
@ -206,6 +229,9 @@ QtObject:
|
||||
proc txTokenFees*(self: PathItem): string =
|
||||
return self.txTokenFees
|
||||
|
||||
proc txEstimatedTime*(self: PathItem): int =
|
||||
return self.txEstimatedTime
|
||||
|
||||
proc txFee*(self: PathItem): string =
|
||||
return self.txFee
|
||||
|
||||
@ -215,9 +241,6 @@ QtObject:
|
||||
proc txTotalFee*(self: PathItem): string =
|
||||
return self.txTotalFee
|
||||
|
||||
proc estimatedTime*(self: PathItem): int =
|
||||
return self.estimatedTime
|
||||
|
||||
proc approvalRequired*(self: PathItem): bool =
|
||||
return self.approvalRequired
|
||||
|
||||
@ -227,6 +250,12 @@ QtObject:
|
||||
proc approvalContractAddress*(self: PathItem): string =
|
||||
return self.approvalContractAddress
|
||||
|
||||
proc approvalTxNonce*(self: PathItem): string =
|
||||
return self.approvalTxNonce
|
||||
|
||||
proc approvalMaxFeesPerGas*(self: PathItem): string =
|
||||
return self.approvalMaxFeesPerGas
|
||||
|
||||
proc approvalBaseFee*(self: PathItem): string =
|
||||
return self.approvalBaseFee
|
||||
|
||||
@ -236,8 +265,18 @@ QtObject:
|
||||
proc approvalGasAmount*(self: PathItem): string =
|
||||
return self.approvalGasAmount
|
||||
|
||||
proc approvalEstimatedTime*(self: PathItem): int =
|
||||
return self.approvalEstimatedTime
|
||||
|
||||
proc approvalFee*(self: PathItem): string =
|
||||
return self.approvalFee
|
||||
|
||||
proc approvalL1Fee*(self: PathItem): string =
|
||||
return self.approvalL1Fee
|
||||
|
||||
proc estimatedTime*(self: PathItem): int =
|
||||
if self.processorName == wallet_constants.PROCESSOR_NAME_SWAP_PARASWAP:
|
||||
return self.txEstimatedTime + self.approvalEstimatedTime
|
||||
if self.processorName == wallet_constants.PROCESSOR_NAME_BRIDGE_HOP:
|
||||
return self.txEstimatedTime + 1
|
||||
return self.txEstimatedTime
|
@ -13,24 +13,29 @@ type
|
||||
AmountInLocked,
|
||||
AmountOut,
|
||||
SuggestedLevelsForMaxFeesPerGas,
|
||||
MaxFeesPerGas,
|
||||
TxNonce,
|
||||
TxMaxFeesPerGas,
|
||||
TxBaseFee,
|
||||
TxPriorityFee,
|
||||
TxGasAmount,
|
||||
TxBonderFees,
|
||||
TxTokenFees,
|
||||
TxEstimatedTime,
|
||||
TxFee,
|
||||
TxL1Fee,
|
||||
TxTotalFee,
|
||||
EstimatedTime,
|
||||
ApprovalRequired,
|
||||
ApprovalAmountRequired,
|
||||
ApprovalContractAddress,
|
||||
ApprovalTxNonce,
|
||||
ApprovalMaxFeesPerGas,
|
||||
ApprovalBaseFee,
|
||||
ApprovalPriorityFee,
|
||||
ApprovalGasAmount,
|
||||
ApprovalEstimatedTime,
|
||||
ApprovalFee,
|
||||
ApprovalL1Fee
|
||||
ApprovalL1Fee,
|
||||
EstimatedTime
|
||||
|
||||
QtObject:
|
||||
type
|
||||
@ -66,24 +71,29 @@ QtObject:
|
||||
ModelRole.AmountInLocked.int: "amountInLocked",
|
||||
ModelRole.AmountOut.int: "amountOut",
|
||||
ModelRole.SuggestedLevelsForMaxFeesPerGas.int: "suggestedLevelsForMaxFeesPerGas",
|
||||
ModelRole.MaxFeesPerGas.int: "maxFeesPerGas",
|
||||
ModelRole.TxNonce.int: "txNonce",
|
||||
ModelRole.TxMaxFeesPerGas.int: "txMaxFeesPerGas",
|
||||
ModelRole.TxBaseFee.int: "txBaseFee",
|
||||
ModelRole.TxPriorityFee.int: "txPriorityFee",
|
||||
ModelRole.TxGasAmount.int: "txGasAmount",
|
||||
ModelRole.TxBonderFees.int: "txBonderFees",
|
||||
ModelRole.TxTokenFees.int: "txTokenFees",
|
||||
ModelRole.TxEstimatedTime.int: "txEstimatedTime",
|
||||
ModelRole.TxFee.int: "txFee",
|
||||
ModelRole.TxL1Fee.int: "txL1Fee",
|
||||
ModelRole.TxTotalFee.int: "txTotalFee",
|
||||
ModelRole.EstimatedTime.int: "estimatedTime",
|
||||
ModelRole.ApprovalRequired.int: "approvalRequired",
|
||||
ModelRole.ApprovalAmountRequired.int: "approvalAmountRequired",
|
||||
ModelRole.ApprovalContractAddress.int: "approvalContractAddress",
|
||||
ModelRole.ApprovalTxNonce.int: "approvalTxNonce",
|
||||
ModelRole.ApprovalMaxFeesPerGas.int: "approvalMaxFeesPerGas",
|
||||
ModelRole.ApprovalBaseFee.int: "approvalBaseFee",
|
||||
ModelRole.ApprovalPriorityFee.int: "approvalPriorityFee",
|
||||
ModelRole.ApprovalGasAmount.int: "approvalGasAmount",
|
||||
ModelRole.ApprovalEstimatedTime.int: "approvalEstimatedTime",
|
||||
ModelRole.ApprovalFee.int: "approvalFee",
|
||||
ModelRole.ApprovalL1Fee.int: "approvalL1Fee",
|
||||
ModelRole.EstimatedTime.int: "estimatedTime"
|
||||
}.toTable
|
||||
|
||||
proc setItems*(self: PathModel, items: seq[PathItem]) =
|
||||
@ -120,8 +130,10 @@ QtObject:
|
||||
result = newQVariant(item.amountOut)
|
||||
of ModelRole.SuggestedLevelsForMaxFeesPerGas:
|
||||
result = newQVariant(item.suggestedLevelsForMaxFeesPerGas)
|
||||
of ModelRole.MaxFeesPerGas:
|
||||
result = newQVariant(item.maxFeesPerGas)
|
||||
of ModelRole.TxNonce:
|
||||
result = newQVariant(item.txNonce)
|
||||
of ModelRole.TxMaxFeesPerGas:
|
||||
result = newQVariant(item.txMaxFeesPerGas)
|
||||
of ModelRole.TxBaseFee:
|
||||
result = newQVariant(item.txBaseFee)
|
||||
of ModelRole.TxPriorityFee:
|
||||
@ -132,29 +144,37 @@ QtObject:
|
||||
result = newQVariant(item.txBonderFees)
|
||||
of ModelRole.TxTokenFees:
|
||||
result = newQVariant(item.txTokenFees)
|
||||
of ModelRole.TxEstimatedTime:
|
||||
result = newQVariant(item.txEstimatedTime)
|
||||
of ModelRole.TxFee:
|
||||
result = newQVariant(item.txFee)
|
||||
of ModelRole.TxL1Fee:
|
||||
result = newQVariant(item.txL1Fee)
|
||||
of ModelRole.TxTotalFee:
|
||||
result = newQVariant(item.txTotalFee)
|
||||
of ModelRole.EstimatedTime:
|
||||
result = newQVariant(item.estimatedTime)
|
||||
of ModelRole.ApprovalRequired:
|
||||
result = newQVariant(item.approvalRequired)
|
||||
of ModelRole.ApprovalAmountRequired:
|
||||
result = newQVariant(item.approvalAmountRequired)
|
||||
of ModelRole.ApprovalContractAddress:
|
||||
result = newQVariant(item.approvalContractAddress)
|
||||
of ModelRole.ApprovalTxNonce:
|
||||
result = newQVariant(item.approvalTxNonce)
|
||||
of ModelRole.ApprovalMaxFeesPerGas:
|
||||
result = newQVariant(item.approvalMaxFeesPerGas)
|
||||
of ModelRole.ApprovalBaseFee:
|
||||
result = newQVariant(item.approvalBaseFee)
|
||||
of ModelRole.ApprovalPriorityFee:
|
||||
result = newQVariant(item.approvalPriorityFee)
|
||||
of ModelRole.ApprovalGasAmount:
|
||||
result = newQVariant(item.approvalGasAmount)
|
||||
of ModelRole.ApprovalEstimatedTime:
|
||||
result = newQVariant(item.approvalEstimatedTime)
|
||||
of ModelRole.ApprovalFee:
|
||||
result = newQVariant(item.approvalFee)
|
||||
of ModelRole.ApprovalL1Fee:
|
||||
result = newQVariant(item.approvalL1Fee)
|
||||
of ModelRole.EstimatedTime:
|
||||
result = newQVariant(item.estimatedTime)
|
||||
else:
|
||||
discard
|
||||
|
@ -13,3 +13,14 @@ const
|
||||
|
||||
TX_HASH_LEN* = 32 * 2
|
||||
TX_HASH_LEN_WITH_PREFIX* = TX_HASH_LEN + 2
|
||||
|
||||
PROCESSOR_NAME_TRANSFER* = "Transfer"
|
||||
PROCESSOR_NAME_BRIDGE_HOP* = "Hop"
|
||||
PROCESSOR_NAME_BRIDGE_CELER* = "CBridge"
|
||||
PROCESSOR_NAME_SWAP_PARASWAP* = "Paraswap"
|
||||
PROCESSOR_NAME_ERC721* = "ERC721Transfer"
|
||||
PROCESSOR_NAME_ERC1155* = "ERC1155Transfer"
|
||||
PROCESSOR_NAME_ENS_REGISTER* = "ENSRegister"
|
||||
PROCESSOR_NAME_ENS_RELEASE* = "ENSRelease"
|
||||
PROCESSOR_NAME_ENS_PUBLIC_KEY* = "ENSPublicKey"
|
||||
PROCESSOR_NAME_STICKERS_BUY* = "StickersBuy"
|
@ -21,6 +21,7 @@ type
|
||||
|
||||
type
|
||||
TransactionPathDtoV2* = ref object
|
||||
routerInputParamsUuid*: string
|
||||
processorName*: string
|
||||
fromChain*: NetworkDto
|
||||
toChain*: NetworkDto
|
||||
@ -29,25 +30,35 @@ type
|
||||
amountIn*: UInt256
|
||||
amountInLocked*: bool
|
||||
amountOut*: UInt256
|
||||
|
||||
suggestedLevelsForMaxFeesPerGas*: SuggestedLevelsForMaxFeesPerGasDto
|
||||
maxFeesPerGas*: UInt256
|
||||
|
||||
txNonce*: UInt256
|
||||
txMaxFeesPerGas*: UInt256
|
||||
txBaseFee*: UInt256
|
||||
txPriorityFee*: UInt256
|
||||
txGasAmount*: uint64
|
||||
txBonderFees*: UInt256
|
||||
txTokenFees*: UInt256
|
||||
txEstimatedTime*: int
|
||||
|
||||
txFee*: UInt256
|
||||
txL1Fee*: UInt256
|
||||
|
||||
approvalRequired*: bool
|
||||
approvalAmountRequired*: UInt256
|
||||
approvalContractAddress*: string
|
||||
approvalTxNonce*: UInt256
|
||||
approvalMaxFeesPerGas*: UInt256
|
||||
approvalBaseFee*: UInt256
|
||||
approvalPriorityFee*: UInt256
|
||||
approvalGasAmount*: uint64
|
||||
approvalEstimatedTime*: int
|
||||
|
||||
approvalFee*: UInt256
|
||||
approvalL1Fee*: UInt256
|
||||
|
||||
txTotalFee*: UInt256
|
||||
estimatedTime*: int
|
||||
|
||||
proc toSuggestedLevelsForMaxFeesPerGasDto*(jsonObj: JsonNode): SuggestedLevelsForMaxFeesPerGasDto =
|
||||
result = SuggestedLevelsForMaxFeesPerGasDto()
|
||||
@ -61,6 +72,7 @@ proc toSuggestedLevelsForMaxFeesPerGasDto*(jsonObj: JsonNode): SuggestedLevelsFo
|
||||
|
||||
proc toTransactionPathDtoV2*(jsonObj: JsonNode): TransactionPathDtoV2 =
|
||||
result = TransactionPathDtoV2()
|
||||
discard jsonObj.getProp("RouterInputParamsUuid", result.routerInputParamsUuid)
|
||||
discard jsonObj.getProp("ProcessorName", result.processorName)
|
||||
result.fromChain = Json.decode($jsonObj["FromChain"], NetworkDto, allowUnknownFields = true)
|
||||
result.toChain = Json.decode($jsonObj["ToChain"], NetworkDto, allowUnknownFields = true)
|
||||
@ -70,24 +82,28 @@ 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.maxFeesPerGas = stint.fromHex(UInt256, jsonObj{"MaxFeesPerGas"}.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)
|
||||
result.txPriorityFee = stint.fromHex(UInt256, jsonObj{"TxPriorityFee"}.getStr)
|
||||
discard jsonObj.getProp("TxGasAmount", result.txGasAmount)
|
||||
result.txBonderFees = stint.fromHex(UInt256, jsonObj{"TxBonderFees"}.getStr)
|
||||
result.txTokenFees = stint.fromHex(UInt256, jsonObj{"TxTokenFees"}.getStr)
|
||||
discard jsonObj.getProp("TxEstimatedTime", result.txEstimatedTime)
|
||||
result.txFee = stint.fromHex(UInt256, jsonObj{"TxFee"}.getStr)
|
||||
result.txL1Fee = stint.fromHex(UInt256, jsonObj{"TxL1Fee"}.getStr)
|
||||
discard jsonObj.getProp("ApprovalRequired", result.approvalRequired)
|
||||
result.approvalAmountRequired = stint.fromHex(UInt256, jsonObj{"ApprovalAmountRequired"}.getStr)
|
||||
discard jsonObj.getProp("ApprovalContractAddress", result.approvalContractAddress)
|
||||
result.approvalTxNonce = stint.fromHex(UInt256, jsonObj{"ApprovalTxNonce"}.getStr)
|
||||
result.approvalMaxFeesPerGas = stint.fromHex(UInt256, jsonObj{"ApprovalMaxFeesPerGas"}.getStr)
|
||||
result.approvalBaseFee = stint.fromHex(UInt256, jsonObj{"ApprovalBaseFee"}.getStr)
|
||||
result.approvalPriorityFee = stint.fromHex(UInt256, jsonObj{"ApprovalPriorityFee"}.getStr)
|
||||
discard jsonObj.getProp("ApprovalGasAmount", result.approvalGasAmount)
|
||||
discard jsonObj.getProp("ApprovalEstimatedTime", result.approvalEstimatedTime)
|
||||
result.approvalFee = stint.fromHex(UInt256, jsonObj{"ApprovalFee"}.getStr)
|
||||
result.approvalL1Fee = stint.fromHex(UInt256, jsonObj{"ApprovalL1Fee"}.getStr)
|
||||
result.txTotalFee = stint.fromHex(UInt256, jsonObj{"TxTotalFee"}.getStr)
|
||||
result.estimatedTime = jsonObj{"EstimatedTime"}.getInt
|
||||
|
||||
proc toTransactionPathsDtoV2*(jsonObj: JsonNode): seq[TransactionPathDtoV2] =
|
||||
return jsonObj.getElems().map(x => x.toTransactionPathDtoV2())
|
||||
|
@ -1,6 +1,6 @@
|
||||
import strutils, stint, chronicles, algorithm
|
||||
|
||||
import app_service/common/conversion
|
||||
import app_service/common/[conversion, wallet_constants]
|
||||
|
||||
import ./dto, ./dtoV2
|
||||
|
||||
@ -60,9 +60,15 @@ proc convertToOldRoute*(route: seq[TransactionPathDtoV2]): seq[TransactionPathDt
|
||||
trPath.approvalAmountRequired = p.approvalAmountRequired
|
||||
trPath.approvalContractAddress = p.approvalContractAddress
|
||||
trPath.amountInLocked = p.amountInLocked
|
||||
trPath.estimatedTime = p.estimatedTime
|
||||
trPath.gasAmount = p.txGasAmount
|
||||
|
||||
if p.processorName == wallet_constants.PROCESSOR_NAME_SWAP_PARASWAP:
|
||||
trPath.estimatedTime = p.txEstimatedTime + p.approvalEstimatedTime
|
||||
elif p.processorName == wallet_constants.PROCESSOR_NAME_BRIDGE_HOP:
|
||||
trPath.estimatedTime = p.txEstimatedTime + 1
|
||||
else:
|
||||
trPath.estimatedTime = p.txEstimatedTime
|
||||
|
||||
value = conversion.wei2Eth(p.suggestedLevelsForMaxFeesPerGas.medium, decimals = ethDecimals)
|
||||
trPath.approvalGasFees = parseFloat(value) * float64(p.approvalGasAmount)
|
||||
value = conversion.wei2Eth(p.approvalL1Fee, decimals = ethDecimals)
|
||||
|
@ -391,10 +391,15 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
readonly property var estimatedTimeAggregator: SumAggregator {
|
||||
|
||||
readonly property var estimatedTimeAggregator: FunctionAggregator {
|
||||
model: !!backendHandler.fetchedPathModel ?
|
||||
backendHandler.fetchedPathModel: null
|
||||
initialValue: Constants.TransactionEstimatedTime.Unknown
|
||||
roleName: "estimatedTime"
|
||||
|
||||
aggregateFunction: (aggr, value) => aggr < value? value : aggr
|
||||
|
||||
onValueChanged: {
|
||||
simpleSendModal.estimatedTime = WalletUtils.getLabelForEstimatedTxTime(value)
|
||||
}
|
||||
|
2
vendor/status-go
vendored
2
vendor/status-go
vendored
@ -1 +1 @@
|
||||
Subproject commit f7d73be2edf5edb51e6d09599ef83a53b9500ffc
|
||||
Subproject commit 73aadcbcafc346751a9cc4bf16ffc9ccffa45b2f
|
Loading…
x
Reference in New Issue
Block a user