@@ -21,9 +21,7 @@ import (
2121
2222 "github.com/BitBoxSwiss/bitbox-wallet-app/backend/accounts"
2323 "github.com/BitBoxSwiss/bitbox-wallet-app/backend/accounts/errors"
24- "github.com/BitBoxSwiss/bitbox-wallet-app/backend/coins/btc/util"
2524 "github.com/BitBoxSwiss/bitbox-wallet-app/backend/coins/coin"
26- "github.com/BitBoxSwiss/bitbox-wallet-app/backend/rates"
2725 "github.com/BitBoxSwiss/bitbox-wallet-app/util/errp"
2826)
2927
@@ -120,7 +118,6 @@ func (backend *Backend) ChartData() (*Chart, error) {
120118 chartEntriesHourly := map [int64 ]RatChartEntry {}
121119
122120 fiat := backend .Config ().AppConfig ().Backend .MainFiat
123- isFiatBtc := fiat == rates .BTC .String ()
124121
125122 // Chart data until this point in time.
126123 until := backend .RatesUpdater ().HistoryLatestTimestampAll (backend .allCoinCodes (), fiat )
@@ -131,8 +128,6 @@ func (backend *Backend) ChartData() (*Chart, error) {
131128 isUpToDate := time .Since (until ) < 2 * time .Hour
132129 lastTimestamp := until .UnixMilli ()
133130
134- formatBtcAsSat := util .FormatBtcAsSat (backend .Config ().AppConfig ().Backend .BtcUnit )
135-
136131 currentTotal := new (big.Rat )
137132 currentTotalMissing := false
138133 // Total number of transactions across all active accounts.
@@ -245,7 +240,7 @@ func (backend *Backend) ChartData() (*Chart, error) {
245240 result [i ] = ChartEntry {
246241 Time : entry .Time ,
247242 Value : floatValue ,
248- FormattedValue : coin .FormatAsCurrency (entry .RatValue , fiat == rates . BTC . String (), formatBtcAsSat ),
243+ FormattedValue : coin .FormatAsCurrency (entry .RatValue , fiat ),
249244 }
250245 i ++
251246 }
@@ -261,7 +256,7 @@ func (backend *Backend) ChartData() (*Chart, error) {
261256 result = append (result , ChartEntry {
262257 Time : time .Now ().Unix (),
263258 Value : total ,
264- FormattedValue : coin .FormatAsCurrency (currentTotal , isFiatBtc , formatBtcAsSat ),
259+ FormattedValue : coin .FormatAsCurrency (currentTotal , fiat ),
265260 })
266261 }
267262 // Truncate leading zeroes, if there are any keep the first one to start the chart with 0
@@ -285,23 +280,18 @@ func (backend *Backend) ChartData() (*Chart, error) {
285280 chartDataMissing = false
286281 }
287282
288- chartFiat := fiat
289- if isFiatBtc && backend .Config ().AppConfig ().Backend .BtcUnit == coin .BtcUnitSats {
290- chartFiat = "sat"
291- }
292-
293283 var chartTotal * float64
294284 var formattedChartTotal string
295285 if ! currentTotalMissing {
296286 tot , _ := currentTotal .Float64 ()
297287 chartTotal = & tot
298- formattedChartTotal = coin .FormatAsCurrency (currentTotal , isFiatBtc , formatBtcAsSat )
288+ formattedChartTotal = coin .FormatAsCurrency (currentTotal , fiat )
299289 }
300290 return & Chart {
301291 DataMissing : chartDataMissing ,
302292 DataDaily : toSortedSlice (chartEntriesDaily , fiat ),
303293 DataHourly : toSortedSlice (chartEntriesHourly , fiat ),
304- Fiat : chartFiat ,
294+ Fiat : fiat ,
305295 Total : chartTotal ,
306296 FormattedTotal : formattedChartTotal ,
307297 IsUpToDate : isUpToDate ,
0 commit comments