dlob add fetch indicative quotes (#372)

* dlob add fetch indicative quotes

* indicative ws stream

* prettify

* allow for oracle orders
This commit is contained in:
moosecat
2025-04-16 12:06:21 -07:00
committed by GitHub
parent 6d1a11f805
commit b3b655dc65
6 changed files with 405 additions and 260 deletions

View File

@@ -1,9 +1,18 @@
import { DLOB, OrderSubscriber, UserAccount, UserMap } from '@drift-labs/sdk';
import {
DLOB,
OrderSubscriber,
ProtectMakerParamsMap,
UserAccount,
UserMap,
} from '@drift-labs/sdk';
import { PublicKey } from '@solana/web3.js';
export type DLOBProvider = {
subscribe(): Promise<void>;
getDLOB(slot: number, protectedMakerView: boolean): Promise<DLOB>;
getDLOB(
slot: number,
protectedMakerParamsMap?: ProtectMakerParamsMap
): Promise<DLOB>;
getUniqueAuthorities(): PublicKey[];
getUserAccounts(): Generator<{
userAccount: UserAccount;
@@ -20,8 +29,11 @@ export function getDLOBProviderFromUserMap(userMap: UserMap): DLOBProvider {
subscribe: async () => {
await userMap.subscribe();
},
getDLOB: async (slot: number, protectedMakerView: boolean) => {
return await userMap.getDLOB(slot, protectedMakerView);
getDLOB: async (
slot: number,
protectedMakerParamsMap?: ProtectMakerParamsMap
) => {
return await userMap.getDLOB(slot, protectedMakerParamsMap);
},
getUniqueAuthorities: () => {
return userMap.getUniqueAuthorities();
@@ -56,8 +68,11 @@ export function getDLOBProviderFromOrderSubscriber(
subscribe: async () => {
await orderSubscriber.subscribe();
},
getDLOB: async (slot: number, protectedMakerView: boolean) => {
return await orderSubscriber.getDLOB(slot, protectedMakerView);
getDLOB: async (
slot: number,
protectedMakerParamsMap?: ProtectMakerParamsMap
) => {
return await orderSubscriber.getDLOB(slot, protectedMakerParamsMap);
},
getUniqueAuthorities: () => {
const authorities = new Set<string>();