Skip to content

Commit

Permalink
[models] refs #337 - Set sky and coinHours properties of qWallet prop…
Browse files Browse the repository at this point in the history
…erly

Use FormatCoins
  • Loading branch information
AntiD2ta committed Feb 7, 2020
1 parent fe78b20 commit 20d1203
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/models/walletsManager.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package models

import (
"fmt"
"sync"

"github.com/fibercrypto/fibercryptowallet/src/coin/skycoin/params"
Expand Down Expand Up @@ -874,16 +873,21 @@ func fromWalletToQWallet(wlt core.Wallet, isEncrypted bool) *QWallet {
return qWallet
}

floatBl := float64(bl) / float64(accuracy)
qWallet.SetSky(fmt.Sprint(floatBl))
qWallet.SetSky(util.FormatCoins(bl, accuracy))

bl, err = wlt.GetCryptoAccount().GetBalance(sky.CoinHoursTicker)
if err != nil {
qWallet.SetCoinHours("N/A")
logWalletManager.WithError(err).Error("Couldn't get Coin Hours balance")
return qWallet
}
qWallet.SetCoinHours(fmt.Sprint(bl))
accuracy, err = util.AltcoinQuotient(params.CoinHoursTicker)
if err != nil {
qWallet.SetCoinHours("N/A")
logWalletManager.WithError(err).Error("Couldn't get Coin Hours Altcoin quotient")
return qWallet
}
qWallet.SetCoinHours(util.FormatCoins(bl, accuracy))

return qWallet
}

0 comments on commit 20d1203

Please sign in to comment.