import { PublicKey } from "@solana/web3.js"; import type { ScalarResolutionParams } from "./types"; /** * Convert a bigint to little-endian bytes * @param value - The value to convert * @param bytes - Number of bytes in the output */ export declare function toLeBytes(value: bigint, bytes: number): Buffer; /** * Convert little-endian bytes to bigint * @param buffer - The buffer to convert */ export declare function fromLeBytes(buffer: Buffer): bigint; /** * Convert a bigint to big-endian bytes * @param value - The value to convert * @param bytes - Number of bytes in the output */ export declare function toBeBytes(value: bigint, bytes: number): Buffer; /** * Convert big-endian bytes to bigint * @param buffer - The buffer to convert */ export declare function fromBeBytes(buffer: Buffer): bigint; /** * Convert a number to u8 buffer */ export declare function toU8(value: number): Buffer; /** * Convert a bigint to u64 little-endian buffer */ export declare function toU64Le(value: bigint): Buffer; /** * Convert a number to u32 little-endian buffer */ export declare function toU32Le(value: number): Buffer; /** * Convert a number to i16 little-endian buffer */ export declare function toI16Le(value: number): Buffer; /** * Convert a bigint to i64 little-endian buffer (signed) */ export declare function toI64Le(value: bigint): Buffer; /** * Convert a buffer to i64 (signed) */ export declare function fromI64Le(buffer: Buffer): bigint; /** * Compute keccak256 hash of data * @param data - The data to hash * @returns 32-byte hash buffer */ export declare function keccak256(data: Buffer): Buffer; /** * Derive condition ID from oracle, question ID, and number of outcomes * This matches the on-chain derivation: keccak256(oracle || questionId || numOutcomes) */ export declare function deriveConditionId(oracle: PublicKey, questionId: Buffer, numOutcomes: number): Buffer; /** * Derive Associated Token Address * @param mint - The token mint * @param owner - The owner of the ATA * @param token2022 - Deprecated. Conditional tokens now use SPL Token. */ export declare function getAssociatedTokenAddress(mint: PublicKey, owner: PublicKey, token2022?: boolean): PublicKey; /** * Get ATA for a conditional token (SPL Token) */ export declare function getConditionalTokenAta(mint: PublicKey, owner: PublicKey): PublicKey; /** * Get ATA for a deposit token (SPL Token) */ export declare function getDepositTokenAta(mint: PublicKey, owner: PublicKey): PublicKey; /** * Serialize a string with u16 length prefix (little-endian) */ export declare function serializeString(str: string): Buffer; /** * Serialize a string with u32 length prefix (little-endian), enforcing max UTF-8 bytes. */ export declare function serializeStringU32(str: string, maxBytes: number): Buffer; /** * Serialize conditional metadata instruction strings. */ export declare function serializeConditionalMetadata(name: string, symbol: string, uri: string): Buffer; /** * Deserialize a string with u16 length prefix * @returns [string, bytesConsumed] */ export declare function deserializeString(buffer: Buffer, offset: number): [string, number]; /** * Validate that a number is within the valid outcomes range */ export declare function validateOutcomes(numOutcomes: number): void; /** * Validate that an outcome index is valid for a market */ export declare function validateOutcomeIndex(outcomeIndex: number, numOutcomes: number): void; /** * Validate a maker/taker fee pair against program rules. */ export declare function validateFeePair(makerFeeBps: number, takerFeeBps: number): void; /** * Validate that a buffer is exactly 32 bytes */ export declare function validate32Bytes(buffer: Buffer, name: string): void; /** * Build a winner-takes-all payout vector for a binary or multi-outcome market. */ export declare function winnerTakesAllPayoutNumerators(winningOutcome: number, numOutcomes: number): number[]; /** * Convert a two-sided scalar resolution into program payout numerators. * * All values are integer fixed-point BigInts. The resolved value is clamped to * [minValue, maxValue], reduced by GCD, and checked against the program's u32 * payout representation. */ export declare function scalarToPayoutNumerators(params: ScalarResolutionParams): number[]; //# sourceMappingURL=utils.d.ts.map