ens changes

This commit is contained in:
fosse 2023-09-19 12:09:13 -04:00
parent ed5a139490
commit 6b1c7e832d
2 changed files with 20 additions and 0 deletions

View file

@ -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<String?> 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<int> _getDecimalPlacesForContract(DeployedContract contract) async {
// final String abi = await rootBundle.loadString("assets/abi_json/erc20_abi.json");
// final contractAbi = ContractAbi.fromJson(abi, "ERC20");

View file

@ -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