11import './shim' ;
2- import React , { useEffect , useState } from 'react' ;
2+ import React , { ReactElement , useEffect , useState } from 'react' ;
33import {
44 SafeAreaView ,
55 ScrollView ,
@@ -17,7 +17,7 @@ import lm from '@synonymdev/react-native-ldk';
1717import { peers } from './utils/constants' ;
1818import { dummyRandomSeed , setSeed } from './utils/helpers' ;
1919
20- const App = ( ) => {
20+ const App = ( ) : ReactElement => {
2121 const [ message , setMessage ] = useState ( '...' ) ;
2222
2323 useEffect ( ( ) => {
@@ -32,7 +32,7 @@ const App = () => {
3232 }
3333 // Subscribe to new blocks and sync LDK accordingly.
3434 await subscribeToHeader ( {
35- onReceive : async ( ) => {
35+ onReceive : async ( ) : Promise < void > => {
3636 const syncRes = await syncLdk ( ) ;
3737 if ( syncRes . isErr ( ) ) {
3838 setMessage ( syncRes . error . message ) ;
@@ -62,7 +62,7 @@ const App = () => {
6262 < View style = { styles . container } >
6363 < Button
6464 title = { 'Create New Random Seed' }
65- onPress = { async ( ) => {
65+ onPress = { async ( ) : Promise < void > => {
6666 const seed = dummyRandomSeed ( ) ;
6767 await setSeed ( 'ldkseed' , seed ) ;
6868 await setItem ( 'LDKData' , '' ) ;
@@ -72,7 +72,7 @@ const App = () => {
7272
7373 < Button
7474 title = { 'Sync LDK' }
75- onPress = { async ( ) => {
75+ onPress = { async ( ) : Promise < void > => {
7676 const syncRes = await syncLdk ( ) ;
7777 if ( syncRes . isErr ( ) ) {
7878 setMessage ( syncRes . error . message ) ;
@@ -84,7 +84,7 @@ const App = () => {
8484
8585 < Button
8686 title = { 'Add Peers' }
87- onPress = { async ( ) => {
87+ onPress = { async ( ) : Promise < void > => {
8888 try {
8989 const peersRes = await Promise . all (
9090 Object . keys ( peers ) . map ( async ( peer ) => {
@@ -108,7 +108,7 @@ const App = () => {
108108
109109 < Button
110110 title = { 'List peers' }
111- onPress = { async ( ) => {
111+ onPress = { async ( ) : Promise < void > => {
112112 try {
113113 const listPeers = await ldk . listPeers ( ) ;
114114 if ( listPeers . isErr ( ) ) {
@@ -124,7 +124,7 @@ const App = () => {
124124
125125 < Button
126126 title = { 'List channels' }
127- onPress = { async ( ) => {
127+ onPress = { async ( ) : Promise < void > => {
128128 try {
129129 const listChannels = await ldk . listChannels ( ) ;
130130 if ( listChannels . isErr ( ) ) {
@@ -164,22 +164,22 @@ const App = () => {
164164
165165 < Button
166166 title = { 'List watch transactions' }
167- onPress = { async ( ) => {
167+ onPress = { async ( ) : Promise < void > => {
168168 console . log ( lm . watchTxs ) ;
169169 setMessage ( `Watch TXs: ${ JSON . stringify ( lm . watchTxs ) } ` ) ;
170170 } }
171171 />
172172
173173 < Button
174174 title = { 'List watch outputs' }
175- onPress = { async ( ) => {
175+ onPress = { async ( ) : Promise < void > => {
176176 setMessage ( `Watch Outputs: ${ JSON . stringify ( lm . watchOutputs ) } ` ) ;
177177 } }
178178 />
179179
180180 < Button
181181 title = { 'Create invoice' }
182- onPress = { async ( ) => {
182+ onPress = { async ( ) : Promise < void > => {
183183 try {
184184 const createPaymentRequest = await ldk . createPaymentRequest ( {
185185 amountSats : 1000000 ,
@@ -203,7 +203,7 @@ const App = () => {
203203
204204 < Button
205205 title = { 'Pay invoice' }
206- onPress = { async ( ) => {
206+ onPress = { async ( ) : Promise < void > => {
207207 const paymentRequest = await Clipboard . getString ( ) ;
208208 const decode = await ldk . decode ( { paymentRequest } ) ;
209209 if ( decode . isErr ( ) ) {
@@ -224,7 +224,7 @@ const App = () => {
224224 } ,
225225 {
226226 text : 'Pay' ,
227- onPress : async ( ) => {
227+ onPress : async ( ) : Promise < void > => {
228228 const pay = await ldk . pay ( { paymentRequest } ) ;
229229 if ( pay . isErr ( ) ) {
230230 return setMessage ( pay . error . message ) ;
@@ -240,7 +240,7 @@ const App = () => {
240240
241241 < Button
242242 title = { 'Get info' }
243- onPress = { async ( ) => {
243+ onPress = { async ( ) : Promise < void > => {
244244 const nodeIdRes = await ldk . nodeId ( ) ;
245245 if ( nodeIdRes . isErr ( ) ) {
246246 return setMessage ( nodeIdRes . error . message ) ;
@@ -255,7 +255,7 @@ const App = () => {
255255
256256 < Button
257257 title = { 'Show version' }
258- onPress = { async ( ) => {
258+ onPress = { async ( ) : Promise < void > => {
259259 const ldkVersion = await ldk . version ( ) ;
260260 if ( ldkVersion . isErr ( ) ) {
261261 return setMessage ( ldkVersion . error . message ) ;
0 commit comments