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
This commit is contained in:
zx9r 2022-08-01 03:03:33 +02:00 committed by GitHub
parent 56bc602d34
commit f0cde287e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 13 deletions

View File

@ -51,9 +51,8 @@ def validate_onchain_address(address):
try: try:
validation = bitcoind_rpc('validateaddress', [address]) validation = bitcoind_rpc('validateaddress', [address])
if not validation['isvalid']: if not validation['isvalid']:
return False, {"bad_address": validation['error']} return False, {"bad_address": "Invalid address"}
except: except:
# TODO: log the exception ?
return False, {"bad_address": 'Unable to validate address, check bitcoind backend'} return False, {"bad_address": 'Unable to validate address, check bitcoind backend'}
return True, None return True, None

View File

@ -188,7 +188,7 @@
"Github Issues - The Robotic Satoshis Open Source Project":"Github Issues - The Robotic Satoshis Open Source Project", "Github Issues - The Robotic Satoshis Open Source Project":"Github Issues - The Robotic Satoshis Open Source Project",
"Your Profile":"Your Profile", "Your Profile":"Your Profile",
"Your robot":"Your robot", "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", "Your current order":"Your current order",
"No active orders":"No active orders", "No active orders":"No active orders",
"Your token (will not remain here)":"Your token (will not remain here)", "Your token (will not remain here)":"Your token (will not remain here)",
@ -328,7 +328,7 @@
"Messages":"Messages", "Messages":"Messages",
"Verified signature by {{nickname}}":"Verified signature by {{nickname}}", "Verified signature by {{nickname}}":"Verified signature by {{nickname}}",
"Cannot verify signature of {{nickname}}":"Cannot verify signature of {{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 - TradeBox.js": "The Contract Box that guides users trough the whole trade pipeline",
"Contract Box":"Contract Box", "Contract Box":"Contract Box",
@ -434,9 +434,8 @@
"Does not look like a valid lightning invoice":"Does not look like a valid lightning invoice", "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", "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.", "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", "Invalid address":"Invalid address",
"This is not a bitcoin mainnet address":"This is not a bitcoin mainnet address", "Unable to validate address, check bitcoind backend":"Unable to validate address, check bitcoind backend",
"This is not a bitcoin testnet address":"This is not a bitcoin testnet address",
"Submit payout info for {{amountSats}} Sats":"Submit payout info for {{amountSats}} Sats", "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.", "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.", "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 ", "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)", "(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." ". 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."
} }

View File

@ -187,7 +187,7 @@
"Github Issues - The Robotic Satoshis Open Source Project": "Issues de GitHub - The Robotic Satoshis Open Source Project", "Github Issues - The Robotic Satoshis Open Source Project": "Issues de GitHub - The Robotic Satoshis Open Source Project",
"Your Profile":"Tu perfil", "Your Profile":"Tu perfil",
"Your robot": "Tu Robot", "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", "Your current order":"Tu orden actual",
"No active orders":"No hay órdenes activas", "No active orders":"No hay órdenes activas",
"Your token (will not remain here)":"Tu token (no permanecerá aquí)", "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", "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", "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.", "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", "Invalid address":"Dirección inválida",
"This is not a bitcoin mainnet address":"No es una dirección de mainnet", "Unable to validate address, check bitcoind backend":"No ha sido posible validar la dirección, comprobar el backend bitcoind",
"This is not a bitcoin testnet address":"No es una dirección de testnet",
"Submit payout info for {{amountSats}} Sats":"Envia info para recibir {{amountSats}} Sats", "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", "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.", "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.",

View File

@ -27,4 +27,3 @@ django-import-export==2.7.1
requests[socks] requests[socks]
python-gnupg==0.4.9 python-gnupg==0.4.9
daphne==3.0.2 daphne==3.0.2
coinaddrvalidator==1.1.3