import { BorshCoder, Provider, Program } from '@coral-xyz/anchor'; import { PublicKey, AccountMeta, Connection, AddressLookupTableAccount } from '@solana/web3.js'; import BN from 'bn.js'; declare const SWITCHBOARD_ONDEMANDE_PRICE_PRECISION = 18; interface CurrentResult { value: BN; std_dev: BN; mean: BN; range: BN; min_value: BN; max_vaalue: BN; slot: BN; min_slot: BN; max_slot: BN; } interface OracleSubmission { oracle: PublicKey; slot: BN; value: BN; } interface PullFeedAccountData { submissions: OracleSubmission[]; authority: PublicKey; queue: PublicKey; feed_hash: Buffer; initialized_at: BN; permissions: BN; max_variance: BN; min_responses: number; name: Buffer; sample_size: number; last_update_timestamp: BN; lut_slot: BN; result: CurrentResult; max_staleness: number; min_sample_size: number; } type CrossbarSimulatePayload = FeedResponse[]; interface FeedResponse { feedHash: string; results: number[]; } declare const switchboardAccountCoder: BorshCoder; declare function getSwitchboardProgram(provider: Provider): Program; declare function decodeSwitchboardPullFeedData(data: Buffer): PullFeedAccountData; /** * An Exponent `CpiInterfaceContext` — one SY-program account a `trade_pt` CPI needs, * referenced by its index into the **market's address lookup table** (not an inline * pubkey). `resolveExponentTradePtContext` turns these into concrete {@link AccountMeta}s. */ interface ExponentCpiInterfaceContext { /** Index into the market's address lookup table. */ altIndex: number; isSigner: boolean; isWritable: boolean; } /** * The SY-program CPI account lists that `trade_pt` appends as remaining accounts * (order: `getSyState` ++ `depositSy` ++ `withdrawSy`). Pricing PT reads the SY rate * on-chain, so the trade must carry the flavor's SY-state/deposit/withdraw accounts. */ interface ExponentMarketTwoCpiAccounts { getSyState: ExponentCpiInterfaceContext[]; depositSy: ExponentCpiInterfaceContext[]; withdrawSy: ExponentCpiInterfaceContext[]; } /** The subset of an Exponent `MarketTwo` account that `trade_pt` needs. */ interface ExponentMarketTwo { /** The market's own address (`self_address`). */ selfAddress: PublicKey; mintPt: PublicKey; mintSy: PublicKey; vault: PublicKey; /** Market liquidity escrow for PT (`token_pt_escrow`). */ tokenPtEscrow: PublicKey; /** Market pass-through SY escrow (`token_sy_escrow`). */ tokenSyEscrow: PublicKey; /** SY account holding treasury fees from PT trading (`token_fee_treasury_sy`). */ tokenFeeTreasurySy: PublicKey; addressLookupTable: PublicKey; syProgram: PublicKey; statusFlags: number; /** SY-program CPI account lists, referenced by ALT index. */ cpiAccounts: ExponentMarketTwoCpiAccounts; } /** * Accounts required by `trade_pt`. The first 12 are the fixed `#[derive(Accounts)]` * accounts; `remainingAccounts` are the SY-program CPI accounts (already resolved from * the market ALT by {@link ResolveExponentTradePtContextParams}). */ interface ExponentTradePtAccounts { /** Trader / signer (the marginfi account authority). */ trader: PublicKey; /** The `MarketTwo` address. */ market: PublicKey; /** Trader's SY token account (source of the SY spent buying PT). */ tokenSyTrader: PublicKey; /** Trader's PT token account (destination of the bought PT). */ tokenPtTrader: PublicKey; /** `MarketTwo.token_sy_escrow`. */ tokenSyEscrow: PublicKey; /** `MarketTwo.token_pt_escrow`. */ tokenPtEscrow: PublicKey; /** `MarketTwo.address_lookup_table`. */ addressLookupTable: PublicKey; /** `MarketTwo.sy_program`. */ syProgram: PublicKey; /** `MarketTwo.token_fee_treasury_sy`. */ tokenFeeTreasurySy: PublicKey; /** SPL token program for the PT/SY mints (defaults to the classic Token program). */ tokenProgram?: PublicKey; /** * SY-program CPI accounts (`getSyState` ++ `depositSy` ++ `withdrawSy`), pubkeys * already resolved from the market ALT. Appended after the 12 fixed accounts. */ remainingAccounts: AccountMeta[]; } interface ResolveExponentTradePtContextParams { connection: Connection; /** Trader / signer (the marginfi account authority). */ owner: PublicKey; /** The successor maturity's `MarketTwo` address (where the new PT trades). */ market: PublicKey; /** Token program for the PT mint (Exponent uses the classic Token program). */ ptTokenProgram?: PublicKey; /** Token program for the SY mint. Defaults to classic Token. */ syTokenProgram?: PublicKey; } /** * Resolved inputs for a native `trade_pt` (SY → PT) on an Exponent `MarketTwo`: the * fully-resolved `trade_pt` accounts (including the ALT-derived SY-CPI remaining * accounts), the market ALT to add to the transaction's lookup tables, and the SY/PT * token info. Feed `tradePtAccounts` + `addressLookupTable` into `makeRollPtTx`. */ interface ExponentTradePtContext { marketAddress: PublicKey; market: ExponentMarketTwo; tradePtAccounts: ExponentTradePtAccounts; /** The market's address lookup table account — must be carried by the transaction. */ addressLookupTable: AddressLookupTableAccount; sy: { mint: PublicKey; decimals: number; tokenProgram: PublicKey; }; pt: { mint: PublicKey; decimals: number; tokenProgram: PublicKey; }; } /** The subset of Exponent's `Vault` account that `merge` / the roll needs. */ interface ExponentVault { /** Vault signer authority (`merge.authority`, via `has_one = authority`). */ authority: PublicKey; syProgram: PublicKey; mintSy: PublicKey; mintYt: PublicKey; mintPt: PublicKey; escrowSy: PublicKey; yieldPosition: PublicKey; addressLookupTable: PublicKey; /** * SY-program CPI account lists (referenced by ALT index). `merge` appends * `get_sy_state ++ withdraw_sy` as remaining accounts. */ cpiAccounts: ExponentMarketTwoCpiAccounts; /** * Total SY backing all PT (native u64). The PT→SY redemption rate is * `sy_for_pt / pt_supply` (Exponent's `Vault::pt_redemption_rate`). */ syForPt: bigint; /** Total PT supply (native u64). */ ptSupply: bigint; /** Last-seen SY exchange rate (underlying per SY), scaled by 1e12 → BigNumber. Sizes `strip`. */ lastSeenSyExchangeRate: BigNumber; /** All-time-high SY exchange rate, scaled by 1e12 → BigNumber. A last-seen rate below it means the vault is in emergency mode. */ allTimeHighSyExchangeRate: BigNumber; /** Final (maturity) SY exchange rate, already scaled by 1e12 → BigNumber (informational). */ finalSyExchangeRate: BigNumber; /** Raw status byte. */ status: number; /** Vault start timestamp (unix seconds); maturity = `startTs + duration`. */ startTs: number; /** Vault duration in seconds. */ duration: number; } /** * Decoded Gamma `LpVault` account (raw on-chain representation). * Pubkeys as {@link PublicKey}, u64/i64 numeric fields as {@link BN}. */ interface GammaLpVaultRaw { pubkey: PublicKey; assetsAccount: PublicKey; pendingSharesAccount: PublicKey; sharesMint: PublicKey; assetsMint: PublicKey; fundAuthority: PublicKey; nav: BN; totalShares: BN; navUpdatedAt: BN; navMaxStaleness: BN; bump: number; vaultName: string; pendingWithdrawalValue: BN; feeRecipient: PublicKey; performanceFeeBps: number; assessmentIntervalSecs: BN; lastAssessmentTimestamp: BN; pricePerShareAtLastAssessment: BN; keeperAuthority: PublicKey; } /** * Decoded Gamma `WithdrawReceipt` account — tracks a user's queued withdrawal * against a vault (pending → claimable). */ interface GammaWithdrawReceiptRaw { pubkey: PublicKey; user: PublicKey; lpVault: PublicKey; pendingShares: BN; claimableShares: BN; claimableAssets: BN; oldestPendingAt: BN; bump: number; } export { type CurrentResult as C, type ExponentVault as E, type FeedResponse as F, type GammaLpVaultRaw as G, type OracleSubmission as O, type PullFeedAccountData as P, type ResolveExponentTradePtContextParams as R, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION as S, type ExponentCpiInterfaceContext as a, type ExponentMarketTwo as b, type ExponentTradePtContext as c, type ExponentTradePtAccounts as d, type GammaWithdrawReceiptRaw as e, type CrossbarSimulatePayload as f, getSwitchboardProgram as g, decodeSwitchboardPullFeedData as h, type ExponentMarketTwoCpiAccounts as i, switchboardAccountCoder as s };