@drift-labs/sdk
Version:
SDK for Drift Protocol
46 lines • 1.61 kB
TypeScript
import { MemcmpFilter } from '@solana/web3.js';
import { DriftClient } from '../driftClient';
import { ReferrerInfo } from '../types';
export declare class ReferrerMap {
/**
* map from authority pubkey to referrer pubkey.
*/
private authorityReferrerMap;
/**
* map from referrer pubkey to ReferrerInfo.
* Will be undefined if the referrer is not in the map yet.
*/
private referrerReferrerInfoMap;
private driftClient;
private parallelSync;
private fetchPromise?;
private fetchPromiseResolver;
/**
* Creates a new UserStatsMap instance.
*
* @param {DriftClient} driftClient - The DriftClient instance.
*/
constructor(driftClient: DriftClient, parallelSync?: boolean);
/**
* Subscribe to all UserStats accounts.
*/
subscribe(): Promise<void>;
has(authorityPublicKey: string): boolean;
get(authorityPublicKey: string): ReferrerInfo | undefined;
addReferrer(authority: string, referrer?: string): Promise<void>;
/**
* Enforce that a UserStats will exist for the given authorityPublicKey,
* reading one from the blockchain if necessary.
* @param authorityPublicKey
* @returns
*/
mustGet(authorityPublicKey: string): Promise<ReferrerInfo | undefined>;
getReferrer(authorityPublicKey: string): ReferrerInfo | undefined;
size(): number;
numberOfReferred(): number;
sync(): Promise<void>;
syncAll(): Promise<void>;
syncReferrer(referrerFilter: MemcmpFilter): Promise<void>;
unsubscribe(): Promise<void>;
}
//# sourceMappingURL=referrerMap.d.ts.map