@drift-labs/sdk
Version:
SDK for Drift Protocol
28 lines • 1.34 kB
TypeScript
import { PublicKey, type AccountMeta } from '@solana/web3.js';
import type { UserAccount, SpotMarketAccount, PerpMarketAccount } from '../types';
export type RemainingAccountParams = {
userAccounts: UserAccount[];
writablePerpMarketIndexes?: number[];
writableSpotMarketIndexes?: number[];
readablePerpMarketIndex?: number | number[];
readableSpotMarketIndexes?: number[];
useMarketLastSlotCache?: boolean;
};
export type RemainingAccountsContext = {
/** Used to resolve market accounts. */
getPerpMarketAccount: (marketIndex: number) => PerpMarketAccount;
getSpotMarketAccount: (marketIndex: number) => SpotMarketAccount;
/** Used to resolve user's last slot for cache invalidation. */
getUserAccountAndSlot: (subAccountId: number, authority: PublicKey) => {
slot: number;
} | undefined;
activeSubAccountId: number;
authority: PublicKey;
/** Mutable caches + forced-market sets (owned by caller). */
perpMarketLastSlotCache: Map<number, number>;
spotMarketLastSlotCache: Map<number, number>;
mustIncludePerpMarketIndexes: Set<number>;
mustIncludeSpotMarketIndexes: Set<number>;
};
export declare function getRemainingAccounts(ctx: RemainingAccountsContext, params: RemainingAccountParams): AccountMeta[];
//# sourceMappingURL=remainingAccounts.d.ts.map