From 8fbda6e093088ac2b3a289e2a9a6e48a6e578bf9 Mon Sep 17 00:00:00 2001 From: Philemon Ukane Date: Tue, 15 Oct 2024 16:43:50 +0100 Subject: [PATCH] enable dex mainnet Signed-off-by: Philemon Ukane --- libwallet/assets_manager.go | 4 ++-- ui/page/dcrdex/dcrdex_page.go | 29 +++++------------------------ ui/values/localizable/en.go | 1 - ui/values/strings.go | 1 - 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/libwallet/assets_manager.go b/libwallet/assets_manager.go index d00e51562..176a9f087 100644 --- a/libwallet/assets_manager.go +++ b/libwallet/assets_manager.go @@ -907,8 +907,8 @@ func (mgr *AssetsManager) DEXCInitialized() bool { // initialized first so the DEX client can bind previously added wallets when it // starts. func (mgr *AssetsManager) InitializeDEX(ctx context.Context) { - // Ignore attempts to InitializeDEX on mainnet and on mobile. - if mgr.NetType() == utils.Mainnet || appos.Current().IsMobile() { + // Ignore attempts to InitializeDEX on mobile. + if appos.Current().IsMobile() { return } diff --git a/ui/page/dcrdex/dcrdex_page.go b/ui/page/dcrdex/dcrdex_page.go index 698fe46d0..27b29610b 100644 --- a/ui/page/dcrdex/dcrdex_page.go +++ b/ui/page/dcrdex/dcrdex_page.go @@ -11,7 +11,6 @@ import ( "github.com/crypto-power/cryptopower/ui/cryptomaterial" "github.com/crypto-power/cryptopower/ui/load" "github.com/crypto-power/cryptopower/ui/page/components" - "github.com/crypto-power/cryptopower/ui/page/settings" "github.com/crypto-power/cryptopower/ui/values" ) @@ -27,7 +26,6 @@ type DEXPage struct { *load.Load - switchToTestnetBtn cryptomaterial.Button openTradeMainPage *cryptomaterial.Clickable splashPageInfoButton cryptomaterial.IconButton splashPageContainer *widget.List @@ -47,9 +45,8 @@ func NewDEXPage(l *load.Load) *DEXPage { Alignment: layout.Middle, Axis: layout.Vertical, }}, - showSplashPage: true, - switchToTestnetBtn: l.Theme.Button(values.String(values.StrSwitchToTestnet)), - materialLoader: material.Loader(l.Theme.Base), + showSplashPage: true, + materialLoader: material.Loader(l.Theme.Base), } if dp.AssetsManager.DEXCInitialized() && dp.AssetsManager.DexClient().InitializedWithPassword() { @@ -117,8 +114,7 @@ func (pg *DEXPage) prepareInitialPage() { // eventually drawn on screen. // Part of the load.Page interface. func (pg *DEXPage) Layout(gtx C) D { - isMainnet := pg.AssetsManager.NetType() == libutils.Mainnet - if !isMainnet && (!pg.AssetsManager.DEXCInitialized() || pg.CurrentPage() == nil) { // dexc must have been reset. + if !pg.AssetsManager.DEXCInitialized() || pg.CurrentPage() == nil { // dexc must have been reset. pg.showSplashPage = true if !pg.dexIsLoading { pg.ParentNavigator().CloseAllPages() @@ -132,19 +128,8 @@ func (pg *DEXPage) Layout(gtx C) D { }) } - var msg string - var actionBtn *cryptomaterial.Button - if isMainnet { - if pg.CanChangeNetworkType() { - actionBtn = &pg.switchToTestnetBtn - } - msg = values.String(values.StrDexMainnetNotReady) - } else if hasMultipleWallets := pg.isMultipleAssetTypeWalletAvailable(); !hasMultipleWallets { - msg = values.String(values.StrMultipleAssetRequiredMsg) - } - - if msg != "" { - return components.DisablePageWithOverlay(pg.Load, nil, gtx, msg, "", actionBtn) + if hasMultipleWallets := pg.isMultipleAssetTypeWalletAvailable(); !hasMultipleWallets { + return components.DisablePageWithOverlay(pg.Load, nil, gtx, values.String(values.StrMultipleAssetRequiredMsg), "", nil) } return pg.CurrentPage().Layout(gtx) @@ -170,10 +155,6 @@ func (pg *DEXPage) isMultipleAssetTypeWalletAvailable() bool { // page's UI components shortly before they are displayed. // Part of the load.Page interface. func (pg *DEXPage) HandleUserInteractions(gtx C) { - if pg.switchToTestnetBtn.Button.Clicked(gtx) { - settings.ChangeNetworkType(pg.Load, pg.ParentWindow(), string(libutils.Testnet)) - } - if pg.CurrentPage() != nil { pg.CurrentPage().HandleUserInteractions(gtx) } diff --git a/ui/values/localizable/en.go b/ui/values/localizable/en.go index 86e25f17c..990a79dae 100644 --- a/ui/values/localizable/en.go +++ b/ui/values/localizable/en.go @@ -926,7 +926,6 @@ const EN = ` "destinationWallet" = "Destination Wallet" "switchToMainnet" = "Switch to Mainnet" "switchToTestnet" = "Switch to Testnet" -"dexMainnetNotReady" = "DCRDEX is currently in beta testing and has been disabled on mainnet to prevent potential loss of funds. Please switch to testnet to try it out." "updateDEXWalletPasswordReason" = "Your %s wallet (%s) is connected to your DEX account. Please provide your DEX password to update DEX with the new wallet password." "loginDEXForActiveOrdersOrExpiredBonds" = "You have one or more active orders and/or expired bonds waiting to be refunded, login to DEX now!" "walletsNeedToSync" = "Wallet(s) need to sync" diff --git a/ui/values/strings.go b/ui/values/strings.go index 0de231fe0..c4b141221 100644 --- a/ui/values/strings.go +++ b/ui/values/strings.go @@ -1035,7 +1035,6 @@ const ( StrDestinationWallet = "destinationWallet" StrSwitchToMainnet = "switchToMainnet" StrSwitchToTestnet = "switchToTestnet" - StrDexMainnetNotReady = "dexMainnetNotReady" StrUpdateDEXWalletPasswordReason = "updateDEXWalletPasswordReason" StrLoginDEXForActiveOrdersOrExpiredBonds = "loginDEXForActiveOrdersOrExpiredBonds" StrWalletsNeedToSync = "walletsNeedToSync"