mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
Code Enhancements
This commit is contained in:
parent
431a17ab08
commit
a515076696
6 changed files with 7 additions and 11 deletions
|
@ -6,7 +6,6 @@ import 'package:cw_ethereum/erc20_balance.dart';
|
|||
import 'package:cw_core/erc20_token.dart';
|
||||
import 'package:cw_ethereum/ethereum_transaction_model.dart';
|
||||
import 'package:cw_ethereum/pending_ethereum_transaction.dart';
|
||||
import 'package:ens_dart/ens_dart.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:web3dart/web3dart.dart';
|
||||
|
|
|
@ -883,7 +883,7 @@ Future<void> setup({
|
|||
getIt.registerFactory(() => YatService());
|
||||
|
||||
getIt.registerFactory(() => AddressResolver(
|
||||
yatService: getIt.get<YatService>(), walletType: getIt.get<AppStore>().wallet!.type));
|
||||
yatService: getIt.get<YatService>(), wallet: getIt.get<AppStore>().wallet!));
|
||||
|
||||
getIt.registerFactoryParam<FullscreenQRPage, QrViewData, void>(
|
||||
(QrViewData viewData, _) => FullscreenQRPage(qrViewData: viewData));
|
||||
|
|
|
@ -10,7 +10,7 @@ class EnsRecord {
|
|||
Web3Client? _client;
|
||||
|
||||
if (wallet != null && wallet.type == WalletType.ethereum) {
|
||||
_client = ethereum!.getWeb3Client(wallet) as Web3Client?;
|
||||
_client = ethereum!.getWeb3Client(wallet);
|
||||
}
|
||||
|
||||
if (_client == null) {
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
import 'package:cake_wallet/core/address_validator.dart';
|
||||
import 'package:cake_wallet/core/yat_service.dart';
|
||||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/entities/ens_record.dart';
|
||||
import 'package:cake_wallet/entities/openalias_record.dart';
|
||||
import 'package:cake_wallet/entities/parsed_address.dart';
|
||||
import 'package:cake_wallet/entities/unstoppable_domain_address.dart';
|
||||
import 'package:cake_wallet/entities/emoji_string_extension.dart';
|
||||
import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:cake_wallet/twitter/twitter_api.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
|
@ -15,10 +12,11 @@ import 'package:cw_core/wallet_type.dart';
|
|||
import 'package:cake_wallet/entities/fio_address_provider.dart';
|
||||
|
||||
class AddressResolver {
|
||||
AddressResolver({required this.yatService, required this.walletType});
|
||||
AddressResolver({required this.yatService, required this.wallet}) : walletType = wallet.type;
|
||||
|
||||
final YatService yatService;
|
||||
final WalletType walletType;
|
||||
final WalletBase wallet;
|
||||
|
||||
static const unstoppableDomains = [
|
||||
'crypto',
|
||||
|
@ -102,7 +100,6 @@ class AddressResolver {
|
|||
}
|
||||
|
||||
if (text.endsWith(".eth")) {
|
||||
WalletBase? wallet = getIt.get<AppStore>().wallet!;
|
||||
final address = await EnsRecord.fetchEnsAddress(text, wallet: wallet);
|
||||
if (address.isNotEmpty && address != "0x0000000000000000000000000000000000000000") {
|
||||
return ParsedAddress.fetchEnsAddress(name: text, address: address);
|
||||
|
|
|
@ -133,7 +133,7 @@ class CWEthereum extends Ethereum {
|
|||
}
|
||||
|
||||
@override
|
||||
dynamic getWeb3Client(WalletBase wallet) {
|
||||
Web3Client? getWeb3Client(WalletBase wallet) {
|
||||
return (wallet as EthereumWallet).getWeb3Client();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -467,7 +467,6 @@ Future<void> generateEthereum(bool hasImplementation) async {
|
|||
final outputFile = File(ethereumOutputPath);
|
||||
const ethereumCommonHeaders = """
|
||||
import 'package:cake_wallet/view_model/send/output.dart';
|
||||
import 'package:cw_core/crypto_amount_format.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
import 'package:cw_core/erc20_token.dart';
|
||||
import 'package:cw_core/output_info.dart';
|
||||
|
@ -478,6 +477,7 @@ import 'package:cw_core/wallet_credentials.dart';
|
|||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/wallet_service.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:web3dart/web3dart.dart';
|
||||
""";
|
||||
const ethereumCWHeaders = """
|
||||
import 'package:cw_ethereum/ethereum_formatter.dart';
|
||||
|
@ -525,7 +525,7 @@ abstract class Ethereum {
|
|||
|
||||
CryptoCurrency assetOfTransaction(WalletBase wallet, TransactionInfo transaction);
|
||||
void updateEtherscanUsageState(WalletBase wallet, bool isEnabled);
|
||||
dynamic getWeb3Client(WalletBase wallet);
|
||||
Web3Client? getWeb3Client(WalletBase wallet);
|
||||
}
|
||||
""";
|
||||
|
||||
|
|
Loading…
Reference in a new issue