import Decimal from "decimal.js"; import { OrderSide } from "../program/types"; export declare const PRICE_SCALE = 1000000n; export declare const I64_MAX: bigint; export declare const U32_MAX: bigint; /** Immutable engine admission rules. Quantum display strings are never arithmetic inputs. */ export interface TradingRules { baseSizeDecimals: number; maxPriceDecimals: number; maxPriceSignificantFigures: number; integerPricesAlwaysAllowed: boolean; priceQuantum: string; priceQuantumRaw: bigint; baseSizeQuantum: string; baseSizeQuantumRaw: bigint; } /** Complete rules required to build or preflight an order. */ export interface OrderbookRules { orderbookId: string; baseDecimals: number; quoteDecimals: number; priceDecimals: number; tradingRules: TradingRules; } export interface ScaledAmounts { amountIn: bigint; amountOut: bigint; priceRaw: bigint; baseAtoms: bigint; quoteAtoms: bigint; } export declare class ScalingError extends Error { readonly code?: string; constructor(message: string, code?: string); static code(code: string, detail?: string): ScalingError; } /** Parse a decimal value at an exact scale without rounding or truncation. */ export declare function exactScaledInteger(value: string | Decimal, decimals: number): bigint; export declare function scalePriceSize(price: string | Decimal, size: string | Decimal, side: OrderSide, rules: OrderbookRules): ScaledAmounts; export declare function validateRawAmounts(amountIn: bigint, amountOut: bigint, side: OrderSide, rules: OrderbookRules): ScaledAmounts; export declare function assertSignedRange(value: bigint, field: string, zeroAllowed?: boolean): void; export declare function validateSignedFields(amountIn: bigint, amountOut: bigint, salt: bigint, nonce: number): void; export declare function validateTriggerPrice(value: string | Decimal, priceDecimals: number): bigint; //# sourceMappingURL=scaling.d.ts.map