Commit ffe03a7 1 parent a68b2b9 commit ffe03a7 Copy full SHA for ffe03a7
File tree 1 file changed +15
-1
lines changed
packages/blockchain-link/src/workers/solana
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -329,8 +329,8 @@ const subscribeAccounts = async (
329
329
} ,
330
330
} ,
331
331
} ) ;
332
- state . addAccounts ( [ { ...a , subscriptionId } ] ) ;
333
332
} ) ;
333
+ state . addAccounts ( [ { ...a , subscriptionId } ] ) ;
334
334
} ) ;
335
335
return { subscribed : true } ;
336
336
} ;
@@ -433,6 +433,20 @@ class SolanaWorker extends BaseWorker<SolanaAPI> {
433
433
}
434
434
435
435
disconnect ( ) : void {
436
+ if ( ! this . api ) {
437
+ return ;
438
+ }
439
+
440
+ this . state . accounts . forEach (
441
+ a => a . subscriptionId && this . api ?. removeAccountChangeListener ( a . subscriptionId ) ,
442
+ ) ;
443
+
444
+ if ( this . state . getSubscription ( 'block' ) ) {
445
+ const interval = this . state . getSubscription ( 'block' ) as NodeJS . Timer ;
446
+ clearInterval ( interval ) ;
447
+ this . state . removeSubscription ( 'block' ) ;
448
+ }
449
+
436
450
this . api = undefined ;
437
451
}
438
452
}
You can’t perform that action at this time.
0 commit comments