Skip to content

Commit

Permalink
v0.5.0 (#27)
Browse files Browse the repository at this point in the history
v0.5.0
  • Loading branch information
andrerfneves committed Nov 8, 2019
2 parents e65e2da + 57fc2b6 commit 6baa2bf
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 84 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lightning-decoder",
"version": "0.4.0",
"version": "0.5.0",
"author": {
"email": "andrerfneves@protonmail.com",
"name": "André Neves",
Expand All @@ -12,6 +12,7 @@
"bitcoinjs-lib": "^5.1.6",
"bn.js": "^5.0.0",
"classnames": "^2.2.6",
"coininfo": "https://github.com/cryptocoinjs/coininfo#dc3e6cc59e593ee7dbeb7c993485706e72d32743",
"date-fns": "^2.1.0",
"lightnode-invoice": "^0.3.0",
"lodash": "^4.17.15",
Expand Down
31 changes: 6 additions & 25 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import cx from 'classnames';
import QrReader from 'react-qr-reader';
import LightningPayReq from './lib/bolt11';
import { formatDetailsKey } from './utils/keys';
import { formatTimestamp } from './utils/timestamp';
// import { formatTimestamp } from './utils/timestamp';

// Assets
import arrowImage from './assets/images/arrow.svg';
import closeImage from './assets/images/close.svg';
import githubImage from './assets/images/github.svg';
import bitcoinImage from './assets/images/bitcoin.svg';
import boltImage from './assets/images/bolt.png';
import qrcodeImage from './assets/images/qrcode.png';

Expand All @@ -20,7 +19,6 @@ import {
APP_TAGLINE,
APP_INPUT_PLACEHOLDER,
APP_GITHUB,
DONATION_BTC,
} from './constants/app';
import {
TAGS_KEY,
Expand Down Expand Up @@ -51,7 +49,8 @@ export class App extends PureComponent {

getInvoiceDetails = (text) => this.setState(() => {
try {
const decodedInvoice = LightningPayReq.decode(text);
const payReq = text.toLowerCase();
const decodedInvoice = LightningPayReq.decode(payReq);

return {
decodedInvoice,
Expand Down Expand Up @@ -218,7 +217,8 @@ export class App extends PureComponent {
valuePropFormat &&
valuePropFormat === TIMESTAMP_STRING_KEY
) {
value = `${formatTimestamp(decodedInvoice[key])}`;
// TODO: this breaks
// value = `${formatTimestamp(decodedInvoice[key])}`;
}

return (
Expand Down Expand Up @@ -277,34 +277,15 @@ export class App extends PureComponent {
}

renderOptions = () => {
const { isBitcoinAddrOpened, isInvoiceLoaded } = this.state;
const { isInvoiceLoaded } = this.state;
const optionsClassnames = cx(
'options',
{ 'options--hide': isInvoiceLoaded },
);
const bitcoinClassnames = cx(
'options__bitcoin',
{ 'options__bitcoin--opened': isBitcoinAddrOpened },
);

return (
<div className={optionsClassnames}>
<div className='options__wrapper'>
<div className={bitcoinClassnames}>
<div className='options__bitcoin-address'>
{DONATION_BTC}
</div>
<button
onClick={this.handleBitcoinClick}
className='options__bitcoin-icon-wrapper'
>
<img
className='options__bitcoin-icon'
src={bitcoinImage}
alt='Bitcoin'
/>
</button>
</div>
<a
href={APP_GITHUB}
className='options__github'
Expand Down
Loading

0 comments on commit 6baa2bf

Please sign in to comment.