limit when to check for thornames to only if the text does not match an address and less than or equal 30 char (#2438)

Omar Hatem committed Aug 8, 2025 at 05:26 UTC 601a6a5a8f0e32039f915bb3ba607882dce1a8bc
2 files changed +10 -7
lib/entities/bip_353_record.dart
-1
@@ -4,7 +4,6 @@ import 'dart:isolate';
4 import 'package:basic_utils/basic_utils.dart';
5 import 'package:cake_wallet/generated/i18n.dart';
6 import 'package:cake_wallet/src/widgets/alert_with_picker_option.dart';
7 -import 'package:cake_wallet/src/widgets/picker.dart';
7 import 'package:cake_wallet/utils/show_pop_up.dart';
8 import 'package:cw_core/crypto_currency.dart';
9 import 'package:cw_core/utils/print_verbose.dart';
lib/entities/parse_address_from_domain.dart
+10 -6
@@ -313,12 +313,16 @@ class AddressResolver {
313 }
314 }
315
316 - final thorChainAddress = await ThorChainExchangeProvider.lookupAddressByName(text);
317 - if (thorChainAddress != null && thorChainAddress.isNotEmpty) {
318 - String? address =
319 - thorChainAddress[ticker] ?? (ticker == 'RUNE' ? thorChainAddress['THOR'] : null);
320 - if (address != null) {
321 - return ParsedAddress.thorChainAddress(address: address, name: text);
316 + final isNormalAddress = extractAddressByType(raw: text, type: currency)?.isNotEmpty ?? false;
317 +
318 + if (text.length <= 30 && !isNormalAddress) {
319 + final thorChainAddress = await ThorChainExchangeProvider.lookupAddressByName(text);
320 + if (thorChainAddress != null && thorChainAddress.isNotEmpty) {
321 + String? address =
322 + thorChainAddress[ticker] ?? (ticker == 'RUNE' ? thorChainAddress['THOR'] : null);
323 + if (address != null) {
324 + return ParsedAddress.thorChainAddress(address: address, name: text);
325 + }
326 }
327 }
328