CW-1208: Pay Anything EVM enahancements (#2600)

* feat: Pay Anything EVM enahancements

* ifx: Add baseEth to address validator switch case

* fix: Error detecting other wallet types

* feat: Preserve QR amount and other data through evm chain selection flow

* Update container color to surfaceContainer

* feat: Add support for Bitcoin Lightning Network detection

- Identify Base QR codes when scanned
- Display all available currencies for network
- Enhance detector to recognize lightning addresses

* fix: Update token selection for currently selected wallet

* fix: Improve token matching logic for EVM networks

* feat: Update selected currency when wallet is switched

* ui: Add chain badge to the swap confirmation bottomsheet

* fix: Asks to switch wallets even if the current wallet type is the same as the QR. Fix merge conflicts too

* fix: Handle matching logic internally and general cleanups

* fix: Terminate flow if address is not a valid parsed address

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
Co-authored-by: tuxsudo <tuxsudo@tux.pizza>
This commit is contained in:
David Adegoke
2025-11-11 21:15:54 +01:00
committed by GitHub
co-authored by Omar Hatem tuxsudo
parent c74f0e5f82
commit 238022c466
43 changed files with 764 additions and 73 deletions
@@ -46,6 +46,36 @@ void main() {
expect(result.address, '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa');
expect(result.amount, '0.001');
});
test('detects Lightning invoice', () {
const invoice = 'lnbc1u1p3zj7j8pp5vkwxc4vxfzgzxcjzk5ksp0l7jgrgzmqxqmexxp8e8gfqk6s0knnqdlc35hsggzypnxw7xxxnrvd3hscqzpgxqrrsssp5txs5g8vkdmdtnm8g5v9m3u094nnxkl0jjf38jj5xn2pptxlqkwn7gpgfkt7q6z0frcj7vjy4mv7659hccln2e0gzt4ufnsukxcnknh7e58kwnr8pk6kgv6vrghcpld2z5n';
final result = UniversalAddressDetector.detectAddress(invoice);
expect(result.isValid, true);
expect(result.detectedCurrency, CryptoCurrency.btcln);
expect(result.detectedWalletType, WalletType.bitcoin);
expect(result.address, invoice);
});
test('detects Lightning address', () {
const address = 'alice@lightning.com';
final result = UniversalAddressDetector.detectAddress(address);
expect(result.isValid, true);
expect(result.detectedCurrency, CryptoCurrency.btcln);
expect(result.detectedWalletType, WalletType.bitcoin);
expect(result.address, address);
});
test('detects LNURL format', () {
const address = 'LNURL1DP68GURN8GHJ7UM9WFMXCCRVFH8RHYEE5QDKURZQDF8JUK6RKCE0E';
final result = UniversalAddressDetector.detectAddress(address);
expect(result.isValid, true);
expect(result.detectedCurrency, CryptoCurrency.btcln);
expect(result.detectedWalletType, WalletType.bitcoin);
expect(result.address, address);
});
});
group('Monero Address Detection', () {