File tree Expand file tree Collapse file tree 2 files changed +28
-9
lines changed Expand file tree Collapse file tree 2 files changed +28
-9
lines changed Original file line number Diff line number Diff line change @@ -125,26 +125,36 @@ export class TestnetClient {
125125
126126 /**
127127 * Polls a given testnet for the ACTIVE state
128- * polls on a 500 milisecond interval
128+ * polls on a 3000 millisecond interval
129129 */
130130 public async pollTestnetForActive ( ) : Promise < string > {
131131 let state = 'Busy' ;
132- while ( state != 'Active' && state != `UNKNOWN` ) {
132+ let pollCount = 0 ;
133+ const startTime = Date . now ( ) ; // Capture start time
134+
135+ while ( state !== 'Active' && state !== 'UNKNOWN' ) {
136+ pollCount ++ ;
137+
133138 const res = await fetch (
134139 this . _processEnvs . TESTNET_MANAGER_URL + '/test/poll/testnet/' + this . _id
135140 ) ;
136141 const stateRes : TestNetResponse < TestNetState > =
137142 await _processTestnetResponse < TestNetState > ( res ) ;
138143 state = stateRes . body ;
139- console . log ( 'found state to be' , state ) ;
140144
141- await new Promise < void > ( ( res , _ ) => {
142- setTimeout ( ( ) => {
143- res ( ) ;
144- } , 500 ) ;
145- } ) ;
145+ console . log ( `Poll attempt # ${ pollCount } : found state to be` , state ) ;
146+
147+ if ( state !== 'Active' && state !== 'UNKNOWN' ) {
148+ await new Promise < void > ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ;
149+ }
146150 }
147151
152+ const endTime = Date . now ( ) ; // Capture end time
153+ const elapsedTime = ( endTime - startTime ) / 1000 ; // Convert to seconds
154+
155+ console . log (
156+ `✅ Polling completed after ${ pollCount } attempts. Time taken: ${ elapsedTime } seconds.`
157+ ) ;
148158 return state ;
149159 }
150160
Original file line number Diff line number Diff line change @@ -554,16 +554,25 @@ export class LitCore {
554554 }
555555
556556 if ( this . config . contractContext ) {
557+ console . log (
558+ '❓ this.config.contractContext:' ,
559+ this . config . contractContext
560+ ) ;
557561 const logAddresses = Object . entries ( this . config . contractContext ) . reduce (
558562 ( output , [ key , val ] ) => {
563+
564+ console . log ( '❓ key:' , key ) ;
565+ console . log ( '❓ val:' , val ) ;
566+
559567 // @ts -expect-error since the object hash returned by `getContractAddresses` is `any`, we have no types here
560568 output [ key ] = val . address ;
561569 return output ;
562570 } ,
563571 { }
564572 ) ;
573+ console . log ( '❓ logAddresses:' , logAddresses ) ;
565574 if ( this . config . litNetwork === LIT_NETWORK . Custom ) {
566- log ( 'using custom contracts: ' , logAddresses ) ;
575+ log ( '❓ using custom contracts: ' , logAddresses ) ;
567576 }
568577 }
569578
You can’t perform that action at this time.
0 commit comments