From f93340aa57012f33b6d621f7ec44e86ecd7757a0 Mon Sep 17 00:00:00 2001 From: Jocelyn Liu Date: Mon, 6 Nov 2023 17:42:32 -0800 Subject: [PATCH] Remove kBraveWalletFilecoinFeature, kBraveWalletSolanaFeature, kCreateDefaultSolanaAccount feature flags --- .../org/chromium/base/BraveFeatureList.java | 2 - .../browser/app/domain/CryptoModel.java | 36 ++-- browser/about_flags.cc | 16 -- .../brave_wallet/brave_wallet_p3a_unittest.cc | 11 -- .../brave_wallet/keyring_service_unittest.cc | 165 +++--------------- .../solana_provider_browsertest.cc | 11 -- .../solana_provider_impl_unittest.cc | 6 - .../solana_provider_renderer_browsertest.cc | 18 -- .../common_handler/wallet_handler.cc | 5 +- .../flags/android/chrome_feature_list.cc | 2 - .../browser/account_discovery_manager.cc | 19 +- .../android_page_appearing_browsertest.cc | 5 - .../browser/eth_tx_manager_unittest.cc | 11 -- .../browser/fil_tx_manager_unittest.cc | 6 - .../brave_wallet/browser/keyring_service.cc | 99 ++++------- .../browser/solana_transaction_unittest.cc | 5 - .../browser/solana_tx_manager_unittest.cc | 6 - .../brave_wallet/common/brave_wallet.mojom | 2 - .../brave_wallet/common/common_utils.cc | 22 +-- components/brave_wallet/common/common_utils.h | 3 - .../common/common_utils_unittest.cc | 12 +- components/brave_wallet/common/features.cc | 10 -- components/brave_wallet/common/features.h | 3 - .../common/async/__mocks__/bridge.ts | 2 - .../common/async/base-query-cache.ts | 6 +- .../common/selectors/wallet-selectors.ts | 2 - .../common/slices/wallet.slice.ts | 4 - .../add-hardware-account-modal.tsx | 14 +- .../add-imported-account-modal.tsx | 8 +- .../create-account-modal.tsx | 8 +- components/brave_wallet_ui/constants/types.ts | 2 - .../options/create-account-options.ts | 32 ++-- .../stories/mock-data/mock-wallet-state.ts | 2 - .../stories/wallet-concept.tsx | 4 - components/brave_wallet_ui/utils/api-utils.ts | 8 +- .../brave_wallet_render_frame_observer.cc | 6 +- 36 files changed, 111 insertions(+), 462 deletions(-) diff --git a/android/java/org/chromium/base/BraveFeatureList.java b/android/java/org/chromium/base/BraveFeatureList.java index 64b9e8acab8..0fb51dafd69 100644 --- a/android/java/org/chromium/base/BraveFeatureList.java +++ b/android/java/org/chromium/base/BraveFeatureList.java @@ -13,8 +13,6 @@ public abstract class BraveFeatureList { public static final String USE_DEV_UPDATER_URL = "UseDevUpdaterUrl"; public static final String FORCE_WEB_CONTENTS_DARK_MODE = "WebContentsForceDark"; public static final String ENABLE_FORCE_DARK = "enable-force-dark"; - public static final String BRAVE_WALLET_SOLANA = "BraveWalletSolana"; - public static final String BRAVE_WALLET_FILECOIN = "BraveWalletFilecoin"; public static final String BRAVE_SEARCH_OMNIBOX_BANNER = "BraveSearchOmniboxBanner"; public static final String BRAVE_BACKGROUND_VIDEO_PLAYBACK = "BraveBackgroundVideoPlayback"; public static final String BRAVE_BACKGROUND_VIDEO_PLAYBACK_INTERNAL = diff --git a/android/java/org/chromium/chrome/browser/app/domain/CryptoModel.java b/android/java/org/chromium/chrome/browser/app/domain/CryptoModel.java index f4253747ad2..f472fc8f7a9 100644 --- a/android/java/org/chromium/chrome/browser/app/domain/CryptoModel.java +++ b/android/java/org/chromium/chrome/browser/app/domain/CryptoModel.java @@ -11,7 +11,6 @@ import androidx.annotation.NonNull; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; -import org.chromium.base.BraveFeatureList; import org.chromium.brave_wallet.mojom.AccountInfo; import org.chromium.brave_wallet.mojom.AssetRatioService; import org.chromium.brave_wallet.mojom.BlockchainRegistry; @@ -31,7 +30,6 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.crypto_wallet.adapters.WalletCoinAdapter; import org.chromium.chrome.browser.crypto_wallet.model.CryptoAccountTypeInfo; import org.chromium.chrome.browser.crypto_wallet.util.PendingTxHelper; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.mojo.bindings.Callbacks.Callback1; import java.util.ArrayList; @@ -181,18 +179,20 @@ public class CryptoModel { mContext.getString(R.string.brave_wallet_create_account_ethereum_description), mContext.getString(R.string.wallet_eth_name), CoinType.ETH, R.drawable.eth)); - if (isSolanaEnabled()) { - cryptoAccountTypeInfos.add(new CryptoAccountTypeInfo( - mContext.getString(R.string.brave_wallet_create_account_solana_description), - mContext.getString(R.string.wallet_sol_name), CoinType.SOL, - R.drawable.ic_sol_asset_icon)); - } - if (isFilecoinEnabled()) { - cryptoAccountTypeInfos.add(new CryptoAccountTypeInfo( - mContext.getString(R.string.brave_wallet_create_account_filecoin_description), - mContext.getString(R.string.wallet_fil_name), CoinType.FIL, - R.drawable.ic_fil_asset_icon)); - } + cryptoAccountTypeInfos.add( + new CryptoAccountTypeInfo( + mContext.getString(R.string.brave_wallet_create_account_solana_description), + mContext.getString(R.string.wallet_sol_name), + CoinType.SOL, + R.drawable.ic_sol_asset_icon)); + + cryptoAccountTypeInfos.add( + new CryptoAccountTypeInfo( + mContext.getString( + R.string.brave_wallet_create_account_filecoin_description), + mContext.getString(R.string.wallet_fil_name), + CoinType.FIL, + R.drawable.ic_fil_asset_icon)); return cryptoAccountTypeInfos; } @@ -227,14 +227,6 @@ public class CryptoModel { mBraveWalletService, mJsonRpcService, mBlockchainRegistry, mSharedData, type); } - public boolean isSolanaEnabled() { - return ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_WALLET_SOLANA); - } - - public boolean isFilecoinEnabled() { - return ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_WALLET_FILECOIN); - } - public void updateCoinType() { updateCoinType(null, null); } diff --git a/browser/about_flags.cc b/browser/about_flags.cc index a58f166794d..cb185de4d25 100644 --- a/browser/about_flags.cc +++ b/browser/about_flags.cc @@ -218,22 +218,6 @@ FEATURE_VALUE_TYPE( \ brave_wallet::features::kNativeBraveWalletFeature), \ }, \ - { \ - "brave-wallet-filecoin", \ - "Enable Brave Wallet Filecoin support", \ - "Filecoin support for native Brave Wallet", \ - kOsDesktop | kOsAndroid, \ - FEATURE_VALUE_TYPE( \ - brave_wallet::features::kBraveWalletFilecoinFeature), \ - }, \ - { \ - "brave-wallet-solana", \ - "Enable Brave Wallet Solana support", \ - "Solana support for native Brave Wallet", \ - kOsDesktop | kOsAndroid, \ - FEATURE_VALUE_TYPE( \ - brave_wallet::features::kBraveWalletSolanaFeature), \ - }, \ { \ "brave-wallet-bitcoin", \ "Enable Brave Wallet Bitcoin support", \ diff --git a/browser/brave_wallet/brave_wallet_p3a_unittest.cc b/browser/brave_wallet/brave_wallet_p3a_unittest.cc index 8d5b116c047..12049d31579 100644 --- a/browser/brave_wallet/brave_wallet_p3a_unittest.cc +++ b/browser/brave_wallet/brave_wallet_p3a_unittest.cc @@ -13,7 +13,6 @@ #include "brave/components/brave_wallet/browser/keyring_service.h" #include "brave/components/brave_wallet/browser/pref_names.h" #include "brave/components/brave_wallet/common/brave_wallet.mojom.h" -#include "brave/components/brave_wallet/common/features.h" #include "chrome/test/base/scoped_testing_local_state.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile_manager.h" @@ -53,16 +52,6 @@ class BraveWalletP3AUnitTest : public testing::Test { }; TEST_F(BraveWalletP3AUnitTest, KeyringCreated) { - base::test::ScopedFeatureList feature_list; - base::FieldTrialParams parameters; - parameters[features::kCreateDefaultSolanaAccount.name] = "false"; - - std::vector enabled_features; - enabled_features.emplace_back( - brave_wallet::features::kBraveWalletSolanaFeature, parameters); - - feature_list.InitWithFeaturesAndParameters(enabled_features, {}); - histogram_tester_->ExpectBucketCount(kKeyringCreatedHistogramName, 0, 1); keyring_service_->CreateWallet("testing123", base::DoNothing()); WaitForResponse(); diff --git a/browser/brave_wallet/keyring_service_unittest.cc b/browser/brave_wallet/keyring_service_unittest.cc index 722d8ca8d5d..194d36b082b 100644 --- a/browser/brave_wallet/keyring_service_unittest.cc +++ b/browser/brave_wallet/keyring_service_unittest.cc @@ -1121,11 +1121,6 @@ TEST_F(KeyringServiceUnitTest, ValidatePassword) { } TEST_F(KeyringServiceUnitTest, LockAndUnlock) { - base::test::ScopedFeatureList feature_list; - feature_list.InitWithFeatures({features::kBraveWalletFilecoinFeature, - features::kBraveWalletSolanaFeature}, - {}); - { KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); // No encryptor but there is no keyring created so they should be unlocked. @@ -1235,9 +1230,6 @@ TEST_F(KeyringServiceUnitTest, BackupComplete) { } TEST_F(KeyringServiceUnitTest, AccountMetasForKeyring) { - base::test::ScopedFeatureList feature_list{ - features::kBraveWalletFilecoinFeature}; - KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); ASSERT_TRUE(RestoreWallet(&service, kMnemonicDivideCruise, "brave", false)); @@ -1310,9 +1302,6 @@ TEST_F(KeyringServiceUnitTest, AccountMetasForKeyring) { } TEST_F(KeyringServiceUnitTest, MigrateDerivedAccountIndex) { - base::test::ScopedFeatureList feature_list{ - features::kBraveWalletFilecoinFeature}; - { KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); ASSERT_TRUE(RestoreWallet(&service, kMnemonicDivideCruise, "brave", false)); @@ -1440,16 +1429,6 @@ TEST_F(KeyringServiceUnitTest, MigrateDerivedAccountIndex) { } TEST_F(KeyringServiceUnitTest, CreateAndRestoreWallet) { - base::test::ScopedFeatureList feature_list; - base::FieldTrialParams parameters; - parameters[features::kCreateDefaultSolanaAccount.name] = "false"; - - std::vector enabled_features; - enabled_features.emplace_back(features::kBraveWalletSolanaFeature, - parameters); - - feature_list.InitWithFeaturesAndParameters(enabled_features, {}); - KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); NiceMock observer(service); @@ -1463,10 +1442,13 @@ TEST_F(KeyringServiceUnitTest, CreateAndRestoreWallet) { std::vector account_infos = service.GetAccountInfosForKeyring(mojom::kDefaultKeyringId); + std::vector solana_account_infos = + service.GetAccountInfosForKeyring(mojom::kSolanaKeyringId); EXPECT_EQ(account_infos.size(), 1u); - EXPECT_EQ(account_infos[0], service.GetSelectedWalletAccount()); EXPECT_EQ(account_infos[0], service.GetSelectedEthereumDappAccount()); - EXPECT_FALSE(service.GetSelectedSolanaDappAccount()); + EXPECT_EQ(solana_account_infos.size(), 1u); + EXPECT_EQ(solana_account_infos[0], service.GetSelectedWalletAccount()); + EXPECT_EQ(solana_account_infos[0], service.GetSelectedSolanaDappAccount()); EXPECT_FALSE(account_infos[0]->address.empty()); const std::string address0 = account_infos[0]->address; @@ -1482,7 +1464,6 @@ TEST_F(KeyringServiceUnitTest, CreateAndRestoreWallet) { std::vector account_infos = service.GetAccountInfosForKeyring(mojom::kDefaultKeyringId); EXPECT_EQ(account_infos.size(), 1u); - EXPECT_EQ(account_infos[0], service.GetSelectedWalletAccount()); EXPECT_EQ(account_infos[0], service.GetSelectedEthereumDappAccount()); EXPECT_EQ(account_infos[0]->address, address0); EXPECT_EQ(account_infos[0]->name, "Account 1"); @@ -1504,8 +1485,9 @@ TEST_F(KeyringServiceUnitTest, CreateAndRestoreWallet) { { std::vector account_infos = service.GetAccountInfosForKeyring(mojom::kSolanaKeyringId); - EXPECT_EQ(account_infos.size(), 0u); - EXPECT_FALSE(service.GetSelectedSolanaDappAccount()); + EXPECT_EQ(account_infos.size(), 1u); + EXPECT_EQ(account_infos[0], service.GetSelectedWalletAccount()); + EXPECT_EQ(account_infos[0], service.GetSelectedSolanaDappAccount()); } }); observer.WaitAndVerify(); @@ -1824,16 +1806,6 @@ TEST_F(KeyringServiceUnitTest, ImportedAccountFromJson) { } TEST_F(KeyringServiceUnitTest, EncodePrivateKeyForExport) { - base::test::ScopedFeatureList feature_list; - base::FieldTrialParams parameters; - parameters[features::kCreateDefaultSolanaAccount.name] = "false"; - - std::vector enabled_features; - enabled_features.emplace_back(features::kBraveWalletSolanaFeature, - parameters); - - feature_list.InitWithFeaturesAndParameters(enabled_features, {}); - KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); ASSERT_TRUE(RestoreWallet(&service, kMnemonicDivideCruise, "brave", false)); @@ -1877,13 +1849,6 @@ TEST_F(KeyringServiceUnitTest, EncodePrivateKeyForExport) { mojom::AccountKind::kDerived, "0x123"))); // Other keyrings - // account not added yet - EXPECT_FALSE(EncodePrivateKeyForExport( - &service, MakeAccountId(mojom::CoinType::SOL, mojom::kSolanaKeyringId, - mojom::AccountKind::kDerived, - "BrG44HdsEhzapvs8bEqzvkq4egwevS3fRE6ze2ENo6S8"))); - ASSERT_TRUE(AddAccount(&service, mojom::CoinType::SOL, - mojom::kSolanaKeyringId, "Account 1")); // Wrong password. EXPECT_FALSE(EncodePrivateKeyForExport( &service, @@ -2107,9 +2072,6 @@ TEST_F(KeyringServiceUnitTest, RestoreLegacyBraveWallet) { } TEST_F(KeyringServiceUnitTest, HardwareAccounts) { - base::test::ScopedFeatureList feature_list{ - features::kBraveWalletFilecoinFeature}; - KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); SetNetwork(mojom::kFilecoinMainnet, mojom::CoinType::FIL); @@ -2457,16 +2419,6 @@ TEST_F(KeyringServiceUnitTest, NotifyUserInteraction) { } TEST_F(KeyringServiceUnitTest, SelectAddedAccount) { - base::test::ScopedFeatureList feature_list; - base::FieldTrialParams parameters; - parameters[features::kCreateDefaultSolanaAccount.name] = "false"; - - std::vector enabled_features; - enabled_features.emplace_back(features::kBraveWalletSolanaFeature, - parameters); - - feature_list.InitWithFeaturesAndParameters(enabled_features, {}); - KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); ASSERT_TRUE(CreateWallet(&service, "brave")); @@ -2589,11 +2541,6 @@ TEST_F(KeyringServiceUnitTest, SelectHardwareAccount) { } TEST_F(KeyringServiceUnitTest, SetSelectedAccount) { - base::test::ScopedFeatureList feature_list; - feature_list.InitWithFeatures({features::kBraveWalletFilecoinFeature, - features::kBraveWalletSolanaFeature}, - {}); - const mojom::AccountInfoPtr empty_account; KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); @@ -3176,9 +3123,6 @@ TEST_F(KeyringServiceUnitTest, AddFilecoinAccounts) { service.Reset(); } - base::test::ScopedFeatureList feature_list{ - features::kBraveWalletFilecoinFeature}; - ASSERT_TRUE(CreateWallet(&service, "brave")); ASSERT_TRUE(ImportAccount( @@ -3223,9 +3167,6 @@ TEST_F(KeyringServiceUnitTest, AddFilecoinAccounts) { } TEST_F(KeyringServiceUnitTest, ImportFilecoinAccounts) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(features::kBraveWalletFilecoinFeature); - KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); ASSERT_TRUE(CreateWallet(&service, "brave")); @@ -3382,33 +3323,8 @@ TEST_F(KeyringServiceUnitTest, ImportFilecoinAccounts) { } TEST_F(KeyringServiceUnitTest, PreCreateEncryptors) { - base::test::ScopedFeatureList feature_list; - base::FieldTrialParams parameters; - parameters[features::kCreateDefaultSolanaAccount.name] = "false"; - - std::vector enabled_features; - enabled_features.emplace_back(features::kBraveWalletSolanaFeature, - parameters); - - feature_list.InitWithFeaturesAndParameters(enabled_features, {}); - { - // Create default wallet with disabled filecoin feature. - // Solana feature is enabled on desktop and disabled on Android. - KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); - ASSERT_TRUE(CreateWallet(&service, "brave")); - EXPECT_NE(service.encryptors_.at(mojom::kDefaultKeyringId), nullptr); - EXPECT_NE(service.encryptors_.at(mojom::kSolanaKeyringId), nullptr); - EXPECT_NE(service.encryptors_.at(mojom::kFilecoinKeyringId), nullptr); - service.Reset(); - } - { - // Create wallet with enabled filecoin & solana - base::test::ScopedFeatureList local_feature_list; - local_feature_list.InitWithFeatures({features::kBraveWalletFilecoinFeature, - features::kBraveWalletSolanaFeature}, - {}); - + // Create wallet KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); ASSERT_TRUE(CreateWallet(&service, "brave")); EXPECT_NE(service.encryptors_.at(mojom::kDefaultKeyringId), nullptr); @@ -3417,17 +3333,13 @@ TEST_F(KeyringServiceUnitTest, PreCreateEncryptors) { service.Reset(); } { - // Create wallet and enable filecoin & solana before unlock + // Create wallet and unlock KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); ASSERT_TRUE(CreateWallet(&service, "brave")); EXPECT_NE(service.encryptors_.at(mojom::kDefaultKeyringId), nullptr); EXPECT_NE(service.encryptors_.at(mojom::kSolanaKeyringId), nullptr); EXPECT_NE(service.encryptors_.at(mojom::kFilecoinKeyringId), nullptr); service.Lock(); - base::test::ScopedFeatureList local_feature_list; - local_feature_list.InitWithFeatures({features::kBraveWalletFilecoinFeature, - features::kBraveWalletSolanaFeature}, - {}); ASSERT_TRUE(Unlock(&service, "brave")); EXPECT_NE(service.encryptors_.at(mojom::kDefaultKeyringId), nullptr); @@ -3436,7 +3348,7 @@ TEST_F(KeyringServiceUnitTest, PreCreateEncryptors) { service.Reset(); } { - // Create default wallet and enable filecoin solana before restore + // Create default wallet and restore KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); absl::optional mnemonic_to_be_restored = CreateWallet(&service, "brave"); @@ -3449,19 +3361,6 @@ TEST_F(KeyringServiceUnitTest, PreCreateEncryptors) { EXPECT_NE(service.encryptors_.at(mojom::kSolanaKeyringId), nullptr); EXPECT_NE(service.encryptors_.at(mojom::kFilecoinKeyringId), nullptr); - base::test::ScopedFeatureList local_feature_list; - base::FieldTrialParams local_parameters; - local_parameters[features::kCreateDefaultSolanaAccount.name] = "false"; - - std::vector local_enabled_features; - local_enabled_features.emplace_back(features::kBraveWalletSolanaFeature, - local_parameters); - local_enabled_features.emplace_back(features::kBraveWalletFilecoinFeature, - base::FieldTrialParams()); - - local_feature_list.InitWithFeaturesAndParameters(local_enabled_features, - {}); - service.Reset(); NiceMock observer(service); @@ -3478,23 +3377,11 @@ TEST_F(KeyringServiceUnitTest, PreCreateEncryptors) { } TEST_F(KeyringServiceUnitTest, SolanaKeyring) { - base::test::ScopedFeatureList feature_list; - base::FieldTrialParams parameters; - parameters[features::kCreateDefaultSolanaAccount.name] = "false"; - - std::vector enabled_features; - enabled_features.emplace_back(features::kBraveWalletSolanaFeature, - parameters); - - feature_list.InitWithFeaturesAndParameters(enabled_features, {}); - { KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); NiceMock observer(service); ASSERT_TRUE(CreateWallet(&service, "brave")); - ASSERT_TRUE(AddAccount(&service, mojom::CoinType::SOL, - mojom::kSolanaKeyringId, "Account 1")); ASSERT_TRUE(AddAccount(&service, mojom::CoinType::SOL, mojom::kSolanaKeyringId, "Account 2")); @@ -3503,7 +3390,7 @@ TEST_F(KeyringServiceUnitTest, SolanaKeyring) { auto account_infos = GetAccountUtils(&service).AllSolAccounts(); EXPECT_EQ(account_infos.size(), 2u); - EXPECT_EQ(account_infos[0]->name, "Account 1"); + EXPECT_EQ(account_infos[0]->name, "Solana Account 1"); EXPECT_EQ(account_infos[0]->account_id->kind, mojom::AccountKind::kDerived); EXPECT_EQ(account_infos[1]->name, "Account 2"); EXPECT_EQ(account_infos[1]->account_id->kind, mojom::AccountKind::kDerived); @@ -3518,12 +3405,9 @@ TEST_F(KeyringServiceUnitTest, SolanaKeyring) { ASSERT_TRUE(RestoreWallet(&service, kMnemonicDivideCruise, "brave", false)); observer.WaitAndVerify(); - ASSERT_TRUE(AddAccount(&service, mojom::CoinType::SOL, - mojom::kSolanaKeyringId, "Account 1")); - auto account_infos = GetAccountUtils(&service).AllSolAccounts(); EXPECT_EQ(account_infos.size(), 1u); - EXPECT_EQ(account_infos[0]->name, "Account 1"); + EXPECT_EQ(account_infos[0]->name, "Solana Account 1"); EXPECT_EQ(account_infos[0]->address, "BrG44HdsEhzapvs8bEqzvkq4egwevS3fRE6ze2ENo6S8"); EXPECT_EQ(account_infos[0]->account_id->kind, mojom::AccountKind::kDerived); @@ -3579,22 +3463,22 @@ TEST_F(KeyringServiceUnitTest, SolanaKeyring) { RemoveAccount(&service, imported_account->account_id, kPasswordBrave)); auto account_infos = GetAccountUtils(&service).AllSolAccounts(); - ASSERT_EQ(account_infos.size(), 1u); - EXPECT_EQ(account_infos[0]->name, "Imported Account 1"); - EXPECT_EQ(account_infos[0]->address, + ASSERT_EQ(account_infos.size(), 2u); + EXPECT_EQ(account_infos[1]->name, "Imported Account 1"); + EXPECT_EQ(account_infos[1]->address, "C5ukMV73nk32h52MjxtnZXTrrr7rupD9CTDDRnYYDRYQ"); - EXPECT_EQ(account_infos[0]->account_id->kind, + EXPECT_EQ(account_infos[1]->account_id->kind, mojom::AccountKind::kImported); service.Lock(); EXPECT_TRUE(Unlock(&service, "brave")); // imported accounts persist after lock & unlock account_infos = GetAccountUtils(&service).AllSolAccounts(); - ASSERT_EQ(account_infos.size(), 1u); - EXPECT_EQ(account_infos[0]->name, "Imported Account 1"); - EXPECT_EQ(account_infos[0]->address, + ASSERT_EQ(account_infos.size(), 2u); + EXPECT_EQ(account_infos[1]->name, "Imported Account 1"); + EXPECT_EQ(account_infos[1]->address, "C5ukMV73nk32h52MjxtnZXTrrr7rupD9CTDDRnYYDRYQ"); - EXPECT_EQ(account_infos[0]->account_id->kind, + EXPECT_EQ(account_infos[1]->account_id->kind, mojom::AccountKind::kImported); service.Reset(); @@ -4092,11 +3976,7 @@ TEST_F(KeyringServiceAccountDiscoveryUnitTest, RestoreWalletTwice) { class KeyringServiceEncryptionKeysMigrationUnitTest : public KeyringServiceUnitTest { public: - KeyringServiceEncryptionKeysMigrationUnitTest() { - feature_list_.InitWithFeatures({features::kBraveWalletFilecoinFeature, - features::kBraveWalletSolanaFeature}, - {}); - } + KeyringServiceEncryptionKeysMigrationUnitTest() {} void SetupKeyring() { KeyringService service(json_rpc_service(), GetPrefs(), GetLocalState()); @@ -4229,7 +4109,6 @@ class KeyringServiceEncryptionKeysMigrationUnitTest private: std::string saved_mnemonic_; - base::test::ScopedFeatureList feature_list_; }; TEST_F(KeyringServiceEncryptionKeysMigrationUnitTest, NoMigration) { diff --git a/browser/brave_wallet/solana_provider_browsertest.cc b/browser/brave_wallet/solana_provider_browsertest.cc index 9f6fa85f3f8..9635927b941 100644 --- a/browser/brave_wallet/solana_provider_browsertest.cc +++ b/browser/brave_wallet/solana_provider_browsertest.cc @@ -4,13 +4,11 @@ * You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "base/command_line.h" -#include "base/feature_list.h" #include "base/memory/raw_ptr.h" #include "base/path_service.h" #include "base/strings/strcat.h" #include "base/strings/string_util.h" #include "base/test/bind.h" -#include "base/test/scoped_feature_list.h" #include "base/test/values_test_util.h" #include "brave/browser/brave_wallet/asset_ratio_service_factory.h" #include "brave/browser/brave_wallet/brave_wallet_service_factory.h" @@ -29,7 +27,6 @@ #include "brave/components/brave_wallet/common/brave_wallet_constants.h" #include "brave/components/brave_wallet/common/common_utils.h" #include "brave/components/brave_wallet/common/encoding_utils.h" -#include "brave/components/brave_wallet/common/features.h" #include "brave/components/brave_wallet/common/solana_utils.h" #include "brave/components/brave_wallet/renderer/resource_helper.h" #include "brave/components/constants/brave_paths.h" @@ -334,13 +331,6 @@ class SolanaProviderTest : public InProcessBrowserTest { SolanaProviderTest() : https_server_for_files_(net::EmbeddedTestServer::TYPE_HTTPS), https_server_for_rpc_(net::EmbeddedTestServer::TYPE_HTTPS) { - base::FieldTrialParams parameters; - parameters[features::kCreateDefaultSolanaAccount.name] = "false"; - - std::vector enabled_features; - enabled_features.emplace_back( - brave_wallet::features::kBraveWalletSolanaFeature, parameters); - feature_list_.InitWithFeaturesAndParameters(enabled_features, {}); } ~SolanaProviderTest() override = default; @@ -719,7 +709,6 @@ class SolanaProviderTest : public InProcessBrowserTest { private: TestTxServiceObserver observer_; - base::test::ScopedFeatureList feature_list_; net::test_server::EmbeddedTestServer https_server_for_files_; net::test_server::EmbeddedTestServer https_server_for_rpc_; raw_ptr tx_service_ = nullptr; diff --git a/browser/brave_wallet/solana_provider_impl_unittest.cc b/browser/brave_wallet/solana_provider_impl_unittest.cc index 5fa2f53bfda..a48617bbe60 100644 --- a/browser/brave_wallet/solana_provider_impl_unittest.cc +++ b/browser/brave_wallet/solana_provider_impl_unittest.cc @@ -8,11 +8,9 @@ #include "base/containers/cxx20_erase_vector.h" #include "brave/components/brave_wallet/browser/solana_provider_impl.h" -#include "base/feature_list.h" #include "base/json/json_reader.h" #include "base/memory/raw_ptr.h" #include "base/test/bind.h" -#include "base/test/scoped_feature_list.h" #include "brave/browser/brave_wallet/brave_wallet_provider_delegate_impl.h" #include "brave/browser/brave_wallet/brave_wallet_provider_delegate_impl_helper.h" #include "brave/browser/brave_wallet/brave_wallet_service_delegate_impl.h" @@ -30,7 +28,6 @@ #include "brave/components/brave_wallet/browser/tx_service.h" #include "brave/components/brave_wallet/common/brave_wallet_constants.h" #include "brave/components/brave_wallet/common/encoding_utils.h" -#include "brave/components/brave_wallet/common/features.h" #include "brave/components/brave_wallet/common/solana_utils.h" #include "brave/components/permissions/brave_permission_manager.h" #include "brave/components/permissions/contexts/brave_wallet_permission_context.h" @@ -97,8 +94,6 @@ class SolanaProviderImplUnitTest : public testing::Test { : shared_url_loader_factory_( base::MakeRefCounted( &url_loader_factory_)) { - feature_list_.InitAndEnableFeature( - brave_wallet::features::kBraveWalletSolanaFeature); } ~SolanaProviderImplUnitTest() override = default; @@ -488,7 +483,6 @@ class SolanaProviderImplUnitTest : public testing::Test { content::BrowserTaskEnvironment browser_task_environment_; content::TestWebContentsFactory factory_; TestingProfile profile_; - base::test::ScopedFeatureList feature_list_; data_decoder::test::InProcessDataDecoder in_process_data_decoder_; network::TestURLLoaderFactory url_loader_factory_; scoped_refptr shared_url_loader_factory_; diff --git a/browser/brave_wallet/solana_provider_renderer_browsertest.cc b/browser/brave_wallet/solana_provider_renderer_browsertest.cc index 809efe80e92..f94fc6765c4 100644 --- a/browser/brave_wallet/solana_provider_renderer_browsertest.cc +++ b/browser/brave_wallet/solana_provider_renderer_browsertest.cc @@ -10,7 +10,6 @@ #include "base/path_service.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" -#include "base/test/scoped_feature_list.h" #include "brave/browser/brave_content_browser_client.h" #include "brave/browser/brave_wallet/keyring_service_factory.h" #include "brave/browser/profiles/brave_renderer_updater.h" @@ -532,8 +531,6 @@ class SolanaProviderRendererTest : public InProcessBrowserTest { public: SolanaProviderRendererTest() : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) { - feature_list_.InitWithFeatures( - {brave_wallet::features::kBraveWalletSolanaFeature}, {}); brave::RegisterPathProvider(); base::FilePath test_data_dir; base::PathService::Get(brave::DIR_TEST_DATA, &test_data_dir); @@ -597,27 +594,12 @@ class SolanaProviderRendererTest : public InProcessBrowserTest { protected: net::EmbeddedTestServer https_server_; TestBraveContentBrowserClient test_content_browser_client_; - base::test::ScopedFeatureList feature_list_; private: content::ContentMockCertVerifier mock_cert_verifier_; net::test_server::EmbeddedTestServerHandle test_server_handle_; }; -class SolanaProviderDisabledTest : public SolanaProviderRendererTest { - public: - SolanaProviderDisabledTest() { - feature_list_.Reset(); - feature_list_.InitAndDisableFeature( - brave_wallet::features::kBraveWalletSolanaFeature); - } -}; - -IN_PROC_BROWSER_TEST_F(SolanaProviderDisabledTest, SolanaObject) { - auto result = EvalJs(web_contents(browser()), CheckSolanaProviderScript); - EXPECT_EQ(base::Value(false), result.value); -} - IN_PROC_BROWSER_TEST_F(SolanaProviderRendererTest, Incognito) { Browser* private_browser = CreateIncognitoBrowser(nullptr); GURL url = embedded_test_server()->GetURL("/empty.html"); diff --git a/browser/ui/webui/brave_wallet/common_handler/wallet_handler.cc b/browser/ui/webui/brave_wallet/common_handler/wallet_handler.cc index 18c7c233f8e..be31e86b74f 100644 --- a/browser/ui/webui/brave_wallet/common_handler/wallet_handler.cc +++ b/browser/ui/webui/brave_wallet/common_handler/wallet_handler.cc @@ -35,9 +35,8 @@ void WalletHandler::GetWalletInfo(GetWalletInfoCallback callback) { std::move(callback).Run(mojom::WalletInfo::New( keyring_service_->IsWalletCreatedSync(), keyring_service_->IsLockedSync(), - keyring_service_->IsWalletBackedUpSync(), IsFilecoinEnabled(), - IsSolanaEnabled(), IsBitcoinEnabled(), IsZCashEnabled(), - IsNftPinningEnabled(), IsAnkrBalancesEnabled())); + keyring_service_->IsWalletBackedUpSync(), IsBitcoinEnabled(), + IsZCashEnabled(), IsNftPinningEnabled(), IsAnkrBalancesEnabled())); } } // namespace brave_wallet diff --git a/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc b/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc index c82837aa97b..60b807c8ff2 100644 --- a/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chromium_src/chrome/browser/flags/android/chrome_feature_list.cc @@ -35,8 +35,6 @@ &brave_search_conversion::features::kOmniboxBanner, \ &brave_vpn::features::kBraveVPNLinkSubscriptionAndroidUI, \ &brave_wallet::features::kNativeBraveWalletFeature, \ - &brave_wallet::features::kBraveWalletSolanaFeature, \ - &brave_wallet::features::kBraveWalletFilecoinFeature, \ &playlist::features::kPlaylist, \ &preferences::features::kBraveBackgroundVideoPlayback, \ &request_otr::features::kBraveRequestOTRTab, \ diff --git a/components/brave_wallet/browser/account_discovery_manager.cc b/components/brave_wallet/browser/account_discovery_manager.cc index 7e9ca5b1daf..fa097620288 100644 --- a/components/brave_wallet/browser/account_discovery_manager.cc +++ b/components/brave_wallet/browser/account_discovery_manager.cc @@ -60,17 +60,14 @@ void AccountDiscoveryManager::StartDiscovery() { AddDiscoveryAccount(std::make_unique( mojom::CoinType::ETH, mojom::KeyringId::kDefault, mojom::kMainnetChainId, derived_count[mojom::KeyringId::kDefault], kDiscoveryAttempts)); - if (IsFilecoinEnabled()) { - AddDiscoveryAccount(std::make_unique( - mojom::CoinType::FIL, mojom::KeyringId::kFilecoin, - mojom::kFilecoinMainnet, derived_count[mojom::KeyringId::kFilecoin], - kDiscoveryAttempts)); - } - if (IsSolanaEnabled()) { - AddDiscoveryAccount(std::make_unique( - mojom::CoinType::SOL, mojom::KeyringId::kSolana, mojom::kSolanaMainnet, - derived_count[mojom::KeyringId::kSolana], kDiscoveryAttempts)); - } + AddDiscoveryAccount(std::make_unique( + mojom::CoinType::FIL, mojom::KeyringId::kFilecoin, + mojom::kFilecoinMainnet, derived_count[mojom::KeyringId::kFilecoin], + kDiscoveryAttempts)); + AddDiscoveryAccount(std::make_unique( + mojom::CoinType::SOL, mojom::KeyringId::kSolana, mojom::kSolanaMainnet, + derived_count[mojom::KeyringId::kSolana], kDiscoveryAttempts)); + if (IsBitcoinEnabled()) { CHECK(bitcoin_wallet_service_); diff --git a/components/brave_wallet/browser/android_page_appearing_browsertest.cc b/components/brave_wallet/browser/android_page_appearing_browsertest.cc index c1252a4b36d..8f83fa17b31 100644 --- a/components/brave_wallet/browser/android_page_appearing_browsertest.cc +++ b/components/brave_wallet/browser/android_page_appearing_browsertest.cc @@ -23,7 +23,6 @@ #include "brave/components/brave_wallet/browser/json_rpc_service.h" #include "brave/components/brave_wallet/browser/keyring_service.h" #include "brave/components/brave_wallet/browser/test_utils.h" -#include "brave/components/brave_wallet/common/features.h" #include "brave/components/constants/webui_url_constants.h" #include "brave/components/cosmetic_filters/browser/cosmetic_filters_resources.h" #include "chrome/browser/chrome_content_browser_client.h" @@ -200,9 +199,6 @@ class AndroidPageAppearingBrowserTest : public PlatformBrowserTest { AndroidPageAppearingBrowserTest() { factory_ = std::make_unique(kWalletPageHost); content::WebUIControllerFactory::RegisterFactory(factory_.get()); - scoped_feature_list_.InitWithFeatures( - {}, {features::kBraveWalletFilecoinFeature, - features::kBraveWalletSolanaFeature}); } void SetUpOnMainThread() override { @@ -390,7 +386,6 @@ class AndroidPageAppearingBrowserTest : public PlatformBrowserTest { absl::optional file_digest_; std::unique_ptr factory_; - base::test::ScopedFeatureList scoped_feature_list_; raw_ptr asset_ratio_service_; raw_ptr keyring_service_; raw_ptr json_rpc_service_; diff --git a/components/brave_wallet/browser/eth_tx_manager_unittest.cc b/components/brave_wallet/browser/eth_tx_manager_unittest.cc index a2d72dd9227..b3e8d68e402 100644 --- a/components/brave_wallet/browser/eth_tx_manager_unittest.cc +++ b/components/brave_wallet/browser/eth_tx_manager_unittest.cc @@ -16,7 +16,6 @@ #include "base/functional/callback_helpers.h" #include "base/task/sequenced_task_runner.h" #include "base/test/bind.h" -#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/test/values_test_util.h" #include "brave/components/brave_wallet/browser/blockchain_registry.h" @@ -38,7 +37,6 @@ #include "brave/components/brave_wallet/browser/tx_storage_delegate.h" #include "brave/components/brave_wallet/browser/tx_storage_delegate_impl.h" #include "brave/components/brave_wallet/common/brave_wallet.mojom.h" -#include "brave/components/brave_wallet/common/features.h" #include "brave/components/brave_wallet/common/hex_utils.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "components/value_store/value_store_frontend.h" @@ -193,14 +191,6 @@ class EthTxManagerUnitTest : public testing::Test { &url_loader_factory_)) {} void SetUp() override { - base::FieldTrialParams parameters; - parameters[features::kCreateDefaultSolanaAccount.name] = "false"; - std::vector enabled_features; - enabled_features.emplace_back( - brave_wallet::features::kBraveWalletSolanaFeature, parameters); - - feature_list_.InitWithFeaturesAndParameters(enabled_features, {}); - url_loader_factory_.SetInterceptor(base::BindLambdaForTesting( [&](const network::ResourceRequest& request) { url_loader_factory_.ClearResponses(); @@ -469,7 +459,6 @@ class EthTxManagerUnitTest : public testing::Test { } protected: - base::test::ScopedFeatureList feature_list_; base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; sync_preferences::TestingPrefServiceSyncable profile_prefs_; diff --git a/components/brave_wallet/browser/fil_tx_manager_unittest.cc b/components/brave_wallet/browser/fil_tx_manager_unittest.cc index 9910c16f3e7..bc87dc8f3ab 100644 --- a/components/brave_wallet/browser/fil_tx_manager_unittest.cc +++ b/components/brave_wallet/browser/fil_tx_manager_unittest.cc @@ -14,7 +14,6 @@ #include "base/json/json_writer.h" #include "base/task/sequenced_task_runner.h" #include "base/test/bind.h" -#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "brave/components/brave_wallet/browser/brave_wallet_prefs.h" #include "brave/components/brave_wallet/browser/brave_wallet_utils.h" @@ -26,7 +25,6 @@ #include "brave/components/brave_wallet/browser/test_utils.h" #include "brave/components/brave_wallet/browser/tx_service.h" #include "brave/components/brave_wallet/common/brave_wallet.mojom.h" -#include "brave/components/brave_wallet/common/features.h" #include "components/grit/brave_components_strings.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h" @@ -74,9 +72,6 @@ class FilTxManagerUnitTest : public testing::Test { &url_loader_factory_)) {} void SetUp() override { - feature_list_.InitAndEnableFeature( - brave_wallet::features::kBraveWalletFilecoinFeature); - brave_wallet::RegisterLocalStatePrefs(local_state_.registry()); brave_wallet::RegisterProfilePrefs(prefs_.registry()); brave_wallet::RegisterProfilePrefsForMigration(prefs_.registry()); @@ -235,7 +230,6 @@ class FilTxManagerUnitTest : public testing::Test { } protected: - base::test::ScopedFeatureList feature_list_; base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; sync_preferences::TestingPrefServiceSyncable prefs_; diff --git a/components/brave_wallet/browser/keyring_service.cc b/components/brave_wallet/browser/keyring_service.cc index e15eabe7221..f99dea33d23 100644 --- a/components/brave_wallet/browser/keyring_service.cc +++ b/components/brave_wallet/browser/keyring_service.cc @@ -1033,19 +1033,6 @@ void KeyringService::GetMnemonicForDefaultKeyring( std::move(callback).Run(GetMnemonicForKeyringImpl(mojom::kDefaultKeyringId)); } -void KeyringService::MaybeCreateDefaultSolanaAccount() { - if (!ShouldCreateDefaultSolanaAccount()) { - return; - } - - auto account = AddAccountForKeyring(mojom::kSolanaKeyringId, - "Solana " + GetAccountName(1)); - if (account) { - SetSelectedAccountInternal(*account); - NotifyAccountsAdded(*account); - } -} - void KeyringService::IsWalletCreated(IsWalletCreatedCallback callback) { std::move(callback).Run(IsWalletCreatedSync()); } @@ -1082,14 +1069,13 @@ void KeyringService::CreateWallet(const std::string& mnemonic, } } - if (IsFilecoinEnabled()) { - CreateKeyring(mojom::kFilecoinKeyringId, mnemonic, password); - CreateKeyring(mojom::kFilecoinTestnetKeyringId, mnemonic, password); - } - - if (IsSolanaEnabled()) { - CreateKeyring(mojom::kSolanaKeyringId, mnemonic, password); - MaybeCreateDefaultSolanaAccount(); + CreateKeyring(mojom::kFilecoinKeyringId, mnemonic, password); + CreateKeyring(mojom::kFilecoinTestnetKeyringId, mnemonic, password); + CreateKeyring(mojom::kSolanaKeyringId, mnemonic, password); + if (auto account = AddAccountForKeyring(mojom::kSolanaKeyringId, + "Solana " + GetAccountName(1))) { + SetSelectedAccountInternal(*account); + NotifyAccountsAdded(*account); } if (IsBitcoinEnabled()) { @@ -1150,19 +1136,20 @@ bool KeyringService::RestoreWalletSync(const std::string& mnemonic, } } - if (IsFilecoinEnabled()) { - // Restore mainnet filecoin acc - RestoreKeyring(mojom::kFilecoinKeyringId, mnemonic, password, false); - // Restore testnet filecoin acc - RestoreKeyring(mojom::kFilecoinTestnetKeyringId, mnemonic, password, false); - } + // Restore mainnet filecoin acc + RestoreKeyring(mojom::kFilecoinKeyringId, mnemonic, password, false); + // Restore testnet filecoin acc + RestoreKeyring(mojom::kFilecoinTestnetKeyringId, mnemonic, password, false); - if (IsSolanaEnabled()) { - auto* solana_keyring = - RestoreKeyring(mojom::kSolanaKeyringId, mnemonic, password, false); - if (solana_keyring && !GetDerivedAccountsNumberForKeyring( - profile_prefs_, mojom::kSolanaKeyringId)) { - MaybeCreateDefaultSolanaAccount(); + auto* solana_keyring = + RestoreKeyring(mojom::kSolanaKeyringId, mnemonic, password, false); + if (solana_keyring && !GetDerivedAccountsNumberForKeyring( + profile_prefs_, mojom::kSolanaKeyringId)) { + auto account = AddAccountForKeyring(mojom::kSolanaKeyringId, + "Solana " + GetAccountName(1)); + if (account) { + SetSelectedAccountInternal(*account); + NotifyAccountsAdded(*account); } } @@ -1220,14 +1207,6 @@ mojom::AccountInfoPtr KeyringService::AddAccountSync( mojom::CoinType coin, mojom::KeyringId keyring_id, const std::string& account_name) { - if (IsFilecoinKeyringId(keyring_id) && !IsFilecoinEnabled()) { - return nullptr; - } - - if (keyring_id == mojom::kSolanaKeyringId && !IsSolanaEnabled()) { - return nullptr; - } - if (IsBitcoinKeyring(keyring_id) && !IsBitcoinEnabled()) { return nullptr; } @@ -1923,29 +1902,25 @@ void KeyringService::Unlock(const std::string& password, return; } - if (IsFilecoinEnabled()) { - if (!ResumeKeyring(mojom::kFilecoinKeyringId, password)) { - VLOG(1) << __func__ << " Unable to unlock filecoin keyring"; - encryptors_.erase(mojom::kFilecoinKeyringId); - std::move(callback).Run(false); - return; - } - - if (!ResumeKeyring(mojom::kFilecoinTestnetKeyringId, password)) { - VLOG(1) << __func__ << " Unable to unlock filecoin testnet keyring"; - encryptors_.erase(mojom::kFilecoinTestnetKeyringId); - std::move(callback).Run(false); - return; - } + if (!ResumeKeyring(mojom::kFilecoinKeyringId, password)) { + VLOG(1) << __func__ << " Unable to unlock filecoin keyring"; + encryptors_.erase(mojom::kFilecoinKeyringId); + std::move(callback).Run(false); + return; } - if (IsSolanaEnabled()) { - if (!ResumeKeyring(mojom::kSolanaKeyringId, password)) { - VLOG(1) << __func__ << " Unable to unlock Solana keyring"; - encryptors_.erase(mojom::kSolanaKeyringId); - std::move(callback).Run(false); - return; - } + if (!ResumeKeyring(mojom::kFilecoinTestnetKeyringId, password)) { + VLOG(1) << __func__ << " Unable to unlock filecoin testnet keyring"; + encryptors_.erase(mojom::kFilecoinTestnetKeyringId); + std::move(callback).Run(false); + return; + } + + if (!ResumeKeyring(mojom::kSolanaKeyringId, password)) { + VLOG(1) << __func__ << " Unable to unlock Solana keyring"; + encryptors_.erase(mojom::kSolanaKeyringId); + std::move(callback).Run(false); + return; } if (IsBitcoinEnabled()) { diff --git a/components/brave_wallet/browser/solana_transaction_unittest.cc b/components/brave_wallet/browser/solana_transaction_unittest.cc index 3e80bf63b1e..4ba784d2777 100644 --- a/components/brave_wallet/browser/solana_transaction_unittest.cc +++ b/components/brave_wallet/browser/solana_transaction_unittest.cc @@ -11,7 +11,6 @@ #include "base/base64.h" #include "base/test/bind.h" #include "base/test/gtest_util.h" -#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/test/values_test_util.h" #include "brave/components/brave_wallet/browser/brave_wallet_prefs.h" @@ -24,7 +23,6 @@ #include "brave/components/brave_wallet/common/brave_wallet_constants.h" #include "brave/components/brave_wallet/common/brave_wallet_types.h" #include "brave/components/brave_wallet/common/encoding_utils.h" -#include "brave/components/brave_wallet/common/features.h" #include "brave/components/brave_wallet/common/solana_utils.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" @@ -101,9 +99,6 @@ class SolanaTransactionUnitTest : public testing::Test { }; TEST_F(SolanaTransactionUnitTest, GetSignedTransaction) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature( - brave_wallet::features::kBraveWalletSolanaFeature); ASSERT_TRUE( RestoreWallet(keyring_service(), kMnemonicDivideCruise, "brave", false)); diff --git a/components/brave_wallet/browser/solana_tx_manager_unittest.cc b/components/brave_wallet/browser/solana_tx_manager_unittest.cc index 1b698d74be0..23033df6131 100644 --- a/components/brave_wallet/browser/solana_tx_manager_unittest.cc +++ b/components/brave_wallet/browser/solana_tx_manager_unittest.cc @@ -13,7 +13,6 @@ #include "base/files/scoped_temp_dir.h" #include "base/task/sequenced_task_runner.h" #include "base/test/bind.h" -#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/test/values_test_util.h" #include "brave/components/brave_wallet/browser/blockchain_registry.h" @@ -33,7 +32,6 @@ #include "brave/components/brave_wallet/common/brave_wallet_constants.h" #include "brave/components/brave_wallet/common/brave_wallet_types.h" #include "brave/components/brave_wallet/common/encoding_utils.h" -#include "brave/components/brave_wallet/common/features.h" #include "brave/components/brave_wallet/common/solana_utils.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h" @@ -67,10 +65,6 @@ class SolanaTxManagerUnitTest : public testing::Test { last_valid_block_height2_ = 3290; last_valid_block_height3_ = 3490; - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature( - brave_wallet::features::kBraveWalletSolanaFeature); - SetInterceptor(latest_blockhash1_, last_valid_block_height1_, tx_hash1_, "", false, last_valid_block_height1_); brave_wallet::RegisterProfilePrefs(prefs_.registry()); diff --git a/components/brave_wallet/common/brave_wallet.mojom b/components/brave_wallet/common/brave_wallet.mojom index eca52b8ff2e..5078995457f 100644 --- a/components/brave_wallet/common/brave_wallet.mojom +++ b/components/brave_wallet/common/brave_wallet.mojom @@ -712,8 +712,6 @@ struct WalletInfo { bool is_wallet_created; bool is_wallet_locked; bool is_wallet_backed_up; - bool is_filecoin_enabled; - bool is_solana_enabled; bool is_bitcoin_enabled; bool is_z_cash_enabled; bool is_nft_pinning_feature_enabled; diff --git a/components/brave_wallet/common/common_utils.cc b/components/brave_wallet/common/common_utils.cc index f6eb793902b..c2a50f0d8b6 100644 --- a/components/brave_wallet/common/common_utils.cc +++ b/components/brave_wallet/common/common_utils.cc @@ -34,22 +34,10 @@ bool IsNativeWalletEnabled() { return base::FeatureList::IsEnabled(features::kNativeBraveWalletFeature); } -bool IsFilecoinEnabled() { - return base::FeatureList::IsEnabled(features::kBraveWalletFilecoinFeature); -} - -bool IsSolanaEnabled() { - return base::FeatureList::IsEnabled(features::kBraveWalletSolanaFeature); -} - bool IsNftPinningEnabled() { return base::FeatureList::IsEnabled(features::kBraveWalletNftPinningFeature); } -bool ShouldCreateDefaultSolanaAccount() { - return IsSolanaEnabled() && features::kCreateDefaultSolanaAccount.Get(); -} - bool IsBitcoinEnabled() { return base::FeatureList::IsEnabled(features::kBraveWalletBitcoinFeature); } @@ -159,13 +147,9 @@ GURL GetActiveEndpointUrl(const mojom::NetworkInfo& chain) { std::vector GetSupportedKeyrings() { std::vector ids = {mojom::KeyringId::kDefault}; - if (IsFilecoinEnabled()) { - ids.push_back(mojom::KeyringId::kFilecoin); - ids.push_back(mojom::KeyringId::kFilecoinTestnet); - } - if (IsSolanaEnabled()) { - ids.push_back(mojom::KeyringId::kSolana); - } + ids.push_back(mojom::KeyringId::kFilecoin); + ids.push_back(mojom::KeyringId::kFilecoinTestnet); + ids.push_back(mojom::KeyringId::kSolana); if (IsBitcoinEnabled()) { ids.push_back(mojom::KeyringId::kBitcoin84); ids.push_back(mojom::KeyringId::kBitcoin84Testnet); diff --git a/components/brave_wallet/common/common_utils.h b/components/brave_wallet/common/common_utils.h index ed43e6da4bc..3d0365f7536 100644 --- a/components/brave_wallet/common/common_utils.h +++ b/components/brave_wallet/common/common_utils.h @@ -22,10 +22,7 @@ constexpr mojom::CoinType kAllCoins[] = { bool IsZCashKeyring(mojom::KeyringId keyring_id); bool IsNativeWalletEnabled(); -bool IsFilecoinEnabled(); -bool IsSolanaEnabled(); bool IsNftPinningEnabled(); -bool ShouldCreateDefaultSolanaAccount(); bool IsBitcoinEnabled(); bool IsZCashEnabled(); bool IsAnkrBalancesEnabled(); diff --git a/components/brave_wallet/common/common_utils_unittest.cc b/components/brave_wallet/common/common_utils_unittest.cc index fe5b39789c4..72950c1b01c 100644 --- a/components/brave_wallet/common/common_utils_unittest.cc +++ b/components/brave_wallet/common/common_utils_unittest.cc @@ -105,8 +105,6 @@ TEST(CommonUtils, GetActiveEndpointUrl) { TEST(CommonUtils, GetSupportedKeyrings) { base::test::ScopedFeatureList disabled_feature_list; const std::vector coin_features = { - features::kBraveWalletSolanaFeature, - features::kBraveWalletFilecoinFeature, features::kBraveWalletBitcoinFeature}; disabled_feature_list.InitWithFeatures({}, coin_features); @@ -127,14 +125,10 @@ TEST(CommonUtils, GetSupportedKeyrings) { EXPECT_EQ(keyrings[last_pos++], mojom::KeyringId::kDefault); - if (IsFilecoinEnabled()) { - EXPECT_EQ(keyrings[last_pos++], mojom::KeyringId::kFilecoin); - EXPECT_EQ(keyrings[last_pos++], mojom::KeyringId::kFilecoinTestnet); - } + EXPECT_EQ(keyrings[last_pos++], mojom::KeyringId::kFilecoin); + EXPECT_EQ(keyrings[last_pos++], mojom::KeyringId::kFilecoinTestnet); - if (IsSolanaEnabled()) { - EXPECT_EQ(keyrings[last_pos++], mojom::KeyringId::kSolana); - } + EXPECT_EQ(keyrings[last_pos++], mojom::KeyringId::kSolana); if (IsBitcoinEnabled()) { EXPECT_EQ(keyrings[last_pos++], mojom::KeyringId::kBitcoin84); diff --git a/components/brave_wallet/common/features.cc b/components/brave_wallet/common/features.cc index 84dd8cb6f22..51dd98f21c5 100644 --- a/components/brave_wallet/common/features.cc +++ b/components/brave_wallet/common/features.cc @@ -14,16 +14,6 @@ namespace features { BASE_FEATURE(kNativeBraveWalletFeature, "NativeBraveWallet", base::FEATURE_ENABLED_BY_DEFAULT); -BASE_FEATURE(kBraveWalletFilecoinFeature, - "BraveWalletFilecoin", - base::FEATURE_ENABLED_BY_DEFAULT); - -BASE_FEATURE(kBraveWalletSolanaFeature, - "BraveWalletSolana", - base::FEATURE_ENABLED_BY_DEFAULT); -const base::FeatureParam kCreateDefaultSolanaAccount{ - &kBraveWalletSolanaFeature, "create_default_solana_account", true}; - BASE_FEATURE(kBraveWalletNftPinningFeature, "BraveWalletNftPinning", diff --git a/components/brave_wallet/common/features.h b/components/brave_wallet/common/features.h index e5366b9b132..75433e94d8a 100644 --- a/components/brave_wallet/common/features.h +++ b/components/brave_wallet/common/features.h @@ -13,10 +13,7 @@ namespace brave_wallet { namespace features { BASE_DECLARE_FEATURE(kNativeBraveWalletFeature); -BASE_DECLARE_FEATURE(kBraveWalletFilecoinFeature); -BASE_DECLARE_FEATURE(kBraveWalletSolanaFeature); BASE_DECLARE_FEATURE(kBraveWalletNftPinningFeature); -extern const base::FeatureParam kCreateDefaultSolanaAccount; BASE_DECLARE_FEATURE(kBraveWalletBitcoinFeature); extern const base::FeatureParam kBitcoinRpcThrottle; extern const base::FeatureParam kBitcoinTestnetDiscovery; diff --git a/components/brave_wallet_ui/common/async/__mocks__/bridge.ts b/components/brave_wallet_ui/common/async/__mocks__/bridge.ts index 820d3d939b0..c170b95d9b6 100644 --- a/components/brave_wallet_ui/common/async/__mocks__/bridge.ts +++ b/components/brave_wallet_ui/common/async/__mocks__/bridge.ts @@ -818,8 +818,6 @@ export class MockedWalletApiProxy { }> => { return { walletInfo: { - isSolanaEnabled: true, - isFilecoinEnabled: true, isBitcoinEnabled: true, isZCashEnabled: true, isWalletBackedUp: true, diff --git a/components/brave_wallet_ui/common/async/base-query-cache.ts b/components/brave_wallet_ui/common/async/base-query-cache.ts index 31562f8d552..1cd9b21de61 100644 --- a/components/brave_wallet_ui/common/async/base-query-cache.ts +++ b/components/brave_wallet_ui/common/async/base-query-cache.ts @@ -127,8 +127,6 @@ export class BaseQueryCache { // network type flags const { - isFilecoinEnabled, - isSolanaEnabled, isBitcoinEnabled, isZCashEnabled } = await this.getWalletInfo() @@ -137,8 +135,8 @@ export class BaseQueryCache { const filteredSupportedCoinTypes = SupportedCoinTypes.filter((coin) => { // FIL and SOL networks, unless enabled by brave://flags return ( - (coin === BraveWallet.CoinType.FIL && isFilecoinEnabled) || - (coin === BraveWallet.CoinType.SOL && isSolanaEnabled) || + coin === BraveWallet.CoinType.FIL || + coin === BraveWallet.CoinType.SOL || (coin === BraveWallet.CoinType.BTC && isBitcoinEnabled) || (coin === BraveWallet.CoinType.ZEC && isZCashEnabled) || coin === BraveWallet.CoinType.ETH diff --git a/components/brave_wallet_ui/common/selectors/wallet-selectors.ts b/components/brave_wallet_ui/common/selectors/wallet-selectors.ts index 43196c9b786..76ff042cb15 100644 --- a/components/brave_wallet_ui/common/selectors/wallet-selectors.ts +++ b/components/brave_wallet_ui/common/selectors/wallet-selectors.ts @@ -20,8 +20,6 @@ export const defaultFiatCurrency = ({ wallet }: State) => export const hasIncorrectPassword = ({ wallet }: State) => wallet.hasIncorrectPassword export const hasInitialized = ({ wallet }: State) => wallet.hasInitialized -export const isFilecoinEnabled = ({ wallet }: State) => wallet.isFilecoinEnabled -export const isSolanaEnabled = ({ wallet }: State) => wallet.isSolanaEnabled export const isBitcoinEnabled = ({ wallet }: State) => wallet.isBitcoinEnabled export const isZCashEnabled = ({ wallet }: State) => wallet.isZCashEnabled export const isLoadingCoinMarketData = ({ wallet }: State) => diff --git a/components/brave_wallet_ui/common/slices/wallet.slice.ts b/components/brave_wallet_ui/common/slices/wallet.slice.ts index 29d54d31a43..0eca90476ff 100644 --- a/components/brave_wallet_ui/common/slices/wallet.slice.ts +++ b/components/brave_wallet_ui/common/slices/wallet.slice.ts @@ -49,8 +49,6 @@ import { createAction, createSlice, PayloadAction } from '@reduxjs/toolkit' const defaultState: WalletState = { hasInitialized: false, - isFilecoinEnabled: false, - isSolanaEnabled: false, isBitcoinEnabled: false, isZCashEnabled: false, isWalletCreated: false, @@ -267,8 +265,6 @@ export const createWalletSlice = (initialState: WalletState = defaultState) => { ) { state.hasInitialized = true state.isWalletCreated = payload.walletInfo.isWalletCreated - state.isFilecoinEnabled = payload.walletInfo.isFilecoinEnabled - state.isSolanaEnabled = payload.walletInfo.isSolanaEnabled state.isBitcoinEnabled = payload.walletInfo.isBitcoinEnabled state.isZCashEnabled = payload.walletInfo.isZCashEnabled state.isWalletLocked = payload.walletInfo.isWalletLocked diff --git a/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/add-hardware-account-modal.tsx b/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/add-hardware-account-modal.tsx index 2be7aa832c3..4c984d0a7dd 100644 --- a/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/add-hardware-account-modal.tsx +++ b/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/add-hardware-account-modal.tsx @@ -32,12 +32,6 @@ import { SelectAccountType } from './select-account-type/select-account-type' // style import { StyledWrapper } from './style' -// hooks -import { WalletSelectors } from '../../../../common/selectors' - -// selectors -import { useSafeWalletSelector } from '../../../../common/hooks/use-safe-selector' - interface Params { accountTypeName: string } @@ -53,20 +47,14 @@ export const AddHardwareAccountModal = ({ onSelectAccountType }: Props) => { // redux const dispatch = useDispatch() - const isFilecoinEnabled = useSafeWalletSelector( - WalletSelectors.isFilecoinEnabled - ) - const isSolanaEnabled = useSafeWalletSelector(WalletSelectors.isSolanaEnabled) // memos const createAccountOptions = React.useMemo(() => { return CreateAccountOptions({ - isFilecoinEnabled, - isSolanaEnabled, isBitcoinEnabled: false, // No bitcoin hardware accounts by now. isZCashEnabled: false // No zcash hardware accounts by now. }) - }, [isFilecoinEnabled, isSolanaEnabled]) + }, []) const selectedAccountType: CreateAccountOptionsType | undefined = React.useMemo(() => { diff --git a/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/add-imported-account-modal.tsx b/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/add-imported-account-modal.tsx index d6314b09d43..e3aa36dc874 100644 --- a/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/add-imported-account-modal.tsx +++ b/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/add-imported-account-modal.tsx @@ -83,10 +83,6 @@ export const ImportAccountModal = () => { const { accountTypeName } = useParams() // redux - const isFilecoinEnabled = useSafeWalletSelector( - WalletSelectors.isFilecoinEnabled - ) - const isSolanaEnabled = useSafeWalletSelector(WalletSelectors.isSolanaEnabled) const hasImportError = useSafeWalletSelector( WalletSelectors.importAccountError ) @@ -94,12 +90,10 @@ export const ImportAccountModal = () => { // memos const createAccountOptions = React.useMemo(() => { return CreateAccountOptions({ - isFilecoinEnabled, - isSolanaEnabled, isBitcoinEnabled: false, // No bitcoin imported accounts by now. isZCashEnabled: false // No zcash imported accounts by now. }) - }, [isFilecoinEnabled, isSolanaEnabled]) + }, []) const selectedAccountType = React.useMemo(() => { return createAccountOptions.find((option) => { diff --git a/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/create-account-modal.tsx b/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/create-account-modal.tsx index a0a6e43c2db..61c92020e99 100644 --- a/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/create-account-modal.tsx +++ b/components/brave_wallet_ui/components/desktop/popup-modals/add-account-modal/create-account-modal.tsx @@ -66,10 +66,6 @@ export const CreateAccountModal = () => { // redux const dispatch = useDispatch() - const isFilecoinEnabled = useSafeWalletSelector( - WalletSelectors.isFilecoinEnabled - ) - const isSolanaEnabled = useSafeWalletSelector(WalletSelectors.isSolanaEnabled) const isBitcoinEnabled = useSafeWalletSelector( WalletSelectors.isBitcoinEnabled ) @@ -96,12 +92,10 @@ export const CreateAccountModal = () => { // memos const createAccountOptions = React.useMemo(() => { return CreateAccountOptions({ - isFilecoinEnabled, - isSolanaEnabled, isBitcoinEnabled, isZCashEnabled }) - }, [isFilecoinEnabled, isSolanaEnabled, isBitcoinEnabled, isZCashEnabled]) + }, [isBitcoinEnabled, isZCashEnabled]) const selectedAccountType = React.useMemo(() => { return createAccountOptions.find((option) => { diff --git a/components/brave_wallet_ui/constants/types.ts b/components/brave_wallet_ui/constants/types.ts index ad15272bd9d..c5cecf942ff 100644 --- a/components/brave_wallet_ui/constants/types.ts +++ b/components/brave_wallet_ui/constants/types.ts @@ -202,8 +202,6 @@ export interface UIState { export interface WalletState { hasInitialized: boolean - isFilecoinEnabled: boolean - isSolanaEnabled: boolean isBitcoinEnabled: boolean isZCashEnabled: boolean isWalletCreated: boolean diff --git a/components/brave_wallet_ui/options/create-account-options.ts b/components/brave_wallet_ui/options/create-account-options.ts index 2c7b75cd476..ab5b0855f76 100644 --- a/components/brave_wallet_ui/options/create-account-options.ts +++ b/components/brave_wallet_ui/options/create-account-options.ts @@ -7,8 +7,6 @@ import { getLocale } from '../../common/locale' import { getNetworkLogo } from './asset-options' export const CreateAccountOptions = (options: { - isFilecoinEnabled: boolean - isSolanaEnabled: boolean isBitcoinEnabled: boolean isZCashEnabled: boolean }): CreateAccountOptionsType[] => { @@ -20,22 +18,20 @@ export const CreateAccountOptions = (options: { icon: getNetworkLogo(BraveWallet.MAINNET_CHAIN_ID, 'ETH') } ] - if (options.isSolanaEnabled) { - accounts.push({ - description: getLocale('braveWalletCreateAccountSolanaDescription'), - name: 'Solana', - coin: BraveWallet.CoinType.SOL, - icon: getNetworkLogo(BraveWallet.SOLANA_MAINNET, 'SOL') - }) - } - if (options.isFilecoinEnabled) { - accounts.push({ - description: getLocale('braveWalletCreateAccountFilecoinDescription'), - name: 'Filecoin', - coin: BraveWallet.CoinType.FIL, - icon: getNetworkLogo(BraveWallet.FILECOIN_MAINNET, 'FIL') - }) - } + accounts.push({ + description: getLocale('braveWalletCreateAccountSolanaDescription'), + name: 'Solana', + coin: BraveWallet.CoinType.SOL, + icon: getNetworkLogo(BraveWallet.SOLANA_MAINNET, 'SOL') + }) + + accounts.push({ + description: getLocale('braveWalletCreateAccountFilecoinDescription'), + name: 'Filecoin', + coin: BraveWallet.CoinType.FIL, + icon: getNetworkLogo(BraveWallet.FILECOIN_MAINNET, 'FIL') + }) + if (options.isBitcoinEnabled) { accounts.push({ description: getLocale('braveWalletCreateAccountBitcoinDescription'), diff --git a/components/brave_wallet_ui/stories/mock-data/mock-wallet-state.ts b/components/brave_wallet_ui/stories/mock-data/mock-wallet-state.ts index a206cb832c9..1a64e449a46 100644 --- a/components/brave_wallet_ui/stories/mock-data/mock-wallet-state.ts +++ b/components/brave_wallet_ui/stories/mock-data/mock-wallet-state.ts @@ -89,9 +89,7 @@ export const mockWalletState: WalletState = { gasEstimates: undefined, hasIncorrectPassword: false, hasInitialized: true, - isFilecoinEnabled: false, isMetaMaskInstalled: false, - isSolanaEnabled: false, isBitcoinEnabled: false, isZCashEnabled: false, isAnkrBalancesFeatureEnabled: false, diff --git a/components/brave_wallet_ui/stories/wallet-concept.tsx b/components/brave_wallet_ui/stories/wallet-concept.tsx index c64fea36f6b..57ffb1bccff 100644 --- a/components/brave_wallet_ui/stories/wallet-concept.tsx +++ b/components/brave_wallet_ui/stories/wallet-concept.tsx @@ -22,8 +22,6 @@ export const _DesktopWalletConcept = () => { walletStateOverride={{ hasIncorrectPassword: false, isWalletCreated: true, - isSolanaEnabled: true, - isFilecoinEnabled: true }} pageStateOverride={{ hasInitialized: true @@ -46,8 +44,6 @@ export const _WalletOnboardingConcept = () => { { - // MULTICHAIN: While we are still in development for FIL and SOL, - // we will not use their networks unless enabled by brave://flags return ( - (coin === BraveWallet.CoinType.FIL && isFilecoinEnabled) || - (coin === BraveWallet.CoinType.SOL && isSolanaEnabled) || + coin === BraveWallet.CoinType.FIL || + coin === BraveWallet.CoinType.SOL || (coin === BraveWallet.CoinType.BTC && isBitcoinEnabled) || (coin === BraveWallet.CoinType.ZEC && isZCashEnabled) || coin === BraveWallet.CoinType.ETH diff --git a/renderer/brave_wallet/brave_wallet_render_frame_observer.cc b/renderer/brave_wallet/brave_wallet_render_frame_observer.cc index 7dd2d390b46..a59221bca1b 100644 --- a/renderer/brave_wallet/brave_wallet_render_frame_observer.cc +++ b/renderer/brave_wallet/brave_wallet_render_frame_observer.cc @@ -8,8 +8,6 @@ #include #include -#include "base/feature_list.h" -#include "brave/components/brave_wallet/common/features.h" #include "brave/components/brave_wallet/renderer/v8_helper.h" #include "build/buildflag.h" #include "content/public/common/isolated_world_ids.h" @@ -106,9 +104,7 @@ void BraveWalletRenderFrameObserver::DidClearWindowObject() { render_frame()); } - if (base::FeatureList::IsEnabled( - brave_wallet::features::kBraveWalletSolanaFeature) && - web_frame->GetDocument().IsDOMFeaturePolicyEnabled(context, "solana") && + if (web_frame->GetDocument().IsDOMFeaturePolicyEnabled(context, "solana") && dynamic_params.brave_use_native_solana_wallet) { JSSolanaProvider::Install( dynamic_params.allow_overwrite_window_solana_provider, render_frame());