continue formatting

This commit is contained in:
Omar
2026-07-15 05:14:40 +03:00
parent 16ddc0837a
commit b1922fc663
29 changed files with 1115 additions and 723 deletions
+6 -3
View File
@@ -48,7 +48,8 @@ void main() {
group("getCanonicalCryptoAmount", () {
test("Amount should not change for Bitcoin", () {
final amount = amountParsingProxy.getCanonicalCryptoAmount("0.000001", CryptoCurrency.btc);
final amount =
amountParsingProxy.getCanonicalCryptoAmount("0.000001", CryptoCurrency.btc);
expect(amount, "0.000001");
});
@@ -58,7 +59,8 @@ void main() {
});
test("Amount should not change for Bitcoin", () {
final amount = amountParsingProxy.getCanonicalCryptoAmount("0.000001", CryptoCurrency.btcln);
final amount =
amountParsingProxy.getCanonicalCryptoAmount("0.000001", CryptoCurrency.btcln);
expect(amount, "0.000001");
});
@@ -118,7 +120,8 @@ void main() {
});
test("Amount should be formated to Satoshi for Bitcoin Lightning", () {
final amount = amountParsingProxy.getDisplayCryptoAmount("0.000001", CryptoCurrency.btcln);
final amount =
amountParsingProxy.getDisplayCryptoAmount("0.000001", CryptoCurrency.btcln);
expect(amount, "100");
});
@@ -48,7 +48,8 @@ void main() {
});
test('detects Lightning invoice', () {
const invoice = 'lnbc1u1p3zj7j8pp5vkwxc4vxfzgzxcjzk5ksp0l7jgrgzmqxqmexxp8e8gfqk6s0knnqdlc35hsggzypnxw7xxxnrvd3hscqzpgxqrrsssp5txs5g8vkdmdtnm8g5v9m3u094nnxkl0jjf38jj5xn2pptxlqkwn7gpgfkt7q6z0frcj7vjy4mv7659hccln2e0gzt4ufnsukxcnknh7e58kwnr8pk6kgv6vrghcpld2z5n';
const invoice =
'lnbc1u1p3zj7j8pp5vkwxc4vxfzgzxcjzk5ksp0l7jgrgzmqxqmexxp8e8gfqk6s0knnqdlc35hsggzypnxw7xxxnrvd3hscqzpgxqrrsssp5txs5g8vkdmdtnm8g5v9m3u094nnxkl0jjf38jj5xn2pptxlqkwn7gpgfkt7q6z0frcj7vjy4mv7659hccln2e0gzt4ufnsukxcnknh7e58kwnr8pk6kgv6vrghcpld2z5n';
final result = UniversalAddressDetector.detectAddress(invoice);
expect(result.isValid, true);
@@ -39,8 +39,7 @@ void main() {
});
test('extracts Ethereum address correctly', () {
final raw =
'Send ETH to 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 thanks';
final raw = 'Send ETH to 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 thanks';
final result = AddressResolverUtils.extractAddressByType(
raw: raw,
type: CryptoCurrency.eth,
@@ -60,25 +59,21 @@ void main() {
});
test('extracts Bitcoin Cash address correctly', () {
final raw =
'BCH: bitcoincash:qr2z7dusk64qnq97azhg0u0hlf7qgwwfzyj92jgmqj';
final raw = 'BCH: bitcoincash:qr2z7dusk64qnq97azhg0u0hlf7qgwwfzyj92jgmqj';
final result = AddressResolverUtils.extractAddressByType(
raw: raw,
type: CryptoCurrency.bch,
);
expect(
result, 'bitcoincash:qr2z7dusk64qnq97azhg0u0hlf7qgwwfzyj92jgmqj');
expect(result, 'bitcoincash:qr2z7dusk64qnq97azhg0u0hlf7qgwwfzyj92jgmqj');
});
test('extracts Nano address correctly', () {
final raw =
'NANO: nano_1natrium1o3z5519ifou7xii8crpxpk8y65qmkih8e8bpsjri651oza8imdd';
final raw = 'NANO: nano_1natrium1o3z5519ifou7xii8crpxpk8y65qmkih8e8bpsjri651oza8imdd';
final result = AddressResolverUtils.extractAddressByType(
raw: raw,
type: CryptoCurrency.nano,
);
expect(result,
'nano_1natrium1o3z5519ifou7xii8crpxpk8y65qmkih8e8bpsjri651oza8imdd');
expect(result, 'nano_1natrium1o3z5519ifou7xii8crpxpk8y65qmkih8e8bpsjri651oza8imdd');
});
test('returns null for unsupported currency', () {
@@ -101,9 +96,7 @@ void main() {
final raw =
'monero_wallet:467iotZU5tvG26k2xdZWkJ7gwATFVhfbuV3yDoWx5jHoPwxEi4f5BuJQwkP6GpCb1sZvUVB7nbSkgEuW8NKrh9KKRRga5qz?spend_key=029c559cd7669f14e91fd835144916009f8697ab5ac5c7f7c06e1ff869c17b0b&view_key=afaf646edbff3d3bcee8efd3383ffe5d20c947040f74e1110b70ca0fbb0ef90d';
final result = AddressResolverUtils.extractAddressByType(
raw: raw,
type: CryptoCurrency.xmr,
requireSurroundingWhitespaces: false);
raw: raw, type: CryptoCurrency.xmr, requireSurroundingWhitespaces: false);
expect(result,
'467iotZU5tvG26k2xdZWkJ7gwATFVhfbuV3yDoWx5jHoPwxEi4f5BuJQwkP6GpCb1sZvUVB7nbSkgEuW8NKrh9KKRRga5qz');
});
@@ -119,16 +112,16 @@ sp1qq0avpawwjg4l66p6lqafj0vlvm6rlhdc6qt0r6dfual835vhs3gvkq63pechaqezvn7j7uj2jucw
#LTC MWEB
ltcmweb1qq0at62jjucmawxp78qutn0cqwkwahcfx7fxls0r2ma5llg5w6wyy2qe20gxa3rku2658j88zg9d2j4ttpw35k0a5nrg93h5nq3wyvkcgwc3q4dgc
''';
final resultXmr = AddressResolverUtils.extractAddressByType(
raw: raw, type: CryptoCurrency.xmr);
final resultXmr =
AddressResolverUtils.extractAddressByType(raw: raw, type: CryptoCurrency.xmr);
expect(resultXmr,
'89bH6i3ftaWSWuPJJYSQuuApWJ8xzinCEbbnAXN1Z3mGGUuAFdpBUg82R9MvJDSheJ6kW2dyMQEFUGM4tsZqRb2Q75UXqvc');
final resultBtc = AddressResolverUtils.extractAddressByType(
raw: raw, type: CryptoCurrency.btc);
final resultBtc =
AddressResolverUtils.extractAddressByType(raw: raw, type: CryptoCurrency.btc);
expect(resultBtc,
'sp1qq0avpawwjg4l66p6lqafj0vlvm6rlhdc6qt0r6dfual835vhs3gvkq63pechaqezvn7j7uj2jucwj5k7nenpw2r86wf42xv6wqdvxuk5rggrul45');
final resultLtc = AddressResolverUtils.extractAddressByType(
raw: raw, type: CryptoCurrency.ltc);
final resultLtc =
AddressResolverUtils.extractAddressByType(raw: raw, type: CryptoCurrency.ltc);
expect(resultLtc,
'ltcmweb1qq0at62jjucmawxp78qutn0cqwkwahcfx7fxls0r2ma5llg5w6wyy2qe20gxa3rku2658j88zg9d2j4ttpw35k0a5nrg93h5nq3wyvkcgwc3q4dgc');
});
+1 -2
View File
@@ -23,8 +23,7 @@ void main() {
});
test("extract address and amount from Cake Style Uri", () {
final uri =
Uri.parse("ethereum:0xCfc1650da7C961FD82998e7e30ca5f699D0aBf41@1?amount=2.00");
final uri = Uri.parse("ethereum:0xCfc1650da7C961FD82998e7e30ca5f699D0aBf41@1?amount=2.00");
final paymentRequest = PaymentRequest.fromUri(uri);
expect(paymentRequest.address, "0xCfc1650da7C961FD82998e7e30ca5f699D0aBf41");