Skip to content
This repository was archived by the owner on Oct 24, 2022. It is now read-only.

Commit b3b844d

Browse files
committed
Update README.md
Code cleanup
1 parent f693e0e commit b3b844d

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ yarn android
4545
import lnd, {
4646
ENetworks,
4747
LndConf,
48-
TCurrentLndState,
48+
ss_lnrpc
4949
} from '@synonymdev/react-native-lightning';
5050

5151
const lndConf = new LndConf(ENetworks.regtest);
@@ -59,11 +59,16 @@ if (res.isErr()) {
5959
}
6060

6161
//LND state changes
62-
lnd.subscribeToCurrentState(({lndRunning, walletUnlocked, grpcReady}) => {
63-
console.log(`lndRunning: ${lndRunning}`);
64-
console.log(`walletUnlocked: ${walletUnlocked}`);
65-
console.log(`grpcReady: ${grpcReady}`);
66-
});
62+
lnd.stateService.subscribeToStateChanges(
63+
(res: Result<ss_lnrpc.WalletState>) => {
64+
if (res.isOk()) {
65+
setLndState(res.value);
66+
}
67+
},
68+
() => {
69+
//Subscription has ended
70+
},
71+
);
6772

6873

6974
//Subscribe to LND logs

src/services/walletunlocker.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import GrpcAction from '../grpc';
22
import { err, ok, Result } from '../utils/result';
3-
import { EGrpcStreamMethods, EGrpcSyncMethods } from '../utils/types';
3+
import { EGrpcSyncMethods } from '../utils/types';
44
import { lnrpc, wu_lnrpc } from '../';
55
import { hexStringToBytes, stringToBytes } from '../utils/helpers';
6-
import base64 from 'base64-js';
76

87
class WalletUnlocker {
98
private readonly grpc: GrpcAction;

0 commit comments

Comments
 (0)