Jack Mallers
7 years ago
59 changed files with 635 additions and 376 deletions
@ -1,27 +1,27 @@ |
|||
import React from 'react'; |
|||
import { render } from 'react-dom'; |
|||
import { AppContainer } from 'react-hot-loader'; |
|||
import Root from './containers/Root'; |
|||
import { configureStore, history } from './store/configureStore'; |
|||
import './app.global.scss'; |
|||
import React from 'react' |
|||
import { render } from 'react-dom' |
|||
import { AppContainer } from 'react-hot-loader' |
|||
import Root from './containers/Root' |
|||
import { configureStore, history } from './store/configureStore' |
|||
import './app.global.scss' |
|||
|
|||
const store = configureStore(); |
|||
const store = configureStore() |
|||
|
|||
render( |
|||
<AppContainer> |
|||
<Root store={store} history={history} /> |
|||
</AppContainer>, |
|||
document.getElementById('root') |
|||
); |
|||
) |
|||
|
|||
if (module.hot) { |
|||
module.hot.accept('./containers/Root', () => { |
|||
const NextRoot = require('./containers/Root'); // eslint-disable-line global-require
|
|||
const NextRoot = require('./containers/Root') // eslint-disable-line global-require
|
|||
render( |
|||
<AppContainer> |
|||
<NextRoot store={store} history={history} /> |
|||
</AppContainer>, |
|||
document.getElementById('root') |
|||
); |
|||
}); |
|||
) |
|||
}) |
|||
} |
|||
|
@ -0,0 +1,42 @@ |
|||
import zbase32 from 'zbase32' |
|||
|
|||
function convertBigEndianBufferToLong(longBuffer) { |
|||
let longValue = 0 |
|||
const byteArray = Buffer.from(longBuffer).swap64() |
|||
|
|||
for (let i = byteArray.length - 1; i >= 0; i -= 1) { |
|||
longValue = (longValue * 256) + byteArray[i] |
|||
} |
|||
|
|||
return longValue |
|||
} |
|||
|
|||
export function decodeInvoice(payreq) { |
|||
const payreqBase32 = zbase32.decode(payreq) |
|||
|
|||
const bufferHexRotated = Buffer.from(payreqBase32).toString('hex') |
|||
const bufferHex = bufferHexRotated.substr(bufferHexRotated.length - 1, bufferHexRotated.length) |
|||
+ bufferHexRotated.substr(0, bufferHexRotated.length - 1) |
|||
const buffer = Buffer.from(bufferHex, 'hex') |
|||
|
|||
const pubkeyBuffer = buffer.slice(0, 33) |
|||
const pubkey = pubkeyBuffer.toString('hex') |
|||
|
|||
const paymentHashBuffer = buffer.slice(33, 65) |
|||
const paymentHashHex = paymentHashBuffer.toString('hex') |
|||
|
|||
const valueBuffer = buffer.slice(65, 73) |
|||
|
|||
const amount = convertBigEndianBufferToLong(valueBuffer) |
|||
|
|||
return { |
|||
payreq, |
|||
pubkey, |
|||
amount, |
|||
r_hash: paymentHashHex |
|||
} |
|||
} |
|||
|
|||
export default { |
|||
decodeInvoice |
|||
} |
@ -0,0 +1,13 @@ |
|||
@import '../../../../../variables.scss'; |
|||
|
|||
.closeContainer { |
|||
background: $lightgrey; |
|||
text-align: right; |
|||
padding: 10px; |
|||
|
|||
span { |
|||
color: $darkestgrey; |
|||
font-size: 20px; |
|||
cursor: pointer; |
|||
} |
|||
} |
@ -1,6 +1,6 @@ |
|||
// @flow
|
|||
if (process.env.NODE_ENV === 'production') { |
|||
module.exports = require('./configureStore.prod'); // eslint-disable-line global-require
|
|||
module.exports = require('./configureStore.prod') // eslint-disable-line global-require
|
|||
} else { |
|||
module.exports = require('./configureStore.dev'); // eslint-disable-line global-require
|
|||
module.exports = require('./configureStore.dev') // eslint-disable-line global-require
|
|||
} |
|||
|
@ -1 +1 @@ |
|||
export default 'test-file-stub'; |
|||
export default 'test-file-stub' |
|||
|
@ -1,24 +1,24 @@ |
|||
// @flow
|
|||
// Check if the renderer and main bundles are built
|
|||
import path from 'path'; |
|||
import chalk from 'chalk'; |
|||
import fs from 'fs'; |
|||
import path from 'path' |
|||
import chalk from 'chalk' |
|||
import fs from 'fs' |
|||
|
|||
function CheckBuildsExist() { |
|||
const mainPath = path.join(__dirname, '..', '..', 'app', 'main.prod.js'); |
|||
const rendererPath = path.join(__dirname, '..', '..', 'app', 'dist', 'renderer.prod.js'); |
|||
const mainPath = path.join(__dirname, '..', '..', 'app', 'main.prod.js') |
|||
const rendererPath = path.join(__dirname, '..', '..', 'app', 'dist', 'renderer.prod.js') |
|||
|
|||
if (!fs.existsSync(mainPath)) { |
|||
throw new Error(chalk.whiteBright.bgRed.bold( |
|||
'The main process is not built yet. Build it by running "npm run build-main"' |
|||
)); |
|||
)) |
|||
} |
|||
|
|||
if (!fs.existsSync(rendererPath)) { |
|||
throw new Error(chalk.whiteBright.bgRed.bold( |
|||
'The renderer process is not built yet. Build it by running "npm run build-renderer"' |
|||
)); |
|||
)) |
|||
} |
|||
} |
|||
|
|||
CheckBuildsExist(); |
|||
CheckBuildsExist() |
|||
|
@ -1,17 +1,17 @@ |
|||
// @flow
|
|||
import chalk from 'chalk'; |
|||
import chalk from 'chalk' |
|||
|
|||
export default function CheckNodeEnv(expectedEnv: string) { |
|||
if (!expectedEnv) { |
|||
throw new Error('"expectedEnv" not set'); |
|||
throw new Error('"expectedEnv" not set') |
|||
} |
|||
|
|||
if (process.env.NODE_ENV !== expectedEnv) { |
|||
/* eslint-disable */ |
|||
console.log(chalk.whiteBright.bgRed.bold( |
|||
`"process.env.NODE_ENV" must be "${expectedEnv}" to use this webpack config` |
|||
)); |
|||
)) |
|||
/* eslint-enable */ |
|||
process.exit(2); |
|||
process.exit(2) |
|||
} |
|||
} |
|||
|
Binary file not shown.
@ -1,5 +1,5 @@ |
|||
describe('description', () => { |
|||
it('should have description', () => { |
|||
expect(1 + 2).toBe(3); |
|||
}); |
|||
}); |
|||
expect(1 + 2).toBe(3) |
|||
}) |
|||
}) |
|||
|
@ -1,11 +1,11 @@ |
|||
const spawn = require('cross-spawn'); |
|||
const path = require('path'); |
|||
const spawn = require('cross-spawn') |
|||
const path = require('path') |
|||
|
|||
const s = `\\${path.sep}`; |
|||
const s = `\\${path.sep}` |
|||
const pattern = process.argv[2] === 'e2e' |
|||
? `test${s}e2e${s}.+\\.spec\\.js` |
|||
: `test${s}(?!e2e${s})[^${s}]+${s}.+\\.spec\\.js$`; |
|||
: `test${s}(?!e2e${s})[^${s}]+${s}.+\\.spec\\.js$` |
|||
|
|||
const result = spawn.sync(path.normalize('./node_modules/.bin/jest'), [pattern], { stdio: 'inherit' }); |
|||
const result = spawn.sync(path.normalize('./node_modules/.bin/jest'), [pattern], { stdio: 'inherit' }) |
|||
|
|||
process.exit(result.status); |
|||
process.exit(result.status) |
|||
|
@ -1,3 +1,3 @@ |
|||
require('babel-register'); |
|||
require('babel-register') |
|||
|
|||
module.exports = require('./webpack.config.renderer.dev'); |
|||
module.exports = require('./webpack.config.renderer.dev') |
|||
|
Loading…
Reference in new issue