@@ -5,14 +5,17 @@ import { OrderSubscriber } from './OrderSubscriber';
55import { GrpcConfigs , ResubOpts } from '../accounts/types' ;
66import { UserAccount } from '../types' ;
77import { getUserFilter , getNonIdleUserFilter } from '../memcmp' ;
8+ import { LaserstreamProgramAccountSubscriber } from '../accounts/laserProgramAccountSubscriber' ;
89
910export class grpcSubscription {
1011 private orderSubscriber : OrderSubscriber ;
1112 private skipInitialLoad : boolean ;
1213 private resubOpts ?: ResubOpts ;
1314 private resyncIntervalMs ?: number ;
1415
15- private subscriber ?: grpcProgramAccountSubscriber < UserAccount > ;
16+ private subscriber ?:
17+ | grpcProgramAccountSubscriber < UserAccount >
18+ | LaserstreamProgramAccountSubscriber < UserAccount > ;
1619 private resyncTimeoutId ?: ReturnType < typeof setTimeout > ;
1720
1821 private decoded ?: boolean ;
@@ -47,17 +50,32 @@ export class grpcSubscription {
4750 return ;
4851 }
4952
50- this . subscriber = await grpcProgramAccountSubscriber . create < UserAccount > (
51- this . grpcConfigs ,
52- 'OrderSubscriber' ,
53- 'User' ,
54- this . orderSubscriber . driftClient . program ,
55- this . orderSubscriber . decodeFn ,
56- {
57- filters : [ getUserFilter ( ) , getNonIdleUserFilter ( ) ] ,
58- } ,
59- this . resubOpts
60- ) ;
53+ if ( this . grpcConfigs . client === 'laser' ) {
54+ this . subscriber =
55+ await LaserstreamProgramAccountSubscriber . create < UserAccount > (
56+ this . grpcConfigs ,
57+ 'OrderSubscriber' ,
58+ 'User' ,
59+ this . orderSubscriber . driftClient . program ,
60+ this . orderSubscriber . decodeFn ,
61+ {
62+ filters : [ getUserFilter ( ) , getNonIdleUserFilter ( ) ] ,
63+ } ,
64+ this . resubOpts
65+ ) ;
66+ } else {
67+ this . subscriber = await grpcProgramAccountSubscriber . create < UserAccount > (
68+ this . grpcConfigs ,
69+ 'OrderSubscriber' ,
70+ 'User' ,
71+ this . orderSubscriber . driftClient . program ,
72+ this . orderSubscriber . decodeFn ,
73+ {
74+ filters : [ getUserFilter ( ) , getNonIdleUserFilter ( ) ] ,
75+ } ,
76+ this . resubOpts
77+ ) ;
78+ }
6179
6280 await this . subscriber . subscribe (
6381 (
0 commit comments