import { HealthStatus } from '@vertex-protocol/contracts'; import { EngineServerProductType, EngineServerSpotProduct, EngineServerPerpProduct, EngineServerSpotBalance, EngineServerPerpBalance, EngineServerHealthBreakdown } from './serverQueryModelTypes.cjs'; interface EngineServerNoncesParams { address: string; } interface EngineServerSubaccountInfoQueryParams { subaccount: string; txns?: Array<{ mint_lp: { product_id: number; subaccount: string; amount_base: string; quote_amount_low: string; quote_amount_high: string; }; } | { burn_lp: { product_id: number; subaccount: string; amount_lp: string; }; } | { apply_delta: { product_id: number; subaccount: string; amount_delta: string; v_quote_delta: string; }; }>; } interface EngineServerIsolatedPositionsQueryParams { subaccount: string; } interface EngineServerSymbolsQueryParams { product_type?: EngineServerProductType; product_ids?: number[]; } interface EngineServerMarketPriceQueryParams { product_id: number; } interface EngineServerMarketPricesQueryParams { product_ids: number[]; } interface EngineServerGetOrderQueryParams { product_id: number; digest: string; } interface EngineServerValidateOrderQueryParams { product_id: number; order: string; } interface EngineServerOrdersQueryParams { sender: string; product_ids: number[]; } interface EngineServerSubaccountOrdersQueryParams { sender: string; product_id: number; } interface EngineServerSubaccountFeeRatesParams { sender: string; } interface EngineServerMarketLiquidityQueryParams { product_id: number; depth: number; } interface EngineServerMaxWithdrawableQueryParams { sender: string; product_id: number; spot_leverage: string | null; } interface EngineServerMaxOrderSizeQueryParams { sender: string; product_id: number; price_x18: string; direction: 'long' | 'short'; spot_leverage: string | null; reduce_only: string | null; } interface EngineServerMaxMintLpQueryParams { sender: string; product_id: number; spot_leverage: string | null; } interface EngineServerLinkedSignerParams { subaccount: string; } interface EngineServerMaxMintVlpQueryParams { sender: string; spot_leverage: string | null; } interface EngineServerQueryRequestByType { all_products: Record; contracts: Record; edge_all_products: Record; fee_rates: EngineServerSubaccountFeeRatesParams; health_groups: Record; insurance: Record; isolated_positions: EngineServerIsolatedPositionsQueryParams; linked_signer: EngineServerLinkedSignerParams; market_liquidity: EngineServerMarketLiquidityQueryParams; market_price: EngineServerMarketPriceQueryParams; market_prices: EngineServerMarketPricesQueryParams; max_lp_mintable: EngineServerMaxMintLpQueryParams; max_vlp_mintable: EngineServerMaxMintVlpQueryParams; max_order_size: EngineServerMaxOrderSizeQueryParams; max_withdrawable: EngineServerMaxWithdrawableQueryParams; min_deposit_rates: Record; nonces: EngineServerNoncesParams; order: EngineServerGetOrderQueryParams; orders: EngineServerOrdersQueryParams; status: Record; subaccount_info: Omit & { txns?: string; }; subaccount_orders: EngineServerSubaccountOrdersQueryParams; symbols: EngineServerSymbolsQueryParams; validate_order: EngineServerValidateOrderQueryParams; } type EngineServerQueryRequestType = keyof EngineServerQueryRequestByType; type EngineServerQueryRequest = { type: TRequestType; } & EngineServerQueryRequestByType[TRequestType]; interface EngineServerContractsResponse { chain_id: string; endpoint_addr: string; book_addrs: string[]; } type EngineServerStatusResponse = 'started' | 'active' | 'stopping' | 'syncing' | 'live_syncing' | 'failed'; interface EngineServerNoncesResponse { order_nonce: string; tx_nonce: string; } interface EngineServerSubaccountInfoResponse { exists: boolean; subaccount: string; healths: [ initial: EngineServerHealthBreakdown, maintenance: EngineServerHealthBreakdown, unweighted: EngineServerHealthBreakdown ]; health_contributions: string[][]; spot_count: number; perp_count: number; spot_balances: EngineServerSpotBalance[]; perp_balances: EngineServerPerpBalance[]; spot_products: EngineServerSpotProduct[]; perp_products: EngineServerPerpProduct[]; } interface EngineServerIsolatedPosition { subaccount: string; healths: [ initial: HealthStatus, maintenance: HealthStatus, unweighted: HealthStatus ]; quote_healths: [initial: string, maintenance: string, unweighted: string]; base_healths: [initial: string, maintenance: string, unweighted: string]; quote_balance: EngineServerSpotBalance; base_balance: EngineServerPerpBalance; quote_product: EngineServerSpotProduct; base_product: EngineServerPerpProduct; } type EngineServerIsolatedPositionsResponse = { isolated_positions: EngineServerIsolatedPosition[]; }; interface EngineServerSymbol { type: EngineServerProductType; product_id: number; symbol: string; price_increment_x18: string; size_increment: string; min_size: string; min_depth_x18: string; max_spread_rate_x18: string; maker_fee_rate_x18: string; taker_fee_rate_x18: string; long_weight_initial_x18: string; long_weight_maintenance_x18: string; } interface EngineServerSymbolsResponse { symbols: Record; } interface EngineServerAllProductsResponse { spot_products: EngineServerSpotProduct[]; perp_products: EngineServerPerpProduct[]; } interface EngineServerHealthGroupsResponse { health_groups: [spotProductId: number, perpProductId: number][]; } type EngineServerPriceTickLiquidity = [ priceX18: string, liquidity: string ]; interface EngineServerMarketLiquidityResponse { bids: EngineServerPriceTickLiquidity[]; asks: EngineServerPriceTickLiquidity[]; } interface EngineServerSubaccountOrders { sender: string; product_id: number; orders: EngineServerOrder[]; } type EngineServerSubaccountOrdersResponse = EngineServerSubaccountOrders; interface EngineServerProductOrdersResponse { sender: string; product_orders: EngineServerSubaccountOrders[]; } interface EngineServerFeeRatesResponse { liquidation_sequencer_fee: string; health_check_sequencer_fee: string; taker_sequencer_fee: string; withdraw_sequencer_fees: string[]; taker_fee_rates_x18: string[]; maker_fee_rates_x18: string[]; } interface EngineServerMarketPrice { product_id: number; bid_x18: string; ask_x18: string; } type EngineServerMarketPriceResponse = EngineServerMarketPrice; interface EngineServerMarketPricesResponse { market_prices: EngineServerMarketPrice[]; } interface EngineServerOrder { product_id: number; sender: string; price_x18: string; amount: string; expiration: string; nonce: string; unfilled_amount: string; digest: string; placed_at: number; order_type: string; margin: string | null; } type EngineServerOrderResponse = EngineServerOrder; interface EngineServerValidateOrderResponse { product_id: number; order: string; valid: boolean; } interface EngineServerMaxOrderSizeResponse { max_order_size: string; } interface EngineServerMaxWithdrawableResponse { max_withdrawable: string; } type EngineServerTimeResponse = number; interface EngineServerMaxMintLpResponse { max_base_amount: string; max_quote_amount: string; } interface EngineServerIpBlockResponse { blocked: boolean; reason: string; } interface EngineServerLinkedSignerResponse { linked_signer: string; } interface EngineInsuranceResponse { insurance: string; } interface EngineServerMinDepositRate { product_id: number; min_deposit_rate_x18: string; } interface EngineServerMinDepositRatesResponse { min_deposit_rates: Record; } interface EngineServerEdgeAllProductsResponse { edge_all_products: Record; } interface EngineServerMaxMintVlpResponse { max_quote_amount: string; } interface EngineServerQueryResponseByType { all_products: EngineServerAllProductsResponse; contracts: EngineServerContractsResponse; edge_all_products: EngineServerEdgeAllProductsResponse; fee_rates: EngineServerFeeRatesResponse; health_groups: EngineServerHealthGroupsResponse; insurance: EngineInsuranceResponse; isolated_positions: EngineServerIsolatedPositionsResponse; linked_signer: EngineServerLinkedSignerResponse; market_liquidity: EngineServerMarketLiquidityResponse; market_price: EngineServerMarketPriceResponse; market_prices: EngineServerMarketPricesResponse; max_lp_mintable: EngineServerMaxMintLpResponse; max_vlp_mintable: EngineServerMaxMintVlpResponse; max_order_size: EngineServerMaxOrderSizeResponse; max_withdrawable: EngineServerMaxWithdrawableResponse; min_deposit_rates: EngineServerMinDepositRatesResponse; nonces: EngineServerNoncesResponse; order: EngineServerOrderResponse; orders: EngineServerProductOrdersResponse; status: EngineServerStatusResponse; subaccount_info: EngineServerSubaccountInfoResponse; subaccount_orders: EngineServerSubaccountOrdersResponse; symbols: EngineServerSymbolsResponse; validate_order: EngineServerValidateOrderResponse; } interface EngineServerQuerySuccessResponse { status: 'success'; data: EngineServerQueryResponseByType[TQueryType]; } interface EngineServerQueryFailureResponse { status: 'failure'; error: string; error_code: number; } type EngineServerQueryResponse = EngineServerQuerySuccessResponse | EngineServerQueryFailureResponse; export type { EngineInsuranceResponse, EngineServerAllProductsResponse, EngineServerContractsResponse, EngineServerEdgeAllProductsResponse, EngineServerFeeRatesResponse, EngineServerGetOrderQueryParams, EngineServerHealthGroupsResponse, EngineServerIpBlockResponse, EngineServerIsolatedPosition, EngineServerIsolatedPositionsQueryParams, EngineServerIsolatedPositionsResponse, EngineServerLinkedSignerParams, EngineServerLinkedSignerResponse, EngineServerMarketLiquidityQueryParams, EngineServerMarketLiquidityResponse, EngineServerMarketPrice, EngineServerMarketPriceQueryParams, EngineServerMarketPriceResponse, EngineServerMarketPricesQueryParams, EngineServerMarketPricesResponse, EngineServerMaxMintLpQueryParams, EngineServerMaxMintLpResponse, EngineServerMaxMintVlpQueryParams, EngineServerMaxMintVlpResponse, EngineServerMaxOrderSizeQueryParams, EngineServerMaxOrderSizeResponse, EngineServerMaxWithdrawableQueryParams, EngineServerMaxWithdrawableResponse, EngineServerMinDepositRate, EngineServerMinDepositRatesResponse, EngineServerNoncesParams, EngineServerNoncesResponse, EngineServerOrder, EngineServerOrderResponse, EngineServerOrdersQueryParams, EngineServerPriceTickLiquidity, EngineServerProductOrdersResponse, EngineServerQueryFailureResponse, EngineServerQueryRequest, EngineServerQueryRequestByType, EngineServerQueryRequestType, EngineServerQueryResponse, EngineServerQueryResponseByType, EngineServerQuerySuccessResponse, EngineServerStatusResponse, EngineServerSubaccountFeeRatesParams, EngineServerSubaccountInfoQueryParams, EngineServerSubaccountInfoResponse, EngineServerSubaccountOrders, EngineServerSubaccountOrdersQueryParams, EngineServerSubaccountOrdersResponse, EngineServerSymbol, EngineServerSymbolsQueryParams, EngineServerSymbolsResponse, EngineServerTimeResponse, EngineServerValidateOrderQueryParams, EngineServerValidateOrderResponse };