diff --git a/.github/workflows/automated_integration_test.yml b/.github/workflows/automated_integration_test.yml
index ac0fa6f2b..96d6ef153 100644
--- a/.github/workflows/automated_integration_test.yml
+++ b/.github/workflows/automated_integration_test.yml
@@ -66,7 +66,6 @@ jobs:
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
echo "const nowNodesApiKey = '${{ secrets.EVM_NOWNODES_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
-
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
diff --git a/.github/workflows/pr_test_build_linux.yml b/.github/workflows/pr_test_build_linux.yml
index 7444be1cc..c3e7ecd88 100644
--- a/.github/workflows/pr_test_build_linux.yml
+++ b/.github/workflows/pr_test_build_linux.yml
@@ -53,8 +53,8 @@ jobs:
echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
+ echo "const blinkApiKey = '${{ secrets.BLINK_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
echo "const nowNodesApiKey = '${{ secrets.EVM_NOWNODES_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
-
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml
index b18495263..08bf24d67 100644
--- a/.github/workflows/reusable-build.yml
+++ b/.github/workflows/reusable-build.yml
@@ -68,7 +68,7 @@ jobs:
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
echo "const nowNodesApiKey = '${{ secrets.EVM_NOWNODES_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
-
+ echo "const blinkApiKey = '${{ secrets.BLINK_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
diff --git a/.gitignore b/.gitignore
index cbe622744..5b17c0122 100644
--- a/.gitignore
+++ b/.gitignore
@@ -143,6 +143,7 @@ lib/decred/decred.dart
lib/dogecoin/dogecoin.dart
lib/base/base.dart
lib/arbitrum/arbitrum.dart
+lib/evm/evm.dart
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
ios/Runner/Assets.xcassets/AppIcon.appiconset/*.png
diff --git a/assets/images/evm_switcher.svg b/assets/images/evm_switcher.svg
new file mode 100644
index 000000000..18ed0cf03
--- /dev/null
+++ b/assets/images/evm_switcher.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/images/evm_switcher_arrow_left.svg b/assets/images/evm_switcher_arrow_left.svg
new file mode 100644
index 000000000..dd12ab3ca
--- /dev/null
+++ b/assets/images/evm_switcher_arrow_left.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/evm_switcher_arrow_right.svg b/assets/images/evm_switcher_arrow_right.svg
new file mode 100644
index 000000000..e73ba2a6b
--- /dev/null
+++ b/assets/images/evm_switcher_arrow_right.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/evm_switcher_checkmark.svg b/assets/images/evm_switcher_checkmark.svg
new file mode 100644
index 000000000..a634d871a
--- /dev/null
+++ b/assets/images/evm_switcher_checkmark.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/images/evm_switcher_icons/arbitrum.svg b/assets/images/evm_switcher_icons/arbitrum.svg
new file mode 100644
index 000000000..c0720257f
--- /dev/null
+++ b/assets/images/evm_switcher_icons/arbitrum.svg
@@ -0,0 +1,20 @@
+
diff --git a/assets/images/evm_switcher_icons/base.svg b/assets/images/evm_switcher_icons/base.svg
new file mode 100644
index 000000000..6d51c92f9
--- /dev/null
+++ b/assets/images/evm_switcher_icons/base.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/images/evm_switcher_icons/ethereum.svg b/assets/images/evm_switcher_icons/ethereum.svg
new file mode 100644
index 000000000..b011052de
--- /dev/null
+++ b/assets/images/evm_switcher_icons/ethereum.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/evm_switcher_icons/gnosis.svg b/assets/images/evm_switcher_icons/gnosis.svg
new file mode 100644
index 000000000..d9347d66a
--- /dev/null
+++ b/assets/images/evm_switcher_icons/gnosis.svg
@@ -0,0 +1,18 @@
+
diff --git a/assets/images/evm_switcher_icons/polygon.svg b/assets/images/evm_switcher_icons/polygon.svg
new file mode 100644
index 000000000..65335cf6a
--- /dev/null
+++ b/assets/images/evm_switcher_icons/polygon.svg
@@ -0,0 +1,3 @@
+
diff --git a/cakewallet.bat b/cakewallet.bat
index 5870452b8..d601741d5 100644
--- a/cakewallet.bat
+++ b/cakewallet.bat
@@ -1,5 +1,5 @@
@echo off
-set cw_win_app_config=--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --dogecoin --base
+set cw_win_app_config=--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --dogecoin --base --arbitrum
set cw_root=%cd%
set cw_archive_name=Cake Wallet.zip
set cw_archive_path=%cw_root%\%cw_archive_name%
diff --git a/cw_arbitrum/.gitignore b/cw_arbitrum/.gitignore
deleted file mode 100644
index eb6c05cd3..000000000
--- a/cw_arbitrum/.gitignore
+++ /dev/null
@@ -1,31 +0,0 @@
-# Miscellaneous
-*.class
-*.log
-*.pyc
-*.swp
-.DS_Store
-.atom/
-.buildlog/
-.history
-.svn/
-migrate_working_dir/
-
-# IntelliJ related
-*.iml
-*.ipr
-*.iws
-.idea/
-
-# The .vscode folder contains launch configuration and tasks you configure in
-# VS Code which you may wish to be included in version control, so this line
-# is commented out by default.
-#.vscode/
-
-# Flutter/Dart/Pub related
-# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
-/pubspec.lock
-**/doc/api/
-.dart_tool/
-.flutter-plugins
-.flutter-plugins-dependencies
-build/
diff --git a/cw_arbitrum/.metadata b/cw_arbitrum/.metadata
deleted file mode 100644
index 6f8d1aa9c..000000000
--- a/cw_arbitrum/.metadata
+++ /dev/null
@@ -1,10 +0,0 @@
-# This file tracks properties of this Flutter project.
-# Used by Flutter tool to assess capabilities and perform upgrades etc.
-#
-# This file should be version controlled and should not be manually edited.
-
-version:
- revision: "fcf2c11572af6f390246c056bc905eca609533a0"
- channel: "[user-branch]"
-
-project_type: package
diff --git a/cw_arbitrum/CHANGELOG.md b/cw_arbitrum/CHANGELOG.md
deleted file mode 100644
index 41cc7d819..000000000
--- a/cw_arbitrum/CHANGELOG.md
+++ /dev/null
@@ -1,3 +0,0 @@
-## 0.0.1
-
-* TODO: Describe initial release.
diff --git a/cw_arbitrum/LICENSE b/cw_arbitrum/LICENSE
deleted file mode 100644
index ba75c69f7..000000000
--- a/cw_arbitrum/LICENSE
+++ /dev/null
@@ -1 +0,0 @@
-TODO: Add your license here.
diff --git a/cw_arbitrum/README.md b/cw_arbitrum/README.md
deleted file mode 100644
index 4a260d8d2..000000000
--- a/cw_arbitrum/README.md
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-TODO: Put a short description of the package here that helps potential users
-know whether this package might be useful for them.
-
-## Features
-
-TODO: List what your package can do. Maybe include images, gifs, or videos.
-
-## Getting started
-
-TODO: List prerequisites and provide or point to information on how to
-start using the package.
-
-## Usage
-
-TODO: Include short and useful examples for package users. Add longer examples
-to `/example` folder.
-
-```dart
-const like = 'sample';
-```
-
-## Additional information
-
-TODO: Tell users more about the package: where to find more information, how to
-contribute to the package, how to file issues, what response they can expect
-from the package authors, and more.
diff --git a/cw_arbitrum/analysis_options.yaml b/cw_arbitrum/analysis_options.yaml
deleted file mode 100644
index a5744c1cf..000000000
--- a/cw_arbitrum/analysis_options.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-include: package:flutter_lints/flutter.yaml
-
-# Additional information about this file can be found at
-# https://dart.dev/guides/language/analysis-options
diff --git a/cw_arbitrum/lib/arbirtrum_mnemonics_exception.dart b/cw_arbitrum/lib/arbirtrum_mnemonics_exception.dart
deleted file mode 100644
index 8af5612db..000000000
--- a/cw_arbitrum/lib/arbirtrum_mnemonics_exception.dart
+++ /dev/null
@@ -1,5 +0,0 @@
-class ArbitrumMnemonicIsIncorrectException implements Exception {
- @override
- String toString() =>
- 'Arbitrum mnemonic has incorrect format. Mnemonic should contain 12 or 24 words separated by space.';
-}
diff --git a/cw_arbitrum/lib/arbitrum_client.dart b/cw_arbitrum/lib/arbitrum_client.dart
deleted file mode 100644
index f9fb36d34..000000000
--- a/cw_arbitrum/lib/arbitrum_client.dart
+++ /dev/null
@@ -1,107 +0,0 @@
-import 'dart:convert';
-
-import 'package:cw_evm/.secrets.g.dart' as secrets;
-import 'package:cw_evm/evm_chain_client.dart';
-import 'package:cw_evm/evm_chain_transaction_model.dart';
-import 'package:flutter/foundation.dart';
-import 'package:web3dart/web3dart.dart';
-
-class ArbitrumClient extends EVMChainClient {
- @override
- Transaction createTransaction({
- required EthereumAddress from,
- required EthereumAddress to,
- required EtherAmount amount,
- EtherAmount? maxPriorityFeePerGas,
- Uint8List? data,
- int? maxGas,
- EtherAmount? gasPrice,
- EtherAmount? maxFeePerGas,
- }) {
- EtherAmount? finalGasPrice = gasPrice;
-
- if (gasPrice == null && maxFeePerGas != null) {
- // If we have EIP-1559 parameters but no legacy gasPrice, then use maxFeePerGas as gasPrice
- finalGasPrice = maxFeePerGas;
- }
-
- return Transaction(
- from: from,
- to: to,
- value: amount,
- data: data,
- maxGas: maxGas,
- gasPrice: finalGasPrice,
- // maxFeePerGas: maxFeePerGas,
- // maxPriorityFeePerGas: maxPriorityFeePerGas,
- );
- }
-
- @override
- Uint8List prepareSignedTransactionForSending(Uint8List signedTransaction) => signedTransaction;
-
- @override
- int get chainId => 42161;
-
- @override
- Future> fetchTransactions(
- String address, {
- String? contractAddress,
- }) async {
- try {
- final response = await client.get(
- Uri.https("api.etherscan.io", "/v2/api", {
- "chainid": "$chainId",
- "module": "account",
- "action": contractAddress != null ? "tokentx" : "txlist",
- if (contractAddress != null) "contractaddress": contractAddress,
- "address": address,
- "apikey": secrets.etherScanApiKey,
- }),
- );
-
- final jsonResponse = json.decode(response.body) as Map;
-
- if (response.statusCode >= 200 && response.statusCode < 300 && jsonResponse['status'] != 0) {
- final res = (jsonResponse['result'] as List);
-
- res.removeWhere((e) => e['value'] == '0');
-
- return res
- .map((e) => EVMChainTransactionModel.fromJson(e as Map, 'ETH'))
- .toList();
- }
-
- return [];
- } catch (e) {
- return [];
- }
- }
-
- @override
- Future> fetchInternalTransactions(String address) async {
- try {
- final response = await client.get(
- Uri.https("api.etherscan.io", "/v2/api", {
- "chainid": "$chainId",
- "module": "account",
- "action": "txlistinternal",
- "address": address,
- "apikey": secrets.etherScanApiKey,
- }),
- );
-
- final jsonResponse = json.decode(response.body) as Map;
-
- if (response.statusCode >= 200 && response.statusCode < 300 && jsonResponse['status'] != 0) {
- return (jsonResponse['result'] as List)
- .map((e) => EVMChainTransactionModel.fromJson(e as Map, 'ETH'))
- .toList();
- }
-
- return [];
- } catch (_) {
- return [];
- }
- }
-}
diff --git a/cw_arbitrum/lib/arbitrum_transaction_history.dart b/cw_arbitrum/lib/arbitrum_transaction_history.dart
deleted file mode 100644
index 1319c7aea..000000000
--- a/cw_arbitrum/lib/arbitrum_transaction_history.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-import 'dart:core';
-
-import 'package:cw_evm/evm_chain_transaction_history.dart';
-import 'package:cw_evm/evm_chain_transaction_info.dart';
-import 'package:cw_arbitrum/arbitrum_transaction_info.dart';
-
-class ArbitrumTransactionHistory extends EVMChainTransactionHistory {
- ArbitrumTransactionHistory({
- required super.walletInfo,
- required super.password,
- required super.encryptionFileUtils,
- });
-
- @override
- String getTransactionHistoryFileName() => 'arbitrum_transactions.json';
-
- @override
- EVMChainTransactionInfo getTransactionInfo(Map val) =>
- ArbitrumTransactionInfo.fromJson(val);
-}
diff --git a/cw_arbitrum/lib/arbitrum_transaction_info.dart b/cw_arbitrum/lib/arbitrum_transaction_info.dart
deleted file mode 100644
index d12499991..000000000
--- a/cw_arbitrum/lib/arbitrum_transaction_info.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-import 'package:cw_core/transaction_direction.dart';
-import 'package:cw_evm/evm_chain_transaction_info.dart';
-
-class ArbitrumTransactionInfo extends EVMChainTransactionInfo {
- ArbitrumTransactionInfo({
- required super.id,
- required super.height,
- required super.ethAmount,
- required super.ethFee,
- required super.tokenSymbol,
- required super.direction,
- required super.isPending,
- required super.date,
- required super.confirmations,
- required super.to,
- required super.from,
- super.contractAddress,
- super.exponent,
- });
-
- factory ArbitrumTransactionInfo.fromJson(Map data) {
- return ArbitrumTransactionInfo(
- id: data['id'] as String,
- height: data['height'] as int,
- ethAmount: BigInt.parse(data['amount']),
- exponent: data['exponent'] as int,
- ethFee: BigInt.parse(data['fee']),
- direction: parseTransactionDirectionFromInt(data['direction'] as int),
- date: DateTime.fromMillisecondsSinceEpoch(data['date'] as int),
- isPending: data['isPending'] as bool,
- confirmations: data['confirmations'] as int,
- tokenSymbol: data['tokenSymbol'] as String,
- to: data['to'],
- from: data['from'],
- contractAddress: data['contractAddress'],
- );
- }
-
- @override
- String get feeCurrency => 'ETH';
-}
diff --git a/cw_arbitrum/lib/arbitrum_wallet.dart b/cw_arbitrum/lib/arbitrum_wallet.dart
deleted file mode 100644
index 39680566f..000000000
--- a/cw_arbitrum/lib/arbitrum_wallet.dart
+++ /dev/null
@@ -1,183 +0,0 @@
-import 'dart:convert';
-
-import 'package:cw_arbitrum/arbitrum_client.dart';
-import 'package:cw_arbitrum/arbitrum_transaction_history.dart';
-import 'package:cw_arbitrum/arbitrum_transaction_info.dart';
-import 'package:cw_arbitrum/default_arbitrum_erc20_tokens.dart';
-import 'package:cw_core/cake_hive.dart';
-import 'package:cw_core/crypto_currency.dart';
-import 'package:cw_core/encryption_file_utils.dart';
-import 'package:cw_core/erc20_token.dart';
-import 'package:cw_core/pathForWallet.dart';
-import 'package:cw_core/transaction_direction.dart';
-import 'package:cw_core/wallet_info.dart';
-import 'package:cw_core/wallet_keys_file.dart';
-import 'package:cw_evm/evm_chain_transaction_history.dart';
-import 'package:cw_evm/evm_chain_transaction_info.dart';
-import 'package:cw_evm/evm_chain_transaction_model.dart';
-import 'package:cw_evm/evm_chain_transaction_priority.dart';
-import 'package:cw_evm/evm_chain_wallet.dart';
-import 'package:cw_evm/evm_erc20_balance.dart';
-
-class ArbitrumWallet extends EVMChainWallet {
- ArbitrumWallet({
- required super.walletInfo,
- required super.password,
- required super.derivationInfo,
- super.mnemonic,
- super.initialBalance,
- super.privateKey,
- required super.client,
- required super.encryptionFileUtils,
- super.passphrase,
- }) : super(nativeCurrency: CryptoCurrency.arbEth);
-
- @override
- bool get hasPriorityFee => false;
-
- @override
- int getTotalPriorityFee(EVMChainTransactionPriority priority) => 0;
-
- @override
- Future initErc20TokensBox() async {
- final boxName = "${walletInfo.name.replaceAll(" ", "_")}_${Erc20Token.arbitrumBoxName}";
-
- evmChainErc20TokensBox = await CakeHive.openBox(boxName);
- }
-
- @override
- void addInitialTokens() {
- final initialErc20Tokens = DefaultArbitrumErc20Tokens().initialArbitrumErc20Tokens;
-
- for (final token in initialErc20Tokens) {
- if (!evmChainErc20TokensBox.containsKey(token.contractAddress)) {
- evmChainErc20TokensBox.put(token.contractAddress, token);
- } else {
- // update existing token
- final existingToken = evmChainErc20TokensBox.get(token.contractAddress);
- evmChainErc20TokensBox.put(
- token.contractAddress,
- Erc20Token.copyWith(token, enabled: existingToken!.enabled),
- );
- }
- }
- }
-
- @override
- List get getDefaultTokenContractAddresses => DefaultArbitrumErc20Tokens()
- .initialArbitrumErc20Tokens
- .map((e) => e.contractAddress)
- .toList();
-
- @override
- Future checkIfScanProviderIsEnabled() async {
- return (await sharedPrefs.future).getBool("use_arbiscan") ?? true;
- }
-
- @override
- String getTransactionHistoryFileName() => 'arbitrum_transactions.json';
-
- @override
- Erc20Token createNewErc20TokenObject(Erc20Token token, String? iconPath) {
- return Erc20Token(
- name: token.name,
- symbol: token.symbol,
- contractAddress: token.contractAddress,
- decimal: token.decimal,
- enabled: token.enabled,
- tag: token.tag ?? 'ETH',
- iconPath: iconPath,
- isPotentialScam: token.isPotentialScam,
- );
- }
-
- @override
- EVMChainTransactionInfo getTransactionInfo(
- EVMChainTransactionModel transactionModel,
- String address,
- ) {
- final model = ArbitrumTransactionInfo(
- id: transactionModel.hash,
- height: transactionModel.blockNumber,
- ethAmount: transactionModel.amount,
- direction: transactionModel.from == address
- ? TransactionDirection.outgoing
- : TransactionDirection.incoming,
- isPending: false,
- date: transactionModel.date,
- confirmations: transactionModel.confirmations,
- ethFee: BigInt.from(transactionModel.gasUsed) * transactionModel.gasPrice,
- exponent: transactionModel.tokenDecimal ?? 18,
- tokenSymbol: transactionModel.tokenSymbol ?? "ETH",
- to: transactionModel.to,
- from: transactionModel.from,
- contractAddress: transactionModel.contractAddress,
- );
- return model;
- }
-
- @override
- EVMChainTransactionHistory setUpTransactionHistory(
- WalletInfo walletInfo,
- String password,
- EncryptionFileUtils encryptionFileUtils,
- ) {
- return ArbitrumTransactionHistory(
- walletInfo: walletInfo,
- password: password,
- encryptionFileUtils: encryptionFileUtils,
- );
- }
-
- static Future open({
- required String name,
- required String password,
- required WalletInfo walletInfo,
- required EncryptionFileUtils encryptionFileUtils,
- }) async {
- final hasKeysFile = await WalletKeysFile.hasKeysFile(name, walletInfo.type);
- final path = await pathForWallet(name: name, type: walletInfo.type);
-
- Map? data;
- try {
- final jsonSource = await encryptionFileUtils.read(path: path, password: password);
-
- data = json.decode(jsonSource) as Map;
- } catch (e) {
- if (!hasKeysFile) rethrow;
- }
-
- final balance =
- EVMChainERC20Balance.fromJSON(data?['balance'] as String?) ??
- EVMChainERC20Balance(BigInt.zero);
-
- final WalletKeysData keysData;
- // Migrate wallet from the old scheme to then new .keys file scheme
- if (!hasKeysFile) {
- final mnemonic = data!['mnemonic'] as String?;
- final privateKey = data['private_key'] as String?;
- final passphrase = data['passphrase'] as String?;
-
- keysData = WalletKeysData(mnemonic: mnemonic, privateKey: privateKey, passphrase: passphrase);
- } else {
- keysData = await WalletKeysFile.readKeysFile(
- name,
- walletInfo.type,
- password,
- encryptionFileUtils,
- );
- }
-
- return ArbitrumWallet(
- walletInfo: walletInfo,
- derivationInfo: await walletInfo.getDerivationInfo(),
- password: password,
- mnemonic: keysData.mnemonic,
- privateKey: keysData.privateKey,
- passphrase: keysData.passphrase,
- initialBalance: balance,
- client: ArbitrumClient(),
- encryptionFileUtils: encryptionFileUtils,
- );
- }
-}
diff --git a/cw_arbitrum/lib/arbitrum_wallet_service.dart b/cw_arbitrum/lib/arbitrum_wallet_service.dart
deleted file mode 100644
index 91e0b86ee..000000000
--- a/cw_arbitrum/lib/arbitrum_wallet_service.dart
+++ /dev/null
@@ -1,174 +0,0 @@
-import 'package:bip39/bip39.dart' as bip39;
-import 'package:cw_arbitrum/arbirtrum_mnemonics_exception.dart';
-import 'package:cw_core/encryption_file_utils.dart';
-import 'package:cw_core/wallet_base.dart';
-import 'package:cw_core/wallet_info.dart';
-import 'package:cw_core/wallet_type.dart';
-import 'package:cw_evm/evm_chain_wallet_creation_credentials.dart';
-import 'package:cw_evm/evm_chain_wallet_service.dart';
-import 'package:cw_arbitrum/arbitrum_wallet.dart';
-import 'package:cw_arbitrum/arbitrum_client.dart';
-
-class ArbitrumWalletService extends EVMChainWalletService {
- ArbitrumWalletService(super.isDirect, {required this.client});
-
- late ArbitrumClient client;
-
- @override
- WalletType getType() => WalletType.arbitrum;
-
- @override
- Future create(EVMChainNewWalletCredentials credentials, {bool? isTestnet}) async {
- final strength = credentials.seedPhraseLength == 24 ? 256 : 128;
-
- final mnemonic = credentials.mnemonic ?? bip39.generateMnemonic(strength: strength);
-
- final wallet = ArbitrumWallet(
- walletInfo: credentials.walletInfo!,
- derivationInfo: await credentials.walletInfo!.getDerivationInfo(),
- mnemonic: mnemonic,
- password: credentials.password!,
- passphrase: credentials.passphrase,
- client: client,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
- return wallet;
- }
-
- @override
- Future openWallet(String name, String password) async {
- final walletInfo = await WalletInfo.get(name, getType());
- if (walletInfo == null) {
- throw Exception('Wallet not found');
- }
-
- try {
- final wallet = await ArbitrumWallet.open(
- name: name,
- password: password,
- walletInfo: walletInfo,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
- saveBackup(name);
- return wallet;
- } catch (_) {
- await restoreWalletFilesFromBackup(name);
-
- final wallet = await ArbitrumWallet.open(
- name: name,
- password: password,
- walletInfo: walletInfo,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
- return wallet;
- }
- }
-
- @override
- Future restoreFromKeys(
- EVMChainRestoreWalletFromPrivateKey credentials, {
- bool? isTestnet,
- }) async {
- final wallet = ArbitrumWallet(
- password: credentials.password!,
- privateKey: credentials.privateKey,
- walletInfo: credentials.walletInfo!,
- derivationInfo: await credentials.walletInfo!.getDerivationInfo(),
- client: client,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
- return wallet;
- }
-
- @override
- Future restoreFromHardwareWallet(
- EVMChainRestoreWalletFromHardware credentials,
- ) async {
- final derivationInfo = await credentials.walletInfo!.getDerivationInfo();
- derivationInfo.derivationType = DerivationType.bip39;
- derivationInfo.derivationPath = "m/44'/60'/${credentials.hwAccountData.accountIndex}'/0/0";
- await derivationInfo.save();
- credentials.walletInfo!.hardwareWalletType = credentials.hardwareWalletType;
- credentials.walletInfo!.address = credentials.hwAccountData.address;
- await credentials.walletInfo!.save();
-
- final wallet = ArbitrumWallet(
- walletInfo: credentials.walletInfo!,
- derivationInfo: derivationInfo,
- password: credentials.password!,
- client: client,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
-
- return wallet;
- }
-
- @override
- Future restoreFromSeed(
- EVMChainRestoreWalletFromSeedCredentials credentials, {
- bool? isTestnet,
- }) async {
- if (!bip39.validateMnemonic(credentials.mnemonic)) {
- throw ArbitrumMnemonicIsIncorrectException();
- }
-
- final wallet = ArbitrumWallet(
- password: credentials.password!,
- mnemonic: credentials.mnemonic,
- walletInfo: credentials.walletInfo!,
- derivationInfo: await credentials.walletInfo!.getDerivationInfo(),
- passphrase: credentials.passphrase,
- client: client,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
-
- return wallet;
- }
-
- @override
- Future rename(String currentName, String password, String newName) async {
- final currentWalletInfo = await WalletInfo.get(currentName, getType());
- if (currentWalletInfo == null) {
- throw Exception('Wallet not found');
- }
- final currentWallet = await ArbitrumWallet.open(
- password: password,
- name: currentName,
- walletInfo: currentWalletInfo,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await currentWallet.renameWalletFiles(newName);
- await saveBackup(newName);
-
- final newWalletInfo = currentWalletInfo;
- newWalletInfo.id = WalletBase.idFor(newName, getType());
- newWalletInfo.name = newName;
-
- newWalletInfo.save();
- }
-}
diff --git a/cw_arbitrum/lib/cw_arbitrum.dart b/cw_arbitrum/lib/cw_arbitrum.dart
deleted file mode 100644
index 298576d81..000000000
--- a/cw_arbitrum/lib/cw_arbitrum.dart
+++ /dev/null
@@ -1,5 +0,0 @@
-/// A Calculator.
-class Calculator {
- /// Returns [value] plus 1.
- int addOne(int value) => value + 1;
-}
diff --git a/cw_arbitrum/lib/default_arbitrum_erc20_tokens.dart b/cw_arbitrum/lib/default_arbitrum_erc20_tokens.dart
deleted file mode 100644
index 25cc5739b..000000000
--- a/cw_arbitrum/lib/default_arbitrum_erc20_tokens.dart
+++ /dev/null
@@ -1,71 +0,0 @@
-import 'package:cw_core/crypto_currency.dart';
-import 'package:cw_core/erc20_token.dart';
-
-class DefaultArbitrumErc20Tokens {
- final List _defaultTokens = [
- Erc20Token(
- name: "USD Coin",
- symbol: "USDC",
- contractAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
- decimal: 6,
- enabled: true,
- ),
- Erc20Token(
- name: "USDC.e",
- symbol: "USDC.e",
- contractAddress: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
- decimal: 6,
- enabled: true,
- ),
- Erc20Token(
- name: "Wrapped BTC",
- symbol: "WBTC",
- contractAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
- decimal: 8,
- enabled: true,
- ),
- Erc20Token(
- name: "Chainlink Token",
- symbol: "LINK",
- contractAddress: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4",
- decimal: 18,
- enabled: true,
- ),
- Erc20Token(
- name: "Wrapped liquid staked Ether 2.0",
- symbol: "wstETH",
- contractAddress: "0x0fBcbaEA96Ce0cF7Ee00A8c19c3ab6f5Dc8E1921",
- decimal: 18,
- enabled: false,
- ),
- Erc20Token(
- name: "Wrapped Ether",
- symbol: "WETH",
- contractAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
- decimal: 18,
- enabled: false,
- ),
- Erc20Token(
- name: "DAI",
- symbol: "DAI",
- contractAddress: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
- decimal: 18,
- enabled: false,
- ),
- ];
-
- List get initialArbitrumErc20Tokens => _defaultTokens.map((token) {
- String? iconPath;
- if (token.iconPath?.isEmpty ?? true) {
- try {
- iconPath = CryptoCurrency.all
- .firstWhere((element) => element.title.toUpperCase() == token.symbol.toUpperCase())
- .iconPath;
- } catch (_) {}
- } else {
- iconPath = token.iconPath;
- }
-
- return Erc20Token.copyWith(token, icon: iconPath, tag: 'ARB');
- }).toList();
-}
diff --git a/cw_arbitrum/pubspec.yaml b/cw_arbitrum/pubspec.yaml
deleted file mode 100644
index f6cb36577..000000000
--- a/cw_arbitrum/pubspec.yaml
+++ /dev/null
@@ -1,73 +0,0 @@
-name: cw_arbitrum
-description: "A new Flutter package project."
-version: 0.0.1
-publish_to: none
-homepage: https://cakewallet.com
-
-environment:
- sdk: '>=3.0.6 <4.0.0'
- flutter: ">=1.17.0"
-
-dependencies:
- flutter:
- sdk: flutter
- cw_core:
- path: ../cw_core
- cw_ethereum:
- path: ../cw_ethereum
- cw_evm:
- path: ../cw_evm
- web3dart: ^2.7.1
- hive: ^2.2.3
- bip39: ^1.0.6
- collection: ^1.17.1
-
-dependency_overrides:
- web3dart:
- git:
- url: https://github.com/cake-tech/web3dart.git
- ref: cake
- watcher: ^1.1.0
-
-dev_dependencies:
- flutter_test:
- sdk: flutter
- flutter_lints: ^2.0.0
- build_runner: ^2.4.15
-
-# For information on the generic Dart part of this file, see the
-# following page: https://dart.dev/tools/pub/pubspec
-
-# The following section is specific to Flutter packages.
-flutter:
-
- # To add assets to your package, add an assets section, like this:
- # assets:
- # - images/a_dot_burr.jpeg
- # - images/a_dot_ham.jpeg
- #
- # For details regarding assets in packages, see
- # https://flutter.dev/to/asset-from-package
- #
- # An image asset can refer to one or more resolution-specific "variants", see
- # https://flutter.dev/to/resolution-aware-images
-
- # To add custom fonts to your package, add a fonts section here,
- # in this "flutter" section. Each entry in this list should have a
- # "family" key with the font family name, and a "fonts" key with a
- # list giving the asset and other descriptors for the font. For
- # example:
- # fonts:
- # - family: Schyler
- # fonts:
- # - asset: fonts/Schyler-Regular.ttf
- # - asset: fonts/Schyler-Italic.ttf
- # style: italic
- # - family: Trajan Pro
- # fonts:
- # - asset: fonts/TrajanPro.ttf
- # - asset: fonts/TrajanPro_Bold.ttf
- # weight: 700
- #
- # For details regarding fonts in packages, see
- # https://flutter.dev/to/font-from-package
diff --git a/cw_arbitrum/test/cw_arbitrum_test.dart b/cw_arbitrum/test/cw_arbitrum_test.dart
deleted file mode 100644
index 5cf35628f..000000000
--- a/cw_arbitrum/test/cw_arbitrum_test.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-import 'package:flutter_test/flutter_test.dart';
-
-import 'package:cw_arbitrum/cw_arbitrum.dart';
-
-void main() {
- test('adds one to input values', () {
- final calculator = Calculator();
- expect(calculator.addOne(2), 3);
- expect(calculator.addOne(-7), -6);
- expect(calculator.addOne(0), 1);
- });
-}
diff --git a/cw_base/.gitignore b/cw_base/.gitignore
deleted file mode 100644
index eb6c05cd3..000000000
--- a/cw_base/.gitignore
+++ /dev/null
@@ -1,31 +0,0 @@
-# Miscellaneous
-*.class
-*.log
-*.pyc
-*.swp
-.DS_Store
-.atom/
-.buildlog/
-.history
-.svn/
-migrate_working_dir/
-
-# IntelliJ related
-*.iml
-*.ipr
-*.iws
-.idea/
-
-# The .vscode folder contains launch configuration and tasks you configure in
-# VS Code which you may wish to be included in version control, so this line
-# is commented out by default.
-#.vscode/
-
-# Flutter/Dart/Pub related
-# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
-/pubspec.lock
-**/doc/api/
-.dart_tool/
-.flutter-plugins
-.flutter-plugins-dependencies
-build/
diff --git a/cw_base/.metadata b/cw_base/.metadata
deleted file mode 100644
index 6f8d1aa9c..000000000
--- a/cw_base/.metadata
+++ /dev/null
@@ -1,10 +0,0 @@
-# This file tracks properties of this Flutter project.
-# Used by Flutter tool to assess capabilities and perform upgrades etc.
-#
-# This file should be version controlled and should not be manually edited.
-
-version:
- revision: "fcf2c11572af6f390246c056bc905eca609533a0"
- channel: "[user-branch]"
-
-project_type: package
diff --git a/cw_base/CHANGELOG.md b/cw_base/CHANGELOG.md
deleted file mode 100644
index 41cc7d819..000000000
--- a/cw_base/CHANGELOG.md
+++ /dev/null
@@ -1,3 +0,0 @@
-## 0.0.1
-
-* TODO: Describe initial release.
diff --git a/cw_base/LICENSE b/cw_base/LICENSE
deleted file mode 100644
index ba75c69f7..000000000
--- a/cw_base/LICENSE
+++ /dev/null
@@ -1 +0,0 @@
-TODO: Add your license here.
diff --git a/cw_base/README.md b/cw_base/README.md
deleted file mode 100644
index 4a260d8d2..000000000
--- a/cw_base/README.md
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-TODO: Put a short description of the package here that helps potential users
-know whether this package might be useful for them.
-
-## Features
-
-TODO: List what your package can do. Maybe include images, gifs, or videos.
-
-## Getting started
-
-TODO: List prerequisites and provide or point to information on how to
-start using the package.
-
-## Usage
-
-TODO: Include short and useful examples for package users. Add longer examples
-to `/example` folder.
-
-```dart
-const like = 'sample';
-```
-
-## Additional information
-
-TODO: Tell users more about the package: where to find more information, how to
-contribute to the package, how to file issues, what response they can expect
-from the package authors, and more.
diff --git a/cw_base/analysis_options.yaml b/cw_base/analysis_options.yaml
deleted file mode 100644
index a5744c1cf..000000000
--- a/cw_base/analysis_options.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-include: package:flutter_lints/flutter.yaml
-
-# Additional information about this file can be found at
-# https://dart.dev/guides/language/analysis-options
diff --git a/cw_base/devtools_options.yaml b/cw_base/devtools_options.yaml
deleted file mode 100644
index fa0b357c4..000000000
--- a/cw_base/devtools_options.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-description: This file stores settings for Dart & Flutter DevTools.
-documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
-extensions:
diff --git a/cw_base/lib/base_client.dart b/cw_base/lib/base_client.dart
deleted file mode 100644
index 4cf7bc910..000000000
--- a/cw_base/lib/base_client.dart
+++ /dev/null
@@ -1,103 +0,0 @@
-import 'dart:convert';
-
-import 'package:cw_evm/evm_chain_client.dart';
-import 'package:cw_evm/.secrets.g.dart' as secrets;
-import 'package:cw_evm/evm_chain_transaction_model.dart';
-import 'package:flutter/foundation.dart';
-import 'package:web3dart/web3dart.dart';
-
-class BaseClient extends EVMChainClient {
- @override
- Transaction createTransaction({
- required EthereumAddress from,
- required EthereumAddress to,
- required EtherAmount amount,
- EtherAmount? maxPriorityFeePerGas,
- Uint8List? data,
- int? maxGas,
- EtherAmount? gasPrice,
- EtherAmount? maxFeePerGas,
- }) {
- EtherAmount? finalGasPrice = gasPrice;
-
- if (gasPrice == null && maxFeePerGas != null) {
- // If we have EIP-1559 parameters but no legacy gasPrice, then use maxFeePerGas as gasPrice
- finalGasPrice = maxFeePerGas;
- }
-
- return Transaction(
- from: from,
- to: to,
- value: amount,
- data: data,
- maxGas: maxGas,
- gasPrice: finalGasPrice,
- // maxFeePerGas: maxFeePerGas,
- // maxPriorityFeePerGas: maxPriorityFeePerGas,
- );
- }
-
- @override
- Uint8List prepareSignedTransactionForSending(Uint8List signedTransaction) => signedTransaction;
-
- @override
- int get chainId => 8453;
-
- @override
- Future> fetchTransactions(String address,
- {String? contractAddress}) async {
- try {
- final response = await client.get(Uri.https("api.etherscan.io", "/v2/api", {
- "chainid": "$chainId",
- "module": "account",
- "action": contractAddress != null ? "tokentx" : "txlist",
- if (contractAddress != null) "contractaddress": contractAddress,
- "address": address,
- "apikey": secrets.etherScanApiKey,
- }));
-
- final jsonResponse = json.decode(response.body) as Map;
-
- if (response.statusCode >= 200 && response.statusCode < 300 && jsonResponse['status'] != 0) {
- final res = (jsonResponse['result'] as List);
-
- res.removeWhere((e) => e['value'] == '0');
-
- return res
- .map(
- (e) => EVMChainTransactionModel.fromJson(e as Map, 'ETH'),
- )
- .toList();
- }
-
- return [];
- } catch (e) {
- return [];
- }
- }
-
- @override
- Future> fetchInternalTransactions(String address) async {
- try {
- final response = await client.get(Uri.https("api.etherscan.io", "/v2/api", {
- "chainid": "$chainId",
- "module": "account",
- "action": "txlistinternal",
- "address": address,
- "apikey": secrets.etherScanApiKey,
- }));
-
- final jsonResponse = json.decode(response.body) as Map;
-
- if (response.statusCode >= 200 && response.statusCode < 300 && jsonResponse['status'] != 0) {
- return (jsonResponse['result'] as List)
- .map((e) => EVMChainTransactionModel.fromJson(e as Map, 'ETH'))
- .toList();
- }
-
- return [];
- } catch (_) {
- return [];
- }
- }
-}
diff --git a/cw_base/lib/base_mnemonics_exception.dart b/cw_base/lib/base_mnemonics_exception.dart
deleted file mode 100644
index 83f8403d2..000000000
--- a/cw_base/lib/base_mnemonics_exception.dart
+++ /dev/null
@@ -1,5 +0,0 @@
-class BaseMnemonicIsIncorrectException implements Exception {
- @override
- String toString() =>
- 'Base mnemonic has incorrect format. Mnemonic should contain 12 or 24 words separated by space.';
-}
diff --git a/cw_base/lib/base_transaction_history.dart b/cw_base/lib/base_transaction_history.dart
deleted file mode 100644
index 42d93a1e0..000000000
--- a/cw_base/lib/base_transaction_history.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-import 'dart:core';
-
-import 'package:cw_evm/evm_chain_transaction_history.dart';
-import 'package:cw_evm/evm_chain_transaction_info.dart';
-import 'package:cw_base/base_transaction_info.dart';
-
-class BaseTransactionHistory extends EVMChainTransactionHistory {
- BaseTransactionHistory({
- required super.walletInfo,
- required super.password,
- required super.encryptionFileUtils,
- });
-
- @override
- String getTransactionHistoryFileName() => 'base_transactions.json';
-
- @override
- EVMChainTransactionInfo getTransactionInfo(Map val) =>
- BaseTransactionInfo.fromJson(val);
-}
diff --git a/cw_base/lib/base_transaction_info.dart b/cw_base/lib/base_transaction_info.dart
deleted file mode 100644
index 858c4fce7..000000000
--- a/cw_base/lib/base_transaction_info.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-import 'package:cw_core/transaction_direction.dart';
-import 'package:cw_evm/evm_chain_transaction_info.dart';
-
-class BaseTransactionInfo extends EVMChainTransactionInfo {
- BaseTransactionInfo({
- required super.id,
- required super.height,
- required super.ethAmount,
- required super.ethFee,
- required super.tokenSymbol,
- required super.direction,
- required super.isPending,
- required super.date,
- required super.confirmations,
- required super.to,
- required super.from,
- super.contractAddress,
- super.exponent,
- });
-
- factory BaseTransactionInfo.fromJson(Map data) {
- return BaseTransactionInfo(
- id: data['id'] as String,
- height: data['height'] as int,
- ethAmount: BigInt.parse(data['amount']),
- exponent: data['exponent'] as int,
- ethFee: BigInt.parse(data['fee']),
- direction: parseTransactionDirectionFromInt(data['direction'] as int),
- date: DateTime.fromMillisecondsSinceEpoch(data['date'] as int),
- isPending: data['isPending'] as bool,
- confirmations: data['confirmations'] as int,
- tokenSymbol: data['tokenSymbol'] as String,
- to: data['to'],
- from: data['from'],
- contractAddress: data['contractAddress'],
- );
- }
-
- @override
- String get feeCurrency => 'ETH';
-}
diff --git a/cw_base/lib/base_wallet.dart b/cw_base/lib/base_wallet.dart
deleted file mode 100644
index a54ace643..000000000
--- a/cw_base/lib/base_wallet.dart
+++ /dev/null
@@ -1,180 +0,0 @@
-import 'dart:convert';
-
-import 'package:cw_base/base_client.dart';
-import 'package:cw_base/base_transaction_history.dart';
-import 'package:cw_base/base_transaction_info.dart';
-import 'package:cw_base/default_base_erc20_tokens.dart';
-import 'package:cw_core/cake_hive.dart';
-import 'package:cw_core/crypto_currency.dart';
-import 'package:cw_core/encryption_file_utils.dart';
-import 'package:cw_core/erc20_token.dart';
-import 'package:cw_core/pathForWallet.dart';
-import 'package:cw_core/transaction_direction.dart';
-import 'package:cw_core/wallet_info.dart';
-import 'package:cw_core/wallet_keys_file.dart';
-import 'package:cw_evm/evm_chain_transaction_history.dart';
-import 'package:cw_evm/evm_chain_transaction_info.dart';
-import 'package:cw_evm/evm_chain_transaction_model.dart';
-import 'package:cw_evm/evm_chain_transaction_priority.dart';
-import 'package:cw_evm/evm_chain_wallet.dart';
-import 'package:cw_evm/evm_erc20_balance.dart';
-import 'package:web3dart/web3dart.dart';
-
-class BaseWallet extends EVMChainWallet {
- BaseWallet({
- required super.walletInfo,
- required super.password,
- required super.derivationInfo,
- super.mnemonic,
- super.initialBalance,
- super.privateKey,
- required super.client,
- required super.encryptionFileUtils,
- super.passphrase,
- }) : super(nativeCurrency: CryptoCurrency.baseEth);
-
- @override
- int getTotalPriorityFee(EVMChainTransactionPriority priority) {
- return switch (priority) {
- EVMChainTransactionPriority.fast => EtherAmount.fromInt(EtherUnit.mwei, 5).getInWei.toInt(),
- EVMChainTransactionPriority.medium => EtherAmount.fromInt(EtherUnit.mwei, 3).getInWei.toInt(),
- EVMChainTransactionPriority.slow => EtherAmount.fromInt(EtherUnit.mwei, 1).getInWei.toInt(),
- _ => EtherAmount.fromInt(EtherUnit.mwei, 1).getInWei.toInt(),
- };
- }
-
- @override
- Future initErc20TokensBox() async {
- final boxName = "${walletInfo.name.replaceAll(" ", "_")}_${Erc20Token.baseBoxName}";
-
- evmChainErc20TokensBox = await CakeHive.openBox(boxName);
- }
-
- @override
- void addInitialTokens() {
- final initialErc20Tokens = DefaultBaseErc20Tokens().initialBaseErc20Tokens;
-
- for (final token in initialErc20Tokens) {
- if (!evmChainErc20TokensBox.containsKey(token.contractAddress)) {
- evmChainErc20TokensBox.put(token.contractAddress, token);
- } else {
- // update existing token
- final existingToken = evmChainErc20TokensBox.get(token.contractAddress);
- evmChainErc20TokensBox.put(
- token.contractAddress,
- Erc20Token.copyWith(token, enabled: existingToken!.enabled),
- );
- }
- }
- }
-
- @override
- List get getDefaultTokenContractAddresses =>
- DefaultBaseErc20Tokens().initialBaseErc20Tokens.map((e) => e.contractAddress).toList();
-
- @override
- Future checkIfScanProviderIsEnabled() async {
- return (await sharedPrefs.future).getBool("use_basescan") ?? true;
- }
-
- @override
- String getTransactionHistoryFileName() => 'base_transactions.json';
-
- @override
- Erc20Token createNewErc20TokenObject(Erc20Token token, String? iconPath) {
- return Erc20Token(
- name: token.name,
- symbol: token.symbol,
- contractAddress: token.contractAddress,
- decimal: token.decimal,
- enabled: token.enabled,
- tag: token.tag ?? 'ETH',
- iconPath: iconPath,
- isPotentialScam: token.isPotentialScam,
- );
- }
-
- @override
- EVMChainTransactionInfo getTransactionInfo(
- EVMChainTransactionModel transactionModel, String address) {
- final model = BaseTransactionInfo(
- id: transactionModel.hash,
- height: transactionModel.blockNumber,
- ethAmount: transactionModel.amount,
- direction: transactionModel.from == address
- ? TransactionDirection.outgoing
- : TransactionDirection.incoming,
- isPending: false,
- date: transactionModel.date,
- confirmations: transactionModel.confirmations,
- ethFee: BigInt.from(transactionModel.gasUsed) * transactionModel.gasPrice,
- exponent: transactionModel.tokenDecimal ?? 18,
- tokenSymbol: transactionModel.tokenSymbol ?? "ETH",
- to: transactionModel.to,
- from: transactionModel.from,
- contractAddress: transactionModel.contractAddress,
- );
- return model;
- }
-
- @override
- EVMChainTransactionHistory setUpTransactionHistory(
- WalletInfo walletInfo, String password, EncryptionFileUtils encryptionFileUtils) {
- return BaseTransactionHistory(
- walletInfo: walletInfo,
- password: password,
- encryptionFileUtils: encryptionFileUtils,
- );
- }
-
- static Future open({
- required String name,
- required String password,
- required WalletInfo walletInfo,
- required EncryptionFileUtils encryptionFileUtils,
- }) async {
- final hasKeysFile = await WalletKeysFile.hasKeysFile(name, walletInfo.type);
- final path = await pathForWallet(name: name, type: walletInfo.type);
-
- Map? data;
- try {
- final jsonSource = await encryptionFileUtils.read(path: path, password: password);
-
- data = json.decode(jsonSource) as Map;
- } catch (e) {
- if (!hasKeysFile) rethrow;
- }
-
- final balance = EVMChainERC20Balance.fromJSON(data?['balance'] as String?) ??
- EVMChainERC20Balance(BigInt.zero);
-
- final WalletKeysData keysData;
- // Migrate wallet from the old scheme to then new .keys file scheme
- if (!hasKeysFile) {
- final mnemonic = data!['mnemonic'] as String?;
- final privateKey = data['private_key'] as String?;
- final passphrase = data['passphrase'] as String?;
-
- keysData = WalletKeysData(mnemonic: mnemonic, privateKey: privateKey, passphrase: passphrase);
- } else {
- keysData = await WalletKeysFile.readKeysFile(
- name,
- walletInfo.type,
- password,
- encryptionFileUtils,
- );
- }
-
- return BaseWallet(
- walletInfo: walletInfo,
- derivationInfo: await walletInfo.getDerivationInfo(),
- password: password,
- mnemonic: keysData.mnemonic,
- privateKey: keysData.privateKey,
- passphrase: keysData.passphrase,
- initialBalance: balance,
- client: BaseClient(),
- encryptionFileUtils: encryptionFileUtils,
- );
- }
-}
diff --git a/cw_base/lib/base_wallet_service.dart b/cw_base/lib/base_wallet_service.dart
deleted file mode 100644
index 7457cbd58..000000000
--- a/cw_base/lib/base_wallet_service.dart
+++ /dev/null
@@ -1,172 +0,0 @@
-import 'package:bip39/bip39.dart' as bip39;
-import 'package:cw_core/encryption_file_utils.dart';
-import 'package:cw_core/wallet_base.dart';
-import 'package:cw_core/wallet_info.dart';
-import 'package:cw_core/wallet_type.dart';
-import 'package:cw_evm/evm_chain_wallet_creation_credentials.dart';
-import 'package:cw_evm/evm_chain_wallet_service.dart';
-import 'package:cw_base/base_wallet.dart';
-import 'package:cw_base/base_client.dart';
-import 'package:cw_base/base_mnemonics_exception.dart';
-
-class BaseWalletService extends EVMChainWalletService {
- BaseWalletService(
- super.isDirect, {
- required this.client,
- });
-
- late BaseClient client;
-
- @override
- WalletType getType() => WalletType.base;
-
- @override
- Future create(EVMChainNewWalletCredentials credentials, {bool? isTestnet}) async {
- final strength = credentials.seedPhraseLength == 24 ? 256 : 128;
-
- final mnemonic = credentials.mnemonic ?? bip39.generateMnemonic(strength: strength);
-
- final wallet = BaseWallet(
- walletInfo: credentials.walletInfo!,
- derivationInfo: await credentials.walletInfo!.getDerivationInfo(),
- mnemonic: mnemonic,
- password: credentials.password!,
- passphrase: credentials.passphrase,
- client: client,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
- return wallet;
- }
-
- @override
- Future openWallet(String name, String password) async {
- final walletInfo = await WalletInfo.get(name, getType());
- if (walletInfo == null) {
- throw Exception('Wallet not found');
- }
-
- try {
- final wallet = await BaseWallet.open(
- name: name,
- password: password,
- walletInfo: walletInfo,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
- saveBackup(name);
- return wallet;
- } catch (_) {
- await restoreWalletFilesFromBackup(name);
-
- final wallet = await BaseWallet.open(
- name: name,
- password: password,
- walletInfo: walletInfo,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
- return wallet;
- }
- }
-
- @override
- Future restoreFromKeys(EVMChainRestoreWalletFromPrivateKey credentials,
- {bool? isTestnet}) async {
- final wallet = BaseWallet(
- password: credentials.password!,
- privateKey: credentials.privateKey,
- walletInfo: credentials.walletInfo!,
- derivationInfo: await credentials.walletInfo!.getDerivationInfo(),
- client: client,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
- return wallet;
- }
-
- @override
- Future restoreFromHardwareWallet(
- EVMChainRestoreWalletFromHardware credentials) async {
- final derivationInfo = await credentials.walletInfo!.getDerivationInfo();
- derivationInfo.derivationType = DerivationType.bip39;
- derivationInfo.derivationPath = "m/44'/60'/${credentials.hwAccountData.accountIndex}'/0/0";
- await derivationInfo.save();
- credentials.walletInfo!.hardwareWalletType = credentials.hardwareWalletType;
- credentials.walletInfo!.address = credentials.hwAccountData.address;
- await credentials.walletInfo!.save();
-
- final wallet = BaseWallet(
- walletInfo: credentials.walletInfo!,
- derivationInfo: derivationInfo,
- password: credentials.password!,
- client: client,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
-
- return wallet;
- }
-
- @override
- Future restoreFromSeed(EVMChainRestoreWalletFromSeedCredentials credentials,
- {bool? isTestnet}) async {
- if (!bip39.validateMnemonic(credentials.mnemonic)) {
- throw BaseMnemonicIsIncorrectException();
- }
-
- final wallet = BaseWallet(
- password: credentials.password!,
- mnemonic: credentials.mnemonic,
- walletInfo: credentials.walletInfo!,
- derivationInfo: await credentials.walletInfo!.getDerivationInfo(),
- passphrase: credentials.passphrase,
- client: client,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await wallet.init();
- wallet.addInitialTokens();
- await wallet.save();
-
- return wallet;
- }
-
- @override
- Future rename(String currentName, String password, String newName) async {
- final currentWalletInfo = await WalletInfo.get(currentName, getType());
- if (currentWalletInfo == null) {
- throw Exception('Wallet not found');
- }
- final currentWallet = await BaseWallet.open(
- password: password,
- name: currentName,
- walletInfo: currentWalletInfo,
- encryptionFileUtils: encryptionFileUtilsFor(isDirect),
- );
-
- await currentWallet.renameWalletFiles(newName);
- await saveBackup(newName);
-
- final newWalletInfo = currentWalletInfo;
- newWalletInfo.id = WalletBase.idFor(newName, getType());
- newWalletInfo.name = newName;
-
- newWalletInfo.save();
- }
-}
diff --git a/cw_base/lib/cw_base.dart b/cw_base/lib/cw_base.dart
deleted file mode 100644
index 298576d81..000000000
--- a/cw_base/lib/cw_base.dart
+++ /dev/null
@@ -1,5 +0,0 @@
-/// A Calculator.
-class Calculator {
- /// Returns [value] plus 1.
- int addOne(int value) => value + 1;
-}
diff --git a/cw_base/lib/default_base_erc20_tokens.dart b/cw_base/lib/default_base_erc20_tokens.dart
deleted file mode 100644
index 967718373..000000000
--- a/cw_base/lib/default_base_erc20_tokens.dart
+++ /dev/null
@@ -1,71 +0,0 @@
-import 'package:cw_core/crypto_currency.dart';
-import 'package:cw_core/erc20_token.dart';
-
-class DefaultBaseErc20Tokens {
- final List _defaultTokens = [
- Erc20Token(
- name: "USD Coin",
- symbol: "USDC",
- contractAddress: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
- decimal: 6,
- enabled: true,
- ),
- Erc20Token(
- name: "USDe",
- symbol: "USDe",
- contractAddress: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34",
- decimal: 18,
- enabled: true,
- ),
- Erc20Token(
- name: "Dai",
- symbol: "DAI",
- contractAddress: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
- decimal: 18,
- enabled: true,
- ),
- Erc20Token(
- name: "Bridged Tether USD",
- symbol: "USDT",
- contractAddress: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
- decimal: 6,
- enabled: true,
- ),
- Erc20Token(
- name: "Wrapped Ether",
- symbol: "WETH",
- contractAddress: "0x4200000000000000000000000000000000000006",
- decimal: 18,
- enabled: false,
- ),
- Erc20Token(
- name: "Wrapped BTC",
- symbol: "WBTC",
- contractAddress: "0x0555E30da8f98308EdB960aa94C0Db47230d2B9c",
- decimal: 8,
- enabled: false,
- ),
- Erc20Token(
- name: "SPX6900",
- symbol: "SPX",
- contractAddress: "0x50dA645f148798F68EF2d7dB7C1CB22A6819bb2C",
- decimal: 8,
- enabled: false,
- ),
- ];
-
- List get initialBaseErc20Tokens => _defaultTokens.map((token) {
- String? iconPath;
- if (token.iconPath?.isEmpty ?? true) {
- try {
- iconPath = CryptoCurrency.all
- .firstWhere((element) => element.title.toUpperCase() == token.symbol.toUpperCase())
- .iconPath;
- } catch (_) {}
- } else {
- iconPath = token.iconPath;
- }
-
- return Erc20Token.copyWith(token, icon: iconPath, tag: 'BASE');
- }).toList();
-}
diff --git a/cw_base/pubspec.yaml b/cw_base/pubspec.yaml
deleted file mode 100644
index f94468bce..000000000
--- a/cw_base/pubspec.yaml
+++ /dev/null
@@ -1,73 +0,0 @@
-name: cw_base
-description: "Base package for Cake Wallet"
-version: 0.0.1
-publish_to: none
-homepage: https://cakewallet.com
-
-environment:
- sdk: '>=3.0.6 <4.0.0'
- flutter: ">=1.17.0"
-
-dependencies:
- flutter:
- sdk: flutter
- cw_core:
- path: ../cw_core
- cw_ethereum:
- path: ../cw_ethereum
- cw_evm:
- path: ../cw_evm
- web3dart: ^2.7.1
- hive: ^2.2.3
- bip39: ^1.0.6
- collection: ^1.17.1
-
-dependency_overrides:
- web3dart:
- git:
- url: https://github.com/cake-tech/web3dart.git
- ref: cake
- watcher: ^1.1.0
-
-dev_dependencies:
- flutter_test:
- sdk: flutter
- flutter_lints: ^2.0.0
- build_runner: ^2.4.15
-
-# For information on the generic Dart part of this file, see the
-# following page: https://dart.dev/tools/pub/pubspec
-
-# The following section is specific to Flutter packages.
-flutter:
-
- # To add assets to your package, add an assets section, like this:
- # assets:
- # - images/a_dot_burr.jpeg
- # - images/a_dot_ham.jpeg
- #
- # For details regarding assets in packages, see
- # https://flutter.dev/to/asset-from-package
- #
- # An image asset can refer to one or more resolution-specific "variants", see
- # https://flutter.dev/to/resolution-aware-images
-
- # To add custom fonts to your package, add a fonts section here,
- # in this "flutter" section. Each entry in this list should have a
- # "family" key with the font family name, and a "fonts" key with a
- # list giving the asset and other descriptors for the font. For
- # example:
- # fonts:
- # - family: Schyler
- # fonts:
- # - asset: fonts/Schyler-Regular.ttf
- # - asset: fonts/Schyler-Italic.ttf
- # style: italic
- # - family: Trajan Pro
- # fonts:
- # - asset: fonts/TrajanPro.ttf
- # - asset: fonts/TrajanPro_Bold.ttf
- # weight: 700
- #
- # For details regarding fonts in packages, see
- # https://flutter.dev/to/font-from-package
diff --git a/cw_base/test/cw_base_test.dart b/cw_base/test/cw_base_test.dart
deleted file mode 100644
index 31f598069..000000000
--- a/cw_base/test/cw_base_test.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-import 'package:flutter_test/flutter_test.dart';
-
-import 'package:cw_base/cw_base.dart';
-
-void main() {
- test('adds one to input values', () {
- final calculator = Calculator();
- expect(calculator.addOne(2), 3);
- expect(calculator.addOne(-7), -6);
- expect(calculator.addOne(0), 1);
- });
-}
diff --git a/cw_core/lib/crypto_currency.dart b/cw_core/lib/crypto_currency.dart
index d3f9faf22..b581e803f 100644
--- a/cw_core/lib/crypto_currency.dart
+++ b/cw_core/lib/crypto_currency.dart
@@ -250,7 +250,8 @@ class CryptoCurrency extends EnumerableItem with Serializable implemen
static const cbbtc = CryptoCurrency(title: 'CBBTC', tag: 'ETH', fullName: 'Coinbase Wrapped BTC', raw: 103, name: 'cbbtc', iconPath: 'assets/images/cbbtc_icon.png', decimals: 8);
static const baseEth = CryptoCurrency(title: 'ETH', tag: 'BASE', fullName: 'Ethereum', raw: 104, name: 'baseth', iconPath: 'assets/images/crypto/base_icon.webp', decimals: 18);
static const usde = CryptoCurrency(title: 'USDE', tag: 'BASE', fullName: 'Ethena USDE', raw: 105, name: 'usde', iconPath: 'assets/images/crypto/ethena-usde-logo.png', decimals: 18);
- static const arbEth = CryptoCurrency(title: 'ETH', tag: 'ARB', fullName: 'Arbitrum', raw: 106, name: 'arbeth', iconPath: 'assets/images/crypto/arbitrum.webp', decimals: 18);
+ static const arbEth = CryptoCurrency(title: 'ETH', tag: 'ARB', fullName: 'Ethereum (Arbitrum One)', raw: 106, name: 'arbeth', iconPath: 'assets/images/crypto/ethereum.webp', decimals: 18);
+ static const usdcArb = CryptoCurrency(title: 'USDC', tag: 'ARB', fullName: 'USDC Coin', raw: 107, name: 'usdcarb', iconPath: 'assets/images/crypto/usdc.webp', decimals: 6);
static final Map _rawCurrencyMap =
[...all, ...havenCurrencies].fold