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

Commit 8e67477

Browse files
committed
Remove wallet dependency from transaction action
since wallet balances are now polled
1 parent 467c0eb commit 8e67477

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
lines changed

src/action/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const grpc = new GrpcAction(store, ipc);
3636
export const notify = new NotificationAction(store, nav);
3737
export const wallet = new WalletAction(store, grpc, db, nav, notify);
3838
export const info = new InfoAction(store, grpc, nav, notify);
39-
export const transaction = new TransactionAction(store, grpc, wallet, nav);
39+
export const transaction = new TransactionAction(store, grpc, nav);
4040
export const channel = new ChannelAction(store, grpc, transaction, nav, notify);
4141
export const invoice = new InvoiceAction(
4242
store,

src/action/transaction.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import * as log from './log';
77
import { parseDate, parseSat, toHex } from '../helper';
88

99
class TransactionAction {
10-
constructor(store, grpc, wallet, nav) {
10+
constructor(store, grpc, nav) {
1111
this._store = store;
1212
this._grpc = grpc;
13-
this._wallet = wallet;
1413
this._nav = nav;
1514
}
1615

@@ -37,17 +36,15 @@ class TransactionAction {
3736
}
3837

3938
/**
40-
* Update the on-chain transactions, invoice, lighting payments, and wallet
41-
* balances in the app state by querying all required grpc apis.
39+
* Update the on-chain transactions, invoice, and lighting payments in the
40+
* app state by querying all required grpc apis.
4241
* @return {Promise<undefined>}
4342
*/
4443
async update() {
4544
await Promise.all([
4645
this.getTransactions(),
4746
this.getInvoices(),
4847
this.getPayments(),
49-
this._wallet.getBalance(),
50-
this._wallet.getChannelBalance(),
5148
]);
5249
}
5350

stories/screen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ sinon.stub(wallet, 'checkSeed');
6565
sinon.stub(wallet, 'checkNewPassword');
6666
sinon.stub(wallet, 'checkPassword');
6767
sinon.stub(wallet, 'getExchangeRate');
68-
const transaction = new TransactionAction(store, grpc, wallet, nav);
68+
const transaction = new TransactionAction(store, grpc, nav);
6969
sinon.stub(transaction, 'update');
7070
const invoice = new InvoiceAction(
7171
store,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ describe('Action Integration Tests', function() {
149149
grpc1 = new GrpcAction(store1, ipc1);
150150
info1 = new InfoAction(store1, grpc1, nav1, notify1);
151151
wallet1 = new WalletAction(store1, grpc1, db1, nav1, notify1);
152-
transactions1 = new TransactionAction(store1, grpc1, wallet1, nav1);
152+
transactions1 = new TransactionAction(store1, grpc1, nav1);
153153
channels1 = new ChannelAction(store1, grpc1, transactions1, nav1, notify1);
154154
invoice1 = new InvoiceAction(store1, grpc1, transactions1, nav1, notify1);
155155
payments1 = new PaymentAction(store1, grpc1, transactions1, nav1, notify1);
@@ -161,7 +161,7 @@ describe('Action Integration Tests', function() {
161161
grpc2 = new GrpcAction(store2, ipc2);
162162
info2 = new InfoAction(store2, grpc2, nav2, notify2);
163163
wallet2 = new WalletAction(store2, grpc2, db2, nav2, notify2);
164-
transactions2 = new TransactionAction(store2, grpc2, wallet2, nav2);
164+
transactions2 = new TransactionAction(store2, grpc2, nav2);
165165
channels2 = new ChannelAction(store2, grpc2, transactions2, nav2, notify2);
166166
invoice2 = new InvoiceAction(store2, grpc2, transactions2, nav2, notify2);
167167
payments2 = new PaymentAction(store2, grpc2, transactions2, nav2, notify2);

test/unit/action/transaction.spec.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Store } from '../../../src/store';
22
import GrpcAction from '../../../src/action/grpc';
33
import TransactionAction from '../../../src/action/transaction';
4-
import WalletAction from '../../../src/action/wallet';
54
import NavAction from '../../../src/action/nav';
65
import * as logger from '../../../src/action/log';
76

@@ -10,7 +9,6 @@ describe('Action Transactions Unit Tests', () => {
109
let sandbox;
1110
let grpc;
1211
let nav;
13-
let wallet;
1412
let transaction;
1513

1614
beforeEach(() => {
@@ -20,8 +18,7 @@ describe('Action Transactions Unit Tests', () => {
2018
require('../../../src/config').RETRY_DELAY = 1;
2119
grpc = sinon.createStubInstance(GrpcAction);
2220
nav = sinon.createStubInstance(NavAction);
23-
wallet = sinon.createStubInstance(WalletAction);
24-
transaction = new TransactionAction(store, grpc, wallet, nav);
21+
transaction = new TransactionAction(store, grpc, nav);
2522
});
2623

2724
afterEach(() => {
@@ -48,11 +45,9 @@ describe('Action Transactions Unit Tests', () => {
4845
});
4946

5047
describe('update()', () => {
51-
it('should refresh transactions and balances', async () => {
48+
it('should refresh transactions', async () => {
5249
await transaction.update();
5350
expect(grpc.sendCommand, 'was called thrice');
54-
expect(wallet.getBalance, 'was called once');
55-
expect(wallet.getChannelBalance, 'was called once');
5651
});
5752
});
5853

0 commit comments

Comments
 (0)