mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
CWA-169 | added try-catch to calculateAmount() in MorphTokenExchangeProvider
This commit is contained in:
@@ -214,8 +214,12 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
|
||||
final response = await get(url);
|
||||
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
|
||||
final rate = responseJSON['data'][from.toString()][to.toString()] as String;
|
||||
final estimatedAmount = double.parse(rate) * amount;
|
||||
|
||||
return estimatedAmount;
|
||||
try {
|
||||
final estimatedAmount = double.parse(rate) * amount;
|
||||
return estimatedAmount;
|
||||
} catch(e) {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user