Skip to content

Commit

Permalink
Merge pull request #6 from takinbo/master
Browse files Browse the repository at this point in the history
fixes #5 by properly encoding the bitcoin URI
  • Loading branch information
alexk111 authored Jul 2, 2018
2 parents beb3156 + 723ef50 commit 8b53d5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/modules/bip21Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
// bitcoincash:<address>[?amount=<amount>][?label=<label>][?message=<message>]

export function encodeBip21Link (isBCH, address, amount, label, message) {
const parts = []
if (amount) parts.push('amount=' + encodeURIComponent(amount))
if (label) parts.push('label=' + encodeURIComponent(label))
if (message) parts.push('message=' + encodeURIComponent(message))
return (isBCH ? 'bitcoincash' : 'bitcoin') + ':' + address +
(amount ? '?amount=' + encodeURIComponent(amount) : '') +
(label ? '?label=' + encodeURIComponent(label) : '') +
(message ? '?message=' + encodeURIComponent(message) : '')
(parts ? '?' + parts.join('&') : '')
}

2 changes: 1 addition & 1 deletion src/modules/paymentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import qrcode from 'qrcode-generator'
const paymentFormLabels = {
'currency': 'Currency',
'requiredFeeRate': 'Fee Rate (sats/byte)',
'time': 'Creaated at',
'time': 'Created at',
'expires': 'Expires at',
'memo': 'Memo',
'amountBTC': 'Amount',
Expand Down

0 comments on commit 8b53d5d

Please sign in to comment.