chore: test out a dlob ignore list
This commit is contained in:
35
src/dlob-subscriber/OrderSubscriberFiltered.ts
Normal file
35
src/dlob-subscriber/OrderSubscriberFiltered.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import {
|
||||
OrderSubscriber,
|
||||
OrderSubscriberConfig,
|
||||
UserAccount,
|
||||
} from '@drift-labs/sdk';
|
||||
|
||||
export class OrderSubscriberFiltered extends OrderSubscriber {
|
||||
public ignoreList: string[];
|
||||
|
||||
constructor(
|
||||
config: OrderSubscriberConfig & {
|
||||
ignoreList?: string[];
|
||||
}
|
||||
) {
|
||||
super(config);
|
||||
this.ignoreList = config.ignoreList ?? [];
|
||||
}
|
||||
|
||||
override async tryUpdateUserAccount(
|
||||
key: string,
|
||||
dataType: 'raw' | 'decoded' | 'buffer',
|
||||
data: string[] | UserAccount | Buffer,
|
||||
slot: number
|
||||
) {
|
||||
if (!this.mostRecentSlot || slot > this.mostRecentSlot) {
|
||||
this.mostRecentSlot = slot;
|
||||
}
|
||||
|
||||
if (this.ignoreList.includes(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.tryUpdateUserAccount(key, dataType, data, slot);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user