@@ -23,7 +23,6 @@ import lnd, {
2323 LndConf ,
2424 ss_lnrpc ,
2525 lnrpc ,
26- stateService ,
2726} from '@synonymdev/react-native-lightning' ;
2827
2928import lndCache from '@synonymdev/react-native-lightning/dist/utils/neutrino-cache' ;
@@ -50,7 +49,7 @@ const App = () => {
5049 const [ seed , setSeed ] = useState < string [ ] > ( [ ] ) ;
5150
5251 const startStateSubscription = ( ) => {
53- stateService . subscribeToStateChanges (
52+ lnd . stateService . subscribeToStateChanges (
5453 ( res : Result < ss_lnrpc . WalletState > ) => {
5554 if ( res . isOk ( ) ) {
5655 setLndState ( res . value ) ;
@@ -62,7 +61,7 @@ const App = () => {
6261
6362 useEffect ( ( ) => {
6463 ( async ( ) => {
65- const res = await stateService . getState ( ) ;
64+ const res = await lnd . stateService . getState ( ) ;
6665 if ( res . isOk ( ) ) {
6766 setLndState ( res . value ) ;
6867 if ( res . value !== ss_lnrpc . WalletState . WAITING_TO_START ) {
@@ -73,7 +72,7 @@ const App = () => {
7372 } , [ ] ) ;
7473
7574 useEffect ( ( ) => {
76- if ( lndState . walletUnlocked ) {
75+ if ( lndState === ss_lnrpc . WalletState . RPC_ACTIVE ) {
7776 lnd . subscribeToOnChainTransactions (
7877 ( res : Result < lnrpc . Transaction > ) => {
7978 if ( res . isErr ( ) ) {
@@ -134,7 +133,7 @@ const App = () => {
134133 contentInsetAdjustmentBehavior = "automatic"
135134 style = { styles . scrollView } >
136135 < Text style = { styles . state } >
137- State: { stateService . readableState ( lndState ) }
136+ State: { lnd . stateService . readableState ( lndState ) }
138137 </ Text >
139138
140139 < Text style = { styles . message } > { message } </ Text >
@@ -184,7 +183,7 @@ const App = () => {
184183 < Button
185184 title = { 'Generate seed' }
186185 onPress = { async ( ) => {
187- const res = await lnd . genSeed ( ) ;
186+ const res = await lnd . walletUnlocker . genSeed ( ) ;
188187
189188 if ( res . isErr ( ) ) {
190189 console . error ( res . error ) ;
@@ -204,30 +203,35 @@ const App = () => {
204203 < Button
205204 title = { 'Unlock wallet' }
206205 onPress = { async ( ) => {
207- const res = await lnd . unlockWallet ( dummyPassword ) ;
206+ const res = await lnd . walletUnlocker . unlockWallet (
207+ dummyPassword ,
208+ ) ;
208209
209210 if ( res . isErr ( ) ) {
210211 console . error ( res . error ) ;
211212 return ;
212213 }
213214
214- setMessage ( JSON . stringify ( res . value ) ) ;
215+ setMessage ( 'Unlocked.' ) ;
215216 } }
216217 />
217218 ) : null }
218219
219220 { showCreateButton ? (
220221 < Button
221- title = { 'Create wallet' }
222+ title = { 'Init wallet' }
222223 onPress = { async ( ) => {
223- const res = await lnd . createWallet ( dummyPassword , seed ) ;
224+ const res = await lnd . walletUnlocker . initWallet (
225+ dummyPassword ,
226+ seed ,
227+ ) ;
224228
225229 if ( res . isErr ( ) ) {
226230 console . error ( res . error ) ;
227231 return ;
228232 }
229233
230- setMessage ( JSON . stringify ( res . value ) ) ;
234+ setMessage ( 'Wallet initialised' ) ;
231235 } }
232236 />
233237 ) : null }
0 commit comments