This repository was archived by the owner on Oct 24, 2022. It is now read-only.
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
45
45
import lnd, {
46
46
ENetworks ,
47
47
LndConf ,
48
- TCurrentLndState ,
48
+ ss_lnrpc
49
49
} from ' @synonymdev/react-native-lightning' ;
50
50
51
51
const lndConf = new LndConf (ENetworks .regtest );
@@ -59,11 +59,16 @@ if (res.isErr()) {
59
59
}
60
60
61
61
// 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
+ );
67
72
68
73
69
74
// Subscribe to LND logs
Original file line number Diff line number Diff line change 1
1
import GrpcAction from '../grpc' ;
2
2
import { err , ok , Result } from '../utils/result' ;
3
- import { EGrpcStreamMethods , EGrpcSyncMethods } from '../utils/types' ;
3
+ import { EGrpcSyncMethods } from '../utils/types' ;
4
4
import { lnrpc , wu_lnrpc } from '../' ;
5
5
import { hexStringToBytes , stringToBytes } from '../utils/helpers' ;
6
- import base64 from 'base64-js' ;
7
6
8
7
class WalletUnlocker {
9
8
private readonly grpc : GrpcAction ;
@@ -33,7 +32,7 @@ class WalletUnlocker {
33
32
34
33
/**
35
34
* 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 >> }
37
36
* @param password
38
37
* @param seed
39
38
* @param multiChanBackup
@@ -69,7 +68,7 @@ class WalletUnlocker {
69
68
70
69
/**
71
70
* 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>> }
73
72
* @param password
74
73
*/
75
74
async unlockWallet ( password : string ) : Promise < Result < wu_lnrpc . UnlockWalletResponse > > {
You can’t perform that action at this time.
0 commit comments