/** * Anchor Program Management * * This module provides utilities for creating and managing the Anchor Program * instance used to interact with the PIT protocol. */ import { Program, AnchorProvider } from "@coral-xyz/anchor"; import { Connection, Keypair } from "@solana/web3.js"; import type { Pit } from "./idl/pit.js"; declare const IDL: Pit; /** * The typed Anchor Program instance for PIT protocol */ export type PitProgram = Program; /** * Re-export IDL for consumers who need it */ export { IDL }; export type { Pit }; /** * Create a PIT Program instance with the given AnchorProvider * * Use this when you have a wallet connected (for signing transactions). * * @param provider - AnchorProvider with wallet and connection * @returns Typed Anchor Program instance * * @example * ```typescript * import { AnchorProvider } from "@coral-xyz/anchor"; * import { createProgram } from "@pit-protocol/sdk"; * * const provider = new AnchorProvider(connection, wallet, { commitment: "confirmed" }); * const program = createProgram(provider); * * // Now use program.methods.* to build instructions * const ix = await program.methods * .trade(poolType, strikeIndex, isHit, amount, isBuy) * .accountsPartial({ ... }) * .instruction(); * ``` */ export declare function createProgram(provider: AnchorProvider): PitProgram; /** * Create a read-only PIT Program instance * * Use this when you don't need to sign transactions (e.g., fetching accounts). * This creates a dummy wallet that cannot sign. * * @param connection - Solana connection * @returns Typed Anchor Program instance (read-only) * * @example * ```typescript * import { Connection } from "@solana/web3.js"; * import { createReadOnlyProgram, getMarketAddress } from "@pit-protocol/sdk"; * * const connection = new Connection("https://api.mainnet-beta.solana.com"); * const program = createReadOnlyProgram(connection); * * // Fetch market state * const marketPda = getMarketAddress(weekNumber); * const market = await program.account.marketState.fetch(marketPda); * ``` */ export declare function createReadOnlyProgram(connection: Connection): PitProgram; /** * Create a PIT Program instance with a keypair signer * * Use this for backend services (like keeper bots) that sign with a keypair. * * @param connection - Solana connection * @param signer - Keypair for signing transactions * @returns Typed Anchor Program instance * * @example * ```typescript * import { Connection, Keypair } from "@solana/web3.js"; * import { createProgramWithKeypair } from "@pit-protocol/sdk"; * * const connection = new Connection(rpcUrl, "confirmed"); * const signer = Keypair.fromSecretKey(secretKey); * const program = createProgramWithKeypair(connection, signer); * * // Build and send transactions * const tx = await program.methods * .markExtreme(poolType, newOutcome) * .accountsPartial({ ... }) * .transaction(); * ``` */ export declare function createProgramWithKeypair(connection: Connection, signer: Keypair): PitProgram; //# sourceMappingURL=program.d.ts.map