@reyaxyz/common 0.261.1 → 0.262.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/trading-api-types.js.map +1 -1
- package/dist/types/trading-api-types.d.ts +320 -360
- package/dist/types/trading-api-types.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -3
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/src/trading-api-types.ts +414 -341
- package/src/types.ts +5 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trading-api-types.js","sourceRoot":"/","sources":["trading-api-types.ts"],"names":[],"mappings":";;;AAwBa,QAAA,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;CACjB,CAAC","sourcesContent":["import { ParamsDictionary, Query } from 'express-serve-static-core';\ntype Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';\ntype OnlyDigits<T extends string> = T extends `${Digit}${infer Rest}`\n ? Rest extends ''\n ? T\n : OnlyDigits<Rest>\n : never;\n\nexport type PaginatedQueryParams = {\n before: OnlyDigits<string>;\n after: OnlyDigits<string>;\n limit: OnlyDigits<string>;\n direction: 'asc' | 'desc';\n};\n\nexport type PaginatedQueryMeta = {\n limit: number;\n count: number;\n before: bigint | null | undefined;\n after: bigint | null | undefined;\n};\n\nexport type Decimal = 'fake-decimal';\n\nexport const AccountStatusValues = {\n OPEN: 'OPEN',\n CLOSED: 'CLOSED',\n};\n\nexport type AccountStatus =\n (typeof AccountStatusValues)[keyof typeof AccountStatusValues];\n\ntype Order = {\n id: string;\n market_id: Decimal | null;\n account_id: Decimal | null;\n order_base: Decimal | null;\n fee: Decimal | null;\n price: Decimal | null;\n type: string;\n processed: boolean;\n transaction_hash: string;\n r_pnl: Decimal | null;\n price_variation_pnl: Decimal | null;\n funding_pnl: Decimal | null;\n average_entry_price: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n source: string | null;\n unique_id: bigint | null;\n created_at: Date;\n};\n\nexport type TradingApiSource = {\n PoolBalance: {\n params: {\n poolId?: string;\n };\n query: never;\n response: {\n id: number;\n timestamp: bigint;\n pool_id: number;\n value: Decimal;\n apy: Decimal;\n share_price: Decimal;\n share_price_index: Decimal;\n } | null;\n };\n Leverages: {\n params: {\n address: string;\n };\n query: never;\n response: {\n accountId: Decimal;\n marketId: Decimal;\n leverage: number;\n createdAt: Date;\n updatedAt: Date;\n }[];\n };\n MarketsConfiguration: {\n params: never;\n query: never;\n response: {\n market_id: Decimal;\n risk_matrix_index: Decimal | null;\n max_open_base: Decimal | null;\n velocity_multiplier: Decimal | null;\n minimum_order_base: Decimal | null;\n base_spacing: Decimal | null;\n price_spacing: Decimal | null;\n oracle_node_id: string | null;\n mtm_window: Decimal | null;\n dutch_config_lambda: Decimal | null;\n dutch_config_min_base: Decimal | null;\n slippage_params_phi: Decimal | null;\n slippage_params_beta: Decimal | null;\n depth_factor: Decimal | null;\n max_exposure_factor: Decimal | null;\n max_p_slippage: Decimal | null;\n price_spread: Decimal | null;\n volatility_index_multiplier: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }[];\n };\n MarketsStorage: {\n params: never;\n query: never;\n response: {\n market_id: Decimal;\n quote_collateral: string | null;\n instrument_address: string | null;\n name: string | null;\n risk_block_id: Decimal | null;\n collateral_pool_id: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }[];\n };\n MarketsTracker: {\n params: never;\n query: never;\n response: {\n market_data_id: Decimal;\n passive_pool_id: Decimal | null;\n pool_account_id: Decimal | null;\n quote_token: string | null;\n quote_token_decimals: Decimal | null;\n last_funding_velocity: Decimal | null;\n last_funding_timestamp: Decimal | null;\n last_mtm_price: Decimal | null;\n last_mtm_timestamp: Decimal | null;\n long_trackers_funding_value: Decimal | null;\n last_funding_rate: Decimal | null;\n long_trackers_base_multiplier: Decimal | null;\n long_trackers_adl_unwind_price: Decimal | null;\n short_trackers_funding_value: Decimal | null;\n short_trackers_base_multiplier: Decimal | null;\n short_trackers_adl_unwind_price: Decimal | null;\n open_interest: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }[];\n };\n Positions: {\n params: {\n address: string;\n };\n query: never;\n response: {\n market_id: Decimal;\n account_id: Decimal;\n base: Decimal | null;\n realized_pnl: Decimal | null;\n realized_pnl_latest_snapshot: Decimal | null;\n average_entry_price_off_chain_tracker: Decimal | null;\n funding_value_off_chain_tracker: Decimal | null;\n last_price: Decimal | null;\n position_data_last_price_data_timestamp: Decimal | null;\n funding_value: Decimal | null;\n base_multiplier: Decimal | null;\n adl_unwind_price: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }[];\n };\n ConditionalOrders: {\n params: {\n address: string;\n };\n query: never;\n response: {\n id: string;\n account_id: Decimal;\n market_id: Decimal;\n order_type: string;\n is_long: boolean;\n trigger_price: number;\n order_base: Decimal;\n exchange_id: bigint;\n inputs: string;\n counterparty_account_id: bigint;\n reya_chain_id: bigint;\n deadline: bigint;\n signer_address: string;\n nonce: Decimal;\n signature: string;\n status: string;\n creation_timestamp_ms: bigint;\n last_update_timestamp_ms: bigint;\n transaction_hash: string | null;\n }[];\n };\n Assets: {\n params: never;\n query: never;\n response: {\n address: string;\n name: string;\n short: string;\n createdAt: Date;\n updatedAt: Date;\n asset_price_contract_id: string | null;\n asset_price_usdc_contract_id: string | null;\n decimals: number;\n }[];\n };\n Prices: {\n params: never;\n query: never;\n response: {\n block_number: Decimal;\n unique_id: bigint | null;\n contract_id: string;\n price: Decimal | null;\n round_id: Decimal | null;\n timestamp: Decimal;\n }[];\n };\n Accounts: {\n params: {\n address: string;\n };\n query: never;\n response: {\n account_id: Decimal;\n name: string;\n status: AccountStatus;\n updated_timestamp_ms: Decimal;\n source: string | null;\n }[];\n };\n AccountsBalances: {\n params: {\n address: string;\n };\n query: never;\n response: {\n account_id: number;\n collateral: string;\n balance: string;\n }[];\n };\n AutoExchange: {\n params: {\n address: string;\n };\n query: PaginatedQueryParams;\n response: {\n data: {\n id: string;\n liquidated_account_id: Decimal | null;\n liquidator_account_id: Decimal | null;\n requested_quote_amount: Decimal | null;\n collateral_out_address: string | null;\n collateral_in_address: string | null;\n collateral_amount_to_liquidator: Decimal | null;\n quote_amount_to_insurance_fund: Decimal | null;\n quote_amount_to_account: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n transaction_hash: string;\n unique_id: bigint | null;\n }[];\n meta: PaginatedQueryMeta;\n };\n };\n Swaps: {\n params: {\n address: string;\n };\n query: PaginatedQueryParams;\n response: {\n data: {\n id: string;\n account_id: Decimal;\n token_in: string;\n token_out: string;\n amount_in: Decimal;\n amount_out: Decimal;\n executed_amount_out: Decimal;\n transaction_hash: string;\n block_timestamp: Decimal;\n block_number: Decimal;\n unique_id: bigint | null;\n }[];\n meta: PaginatedQueryMeta;\n };\n };\n MarketOrders: {\n params: {\n marketId: string;\n type?: string;\n };\n query: PaginatedQueryParams;\n response: {\n data: Order[];\n meta: PaginatedQueryMeta;\n };\n };\n AccountOrders: {\n params: {\n accountId: string;\n type?: string;\n };\n query: PaginatedQueryParams;\n response: {\n data: Order[];\n meta: PaginatedQueryMeta;\n };\n };\n WalletBalanceHistory: {\n params: {\n address: string;\n timestamp?: string;\n };\n query: never;\n response: {\n timestamp: number;\n balance: number;\n }[];\n };\n WalletOrders: {\n params: {\n address: string;\n type?: string;\n };\n query: PaginatedQueryParams;\n response: {\n data: Order[];\n meta: PaginatedQueryMeta;\n };\n };\n RiskMatrices: {\n params: {\n poolId: string;\n };\n query: never;\n response: {\n blockId: Decimal;\n matrix: string[][];\n }[];\n };\n Markets: {\n params: never;\n query: never;\n response: {\n id: Decimal;\n ticker: string;\n markPrice: number;\n isActive: boolean;\n maxLeverage: number;\n volume24H: number;\n priceChange24H: number;\n longOI: number;\n shortOI: number;\n availableLong: number;\n availableShort: number;\n marketPriceDeviation: number;\n riskBlockId: number;\n rootCollateralPoolId: number;\n description: string;\n name: string;\n quoteTokenId: string;\n tickSizeDecimals: number;\n underlyingAssetId: string;\n priceChange24HPercentage: number;\n openInterest: number;\n fundingRate: number;\n priority: number;\n }[];\n };\n TierFees: {\n params: never;\n query: never;\n response: {\n market_id: Decimal;\n tier_id: Decimal;\n fee_parameter: Decimal | null;\n }[];\n };\n AccountsTiers: {\n params: {\n address: string;\n };\n query: never;\n response: {\n market_id: Decimal;\n account_id: Decimal;\n tier_id: Decimal;\n }[];\n };\n CollateralConfiguration: {\n params: never;\n query: never;\n response: {\n collateral_pool_id: Decimal;\n collateral_address: string;\n price_haircut: Decimal | null;\n auto_exchange_discount: Decimal | null;\n oracle_node_id: string | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }[];\n };\n};\n\nexport type Stringified<T, D = Decimal> = T extends D | bigint | Date\n ? string\n : T extends (infer U)[]\n ? Stringified<U, D>[]\n : { [K in keyof T]: Stringified<T[K], D> };\n\nexport type Req<P = ParamsDictionary, ReqQuery = Query> = {\n params: P;\n query: ReqQuery;\n};\n\n/*\n\nSame as infered type \n\nexport type TradingApi = {\n [K in keyof typeof TradingQueries as K extends `get${infer R}` ? R : K]: {\n params: Parameters<ReturnType<(typeof TradingQueries)[K]>>[0] extends Req\n ? Parameters<ReturnType<(typeof TradingQueries)[K]>>[0]['params']\n : never;\n query: Parameters<ReturnType<(typeof TradingQueries)[K]>>[0] extends Req\n ? Parameters<ReturnType<(typeof TradingQueries)[K]>>[0]['query']\n : never;\n response: Stringified<\n Awaited<ReturnType<ReturnType<(typeof TradingQueries)[K]>>>\n >;\n\n*/\n\nexport type TradingApi = {\n [K in keyof TradingApiSource as K]: {\n params: TradingApiSource[K]['params'];\n query: TradingApiSource[K]['query'];\n response: Stringified<TradingApiSource[K]['response']>;\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"trading-api-types.js","sourceRoot":"/","sources":["trading-api-types.ts"],"names":[],"mappings":";;;AAwBa,QAAA,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;CACjB,CAAC","sourcesContent":["import { ParamsDictionary, Query } from 'express-serve-static-core';\ntype Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';\ntype OnlyDigits<T extends string> = T extends `${Digit}${infer Rest}`\n ? Rest extends ''\n ? T\n : OnlyDigits<Rest>\n : never;\n\nexport type PaginatedQueryParams = {\n before: OnlyDigits<string>;\n after: OnlyDigits<string>;\n limit: OnlyDigits<string>;\n direction: 'asc' | 'desc';\n};\n\nexport type PaginatedQueryMeta = {\n limit: number;\n count: number;\n before: bigint | null | undefined;\n after: bigint | null | undefined;\n};\n\nexport type Decimal = 'fake-decimal';\n\nexport const AccountStatusValues = {\n OPEN: 'OPEN',\n CLOSED: 'CLOSED',\n};\n\nexport type AccountStatus =\n (typeof AccountStatusValues)[keyof typeof AccountStatusValues];\n\ntype Order = {\n id: string;\n market_id: Decimal | null;\n account_id: Decimal | null;\n order_base: Decimal | null;\n fee: Decimal | null;\n price: Decimal | null;\n type: string;\n processed: boolean;\n transaction_hash: string;\n r_pnl: Decimal | null;\n price_variation_pnl: Decimal | null;\n funding_pnl: Decimal | null;\n average_entry_price: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n source: string | null;\n unique_id: bigint | null;\n created_at: Date;\n};\n\ntype Position = {\n market_id: Decimal;\n account_id: Decimal;\n base: Decimal | null;\n realized_pnl: Decimal | null;\n realized_pnl_latest_snapshot: Decimal | null;\n average_entry_price_off_chain_tracker: Decimal | null;\n funding_value_off_chain_tracker: Decimal | null;\n last_price: Decimal | null;\n position_data_last_price_data_timestamp: Decimal | null;\n funding_value: Decimal | null;\n base_multiplier: Decimal | null;\n adl_unwind_price: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\ntype ConditionalOrder = {\n id: string;\n account_id: Decimal;\n market_id: Decimal;\n order_type: string;\n is_long: boolean;\n trigger_price: number;\n order_base: Decimal;\n exchange_id: bigint;\n inputs: string;\n counterparty_account_id: bigint;\n reya_chain_id: bigint;\n deadline: bigint;\n signer_address: string;\n nonce: Decimal;\n signature: string;\n status: string;\n creation_timestamp_ms: bigint;\n last_update_timestamp_ms: bigint;\n transaction_hash: string | null;\n};\n\ntype Swap = {\n id: string;\n account_id: Decimal;\n token_in: string;\n token_out: string;\n amount_in: Decimal;\n amount_out: Decimal;\n executed_amount_out: Decimal;\n transaction_hash: string;\n block_timestamp: Decimal;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\ntype Market = {\n id: Decimal;\n ticker: string;\n markPrice: number;\n isActive: boolean;\n maxLeverage: number;\n volume24H: number;\n priceChange24H: number;\n longOI: number;\n shortOI: number;\n availableLong: number;\n availableShort: number;\n marketPriceDeviation: number;\n riskBlockId: number;\n rootCollateralPoolId: number;\n description: string;\n name: string;\n quoteTokenId: string;\n tickSizeDecimals: number;\n underlyingAssetId: string;\n priceChange24HPercentage: number;\n openInterest: number;\n fundingRate: number;\n priority: number;\n};\n\ntype Account = {\n account_id: Decimal;\n name: string;\n status: AccountStatus;\n updated_timestamp_ms: Decimal;\n source: string | null;\n};\n\ntype Price = {\n block_number: Decimal;\n unique_id: bigint | null;\n contract_id: string;\n price: Decimal | null;\n round_id: Decimal | null;\n timestamp: Decimal;\n};\n\ntype AccountBalance = {\n account_id: number | null;\n collateral: string | null;\n balance?: string | null;\n delta?: string | null;\n};\n\ntype AutoExchange = {\n id: string;\n liquidated_account_id: Decimal | null;\n liquidator_account_id: Decimal | null;\n requested_quote_amount: Decimal | null;\n collateral_out_address: string | null;\n collateral_in_address: string | null;\n collateral_amount_to_liquidator: Decimal | null;\n quote_amount_to_insurance_fund: Decimal | null;\n quote_amount_to_account: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n transaction_hash: string;\n unique_id: bigint | null;\n};\n\ntype Leverage = {\n accountId: Decimal;\n marketId: Decimal;\n leverage: number;\n createdAt: Date;\n updatedAt: Date;\n};\n\nexport type TradingApiEndpoint<\n Response,\n Params,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = never,\n> = {\n params: Params;\n query: Query;\n response: Response;\n replication: GenericReplicationMessage<Replication, ReplicationTable>;\n};\n\nexport type TradingApiListEndpoint<\n Response,\n Params = never,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = never,\n> = {\n params: Params;\n query: Query;\n response: Response[];\n replication: GenericReplicationMessage<Replication, ReplicationTable>;\n};\n\nexport type TradingApiInfiniteListEndpointResponse<Response> = {\n data: Response[];\n meta: PaginatedQueryMeta;\n};\n\nexport type TradingApiInfiniteListEndpoint<\n Response,\n Params = never,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = PaginatedQueryParams,\n> = {\n params: Params;\n query: Query;\n response: TradingApiInfiniteListEndpointResponse<Response>;\n replication: GenericReplicationMessage<Replication, ReplicationTable>;\n};\n\ntype AddressParam = {\n address: string;\n};\n\nexport type TradingApiSource = {\n 'poolBalance/:poolId?': TradingApiEndpoint<\n {\n id: number;\n timestamp: bigint;\n pool_id: number;\n value: Decimal;\n apy: Decimal;\n share_price: Decimal;\n share_price_index: Decimal;\n } | null,\n {\n poolId?: string;\n }\n >;\n 'wallet/:address/leverages': TradingApiListEndpoint<\n Leverage,\n { address: string },\n 'accountLeveragePerMarket'\n >;\n 'markets/configuration': TradingApiListEndpoint<{\n market_id: Decimal;\n risk_matrix_index: Decimal | null;\n max_open_base: Decimal | null;\n velocity_multiplier: Decimal | null;\n minimum_order_base: Decimal | null;\n base_spacing: Decimal | null;\n price_spacing: Decimal | null;\n oracle_node_id: string | null;\n mtm_window: Decimal | null;\n dutch_config_lambda: Decimal | null;\n dutch_config_min_base: Decimal | null;\n slippage_params_phi: Decimal | null;\n slippage_params_beta: Decimal | null;\n depth_factor: Decimal | null;\n max_exposure_factor: Decimal | null;\n max_p_slippage: Decimal | null;\n price_spread: Decimal | null;\n volatility_index_multiplier: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n 'markets/storage': TradingApiListEndpoint<{\n market_id: Decimal;\n quote_collateral: string | null;\n instrument_address: string | null;\n name: string | null;\n risk_block_id: Decimal | null;\n collateral_pool_id: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n 'markets/trackers': TradingApiListEndpoint<{\n market_data_id: Decimal;\n passive_pool_id: Decimal | null;\n pool_account_id: Decimal | null;\n quote_token: string | null;\n quote_token_decimals: Decimal | null;\n last_funding_velocity: Decimal | null;\n last_funding_timestamp: Decimal | null;\n last_mtm_price: Decimal | null;\n last_mtm_timestamp: Decimal | null;\n long_trackers_funding_value: Decimal | null;\n last_funding_rate: Decimal | null;\n long_trackers_base_multiplier: Decimal | null;\n long_trackers_adl_unwind_price: Decimal | null;\n short_trackers_funding_value: Decimal | null;\n short_trackers_base_multiplier: Decimal | null;\n short_trackers_adl_unwind_price: Decimal | null;\n open_interest: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n 'wallet/:address/positions': TradingApiListEndpoint<\n Position,\n AddressParam,\n 'position_raw'\n >;\n 'wallet/:address/conditionalOrders': TradingApiListEndpoint<\n ConditionalOrder,\n AddressParam,\n 'ConditionalOrders'\n >;\n assets: TradingApiListEndpoint<{\n address: string;\n name: string;\n short: string;\n createdAt: Date;\n updatedAt: Date;\n asset_price_contract_id: string | null;\n asset_price_usdc_contract_id: string | null;\n decimals: number;\n }>;\n prices: TradingApiListEndpoint<Price>;\n 'wallet/:address/accounts': TradingApiListEndpoint<\n Account,\n AddressParam,\n 'accountProfile'\n >;\n 'wallet/:address/accounts/tiers': TradingApiListEndpoint<\n {\n market_id: Decimal;\n account_id: Decimal;\n tier_id: Decimal;\n },\n AddressParam\n >;\n 'wallet/:address/accounts/balances': TradingApiListEndpoint<\n AccountBalance,\n AddressParam,\n 'account_balances'\n >;\n 'wallet/:address/autoExchange': TradingApiInfiniteListEndpoint<\n AutoExchange,\n AddressParam,\n 'auto_exchange'\n >;\n 'wallet/:address/swaps': TradingApiInfiniteListEndpoint<\n Swap,\n AddressParam,\n 'swaps'\n >;\n 'market/:marketId/orders': TradingApiInfiniteListEndpoint<\n Order,\n {\n marketId: string;\n type?: string;\n },\n 'order_history'\n >;\n 'account/:accountId/orders': TradingApiInfiniteListEndpoint<\n Order,\n {\n accountId: string;\n type?: string;\n },\n 'order_history'\n >;\n 'wallet/:address/balanceHistory/:timestamp?': TradingApiListEndpoint<\n {\n timestamp: number;\n balance: number;\n },\n {\n address: string;\n timestamp?: string;\n }\n >;\n 'wallet/:address/orders/:type?': TradingApiInfiniteListEndpoint<\n Order,\n {\n address: string;\n type?: string;\n },\n 'order_history'\n >;\n 'riskMatrices/:poolId?': TradingApiListEndpoint<\n {\n blockId: Decimal;\n matrix: string[][];\n },\n {\n poolId: string;\n }\n >;\n markets: TradingApiListEndpoint<Market>;\n tierFees: TradingApiListEndpoint<{\n market_id: Decimal;\n tier_id: Decimal;\n fee_parameter: Decimal | null;\n }>;\n collateralConfiguration: TradingApiListEndpoint<{\n collateral_pool_id: Decimal;\n collateral_address: string;\n price_haircut: Decimal | null;\n auto_exchange_discount: Decimal | null;\n oracle_node_id: string | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n candles: TradingApiEndpoint<\n {\n t: number[];\n o: number[];\n h: number[];\n l: number[];\n c: number[];\n },\n never,\n never,\n never,\n {\n from: number;\n to: number;\n resolution: 1 | 5 | 15 | 30 | 60 | 240 | '1D';\n symbol: string;\n }\n >;\n};\n\nexport type Stringified<T, D = Decimal> = T extends D | bigint | Date\n ? string\n : T extends (infer U)[]\n ? Stringified<U, D>[]\n : { [K in keyof T]: Stringified<T[K], D> };\n\nexport type Req<P = ParamsDictionary, ReqQuery = Query> = {\n params: P;\n query: ReqQuery;\n};\n\n/*\n\nSame as infered type \n\nexport type TradingApi = {\n [K in keyof typeof TradingQueries as K extends `get${infer R}` ? R : K]: {\n params: Parameters<ReturnType<(typeof TradingQueries)[K]>>[0] extends Req\n ? Parameters<ReturnType<(typeof TradingQueries)[K]>>[0]['params']\n : never;\n query: Parameters<ReturnType<(typeof TradingQueries)[K]>>[0] extends Req\n ? Parameters<ReturnType<(typeof TradingQueries)[K]>>[0]['query']\n : never;\n response: Stringified<\n Awaited<ReturnType<ReturnType<(typeof TradingQueries)[K]>>>\n >;\n\n*/\n\nexport type TradingApi = {\n [K in keyof TradingApiSource as K]: {\n params: TradingApiSource[K]['params'];\n query: TradingApiSource[K]['query'];\n response: Stringified<TradingApiSource[K]['response']>;\n replication: Stringified<TradingApiSource[K]['replication']>;\n };\n};\n\ntype ReplicationModel = string | never;\n\nexport type GenericReplicationMessage<T, model extends ReplicationModel> =\n | {\n model: model;\n result: T;\n operation: 'create' | 'update' | 'upsert' | 'delete';\n }\n | {\n model: model;\n result: T[];\n operation: 'updateMany';\n };\n\ntype account_collateral_balance_entries = {\n id: string;\n account_id: Decimal | null;\n collateral: string | null;\n amount: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\ntype account_owner_updated_snapshot = {\n account_id: Decimal;\n transaction_hash: string;\n new_owner: string | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\nexport type ReplicationMessage =\n | GenericReplicationMessage<Order, 'order_history'>\n | GenericReplicationMessage<ConditionalOrder, 'ConditionalOrders'>\n | GenericReplicationMessage<Swap, 'swaps'>\n | GenericReplicationMessage<AutoExchange, 'auto_exchange'>\n | GenericReplicationMessage<Position, 'position_raw'>\n | GenericReplicationMessage<Price, 'asset_price'>\n | GenericReplicationMessage<Account, 'accountProfile'>\n | GenericReplicationMessage<Leverage, 'accountLeveragePerMarket'>\n | GenericReplicationMessage<\n account_owner_updated_snapshot,\n 'account_owner_updated_snapshot'\n >\n | GenericReplicationMessage<\n account_collateral_balance_entries,\n 'account_collateral_balance_entries'\n >\n | GenericReplicationMessage<AccountBalance, 'account_balances'>\n | GenericReplicationMessage<Market, 'Market'>;\n"]}
|