@reyaxyz/common 0.344.0 → 0.344.1-perpob.110
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/README.md +1 -1
- package/dist/commands/exposure/command.js +8 -22
- package/dist/commands/exposure/command.js.map +1 -1
- package/dist/incentives-api-types.js.map +1 -1
- package/dist/rest/helpers/constants.js +12 -0
- package/dist/rest/helpers/constants.js.map +1 -1
- package/dist/services/getNativeToken.js +1 -0
- package/dist/services/getNativeToken.js.map +1 -1
- package/dist/services/getSocketAddresses.js +1 -0
- package/dist/services/getSocketAddresses.js.map +1 -1
- package/dist/trading-api-types.js.map +1 -1
- package/dist/transactions/abis/Errors.json +1283 -34
- package/dist/transactions/abis/OrdersGateway.json +729 -123
- package/dist/transactions/abis/PassivePerpProxy.json +542 -0
- package/dist/transactions/buildMulticallTx.js.map +1 -1
- package/dist/transactions/consts.js +1 -2
- package/dist/transactions/consts.js.map +1 -1
- package/dist/transactions/contractAddresses.js +46 -5
- package/dist/transactions/contractAddresses.js.map +1 -1
- package/dist/transactions/executeTransaction.js +8 -123
- package/dist/transactions/executeTransaction.js.map +1 -1
- package/dist/transactions/sign.js +285 -79
- package/dist/transactions/sign.js.map +1 -1
- package/dist/types/commands/exposure/command.d.ts +8 -7
- package/dist/types/commands/exposure/command.d.ts.map +1 -1
- package/dist/types/incentives-api-types.d.ts +40 -17
- package/dist/types/incentives-api-types.d.ts.map +1 -1
- package/dist/types/rest/helpers/constants.d.ts +1 -1
- package/dist/types/rest/helpers/constants.d.ts.map +1 -1
- package/dist/types/services/getNativeToken.d.ts.map +1 -1
- package/dist/types/services/getSocketAddresses.d.ts.map +1 -1
- package/dist/types/trading-api-types.d.ts +144 -94
- package/dist/types/trading-api-types.d.ts.map +1 -1
- package/dist/types/transactions/buildMulticallTx.d.ts +1 -0
- package/dist/types/transactions/buildMulticallTx.d.ts.map +1 -1
- package/dist/types/transactions/consts.d.ts +0 -1
- package/dist/types/transactions/consts.d.ts.map +1 -1
- package/dist/types/transactions/contractAddresses.d.ts +1 -1
- package/dist/types/transactions/contractAddresses.d.ts.map +1 -1
- package/dist/types/transactions/executeTransaction.d.ts +2 -15
- package/dist/types/transactions/executeTransaction.d.ts.map +1 -1
- package/dist/types/transactions/sign.d.ts +117 -6
- package/dist/types/transactions/sign.d.ts.map +1 -1
- package/dist/types/types.d.ts +52 -64
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/calculate.d.ts +14 -2
- package/dist/types/utils/calculate.d.ts.map +1 -1
- package/dist/types/utils/compute-trade-pnl.d.ts +39 -0
- package/dist/types/utils/compute-trade-pnl.d.ts.map +1 -0
- package/dist/types/utils/consts.d.ts +2 -2
- package/dist/types/utils/consts.d.ts.map +1 -1
- package/dist/types/utils/error-sanitizer.d.ts +15 -0
- package/dist/types/utils/error-sanitizer.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/layerzero.d.ts +22 -0
- package/dist/types/utils/layerzero.d.ts.map +1 -0
- package/dist/types/utils/network.d.ts.map +1 -1
- package/dist/types/utils/throttled-error.d.ts +42 -0
- package/dist/types/utils/throttled-error.d.ts.map +1 -0
- package/dist/types/utils/token/batch-token-getters.d.ts +0 -5
- package/dist/types/utils/token/batch-token-getters.d.ts.map +1 -1
- package/dist/types/utils/token/normalize.d.ts +2 -1
- package/dist/types/utils/token/normalize.d.ts.map +1 -1
- package/dist/types/utils/token/token-getters.d.ts +0 -2
- package/dist/types/utils/token/token-getters.d.ts.map +1 -1
- package/dist/types/utils/token/token-info-getters.d.ts.map +1 -1
- package/dist/types/utils/token/token-info.d.ts.map +1 -1
- package/dist/types.js +41 -11
- package/dist/types.js.map +1 -1
- package/dist/utils/calculate.js +137 -16
- package/dist/utils/calculate.js.map +1 -1
- package/dist/utils/compute-trade-pnl.js +60 -0
- package/dist/utils/compute-trade-pnl.js.map +1 -0
- package/dist/utils/consts.js +8 -13
- package/dist/utils/consts.js.map +1 -1
- package/dist/utils/error-sanitizer.js +135 -0
- package/dist/utils/error-sanitizer.js.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/layerzero.js +31 -0
- package/dist/utils/layerzero.js.map +1 -0
- package/dist/utils/network.js +4 -0
- package/dist/utils/network.js.map +1 -1
- package/dist/utils/throttled-error.js +60 -0
- package/dist/utils/throttled-error.js.map +1 -0
- package/dist/utils/token/batch-token-getters.js +13 -64
- package/dist/utils/token/batch-token-getters.js.map +1 -1
- package/dist/utils/token/normalize.js +2 -2
- package/dist/utils/token/normalize.js.map +1 -1
- package/dist/utils/token/token-getters.js +1 -42
- package/dist/utils/token/token-getters.js.map +1 -1
- package/dist/utils/token/token-info-getters.js +45 -4
- package/dist/utils/token/token-info-getters.js.map +1 -1
- package/dist/utils/token/token-info.js +6 -0
- package/dist/utils/token/token-info.js.map +1 -1
- package/package.json +3 -3
- package/src/commands/exposure/command.ts +8 -38
- package/src/incentives-api-types.ts +66 -33
- package/src/rest/helpers/constants.ts +22 -0
- package/src/services/getNativeToken.ts +1 -0
- package/src/services/getSocketAddresses.ts +1 -0
- package/src/trading-api-types.ts +175 -127
- package/src/transactions/abis/Errors.json +5133 -3884
- package/src/transactions/abis/OrdersGateway.json +730 -124
- package/src/transactions/abis/PassivePerpProxy.json +542 -0
- package/src/transactions/buildMulticallTx.ts +4 -0
- package/src/transactions/consts.ts +0 -1
- package/src/transactions/contractAddresses.ts +43 -6
- package/src/transactions/executeTransaction.ts +2 -130
- package/src/transactions/sign.ts +347 -93
- package/src/types.ts +90 -74
- package/src/utils/calculate.ts +181 -21
- package/src/utils/compute-trade-pnl.ts +110 -0
- package/src/utils/consts.ts +10 -22
- package/src/utils/error-sanitizer.ts +137 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/layerzero.ts +66 -0
- package/src/utils/network.ts +4 -0
- package/src/utils/throttled-error.ts +85 -0
- package/src/utils/token/batch-token-getters.ts +0 -28
- package/src/utils/token/normalize.ts +6 -1
- package/src/utils/token/token-getters.ts +0 -29
- package/src/utils/token/token-info-getters.ts +54 -4
- package/src/utils/token/token-info.ts +35 -0
- package/dist/types/utils/layerzero/index.d.ts +0 -3
- package/dist/types/utils/layerzero/index.d.ts.map +0 -1
- package/dist/types/utils/layerzero/oft-config.d.ts +0 -4
- package/dist/types/utils/layerzero/oft-config.d.ts.map +0 -1
- package/dist/types/utils/layerzero/types.d.ts +0 -23
- package/dist/types/utils/layerzero/types.d.ts.map +0 -1
- package/dist/utils/layerzero/index.js +0 -19
- package/dist/utils/layerzero/index.js.map +0 -1
- package/dist/utils/layerzero/oft-config.js +0 -29
- package/dist/utils/layerzero/oft-config.js.map +0 -1
- package/dist/utils/layerzero/types.js +0 -3
- package/dist/utils/layerzero/types.js.map +0 -1
- package/src/utils/layerzero/index.ts +0 -2
- package/src/utils/layerzero/oft-config.ts +0 -32
- package/src/utils/layerzero/types.ts +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trading-api-types.js","sourceRoot":"/","sources":["trading-api-types.ts"],"names":[],"mappings":";;;AAYa,QAAA,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;CACjB,CAAC","sourcesContent":["import { ParamsDictionary, Query } from 'express-serve-static-core';\nimport { AssetPair, CollateralPrice, MarketPrice } from './types';\nimport {\n AddressParam,\n ApiEndpoint,\n ApiInfiniteListEndpoint,\n ApiListEndpoint,\n Decimal,\n PaginatedQueryParams,\n Stringified,\n} from './api-types';\n\nexport const AccountStatusValues = {\n OPEN: 'OPEN',\n CLOSED: 'CLOSED',\n};\n\nexport type AccountStatus =\n (typeof AccountStatusValues)[keyof typeof AccountStatusValues];\n\ntype CandleResolution = '1' | '5' | '15' | '30' | '60' | '240' | '1D';\n\ntype Candle = {\n time: number;\n open: number;\n high: number;\n low: number;\n close: number;\n assetPairId: AssetPair;\n resolution: CandleResolution;\n};\n\ntype Order = {\n id: string;\n market_id: Decimal | null;\n account_id: Decimal | null;\n executed_base: Decimal | null;\n fee: Decimal | null;\n price: Decimal | null;\n is_match_order: boolean | null;\n liquidation_type: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n event_sequence_number: bigint | null;\n exchange_id: Decimal | null;\n created_at: Date;\n counterparty_account_id: Decimal | null;\n counterparty_adl_unwind_price: Decimal | null;\n counterparty_average_entry_funding_value: Decimal | null;\n counterparty_base: Decimal | null;\n counterparty_base_multiplier: Decimal | null;\n counterparty_funding_value: Decimal | null;\n counterparty_last_price: Decimal | null;\n counterparty_last_price_timestamp: Decimal | null;\n counterparty_realized_pnl: Decimal | null;\n counterparty_session: Decimal | null;\n position_adl_unwind_price: Decimal | null;\n position_average_entry_funding_value: Decimal | null;\n position_base: Decimal | null;\n position_base_multiplier: Decimal | null;\n position_funding_value: Decimal | null;\n position_last_price: Decimal | null;\n position_last_price_timestamp: Decimal | null;\n position_previous_adl_unwind_price: Decimal | null;\n position_previous_average_entry_funding_value: Decimal | null;\n position_previous_base_multiplier: Decimal | null;\n position_previous_funding_value: Decimal | null;\n position_previous_last_price: Decimal | null;\n position_previous_realized_pnl: Decimal | null;\n position_realized_pnl: Decimal | null;\n position_session: Decimal | null;\n referrer_account_id: Decimal | null;\n referrer_fee_credit: Decimal | null;\n};\n\ntype Position = {\n market_id: Decimal;\n account_id: Decimal;\n base: Decimal | null;\n realized_pnl: Decimal | null;\n last_price: Decimal | null;\n last_price_timestamp: Decimal | null;\n funding_value: Decimal | null;\n base_multiplier: Decimal | null;\n adl_unwind_price: Decimal | null;\n average_entry_funding_value: Decimal | null;\n session: Decimal | null;\n exchange_id: Decimal | null;\n event_sequence_number: bigint | null;\n referrer_account_id: Decimal | null;\n referrer_fee_credit: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n adjusted_base: Decimal | null;\n adl_realized_pnl: Decimal | 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 status: string;\n creation_timestamp_ms: bigint;\n last_update_timestamp_ms: bigint;\n transaction_hash: string | null;\n};\n\ntype ConditionalOrderSensitive = ConditionalOrder & {\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};\n\ntype Market = {\n id: Decimal;\n assetPairId: AssetPair;\n ticker: string;\n isActive: boolean;\n maxLeverage: number;\n description: string;\n name: string;\n tickSizeDecimals: number;\n priority: number;\n underlyingAssetId: string;\n quoteTokenId: string;\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 AccountBalance = {\n account_id: Decimal | null;\n collateral: string | null;\n balance?: Decimal | null;\n delta?: Decimal | null;\n};\n\ntype spot_execution = {\n account_id: Decimal;\n counterparty_account_id: Decimal;\n exchange_id: Decimal;\n executed_base: Decimal;\n price: Decimal;\n account_order_id: bigint;\n counterparty_order_id: bigint;\n spot_market_id: Decimal;\n is_auto_exchange: boolean;\n is_long: boolean;\n event_sequence_number: bigint;\n parent_event_sequence_number: bigint | null;\n block_timestamp: Decimal;\n block_number: Decimal;\n transaction_hash: string;\n created_at: string;\n};\n\ntype account_real_balance = {\n account_id: Decimal;\n collateral: string;\n balance: Decimal;\n rpnl: Decimal;\n event_sequence_number: bigint | null;\n transfer_event_sequence_number: bigint | null;\n parent_event_sequence_number: bigint | null;\n block_timestamp: Decimal;\n block_number: Decimal;\n transaction_hash: string;\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\ntype WalletStats = {\n volume_14d: Decimal;\n};\n\ntype MarketData = {\n marketId: string;\n updatedAt: number;\n longOI: number;\n shortOI: number;\n longSkewPercentage: number;\n shortSkewPercentage: number;\n openInterest?: number;\n fundingRate?: number;\n fundingRateVelocity?: number;\n longFundingValue?: number;\n shortFundingValue?: number;\n last24hVolume: number;\n priceChange24H?: number;\n priceChange24HPercentage?: number;\n maxAmountBaseLong?: number;\n maxAmountSizeLong?: number;\n maxAmountBaseShort?: number;\n maxAmountSizeShort?: number;\n oraclePrice?: number;\n poolPrice?: number;\n pricesUpdatedAt?: number;\n longBaseMultiplier?: number;\n shortBaseMultiplier?: number;\n longAdlUnwindPrice?: number;\n shortAdlUnwindPrice?: number;\n depthFactor?: number;\n priceSpread?: number;\n logPriceMultiplier?: number;\n};\n\ntype SpotMarketData = {\n spotMarketId: string;\n symbol: string;\n updatedAt: number;\n volume24h: number;\n pxChange24h?: number;\n oraclePrice?: number;\n};\n\ntype MarketTrackers = {\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 price_spread: Decimal | null;\n depth_factor: Decimal | null;\n log_price_multiplier: Decimal | null;\n};\n\nexport type TradingApiReplication<\n ReplicationTable extends ReplicationModel = never,\n Replication = never,\n> = {\n replication: ReplicationTable extends never\n ? never\n : GenericReplicationMessage<Replication, ReplicationTable>;\n};\n\nexport type TradingApiEndpoint<\n Response,\n Params,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = never,\n> = ApiEndpoint<Response, Params, Query> &\n TradingApiReplication<ReplicationTable, Replication>;\n\nexport type TradingApiListEndpoint<\n Response,\n Params = never,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = never,\n> = ApiListEndpoint<Response, Params, Query> &\n TradingApiReplication<ReplicationTable, Replication>;\n\nexport type TradingApiInfiniteListEndpoint<\n Response,\n Params = never,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = PaginatedQueryParams,\n> = ApiInfiniteListEndpoint<Response, Params, Query> &\n TradingApiReplication<ReplicationTable, Replication>;\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: TradingApiListEndpoint<Market>;\n 'markets/data': TradingApiListEndpoint<MarketData, never, 'marketData'>;\n 'spotMarkets/data': TradingApiListEndpoint<\n SpotMarketData,\n never,\n 'spotMarketData'\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 MarketTrackers,\n never,\n 'marketTrackers'\n >;\n 'market/:marketId/trackers': TradingApiEndpoint<\n MarketTrackers,\n {\n marketId: string;\n },\n 'marketTrackers'\n >;\n 'market/:marketId': TradingApiEndpoint<\n Market,\n {\n marketId: string;\n }\n >;\n 'market/:marketId/data': TradingApiEndpoint<\n MarketData,\n {\n marketId: string;\n },\n 'marketData'\n >;\n 'market/:marketId/trades': TradingApiInfiniteListEndpoint<\n Order,\n {\n marketId: string;\n },\n 'orders'\n >;\n 'wallet/:address/positions': TradingApiListEndpoint<\n Position,\n AddressParam,\n 'position',\n Omit<Position, 'adjusted_base' | 'adl_realized_pnl'>\n >;\n 'wallet/:address/openOrders': 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: TradingApiEndpoint<\n Partial<Record<AssetPair, MarketPrice | CollateralPrice>>,\n never\n >;\n 'prices/:assetPairId': TradingApiEndpoint<\n MarketPrice | CollateralPrice | undefined,\n {\n assetPairId: string;\n },\n 'price'\n >;\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 | null;\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/balanceHistory/:timestamp': TradingApiListEndpoint<\n {\n timestamp: number;\n balance: number;\n },\n {\n address: string;\n timestamp: string;\n }\n >;\n 'wallet/:address/trades': TradingApiInfiniteListEndpoint<\n Order,\n {\n address: string;\n },\n 'order_history'\n >;\n 'wallet/:address/trades/:type': TradingApiInfiniteListEndpoint<\n Order,\n {\n address: string;\n type?: 'matchOrder' | 'liquidation';\n },\n 'order_history'\n >;\n riskMatrices: TradingApiListEndpoint<\n {\n blockId: Decimal;\n matrix: string[][];\n },\n {\n poolId: string;\n }\n >;\n tierFees: TradingApiListEndpoint<{\n market_id: Decimal;\n tier_id: Decimal;\n fee_parameter: Decimal | null;\n }>;\n collateralConfiguration: TradingApiListEndpoint<{\n assetPairId?: AssetPair;\n name?: string;\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 'candle/:assetPairId/:resolution': TradingApiEndpoint<\n Candle | null,\n {\n resolution: CandleResolution;\n assetPairId: AssetPair;\n },\n 'storkPriceCandle',\n Candle\n >;\n 'candles/:assetPairId/:resolution': TradingApiEndpoint<\n {\n t: number[];\n o: number[];\n h: number[];\n l: number[];\n c: number[];\n },\n {\n resolution: CandleResolution;\n assetPairId: AssetPair;\n },\n never,\n never,\n {\n to: string;\n from: string;\n countBack?: string;\n }\n >;\n feeTierParameters: TradingApiListEndpoint<{\n tier_id: Decimal;\n taker_fee: Decimal;\n maker_fee: Decimal;\n volume: Decimal;\n }>;\n globalFeeParameters: TradingApiEndpoint<\n {\n og_discount: Decimal;\n vltz_discount: Decimal;\n referee_discount: Decimal;\n referrer_rebate: Decimal;\n affiliate_referrer_rebate: Decimal;\n },\n never\n >;\n dynamicDepthConfig: TradingApiEndpoint<\n {\n markets: {\n marketId: number;\n baseDepth: number;\n thresholds: number[];\n ratios: number[];\n }[];\n },\n never\n >;\n 'wallet/:address/configuration': TradingApiEndpoint<\n {\n tier_id: Decimal;\n og_status: boolean;\n vltz_status: boolean;\n affiliate_status: boolean;\n referee_status: boolean;\n spread_discount_status: boolean;\n main_account_id: Decimal;\n },\n {\n address: string;\n }\n >;\n 'wallet/:address/stats': TradingApiEndpoint<\n WalletStats,\n {\n address: string;\n }\n >;\n 'wallet/:address/apiWalletStatus': TradingApiEndpoint<\n {\n enabledApiWallets: string[];\n },\n {\n address: string;\n }\n >;\n rlp: TradingApiEndpoint<\n {\n tvlInUsdc: number;\n tvlInRlp: number;\n rlpUsdcPrice: number;\n apy: {\n '1d': number;\n '7d': number;\n '30d': number;\n '365d': number;\n };\n numberOfDepositors: number;\n ageSeconds: number;\n },\n never\n >;\n 'wallet/:address/rlp': TradingApiEndpoint<\n {\n balanceInUsdc: number;\n balanceInRlp: number;\n },\n {\n address: string;\n }\n >;\n};\n\nexport type Req<P = ParamsDictionary, ReqQuery = Query> = {\n params: P;\n query: ReqQuery;\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 | {\n model: model;\n result: T[];\n operation: 'createMany';\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\ntype positions_migration = {\n market_id: Decimal;\n account_id: Decimal;\n base: Decimal | null;\n realized_pnl: Decimal | null;\n last_price: Decimal | null;\n last_price_timestamp: Decimal | null;\n funding_value: Decimal | null;\n base_multiplier: Decimal | null;\n adl_unwind_price: Decimal | null;\n average_entry_funding_value: Decimal | null;\n session: Decimal | null;\n exchange_id: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n event_sequence_number: bigint | null;\n referrer_account_id: Decimal | null;\n referrer_fee_credit: Decimal | null;\n};\n\ntype spot_execution_bust = {\n event_sequence_number: bigint;\n spot_market_id: Decimal;\n account_id: Decimal;\n counterparty_account_id: Decimal;\n account_order_id: bigint;\n counterparty_order_id: bigint;\n exchange_id: Decimal;\n failed_base: Decimal;\n price: Decimal;\n is_long: boolean;\n reason: string;\n block_timestamp: Decimal;\n block_number: Decimal;\n transaction_hash: string;\n created_at: string;\n};\n\ntype ReplicationMessage =\n // Extract the union of all `replication` values from TradingApiSource\n | Exclude<TradingApiSource[keyof TradingApiSource]['replication'], never>\n // add messages that do not exists in TradingApiSource\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<account_real_balance, 'account_real_balances'>\n | GenericReplicationMessage<\n ConditionalOrderSensitive,\n 'ConditionalOrdersSensitive'\n >\n | GenericReplicationMessage<\n // Todo: remove after migration\n positions_migration,\n 'positions_migration'\n >\n | GenericReplicationMessage<spot_execution, 'spot_executions'>\n | GenericReplicationMessage<spot_execution_bust, 'spot_execution_busts'>;\n\nexport type Replication = {\n [K in ReplicationMessage as `replication:${K['model']}`]: Extract<\n ReplicationMessage,\n { model: K['model'] }\n >;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"trading-api-types.js","sourceRoot":"/","sources":["trading-api-types.ts"],"names":[],"mappings":";;;AAYa,QAAA,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;CACjB,CAAC","sourcesContent":["import { ParamsDictionary, Query } from 'express-serve-static-core';\nimport { Address, AssetPair, CollateralPrice, MarketPrice } from './types';\nimport {\n AddressParam,\n ApiEndpoint,\n ApiInfiniteListEndpoint,\n ApiListEndpoint,\n Decimal,\n PaginatedQueryParams,\n Stringified,\n} from './api-types';\n\nexport const AccountStatusValues = {\n OPEN: 'OPEN',\n CLOSED: 'CLOSED',\n};\n\nexport type AccountStatus =\n (typeof AccountStatusValues)[keyof typeof AccountStatusValues];\n\ntype CandleResolution = '1' | '5' | '15' | '30' | '60' | '240' | '1D';\n\ntype Candle = {\n time: number;\n open: number;\n high: number;\n low: number;\n close: number;\n assetPairId: AssetPair;\n resolution: CandleResolution;\n};\n\n// Used only for PerpExecutionReplicationData (replication:orders messages)\ntype Order = {\n id: string;\n market_id: Decimal | null;\n account_id: Decimal | null;\n executed_base: Decimal | null;\n fee: Decimal | null;\n price: Decimal | null;\n is_match_order: boolean | null;\n liquidation_type: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n event_sequence_number: bigint | null;\n exchange_id: Decimal | null;\n created_at: Date;\n counterparty_account_id: Decimal | null;\n counterparty_adl_unwind_price: Decimal | null;\n counterparty_average_entry_funding_value: Decimal | null;\n counterparty_base: Decimal | null;\n counterparty_base_multiplier: Decimal | null;\n counterparty_funding_value: Decimal | null;\n counterparty_last_price: Decimal | null;\n counterparty_last_price_timestamp: Decimal | null;\n counterparty_previous_average_entry_funding_value: Decimal | null;\n counterparty_previous_base_multiplier: Decimal | null;\n counterparty_previous_funding_value: Decimal | null;\n counterparty_previous_last_price: Decimal | null;\n counterparty_previous_realized_pnl: Decimal | null;\n counterparty_realized_pnl: Decimal | null;\n counterparty_session: Decimal | null;\n position_adl_unwind_price: Decimal | null;\n position_average_entry_funding_value: Decimal | null;\n position_base: Decimal | null;\n position_base_multiplier: Decimal | null;\n position_funding_value: Decimal | null;\n position_last_price: Decimal | null;\n position_last_price_timestamp: Decimal | null;\n position_previous_adl_unwind_price: Decimal | null;\n position_previous_average_entry_funding_value: Decimal | null;\n position_previous_base_multiplier: Decimal | null;\n position_previous_funding_value: Decimal | null;\n position_previous_last_price: Decimal | null;\n position_previous_realized_pnl: Decimal | null;\n position_realized_pnl: Decimal | null;\n position_session: Decimal | null;\n referrer_account_id: Decimal | null;\n referrer_fee_credit: Decimal | null;\n // V3 fields\n protocol_fee_credit: Decimal | null;\n taker_rebate_credit: Decimal | null;\n pool_fee_credit: Decimal | null;\n exchange_fee_credit: Decimal | null;\n maker_fee_credit: Decimal | null;\n maker_fee_debit: Decimal | null;\n account_order_id: bigint | null;\n counterparty_order_id: bigint | null;\n me_nonce: Decimal | null;\n};\n\ntype Position = {\n market_id: Decimal;\n account_id: Decimal;\n base: Decimal | null;\n realized_pnl: Decimal | null;\n last_price: Decimal | null;\n last_price_timestamp: Decimal | null;\n funding_value: Decimal | null;\n base_multiplier: Decimal | null;\n adl_unwind_price: Decimal | null;\n average_entry_funding_value: Decimal | null;\n session: Decimal | null;\n exchange_id: Decimal | null;\n event_sequence_number: bigint | null;\n referrer_account_id: Decimal | null;\n referrer_fee_credit: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n adjusted_base: Decimal | null;\n adl_realized_pnl: Decimal | null;\n};\n\n// PRO-126 Bug 7: `ConditionalOrder` + `ConditionalOrderSensitive`\n// trading-api-types retired with the rest of the legacy\n// `ConditionalOrders` DB pipeline. They modeled the legacy row shape\n// for the dead V1 `/wallet/:address/openOrders` endpoint + the dead\n// `replication:ConditionalOrdersSensitive` broadcast channel; both\n// callers have been removed.\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 AccountBalance = {\n account_id: Decimal | null;\n collateral: string | null;\n balance?: Decimal | null;\n delta?: Decimal | null;\n};\n\ntype spot_execution = {\n account_id: Decimal;\n counterparty_account_id: Decimal;\n exchange_id: Decimal;\n executed_base: Decimal;\n price: Decimal;\n account_order_id: bigint;\n counterparty_order_id: bigint;\n me_nonce: Decimal | null;\n spot_market_id: Decimal;\n is_auto_exchange: boolean;\n is_long: boolean;\n event_sequence_number: bigint;\n parent_event_sequence_number: bigint | null;\n block_timestamp: Decimal;\n block_number: Decimal;\n transaction_hash: string;\n created_at: string;\n};\n\ntype account_real_balance = {\n account_id: Decimal;\n collateral: string;\n balance: Decimal;\n rpnl: Decimal;\n event_sequence_number: bigint | null;\n transfer_event_sequence_number: bigint | null;\n parent_event_sequence_number: bigint | null;\n block_timestamp: Decimal;\n block_number: Decimal;\n transaction_hash: string;\n};\n\n// `Leverage` is still referenced by the `wallet/:address/leverages`\n// endpoint below, so it is kept; `AutoExchange` (a dead legacy type with\n// no remaining references) was removed in #2713/#2710.\ntype Leverage = {\n accountId: Decimal;\n marketId: Decimal;\n leverage: number;\n createdAt: Date;\n updatedAt: Date;\n};\n\ntype WalletStats = {\n volume_30d: Decimal;\n};\n\ntype MarketData = {\n marketId: string;\n updatedAt: number;\n longOI: number;\n shortOI: number;\n longSkewPercentage: number;\n shortSkewPercentage: number;\n openInterest?: number;\n fundingRate?: number;\n fundingRateVelocity?: number;\n longFundingValue?: number;\n shortFundingValue?: number;\n last24hVolume: number;\n priceChange24H?: number;\n priceChange24HPercentage?: number;\n maxAmountBaseLong?: number;\n maxAmountSizeLong?: number;\n maxAmountBaseShort?: number;\n maxAmountSizeShort?: number;\n oraclePrice?: number;\n poolPrice?: number;\n pricesUpdatedAt?: number;\n longBaseMultiplier?: number;\n shortBaseMultiplier?: number;\n longAdlUnwindPrice?: number;\n shortAdlUnwindPrice?: number;\n depthFactor?: number;\n priceSpread?: number;\n logPriceMultiplier?: number;\n};\n\ntype SpotMarketData = {\n spotMarketId: string;\n symbol: string;\n updatedAt: number;\n volume24h: number;\n pxChange24h?: number;\n oraclePrice?: number;\n};\n\ntype MarketTrackers = {\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 price_spread: Decimal | null;\n depth_factor: Decimal | null;\n log_price_multiplier: Decimal | null;\n mark_price: Decimal | null;\n mark_price_timestamp: Decimal | null;\n funding_rate: Decimal | null;\n funding_rate_timestamp: Decimal | null;\n};\n\nexport type TradingApiReplication<\n ReplicationTable extends ReplicationModel = never,\n Replication = never,\n> = {\n replication: ReplicationTable extends never\n ? never\n : GenericReplicationMessage<Replication, ReplicationTable>;\n};\n\nexport type TradingApiEndpoint<\n Response,\n Params,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = never,\n> = ApiEndpoint<Response, Params, Query> &\n TradingApiReplication<ReplicationTable, Replication>;\n\nexport type TradingApiListEndpoint<\n Response,\n Params = never,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = never,\n> = ApiListEndpoint<Response, Params, Query> &\n TradingApiReplication<ReplicationTable, Replication>;\n\nexport type TradingApiInfiniteListEndpoint<\n Response,\n Params = never,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = PaginatedQueryParams,\n> = ApiInfiniteListEndpoint<Response, Params, Query> &\n TradingApiReplication<ReplicationTable, Replication>;\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/data': TradingApiListEndpoint<MarketData, never, 'marketData'>;\n 'spotMarkets/data': TradingApiListEndpoint<\n SpotMarketData,\n never,\n 'spotMarketData'\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 MarketTrackers,\n never,\n 'marketTrackers'\n >;\n 'market/:marketId/trackers': TradingApiEndpoint<\n MarketTrackers,\n {\n marketId: string;\n },\n 'marketTrackers'\n >;\n 'market/:marketId/data': TradingApiEndpoint<\n MarketData,\n {\n marketId: string;\n },\n 'marketData'\n >;\n 'wallet/:address/positions': TradingApiListEndpoint<\n Position,\n AddressParam,\n 'position',\n Omit<Position, 'adjusted_base' | 'adl_realized_pnl'>\n >;\n // PRO-126 Bug 7: V1 `/wallet/:address/openOrders` endpoint type\n // retired. The route+controller were removed in trading.router.ts +\n // trading.controller.ts. V2 callers should use\n // `/v2/wallet/:address/openOrders` which serves both spot and perp\n // orders from the unified ME stream via OrdersProvider.\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: TradingApiEndpoint<\n Partial<Record<AssetPair, MarketPrice | CollateralPrice>>,\n never\n >;\n 'prices/:assetPairId': TradingApiEndpoint<\n MarketPrice | CollateralPrice | undefined,\n {\n assetPairId: string;\n },\n 'price'\n >;\n 'wallet/:address/accounts': TradingApiListEndpoint<\n Account,\n AddressParam,\n 'AccountProfile'\n >;\n 'wallet/:address/accounts/balances': TradingApiListEndpoint<\n AccountBalance,\n AddressParam,\n 'account_balances'\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 riskMatrices: TradingApiListEndpoint<\n {\n blockId: Decimal;\n matrix: string[][];\n },\n {\n poolId: string;\n }\n >;\n 'candle/:assetPairId/:resolution': TradingApiEndpoint<\n Candle | null,\n {\n resolution: CandleResolution;\n assetPairId: AssetPair;\n },\n 'storkPriceCandle',\n Candle\n >;\n 'candles/:assetPairId/:resolution': TradingApiEndpoint<\n {\n t: number[];\n o: number[];\n h: number[];\n l: number[];\n c: number[];\n },\n {\n resolution: CandleResolution;\n assetPairId: AssetPair;\n },\n never,\n never,\n {\n to: string;\n from: string;\n countBack?: string;\n }\n >;\n feeTierParameters: TradingApiListEndpoint<{\n tier_id: Decimal;\n taker_fee: Decimal;\n maker_fee: Decimal;\n volume: Decimal;\n }>;\n globalFeeParameters: TradingApiEndpoint<\n {\n og_discount: Decimal;\n vltz_discount: Decimal;\n referee_discount: Decimal;\n referrer_rebate: Decimal;\n affiliate_referrer_rebate: Decimal;\n },\n never\n >;\n dynamicDepthConfig: TradingApiEndpoint<\n {\n markets: {\n marketId: number;\n baseDepth: number;\n thresholds: number[];\n ratios: number[];\n }[];\n },\n never\n >;\n 'wallet/:address/configuration': TradingApiEndpoint<\n {\n tier_id: Decimal;\n og_status: boolean;\n vltz_status: boolean;\n affiliate_status: boolean;\n referee_status: boolean;\n spread_discount_status: boolean;\n main_account_id: Decimal;\n },\n {\n address: string;\n }\n >;\n 'wallet/:address/stats': TradingApiEndpoint<\n WalletStats,\n {\n address: string;\n }\n >;\n 'wallet/:address/apiWalletStatus': TradingApiEndpoint<\n {\n enabledApiWallets: string[];\n },\n {\n address: string;\n }\n >;\n rlp: TradingApiEndpoint<\n {\n tvlInUsdc: number;\n tvlInRlp: number;\n rlpUsdcPrice: number;\n apy: {\n '1d': number;\n '7d': number;\n '30d': number;\n '365d': number;\n };\n numberOfDepositors: number;\n ageSeconds: number;\n },\n never\n >;\n 'wallet/:address/rlp': TradingApiEndpoint<\n {\n balanceInUsdc: number;\n balanceInRlp: number;\n },\n {\n address: string;\n }\n >;\n 'collaterals/definitions': TradingApiEndpoint<\n {\n collaterals: CollateralDefinition[];\n },\n never\n >;\n 'collaterals/balances/wallet/:address': TradingApiEndpoint<\n {\n collaterals: CollateralWalletBalance[];\n },\n {\n address: string;\n }\n >;\n};\n\nexport type Req<P = ParamsDictionary, ReqQuery = Query> = {\n params: P;\n query: ReqQuery;\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 | {\n model: model;\n result: T[];\n operation: 'createMany';\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 event_sequence_number: bigint | null;\n};\n\ntype positions_migration = {\n market_id: Decimal;\n account_id: Decimal;\n base: Decimal | null;\n realized_pnl: Decimal | null;\n last_price: Decimal | null;\n last_price_timestamp: Decimal | null;\n funding_value: Decimal | null;\n base_multiplier: Decimal | null;\n adl_unwind_price: Decimal | null;\n average_entry_funding_value: Decimal | null;\n session: Decimal | null;\n exchange_id: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n event_sequence_number: bigint | null;\n referrer_account_id: Decimal | null;\n referrer_fee_credit: Decimal | null;\n};\n\ntype execution_bust = {\n event_sequence_number: bigint;\n market_id: Decimal;\n market_type: string;\n account_id: Decimal;\n counterparty_account_id: Decimal;\n account_order_id: bigint;\n counterparty_order_id: bigint;\n me_nonce: Decimal | null;\n exchange_id: Decimal;\n failed_base: Decimal;\n price: Decimal;\n is_long: boolean;\n reason: string;\n block_timestamp: Decimal;\n block_number: Decimal;\n transaction_hash: string;\n created_at: string;\n};\n\ntype ReplicationMessage =\n // Extract the union of all `replication` values from TradingApiSource\n | Exclude<TradingApiSource[keyof TradingApiSource]['replication'], never>\n // add messages that do not exists in TradingApiSource\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<account_real_balance, 'account_real_balances'>\n // PRO-126 Bug 7: `ConditionalOrdersSensitive` replication channel\n // retired with the rest of the `ConditionalOrders` DB pipeline.\n // Order data flows through the ME's `{orders}:changes` stream.\n | GenericReplicationMessage<\n // Todo: remove after migration\n positions_migration,\n 'positions_migration'\n >\n | GenericReplicationMessage<spot_execution, 'spot_executions'>\n | GenericReplicationMessage<Order, 'orders'>\n | GenericReplicationMessage<execution_bust, 'execution_busts'>;\n\nexport type SocketDepositChainDetails = {\n chainId: number;\n chainName: string;\n collateralAddress: Address;\n collateralName: string;\n collateralAddressInReyaPeriphery: Address;\n vaultAddress: Address;\n connectorAddress: Address;\n msgGasLimit: string;\n bridgeTime: number;\n};\n\nexport type SocketWithdrawChainDetails = {\n chainId: number;\n chainName: string;\n collateralAddress: Address;\n collateralName: string;\n collateralAddressInReyaCore: Address;\n msgGasLimit: string;\n bridgeFee: string;\n bridgeTime: number;\n};\n\nexport type LayerzeroDepositChainDetails = {\n chainId: number;\n chainName: string;\n collateralAddress: Address;\n collateralName: string;\n collateralAddressInReyaPeriphery: Address;\n dstEid: number;\n extraOptions: string;\n bridgeTime: number;\n};\n\nexport type LayerzeroWithdrawChainDetails = {\n chainId: number;\n chainName: string;\n collateralAddress: Address;\n collateralName: string;\n collateralAddressInReyaCore: Address;\n dstEid: number;\n bridgeFee: string;\n bridgeTime: number;\n};\n\nexport type SocketDepositInfo =\n | { enabled: false }\n | { enabled: true; chains: SocketDepositChainDetails[]; minAmount: number };\n\nexport type SocketWithdrawInfo =\n | { enabled: false }\n | { enabled: true; chains: SocketWithdrawChainDetails[]; minAmount: number };\n\nexport type LayerzeroDepositInfo =\n | { enabled: false }\n | {\n enabled: true;\n minAmount: number;\n chains: LayerzeroDepositChainDetails[];\n };\n\nexport type LayerzeroWithdrawInfo =\n | { enabled: false }\n | {\n enabled: true;\n minAmount: number;\n chains: LayerzeroWithdrawChainDetails[];\n };\n\nexport type TransferInfo = { enabled: boolean };\n\nexport type SpotInfo =\n | { enabled: false }\n | { enabled: true; spotMarketSymbol: string };\n\nexport type DisplayInfo = {\n advertisedInSpot: boolean;\n advertisedInPerp: boolean;\n displayName: string;\n displayDecimals: number;\n};\n\nexport type CollateralDefinition = {\n id: Uppercase<string>;\n address: Address;\n assetPairId: string;\n priceHaircut: string;\n liquidationDiscount: string;\n decimals: number;\n socketDepositInfo: SocketDepositInfo;\n socketWithdrawInfo: SocketWithdrawInfo;\n layerzeroDepositInfo: LayerzeroDepositInfo;\n layerzeroWithdrawInfo: LayerzeroWithdrawInfo;\n transferInfo: TransferInfo;\n spotInfo: SpotInfo;\n displayInfo: DisplayInfo;\n};\n\n// Per-collateral, per-source-chain wallet balance available to deposit. This is\n// the user's ERC20 balance of the collateral's source-chain token (what a\n// deposit spends), read via `balanceOf`. `balance` is a human-readable decimal\n// string; it is `null` when every RPC for that chain failed.\nexport type CollateralChainBalance = {\n chainId: number;\n chainName: string;\n collateralAddress: Address;\n balance: string | null;\n};\n\nexport type CollateralWalletBalance = {\n id: Uppercase<string>;\n chains: CollateralChainBalance[];\n};\n\nexport type Replication = {\n [K in ReplicationMessage as `replication:${K['model']}`]: Extract<\n ReplicationMessage,\n { model: K['model'] }\n >;\n};\n"]}
|