UNPKG

aftermath-ts-sdk

Version:
237 lines 8.28 kB
import { EventOnChain } from "../../general/types/castingTypes"; import { BigIntAsString, CoinSymbol, IdAsStringBytes, IFixedAsString, IFixedAsStringBytes, ObjectId, PerpetualsMarketId, PerpetualsOrderIdAsString, SuiAddress } from "../../types"; export interface PerpetualsMarketDataIndexerResponse { pkg_id: IdAsStringBytes; initial_shared_version: BigIntAsString; object: { id: { id: IdAsStringBytes; }; version: BigIntAsString; market_params: PerpetualsMarketParamsFieldsIndexerReponse; market_state: PerpetualsMarketStateFieldsIndexerReponse; }; } export interface PerpetualsOrderbookIndexerResponse { asks: Record<PerpetualsOrderIdAsString, { account_id: BigIntAsString; size: BigIntAsString; }>; bids: Record<PerpetualsOrderIdAsString, { account_id: BigIntAsString; size: BigIntAsString; }>; asks_size: BigIntAsString; bids_size: BigIntAsString; } export interface PerpetualsMarketParamsFieldsIndexerReponse { margin_ratio_initial: IFixedAsStringBytes; margin_ratio_maintenance: IFixedAsStringBytes; base_pfs_id: IdAsStringBytes; collateral_pfs_id: IdAsStringBytes; funding_frequency_ms: BigIntAsString; funding_period_ms: BigIntAsString; premium_twap_frequency_ms: BigIntAsString; premium_twap_period_ms: BigIntAsString; spread_twap_frequency_ms: BigIntAsString; spread_twap_period_ms: BigIntAsString; maker_fee: IFixedAsStringBytes; taker_fee: IFixedAsStringBytes; liquidation_fee: IFixedAsStringBytes; force_cancel_fee: IFixedAsStringBytes; insurance_fund_fee: IFixedAsStringBytes; min_order_usd_value: IFixedAsStringBytes; lot_size: BigIntAsString; tick_size: BigIntAsString; liquidation_tolerance: BigIntAsString; max_pending_orders: BigIntAsString; oracle_tolerance: BigIntAsString; } export interface PerpetualsMarketStateFieldsIndexerReponse { cum_funding_rate_long: IFixedAsStringBytes; cum_funding_rate_short: IFixedAsStringBytes; funding_last_upd_ms: BigIntAsString; premium_twap: IFixedAsStringBytes; premium_twap_last_upd_ms: BigIntAsString; spread_twap: IFixedAsStringBytes; spread_twap_last_upd_ms: BigIntAsString; open_interest: IFixedAsStringBytes; fees_accrued: IFixedAsStringBytes; } export interface PerpetualsPositionIndexerResponse { position: { collateral: IFixedAsStringBytes; base_asset_amount: IFixedAsStringBytes; quote_asset_notional_amount: IFixedAsStringBytes; cum_funding_rate_long: IFixedAsStringBytes; cum_funding_rate_short: IFixedAsStringBytes; asks_quantity: IFixedAsStringBytes; bids_quantity: IFixedAsStringBytes; pending_orders: BigIntAsString; maker_fee: IFixedAsStringBytes; taker_fee: IFixedAsStringBytes; }; pending_orders: { bids: Record<string, // PerpetualsOrderId BigIntAsString>; asks: Record<string, // PerpetualsOrderId BigIntAsString>; }; } export type PerpetualsAccountPositionsIndexerResponse = [ IdAsStringBytes, PerpetualsPositionIndexerResponse, IFixedAsStringBytes ][]; export type PerpetualsPreviewOrderIndexerResponse = { position: PerpetualsPositionIndexerResponse; price_slippage: IFixedAsStringBytes; percent_slippage: IFixedAsStringBytes; execution_price: IFixedAsStringBytes; size_filled: IFixedAsStringBytes; collateral_change: IFixedAsStringBytes; position_found: boolean; size_posted?: IFixedAsStringBytes; } | { error: string; }; export type PerpetualsPreviewCancelOrdersIndexerResponse = { position: PerpetualsPositionIndexerResponse; collateral_change: IFixedAsStringBytes; } | { error: string; }; export type PerpetualsPreviewReduceOrdersIndexerResponse = { position: PerpetualsPositionIndexerResponse; collateral_change: IFixedAsStringBytes; } | { error: string; }; export type PerpetualsMarketsIndexerResponse = Record<PerpetualsMarketId, [ PerpetualsMarketDataIndexerResponse, CoinSymbol ]>; export type PerpetualsMarketIndexerResponse = { ch: [PerpetualsMarketDataIndexerResponse, CoinSymbol]; orderbook: PerpetualsOrderbookIndexerResponse; }; export type UpdatedMarketVersionEventOnChain = EventOnChain<{ ch_id: ObjectId; version: BigIntAsString; }>; export type WithdrewCollateralEventOnChain = EventOnChain<{ account_id: BigIntAsString; collateral: BigIntAsString; }>; export type DepositedCollateralEventOnChain = EventOnChain<{ account_id: BigIntAsString; collateral: BigIntAsString; }>; export type AllocatedCollateralEventOnChain = EventOnChain<{ ch_id: ObjectId; account_id: BigIntAsString; collateral: BigIntAsString; position_collateral_after: IFixedAsString; }>; export type DeallocatedCollateralEventOnChain = EventOnChain<{ ch_id: ObjectId; account_id: BigIntAsString; collateral: BigIntAsString; position_collateral_after: IFixedAsString; }>; export type SettledFundingEventOnChain = EventOnChain<{ ch_id: ObjectId; account_id: BigIntAsString; collateral_change_usd: IFixedAsString; mkt_funding_rate_long: IFixedAsString; mkt_funding_rate_short: IFixedAsString; }>; export type LiquidatedEventOnChain = EventOnChain<{ ch_id: ObjectId; liqee_account_id: BigIntAsString; liqor_account_id: BigIntAsString; is_liqee_long: boolean; size_liquidated: BigIntAsString; mark_price: IFixedAsString; liqee_collateral_change_usd: IFixedAsString; liqee_base_amount: IFixedAsString; liqee_quote_amount: IFixedAsString; bad_debt: IFixedAsString; }>; export type CreatedAccountEventOnChain = EventOnChain<{ user: SuiAddress; account_id: BigIntAsString; }>; export type CanceledOrderEventOnChain = EventOnChain<{ ch_id: ObjectId; account_id: BigIntAsString; size: BigIntAsString; order_id: BigIntAsString; }>; export type PostedOrderEventOnChain = EventOnChain<{ ch_id: ObjectId; account_id: BigIntAsString; posted_base_ask: BigIntAsString; posted_base_bid: BigIntAsString; pending_asks: IFixedAsString; pending_bids: IFixedAsString; }>; export type FilledMakerOrderEventOnChain = EventOnChain<{ ch_id: ObjectId; maker_account_id: BigIntAsString; collateral_change_usd: IFixedAsString; maker_base_amount: IFixedAsString; maker_collateral: IFixedAsString; maker_final_size: BigIntAsString; maker_pending_asks_quantity: IFixedAsString; maker_pending_bids_quantity: IFixedAsString; maker_quote_amount: IFixedAsString; maker_size: BigIntAsString; order_id: BigIntAsString; }>; export type FilledTakerOrderEventOnChain = EventOnChain<{ ch_id: ObjectId; taker_account_id: BigIntAsString; taker_collateral: IFixedAsString; collateral_change_usd: IFixedAsString; base_asset_delta_ask: IFixedAsString; quote_asset_delta_ask: IFixedAsString; base_asset_delta_bid: IFixedAsString; quote_asset_delta_bid: IFixedAsString; taker_base_amount: IFixedAsString; taker_quote_amount: IFixedAsString; liquidated_volume: IFixedAsString; }>; export type PostedOrderReceiptEventOnChain = EventOnChain<{ ch_id: ObjectId; account_id: BigIntAsString; order_id: BigIntAsString; order_size: BigIntAsString; }>; export type ReducedOrderEventOnChain = EventOnChain<{ ch_id: ObjectId; account_id: BigIntAsString; size_change: BigIntAsString; order_id: BigIntAsString; }>; export type UpdatedPremiumTwapEventOnChain = EventOnChain<{ ch_id: ObjectId; index_price: IFixedAsString; book_price: IFixedAsString; premium_twap: IFixedAsString; premium_twap_last_upd_ms: BigIntAsString; }>; export type UpdatedSpreadTwapEventOnChain = EventOnChain<{ ch_id: ObjectId; book_price: IFixedAsString; index_price: IFixedAsString; spread_twap: IFixedAsString; spread_twap_last_upd_ms: BigIntAsString; }>; export type UpdatedFundingEventOnChain = EventOnChain<{ ch_id: ObjectId; cum_funding_rate_long: IFixedAsString; cum_funding_rate_short: IFixedAsString; funding_last_upd_ms: BigIntAsString; }>; //# sourceMappingURL=perpetualsCastingTypes.d.ts.map