Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 4f6e9f6

Browse files
yatebryanvu
authored andcommitted
add qrcode to payment request
1 parent 9d49c71 commit 4f6e9f6

File tree

13 files changed

+104
-83
lines changed

13 files changed

+104
-83
lines changed

apps/desktop/package.json

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,47 @@
2121
"author": "case <case@casesandberg.com>",
2222
"license": "MIT",
2323
"dependencies": {
24-
"babel-loader": "^6.2.10",
25-
"babel-polyfill": "^6.20.0",
26-
"babel-register": "^6.18.0",
27-
"concurrently": "^3.1.0",
28-
"css-loader": "^0.26.1",
29-
"electron-debug": "^1.1.0",
30-
"electron-log": "^2.2.6",
31-
"electron-packager": "^8.4.0",
32-
"electron-prebuilt": "^1.4.6",
33-
"electron-window-state": "^4.0.1",
34-
"express": "^4.14.0",
24+
"babel-loader": "^6.4.1",
25+
"babel-polyfill": "^6.26.0",
26+
"concurrently": "^3.5.1",
27+
"css-loader": "^0.26.4",
28+
"electron-debug": "^1.4.0",
29+
"electron-log": "^2.2.12",
30+
"electron-packager": "^8.7.2",
31+
"electron-prebuilt": "^1.4.13",
32+
"electron-window-state": "^4.1.1",
33+
"express": "^4.16.2",
3534
"extract-text-webpack-plugin": "^1.0.1",
3635
"file-loader": "^0.9.0",
37-
"grpc": "^1.1.1",
38-
"json-loader": "^0.5.4",
36+
"grpc": "^1.7.3",
37+
"json-loader": "^0.5.7",
3938
"lightning-app": "^0.1.0",
4039
"lightning-components": "^0.1.1",
4140
"lightning-core": "^1.9.1",
4241
"lightning-notifications": "^0.1.1",
4342
"lightning-store": "^0.1.1",
44-
"lodash": "^4.17.2",
43+
"lodash": "^4.17.4",
4544
"normalize.css": "^5.0.0",
46-
"observe": "^1.3.7",
47-
"protobufjs": "^6.4.6",
48-
"ps-node": "^0.1.4",
49-
"react": "^15.4.1",
50-
"react-dom": "^15.4.1",
51-
"react-redux": "^4.4.6",
52-
"react-router-dom": "^4.0.0",
53-
"react-router-redux": "^5.0.0-alpha.6",
54-
"reactcss": "^1.1.1",
55-
"redux": "^3.6.0",
56-
"source-map-support": "^0.4.8",
57-
"style-loader": "^0.13.1",
58-
"webpack": "^1.14.0",
59-
"webpack-dev-middleware": "^1.9.0",
60-
"webpack-hot-middleware": "^2.13.2",
45+
"observe": "^1.4.1",
46+
"protobufjs": "^6.8.3",
47+
"ps-node": "^0.1.6",
48+
"react": "^15.6.2",
49+
"react-dom": "^15.6.2",
50+
"react-redux": "^4.4.8",
51+
"react-router-dom": "^4.2.2",
52+
"react-router-redux": "^5.0.0-alpha.8",
53+
"reactcss": "^1.2.3",
54+
"redux": "^3.7.2",
55+
"source-map-support": "^0.4.18",
56+
"style-loader": "^0.13.2",
57+
"webpack": "^1.15.0",
58+
"webpack-dev-middleware": "^1.12.2",
59+
"webpack-hot-middleware": "^2.21.0",
6160
"webpack-merge": "^1.1.2",
6261
"webpack-validator": "^2.3.0"
6362
},
6463
"devDependencies": {
65-
"babel-register": "^6.18.0",
66-
"cross-env": "^3.1.3"
64+
"babel-register": "^6.26.0",
65+
"cross-env": "^3.2.4"
6766
}
6867
}

packages/lightning-app/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
"author": "case <case@casesandberg.com>",
99
"license": "MIT",
1010
"dependencies": {
11-
"@components/electron": "^0.3.0",
11+
"@components/electron": "^0.3.1",
1212
"lightning-components": "^0.1.0",
1313
"lightning-core": "^1.9.1",
1414
"lightning-notifications": "^0.1.0",
15-
"react": "^15.4.1",
16-
"react-router-dom": "^4.0.0",
17-
"reactcss": "^1.1.1"
15+
"react": "^15.6.2",
16+
"react-router-dom": "^4.2.2",
17+
"reactcss": "^1.2.3"
1818
}
1919
}

packages/lightning-components/QRCode/index.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,21 @@ import React from 'react'
22
import { format } from 'url'
33
import qrImage from 'qr-image'
44

5-
export const QRCode = ({ address }) => {
6-
const bitcoinURL = format({ protocol: 'bitcoin:', host: address })
7-
const svg = qrImage.imageSync(bitcoinURL, { type: 'svg' })
5+
export const QRCode = {
6+
bitcoin: ({ address }) => {
7+
const bitcoinURL = format({ protocol: 'bitcoin:', host: address })
8+
const svg = qrImage.imageSync(bitcoinURL, { type: 'svg' })
89

9-
// eslint-disable-next-line react/no-danger
10-
return <div dangerouslySetInnerHTML={{ __html: svg }} />
10+
// eslint-disable-next-line react/no-danger
11+
return <div dangerouslySetInnerHTML={{ __html: svg }} />
12+
},
13+
lightning: ({ paymentRequest }) => {
14+
console.log(paymentRequest);
15+
const svg = qrImage.imageSync(paymentRequest, { type: 'svg' })
16+
17+
// eslint-disable-next-line react/no-danger
18+
return <div dangerouslySetInnerHTML={{ __html: svg }} />
19+
}
1120
}
1221

1322
export default QRCode

packages/lightning-components/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"author": "case <case@casesandberg.com>",
1010
"license": "MIT",
1111
"dependencies": {
12-
"lodash": "^4.16.1",
13-
"qr-image": "^3.1.0",
14-
"react": "^15.3.2",
15-
"react-router-dom": "^4.0.0",
16-
"reactcss": "^1.0.8"
12+
"lodash": "^4.17.4",
13+
"qr-image": "^3.2.0",
14+
"react": "^15.6.2",
15+
"react-router-dom": "^4.2.2",
16+
"reactcss": "^1.2.3"
1717
},
1818
"devDependencies": {
1919
"@kadira/storybook": "^2.35.3"

packages/lightning-core/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
"author": "case <case@casesandberg.com>",
1010
"license": "MIT",
1111
"dependencies": {
12-
"electron": "^1.6.2",
12+
"electron": "^1.7.9",
1313
"lightning-components": "^0.1.1",
1414
"lightning-forms": "^0.1.0",
1515
"lightning-notifications": "^0.1.1",
1616
"lightning-popup": "^0.1.0",
1717
"lightning-store": "^0.1.1",
18-
"lodash": "^4.16.2",
19-
"react": "^15.4.1",
18+
"lodash": "^4.17.4",
19+
"react": "^15.6.2",
2020
"react-infinite": "^0.10.0",
21-
"react-redux": "^4.4.6",
22-
"react-router-dom": "^4.0.0",
23-
"reactcss": "^1.0.8",
24-
"redux": "^3.6.0",
21+
"react-redux": "^4.4.8",
22+
"react-router-dom": "^4.2.2",
23+
"reactcss": "^1.2.3",
24+
"redux": "^3.7.2",
2525
"redux-grpc-middleware": "^0.1.1",
2626
"redux-selector": "^0.1.0"
2727
}

packages/lightning-core/request/BitcoinWallet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class BitcoinWallet extends React.Component {
6767

6868
<Popup name={ QR_CODE }>
6969
<div style={ styles.qrPopup }>
70-
<QRCode address={ address } />
70+
<QRCode.bitcoin address={ address } />
7171
</div>
7272
</Popup>
7373

packages/lightning-core/request/PaymentRequestPopup.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react'
22
import reactCSS from 'reactcss'
33
import { remote } from 'electron'
44
import { Popup } from 'lightning-popup'
5+
import { QRCode } from 'lightning-components'
56
import { Head, Input } from '../common'
67

78
const { Menu, MenuItem } = remote
@@ -29,6 +30,15 @@ export const PaymentRequestPopup = ({ paymentRequest, closePopup }) => {
2930
color: '#4990E2',
3031
cursor: 'pointer',
3132
},
33+
qrPopup: {
34+
background: '#fff',
35+
borderRadius: 2,
36+
width: 300,
37+
height: 300,
38+
marginLeft: 'auto',
39+
marginRight: 'auto',
40+
paddingBottom: 10,
41+
}
3242
},
3343
})
3444
const menu = new Menu()
@@ -50,6 +60,9 @@ export const PaymentRequestPopup = ({ paymentRequest, closePopup }) => {
5060
body="Send this encoded payment request to the party who would like to
5161
pay you via the Lightning Network."
5262
/>
63+
<div style={ styles.qrPopup }>
64+
<QRCode.lightning paymentRequest={ paymentRequest } />
65+
</div>
5366
<Input
5467
fullWidth
5568
selectOnClick

packages/lightning-currency/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
"dependencies": {
1111
"lightning-components": "^0.1.1",
1212
"lightning-store": "^0.1.1",
13-
"lodash": "^4.17.2",
14-
"react": "^15.4.1",
15-
"react-redux": "^4.4.6",
16-
"reactcss": "^1.1.1",
17-
"redux": "^3.6.0"
13+
"lodash": "^4.17.4",
14+
"react": "^15.6.2",
15+
"react-redux": "^4.4.8",
16+
"reactcss": "^1.2.3",
17+
"redux": "^3.7.2"
1818
}
1919
}

packages/lightning-forms/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"author": "",
1010
"license": "MIT",
1111
"dependencies": {
12-
"lodash": "^4.16.2",
13-
"react": "^15.4.2",
14-
"react-redux": "^4.4.6",
15-
"reactcss": "^1.1.1",
16-
"redux": "^3.6.0"
12+
"lodash": "^4.17.4",
13+
"react": "^15.6.2",
14+
"react-redux": "^4.4.8",
15+
"reactcss": "^1.2.3",
16+
"redux": "^3.7.2"
1717
}
1818
}

packages/lightning-notifications/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"dependencies": {
1212
"lightning-components": "^0.1.1",
1313
"lightning-store": "^0.1.1",
14-
"lodash": "^4.17.2",
15-
"react": "^15.4.1",
16-
"react-redux": "^4.4.6",
17-
"reactcss": "^1.1.1",
18-
"redux": "^3.6.0"
14+
"lodash": "^4.17.4",
15+
"react": "^15.6.2",
16+
"react-redux": "^4.4.8",
17+
"reactcss": "^1.2.3",
18+
"redux": "^3.7.2"
1919
}
2020
}

0 commit comments

Comments
 (0)