Add withdrawal address validation according to this issue: https://development.tornadocash.community/tornadocash/tornado-cli/issues/6

This commit is contained in:
Theo 2023-05-16 18:00:35 +03:00
parent 1082b382c2
commit 44a8b82b00

5
cli.js

@ -457,6 +457,11 @@ async function withdraw({ deposit, currency, amount, recipient, relayerURL, refu
if (currency === netSymbol.toLowerCase() && refund !== '0') { if (currency === netSymbol.toLowerCase() && refund !== '0') {
throw new Error('The ETH purchase is supposted to be 0 for ETH withdrawals'); throw new Error('The ETH purchase is supposted to be 0 for ETH withdrawals');
} }
if (!web3.utils.isAddress(recipient)) {
throw new Error('Recipient address is not valid');
}
refund = toWei(refund); refund = toWei(refund);
if (relayerURL) { if (relayerURL) {
if (relayerURL.endsWith('.eth')) { if (relayerURL.endsWith('.eth')) {