Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeBoy committed May 20, 2024
1 parent fb04f34 commit ca92dce
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 89 deletions.
13 changes: 0 additions & 13 deletions libwallet/ext/rate_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ var (
values.LTCUSDTMarket: {},
}

// binanceMarkets is a map of Binance formatted market to the repo's format,
// e.g BTCUSDT : BTC-USDT. This is to facilitate quick lookup and to/fro
// market name formatting.
// binanceMarkets = make(map[string]string)

// Rates exceeding rateExpiry are expired and should be removed unless there
// was an error fetching a new rate.
rateExpiry = 30 * time.Minute
Expand All @@ -120,14 +115,6 @@ var (
RateRefreshDuration = 60 * time.Minute
)

// Add source.
func init() {
// for market := range supportedMarkets {
// binanceMarketName := strings.ReplaceAll(market, MktSep, "")
// binanceMarkets[binanceMarketName] = market
// }
}

// RateSource is the interface that binds different rate sources. Most of the
// methods are implemented by CommonRateSource, but Refresh is implemented in
// the individual rate source.
Expand Down
13 changes: 0 additions & 13 deletions ui/page/accounts/accounts_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,6 @@ func (pg *Page) OnNavigatedTo() {
func (pg *Page) OnNavigatedFrom() {}

func (pg *Page) fetchExchangeRate() {
// var market string
// switch pg.wallet.GetAssetType() {
// case libutils.DCRWalletAsset:
// market = values.DCRUSDTMarket
// case libutils.BTCWalletAsset:
// market = values.BTCUSDTMarket
// case libutils.LTCWalletAsset:
// market = values.LTCUSDTMarket
// default:
// log.Errorf("Unsupported asset type: %s", pg.wallet.GetAssetType())
// return
// }

market, err := utils.MarketFromAsset(pg.wallet.GetAssetType())
if err != nil {
log.Errorf("Unsupported asset type: %s", pg.wallet.GetAssetType())
Expand Down
12 changes: 0 additions & 12 deletions ui/page/root/home_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,6 @@ func (hp *HomePage) OnNavigatedTo() {
}

if hp.AssetsManager.ExchangeRateFetchingEnabled() {
// Reload the window whenever there is an exchange rate update.
// hp.AssetsManager.RateSource.RemoveRateListener(HomePageID)
// rateListener := &ext.RateListener{
// OnRateUpdated: hp.CalculateAssetsUSDBalance,
// }
// err := hp.AssetsManager.RateSource.AddRateListener(rateListener, HomePageID)
// if err != nil {
// log.Error("RateSource.AddRateListener error: %v", err)
// }

go hp.CalculateAssetsUSDBalance()
}
hp.isBalanceHidden = hp.AssetsManager.IsTotalBalanceVisible()
Expand Down Expand Up @@ -560,8 +550,6 @@ func (hp *HomePage) OnNavigatedFrom() {
activeTab.OnNavigatedFrom()
}

// hp.AssetsManager.RateSource.RemoveRateListener(OverviewPageID)

hp.ctxCancel()
}

Expand Down
13 changes: 0 additions & 13 deletions ui/page/root/overview_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -1207,18 +1207,6 @@ func (pg *OverviewPage) listenForMixerNotifications() {
}
}

// Reload the window whenever there is an exchange rate update.
// pg.AssetsManager.RateSource.RemoveRateListener(OverviewPageID)
// rateListener := &ext.RateListener{
// OnRateUpdated: func() {
// go pg.updateAssetsUSDBalance()
// },
// }
// err := pg.AssetsManager.RateSource.AddRateListener(rateListener, OverviewPageID)
// if err != nil {
// log.Error("RateSource.AddRateListener error: %v", err)
// }

pg.sortedMixerSlideKeys = make([]int, 0)
pg.mixerSliderData = make(map[int]*mixerData)
for _, wal := range wallets {
Expand Down Expand Up @@ -1254,7 +1242,6 @@ func (pg *OverviewPage) stopNtfnListeners() {
}
wal.RemoveTxAndBlockNotificationListener(OverviewPageID)
}
// pg.AssetsManager.RateSource.RemoveRateListener(OverviewPageID)
}

func (pg *OverviewPage) setUnMixedBalance(id int) {
Expand Down
14 changes: 0 additions & 14 deletions ui/page/send/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,20 +291,6 @@ func (pg *Page) fetchExchangeRate() {
return
}
pg.isFetchingExchangeRate = true
// var market string
// switch pg.selectedWallet.GetAssetType() {
// case libUtil.DCRWalletAsset:
// market = values.DCRUSDTMarket
// case libUtil.BTCWalletAsset:
// market = values.BTCUSDTMarket
// case libUtil.LTCWalletAsset:
// market = values.LTCUSDTMarket
// default:
// log.Errorf("Unsupported asset type: %s", pg.selectedWallet.GetAssetType())
// pg.isFetchingExchangeRate = false
// return
// }

market, err := utils.MarketFromAsset(pg.selectedWallet.GetAssetType())
if err != nil {
log.Errorf("Unsupported asset type: %s", pg.selectedWallet.GetAssetType())
Expand Down
14 changes: 0 additions & 14 deletions ui/page/wallet/single_wallet_main_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,20 +226,6 @@ func (swmp *SingleWalletMasterPage) fetchExchangeRate() {
}

swmp.isFetchingExchangeRate = true
// var market string
// switch swmp.selectedWallet.GetAssetType() {
// case libutils.DCRWalletAsset:
// market = values.DCRUSDTMarket
// case libutils.BTCWalletAsset:
// market = values.BTCUSDTMarket
// case libutils.LTCWalletAsset:
// market = values.LTCUSDTMarket
// default:
// log.Errorf("Asset type %q is not supported for exchange rate fetching", swmp.selectedWallet.GetAssetType())
// swmp.isFetchingExchangeRate = false
// return
// }

market, err := utils.MarketFromAsset(swmp.selectedWallet.GetAssetType())
if err != nil {
log.Errorf("Asset type %q is not supported for exchange rate fetching", swmp.selectedWallet.GetAssetType())
Expand Down
10 changes: 0 additions & 10 deletions ui/values/arrays.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@ package values

import "github.com/crypto-power/cryptopower/libwallet/utils"

// These are a list of markets supported by rate sources.
const (
// DCRUSDTMarket = "DCR-USDT"
// BTCUSDTMarket = "BTC-USDT"
// LTCUSDTMarket = "LTC-USDT"
// Current only support Coin with USDT
// DCRBTCMarket = "DCR-BTC"
// LTCBTCMarket = "LTC-BTC"
)

// These are a list of supported rate sources.
const (
DefaultExchangeValue = "none"
Expand Down

0 comments on commit ca92dce

Please sign in to comment.