File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ yarn android
4545import lnd, {
4646 ENetworks ,
4747 LndConf ,
48- TCurrentLndState ,
48+ ss_lnrpc
4949} from ' @synonymdev/react-native-lightning' ;
5050
5151const 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
Original file line number Diff line number Diff line change 11import GrpcAction from '../grpc' ;
22import { err , ok , Result } from '../utils/result' ;
3- import { EGrpcStreamMethods , EGrpcSyncMethods } from '../utils/types' ;
3+ import { EGrpcSyncMethods } from '../utils/types' ;
44import { lnrpc , wu_lnrpc } from '../' ;
55import { hexStringToBytes , stringToBytes } from '../utils/helpers' ;
6- import base64 from 'base64-js' ;
76
87class WalletUnlocker {
98 private readonly grpc : GrpcAction ;
@@ -33,7 +32,7 @@ class WalletUnlocker {
3332
3433 /**
3534 * Once LND is started then the wallet can be created and unlocked with this.
36- * @return {Promise<Ok<any > | Err<unknown >> }
35+ * @return {Promise<Err<unknown > | Ok<wu_lnrpc.InitWalletResponse >> }
3736 * @param password
3837 * @param seed
3938 * @param multiChanBackup
@@ -69,7 +68,7 @@ class WalletUnlocker {
6968
7069 /**
7170 * Once LND is started then the wallet can be unlocked with this.
72- * @return {Promise<Ok<string > | Err<unknown>> }
71+ * @return {Promise<Ok<wu_lnrpc.UnlockWalletResponse > | Err<unknown>> }
7372 * @param password
7473 */
7574 async unlockWallet ( password : string ) : Promise < Result < wu_lnrpc . UnlockWalletResponse > > {
You can’t perform that action at this time.
0 commit comments