/** * Slab Account Parsing * * Parse Percolator on-chain slab accounts. * * @module solana/slab */ import { Connection, PublicKey } from "@solana/web3.js"; declare const HEADER_LEN = 136; declare const CONFIG_LEN = 400; export declare const SLAB_LEN = 1525624; export { HEADER_LEN, CONFIG_LEN }; /** * Slab header */ export interface SlabHeader { magic: bigint; version: number; bump: number; flags: number; admin: PublicKey; nonce: bigint; matCounter: bigint; insuranceAuthority: PublicKey; insuranceOperator: PublicKey; } /** * MarketConfig */ export interface MarketConfig { collateralMint: PublicKey; vaultPubkey: PublicKey; indexFeedId: PublicKey; maxStalenessSecs: bigint; confFilterBps: number; vaultAuthorityBump: number; invert: number; unitScale: number; fundingHorizonSlots: bigint; fundingKBps: bigint; fundingMaxPremiumBps: bigint; fundingMaxE9PerSlot: bigint; hyperpAuthority: PublicKey; hyperpMarkE6: bigint; lastOraclePublishTime: bigint; oraclePriceCapE2bps: bigint; lastEffectivePriceE6: bigint; minOraclePriceCapE2bps: bigint; insuranceWithdrawMaxBps: number; tvlInsuranceCapMult: number; insuranceWithdrawCooldownSlots: bigint; lastHyperpIndexSlot: bigint; lastMarkPushSlot: bigint; lastInsuranceWithdrawSlot: bigint; markEwmaE6: bigint; markEwmaLastSlot: bigint; markEwmaHalflifeSlots: bigint; initRestartSlot: bigint; permissionlessResolveStaleSlots: bigint; lastGoodOracleSlot: bigint; maintenanceFeePerSlot: bigint; feeSweepCursorWord: bigint; feeSweepCursorBit: bigint; markMinFee: bigint; forceCloseDelaySlots: bigint; newAccountFee: bigint; } export interface EngineState { vault: bigint; insuranceFundBalance: bigint; currentSlot: bigint; lastCrankSlot: bigint; lastOraclePrice: bigint; numUsedAccounts: number; } export declare function fetchSlab(connection: Connection, slabPubkey: PublicKey): Promise; export declare function parseHeader(data: Buffer): SlabHeader; export declare function parseConfig(data: Buffer): MarketConfig; export declare function parseEngine(data: Buffer): EngineState; export declare function readNonce(data: Buffer): bigint; export declare enum AccountKind { User = 0, LP = 1 } export interface Account { kind: AccountKind; capital: bigint; pnl: bigint; reservedPnl: bigint; positionBasisQ: bigint; adlABasis: bigint; adlKSnap: bigint; fSnap: bigint; adlEpochSnap: bigint; matcherProgram: PublicKey; matcherContext: PublicKey; owner: PublicKey; feeCredits: bigint; lastFeeSlot: bigint; schedPresent: number; schedRemainingQ: bigint; schedAnchorQ: bigint; schedStartSlot: bigint; schedHorizon: bigint; schedReleaseQ: bigint; pendingPresent: number; pendingRemainingQ: bigint; pendingHorizon: bigint; pendingCreatedSlot: bigint; } export declare function layoutForDataLength(dataLen: number): { maxAccounts: number; bitmapWords: number; accountsOff: number; accountSize: number; }; export declare function parseAccount(data: Buffer, idx: number): Account; export declare function parseUsedIndices(data: Buffer): number[]; export declare function parseAllAccounts(data: Buffer): { idx: number; account: Account; }[]; //# sourceMappingURL=slab.d.ts.map