UNPKG

@drift-labs/sdk

Version:
39 lines 1.48 kB
/// <reference types="bn.js" /> import { Connection, PublicKey } from '@solana/web3.js'; import { BulkAccountLoader } from '../accounts/bulkAccountLoader'; import { BN } from '@coral-xyz/anchor'; import { L2Level, L2OrderBookGenerator } from '../dlob/orderBookLevels'; import { Market, OpenBookV2Client } from '@openbook-dex/openbook-v2'; export type OpenbookV2SubscriberConfig = { connection: Connection; programId: PublicKey; marketAddress: PublicKey; accountSubscription: { type: 'polling'; accountLoader: BulkAccountLoader; } | { type: 'websocket'; }; }; export declare class OpenbookV2Subscriber implements L2OrderBookGenerator { connection: Connection; programId: PublicKey; marketAddress: PublicKey; subscriptionType: 'polling' | 'websocket'; accountLoader: BulkAccountLoader | undefined; subscribed: boolean; market: Market; marketCallbackId: string | number; client: OpenBookV2Client; constructor(config: OpenbookV2SubscriberConfig); subscribe(): Promise<void>; getBestBid(): BN | undefined; getBestAsk(): BN | undefined; getL2Bids(): Generator<L2Level>; getL2Asks(): Generator<L2Level>; convertSizeInBaseLotsToMarketPrecision(sizeInLots: BN): BN; convertPriceInLotsToPricePrecision(priceInLots: BN): BN; getL2Levels(side: 'bids' | 'asks'): Generator<L2Level>; unsubscribe(): Promise<void>; } //# sourceMappingURL=openbookV2Subscriber.d.ts.map