From f0cde287e1fc176770383955a3498dd757e723fb Mon Sep 17 00:00:00 2001 From: zx9r Date: Mon, 1 Aug 2022 03:03:33 +0200 Subject: [PATCH] Clean up and finish new adress validator method (#202) * Removed coinaddrvalidator dependency * Return generic "Ivalid address" error message instead of the error returned by bitcoind when validating an address * Modified messages related to bitcoin addresses validation --- api/utils.py | 3 +-- frontend/static/locales/en.json | 11 +++++------ frontend/static/locales/es.json | 7 +++---- requirements.txt | 1 - 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/api/utils.py b/api/utils.py index 85d7d743..a6e780e6 100644 --- a/api/utils.py +++ b/api/utils.py @@ -51,9 +51,8 @@ def validate_onchain_address(address): try: validation = bitcoind_rpc('validateaddress', [address]) if not validation['isvalid']: - return False, {"bad_address": validation['error']} + return False, {"bad_address": "Invalid address"} except: - # TODO: log the exception ? return False, {"bad_address": 'Unable to validate address, check bitcoind backend'} return True, None diff --git a/frontend/static/locales/en.json b/frontend/static/locales/en.json index fce12c17..529c5c55 100644 --- a/frontend/static/locales/en.json +++ b/frontend/static/locales/en.json @@ -188,7 +188,7 @@ "Github Issues - The Robotic Satoshis Open Source Project":"Github Issues - The Robotic Satoshis Open Source Project", "Your Profile":"Your Profile", "Your robot":"Your robot", - "One active order #{{orderID}}":"One active order #{{orderID}}", + "One active order #{{orderID}}":"One active order #{{orderID}}", "Your current order":"Your current order", "No active orders":"No active orders", "Your token (will not remain here)":"Your token (will not remain here)", @@ -328,7 +328,7 @@ "Messages":"Messages", "Verified signature by {{nickname}}":"Verified signature by {{nickname}}", "Cannot verify signature of {{nickname}}":"Cannot verify signature of {{nickname}}", - + "CONTRACT BOX - TradeBox.js": "The Contract Box that guides users trough the whole trade pipeline", "Contract Box":"Contract Box", @@ -434,9 +434,8 @@ "Does not look like a valid lightning invoice":"Does not look like a valid lightning invoice", "The invoice provided has already expired":"The invoice provided has already expired", "Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.":"Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.", - "Does not look like a valid address":"Does not look like a valid address", - "This is not a bitcoin mainnet address":"This is not a bitcoin mainnet address", - "This is not a bitcoin testnet address":"This is not a bitcoin testnet address", + "Invalid address":"Invalid address", + "Unable to validate address, check bitcoind backend":"Unable to validate address, check bitcoind backend", "Submit payout info for {{amountSats}} Sats":"Submit payout info for {{amountSats}} Sats", "Submit a valid invoice for {{amountSats}} Satoshis.":"Submit a valid invoice for {{amountSats}} Satoshis.", "Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.":"Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.", @@ -512,4 +511,4 @@ "This lightning application is provided as is. It is in active development: trade with the utmost caution. There is no private support. Support is only offered via public channels ":"This lightning application is provided as is. It is in active development: trade with the utmost caution. There is no private support. Support is only offered via public channels ", "(Telegram)":"(Telegram)", ". RoboSats will never contact you. RoboSats will definitely never ask for your robot token.":". RoboSats will never contact you. RoboSats will definitely never ask for your robot token." -} \ No newline at end of file +} diff --git a/frontend/static/locales/es.json b/frontend/static/locales/es.json index 2cbcf9ad..ac7dfd79 100644 --- a/frontend/static/locales/es.json +++ b/frontend/static/locales/es.json @@ -187,7 +187,7 @@ "Github Issues - The Robotic Satoshis Open Source Project": "Issues de GitHub - The Robotic Satoshis Open Source Project", "Your Profile":"Tu perfil", "Your robot": "Tu Robot", - "One active order #{{orderID}}":"Ir a orden activa #{{orderID}}", + "One active order #{{orderID}}":"Ir a orden activa #{{orderID}}", "Your current order":"Tu orden actual", "No active orders":"No hay órdenes activas", "Your token (will not remain here)":"Tu token (no permanecerá aquí)", @@ -434,9 +434,8 @@ "Does not look like a valid lightning invoice":"No parece ser una factura lightning válida", "The invoice provided has already expired":"La factura que has entregado ya ha caducado", "Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.":"Asegurate de EXPORTAR el registro del chat. Los administradores pueden pedirte el registro del chat en caso de discrepancias. Es tu responsabilidad proveerlo.", - "Does not look like a valid address":"No parece una dirección Bitcoin válida", - "This is not a bitcoin mainnet address":"No es una dirección de mainnet", - "This is not a bitcoin testnet address":"No es una dirección de testnet", + "Invalid address":"Dirección inválida", + "Unable to validate address, check bitcoind backend":"No ha sido posible validar la dirección, comprobar el backend bitcoind", "Submit payout info for {{amountSats}} Sats":"Envia info para recibir {{amountSats}} Sats", "Submit a valid invoice for {{amountSats}} Satoshis.": "Envía una factura por {{amountSats}} Sats", "Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.":"Antes de dejarte enviar {{amountFiat}} {{currencyCode}}, queremos asegurarnos de que puedes recibir BTC.", diff --git a/requirements.txt b/requirements.txt index a03433ca..1f71914c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,4 +27,3 @@ django-import-export==2.7.1 requests[socks] python-gnupg==0.4.9 daphne==3.0.2 -coinaddrvalidator==1.1.3