Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Special case new style LTC addresses for validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
sproxet committed Oct 17, 2023
1 parent 117bf6a commit 3b547c0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/renderer/components/CoinSwapPage/CoinSwapDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@ const CoinNames = {
const ChainOptions = PROVIDERS.map(p => ({id: p, name: p}));
const DEFAULT_PROVIDER = PROVIDERS[0];
function isValidLTCAddress(address) {
if (CryptoAddressValidator.validate(address, 'LTC'))
return true;
// This is actually a really terrible validation, but their addresses use custom stuff that no one supports and it's
// not really worth it to make a custom decoder just to parse their addresses.
return !!address.match(/^ltc[a-zA-Z0-9]{38,42}$/);
}
export default {
name: 'CoinSwapDetail',
Expand Down Expand Up @@ -350,6 +359,9 @@ export default {
else
return 'Unknown coin (this is a bug)';
if (this.selectedCoin == 'LTC')
return isValidLTCAddress(value) || 'Invalid address';
try {
return !!CryptoAddressValidator.validate(value, coin, 'prod') || 'Invalid address';
} catch(e) {
Expand Down

0 comments on commit 3b547c0

Please sign in to comment.