From 601a6a5a8f0e32039f915bb3ba607882dce1a8bc Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Fri, 8 Aug 2025 05:26:22 +0300 Subject: [PATCH] limit when to check for thornames to only if the text does not match an address and less than or equal 30 char (#2438) --- lib/entities/bip_353_record.dart | 1 - lib/entities/parse_address_from_domain.dart | 16 ++++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/entities/bip_353_record.dart b/lib/entities/bip_353_record.dart index e8451fd79..9a2a50e0a 100644 --- a/lib/entities/bip_353_record.dart +++ b/lib/entities/bip_353_record.dart @@ -4,7 +4,6 @@ import 'dart:isolate'; import 'package:basic_utils/basic_utils.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/widgets/alert_with_picker_option.dart'; -import 'package:cake_wallet/src/widgets/picker.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/utils/print_verbose.dart'; diff --git a/lib/entities/parse_address_from_domain.dart b/lib/entities/parse_address_from_domain.dart index fa7184e8e..b2621a688 100644 --- a/lib/entities/parse_address_from_domain.dart +++ b/lib/entities/parse_address_from_domain.dart @@ -313,12 +313,16 @@ class AddressResolver { } } - final thorChainAddress = await ThorChainExchangeProvider.lookupAddressByName(text); - if (thorChainAddress != null && thorChainAddress.isNotEmpty) { - String? address = - thorChainAddress[ticker] ?? (ticker == 'RUNE' ? thorChainAddress['THOR'] : null); - if (address != null) { - return ParsedAddress.thorChainAddress(address: address, name: text); + final isNormalAddress = extractAddressByType(raw: text, type: currency)?.isNotEmpty ?? false; + + if (text.length <= 30 && !isNormalAddress) { + final thorChainAddress = await ThorChainExchangeProvider.lookupAddressByName(text); + if (thorChainAddress != null && thorChainAddress.isNotEmpty) { + String? address = + thorChainAddress[ticker] ?? (ticker == 'RUNE' ? thorChainAddress['THOR'] : null); + if (address != null) { + return ParsedAddress.thorChainAddress(address: address, name: text); + } } }