fix(@desktop/communitytokens): fix converting json to dto

Fix #14307
This commit is contained in:
Michal Iskierko 2024-04-05 16:09:53 +02:00 committed by Michał Iskierko
parent ff79646dd3
commit 5f2193b2c5
1 changed files with 4 additions and 2 deletions

View File

@ -196,7 +196,8 @@ proc decodeSuggestedFeesDto*(jsonObj: JsonNode): SuggestedFeesDto =
result.maxFeePerGasL = jsonObj{"maxFeePerGasL"}.getFloat
result.maxFeePerGasM = jsonObj{"maxFeePerGasM"}.getFloat
result.maxFeePerGasH = jsonObj{"maxFeePerGasH"}.getFloat
result.l1GasFee = jsonObj{"l1GasFee"}.getFloat
if jsonObj.hasKey("l1GasFee"):
result.l1GasFee = jsonObj{"l1GasFee"}.getFloat
result.eip1559Enabled = jsonObj{"eip1559Enabled"}.getbool
proc toSuggestedFeesDto*(jsonObj: JsonNode): SuggestedFeesDto =
@ -207,7 +208,8 @@ proc toSuggestedFeesDto*(jsonObj: JsonNode): SuggestedFeesDto =
result.maxFeePerGasL = parseFloat(jsonObj{"maxFeePerGasLow"}.getStr)
result.maxFeePerGasM = parseFloat(jsonObj{"maxFeePerGasMedium"}.getStr)
result.maxFeePerGasH = parseFloat(jsonObj{"maxFeePerGasHigh"}.getStr)
result.l1GasFee = parseFloat(jsonObj{"l1GasFee"}.getStr)
if jsonObj.hasKey("l1GasFee"):
result.l1GasFee = parseFloat(jsonObj{"l1GasFee"}.getStr)
result.eip1559Enabled = jsonObj{"eip1559Enabled"}.getbool
proc `$`*(self: SuggestedFeesDto): string =