Skip to content

Commit

Permalink
feat(ui): add zero amount payment request message
Browse files Browse the repository at this point in the history
address LN-Zap#1510
  • Loading branch information
bolatovumar committed Mar 10, 2020
1 parent 2cf874d commit ac9c736
Show file tree
Hide file tree
Showing 36 changed files with 41 additions and 1 deletion.
6 changes: 5 additions & 1 deletion renderer/components/Form/LightningInvoiceInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ const validate = (intl, network, chain, value) => {
if (isLn(value, chain, network)) {
try {
const invoice = decodePayReq(value)
if (!invoice || (!invoice.satoshis && !invoice.millisatoshis)) {
if (!invoice) {
throw new Error('Invalid invoice')
}

if (!invoice.satoshis && !invoice.millisatoshis) {
return intl.formatMessage({ ...messages.zero_amount_request })
}
} catch (e) {
return invalidRequestMessage
}
Expand Down
2 changes: 2 additions & 0 deletions renderer/components/Form/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ export default defineMessages({
transaction_speed_description_medium: 'less than 3 hours',
transaction_speed_description_slow: 'up to 24 hours',
transaction_speed_description_slowest: 'more than 24 hours',
zero_amount_request:
'This appears to be a zero amount payment request. Zap does not support zero amount payment requests due to security concerns associated with them.',
})
1 change: 1 addition & 0 deletions translations/af-ZA.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ar-SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/bg-BG.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ca-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/cs-CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "Pomalu",
"components.Form.valid_pubkey": "Validní PubKey",
"components.Form.valid_request": "Validní {chain} požadavek",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "Zrušit",
"components.Home.button_save": "Uložit",
"components.Home.cert_description": "Cesta k lnd tls certifikátu.",
Expand Down
1 change: 1 addition & 0 deletions translations/da-DK.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "Gyldig {chain} anmodning",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "Langsam",
"components.Form.valid_pubkey": "Gültiger PubKey",
"components.Form.valid_request": "Gültige {chain} -Anfrage",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "Abbrechen",
"components.Home.button_save": "Speichern",
"components.Home.cert_description": "Pfad zum Lnd TLS-Zertifikat.",
Expand Down
1 change: 1 addition & 0 deletions translations/el-GR.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "Slow",
"components.Form.valid_pubkey": "Valid PubKey",
"components.Form.valid_request": "Valid {chain} request",
"components.Form.zero_amount_request": "This appears to be a zero amount payment request. Zap does not support zero amount payment requests due to security concerns associated with them.",
"components.Home.button_cancel": "Cancel",
"components.Home.button_save": "Save",
"components.Home.cert_description": "Path to the lnd tls cert.",
Expand Down
1 change: 1 addition & 0 deletions translations/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "Lento",
"components.Form.valid_pubkey": "Pubkey Valida",
"components.Form.valid_request": "Solicitud valida de {chain}",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "Cancelar",
"components.Home.button_save": "Guardar",
"components.Home.cert_description": "La ruta al certificado tls de lnd.",
Expand Down
1 change: 1 addition & 0 deletions translations/fi-FI.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "Lente",
"components.Form.valid_pubkey": "PubKey valide",
"components.Form.valid_request": "Requête {chain} valide",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "Annuler",
"components.Home.button_save": "Enregistrer",
"components.Home.cert_description": "Le chemin d'accès au certificat TLS de lnd.",
Expand Down
1 change: 1 addition & 0 deletions translations/ga-IE.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "Iarratas bailí {chain}",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/he-IL.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/hi-IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/hr-HR.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "Sporo",
"components.Form.valid_pubkey": "Valjan PubKey",
"components.Form.valid_request": "Valjan {chain} zahtijev",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "Odustani",
"components.Home.button_save": "Spremi",
"components.Home.cert_description": "Staza do lnd tls cert.",
Expand Down
1 change: 1 addition & 0 deletions translations/hu-HU.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/no-NO.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "Sakte",
"components.Form.valid_pubkey": "Gyldig PubKey",
"components.Form.valid_request": "Gyldig {chain} forespørsel",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "Avbryt",
"components.Home.button_save": "Lagre",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/pl-PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ro-RO.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "Отмена",
"components.Home.button_save": "Сохранить",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/sr-SP.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/sv-SE.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/tr-TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/uk-UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "Скасувати",
"components.Home.button_save": "Зберегти",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down
1 change: 1 addition & 0 deletions translations/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"components.Form.transaction_speed_slow": "",
"components.Form.valid_pubkey": "",
"components.Form.valid_request": "",
"components.Form.zero_amount_request": "",
"components.Home.button_cancel": "",
"components.Home.button_save": "",
"components.Home.cert_description": "",
Expand Down

0 comments on commit ac9c736

Please sign in to comment.