@reyaxyz/common 0.382.0 → 0.384.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.
@@ -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;AA6HF,wCAAwC;AAC3B,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAE1C,6EAA6E;AAC7E,wEAAwE;AACxE,wEAAwE;AACxE,4EAA4E;AAC5E,IAAM,sBAAsB,GAAG,yCAAyC,CAAC;AAEzE;;;;GAIG;AACI,IAAM,gBAAgB,GAAG,UAAC,GAAY;IAC3C,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzC,IAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACxB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC;QACpB,IAAI,CAAC,MAAM,IAAI,+BAAuB;QACtC,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC;QAClC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B;AAEF;;;;;GAKG;AACU,QAAA,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAErD,QAAA,sBAAsB,GAAkB,MAAM,CAAC;AAC/C,QAAA,oBAAoB,GAAkB,OAAO,CAAC;AAEpD,IAAM,eAAe,GAAG,UAAC,GAAY;IAC1C,OAAC,uBAAsC,CAAC,QAAQ,CAAC,GAAG,CAAC;AAArD,CAAqD,CAAC;AAD3C,QAAA,eAAe,mBAC4B;AAExD;;;;;;GAMG;AACI,IAAM,kBAAkB,GAAG,UAAC,GAAY;IAC7C,OAAA,IAAA,uBAAe,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,8BAAsB;AAAnD,CAAmD,CAAC;AADzC,QAAA,kBAAkB,sBACuB","sourcesContent":["import { ParamsDictionary, Query } from 'express-serve-static-core';\nimport { Address, AssetPair } 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// Database-shaped perp execution row exposed by provider and API types.\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 execution_type: number | 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_adl_unwind_price: 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 /**\n * Funding settled at the position's fills since its session opened (raw\n * E18, RET-281). Stored by the indexer; absent from trade-stream rows, whose\n * consumers derive it with `nextSessionSettledFunding`. Null while unknown.\n */\n session_settled_funding?: 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\n// Matches the app's account-name field.\nexport const ACCOUNT_NAME_MAX_LENGTH = 25;\n\n// Control, format (bidi, zero-width), surrogate and private-use code points,\n// plus the line and paragraph separators. Not unassigned (Cn): that set\n// depends on the runtime's Unicode tables and would reject newer emoji.\n// Sequence emoji joined by U+200D (ZWJ) or tag characters are rejected too.\nconst ACCOUNT_NAME_FORBIDDEN = /[\\p{Cc}\\p{Cf}\\p{Cs}\\p{Co}\\u2028\\u2029]/u;\n\n/**\n * The trimmed account name, or null when it is not a non-empty string of at\n * most ACCOUNT_NAME_MAX_LENGTH characters free of forbidden code points.\n * Shared by the rename endpoint and the relay's account-creation name.\n */\nexport const parseAccountName = (raw: unknown): string | null => {\n if (typeof raw !== 'string') return null;\n const name = raw.trim();\n return name.length > 0 &&\n name.length <= ACCOUNT_NAME_MAX_LENGTH &&\n !ACCOUNT_NAME_FORBIDDEN.test(name)\n ? name\n : null;\n};\n\n/**\n * Allow-listed `AccountProfile.source` values, set once when the relay writes\n * the profile of a new account from `metadata.accountSource`. 'reya' is the\n * default, 'rage' the Rage Trade integration, and 'agent' marks the Agent\n * account, which the V2 API reports as `AGENTPERP`.\n */\nexport const ACCOUNT_SOURCES = ['reya', 'rage', 'agent'] as const;\nexport type AccountSource = (typeof ACCOUNT_SOURCES)[number];\nexport const DEFAULT_ACCOUNT_SOURCE: AccountSource = 'reya';\nexport const AGENT_ACCOUNT_SOURCE: AccountSource = 'agent';\n\nexport const isAccountSource = (raw: unknown): raw is AccountSource =>\n (ACCOUNT_SOURCES as readonly unknown[]).includes(raw);\n\n/**\n * The source exactly as sent when it is allow-listed, otherwise\n * DEFAULT_ACCOUNT_SOURCE. Unknown values are normalised, not rejected: the\n * account already exists on-chain when its profile is written, and rejecting\n * would only lose the account name. Matching is exact, so only 'agent' makes\n * an Agent account.\n */\nexport const parseAccountSource = (raw: unknown): AccountSource =>\n isAccountSource(raw) ? raw : DEFAULT_ACCOUNT_SOURCE;\n\n/** Body of `PUT /api/trading/wallet/:address/account/:accountId/name`. */\nexport type UpdateAccountNameBody = { name: string };\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 // Order attribution is absent for auto-exchange executions: there is no\n // matched order, so the chain emits no exchange/order ids and the DB\n // columns are NULL. Matches the `spot_executions` Prisma model.\n exchange_id: Decimal | null;\n executed_base: Decimal;\n price: Decimal;\n account_order_id: bigint | null;\n counterparty_order_id: bigint | null;\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 /** The wallet's volume over the trailing 14 days. */\n volume_14d: Decimal;\n /** The wallet's volume over the trailing `lookback_window_seconds`. */\n lookback_volume: Decimal;\n lookback_window_seconds: number;\n};\n\ntype BalanceHistoryPoint = {\n timestamp: number;\n balance: number;\n /**\n * PnL since the first point: the change in balance minus the change in\n * net deposits, withdrawals and transfers.\n */\n pnl: number;\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 /** ME mark price, despite the name. Surfaced as v2 `MarketSummary.markPrice`. */\n oraclePrice?: number;\n /**\n * Orderbook mid. Absent on an empty or one-sided book\n */\n poolPrice?: number;\n /**\n * Stork index price, rUSD-quoted (divided by USDCUSD, like the collateral\n * feeds). Surfaced as v2 `MarketSummary.oraclePrice` — the name differs\n * because the v1 `oraclePrice` above is already taken by the mark price.\n * Absent when the index feed has no fresh tick.\n */\n indexPrice?: 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 /** Stork price for the base token, rUSD-quoted (divided by USDCUSD). */\n oraclePrice?: number;\n /**\n * Spot orderbook mid, read from the ME `{depth}:bbo:<id>` key. Absent on an\n * empty or one-sided book — spot has no mark price to fall back to, unlike\n * the perp `poolPrice` above.\n */\n throttledMidPrice?: 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 'poolBalance/:poolId/apy-history': TradingApiEndpoint<\n { timestampInMs: number; apy: number }[],\n { poolId?: string },\n never,\n { timestampInMs: number; apy: number }[],\n { timeframeMs: string; granularity: string }\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 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 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 AccountOrdersMap.\n // Bridge deposits and withdrawals for a wallet. Rows are registered by the\n // Reya app when it broadcasts the source-chain transaction, and reconciled\n // by the pending-transaction cron -- nothing else writes them, which is why\n // this is a v1 app endpoint rather than part of the general v2 API.\n 'wallet/:address/bridgeTransactions': TradingApiListEndpoint<\n bridge_transactions_margin_account,\n AddressParam,\n 'BridgeTransactionsMarginAccount'\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 BalanceHistoryPoint,\n {\n address: string;\n timestamp: string;\n },\n never,\n BalanceHistoryPoint,\n {\n /**\n * Comma-separated ids of the wallet's accounts to sum (e.g. the main\n * account, or one sub-account). Omitted: every account of the wallet.\n */\n accountIds?: 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 '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 // PUT with an `UpdateAccountNameBody` and a Dynamic `Authorization: Bearer`\n // token; only the account's owner may rename it.\n 'wallet/:address/account/:accountId/name': TradingApiEndpoint<\n Account,\n {\n address: string;\n accountId: 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\nexport interface OrdersGatewayPermissionUpdatedStreamResult {\n owner: string;\n delegate: string;\n permission_state: boolean;\n event_sequence_number: string;\n block_number: string;\n block_timestamp: string;\n transaction_hash: string | null;\n}\n\nexport interface PerpTradeStreamPosition {\n account_id: Decimal;\n base: Decimal;\n base_multiplier: Decimal;\n funding_value: Decimal;\n adl_unwind_price: Decimal;\n last_price: Decimal;\n last_price_timestamp: Decimal;\n realized_pnl: Decimal;\n average_entry_funding_value: Decimal;\n session: Decimal;\n}\n\nexport interface PerpTradeStreamResult {\n id: string;\n event_sequence_number: Decimal;\n me_nonce: Decimal;\n market_id: Decimal;\n account_id: Decimal;\n counterparty_account_id: Decimal;\n /** Lowercased owner of `account_id`; absent for account 0 (PRO-1172). */\n account_owner?: string;\n /** Lowercased owner of `counterparty_account_id`; absent for account 0. */\n counterparty_account_owner?: string;\n executed_base: Decimal;\n fee: Decimal;\n price: Decimal;\n is_match_order: boolean;\n liquidation_type: Decimal;\n execution_type: number;\n protocol_fee_credit: Decimal;\n taker_rebate_credit: Decimal;\n pool_fee_credit: Decimal;\n exchange_fee_credit: null;\n maker_fee_credit: null;\n maker_fee_debit: null;\n account_order_id: Decimal;\n counterparty_order_id: Decimal;\n position_previous_average_entry_funding_value: Decimal;\n position_previous_adl_unwind_price: Decimal;\n position_previous_base_multiplier: Decimal;\n position_previous_funding_value: Decimal;\n position_previous_last_price: Decimal;\n position_previous_realized_pnl: Decimal;\n counterparty_previous_average_entry_funding_value: Decimal;\n counterparty_previous_adl_unwind_price: Decimal;\n counterparty_previous_base_multiplier: Decimal;\n counterparty_previous_funding_value: Decimal;\n counterparty_previous_last_price: Decimal;\n counterparty_previous_realized_pnl: Decimal;\n block_timestamp: Decimal;\n block_number: Decimal;\n transaction_hash: string;\n unique_id: bigint;\n exchange_id: Decimal;\n referrer_account_id: Decimal;\n referrer_fee_credit: Decimal;\n account: PerpTradeStreamPosition;\n counterparty: PerpTradeStreamPosition;\n}\n\nexport type PerpTradeStreamMessage = GenericReplicationMessage<\n PerpTradeStreamResult,\n 'trade'\n>;\n\nexport interface BalanceStreamSide {\n account_id: Decimal;\n balance: Decimal;\n /** Lowercased owner address (address(0) for account 0); part of the ledger enrichment. */\n owner?: string;\n}\n\n/**\n * One built leg of a Transfers event. The account ledger fields (PRO-852,\n * design §3.2) label and link the leg the same way its account_transfers row\n * is: `type` from command type and leg position, `fill_id` (ME nonce) and\n * `market_id` for perp fills settled after reya-network#752,\n * `spot_execution_sequence_number` / `spot_market_id` for spot trades and\n * auto-exchanges. Consumers that only track balances ignore them.\n */\nexport interface BalanceStreamTransfer {\n transfer_event_sequence_number: Decimal;\n collateral: string;\n from: BalanceStreamSide;\n to: BalanceStreamSide;\n // The ledger enrichment (PRO-852), included on all newly published legs;\n // a leg without it feeds the balances rail and nothing else.\n /** Position of the leg in the event's array. */\n leg_index?: number;\n /** Amount moved (`netDepositsDelta`), raw token units, always positive. */\n amount?: Decimal;\n /** TransferType label; OTHER when the leg is not recognised. */\n type?: string;\n fill_id?: Decimal | null;\n market_id?: Decimal | null;\n spot_execution_sequence_number?: Decimal | null;\n spot_market_id?: Decimal | null;\n}\n\n/** A leg as published while the ledger is on: every enrichment field present. */\nexport type EnrichedBalanceStreamTransfer = Required<\n Omit<BalanceStreamTransfer, 'from' | 'to'>\n> & {\n from: Required<BalanceStreamSide>;\n to: Required<BalanceStreamSide>;\n};\n\nexport interface BalanceStreamResult {\n event_sequence_number: Decimal;\n block_timestamp: Decimal;\n block_number: Decimal;\n transaction_hash: string;\n command_type: Decimal;\n me_nonce: Decimal | null;\n spot_market_id: Decimal | null;\n account_id: Decimal | null;\n counterparty_account_id: Decimal | null;\n /** The ME perp fill a MatchOrder entry settles; null otherwise. */\n perp_fill: { market_id: Decimal; me_nonce: Decimal } | null;\n transfers: BalanceStreamTransfer[];\n}\n\nexport type BalanceStreamMessage = GenericReplicationMessage<\n BalanceStreamResult,\n 'transfers'\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\n// Bridge-carried money-in/out transactions, recorded as soon as the source\n// chain tx is broadcast and reconciled once the bridge delivers. Declared with\n// the database's own types; `Stringified<>` maps Date and Decimal to strings\n// for the replication payload.\ntype bridge_transactions_margin_account = {\n source_tx_hash: string;\n destination_tx_hash: string | null;\n source_chain_id: number;\n destination_chain_id: number;\n account_id: Decimal;\n status: string;\n amount: Decimal;\n type: string;\n asset_id: string;\n createdAt: Date;\n updatedAt: Date;\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 OrdersGatewayPermissionUpdatedStreamResult,\n 'orders_gateway_permission'\n >\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<spot_execution, 'spot_executions'>\n | GenericReplicationMessage<Order, 'orders'>\n | GenericReplicationMessage<execution_bust, 'execution_busts'>\n | GenericReplicationMessage<\n bridge_transactions_margin_account,\n 'BridgeTransactionsMarginAccount'\n >;\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"]}
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;AA6HF,wCAAwC;AAC3B,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAE1C,6EAA6E;AAC7E,wEAAwE;AACxE,wEAAwE;AACxE,4EAA4E;AAC5E,IAAM,sBAAsB,GAAG,yCAAyC,CAAC;AAEzE;;;;GAIG;AACI,IAAM,gBAAgB,GAAG,UAAC,GAAY;IAC3C,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzC,IAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACxB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC;QACpB,IAAI,CAAC,MAAM,IAAI,+BAAuB;QACtC,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC;QAClC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B;AAEF;;;;;GAKG;AACU,QAAA,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAErD,QAAA,sBAAsB,GAAkB,MAAM,CAAC;AAC/C,QAAA,oBAAoB,GAAkB,OAAO,CAAC;AAEpD,IAAM,eAAe,GAAG,UAAC,GAAY;IAC1C,OAAC,uBAAsC,CAAC,QAAQ,CAAC,GAAG,CAAC;AAArD,CAAqD,CAAC;AAD3C,QAAA,eAAe,mBAC4B;AAExD;;;;;;GAMG;AACI,IAAM,kBAAkB,GAAG,UAAC,GAAY;IAC7C,OAAA,IAAA,uBAAe,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,8BAAsB;AAAnD,CAAmD,CAAC;AADzC,QAAA,kBAAkB,sBACuB","sourcesContent":["import { ParamsDictionary, Query } from 'express-serve-static-core';\nimport { Address, AssetPair } 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// Database-shaped perp execution row exposed by provider and API types.\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 execution_type: number | 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_adl_unwind_price: 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 /**\n * Funding settled at the position's fills since its session opened (raw\n * E18, RET-281). Stored by the indexer; absent from trade-stream rows, whose\n * consumers derive it with `nextSessionSettledFunding`. Null while unknown.\n */\n session_settled_funding?: 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\n// Matches the app's account-name field.\nexport const ACCOUNT_NAME_MAX_LENGTH = 25;\n\n// Control, format (bidi, zero-width), surrogate and private-use code points,\n// plus the line and paragraph separators. Not unassigned (Cn): that set\n// depends on the runtime's Unicode tables and would reject newer emoji.\n// Sequence emoji joined by U+200D (ZWJ) or tag characters are rejected too.\nconst ACCOUNT_NAME_FORBIDDEN = /[\\p{Cc}\\p{Cf}\\p{Cs}\\p{Co}\\u2028\\u2029]/u;\n\n/**\n * The trimmed account name, or null when it is not a non-empty string of at\n * most ACCOUNT_NAME_MAX_LENGTH characters free of forbidden code points.\n * Shared by the rename endpoint and the relay's account-creation name.\n */\nexport const parseAccountName = (raw: unknown): string | null => {\n if (typeof raw !== 'string') return null;\n const name = raw.trim();\n return name.length > 0 &&\n name.length <= ACCOUNT_NAME_MAX_LENGTH &&\n !ACCOUNT_NAME_FORBIDDEN.test(name)\n ? name\n : null;\n};\n\n/**\n * Allow-listed `AccountProfile.source` values, set once when the relay writes\n * the profile of a new account from `metadata.accountSource`. 'reya' is the\n * default, 'rage' the Rage Trade integration, and 'agent' marks the Agent\n * account, which the V2 API reports as `AGENTPERP`.\n */\nexport const ACCOUNT_SOURCES = ['reya', 'rage', 'agent'] as const;\nexport type AccountSource = (typeof ACCOUNT_SOURCES)[number];\nexport const DEFAULT_ACCOUNT_SOURCE: AccountSource = 'reya';\nexport const AGENT_ACCOUNT_SOURCE: AccountSource = 'agent';\n\nexport const isAccountSource = (raw: unknown): raw is AccountSource =>\n (ACCOUNT_SOURCES as readonly unknown[]).includes(raw);\n\n/**\n * The source exactly as sent when it is allow-listed, otherwise\n * DEFAULT_ACCOUNT_SOURCE. Unknown values are normalised, not rejected: the\n * account already exists on-chain when its profile is written, and rejecting\n * would only lose the account name. Matching is exact, so only 'agent' makes\n * an Agent account.\n */\nexport const parseAccountSource = (raw: unknown): AccountSource =>\n isAccountSource(raw) ? raw : DEFAULT_ACCOUNT_SOURCE;\n\n/** Body of `PUT /api/trading/wallet/:address/account/:accountId/name`. */\nexport type UpdateAccountNameBody = { name: string };\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 // Order attribution is absent for auto-exchange executions: there is no\n // matched order, so the chain emits no exchange/order ids and the DB\n // columns are NULL. Matches the `spot_executions` Prisma model.\n exchange_id: Decimal | null;\n executed_base: Decimal;\n price: Decimal;\n account_order_id: bigint | null;\n counterparty_order_id: bigint | null;\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 /** The wallet's taker volume over the trailing 14 days, in dollars. */\n volume_14d: Decimal;\n /**\n * Taker volume on match executions over the last `lookback_window_seconds`,\n * in dollars: what the ladder compares with its thresholds.\n */\n lookback_volume: Decimal;\n /** The ladder's volume window, in seconds. */\n lookback_window_seconds: number;\n /** The tier the tier job holds the wallet on (the on-chain tier until it has a row). */\n tier_id: number;\n /** When `tier_id` last changed, in milliseconds. */\n tier_since: number | null;\n /** Highest ladder tier ever earned; status-match trial time does not count. */\n highest_tier_id: number | null;\n /** Start of the current unbroken run at Gold or above, in milliseconds. */\n gold_plus_since: number | null;\n /** Start of the current unbroken run at VIP1 or above, in milliseconds. */\n vip1_plus_since: number | null;\n /** The tier the 14-day volume earns. */\n live_tier_id: number;\n next_tier_id: number | null;\n /** Dollars of 14-day volume still needed for `next_tier_id`. */\n volume_to_next_tier: Decimal | null;\n /** The open deadline protecting `tier_id`, in milliseconds. */\n deadline_until: number | null;\n deadline_reason: 'grace' | 'status_match' | null;\n /** Dollars to trade before the deadline to keep `tier_id`. */\n volume_to_hold: Decimal | null;\n /**\n * Dollars of taker fees saved against Standard's rate over the last\n * `lookback_window_seconds` (14 days), before rebates; about 0 on Standard.\n */\n fees_saved_vs_standard: Decimal;\n};\n\ntype BalanceHistoryPoint = {\n timestamp: number;\n balance: number;\n /**\n * PnL since the first point: the change in balance minus the change in\n * net deposits, withdrawals and transfers.\n */\n pnl: number;\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 /** ME mark price, despite the name. Surfaced as v2 `MarketSummary.markPrice`. */\n oraclePrice?: number;\n /**\n * Orderbook mid. Absent on an empty or one-sided book\n */\n poolPrice?: number;\n /**\n * Stork index price, rUSD-quoted (divided by USDCUSD, like the collateral\n * feeds). Surfaced as v2 `MarketSummary.oraclePrice` — the name differs\n * because the v1 `oraclePrice` above is already taken by the mark price.\n * Absent when the index feed has no fresh tick.\n */\n indexPrice?: 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 /** Stork price for the base token, rUSD-quoted (divided by USDCUSD). */\n oraclePrice?: number;\n /**\n * Spot orderbook mid, read from the ME `{depth}:bbo:<id>` key. Absent on an\n * empty or one-sided book — spot has no mark price to fall back to, unlike\n * the perp `poolPrice` above.\n */\n throttledMidPrice?: 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 'poolBalance/:poolId/apy-history': TradingApiEndpoint<\n { timestampInMs: number; apy: number }[],\n { poolId?: string },\n never,\n { timestampInMs: number; apy: number }[],\n { timeframeMs: string; granularity: string }\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 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 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 AccountOrdersMap.\n // Bridge deposits and withdrawals for a wallet. Rows are registered by the\n // Reya app when it broadcasts the source-chain transaction, and reconciled\n // by the pending-transaction cron -- nothing else writes them, which is why\n // this is a v1 app endpoint rather than part of the general v2 API.\n 'wallet/:address/bridgeTransactions': TradingApiListEndpoint<\n bridge_transactions_margin_account,\n AddressParam,\n 'BridgeTransactionsMarginAccount'\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 BalanceHistoryPoint,\n {\n address: string;\n timestamp: string;\n },\n never,\n BalanceHistoryPoint,\n {\n /**\n * Comma-separated ids of the wallet's accounts to sum (e.g. the main\n * account, or one sub-account). Omitted: every account of the wallet.\n */\n accountIds?: 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 /**\n * Taker volume over `lookback_window_seconds` a wallet needs for the tier;\n * 0 for tier 0 and special tiers.\n */\n volume: Decimal;\n /** The window `volume` is measured over, in seconds. */\n lookback_window_seconds: number;\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 '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 // PUT with an `UpdateAccountNameBody` and a Dynamic `Authorization: Bearer`\n // token; only the account's owner may rename it.\n 'wallet/:address/account/:accountId/name': TradingApiEndpoint<\n Account,\n {\n address: string;\n accountId: 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\nexport interface OrdersGatewayPermissionUpdatedStreamResult {\n owner: string;\n delegate: string;\n permission_state: boolean;\n event_sequence_number: string;\n block_number: string;\n block_timestamp: string;\n transaction_hash: string | null;\n}\n\nexport interface PerpTradeStreamPosition {\n account_id: Decimal;\n base: Decimal;\n base_multiplier: Decimal;\n funding_value: Decimal;\n adl_unwind_price: Decimal;\n last_price: Decimal;\n last_price_timestamp: Decimal;\n realized_pnl: Decimal;\n average_entry_funding_value: Decimal;\n session: Decimal;\n}\n\nexport interface PerpTradeStreamResult {\n id: string;\n event_sequence_number: Decimal;\n me_nonce: Decimal;\n market_id: Decimal;\n account_id: Decimal;\n counterparty_account_id: Decimal;\n /** Lowercased owner of `account_id`; absent for account 0 (PRO-1172). */\n account_owner?: string;\n /** Lowercased owner of `counterparty_account_id`; absent for account 0. */\n counterparty_account_owner?: string;\n executed_base: Decimal;\n fee: Decimal;\n price: Decimal;\n is_match_order: boolean;\n liquidation_type: Decimal;\n execution_type: number;\n protocol_fee_credit: Decimal;\n taker_rebate_credit: Decimal;\n pool_fee_credit: Decimal;\n exchange_fee_credit: null;\n maker_fee_credit: null;\n maker_fee_debit: null;\n account_order_id: Decimal;\n counterparty_order_id: Decimal;\n position_previous_average_entry_funding_value: Decimal;\n position_previous_adl_unwind_price: Decimal;\n position_previous_base_multiplier: Decimal;\n position_previous_funding_value: Decimal;\n position_previous_last_price: Decimal;\n position_previous_realized_pnl: Decimal;\n counterparty_previous_average_entry_funding_value: Decimal;\n counterparty_previous_adl_unwind_price: Decimal;\n counterparty_previous_base_multiplier: Decimal;\n counterparty_previous_funding_value: Decimal;\n counterparty_previous_last_price: Decimal;\n counterparty_previous_realized_pnl: Decimal;\n block_timestamp: Decimal;\n block_number: Decimal;\n transaction_hash: string;\n unique_id: bigint;\n exchange_id: Decimal;\n referrer_account_id: Decimal;\n referrer_fee_credit: Decimal;\n account: PerpTradeStreamPosition;\n counterparty: PerpTradeStreamPosition;\n}\n\nexport type PerpTradeStreamMessage = GenericReplicationMessage<\n PerpTradeStreamResult,\n 'trade'\n>;\n\nexport interface BalanceStreamSide {\n account_id: Decimal;\n balance: Decimal;\n /** Lowercased owner address (address(0) for account 0); part of the ledger enrichment. */\n owner?: string;\n}\n\n/**\n * One built leg of a Transfers event. The account ledger fields (PRO-852,\n * design §3.2) label and link the leg the same way its account_transfers row\n * is: `type` from command type and leg position, `fill_id` (ME nonce) and\n * `market_id` for perp fills settled after reya-network#752,\n * `spot_execution_sequence_number` / `spot_market_id` for spot trades and\n * auto-exchanges. Consumers that only track balances ignore them.\n */\nexport interface BalanceStreamTransfer {\n transfer_event_sequence_number: Decimal;\n collateral: string;\n from: BalanceStreamSide;\n to: BalanceStreamSide;\n // The ledger enrichment (PRO-852), included on all newly published legs;\n // a leg without it feeds the balances rail and nothing else.\n /** Position of the leg in the event's array. */\n leg_index?: number;\n /** Amount moved (`netDepositsDelta`), raw token units, always positive. */\n amount?: Decimal;\n /** TransferType label; OTHER when the leg is not recognised. */\n type?: string;\n fill_id?: Decimal | null;\n market_id?: Decimal | null;\n spot_execution_sequence_number?: Decimal | null;\n spot_market_id?: Decimal | null;\n}\n\n/** A leg as published while the ledger is on: every enrichment field present. */\nexport type EnrichedBalanceStreamTransfer = Required<\n Omit<BalanceStreamTransfer, 'from' | 'to'>\n> & {\n from: Required<BalanceStreamSide>;\n to: Required<BalanceStreamSide>;\n};\n\nexport interface BalanceStreamResult {\n event_sequence_number: Decimal;\n block_timestamp: Decimal;\n block_number: Decimal;\n transaction_hash: string;\n command_type: Decimal;\n me_nonce: Decimal | null;\n spot_market_id: Decimal | null;\n account_id: Decimal | null;\n counterparty_account_id: Decimal | null;\n /** The ME perp fill a MatchOrder entry settles; null otherwise. */\n perp_fill: { market_id: Decimal; me_nonce: Decimal } | null;\n transfers: BalanceStreamTransfer[];\n}\n\nexport type BalanceStreamMessage = GenericReplicationMessage<\n BalanceStreamResult,\n 'transfers'\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\n// Bridge-carried money-in/out transactions, recorded as soon as the source\n// chain tx is broadcast and reconciled once the bridge delivers. Declared with\n// the database's own types; `Stringified<>` maps Date and Decimal to strings\n// for the replication payload.\ntype bridge_transactions_margin_account = {\n source_tx_hash: string;\n destination_tx_hash: string | null;\n source_chain_id: number;\n destination_chain_id: number;\n account_id: Decimal;\n status: string;\n amount: Decimal;\n type: string;\n asset_id: string;\n createdAt: Date;\n updatedAt: Date;\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 OrdersGatewayPermissionUpdatedStreamResult,\n 'orders_gateway_permission'\n >\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<spot_execution, 'spot_executions'>\n | GenericReplicationMessage<Order, 'orders'>\n | GenericReplicationMessage<execution_bust, 'execution_busts'>\n | GenericReplicationMessage<\n bridge_transactions_margin_account,\n 'BridgeTransactionsMarginAccount'\n >;\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"]}
@@ -187,11 +187,40 @@ type Leverage = {
187
187
  updatedAt: Date;
188
188
  };
189
189
  type WalletStats = {
190
- /** The wallet's volume over the trailing 14 days. */
190
+ /** The wallet's taker volume over the trailing 14 days, in dollars. */
191
191
  volume_14d: Decimal;
192
- /** The wallet's volume over the trailing `lookback_window_seconds`. */
192
+ /**
193
+ * Taker volume on match executions over the last `lookback_window_seconds`,
194
+ * in dollars: what the ladder compares with its thresholds.
195
+ */
193
196
  lookback_volume: Decimal;
197
+ /** The ladder's volume window, in seconds. */
194
198
  lookback_window_seconds: number;
199
+ /** The tier the tier job holds the wallet on (the on-chain tier until it has a row). */
200
+ tier_id: number;
201
+ /** When `tier_id` last changed, in milliseconds. */
202
+ tier_since: number | null;
203
+ /** Highest ladder tier ever earned; status-match trial time does not count. */
204
+ highest_tier_id: number | null;
205
+ /** Start of the current unbroken run at Gold or above, in milliseconds. */
206
+ gold_plus_since: number | null;
207
+ /** Start of the current unbroken run at VIP1 or above, in milliseconds. */
208
+ vip1_plus_since: number | null;
209
+ /** The tier the 14-day volume earns. */
210
+ live_tier_id: number;
211
+ next_tier_id: number | null;
212
+ /** Dollars of 14-day volume still needed for `next_tier_id`. */
213
+ volume_to_next_tier: Decimal | null;
214
+ /** The open deadline protecting `tier_id`, in milliseconds. */
215
+ deadline_until: number | null;
216
+ deadline_reason: 'grace' | 'status_match' | null;
217
+ /** Dollars to trade before the deadline to keep `tier_id`. */
218
+ volume_to_hold: Decimal | null;
219
+ /**
220
+ * Dollars of taker fees saved against Standard's rate over the last
221
+ * `lookback_window_seconds` (14 days), before rebates; about 0 on Standard.
222
+ */
223
+ fees_saved_vs_standard: Decimal;
195
224
  };
196
225
  type BalanceHistoryPoint = {
197
226
  timestamp: number;
@@ -399,7 +428,13 @@ export type TradingApiSource = {
399
428
  tier_id: Decimal;
400
429
  taker_fee: Decimal;
401
430
  maker_fee: Decimal;
431
+ /**
432
+ * Taker volume over `lookback_window_seconds` a wallet needs for the tier;
433
+ * 0 for tier 0 and special tiers.
434
+ */
402
435
  volume: Decimal;
436
+ /** The window `volume` is measured over, in seconds. */
437
+ lookback_window_seconds: number;
403
438
  }>;
404
439
  globalFeeParameters: TradingApiEndpoint<{
405
440
  og_discount: Decimal;
@@ -1 +1 @@
1
- {"version":3,"file":"trading-api-types.d.ts","sourceRoot":"/","sources":["trading-api-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EACL,YAAY,EACZ,WAAW,EACX,uBAAuB,EACvB,eAAe,EACf,OAAO,EACP,oBAAoB,EACpB,WAAW,EACZ,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC;AAEF,MAAM,MAAM,aAAa,GACvB,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,KAAK,gBAAgB,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC;AAEtE,KAAK,MAAM,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,SAAS,CAAC;IACvB,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AAGF,KAAK,KAAK,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IAC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,kBAAkB,EAClB;QAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA;KAAE,CACtB;CACF,CAAC"}
@@ -7,9 +7,12 @@ export declare const RANKS: Record<number, Rank>;
7
7
  export declare const RANKS_TRADING: Record<number, RankTrading>;
8
8
  export declare const INSTANT_TRADING_RATE_XP = 2;
9
9
  export declare const TRADING_LOTTERY_BOOST = 10;
10
- export declare const VOLUME_LOOKBACK_WINDOW_IN_SECONDS: number;
10
+ /**
11
+ * The previous 30-day ladder's thresholds, still reported as V2's deprecated
12
+ * `volume30d`. No tier job reads it: the RET-245 job assigns tiers from
13
+ * FEE_TIER_LADDER only (`fee-tier-ladder.ts`).
14
+ */
11
15
  export declare const VOLUME_TIER_MAP: Record<number, number>;
12
- export declare const FEE_TIER_VOLUME_LOOKBACK_WINDOW_IN_SECONDS: number;
13
16
  export declare const TIER_TYPE_MAP: Record<number, TierType>;
14
17
  export declare const SPECIAL_TIER_THRESHOLD = 100;
15
18
  export declare const MA_HEALTH_DANGER_THRESHOLD = 95;
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"/","sources":["utils/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEvD,eAAO,MAAM,WAAW,QAAe,CAAC;AACxC,eAAO,MAAM,WAAW,EAAE,MAAa,CAAC;AAExC,eAAO,MAAM,kBAAkB,EAAE,MAAqB,CAAC;AAEvD,eAAO,MAAM,mBAAmB,UAmB/B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAwDtC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAiBrD,CAAC;AAEF,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,eAAO,MAAM,iCAAiC,QAAoB,CAA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CAYlD,CAAC;AAEF,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAC7C,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C,eAAO,MAAM,8BAA8B,QAAqB,CAAC;AACjE,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAC7C,eAAO,MAAM,oBAAoB,SAAU,MAAM,KAAG,MAGnD,CAAC;AAEF,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B,eAAO,MAAM,gBAAgB,iBAAkB,OAAO,KAAG,MAExD,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * RET-245 Wave 1 fee ladder, read by the hourly tier job (updateTierId) and
3
+ * the fee-tier API (the status-match one-off SQL repeats its rates). A tier is earned by trailing
4
+ * 14-day taker volume on match executions (no liquidations or ADL), across
5
+ * all of a wallet's accounts and markets. The ladder reuses the on-chain tier
6
+ * IDs; `takerFee` is the rate the chain must hold for the ID, as the raw
7
+ * UD60x18 integer (1e14 = 1bp), so the job can refuse to run against any
8
+ * other ladder. Special tiers (>= SPECIAL_TIER_THRESHOLD) are not on it.
9
+ */
10
+ export type FeeTierRung = {
11
+ tierId: number;
12
+ name: string;
13
+ /** Minimum trailing 14-day taker volume, in whole dollars. */
14
+ minVolume: number;
15
+ takerFee: string;
16
+ };
17
+ export declare const FEE_TIER_LADDER: readonly FeeTierRung[];
18
+ export declare const FEE_TIER_VOLUME_WINDOW_IN_SECONDS: number;
19
+ /** How long a wallet keeps its tier after its volume falls below it. */
20
+ export declare const FEE_TIER_GRACE_IN_SECONDS: number;
21
+ /**
22
+ * How long after a deadline the job waits before judging it, so fills from
23
+ * just before the deadline are indexed by then. The deadline itself, and the
24
+ * 14 days ending at it that decide, are unchanged.
25
+ */
26
+ export declare const FEE_TIER_DEADLINE_BUFFER_IN_SECONDS: number;
27
+ /** How long a status match holds Gold while the wallet works towards it. */
28
+ export declare const FEE_TIER_STATUS_MATCH_IN_SECONDS: number;
29
+ /** The merch tenure tiers: Gold+ (t-shirt) and VIP1+ (hoodie). */
30
+ export declare const FEE_TIER_GOLD_TIER_ID = 3;
31
+ export declare const FEE_TIER_VIP1_TIER_ID = 4;
32
+ export declare const FEE_TIER_TOP_TIER_ID = 8;
33
+ /**
34
+ * Whether the on-chain taker rates of IDs 0-8 (`takerFees[tierId]`, raw
35
+ * UD60x18 decimal strings; a missing ID reads as unset) are exactly
36
+ * FEE_TIER_LADDER's. Only the taker rate is compared: the maker fields are
37
+ * inert and zeroed by the launch batch.
38
+ */
39
+ export declare const holdsFeeTierLadder: (takerFees: Readonly<Record<number, string | undefined>>) => boolean;
40
+ export declare const isFeeTierLadderId: (tierId: number) => boolean;
41
+ /** The rung of a ladder ID; throws for any other ID. */
42
+ export declare const feeTierRung: (tierId: number) => FeeTierRung;
43
+ /** A tier's 14-day volume threshold in dollars; 0 for IDs off the ladder. */
44
+ export declare const feeTierMinVolume: (tierId: number) => number;
45
+ //# sourceMappingURL=fee-tier-ladder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fee-tier-ladder.d.ts","sourceRoot":"/","sources":["utils/fee-tier-ladder.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,WAAW,EAkDjD,CAAC;AAEF,eAAO,MAAM,iCAAiC,QAA0B,CAAC;AACzE,wEAAwE;AACxE,eAAO,MAAM,yBAAyB,QAAyB,CAAC;AAChE;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,QAAc,CAAC;AAC/D,4EAA4E;AAC5E,eAAO,MAAM,gCAAgC,QAA0B,CAAC;AACxE,kEAAkE;AAClE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,cAClB,SAAS,OAAO,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,KACtD,OACwE,CAAC;AAE5E,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,OACwB,CAAC;AAE5E,wDAAwD;AACxD,eAAO,MAAM,WAAW,WAAY,MAAM,KAAG,WAI5C,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,gBAAgB,WAAY,MAAM,KAAG,MACT,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './consts';
2
+ export * from './fee-tier-ladder';
2
3
  export * from './points';
3
4
  export * from './calculate';
4
5
  export * from './compute-trade-pnl';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPoolAccountId = exports.REYA_DEX_ID = exports.applySocketFeeBuffer = exports.SOCKET_EMPTY_PAYLOAD_SIZE = exports.SOCKET_BRIDGE_IN_MSG_GAS_LIMIT = exports.MA_HEALTH_WARNING_THRESHOLD = exports.MA_HEALTH_DANGER_THRESHOLD = exports.SPECIAL_TIER_THRESHOLD = exports.TIER_TYPE_MAP = exports.FEE_TIER_VOLUME_LOOKBACK_WINDOW_IN_SECONDS = exports.VOLUME_TIER_MAP = exports.VOLUME_LOOKBACK_WINDOW_IN_SECONDS = exports.TRADING_LOTTERY_BOOST = exports.INSTANT_TRADING_RATE_XP = exports.RANKS_TRADING = exports.RANKS = exports.WHITELISTED_WALLETS = exports.ONE_DAY_IN_SECONDS = exports.API_TIMEOUT = exports.MAX_UINT128 = void 0;
3
+ exports.getPoolAccountId = exports.REYA_DEX_ID = exports.applySocketFeeBuffer = exports.SOCKET_EMPTY_PAYLOAD_SIZE = exports.SOCKET_BRIDGE_IN_MSG_GAS_LIMIT = exports.MA_HEALTH_WARNING_THRESHOLD = exports.MA_HEALTH_DANGER_THRESHOLD = exports.SPECIAL_TIER_THRESHOLD = exports.TIER_TYPE_MAP = exports.VOLUME_TIER_MAP = exports.TRADING_LOTTERY_BOOST = exports.INSTANT_TRADING_RATE_XP = exports.RANKS_TRADING = exports.RANKS = exports.WHITELISTED_WALLETS = exports.ONE_DAY_IN_SECONDS = exports.API_TIMEOUT = exports.MAX_UINT128 = void 0;
4
4
  var types_1 = require("../types");
5
5
  exports.MAX_UINT128 = Math.pow(2, 128) - 1;
6
6
  exports.API_TIMEOUT = 2500;
@@ -102,7 +102,11 @@ exports.RANKS_TRADING = {
102
102
  };
103
103
  exports.INSTANT_TRADING_RATE_XP = 2;
104
104
  exports.TRADING_LOTTERY_BOOST = 10;
105
- exports.VOLUME_LOOKBACK_WINDOW_IN_SECONDS = 30 * 24 * 60 * 60;
105
+ /**
106
+ * The previous 30-day ladder's thresholds, still reported as V2's deprecated
107
+ * `volume30d`. No tier job reads it: the RET-245 job assigns tiers from
108
+ * FEE_TIER_LADDER only (`fee-tier-ladder.ts`).
109
+ */
106
110
  exports.VOLUME_TIER_MAP = {
107
111
  0: 0, // Tier 0: $0 volume
108
112
  1: 1000000, // Tier 1: $1,000,000 volume
@@ -112,7 +116,6 @@ exports.VOLUME_TIER_MAP = {
112
116
  5: 1000000000, // Tier 5: $1,000,000,000 volume
113
117
  6: 5000000000, // Tier 6: $5,000,000,000 volume
114
118
  };
115
- exports.FEE_TIER_VOLUME_LOOKBACK_WINDOW_IN_SECONDS = 30 * exports.ONE_DAY_IN_SECONDS;
116
119
  exports.TIER_TYPE_MAP = {
117
120
  0: types_1.TierType.REGULAR,
118
121
  1: types_1.TierType.REGULAR,
@@ -121,6 +124,8 @@ exports.TIER_TYPE_MAP = {
121
124
  4: types_1.TierType.REGULAR,
122
125
  5: types_1.TierType.REGULAR,
123
126
  6: types_1.TierType.REGULAR,
127
+ 7: types_1.TierType.REGULAR,
128
+ 8: types_1.TierType.REGULAR,
124
129
  100: types_1.TierType.VIP,
125
130
  101: types_1.TierType.VIP,
126
131
  };
@@ -1 +1 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"/","sources":["utils/consts.ts"],"names":[],"mappings":";;;AAAA,kCAAuD;AAE1C,QAAA,WAAW,GAAG,SAAA,CAAC,EAAI,GAAG,CAAA,GAAG,CAAC,CAAC;AAC3B,QAAA,WAAW,GAAW,IAAI,CAAC;AAE3B,QAAA,kBAAkB,GAAW,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE1C,QAAA,mBAAmB,GAAG;IACjC,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C,EAAE,mCAAmC;IACjF,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C,EAAE,mBAAmB;IACjE,4CAA4C,EAAE,UAAU;IACxD,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C,EAAE,SAAS;CACxD,CAAC;AAEW,QAAA,KAAK,GAAyB;IACzC,CAAC,EAAE;QACD,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;KACf;IACD,CAAC,EAAE;QACD,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,OAAO;QACjB,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,EAAE;QACD,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,EAAE;QACD,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,OAAO;QACjB,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,EAAE;QACD,UA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BAE3B","sourcesContent":["import { Rank, RankTrading, TierType } from '../types';\n\nexport const MAX_UINT128 = 2 ** 128 - 1;\nexport const API_TIMEOUT: number = 2500;\n\nexport const ONE_DAY_IN_SECONDS: number = 60 * 60 * 24;\n\nexport const WHITELISTED_WALLETS = [\n '0xE116e2c0c2B0e7cd88060F06e2b2D7981Ef897ef',\n '0xb9db1789e8998eEDB6a53348Fe57Dcd080405cD4',\n '0x9A47F123916fC4745aCC6868D88450DC6056d335',\n '0x8d24B1663E80B4d1aB85e6B710Cd9178e475fd60',\n '0x1A0E5AbE817FDC9C000176183FA54e4B86940a83',\n '0x2b38d2d4FEcf085Eb7552607b5A5D631180015D6',\n '0xFcC63268172cDcf1Ae6D9dC572a10d0De7303C92',\n '0xDa0aA49cA0ca58939b76BaeCDcbfDb04b40CF6e8',\n '0xe33340635435BCA1E7686af89971D23525b2d8F8',\n '0xF8F6B70a36f4398f0853a311dC6699Aba8333Cc1', // internal dev account for testing\n '0x564aa5a2e98bdfcb876e8bcce129c18b6f052a0d',\n '0xaE173a960084903b1d278Ff9E3A81DeD82275556',\n '0x7aa47a9737395ae9e98E8b25aC97ee04b205dC22',\n '0xfd4295c1a0b07e6b706f0ab83dc9eb461b7f17b3', // input from simon\n '0x2fa11ef008c4b585ccf0a76861794ac7ae5a3a67', // brokoli\n '0x423063ed854736ae151B79032e4275AB57245173',\n '0xb89b383C26c2514907b6De5B6df96b2d97f425eC',\n '0x6C51275FD01d5DbD2DA194E92f920f8598306dF2', // Daniel\n];\n\nexport const RANKS: Record<number, Rank> = {\n 0: {\n rankNumber: 0,\n rankName: '',\n rankLetter: '',\n },\n 1: {\n rankNumber: 1,\n rankName: 'Alpha',\n rankLetter: 'α',\n },\n 2: {\n rankNumber: 2,\n rankName: 'Beta',\n rankLetter: 'β',\n },\n 3: {\n rankNumber: 3,\n rankName: 'Gamma',\n rankLetter: 'γ',\n },\n 4: {\n rankNumber: 4,\n rankName: 'Delta',\n rankLetter: 'δ',\n },\n 5: {\n rankNumber: 5,\n rankName: 'Epsilon',\n rankLetter: 'ε',\n },\n 6: {\n rankNumber: 6,\n rankName: 'Zeta',\n rankLetter: 'ζ',\n },\n 7: {\n rankNumber: 7,\n rankName: 'Eta',\n rankLetter: 'η',\n },\n 8: {\n rankNumber: 8,\n rankName: 'Theta',\n rankLetter: 'θ',\n },\n 9: {\n rankNumber: 9,\n rankName: 'Iota',\n rankLetter: 'ι',\n },\n 10: {\n rankNumber: 10,\n rankName: 'Kappa',\n rankLetter: 'κ',\n },\n};\n\nexport const RANKS_TRADING: Record<number, RankTrading> = {\n 0: {\n rankNumber: 0,\n rankName: '',\n },\n 1: {\n rankNumber: 1,\n rankName: 'Heracles',\n },\n 2: {\n rankNumber: 2,\n rankName: 'Perseus',\n },\n 3: {\n rankNumber: 3,\n rankName: 'Achilles',\n },\n};\n\nexport const INSTANT_TRADING_RATE_XP = 2;\nexport const TRADING_LOTTERY_BOOST = 10;\n\nexport const VOLUME_LOOKBACK_WINDOW_IN_SECONDS = 30 * 24 * 60 * 60;\n\nexport const VOLUME_TIER_MAP: Record<number, number> = {\n 0: 0, // Tier 0: $0 volume\n 1: 1_000_000, // Tier 1: $1,000,000 volume\n 2: 10_000_000, // Tier 2: $10,000,000 volume\n 3: 50_000_000, // Tier 3: $50,000,000 volume\n 4: 250_000_000, // Tier 4: $250,000,000 volume\n 5: 1_000_000_000, // Tier 5: $1,000,000,000 volume\n 6: 5_000_000_000, // Tier 6: $5,000,000,000 volume\n};\n\nexport const FEE_TIER_VOLUME_LOOKBACK_WINDOW_IN_SECONDS =\n 30 * ONE_DAY_IN_SECONDS;\n\nexport const TIER_TYPE_MAP: Record<number, TierType> = {\n 0: TierType.REGULAR,\n 1: TierType.REGULAR,\n 2: TierType.REGULAR,\n 3: TierType.REGULAR,\n 4: TierType.REGULAR,\n 5: TierType.REGULAR,\n 6: TierType.REGULAR,\n 100: TierType.VIP,\n 101: TierType.VIP,\n};\n\nexport const SPECIAL_TIER_THRESHOLD = 100;\n\nexport const MA_HEALTH_DANGER_THRESHOLD = 95;\nexport const MA_HEALTH_WARNING_THRESHOLD = 80;\n\nexport const SOCKET_BRIDGE_IN_MSG_GAS_LIMIT = BigInt('50000000');\nexport const SOCKET_EMPTY_PAYLOAD_SIZE = 160;\nexport const applySocketFeeBuffer = (fees: bigint): bigint => {\n // apply 10% buffer\n return (fees * BigInt(110)) / BigInt(100);\n};\n\nexport const REYA_DEX_ID = 2;\n\nexport const getPoolAccountId = (isProduction: boolean): number => {\n return isProduction ? 2 : 4;\n};\n"]}
1
+ {"version":3,"file":"consts.js","sourceRoot":"/","sources":["utils/consts.ts"],"names":[],"mappings":";;;AAAA,kCAAuD;AAE1C,QAAA,WAAW,GAAG,SAAA,CAAC,EAAI,GAAG,CAAA,GAAG,CAAC,CAAC;AAC3B,QAAA,WAAW,GAAW,IAAI,CAAC;AAE3B,QAAA,kBAAkB,GAAW,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE1C,QAAA,mBAAmB,GAAG;IACjC,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C,EAAE,mCAAmC;IACjF,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C,EAAE,mBAAmB;IACjE,4CAA4C,EAAE,UAAU;IACxD,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C,EAAE,SAAS;CACxD,CAAC;AAEW,QAAA,KAAK,GAAyB;IACzC,CAAC,EAAE;QACD,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;KACf;IACD,CAAC,EAAE;QACD,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,OAAO;QACjB,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,EAAE;QACD,UAAU,EAAE,CAAC;QACb,QAAQ,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,YAAqB;IACpD,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B","sourcesContent":["import { Rank, RankTrading, TierType } from '../types';\n\nexport const MAX_UINT128 = 2 ** 128 - 1;\nexport const API_TIMEOUT: number = 2500;\n\nexport const ONE_DAY_IN_SECONDS: number = 60 * 60 * 24;\n\nexport const WHITELISTED_WALLETS = [\n '0xE116e2c0c2B0e7cd88060F06e2b2D7981Ef897ef',\n '0xb9db1789e8998eEDB6a53348Fe57Dcd080405cD4',\n '0x9A47F123916fC4745aCC6868D88450DC6056d335',\n '0x8d24B1663E80B4d1aB85e6B710Cd9178e475fd60',\n '0x1A0E5AbE817FDC9C000176183FA54e4B86940a83',\n '0x2b38d2d4FEcf085Eb7552607b5A5D631180015D6',\n '0xFcC63268172cDcf1Ae6D9dC572a10d0De7303C92',\n '0xDa0aA49cA0ca58939b76BaeCDcbfDb04b40CF6e8',\n '0xe33340635435BCA1E7686af89971D23525b2d8F8',\n '0xF8F6B70a36f4398f0853a311dC6699Aba8333Cc1', // internal dev account for testing\n '0x564aa5a2e98bdfcb876e8bcce129c18b6f052a0d',\n '0xaE173a960084903b1d278Ff9E3A81DeD82275556',\n '0x7aa47a9737395ae9e98E8b25aC97ee04b205dC22',\n '0xfd4295c1a0b07e6b706f0ab83dc9eb461b7f17b3', // input from simon\n '0x2fa11ef008c4b585ccf0a76861794ac7ae5a3a67', // brokoli\n '0x423063ed854736ae151B79032e4275AB57245173',\n '0xb89b383C26c2514907b6De5B6df96b2d97f425eC',\n '0x6C51275FD01d5DbD2DA194E92f920f8598306dF2', // Daniel\n];\n\nexport const RANKS: Record<number, Rank> = {\n 0: {\n rankNumber: 0,\n rankName: '',\n rankLetter: '',\n },\n 1: {\n rankNumber: 1,\n rankName: 'Alpha',\n rankLetter: 'α',\n },\n 2: {\n rankNumber: 2,\n rankName: 'Beta',\n rankLetter: 'β',\n },\n 3: {\n rankNumber: 3,\n rankName: 'Gamma',\n rankLetter: 'γ',\n },\n 4: {\n rankNumber: 4,\n rankName: 'Delta',\n rankLetter: 'δ',\n },\n 5: {\n rankNumber: 5,\n rankName: 'Epsilon',\n rankLetter: 'ε',\n },\n 6: {\n rankNumber: 6,\n rankName: 'Zeta',\n rankLetter: 'ζ',\n },\n 7: {\n rankNumber: 7,\n rankName: 'Eta',\n rankLetter: 'η',\n },\n 8: {\n rankNumber: 8,\n rankName: 'Theta',\n rankLetter: 'θ',\n },\n 9: {\n rankNumber: 9,\n rankName: 'Iota',\n rankLetter: 'ι',\n },\n 10: {\n rankNumber: 10,\n rankName: 'Kappa',\n rankLetter: 'κ',\n },\n};\n\nexport const RANKS_TRADING: Record<number, RankTrading> = {\n 0: {\n rankNumber: 0,\n rankName: '',\n },\n 1: {\n rankNumber: 1,\n rankName: 'Heracles',\n },\n 2: {\n rankNumber: 2,\n rankName: 'Perseus',\n },\n 3: {\n rankNumber: 3,\n rankName: 'Achilles',\n },\n};\n\nexport const INSTANT_TRADING_RATE_XP = 2;\nexport const TRADING_LOTTERY_BOOST = 10;\n\n/**\n * The previous 30-day ladder's thresholds, still reported as V2's deprecated\n * `volume30d`. No tier job reads it: the RET-245 job assigns tiers from\n * FEE_TIER_LADDER only (`fee-tier-ladder.ts`).\n */\nexport const VOLUME_TIER_MAP: Record<number, number> = {\n 0: 0, // Tier 0: $0 volume\n 1: 1_000_000, // Tier 1: $1,000,000 volume\n 2: 10_000_000, // Tier 2: $10,000,000 volume\n 3: 50_000_000, // Tier 3: $50,000,000 volume\n 4: 250_000_000, // Tier 4: $250,000,000 volume\n 5: 1_000_000_000, // Tier 5: $1,000,000,000 volume\n 6: 5_000_000_000, // Tier 6: $5,000,000,000 volume\n};\n\nexport const TIER_TYPE_MAP: Record<number, TierType> = {\n 0: TierType.REGULAR,\n 1: TierType.REGULAR,\n 2: TierType.REGULAR,\n 3: TierType.REGULAR,\n 4: TierType.REGULAR,\n 5: TierType.REGULAR,\n 6: TierType.REGULAR,\n 7: TierType.REGULAR,\n 8: TierType.REGULAR,\n 100: TierType.VIP,\n 101: TierType.VIP,\n};\n\nexport const SPECIAL_TIER_THRESHOLD = 100;\n\nexport const MA_HEALTH_DANGER_THRESHOLD = 95;\nexport const MA_HEALTH_WARNING_THRESHOLD = 80;\n\nexport const SOCKET_BRIDGE_IN_MSG_GAS_LIMIT = BigInt('50000000');\nexport const SOCKET_EMPTY_PAYLOAD_SIZE = 160;\nexport const applySocketFeeBuffer = (fees: bigint): bigint => {\n // apply 10% buffer\n return (fees * BigInt(110)) / BigInt(100);\n};\n\nexport const REYA_DEX_ID = 2;\n\nexport const getPoolAccountId = (isProduction: boolean): number => {\n return isProduction ? 2 : 4;\n};\n"]}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.feeTierMinVolume = exports.feeTierRung = exports.isFeeTierLadderId = exports.holdsFeeTierLadder = exports.FEE_TIER_TOP_TIER_ID = exports.FEE_TIER_VIP1_TIER_ID = exports.FEE_TIER_GOLD_TIER_ID = exports.FEE_TIER_STATUS_MATCH_IN_SECONDS = exports.FEE_TIER_DEADLINE_BUFFER_IN_SECONDS = exports.FEE_TIER_GRACE_IN_SECONDS = exports.FEE_TIER_VOLUME_WINDOW_IN_SECONDS = exports.FEE_TIER_LADDER = void 0;
4
+ var consts_1 = require("./consts");
5
+ exports.FEE_TIER_LADDER = [
6
+ { tierId: 0, name: 'Standard', minVolume: 0, takerFee: '300000000000000' },
7
+ {
8
+ tierId: 1,
9
+ name: 'Bronze',
10
+ minVolume: 500000,
11
+ takerFee: '290000000000000',
12
+ },
13
+ {
14
+ tierId: 2,
15
+ name: 'Silver',
16
+ minVolume: 1000000,
17
+ takerFee: '280000000000000',
18
+ },
19
+ {
20
+ tierId: 3,
21
+ name: 'Gold',
22
+ minVolume: 2000000,
23
+ takerFee: '270000000000000',
24
+ },
25
+ {
26
+ tierId: 4,
27
+ name: 'VIP1',
28
+ minVolume: 5000000,
29
+ takerFee: '260000000000000',
30
+ },
31
+ {
32
+ tierId: 5,
33
+ name: 'VIP2',
34
+ minVolume: 25000000,
35
+ takerFee: '240000000000000',
36
+ },
37
+ {
38
+ tierId: 6,
39
+ name: 'VIP3',
40
+ minVolume: 125000000,
41
+ takerFee: '220000000000000',
42
+ },
43
+ {
44
+ tierId: 7,
45
+ name: 'VIP4',
46
+ minVolume: 500000000,
47
+ takerFee: '210000000000000',
48
+ },
49
+ {
50
+ tierId: 8,
51
+ name: 'VIP5',
52
+ minVolume: 1000000000,
53
+ takerFee: '200000000000000',
54
+ },
55
+ ];
56
+ exports.FEE_TIER_VOLUME_WINDOW_IN_SECONDS = 14 * consts_1.ONE_DAY_IN_SECONDS;
57
+ /** How long a wallet keeps its tier after its volume falls below it. */
58
+ exports.FEE_TIER_GRACE_IN_SECONDS = 7 * consts_1.ONE_DAY_IN_SECONDS;
59
+ /**
60
+ * How long after a deadline the job waits before judging it, so fills from
61
+ * just before the deadline are indexed by then. The deadline itself, and the
62
+ * 14 days ending at it that decide, are unchanged.
63
+ */
64
+ exports.FEE_TIER_DEADLINE_BUFFER_IN_SECONDS = 2 * 60 * 60;
65
+ /** How long a status match holds Gold while the wallet works towards it. */
66
+ exports.FEE_TIER_STATUS_MATCH_IN_SECONDS = 28 * consts_1.ONE_DAY_IN_SECONDS;
67
+ /** The merch tenure tiers: Gold+ (t-shirt) and VIP1+ (hoodie). */
68
+ exports.FEE_TIER_GOLD_TIER_ID = 3;
69
+ exports.FEE_TIER_VIP1_TIER_ID = 4;
70
+ exports.FEE_TIER_TOP_TIER_ID = 8;
71
+ /**
72
+ * Whether the on-chain taker rates of IDs 0-8 (`takerFees[tierId]`, raw
73
+ * UD60x18 decimal strings; a missing ID reads as unset) are exactly
74
+ * FEE_TIER_LADDER's. Only the taker rate is compared: the maker fields are
75
+ * inert and zeroed by the launch batch.
76
+ */
77
+ var holdsFeeTierLadder = function (takerFees) {
78
+ return exports.FEE_TIER_LADDER.every(function (rung) { return takerFees[rung.tierId] === rung.takerFee; });
79
+ };
80
+ exports.holdsFeeTierLadder = holdsFeeTierLadder;
81
+ var isFeeTierLadderId = function (tierId) {
82
+ return Number.isInteger(tierId) && tierId >= 0 && tierId <= exports.FEE_TIER_TOP_TIER_ID;
83
+ };
84
+ exports.isFeeTierLadderId = isFeeTierLadderId;
85
+ /** The rung of a ladder ID; throws for any other ID. */
86
+ var feeTierRung = function (tierId) {
87
+ var rung = exports.FEE_TIER_LADDER[tierId];
88
+ if (!rung)
89
+ throw new Error("Tier ".concat(tierId, " is not on the fee tier ladder"));
90
+ return rung;
91
+ };
92
+ exports.feeTierRung = feeTierRung;
93
+ /** A tier's 14-day volume threshold in dollars; 0 for IDs off the ladder. */
94
+ var feeTierMinVolume = function (tierId) { var _a, _b; return (_b = (_a = exports.FEE_TIER_LADDER[tierId]) === null || _a === void 0 ? void 0 : _a.minVolume) !== null && _b !== void 0 ? _b : 0; };
95
+ exports.feeTierMinVolume = feeTierMinVolume;
96
+ //# sourceMappingURL=fee-tier-ladder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fee-tier-ladder.js","sourceRoot":"/","sources":["utils/fee-tier-ladder.ts"],"names":[],"mappings":";;;AAAA,mCAA8C;AAmBjC,QAAA,eAAe,GAA2B;IACrD,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE;IAC1E;QACE,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,MAAO;QAClB,QAAQ,EAAE,iBAAiB;KAC5B;IACD;QACE,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,OAAS;QACpB,QAAQ,EAAE,iBAAiB;KAC5B;IACD;QACE,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,OAA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BAAkB,sBAG6C;AAErE,IAAM,iBAAiB,GAAG,UAAC,MAAc;IAC9C,OAAA,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,4BAAoB;AAAzE,CAAyE,CAAC;AAD/D,QAAA,iBAAiB,qBAC8C;AAE5E,wDAAwD;AACjD,IAAM,WAAW,GAAG,UAAC,MAAc;IACxC,IAAM,IAAI,GAAG,uBAAe,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,eAAQ,MAAM,mCAAgC,CAAC,CAAC;IAC3E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB;AAEF,6EAA6E;AACtE,IAAM,gBAAgB,GAAG,UAAC,MAAc,gBAC7C,OAAA,MAAA,MAAA,uBAAe,CAAC,MAAM,CAAC,0CAAE,SAAS,mCAAI,CAAC,CAAA,EAAA,CAAC;AAD7B,QAAA,gBAAgB,oBACa","sourcesContent":["import { ONE_DAY_IN_SECONDS } from './consts';\n\n/**\n * RET-245 Wave 1 fee ladder, read by the hourly tier job (updateTierId) and\n * the fee-tier API (the status-match one-off SQL repeats its rates). A tier is earned by trailing\n * 14-day taker volume on match executions (no liquidations or ADL), across\n * all of a wallet's accounts and markets. The ladder reuses the on-chain tier\n * IDs; `takerFee` is the rate the chain must hold for the ID, as the raw\n * UD60x18 integer (1e14 = 1bp), so the job can refuse to run against any\n * other ladder. Special tiers (>= SPECIAL_TIER_THRESHOLD) are not on it.\n */\nexport type FeeTierRung = {\n tierId: number;\n name: string;\n /** Minimum trailing 14-day taker volume, in whole dollars. */\n minVolume: number;\n takerFee: string;\n};\n\nexport const FEE_TIER_LADDER: readonly FeeTierRung[] = [\n { tierId: 0, name: 'Standard', minVolume: 0, takerFee: '300000000000000' },\n {\n tierId: 1,\n name: 'Bronze',\n minVolume: 500_000,\n takerFee: '290000000000000',\n },\n {\n tierId: 2,\n name: 'Silver',\n minVolume: 1_000_000,\n takerFee: '280000000000000',\n },\n {\n tierId: 3,\n name: 'Gold',\n minVolume: 2_000_000,\n takerFee: '270000000000000',\n },\n {\n tierId: 4,\n name: 'VIP1',\n minVolume: 5_000_000,\n takerFee: '260000000000000',\n },\n {\n tierId: 5,\n name: 'VIP2',\n minVolume: 25_000_000,\n takerFee: '240000000000000',\n },\n {\n tierId: 6,\n name: 'VIP3',\n minVolume: 125_000_000,\n takerFee: '220000000000000',\n },\n {\n tierId: 7,\n name: 'VIP4',\n minVolume: 500_000_000,\n takerFee: '210000000000000',\n },\n {\n tierId: 8,\n name: 'VIP5',\n minVolume: 1_000_000_000,\n takerFee: '200000000000000',\n },\n];\n\nexport const FEE_TIER_VOLUME_WINDOW_IN_SECONDS = 14 * ONE_DAY_IN_SECONDS;\n/** How long a wallet keeps its tier after its volume falls below it. */\nexport const FEE_TIER_GRACE_IN_SECONDS = 7 * ONE_DAY_IN_SECONDS;\n/**\n * How long after a deadline the job waits before judging it, so fills from\n * just before the deadline are indexed by then. The deadline itself, and the\n * 14 days ending at it that decide, are unchanged.\n */\nexport const FEE_TIER_DEADLINE_BUFFER_IN_SECONDS = 2 * 60 * 60;\n/** How long a status match holds Gold while the wallet works towards it. */\nexport const FEE_TIER_STATUS_MATCH_IN_SECONDS = 28 * ONE_DAY_IN_SECONDS;\n/** The merch tenure tiers: Gold+ (t-shirt) and VIP1+ (hoodie). */\nexport const FEE_TIER_GOLD_TIER_ID = 3;\nexport const FEE_TIER_VIP1_TIER_ID = 4;\nexport const FEE_TIER_TOP_TIER_ID = 8;\n\n/**\n * Whether the on-chain taker rates of IDs 0-8 (`takerFees[tierId]`, raw\n * UD60x18 decimal strings; a missing ID reads as unset) are exactly\n * FEE_TIER_LADDER's. Only the taker rate is compared: the maker fields are\n * inert and zeroed by the launch batch.\n */\nexport const holdsFeeTierLadder = (\n takerFees: Readonly<Record<number, string | undefined>>,\n): boolean =>\n FEE_TIER_LADDER.every((rung) => takerFees[rung.tierId] === rung.takerFee);\n\nexport const isFeeTierLadderId = (tierId: number): boolean =>\n Number.isInteger(tierId) && tierId >= 0 && tierId <= FEE_TIER_TOP_TIER_ID;\n\n/** The rung of a ladder ID; throws for any other ID. */\nexport const feeTierRung = (tierId: number): FeeTierRung => {\n const rung = FEE_TIER_LADDER[tierId];\n if (!rung) throw new Error(`Tier ${tierId} is not on the fee tier ladder`);\n return rung;\n};\n\n/** A tier's 14-day volume threshold in dollars; 0 for IDs off the ladder. */\nexport const feeTierMinVolume = (tierId: number): number =>\n FEE_TIER_LADDER[tierId]?.minVolume ?? 0;\n"]}
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./consts"), exports);
18
+ __exportStar(require("./fee-tier-ladder"), exports);
18
19
  __exportStar(require("./points"), exports);
19
20
  __exportStar(require("./calculate"), exports);
20
21
  __exportStar(require("./compute-trade-pnl"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,8CAA4B;AAC5B,sDAAoC;AACpC,2CAAyB;AACzB,sDAAoC;AACpC,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,0CAAwB;AACxB,iDAA+B;AAC/B,wDAAsC;AACtC,8CAA4B;AAC5B,0CAAwB;AACxB,wDAAsC;AACtC,8CAA4B;AAC5B,oDAAkC;AAClC,oDAAkC;AAClC,yDAAuC;AACvC,qDAAmC;AACnC,gDAA8B;AAC9B,sDAAoC","sourcesContent":["export * from './consts';\nexport * from './points';\nexport * from './calculate';\nexport * from './compute-trade-pnl';\nexport * from './struct';\nexport * from './cooldown-interval';\nexport * from './network';\nexport * from './number';\nexport * from './retry';\nexport * from './timestamp';\nexport * from './token';\nexport * from './task-wrapper';\nexport * from './whitelisted-wallets';\nexport * from './stringify';\nexport * from './delay';\nexport * from './transaction-receipt';\nexport * from './layerzero';\nexport * from './throttled-error';\nexport * from './error-sanitizer';\nexport * from './url-secret-redaction';\nexport * from './realized-balance';\nexport * from './error-chain';\nexport * from './receipt-rpc-error';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,oDAAkC;AAClC,2CAAyB;AACzB,8CAA4B;AAC5B,sDAAoC;AACpC,2CAAyB;AACzB,sDAAoC;AACpC,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,0CAAwB;AACxB,iDAA+B;AAC/B,wDAAsC;AACtC,8CAA4B;AAC5B,0CAAwB;AACxB,wDAAsC;AACtC,8CAA4B;AAC5B,oDAAkC;AAClC,oDAAkC;AAClC,yDAAuC;AACvC,qDAAmC;AACnC,gDAA8B;AAC9B,sDAAoC","sourcesContent":["export * from './consts';\nexport * from './fee-tier-ladder';\nexport * from './points';\nexport * from './calculate';\nexport * from './compute-trade-pnl';\nexport * from './struct';\nexport * from './cooldown-interval';\nexport * from './network';\nexport * from './number';\nexport * from './retry';\nexport * from './timestamp';\nexport * from './token';\nexport * from './task-wrapper';\nexport * from './whitelisted-wallets';\nexport * from './stringify';\nexport * from './delay';\nexport * from './transaction-receipt';\nexport * from './layerzero';\nexport * from './throttled-error';\nexport * from './error-sanitizer';\nexport * from './url-secret-redaction';\nexport * from './realized-balance';\nexport * from './error-chain';\nexport * from './receipt-rpc-error';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/common",
3
- "version": "0.382.0",
3
+ "version": "0.384.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -41,5 +41,5 @@
41
41
  "test:coverage": "npx jest test --coverage",
42
42
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
43
43
  },
44
- "gitHead": "2098c695276efcc01cb2c7c8a5259bfd7a385cb6"
44
+ "gitHead": "0b68837bcd916affa18bd7d6726c822ae5fac6f1"
45
45
  }
@@ -244,11 +244,40 @@ type Leverage = {
244
244
  };
245
245
 
246
246
  type WalletStats = {
247
- /** The wallet's volume over the trailing 14 days. */
247
+ /** The wallet's taker volume over the trailing 14 days, in dollars. */
248
248
  volume_14d: Decimal;
249
- /** The wallet's volume over the trailing `lookback_window_seconds`. */
249
+ /**
250
+ * Taker volume on match executions over the last `lookback_window_seconds`,
251
+ * in dollars: what the ladder compares with its thresholds.
252
+ */
250
253
  lookback_volume: Decimal;
254
+ /** The ladder's volume window, in seconds. */
251
255
  lookback_window_seconds: number;
256
+ /** The tier the tier job holds the wallet on (the on-chain tier until it has a row). */
257
+ tier_id: number;
258
+ /** When `tier_id` last changed, in milliseconds. */
259
+ tier_since: number | null;
260
+ /** Highest ladder tier ever earned; status-match trial time does not count. */
261
+ highest_tier_id: number | null;
262
+ /** Start of the current unbroken run at Gold or above, in milliseconds. */
263
+ gold_plus_since: number | null;
264
+ /** Start of the current unbroken run at VIP1 or above, in milliseconds. */
265
+ vip1_plus_since: number | null;
266
+ /** The tier the 14-day volume earns. */
267
+ live_tier_id: number;
268
+ next_tier_id: number | null;
269
+ /** Dollars of 14-day volume still needed for `next_tier_id`. */
270
+ volume_to_next_tier: Decimal | null;
271
+ /** The open deadline protecting `tier_id`, in milliseconds. */
272
+ deadline_until: number | null;
273
+ deadline_reason: 'grace' | 'status_match' | null;
274
+ /** Dollars to trade before the deadline to keep `tier_id`. */
275
+ volume_to_hold: Decimal | null;
276
+ /**
277
+ * Dollars of taker fees saved against Standard's rate over the last
278
+ * `lookback_window_seconds` (14 days), before rebates; about 0 on Standard.
279
+ */
280
+ fees_saved_vs_standard: Decimal;
252
281
  };
253
282
 
254
283
  type BalanceHistoryPoint = {
@@ -553,7 +582,13 @@ export type TradingApiSource = {
553
582
  tier_id: Decimal;
554
583
  taker_fee: Decimal;
555
584
  maker_fee: Decimal;
585
+ /**
586
+ * Taker volume over `lookback_window_seconds` a wallet needs for the tier;
587
+ * 0 for tier 0 and special tiers.
588
+ */
556
589
  volume: Decimal;
590
+ /** The window `volume` is measured over, in seconds. */
591
+ lookback_window_seconds: number;
557
592
  }>;
558
593
  globalFeeParameters: TradingApiEndpoint<
559
594
  {
@@ -106,8 +106,11 @@ export const RANKS_TRADING: Record<number, RankTrading> = {
106
106
  export const INSTANT_TRADING_RATE_XP = 2;
107
107
  export const TRADING_LOTTERY_BOOST = 10;
108
108
 
109
- export const VOLUME_LOOKBACK_WINDOW_IN_SECONDS = 30 * 24 * 60 * 60;
110
-
109
+ /**
110
+ * The previous 30-day ladder's thresholds, still reported as V2's deprecated
111
+ * `volume30d`. No tier job reads it: the RET-245 job assigns tiers from
112
+ * FEE_TIER_LADDER only (`fee-tier-ladder.ts`).
113
+ */
111
114
  export const VOLUME_TIER_MAP: Record<number, number> = {
112
115
  0: 0, // Tier 0: $0 volume
113
116
  1: 1_000_000, // Tier 1: $1,000,000 volume
@@ -118,9 +121,6 @@ export const VOLUME_TIER_MAP: Record<number, number> = {
118
121
  6: 5_000_000_000, // Tier 6: $5,000,000,000 volume
119
122
  };
120
123
 
121
- export const FEE_TIER_VOLUME_LOOKBACK_WINDOW_IN_SECONDS =
122
- 30 * ONE_DAY_IN_SECONDS;
123
-
124
124
  export const TIER_TYPE_MAP: Record<number, TierType> = {
125
125
  0: TierType.REGULAR,
126
126
  1: TierType.REGULAR,
@@ -129,6 +129,8 @@ export const TIER_TYPE_MAP: Record<number, TierType> = {
129
129
  4: TierType.REGULAR,
130
130
  5: TierType.REGULAR,
131
131
  6: TierType.REGULAR,
132
+ 7: TierType.REGULAR,
133
+ 8: TierType.REGULAR,
132
134
  100: TierType.VIP,
133
135
  101: TierType.VIP,
134
136
  };
@@ -0,0 +1,111 @@
1
+ import { ONE_DAY_IN_SECONDS } from './consts';
2
+
3
+ /**
4
+ * RET-245 Wave 1 fee ladder, read by the hourly tier job (updateTierId) and
5
+ * the fee-tier API (the status-match one-off SQL repeats its rates). A tier is earned by trailing
6
+ * 14-day taker volume on match executions (no liquidations or ADL), across
7
+ * all of a wallet's accounts and markets. The ladder reuses the on-chain tier
8
+ * IDs; `takerFee` is the rate the chain must hold for the ID, as the raw
9
+ * UD60x18 integer (1e14 = 1bp), so the job can refuse to run against any
10
+ * other ladder. Special tiers (>= SPECIAL_TIER_THRESHOLD) are not on it.
11
+ */
12
+ export type FeeTierRung = {
13
+ tierId: number;
14
+ name: string;
15
+ /** Minimum trailing 14-day taker volume, in whole dollars. */
16
+ minVolume: number;
17
+ takerFee: string;
18
+ };
19
+
20
+ export const FEE_TIER_LADDER: readonly FeeTierRung[] = [
21
+ { tierId: 0, name: 'Standard', minVolume: 0, takerFee: '300000000000000' },
22
+ {
23
+ tierId: 1,
24
+ name: 'Bronze',
25
+ minVolume: 500_000,
26
+ takerFee: '290000000000000',
27
+ },
28
+ {
29
+ tierId: 2,
30
+ name: 'Silver',
31
+ minVolume: 1_000_000,
32
+ takerFee: '280000000000000',
33
+ },
34
+ {
35
+ tierId: 3,
36
+ name: 'Gold',
37
+ minVolume: 2_000_000,
38
+ takerFee: '270000000000000',
39
+ },
40
+ {
41
+ tierId: 4,
42
+ name: 'VIP1',
43
+ minVolume: 5_000_000,
44
+ takerFee: '260000000000000',
45
+ },
46
+ {
47
+ tierId: 5,
48
+ name: 'VIP2',
49
+ minVolume: 25_000_000,
50
+ takerFee: '240000000000000',
51
+ },
52
+ {
53
+ tierId: 6,
54
+ name: 'VIP3',
55
+ minVolume: 125_000_000,
56
+ takerFee: '220000000000000',
57
+ },
58
+ {
59
+ tierId: 7,
60
+ name: 'VIP4',
61
+ minVolume: 500_000_000,
62
+ takerFee: '210000000000000',
63
+ },
64
+ {
65
+ tierId: 8,
66
+ name: 'VIP5',
67
+ minVolume: 1_000_000_000,
68
+ takerFee: '200000000000000',
69
+ },
70
+ ];
71
+
72
+ export const FEE_TIER_VOLUME_WINDOW_IN_SECONDS = 14 * ONE_DAY_IN_SECONDS;
73
+ /** How long a wallet keeps its tier after its volume falls below it. */
74
+ export const FEE_TIER_GRACE_IN_SECONDS = 7 * ONE_DAY_IN_SECONDS;
75
+ /**
76
+ * How long after a deadline the job waits before judging it, so fills from
77
+ * just before the deadline are indexed by then. The deadline itself, and the
78
+ * 14 days ending at it that decide, are unchanged.
79
+ */
80
+ export const FEE_TIER_DEADLINE_BUFFER_IN_SECONDS = 2 * 60 * 60;
81
+ /** How long a status match holds Gold while the wallet works towards it. */
82
+ export const FEE_TIER_STATUS_MATCH_IN_SECONDS = 28 * ONE_DAY_IN_SECONDS;
83
+ /** The merch tenure tiers: Gold+ (t-shirt) and VIP1+ (hoodie). */
84
+ export const FEE_TIER_GOLD_TIER_ID = 3;
85
+ export const FEE_TIER_VIP1_TIER_ID = 4;
86
+ export const FEE_TIER_TOP_TIER_ID = 8;
87
+
88
+ /**
89
+ * Whether the on-chain taker rates of IDs 0-8 (`takerFees[tierId]`, raw
90
+ * UD60x18 decimal strings; a missing ID reads as unset) are exactly
91
+ * FEE_TIER_LADDER's. Only the taker rate is compared: the maker fields are
92
+ * inert and zeroed by the launch batch.
93
+ */
94
+ export const holdsFeeTierLadder = (
95
+ takerFees: Readonly<Record<number, string | undefined>>,
96
+ ): boolean =>
97
+ FEE_TIER_LADDER.every((rung) => takerFees[rung.tierId] === rung.takerFee);
98
+
99
+ export const isFeeTierLadderId = (tierId: number): boolean =>
100
+ Number.isInteger(tierId) && tierId >= 0 && tierId <= FEE_TIER_TOP_TIER_ID;
101
+
102
+ /** The rung of a ladder ID; throws for any other ID. */
103
+ export const feeTierRung = (tierId: number): FeeTierRung => {
104
+ const rung = FEE_TIER_LADDER[tierId];
105
+ if (!rung) throw new Error(`Tier ${tierId} is not on the fee tier ladder`);
106
+ return rung;
107
+ };
108
+
109
+ /** A tier's 14-day volume threshold in dollars; 0 for IDs off the ladder. */
110
+ export const feeTierMinVolume = (tierId: number): number =>
111
+ FEE_TIER_LADDER[tierId]?.minVolume ?? 0;
@@ -1,4 +1,5 @@
1
1
  export * from './consts';
2
+ export * from './fee-tier-ladder';
2
3
  export * from './points';
3
4
  export * from './calculate';
4
5
  export * from './compute-trade-pnl';