mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-02-03 11:46:35 +00:00
CWA-169 | added try-catch to calculateAmount() in MorphTokenExchangeProvider
This commit is contained in:
parent
d80123d960
commit
eb875b1321
1 changed files with 6 additions and 2 deletions
|
@ -214,8 +214,12 @@ class MorphTokenExchangeProvider extends ExchangeProvider {
|
||||||
final response = await get(url);
|
final response = await get(url);
|
||||||
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
|
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
|
||||||
final rate = responseJSON['data'][from.toString()][to.toString()] as String;
|
final rate = responseJSON['data'][from.toString()][to.toString()] as String;
|
||||||
final estimatedAmount = double.parse(rate) * amount;
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
final estimatedAmount = double.parse(rate) * amount;
|
||||||
return estimatedAmount;
|
return estimatedAmount;
|
||||||
|
} catch(e) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue