fix(@desktop/wallet): Wallet - Send - Crash after opening send modal

The error seen in the bug is linked to getSuggestedFees returning an rpc error that was unhandled, I think this should resolve this issue.

fixes #6801
This commit is contained in:
Khushboo Mehta 2022-08-30 12:12:35 +02:00 committed by Khushboo-dev-cpp
parent e1c548696f
commit 171b31ad93
1 changed files with 20 additions and 14 deletions

View File

@ -370,6 +370,7 @@ QtObject:
return self.transferTokens(from_addr, to_addr, assetSymbol, value, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, password, chainId, uuid, eip1559Enabled)
proc suggestedFees*(self: Service, chainId: int): SuggestedFees =
try:
let response = eth.suggestedFees(chainId).result
return SuggestedFees(
gasPrice: parseFloat(response{"gasPrice"}.getStr),
@ -380,12 +381,17 @@ QtObject:
maxFeePerGasH: parseFloat(response{"maxFeePerGasHigh"}.getStr),
eip1559Enabled: response{"eip1559Enabled"}.getbool,
)
except Exception as e:
error "Error getting suggested fees", msg = e.msg
proc suggestedRoutes*(self: Service, account: string, amount: float64, token: string, disabledChainIDs: seq[uint64]): SuggestedRoutes =
try:
let response = eth.suggestedRoutes(account, amount, token, disabledChainIDs)
return SuggestedRoutes(
networks: Json.decode($response.result{"networks"}, seq[NetworkDto])
)
except Exception as e:
error "Error getting suggested routes", msg = e.msg
proc fetchCryptoServices*(self: Service): seq[CryptoRampDto] =
try: