8
8
} from '../oracles/types' ;
9
9
10
10
import { getOracleId } from '../oracles/oracleId' ;
11
- import { DevnetPerpMarkets , MainnetPerpMarkets , PublicKey } from '@drift-labs/sdk' ;
12
11
13
- // allowing app UI state to mixin and replace with RPC polled data
12
+
13
+ // allowing app UI state to incrementally replace RPC fetched acconut data with data from our infra that is pre-indexed and decoded
14
14
export class ExternalDataDriftClientSubscriber extends PollingDriftClientAccountSubscriber {
15
15
private oracleLastUpdate = new Map < string , number > ( ) ;
16
16
private pollingOracles = new Map < string , boolean > ( ) ;
@@ -28,9 +28,6 @@ export class ExternalDataDriftClientSubscriber extends PollingDriftClientAccount
28
28
29
29
/** Public method to be called externally with fresh oracle data */
30
30
public feedOracle ( oracleInfo : OracleInfo , priceData : OraclePriceData , slot : number ) {
31
- if ( oracleInfo . publicKey . equals ( new PublicKey ( "BtUUSUc9rZSzBmmKhQq4no65zHQTzMFeVYss7xcMRD53" ) ) ) {
32
- console . log ( "feedOracle Republican popular vote" , oracleInfo . publicKey . toBase58 ( ) , oracleInfo . source ) ;
33
- }
34
31
const oracleId = getOracleId ( oracleInfo . publicKey , oracleInfo . source ) ;
35
32
this . oracles . set ( oracleId , { data : priceData , slot } ) ;
36
33
this . oracleLastUpdate . set ( oracleId , Date . now ( ) ) ;
@@ -63,10 +60,6 @@ export class ExternalDataDriftClientSubscriber extends PollingDriftClientAccount
63
60
if ( ! oracleToPoll ) continue ;
64
61
const now = Date . now ( ) ;
65
62
if ( now - lastUpdate > 130_000 && ! this . pollingOracles . has ( oracleId ) ) {
66
- const market = [ ...DevnetPerpMarkets , ...MainnetPerpMarkets ] . find ( m => m . oracle . equals ( oracleToPoll . publicKey ) ) ;
67
- if ( oracleToPoll . publicKey . equals ( new PublicKey ( "BtUUSUc9rZSzBmmKhQq4no65zHQTzMFeVYss7xcMRD53" ) ) ) {
68
- console . log ( "startOraclePollingWatchdog timeout fallback Republican popular vote" , oracleToPoll . publicKey . toBase58 ( ) , market ?. symbol ) ;
69
- }
70
63
await this . addOracleToAccountLoader ( oracleToPoll ) ;
71
64
this . pollingOracles . set ( oracleId , true ) ;
72
65
}
0 commit comments