Skip to content

Commit

Permalink
Ana/fix calculatefiatvalue when fiatcurrency not set (#462)
Browse files Browse the repository at this point in the history
* fix calculatefiatvalue when fiatcurrency not set

* improve fix and comment
  • Loading branch information
Bitcoinera authored Mar 17, 2020
1 parent 09879a7 commit 9efa017
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/source/emoneyV0-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ class EMoneyV0API extends TerraV3API {
// We just default to EUR if there is no fiat currency included in the query
// This is because the standard price for NGM tokens given by e-Money team is 0.50€
async calculateFiatValue(balance, selectedFiatCurrency = `EUR`) {
// when fiatCurrency is set in the query as "" or null it doesn't get the default value
if (!selectedFiatCurrency) selectedFiatCurrency = `EUR`

// firt check if the selectedFiatCurrency is a supported currency
if (!supportedFiatCurrencies.has(selectedFiatCurrency)) {
throw new Error(
Expand Down

0 comments on commit 9efa017

Please sign in to comment.