@drift-labs/sdk
Version:
SDK for Drift Protocol
28 lines • 1.26 kB
TypeScript
import { BlockhashWithExpiryBlockHeight, Context } from '@solana/web3.js';
import { BlockhashSubscriberConfig } from './types';
export declare class BlockhashSubscriber {
private connection;
private isSubscribed;
private latestBlockHeight;
private latestBlockHeightContext;
private blockhashes;
private updateBlockhashIntervalId;
private commitment;
private updateIntervalMs;
constructor(config: BlockhashSubscriberConfig);
getBlockhashCacheSize(): number;
getLatestBlockHeight(): number;
getLatestBlockHeightContext(): Context | undefined;
/**
* Returns the latest cached blockhash, based on an offset from the latest obtained
* @param offset Offset to use, defaulting to 0
* @param offsetType If 'seconds', it will use calculate the actual element offset based on the update interval; otherwise it will return a fixed index
* @returns Cached blockhash at the given offset, or undefined
*/
getLatestBlockhash(offset?: number, offsetType?: 'index' | 'seconds'): BlockhashWithExpiryBlockHeight | undefined;
pruneBlockhashes(): void;
updateBlockhash(): Promise<void>;
subscribe(): Promise<void>;
unsubscribe(): void;
}
//# sourceMappingURL=BlockhashSubscriber.d.ts.map