Fix BSC and ARB QR scan in pay-anything flow (#3075)

This commit is contained in:
David Adegoke
2026-03-13 17:47:00 +01:00
committed by GitHub
parent dd8a0ec904
commit c72f6fd627
2 changed files with 13 additions and 3 deletions
+1
View File
@@ -303,6 +303,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
'lightning': btcln,
'base': baseEth,
'arbitrum': arbEth,
'bsc': bnb,
};
static CryptoCurrency deserialize({required int raw}) {
+12 -3
View File
@@ -2,6 +2,7 @@ import 'package:cake_wallet/utils/payment_request.dart';
import 'package:cake_wallet/core/address_validator.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/lnurl.dart';
import 'package:cw_core/payment_uris.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cw_core/currency_for_wallet_type.dart';
@@ -72,10 +73,18 @@ class UniversalAddressDetector {
final paymentRequest = PaymentRequest.fromUri(uri);
// Determine currency from scheme
final currency = CryptoCurrency.fromString(uri.scheme.toLowerCase());
CryptoCurrency currency;
int? chainId;
if (uri.scheme.toLowerCase() == 'ethereum') {
final erc681 = ERC681URI.fromUri(uri);
chainId = erc681.chainId;
currency = getCryptoCurrencyByChainId(chainId);
} else {
currency = CryptoCurrency.fromString(uri.scheme.toLowerCase());
chainId = getChainIdByCryptoCurrency(currency);
}
final walletType = cryptoCurrencyOrTokenToWalletType(currency);
final chainId = getChainIdByCryptoCurrency(currency);
return AddressDetectionResult(
address: paymentRequest.address,