diff --git a/cw_ethereum/lib/ethereum_client.dart b/cw_ethereum/lib/ethereum_client.dart index e10e79f1e..0ef8ad54a 100644 --- a/cw_ethereum/lib/ethereum_client.dart +++ b/cw_ethereum/lib/ethereum_client.dart @@ -6,6 +6,7 @@ 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'; @@ -210,6 +211,21 @@ I/flutter ( 4474): Gas Used: 53000 } } + Future checkEnsName(String ensName) async { + if (_client == null) { + return null; + } + try { + final ens = Ens(client: _client!); + + final addr = await ens.withName(ensName).getAddress(); + return addr.hex; + } catch (e) { + print(e); + return null; + } + } + // Future _getDecimalPlacesForContract(DeployedContract contract) async { // final String abi = await rootBundle.loadString("assets/abi_json/erc20_abi.json"); // final contractAbi = ContractAbi.fromJson(abi, "ERC20"); diff --git a/cw_ethereum/pubspec.yaml b/cw_ethereum/pubspec.yaml index 5d19589f3..895098658 100644 --- a/cw_ethereum/pubspec.yaml +++ b/cw_ethereum/pubspec.yaml @@ -21,6 +21,7 @@ dependencies: hex: ^0.2.0 http: ^1.1.0 shared_preferences: ^2.0.15 + ens_dart: ^1.0.0 cw_core: path: ../cw_core @@ -31,6 +32,9 @@ dev_dependencies: mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 +dependency_overrides: + http: 1.1.0 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec