88 DevnetSpotMarkets ,
99 DriftClient ,
1010 getPythLazerOraclePublicKey ,
11+ getVariant ,
1112 MainnetPerpMarkets ,
1213 MainnetSpotMarkets ,
1314 PriorityFeeSubscriber ,
@@ -53,13 +54,6 @@ export class PythLazerCrankerBot implements Bot {
5354 this . name = crankConfigs . botId ;
5455 this . dryRun = crankConfigs . dryRun ;
5556 this . intervalMs = crankConfigs . intervalMs ;
56- if ( ! globalConfig . hermesEndpoint ) {
57- throw new Error ( 'Missing hermesEndpoint in global config' ) ;
58- }
59-
60- if ( globalConfig . driftEnv != 'devnet' ) {
61- throw new Error ( 'Only devnet drift env is supported' ) ;
62- }
6357
6458 const spotMarkets =
6559 this . globalConfig . driftEnv === 'mainnet-beta'
@@ -70,13 +64,18 @@ export class PythLazerCrankerBot implements Bot {
7064 ? MainnetPerpMarkets
7165 : DevnetPerpMarkets ;
7266
73- const allFeedIds = [
74- ...spotMarkets . map ( ( market ) => market . pythLazerId ) ,
75- ...perpMarkets . map ( ( market ) => market . pythLazerId ) ,
76- ] . filter ( ( id ) => id !== undefined ) as number [ ] ;
67+ const allFeedIds : number [ ] = [ ] ;
68+ for ( const market of [ ...spotMarkets , ...perpMarkets ] ) {
69+ if (
70+ ( this . crankConfigs . onlyCrankUsedOracles &&
71+ ! getVariant ( market . oracleSource ) . toLowerCase ( ) . includes ( 'lazer' ) ) ||
72+ market . pythFeedId == undefined
73+ )
74+ continue ;
75+ allFeedIds . push ( market . pythLazerId ! ) ;
76+ }
7777 const allFeedIdsSet = new Set ( allFeedIds ) ;
7878 const feedIdChunks = chunks ( Array . from ( allFeedIdsSet ) , 11 ) ;
79-
8079 console . log ( feedIdChunks ) ;
8180
8281 if ( ! this . globalConfig . lazerEndpoint || ! this . globalConfig . lazerToken ) {
0 commit comments