@drift-labs/sdk
Version:
SDK for Drift Protocol
30 lines • 1.44 kB
TypeScript
/// <reference types="node" />
import { DataAndSlot, UserAccountEvents, UserAccountSubscriber } from './types';
import { Connection } from '../bankrun/bankrunConnection';
import StrictEventEmitter from 'strict-event-emitter-types';
import { EventEmitter } from 'events';
import { PublicKey } from '@solana/web3.js';
import { UserAccount } from '../types';
import { BulkAccountLoader } from './bulkAccountLoader';
export declare class PollingUserAccountSubscriber implements UserAccountSubscriber {
isSubscribed: boolean;
connection: Connection;
eventEmitter: StrictEventEmitter<EventEmitter, UserAccountEvents>;
userAccountPublicKey: PublicKey;
accountLoader: BulkAccountLoader;
callbackId?: string;
errorCallbackId?: string;
decode: (name: any, buffer: any) => UserAccount;
user?: DataAndSlot<UserAccount>;
constructor(connection: Connection, userAccountPublicKey: PublicKey, accountLoader: BulkAccountLoader, decode: (name: any, buffer: any) => UserAccount);
subscribe(userAccount?: UserAccount): Promise<boolean>;
addToAccountLoader(): Promise<void>;
fetchIfUnloaded(): Promise<void>;
fetch(): Promise<void>;
doesAccountExist(): boolean;
unsubscribe(): Promise<void>;
assertIsSubscribed(): void;
getUserAccountAndSlot(): DataAndSlot<UserAccount>;
updateData(userAccount: UserAccount, slot: number): void;
}
//# sourceMappingURL=pollingUserAccountSubscriber.d.ts.map