navcoin / WhisperWallet

Whisper Wallet
5 stars 4 forks source link

Option to show fiat value #52

Open aguycalled opened 2 years ago

aguycalled commented 2 years ago

User should be able to tap on the balance circle to switch between NAV or FIAT value.

Wallet can fetch the price from https://api.coingecko.com/api/v3/simple/price?ids=nav-coin&vs_currencies=CURRENCY, with currency being one of:

                    "BTC"
                    "EUR"
                    "USD"
                    "ARS"
                    "AUD"
                    "BRL"
                    "CAD"
                    "CHF"
                    "CLP"
                    "CZK"
                    "DKK"
                    "GBP"
                    "HKD"
                    "HUF"
                    "IDR"
                    "ILS"
                    "INR"
                    "JPY"
                    "KRW"
                    "MXN"
                    "MYR"
                    "NOK"
                    "NZD"
                    "PHP"
                    "PKR"
                    "PLN"
                    "RUB"
                    "SEK"
                    "SGD"
                    "THB"
                    "TRY"
                    "TWD"
                    "ZAR"

User should be able to set the currency through the Settings screen.

tsejerome commented 2 years ago

Shd a wallet contain mulitple fiat? If the wallet is currently in USD, will the amount in BTC be displayed? Do we need to refresh the wallet once we switch the fiat? Is there any logic from the useWallet function or from navcoin-js that can handle this issue? Thanks!

Side note: I think switching fiat is a major case (?) So it shd be in main wallet screen instead of settings screen

aguycalled commented 2 years ago

I think only conversion to one currency at the same time might occur.

If the currency is switched, then, if the main wallet is set to show fiat instead of NAV, it should show the chosen currency. So it would show totalValue * fiatRate. fiatRate is read from the coingecko API, which allows fetching multiple currencies at the same time, for example:

https://api.coingecko.com/api/v3/simple/price?ids=nav-coin&vs_currencies=USD,EUR

So switching the currency would not need additional fetches but just setting the fiatRate multiplier.

I would not complicate the main screen with more elements. How do you think it'd be integrated there instead of in settings?

tsejerome commented 2 years ago

Sounds like a fun feature, I will work on it these two days

tsejerome commented 2 years ago

I think it won't complicate the main screen a lot as long as we use hooks to handle it, which if we use settings page, we wud still use hooks

tsejerome commented 2 years ago

Sounds like a fun feature, I will work on it these two days

Conscious decision after discussing with @aguycalled Will work on this earliest next week as we want to focus on stability for android + KO current PRs first, e.g. https://github.com/navcoin/WhisperWallet/pull/82 and https://github.com/navcoin/WhisperWallet/pull/74

aguycalled commented 2 years ago

I think it won't complicate the main screen a lot as long as we use hooks to handle it, which if we use settings page, we wud still use hooks

I mean how would one pick which of the fiat currencies to use for the conversion from the main screen.