@@ -322,36 +322,43 @@ Ethplorer = {
322
322
}
323
323
var stopCheckingPendingAt = Date . now ( ) + 1800000 ; // after 30 minutes
324
324
function loadTxDetails ( showResult = true ) {
325
- $ . getJSON ( Ethplorer . service , requestData , function ( _txHash ) {
326
- return function ( data ) {
327
- if ( data . debug ) {
328
- Ethplorer . requestDebug = data . debug ;
325
+ $ . getJSON ( Ethplorer . service , requestData )
326
+ . done ( function ( _txHash ) {
327
+ return function ( data ) {
328
+ if ( data . debug ) {
329
+ Ethplorer . requestDebug = data . debug ;
330
+ }
331
+ if ( data . ethPrice ) {
332
+ Ethplorer . ethPrice = data . ethPrice ;
333
+ }
334
+ if ( showResult ) {
335
+ // if transaction is pending need send ga event
336
+ if ( data . pending ) {
337
+ Ethplorer . gaSendEvent ( 'pageView' , 'viewTx' , 'tx-pending' ) ;
338
+ }
339
+ Ethplorer . showTxDetails ( _txHash , data ) ;
340
+ } else if ( ! data . pending ) {
341
+ // Transaction not pending anymore. Reloading the view.
342
+ location . reload ( ) ;
343
+ }
344
+ // is transaction is pending
345
+ if ( data . pending && stopCheckingPendingAt > Date . now ( ) ) {
346
+ setTimeout ( function ( ) {
347
+ loadTxDetails ( false ) ;
348
+ } , 30000 ) ; // every 30 seconds
349
+ }
329
350
}
330
351
if ( data . ethPrice ) {
331
352
Ethplorer . ethPrice = data . ethPrice ;
332
353
}
333
- if ( showResult ) {
334
- // if transaction is pending need send ga event
335
- if ( data . pending ) {
336
- Ethplorer . gaSendEvent ( 'pageView' , 'viewTx' , 'tx-pending' ) ;
337
- }
338
- Ethplorer . showTxDetails ( _txHash , data ) ;
339
- } else if ( ! data . pending ) {
340
- // Transaction not pending anymore. Reloading the view.
341
- location . reload ( ) ;
342
- }
343
- // is transaction is pending
344
- if ( data . pending && stopCheckingPendingAt > Date . now ( ) ) {
345
- setTimeout ( function ( ) {
346
- loadTxDetails ( false ) ;
347
- } , 30000 ) ; // every 30 seconds
348
- }
349
- }
350
- if ( data . ethPrice ) {
351
- Ethplorer . ethPrice = data . ethPrice ;
352
- }
353
- Ethplorer . showTxDetails ( _txHash , data ) ;
354
- } ( txHash ) ) ;
354
+ Ethplorer . showTxDetails ( _txHash , data ) ;
355
+ } ( txHash ) )
356
+ . fail ( function ( ) {
357
+ // Try send request again after 30 seconds
358
+ setTimeout ( function ( ) {
359
+ loadTxDetails ( false ) ;
360
+ } , 30000 ) ;
361
+ } ) ;
355
362
}
356
363
loadTxDetails ( ) ;
357
364
} ,
0 commit comments