Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public getAddressDetails(address: string): Address {
const destinationDetails = url.parse(address);
const destinationAddress = destinationDetails.pathname;
if (!destinationAddress || !rippleAddressCodec.isValidClassicAddress(destinationAddress)) {
throw new InvalidAddressError(`destination address "${destinationAddress}" is not valid`);
}
// there are no other properties like destination tags
if (destinationDetails.pathname === address) {
return {
address: address,
destinationTag: undefined,
};
}
if (!destinationDetails.query) {
throw new InvalidAddressError('no query params present');
}
const queryDetails = querystring.parse(destinationDetails.query);
if (!queryDetails.dt) {
function isValidAddress(address: string): boolean {
return isValidXAddress(address) || isValidClassicAddress(address)
}