Skip to content

Commit 6c3bde5

Browse files
authored
v0.5.1 (#28)
v0.5.1
2 parents 6baa2bf + 3665828 commit 6c3bde5

File tree

7 files changed

+58
-28
lines changed

7 files changed

+58
-28
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lightning-decoder",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"author": {
55
"email": "andrerfneves@protonmail.com",
66
"name": "André Neves",
@@ -31,7 +31,7 @@
3131
"build": "react-scripts build",
3232
"test": "react-scripts test",
3333
"eject": "react-scripts eject",
34-
"now-start": "cd build && serve --single"
34+
"deploy": "yarn build && cd build && now"
3535
},
3636
"eslintConfig": {
3737
"extends": "react-app"

src/app.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ import {
2222
} from './constants/app';
2323
import {
2424
TAGS_KEY,
25-
TIMESTAMP_KEY,
26-
WORDS_TEMP_KEY,
2725
TIMESTAMP_STRING_KEY,
26+
COMPLETE_KEY,
2827
} from './constants/keys';
2928

3029
// Styles
@@ -85,10 +84,6 @@ export class App extends PureComponent {
8584
}
8685
}
8786

88-
handleBitcoinClick = () => this.setState(prevState => ({
89-
isBitcoinAddrOpened: !prevState.isBitcoinAddrOpened,
90-
}));
91-
9287
handleQRCode = () => this.setState(prevState => ({
9388
isQRCodeOpened: !prevState.isQRCodeOpened
9489
}))
@@ -141,8 +136,7 @@ export class App extends PureComponent {
141136
const invoiceDetails = Object.keys(decodedInvoice)
142137
.map((key) => {
143138
switch (key) {
144-
case WORDS_TEMP_KEY:
145-
case TIMESTAMP_KEY:
139+
case COMPLETE_KEY:
146140
return null;
147141
case TAGS_KEY:
148142
return this.renderInvoiceInnerItem(key);
@@ -173,7 +167,7 @@ export class App extends PureComponent {
173167
) ? renderNestedTag(tag) : renderNormalTag(tag);
174168

175169
const renderNestedTag = (tag) => (
176-
<div className='invoice__item invoice__item--nested'>
170+
<div key={tag.data.key} className='invoice__item invoice__item--nested'>
177171
<div className='invoice__item-title'>
178172
{formatDetailsKey(tag.tagName)}
179173
</div>
@@ -187,7 +181,7 @@ export class App extends PureComponent {
187181
{formatDetailsKey(key)}
188182
</div>
189183
<div className='invoice__nested-value'>
190-
{`${tag.data[key]}`}
184+
{`${tag.data[key] || '--'}`}
191185
</div>
192186
</div>
193187
))}
@@ -196,12 +190,12 @@ export class App extends PureComponent {
196190
);
197191

198192
const renderNormalTag = (tag) => (
199-
<div className='invoice__item'>
193+
<div key={tag.data.key} className='invoice__item'>
200194
<div className='invoice__item-title'>
201195
{formatDetailsKey(tag.tagName)}
202196
</div>
203197
<div className='invoice__item-value'>
204-
{`${tag.data}`}
198+
{`${tag.data || '--'}`}
205199
</div>
206200
</div>
207201
)

src/assets/styles/modules/app.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
$container-width: 700px;
22

33
// App Layout
4+
body {
5+
background: $app-background;
6+
}
7+
48
.app {
59
background: $app-background;
610
display: flex;
@@ -32,9 +36,7 @@ $container-width: 700px;
3236
@include larger-than(mobile) {
3337
width: 100%;
3438
max-width: $container-width;
35-
margin-bottom: 2 * $base-spacing;
3639
flex-direction: row;
37-
margin-left: 4 * $base-spacing;
3840
}
3941
}
4042

src/assets/styles/modules/error.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
color: $text-primary;
1616
font-size: $font-extra-small-size;
1717
font-weight: $font-weight-bold;
18-
overflow-x: scroll;
1918

2019
@include larger-than(mobile) {
2120
font-size: $font-small-size;

src/assets/styles/modules/invoice.scss

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,25 @@
55
width: 100%;
66

77
margin: 0 auto;
8-
overflow-x: scroll;
98
padding: ($base-spacing / 2) 0;
109
opacity: 0;
1110
visibility: hidden;
1211
border: $border;
12+
margin-bottom: 20px;
13+
1314
&--opened {
1415
opacity: 1;
1516
visibility: visible;
1617
}
1718

1819
&__item {
19-
padding: ($base-spacing / 2) 25px;
20+
padding: ($base-spacing / 2) 20px;
2021
display: flex;
21-
flex-direction: row;
22+
flex-direction: column;
23+
24+
@include larger-than(mobile) {
25+
flex-direction: row;
26+
}
2227

2328
&--nested {
2429
flex-direction: column;
@@ -29,12 +34,18 @@
2934
color: $text-secondary;
3035
font-weight: $font-weight-bold;
3136
min-width: 200px;
37+
padding-bottom: 5px;
38+
39+
@include larger-than(mobile) {
40+
padding-bottom: 0;
41+
}
3242
}
3343

3444
&__item-value {
3545
font-weight: $font-weight-bold;
3646
color: $text-primary;
3747
width: 100%;
48+
word-break: break-all;
3849

3950
&--nested {
4051
padding: ($base-spacing / 2) 0;

src/constants/keys.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const PAYMENT_REQUEST_KEY = 'paymentRequest';
66
export const PREFIX_KEY = 'prefix';
77
export const RECOVERY_FLAG_KEY = 'recoveryFlag';
88
export const SATOSHIS_KEY = 'satoshis';
9+
export const MILLISATOSHIS_KEY = 'millisatoshis';
910
export const SIGNATURE_KEY = 'signature';
1011
export const TIMESTAMP_KEY = 'timestamp';
1112
export const TIMESTAMP_STRING_KEY = 'timestampString';
@@ -18,4 +19,9 @@ export const CODE_KEY = 'code';
1819
export const ADDRESS_KEY = 'address';
1920
export const ADDRESS_HASH_KEY = 'addressHash';
2021
export const DESCRIPTION_KEY = 'description';
21-
export const EXPIRY_HTLC = 'min_final_cltv_expiry';
22+
export const EXPIRE_TIME = 'expire_time';
23+
export const EXPIRY_HTLC = 'expiry_htlc';
24+
export const MIN_FINAL_CLTV_EXPIRY = 'min_final_cltv_expiry';
25+
export const TIME_EXPIRE_DATE_STRING = 'timeExpireDateString';
26+
export const TIME_EXPIRE_DATE = 'timeExpireDate';
27+
export const timeExpireDate = 'min_final_cltv_expiry';

src/utils/keys.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Key Formatting Utilities
22
import {
33
COIN_TYPE_KEY,
4-
COMPLETE_KEY,
54
PAYEE_NODE_KEY,
65
PAYMENT_REQUEST_KEY,
76
PREFIX_KEY,
87
TIMESTAMP_STRING_KEY,
8+
TIMESTAMP_KEY,
99
SATOSHIS_KEY,
1010
SIGNATURE_KEY,
1111
RECOVERY_FLAG_KEY,
@@ -14,31 +14,41 @@ import {
1414
FALLBACK_ADDRESS_KEY,
1515
ADDRESS_HASH_KEY,
1616
ADDRESS_KEY,
17+
MILLISATOSHIS_KEY,
1718
CODE_KEY,
1819
DESCRIPTION_KEY,
1920
EXPIRY_HTLC,
21+
TIME_EXPIRE_DATE,
22+
WORDS_TEMP_KEY,
23+
EXPIRE_TIME,
24+
TIME_EXPIRE_DATE_STRING,
25+
MIN_FINAL_CLTV_EXPIRY,
2026
} from '../constants/keys';
2127

2228
export const formatDetailsKey = (key: string) => {
2329
switch (key) {
2430
case COIN_TYPE_KEY:
2531
return 'Chain';
26-
case COMPLETE_KEY:
27-
return 'Tx Complete?';
2832
case PAYEE_NODE_KEY:
2933
return 'Payee Pub Key';
34+
case EXPIRE_TIME:
35+
return 'Expire Time';
3036
case PAYMENT_REQUEST_KEY:
31-
return 'Payment Request';
37+
return 'Invoice';
3238
case PREFIX_KEY:
3339
return 'Prefix';
3440
case RECOVERY_FLAG_KEY:
3541
return 'Recovery Flag';
3642
case SATOSHIS_KEY:
37-
return 'Payment Amount';
43+
return 'Amount (Satoshis)';
44+
case MILLISATOSHIS_KEY:
45+
return 'Amount (Millisatoshis)';
3846
case SIGNATURE_KEY:
39-
return 'Tx Signature';
47+
return 'Transaction Signature';
4048
case TIMESTAMP_STRING_KEY:
41-
return 'Timestamp';
49+
return 'Timestamp String';
50+
case WORDS_TEMP_KEY:
51+
return 'Words Temp';
4252
case COMMIT_HASH_KEY:
4353
return 'Commit Hash';
4454
case PAYMENT_HASH_KEY:
@@ -55,6 +65,14 @@ export const formatDetailsKey = (key: string) => {
5565
return 'Description';
5666
case EXPIRY_HTLC:
5767
return 'Expiry CLTV';
68+
case TIME_EXPIRE_DATE_STRING:
69+
return 'Time Expire Date String';
70+
case TIME_EXPIRE_DATE:
71+
return 'Time Expire Date';
72+
case TIMESTAMP_KEY:
73+
return 'Timestamp';
74+
case MIN_FINAL_CLTV_EXPIRY:
75+
return 'Minimum Final CLTV Expiry';
5876
default:
5977
break;
6078
}

0 commit comments

Comments
 (0)