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

Commit 62c8426

Browse files
committed
Remove transaction dependency in invoice action
since wallet balances are polled now and transactions are updated anyway when navigating to the transaction list
1 parent 8e67477 commit 62c8426

File tree

5 files changed

+6
-33
lines changed

5 files changed

+6
-33
lines changed

src/action/index.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,7 @@ export const wallet = new WalletAction(store, grpc, db, nav, notify);
3838
export const info = new InfoAction(store, grpc, nav, notify);
3939
export const transaction = new TransactionAction(store, grpc, nav);
4040
export const channel = new ChannelAction(store, grpc, transaction, nav, notify);
41-
export const invoice = new InvoiceAction(
42-
store,
43-
grpc,
44-
transaction,
45-
nav,
46-
notify,
47-
Clipboard
48-
);
41+
export const invoice = new InvoiceAction(store, grpc, nav, notify, Clipboard);
4942
export const payment = new PaymentAction(store, grpc, transaction, nav, notify);
5043
export const setting = new SettingAction(store, wallet, db, ipc);
5144

src/action/invoice.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import { PREFIX_URI } from '../config';
77
import { toSatoshis } from '../helper';
88

99
class InvoiceAction {
10-
constructor(store, grpc, transaction, nav, notification, clipboard) {
10+
constructor(store, grpc, nav, notification, clipboard) {
1111
this._store = store;
1212
this._grpc = grpc;
13-
this._transaction = transaction;
1413
this._nav = nav;
1514
this._notification = notification;
1615
this._clipboard = clipboard;
@@ -70,7 +69,6 @@ class InvoiceAction {
7069
} catch (err) {
7170
this._notification.display({ msg: 'Creating invoice failed!', err });
7271
}
73-
await this._transaction.update();
7472
}
7573

7674
/**

stories/screen.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,7 @@ sinon.stub(wallet, 'checkPassword');
6767
sinon.stub(wallet, 'getExchangeRate');
6868
const transaction = new TransactionAction(store, grpc, nav);
6969
sinon.stub(transaction, 'update');
70-
const invoice = new InvoiceAction(
71-
store,
72-
grpc,
73-
transaction,
74-
nav,
75-
notify,
76-
Clipboard
77-
);
70+
const invoice = new InvoiceAction(store, grpc, nav, notify, Clipboard);
7871
sinon.stub(invoice, 'generateUri');
7972
const payment = new PaymentAction(store, grpc, transaction, nav, notify);
8073
sinon.stub(payment, 'checkType');

test/integration/action/action-integration.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ describe('Action Integration Tests', function() {
151151
wallet1 = new WalletAction(store1, grpc1, db1, nav1, notify1);
152152
transactions1 = new TransactionAction(store1, grpc1, nav1);
153153
channels1 = new ChannelAction(store1, grpc1, transactions1, nav1, notify1);
154-
invoice1 = new InvoiceAction(store1, grpc1, transactions1, nav1, notify1);
154+
invoice1 = new InvoiceAction(store1, grpc1, nav1, notify1);
155155
payments1 = new PaymentAction(store1, grpc1, transactions1, nav1, notify1);
156156

157157
db2 = sinon.createStubInstance(AppStorage);
@@ -163,7 +163,7 @@ describe('Action Integration Tests', function() {
163163
wallet2 = new WalletAction(store2, grpc2, db2, nav2, notify2);
164164
transactions2 = new TransactionAction(store2, grpc2, nav2);
165165
channels2 = new ChannelAction(store2, grpc2, transactions2, nav2, notify2);
166-
invoice2 = new InvoiceAction(store2, grpc2, transactions2, nav2, notify2);
166+
invoice2 = new InvoiceAction(store2, grpc2, nav2, notify2);
167167
payments2 = new PaymentAction(store2, grpc2, transactions2, nav2, notify2);
168168
});
169169

test/unit/action/invoice.spec.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ import { Store } from '../../../src/store';
22
import NavAction from '../../../src/action/nav';
33
import GrpcAction from '../../../src/action/grpc';
44
import InvoiceAction from '../../../src/action/invoice';
5-
import TransactionAction from '../../../src/action/transaction';
65
import NotificationAction from '../../../src/action/notification';
76

87
describe('Action Invoice Unit Tests', () => {
98
let store;
109
let nav;
1110
let grpc;
1211
let invoice;
13-
let transaction;
1412
let notification;
1513
let clipboard;
1614

@@ -22,15 +20,7 @@ describe('Action Invoice Unit Tests', () => {
2220
grpc = sinon.createStubInstance(GrpcAction);
2321
notification = sinon.createStubInstance(NotificationAction);
2422
clipboard = { setString: sinon.stub() };
25-
transaction = sinon.createStubInstance(TransactionAction);
26-
invoice = new InvoiceAction(
27-
store,
28-
grpc,
29-
transaction,
30-
nav,
31-
notification,
32-
clipboard
33-
);
23+
invoice = new InvoiceAction(store, grpc, nav, notification, clipboard);
3424
});
3525

3626
describe('init()', () => {
@@ -78,7 +68,6 @@ describe('Action Invoice Unit Tests', () => {
7868
expect(store.invoice.encoded, 'to equal', 'some-request');
7969
expect(store.invoice.uri, 'to equal', 'lightning:some-request');
8070
expect(nav.goInvoiceQR, 'was called once');
81-
expect(transaction.update, 'was called once');
8271
});
8372

8473
it('should display notification on error', async () => {

0 commit comments

Comments
 (0)