@lightconexyz/lightcone-sdk 0.5.2 → 0.6.1

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.
Files changed (137) hide show
  1. package/README.md +34 -4
  2. package/dist/client.d.ts +30 -1
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +38 -0
  5. package/dist/client.js.map +1 -1
  6. package/dist/domain/admin/client.d.ts +10 -1
  7. package/dist/domain/admin/client.d.ts.map +1 -1
  8. package/dist/domain/admin/client.js +51 -0
  9. package/dist/domain/admin/client.js.map +1 -1
  10. package/dist/domain/admin/wire.d.ts +267 -7
  11. package/dist/domain/admin/wire.d.ts.map +1 -1
  12. package/dist/domain/admin/wire.js.map +1 -1
  13. package/dist/domain/faucet.d.ts +25 -0
  14. package/dist/domain/faucet.d.ts.map +1 -0
  15. package/dist/domain/faucet.js +3 -0
  16. package/dist/domain/faucet.js.map +1 -0
  17. package/dist/domain/index.d.ts +2 -0
  18. package/dist/domain/index.d.ts.map +1 -1
  19. package/dist/domain/index.js +3 -1
  20. package/dist/domain/index.js.map +1 -1
  21. package/dist/domain/market/client.d.ts +23 -2
  22. package/dist/domain/market/client.d.ts.map +1 -1
  23. package/dist/domain/market/client.js +30 -0
  24. package/dist/domain/market/client.js.map +1 -1
  25. package/dist/domain/market/convert.d.ts +10 -0
  26. package/dist/domain/market/convert.d.ts.map +1 -1
  27. package/dist/domain/market/convert.js +43 -4
  28. package/dist/domain/market/convert.js.map +1 -1
  29. package/dist/domain/market/icon.d.ts +17 -0
  30. package/dist/domain/market/icon.d.ts.map +1 -0
  31. package/dist/domain/market/icon.js +25 -0
  32. package/dist/domain/market/icon.js.map +1 -0
  33. package/dist/domain/market/index.d.ts +13 -4
  34. package/dist/domain/market/index.d.ts.map +1 -1
  35. package/dist/domain/market/index.js +3 -1
  36. package/dist/domain/market/index.js.map +1 -1
  37. package/dist/domain/market/outcome.d.ts +3 -1
  38. package/dist/domain/market/outcome.d.ts.map +1 -1
  39. package/dist/domain/market/outcome.js +7 -7
  40. package/dist/domain/market/outcome.js.map +1 -1
  41. package/dist/domain/market/tokens.d.ts +53 -3
  42. package/dist/domain/market/tokens.d.ts.map +1 -1
  43. package/dist/domain/market/tokens.js +99 -8
  44. package/dist/domain/market/tokens.js.map +1 -1
  45. package/dist/domain/market/wire.d.ts +46 -8
  46. package/dist/domain/market/wire.d.ts.map +1 -1
  47. package/dist/domain/market/wire.js.map +1 -1
  48. package/dist/domain/metrics/client.d.ts +66 -0
  49. package/dist/domain/metrics/client.d.ts.map +1 -0
  50. package/dist/domain/metrics/client.js +124 -0
  51. package/dist/domain/metrics/client.js.map +1 -0
  52. package/dist/domain/metrics/index.d.ts +3 -0
  53. package/dist/domain/metrics/index.d.ts.map +1 -0
  54. package/dist/domain/metrics/index.js +19 -0
  55. package/dist/domain/metrics/index.js.map +1 -0
  56. package/dist/domain/metrics/wire.d.ts +342 -0
  57. package/dist/domain/metrics/wire.d.ts.map +1 -0
  58. package/dist/domain/metrics/wire.js +3 -0
  59. package/dist/domain/metrics/wire.js.map +1 -0
  60. package/dist/domain/notification/client.d.ts +6 -0
  61. package/dist/domain/notification/client.d.ts.map +1 -1
  62. package/dist/domain/notification/client.js +10 -0
  63. package/dist/domain/notification/client.js.map +1 -1
  64. package/dist/domain/notification/index.d.ts +3 -1
  65. package/dist/domain/notification/index.d.ts.map +1 -1
  66. package/dist/domain/notification/index.js.map +1 -1
  67. package/dist/domain/order/client.d.ts +28 -2
  68. package/dist/domain/order/client.d.ts.map +1 -1
  69. package/dist/domain/order/client.js +76 -16
  70. package/dist/domain/order/client.js.map +1 -1
  71. package/dist/domain/order/convert.d.ts +5 -5
  72. package/dist/domain/order/convert.d.ts.map +1 -1
  73. package/dist/domain/order/convert.js +1 -1
  74. package/dist/domain/order/convert.js.map +1 -1
  75. package/dist/domain/order/index.d.ts +1 -1
  76. package/dist/domain/order/index.d.ts.map +1 -1
  77. package/dist/domain/order/index.js.map +1 -1
  78. package/dist/domain/order/state.d.ts +9 -7
  79. package/dist/domain/order/state.d.ts.map +1 -1
  80. package/dist/domain/order/state.js +81 -28
  81. package/dist/domain/order/state.js.map +1 -1
  82. package/dist/domain/orderbook/index.d.ts +1 -1
  83. package/dist/domain/orderbook/index.d.ts.map +1 -1
  84. package/dist/domain/orderbook/index.js +3 -8
  85. package/dist/domain/orderbook/index.js.map +1 -1
  86. package/dist/domain/orderbook/state.d.ts +30 -7
  87. package/dist/domain/orderbook/state.d.ts.map +1 -1
  88. package/dist/domain/orderbook/state.js +41 -12
  89. package/dist/domain/orderbook/state.js.map +1 -1
  90. package/dist/domain/position/client.d.ts +55 -0
  91. package/dist/domain/position/client.d.ts.map +1 -1
  92. package/dist/domain/position/client.js +71 -0
  93. package/dist/domain/position/client.js.map +1 -1
  94. package/dist/domain/position/index.d.ts +3 -2
  95. package/dist/domain/position/index.d.ts.map +1 -1
  96. package/dist/domain/position/index.js.map +1 -1
  97. package/dist/domain/price_history/client.d.ts +12 -1
  98. package/dist/domain/price_history/client.d.ts.map +1 -1
  99. package/dist/domain/price_history/client.js +14 -0
  100. package/dist/domain/price_history/client.js.map +1 -1
  101. package/dist/domain/price_history/wire.d.ts +27 -0
  102. package/dist/domain/price_history/wire.d.ts.map +1 -1
  103. package/dist/domain/price_history/wire.js.map +1 -1
  104. package/dist/domain/referral/client.d.ts +6 -0
  105. package/dist/domain/referral/client.d.ts.map +1 -1
  106. package/dist/domain/referral/client.js +22 -9
  107. package/dist/domain/referral/client.js.map +1 -1
  108. package/dist/http/client.d.ts +9 -0
  109. package/dist/http/client.d.ts.map +1 -1
  110. package/dist/http/client.js +24 -9
  111. package/dist/http/client.js.map +1 -1
  112. package/dist/index.d.ts +1 -1
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.js.map +1 -1
  115. package/dist/prelude.d.ts +12 -4
  116. package/dist/prelude.d.ts.map +1 -1
  117. package/dist/prelude.js +4 -2
  118. package/dist/prelude.js.map +1 -1
  119. package/dist/shared/fmt/decimal.js +4 -4
  120. package/dist/shared/fmt/decimal.js.map +1 -1
  121. package/dist/shared/index.d.ts +1 -1
  122. package/dist/shared/index.d.ts.map +1 -1
  123. package/dist/shared/index.js +2 -1
  124. package/dist/shared/index.js.map +1 -1
  125. package/dist/shared/types.d.ts +1 -0
  126. package/dist/shared/types.d.ts.map +1 -1
  127. package/dist/shared/types.js +19 -0
  128. package/dist/shared/types.js.map +1 -1
  129. package/dist/ws/index.d.ts +12 -1
  130. package/dist/ws/index.d.ts.map +1 -1
  131. package/dist/ws/index.js +20 -0
  132. package/dist/ws/index.js.map +1 -1
  133. package/dist/ws/subscriptions.d.ts +6 -0
  134. package/dist/ws/subscriptions.d.ts.map +1 -1
  135. package/dist/ws/subscriptions.js +4 -0
  136. package/dist/ws/subscriptions.js.map +1 -1
  137. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"prelude.js","sourceRoot":"","sources":["../src/prelude.ts"],"names":[],"mappings":";;;;AAAA,mCAmBkB;AAlBhB,4GAAA,kBAAkB,OAAA;AAClB,uGAAA,aAAa,OAAA;AACb,uGAAA,aAAa,OAAA;AACb,qGAAA,WAAW,OAAA;AACX,uGAAA,aAAa,OAAA;AACb,2GAAA,iBAAiB,OAAA;AACjB,yGAAA,eAAe,OAAA;AACf,oGAAA,UAAU,OAAA;AACV,8FAAA,IAAI,OAAA;AACJ,qGAAA,WAAW,OAAA;AACX,6GAAA,mBAAmB,OAAA;AACnB,uGAAA,aAAa,OAAA;AACb,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AAOnB,iCAAmC;AAA1B,iGAAA,QAAQ,OAAA;AACjB,6BAAuE;AAA9D,mGAAA,YAAY,OAAA;AAAE,6FAAA,MAAM,OAAA;AAAE,4FAAA,KAAK,OAAA;AAAE,6FAAA,MAAM,OAAA;AAAE,gGAAA,SAAS,OAAA;AAEvD,mCAGkB;AAFhB,yGAAA,eAAe,OAAA;AACf,gHAAA,sBAAsB,OAAA;AAGxB,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AAGZ,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,wCAAuC;AAA9B,8FAAA,KAAK,OAAA;AACd,0CAA0C;AAAjC,iGAAA,OAAO,OAAA;AAChB,gDAAgD;AAAvC,uGAAA,UAAU,OAAA;AACnB,wCAAwC;AAA/B,+FAAA,MAAM,OAAA;AACf,8CAA8C;AAArC,qGAAA,SAAS,OAAA;AAClB,wCAAwC;AAA/B,+FAAA,MAAM,OAAA;AACf,wDAA4D;AAAnD,mHAAA,kBAAkB,OAAA;AAC3B,sDAAsD;AAA7C,6GAAA,aAAa,OAAA;AACtB,8CAA8C;AAArC,qGAAA,SAAS,OAAA;AAoBlB,gDAA8D;AAArD,qHAAA,wBAAwB,OAAA;AACjC,kDAA0D;AAAjD,uGAAA,cAAc,OAAA;AAuCvB,8CAU2B;AATzB,0GAAA,cAAc,OAAA;AACd,2GAAA,eAAe,OAAA;AACf,iHAAA,qBAAqB,OAAA;AACrB,uHAAA,2BAA2B,OAAA;AAC3B,qHAAA,yBAAyB,OAAA;AACzB,uHAAA,2BAA2B,OAAA;AAC3B,kHAAA,sBAAsB,OAAA;AACtB,qHAAA,yBAAyB,OAAA;AACzB,wHAAA,4BAA4B,OAAA;AAI9B,8CAAoD;AAA3C,qGAAA,YAAY,OAAA;AAqBrB,wDAA8E;AAArE,kHAAA,iBAAiB,OAAA;AAAE,kHAAA,iBAAiB,OAAA;AAW7C,qCAKmB;AAJjB,6GAAA,kBAAkB,OAAA;AAClB,+GAAA,oBAAoB,OAAA;AActB,4CAI0B;AAHxB,6GAAA,kBAAkB,OAAA;AAKpB,8CAE2B;AADzB,wGAAA,YAAY,OAAA;AAiBd,+BAGgB;AAFd,mGAAA,WAAW,OAAA","sourcesContent":["export {\n ApiRejectedDetails,\n RejectionCode,\n asOrderBookId,\n asPubkeyStr,\n DepositSource,\n deriveOrderbookId,\n OrderUpdateType,\n Resolution,\n Side,\n TimeInForce,\n TriggerResultStatus,\n TriggerStatus,\n TriggerType,\n TriggerUpdateType,\n type ApiResponse,\n type OrderBookId,\n type PubkeyStr,\n type SubmitOrderRequest,\n} from \"./shared\";\n\nexport { SdkError } from \"./error\";\nexport { LightconeEnv, apiUrl, wsUrl, rpcUrl, programId } from \"./env\";\n\nexport {\n LightconeClient,\n LightconeClientBuilder,\n} from \"./client\";\n\nexport { Rpc } from \"./rpc\";\nexport type { ClientContext } from \"./context\";\n\nexport { Auth } from \"./auth\";\nexport { Admin } from \"./domain/admin\";\nexport { Markets } from \"./domain/market\";\nexport { Orderbooks } from \"./domain/orderbook\";\nexport { Orders } from \"./domain/order\";\nexport { Positions } from \"./domain/position\";\nexport { Trades } from \"./domain/trade\";\nexport { PriceHistoryClient } from \"./domain/price_history\";\nexport { Notifications } from \"./domain/notification\";\nexport { Referrals } from \"./domain/referral\";\n\nexport type {\n Market,\n Status,\n Outcome,\n ConditionalToken,\n DepositAsset,\n Token,\n TokenMetadata,\n ValidatedTokens,\n} from \"./domain/market\";\n\nexport type {\n OrderBook,\n OrderBookPair,\n OutcomeImpact,\n TickerData,\n WsBookLevel,\n} from \"./domain/orderbook\";\nexport { OrderBookValidationError } from \"./domain/orderbook\";\nexport { OrderbookState } from \"./domain/orderbook/state\";\n\nexport type {\n CancelAllBody,\n CancelAllSuccess,\n CancelBody,\n CancelSuccess,\n CancelTriggerBody,\n CancelTriggerSuccess,\n ConditionalBalance,\n FillInfo,\n GlobalDepositUpdate,\n NonceUpdate,\n Order,\n OrderEvent,\n OrderStatus,\n OrderType,\n SubmitOrderResponse,\n TriggerOrder,\n TriggerOrderResponse,\n TriggerOrderUpdate,\n UserSnapshotBalance,\n UserSnapshotOrder,\n UserOrdersResponse,\n} from \"./domain/order\";\nexport type { UserOpenOrders, UserTriggerOrders } from \"./domain/order/state\";\n\nexport type {\n Portfolio,\n Position,\n PositionOutcome,\n WalletHolding,\n TokenBalance,\n TokenBalanceComputedBase,\n TokenBalanceTokenType,\n DepositAssetMetadata,\n DepositTokenBalance,\n} from \"./domain/position\";\n\nexport {\n DepositBuilder,\n WithdrawBuilder,\n RedeemWinningsBuilder,\n WithdrawFromPositionBuilder,\n InitPositionTokensBuilder,\n ExtendPositionTokensBuilder,\n DepositToGlobalBuilder,\n WithdrawFromGlobalBuilder,\n GlobalToMarketDepositBuilder,\n} from \"./domain/position\";\n\nexport type { Trade, WsTrade } from \"./domain/trade\";\nexport { TradeHistory } from \"./domain/trade/state\";\nexport type {\n DepositPrice,\n DepositPriceCandleUpdate,\n DepositPriceHistoryQuery,\n DepositPriceKey,\n DepositPriceSnapshot,\n DepositPriceTick,\n DepositTokenCandle,\n DepositTokenPriceHistoryResponse,\n LineData,\n MidpointPriceCandle,\n OhlcvPriceCandle,\n OrderbookPriceHistoryQuery,\n OrderbookPriceHistoryResponse,\n PriceCandle,\n PriceHistory,\n PriceHistoryRestResponse,\n PriceHistorySnapshot,\n PriceHistoryUpdate,\n} from \"./domain/price_history\";\nexport { DepositPriceState, PriceHistoryState } from \"./domain/price_history\";\n\nexport type {\n AuthCredentials,\n ChainType,\n EmbeddedWallet,\n LinkedAccount,\n LinkedAccountType,\n User,\n} from \"./auth\";\n\nexport {\n LimitOrderEnvelope,\n TriggerOrderEnvelope,\n type OrderEnvelope,\n type OrderPayload,\n} from \"./program\";\n\nexport type {\n ExportWalletRequest,\n ExportWalletResponse,\n PrivyOrderEnvelope,\n SignAndSendOrderRequest,\n SignAndSendTxRequest,\n SignAndSendTxResponse,\n} from \"./privy\";\n\nexport {\n isUserCancellation,\n type ExternalSigner,\n type SigningStrategy,\n} from \"./shared/signing\";\n\nexport {\n MergeBuilder,\n} from \"./domain/position\";\n\nexport type {\n Notification,\n NotificationKind,\n MarketResolvedData,\n OrderFilledData,\n MarketData,\n} from \"./domain/notification\";\n\nexport type {\n RedeemResult,\n ReferralCodeInfo,\n ReferralStatus,\n} from \"./domain/referral\";\n\nexport {\n RetryPolicy,\n type RetryConfig,\n} from \"./http\";\n\nexport type {\n IWsClient,\n Kind,\n MessageIn,\n MessageOut,\n SubscribeParams,\n UnsubscribeParams,\n WsConfig,\n WsEvent,\n} from \"./ws\";\n\nexport type AuthClient = import(\"./auth\").Auth;\nexport type AdminClient = import(\"./domain/admin\").Admin;\nexport type MarketsClient = import(\"./domain/market\").Markets;\nexport type MarketsResult = import(\"./domain/market\").MarketsResult;\nexport type OrderbooksClient = import(\"./domain/orderbook\").Orderbooks;\nexport type OrdersClient = import(\"./domain/order\").Orders;\nexport type PositionsClient = import(\"./domain/position\").Positions;\nexport type TradesClient = import(\"./domain/trade\").Trades;\nexport type PriceHistorySubClient = import(\"./domain/price_history\").PriceHistoryClient;\nexport type NotificationsClient = import(\"./domain/notification\").Notifications;\nexport type ReferralsClient = import(\"./domain/referral\").Referrals;\nexport type RpcClient = import(\"./rpc\").Rpc;\n"]}
1
+ {"version":3,"file":"prelude.js","sourceRoot":"","sources":["../src/prelude.ts"],"names":[],"mappings":";;;;AAAA,mCAmBkB;AAlBhB,4GAAA,kBAAkB,OAAA;AAClB,uGAAA,aAAa,OAAA;AACb,uGAAA,aAAa,OAAA;AACb,qGAAA,WAAW,OAAA;AACX,uGAAA,aAAa,OAAA;AACb,2GAAA,iBAAiB,OAAA;AACjB,yGAAA,eAAe,OAAA;AACf,oGAAA,UAAU,OAAA;AACV,8FAAA,IAAI,OAAA;AACJ,qGAAA,WAAW,OAAA;AACX,6GAAA,mBAAmB,OAAA;AACnB,uGAAA,aAAa,OAAA;AACb,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AAOnB,iCAAmC;AAA1B,iGAAA,QAAQ,OAAA;AACjB,6BAAuE;AAA9D,mGAAA,YAAY,OAAA;AAAE,6FAAA,MAAM,OAAA;AAAE,4FAAA,KAAK,OAAA;AAAE,6FAAA,MAAM,OAAA;AAAE,gGAAA,SAAS,OAAA;AAEvD,mCAGkB;AAFhB,yGAAA,eAAe,OAAA;AACf,gHAAA,sBAAsB,OAAA;AAGxB,6BAA4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,\n Resolution,\n Side,\n TimeInForce,\n TriggerResultStatus,\n TriggerStatus,\n TriggerType,\n TriggerUpdateType,\n type ApiResponse,\n type OrderBookId,\n type PubkeyStr,\n type SubmitOrderRequest,\n} from \"./shared\";\n\nexport { SdkError } from \"./error\";\nexport { LightconeEnv, apiUrl, wsUrl, rpcUrl, programId } from \"./env\";\n\nexport {\n LightconeClient,\n LightconeClientBuilder,\n} from \"./client\";\n\nexport { Rpc } from \"./rpc\";\nexport type { ClientContext } from \"./context\";\n\nexport { Auth } from \"./auth\";\nexport { Admin } from \"./domain/admin\";\nexport { Markets } from \"./domain/market\";\nexport { Metrics } from \"./domain/metrics\";\nexport { Orderbooks } from \"./domain/orderbook\";\nexport { Orders } from \"./domain/order\";\nexport { Positions } from \"./domain/position\";\nexport { Trades } from \"./domain/trade\";\nexport { PriceHistoryClient } from \"./domain/price_history\";\nexport { Notifications } from \"./domain/notification\";\nexport { Referrals } from \"./domain/referral\";\n\nexport type {\n AdminLogEvent,\n AdminLogEventsQuery,\n AdminLogEventsResponse,\n AdminLogMetricBreakdown,\n AdminLogMetricHistoryQuery,\n AdminLogMetricHistoryResponse,\n AdminLogMetricPoint,\n AdminLogMetricSummary,\n AdminLogMetricsQuery,\n AdminLogMetricsResponse,\n CodeListEntry,\n ListCodesRequest,\n ListCodesResponse,\n ReferralConfig,\n UpdateCodeRequest,\n UpdateCodeResponse,\n UpdateConfigRequest,\n} from \"./domain/admin\";\n\nexport type {\n CategoriesMetrics,\n CategoryVolumeMetrics,\n DepositTokenVolumeMetrics,\n DepositTokensMetrics,\n HistoryPoint,\n Leaderboard,\n LeaderboardEntry,\n MarketDetailMetrics,\n MarketOrderbookVolumeMetrics,\n MarketVolumeMetrics,\n MarketsMetrics,\n MetricsHistory,\n MetricsHistoryQuery,\n OrderbookTickerEntry,\n OrderbookTickersResponse,\n OrderbookVolumeMetrics,\n OutcomeVolumeMetrics,\n PlatformMetrics,\n} from \"./domain/metrics\";\n\nexport type {\n FaucetRequest,\n FaucetResponse,\n FaucetToken,\n} from \"./domain/faucet\";\n\nexport type {\n ConditionalTokenResponse,\n DepositAssetResponse,\n DepositMintsResponse,\n} from \"./domain/market/wire\";\n\nexport type {\n Market,\n Status,\n Outcome,\n ConditionalToken,\n DepositAsset,\n GlobalDepositAsset,\n Token,\n TokenMetadata,\n ValidatedTokens,\n} from \"./domain/market\";\n\nexport type {\n OrderBook,\n OrderBookPair,\n OutcomeImpact,\n TickerData,\n WsBookLevel,\n} from \"./domain/orderbook\";\nexport { OrderBookValidationError } from \"./domain/orderbook\";\nexport { OrderbookState } from \"./domain/orderbook/state\";\nexport type {\n OrderbookApplyResult,\n OrderbookIgnoreReason,\n OrderbookRefreshReason,\n} from \"./domain/orderbook/state\";\n\nexport type {\n CancelAllBody,\n CancelAllSuccess,\n CancelBody,\n CancelSuccess,\n CancelTriggerBody,\n CancelTriggerSuccess,\n ConditionalBalance,\n FillInfo,\n GlobalDepositUpdate,\n NonceUpdate,\n LimitOrder,\n OrderEvent,\n OrderStatus,\n OrderType,\n SubmitOrderResponse,\n TriggerOrder,\n TriggerOrderResponse,\n TriggerOrderUpdate,\n UserSnapshotBalance,\n UserSnapshotOrder,\n UserOrdersResponse,\n} from \"./domain/order\";\nexport type { UserOpenLimitOrders, UserTriggerOrders } from \"./domain/order/state\";\n\nexport type {\n Portfolio,\n Position,\n PositionOutcome,\n WalletHolding,\n TokenBalance,\n TokenBalanceComputedBase,\n TokenBalanceTokenType,\n DepositAssetMetadata,\n DepositTokenBalance,\n} from \"./domain/position\";\n\nexport {\n DepositBuilder,\n WithdrawBuilder,\n RedeemWinningsBuilder,\n WithdrawFromPositionBuilder,\n InitPositionTokensBuilder,\n ExtendPositionTokensBuilder,\n DepositToGlobalBuilder,\n WithdrawFromGlobalBuilder,\n GlobalToMarketDepositBuilder,\n} from \"./domain/position\";\n\nexport type { Trade, WsTrade } from \"./domain/trade\";\nexport { TradeHistory } from \"./domain/trade/state\";\nexport type {\n DepositPrice,\n DepositPriceCandleUpdate,\n DepositPriceHistoryQuery,\n DepositPriceKey,\n DepositPriceSnapshot,\n DepositPriceTick,\n DepositTokenCandle,\n DepositTokenPriceHistoryResponse,\n DepositAssetPriceEvent,\n DepositAssetPriceSnapshot,\n DepositAssetPriceTick,\n DepositAssetPricesSnapshotResponse,\n LineData,\n MidpointPriceCandle,\n OhlcvPriceCandle,\n OrderbookPriceHistoryQuery,\n OrderbookPriceHistoryResponse,\n PriceCandle,\n PriceHistory,\n PriceHistoryRestResponse,\n PriceHistorySnapshot,\n PriceHistoryUpdate,\n} from \"./domain/price_history\";\nexport { DepositPriceState, PriceHistoryState } from \"./domain/price_history\";\n\nexport type {\n AuthCredentials,\n ChainType,\n EmbeddedWallet,\n LinkedAccount,\n LinkedAccountType,\n User,\n} from \"./auth\";\n\nexport {\n LimitOrderEnvelope,\n TriggerOrderEnvelope,\n type OrderEnvelope,\n type OrderPayload,\n} from \"./program\";\n\nexport type {\n ExportWalletRequest,\n ExportWalletResponse,\n PrivyOrderEnvelope,\n SignAndSendOrderRequest,\n SignAndSendTxRequest,\n SignAndSendTxResponse,\n} from \"./privy\";\n\nexport {\n isUserCancellation,\n type ExternalSigner,\n type SigningStrategy,\n} from \"./shared/signing\";\n\nexport {\n MergeBuilder,\n} from \"./domain/position\";\n\nexport type {\n Notification,\n NotificationKind,\n MarketResolvedData,\n OrderFilledData,\n MarketData,\n} from \"./domain/notification\";\n\nexport type {\n RedeemResult,\n ReferralCodeInfo,\n ReferralStatus,\n} from \"./domain/referral\";\n\nexport {\n RetryPolicy,\n type RetryConfig,\n} from \"./http\";\n\nexport type {\n IWsClient,\n Kind,\n MessageIn,\n MessageOut,\n SubscribeParams,\n UnsubscribeParams,\n WsConfig,\n WsEvent,\n} from \"./ws\";\n\nexport type AuthClient = import(\"./auth\").Auth;\nexport type AdminClient = import(\"./domain/admin\").Admin;\nexport type MarketsClient = import(\"./domain/market\").Markets;\nexport type MarketsResult = import(\"./domain/market\").MarketsResult;\nexport type GlobalDepositAssetsResult = import(\"./domain/market\").GlobalDepositAssetsResult;\nexport type MetricsClient = import(\"./domain/metrics\").Metrics;\nexport type OrderbooksClient = import(\"./domain/orderbook\").Orderbooks;\nexport type OrdersClient = import(\"./domain/order\").Orders;\nexport type PositionsClient = import(\"./domain/position\").Positions;\nexport type TradesClient = import(\"./domain/trade\").Trades;\nexport type PriceHistorySubClient = import(\"./domain/price_history\").PriceHistoryClient;\nexport type NotificationsClient = import(\"./domain/notification\").Notifications;\nexport type ReferralsClient = import(\"./domain/referral\").Referrals;\nexport type RpcClient = import(\"./rpc\").Rpc;\n"]}
@@ -32,10 +32,10 @@ function abbrNumber(value, digits = 2, showSign = true) {
32
32
  const sign = showSign && value.isNegative() ? "-" : "";
33
33
  const abs = value.abs();
34
34
  const units = [
35
- [new decimal_js_1.default("1000000000000"), "T"],
36
- [new decimal_js_1.default("1000000000"), "B"],
37
- [new decimal_js_1.default("1000000"), "M"],
38
- [new decimal_js_1.default("1000"), "K"],
35
+ [new decimal_js_1.default("1000000000000"), "t"],
36
+ [new decimal_js_1.default("1000000000"), "b"],
37
+ [new decimal_js_1.default("1000000"), "m"],
38
+ [new decimal_js_1.default("1000"), "k"],
39
39
  ];
40
40
  for (const [threshold, suffix] of units) {
41
41
  if (abs.greaterThanOrEqualTo(threshold)) {
@@ -1 +1 @@
1
- {"version":3,"file":"decimal.js","sourceRoot":"","sources":["../../../src/shared/fmt/decimal.ts"],"names":[],"mappings":";;;;;AAGA,0BAsBC;AAED,gCAkBC;AAED,kCAMC;AArDD,4DAAiC;AACjC,+BAA+C;AAE/C,SAAgB,OAAO,CAAC,KAAc;IACpC,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QACnB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;IACxB,IAAI,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,IAAA,4BAAsB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AE,CAAC;IAExB,MAAM,KAAK,GAA6B;QACtC,CAAC,IAAI,oBAAO,CAAC,eAAe,CAAC,EAAE,GAAG,CAAC;QACnC,CAAC,IAAI,oBAAO,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC;QAChC,CAAC,IAAI,oBAAO,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC;QAC7B,CAAC,IAAI,oBAAO,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC;KAC3B,CAAC;IAEF,KAAK,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACxC,IAAI,GAAG,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,CAAC;YACxC,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;QACpF,CAAC;IACH,CAAC;IAED,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC5D,CAAC;AAED,SAAgB,WAAW,CAAC,KAAc,EAAE,QAAgB;IAC1D,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,oBAAO,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import Decimal from \"decimal.js\";\nimport { displayFormattedString } from \"./num\";\n\nexport function display(value: Decimal): string {\n if (value.isZero()) {\n return \"0\";\n }\n\n const abs = value.abs();\n if (abs.greaterThanOrEqualTo(100)) {\n return displayFormattedString(value.toDecimalPlaces(0).toString());\n }\n if (abs.greaterThanOrEqualTo(1)) {\n return displayFormattedString(value.toDecimalPlaces(2).toString());\n }\n\n const asString = abs.toFixed(20).replace(/0+$/, \"\");\n const match = /^0\\.(0+)(\\d+)/.exec(asString);\n if (match && match[1].length > 5) {\n const sign = value.isNegative() ? \"-\" : \"\";\n const significant = match[2].slice(0, 4).replace(/0+$/, \"\");\n return `${sign}0.0(${match[1].length})${significant || \"0\"}`;\n }\n\n return displayFormattedString(value.toSignificantDigits(8).toString());\n}\n\nexport function abbrNumber(value: Decimal, digits = 2, showSign = true): string {\n const sign = showSign && value.isNegative() ? \"-\" : \"\";\n const abs = value.abs();\n\n const units: Array<[Decimal, string]> = [\n [new Decimal(\"1000000000000\"), \"T\"],\n [new Decimal(\"1000000000\"), \"B\"],\n [new Decimal(\"1000000\"), \"M\"],\n [new Decimal(\"1000\"), \"K\"],\n ];\n\n for (const [threshold, suffix] of units) {\n if (abs.greaterThanOrEqualTo(threshold)) {\n return `${sign}${abs.div(threshold).toDecimalPlaces(digits).toString()}${suffix}`;\n }\n }\n\n return `${sign}${abs.toDecimalPlaces(digits).toString()}`;\n}\n\nexport function toBaseUnits(value: Decimal, decimals: number): bigint | null {\n const scaled = value.mul(new Decimal(10).pow(decimals));\n if (!scaled.isInteger() || scaled.isNegative()) {\n return null;\n }\n return BigInt(scaled.toFixed(0));\n}\n"]}
1
+ {"version":3,"file":"decimal.js","sourceRoot":"","sources":["../../../src/shared/fmt/decimal.ts"],"names":[],"mappings":";;;;;AAGA,0BAsBC;AAED,gCAkBC;AAED,kCAMC;AArDD,4DAAiC;AACjC,+BAA+C;AAE/C,SAAgB,OAAO,CAAC,KAAc;IACpC,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QACnB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;IACxB,IAAI,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAA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,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;IAExB,MAAM,KAAK,GAA6B;QACtC,CAAC,IAAI,oBAAO,CAAC,eAAe,CAAC,EAAE,GAAG,CAAC;QACnC,CAAC,IAAI,oBAAO,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC;QAChC,CAAC,IAAI,oBAAO,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC;QAC7B,CAAC,IAAI,oBAAO,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC;KAC3B,CAAC;IAEF,KAAK,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACxC,IAAI,GAAG,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,CAAC;YACxC,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;QACpF,CAAC;IACH,CAAC;IAED,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC5D,CAAC;AAED,SAAgB,WAAW,CAAC,KAAc,EAAE,QAAgB;IAC1D,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,oBAAO,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import Decimal from \"decimal.js\";\nimport { displayFormattedString } from \"./num\";\n\nexport function display(value: Decimal): string {\n if (value.isZero()) {\n return \"0\";\n }\n\n const abs = value.abs();\n if (abs.greaterThanOrEqualTo(100)) {\n return displayFormattedString(value.toDecimalPlaces(0).toString());\n }\n if (abs.greaterThanOrEqualTo(1)) {\n return displayFormattedString(value.toDecimalPlaces(2).toString());\n }\n\n const asString = abs.toFixed(20).replace(/0+$/, \"\");\n const match = /^0\\.(0+)(\\d+)/.exec(asString);\n if (match && match[1].length > 5) {\n const sign = value.isNegative() ? \"-\" : \"\";\n const significant = match[2].slice(0, 4).replace(/0+$/, \"\");\n return `${sign}0.0(${match[1].length})${significant || \"0\"}`;\n }\n\n return displayFormattedString(value.toSignificantDigits(8).toString());\n}\n\nexport function abbrNumber(value: Decimal, digits = 2, showSign = true): string {\n const sign = showSign && value.isNegative() ? \"-\" : \"\";\n const abs = value.abs();\n\n const units: Array<[Decimal, string]> = [\n [new Decimal(\"1000000000000\"), \"t\"],\n [new Decimal(\"1000000000\"), \"b\"],\n [new Decimal(\"1000000\"), \"m\"],\n [new Decimal(\"1000\"), \"k\"],\n ];\n\n for (const [threshold, suffix] of units) {\n if (abs.greaterThanOrEqualTo(threshold)) {\n return `${sign}${abs.div(threshold).toDecimalPlaces(digits).toString()}${suffix}`;\n }\n }\n\n return `${sign}${abs.toDecimalPlaces(digits).toString()}`;\n}\n\nexport function toBaseUnits(value: Decimal, decimals: number): bigint | null {\n const scaled = value.mul(new Decimal(10).pow(decimals));\n if (!scaled.isInteger() || scaled.isNegative()) {\n return null;\n }\n return BigInt(scaled.toFixed(0));\n}\n"]}
@@ -1,4 +1,4 @@
1
- export { asOrderBookId, asPubkeyStr, DepositSource, deriveOrderbookId, parseSide, resolutionSeconds, sideLabel, OrderUpdateType, Resolution, Side, TimeInForce, TriggerResultStatus, TriggerStatus, TriggerType, TriggerUpdateType, type Branded, type OrderBookId, type PubkeyStr, type SubmitOrderRequest, } from "./types";
1
+ export { asOrderBookId, asPubkeyStr, DepositSource, deriveOrderbookId, parseResolution, parseSide, resolutionSeconds, sideLabel, OrderUpdateType, Resolution, Side, TimeInForce, TriggerResultStatus, TriggerStatus, TriggerType, TriggerUpdateType, type Branded, type OrderBookId, type PubkeyStr, type SubmitOrderRequest, } from "./types";
2
2
  export { ApiRejectedDetails, isApiResponse, type ApiRejectedDetailsWire, type ApiResponse, } from "./api_response";
3
3
  export { RejectionCode } from "./rejection";
4
4
  export { formatDecimal, isZero, parseDecimal } from "./price";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,UAAU,EACV,IAAI,EACJ,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,kBAAkB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,KAAK,sBAAsB,EAC3B,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE9D,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,oBAAoB,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAErE,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,UAAU,EACV,IAAI,EACJ,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,kBAAkB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,KAAK,sBAAsB,EAC3B,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE9D,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,oBAAoB,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAErE,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,WAAW,CAAC"}
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isUserCancellation = exports.scalePriceSizeV1 = exports.ScalingError = exports.scalePriceSizeLegacy = exports.scalePriceSize = exports.alignPriceToTick = exports.parseDecimal = exports.isZero = exports.formatDecimal = exports.RejectionCode = exports.isApiResponse = exports.ApiRejectedDetails = exports.TriggerUpdateType = exports.TriggerType = exports.TriggerStatus = exports.TriggerResultStatus = exports.TimeInForce = exports.Side = exports.Resolution = exports.OrderUpdateType = exports.sideLabel = exports.resolutionSeconds = exports.parseSide = exports.deriveOrderbookId = exports.DepositSource = exports.asPubkeyStr = exports.asOrderBookId = void 0;
3
+ exports.isUserCancellation = exports.scalePriceSizeV1 = exports.ScalingError = exports.scalePriceSizeLegacy = exports.scalePriceSize = exports.alignPriceToTick = exports.parseDecimal = exports.isZero = exports.formatDecimal = exports.RejectionCode = exports.isApiResponse = exports.ApiRejectedDetails = exports.TriggerUpdateType = exports.TriggerType = exports.TriggerStatus = exports.TriggerResultStatus = exports.TimeInForce = exports.Side = exports.Resolution = exports.OrderUpdateType = exports.sideLabel = exports.resolutionSeconds = exports.parseSide = exports.parseResolution = exports.deriveOrderbookId = exports.DepositSource = exports.asPubkeyStr = exports.asOrderBookId = void 0;
4
4
  var types_1 = require("./types");
5
5
  Object.defineProperty(exports, "asOrderBookId", { enumerable: true, get: function () { return types_1.asOrderBookId; } });
6
6
  Object.defineProperty(exports, "asPubkeyStr", { enumerable: true, get: function () { return types_1.asPubkeyStr; } });
7
7
  Object.defineProperty(exports, "DepositSource", { enumerable: true, get: function () { return types_1.DepositSource; } });
8
8
  Object.defineProperty(exports, "deriveOrderbookId", { enumerable: true, get: function () { return types_1.deriveOrderbookId; } });
9
+ Object.defineProperty(exports, "parseResolution", { enumerable: true, get: function () { return types_1.parseResolution; } });
9
10
  Object.defineProperty(exports, "parseSide", { enumerable: true, get: function () { return types_1.parseSide; } });
10
11
  Object.defineProperty(exports, "resolutionSeconds", { enumerable: true, get: function () { return types_1.resolutionSeconds; } });
11
12
  Object.defineProperty(exports, "sideLabel", { enumerable: true, get: function () { return types_1.sideLabel; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;AAAA,iCAoBiB;AAnBf,sGAAA,aAAa,OAAA;AACb,oGAAA,WAAW,OAAA;AACX,sGAAA,aAAa,OAAA;AACb,0GAAA,iBAAiB,OAAA;AACjB,kGAAA,SAAS,OAAA;AACT,0GAAA,iBAAiB,OAAA;AACjB,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA;AACf,mGAAA,UAAU,OAAA;AACV,6FAAA,IAAI,OAAA;AACJ,oGAAA,WAAW,OAAA;AACX,4GAAA,mBAAmB,OAAA;AACnB,sGAAA,aAAa,OAAA;AACb,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AAOnB,+CAKwB;AAJtB,kHAAA,kBAAkB,OAAA;AAClB,6GAAA,aAAa,OAAA;AAKf,yCAA4C;AAAnC,0GAAA,aAAa,OAAA;AAEtB,iCAA8D;AAArD,sGAAA,aAAa,OAAA;AAAE,+FAAA,MAAM,OAAA;AAAE,qGAAA,YAAY,OAAA;AAE5C,qCAQmB;AAPjB,2GAAA,gBAAgB,OAAA;AAChB,yGAAA,cAAc,OAAA;AACd,+GAAA,oBAAoB,OAAA;AACpB,uGAAA,YAAY,OAAA;AAMd,oCAAoC;AACpC,qCAAqE;AAA5D,2GAAA,oBAAoB,OAAoB;AAEjD,qCAImB;AAHjB,6GAAA,kBAAkB,OAAA","sourcesContent":["export {\n asOrderBookId,\n asPubkeyStr,\n DepositSource,\n deriveOrderbookId,\n parseSide,\n resolutionSeconds,\n sideLabel,\n OrderUpdateType,\n Resolution,\n Side,\n TimeInForce,\n TriggerResultStatus,\n TriggerStatus,\n TriggerType,\n TriggerUpdateType,\n type Branded,\n type OrderBookId,\n type PubkeyStr,\n type SubmitOrderRequest,\n} from \"./types\";\n\nexport {\n ApiRejectedDetails,\n isApiResponse,\n type ApiRejectedDetailsWire,\n type ApiResponse,\n} from \"./api_response\";\n\nexport { RejectionCode } from \"./rejection\";\n\nexport { formatDecimal, isZero, parseDecimal } from \"./price\";\n\nexport {\n alignPriceToTick,\n scalePriceSize,\n scalePriceSizeLegacy,\n ScalingError,\n type LegacyScaledAmounts,\n type OrderbookDecimals,\n type ScaledAmounts,\n} from \"./scaling\";\n\n// Backward-compatible name from v1.\nexport { scalePriceSizeLegacy as scalePriceSizeV1 } from \"./scaling\";\n\nexport {\n isUserCancellation,\n type ExternalSigner,\n type SigningStrategy,\n} from \"./signing\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;AAAA,iCAqBiB;AApBf,sGAAA,aAAa,OAAA;AACb,oGAAA,WAAW,OAAA;AACX,sGAAA,aAAa,OAAA;AACb,0GAAA,iBAAiB,OAAA;AACjB,wGAAA,eAAe,OAAA;AACf,kGAAA,SAAS,OAAA;AACT,0GAAA,iBAAiB,OAAA;AACjB,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA;AACf,mGAAA,UAAU,OAAA;AACV,6FAAA,IAAI,OAAA;AACJ,oGAAA,WAAW,OAAA;AACX,4GAAA,mBAAmB,OAAA;AACnB,sGAAA,aAAa,OAAA;AACb,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AAOnB,+CAKwB;AAJtB,kHAAA,kBAAkB,OAAA;AAClB,6GAAA,aAAa,OAAA;AAKf,yCAA4C;AAAnC,0GAAA,aAAa,OAAA;AAEtB,iCAA8D;AAArD,sGAAA,aAAa,OAAA;AAAE,+FAAA,MAAM,OAAA;AAAE,qGAAA,YAAY,OAAA;AAE5C,qCAQmB;AAPjB,2GAAA,gBAAgB,OAAA;AAChB,yGAAA,cAAc,OAAA;AACd,+GAAA,oBAAoB,OAAA;AACpB,uGAAA,YAAY,OAAA;AAMd,oCAAoC;AACpC,qCAAqE;AAA5D,2GAAA,oBAAoB,OAAoB;AAEjD,qCAImB;AAHjB,6GAAA,kBAAkB,OAAA","sourcesContent":["export {\n asOrderBookId,\n asPubkeyStr,\n DepositSource,\n deriveOrderbookId,\n parseResolution,\n parseSide,\n resolutionSeconds,\n sideLabel,\n OrderUpdateType,\n Resolution,\n Side,\n TimeInForce,\n TriggerResultStatus,\n TriggerStatus,\n TriggerType,\n TriggerUpdateType,\n type Branded,\n type OrderBookId,\n type PubkeyStr,\n type SubmitOrderRequest,\n} from \"./types\";\n\nexport {\n ApiRejectedDetails,\n isApiResponse,\n type ApiRejectedDetailsWire,\n type ApiResponse,\n} from \"./api_response\";\n\nexport { RejectionCode } from \"./rejection\";\n\nexport { formatDecimal, isZero, parseDecimal } from \"./price\";\n\nexport {\n alignPriceToTick,\n scalePriceSize,\n scalePriceSizeLegacy,\n ScalingError,\n type LegacyScaledAmounts,\n type OrderbookDecimals,\n type ScaledAmounts,\n} from \"./scaling\";\n\n// Backward-compatible name from v1.\nexport { scalePriceSizeLegacy as scalePriceSizeV1 } from \"./scaling\";\n\nexport {\n isUserCancellation,\n type ExternalSigner,\n type SigningStrategy,\n} from \"./signing\";\n"]}
@@ -57,6 +57,7 @@ export declare enum Resolution {
57
57
  Hour4 = "4h",
58
58
  Day1 = "1d"
59
59
  }
60
+ export declare function parseResolution(value: string): Resolution;
60
61
  export declare function resolutionSeconds(resolution: Resolution): number;
61
62
  export declare function deriveOrderbookId(baseToken: string, quoteToken: string): OrderBookId;
62
63
  export interface SubmitOrderRequest {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC;AAE/E,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AACzD,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAErD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAExD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAEpD;AAED,oBAAY,IAAI;IACd,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAI7C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,CAEpD;AAED,oBAAY,WAAW;IACrB,GAAG,QA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5
  exports.asPubkeyStr = asPubkeyStr;
6
6
  exports.parseSide = parseSide;
7
7
  exports.sideLabel = sideLabel;
8
+ exports.parseResolution = parseResolution;
8
9
  exports.resolutionSeconds = resolutionSeconds;
9
10
  exports.deriveOrderbookId = deriveOrderbookId;
10
11
  const error_1 = require("../error");
@@ -83,6 +84,24 @@ var Resolution;
83
84
  Resolution["Hour4"] = "4h";
84
85
  Resolution["Day1"] = "1d";
85
86
  })(Resolution || (exports.Resolution = Resolution = {}));
87
+ function parseResolution(value) {
88
+ switch (value) {
89
+ case "1m":
90
+ return Resolution.Minute1;
91
+ case "5m":
92
+ return Resolution.Minute5;
93
+ case "15m":
94
+ return Resolution.Minute15;
95
+ case "1h":
96
+ return Resolution.Hour1;
97
+ case "4h":
98
+ return Resolution.Hour4;
99
+ case "1d":
100
+ return Resolution.Day1;
101
+ default:
102
+ throw error_1.SdkError.validation(`Invalid resolution: ${value}`);
103
+ }
104
+ }
86
105
  function resolutionSeconds(resolution) {
87
106
  switch (resolution) {
88
107
  case Resolution.Minute1:
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":";;;AAOA,sCAEC;AAED,kCAEC;AAOD,8BAIC;AAED,8BAEC;AAwDD,8CAeC;AAED,8CAEC;AAvGD,oCAAoC;AAOpC,SAAgB,aAAa,CAAC,KAAa;IACzC,OAAO,KAAoB,CAAC;AAC9B,CAAC;AAED,SAAgB,WAAW,CAAC,KAAa;IACvC,OAAO,KAAkB,CAAC;AAC5B,CAAC;AAED,IAAY,IAGX;AAHD,WAAY,IAAI;IACd,mBAAW,CAAA;IACX,mBAAW,CAAA;AACb,CAAC,EAHW,IAAI,oBAAJ,IAAI,QAGf;AAED,SAAgB,SAAS,CAAC,KAAa;IACrC,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC;IACxD,IAAI,KAAK,KAAK,KAAK,IAA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HD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,kCAAiB,CAAA;AACnB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,4BAAc,CAAA;IACd,4BAAc,CAAA;IACd,8BAAgB,CAAA;IAChB,0BAAY,CAAA;IACZ,0BAAY,CAAA;IACZ,yBAAW,CAAA;AACb,CAAC,EAPW,UAAU,0BAAV,UAAU,QAOrB;AAED,SAAgB,iBAAiB,CAAC,UAAsB;IACtD,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,UAAU,CAAC,OAAO;YACrB,OAAO,EAAE,CAAC;QACZ,KAAK,UAAU,CAAC,OAAO;YACrB,OAAO,GAAG,CAAC;QACb,KAAK,UAAU,CAAC,QAAQ;YACtB,OAAO,GAAG,CAAC;QACb,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,IAAI,CAAC;QACd,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,KAAK,CAAC;QACf,KAAK,UAAU,CAAC,IAAI;YAClB,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED,SAAgB,iBAAiB,CAAC,SAAiB,EAAE,UAAkB;IACrE,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAiB,CAAC;AAC7E,CAAC","sourcesContent":["import { SdkError } from \"../error\";\n\nexport type Branded<T, Brand extends string> = T & { readonly __brand: Brand };\n\nexport type OrderBookId = Branded<string, \"OrderBookId\">;\nexport type PubkeyStr = Branded<string, \"PubkeyStr\">;\n\nexport function asOrderBookId(value: string): OrderBookId {\n return value as OrderBookId;\n}\n\nexport function asPubkeyStr(value: string): PubkeyStr {\n return value as PubkeyStr;\n}\n\nexport enum Side {\n Bid = \"bid\",\n Ask = \"ask\",\n}\n\nexport function parseSide(value: string): Side {\n if (value === \"bid\" || value === \"buy\") return Side.Bid;\n if (value === \"ask\" || value === \"sell\") return Side.Ask;\n throw SdkError.validation(`Invalid side: ${value}`);\n}\n\nexport function sideLabel(side: Side): \"Buy\" | \"Sell\" {\n return side === Side.Bid ? \"Buy\" : \"Sell\";\n}\n\nexport enum TimeInForce {\n Gtc = \"GTC\",\n Ioc = \"IOC\",\n Fok = \"FOK\",\n Alo = \"ALO\",\n}\n\nexport enum TriggerType {\n TakeProfit = \"TP\",\n StopLoss = \"SL\",\n}\n\nexport enum TriggerStatus {\n Created = \"created\",\n Triggered = \"triggered\",\n Failed = \"failed\",\n Expired = \"expired\",\n Invalidated = \"invalidated\",\n}\n\nexport enum OrderUpdateType {\n Placement = \"PLACEMENT\",\n Update = \"UPDATE\",\n Cancellation = \"CANCELLATION\",\n}\n\nexport enum TriggerUpdateType {\n Created = \"CREATED\",\n Triggered = \"TRIGGERED\",\n Failed = \"FAILED\",\n Expired = \"EXPIRED\",\n Invalidated = \"INVALIDATED\",\n}\n\nexport enum TriggerResultStatus {\n Filled = \"filled\",\n Accepted = \"accepted\",\n Rejected = \"rejected\",\n}\n\nexport enum DepositSource {\n Global = \"global\",\n Market = \"market\",\n}\n\nexport enum Resolution {\n Minute1 = \"1m\",\n Minute5 = \"5m\",\n Minute15 = \"15m\",\n Hour1 = \"1h\",\n Hour4 = \"4h\",\n Day1 = \"1d\",\n}\n\nexport function resolutionSeconds(resolution: Resolution): number {\n switch (resolution) {\n case Resolution.Minute1:\n return 60;\n case Resolution.Minute5:\n return 300;\n case Resolution.Minute15:\n return 900;\n case Resolution.Hour1:\n return 3600;\n case Resolution.Hour4:\n return 14400;\n case Resolution.Day1:\n return 86400;\n }\n}\n\nexport function deriveOrderbookId(baseToken: string, quoteToken: string): OrderBookId {\n return `${baseToken.slice(0, 8)}_${quoteToken.slice(0, 8)}` as OrderBookId;\n}\n\nexport interface SubmitOrderRequest {\n maker: string;\n nonce: number;\n salt: number;\n market_pubkey: string;\n base_token: string;\n quote_token: string;\n side: number;\n /** u64 amount — validated to fit in Number.MAX_SAFE_INTEGER at construction time */\n amount_in: number;\n /** u64 amount — validated to fit in Number.MAX_SAFE_INTEGER at construction time */\n amount_out: number;\n expiration: number;\n signature: string;\n orderbook_id: string;\n tif?: TimeInForce;\n trigger_price?: number;\n trigger_type?: TriggerType;\n deposit_source?: DepositSource;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":";;;AAOA,sCAEC;AAED,kCAEC;AAOD,8BAIC;AAED,8BAEC;AAwDD,0CAiBC;AAED,8CAeC;AAED,8CAEC;AA1HD,oCAAoC;AAOpC,SAAgB,aAAa,CAAC,KAAa;IACzC,OAAO,KAAoB,CAAC;AAC9B,CAAC;AAED,SAAgB,WAAW,CAAC,KAAa;IACvC,OAAO,KAAkB,CAAC;AAC5B,CAAC;AAED,IAAY,IAGX;AAHD,WAAY,IAAI;IACd,mBAAW,CAAA;IACX,mBAAW,CAAA;AACb,CAAC,EAHW,IAAI,oBAAJ,IAAI,QAGf;AAED,SAAgB,SAAS,CAAC,KAAa;IACrC,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC;IACxD,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC;IACzD,MAAM,gBAAQ,CAAC,UAAU,CAAC,iBAAiB,KAAK,EAAE,CAAC,CAAC;AACtD,CAAC;AAED,SAAgB,SAAS,CAAC,IAAU;IAClC,OAAO,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC;AAED,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,0BAAW,CAAA;IACX,0BAAW,CAAA;IACX,0BAAW,CAAA;IACX,0BAAW,CAAA;AACb,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AA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,OAAO,UAAU,CAAC,OAAO,CAAC;QAC5B,KAAK,KAAK;YACR,OAAO,UAAU,CAAC,QAAQ,CAAC;QAC7B,KAAK,IAAI;YACP,OAAO,UAAU,CAAC,KAAK,CAAC;QAC1B,KAAK,IAAI;YACP,OAAO,UAAU,CAAC,KAAK,CAAC;QAC1B,KAAK,IAAI;YACP,OAAO,UAAU,CAAC,IAAI,CAAC;QACzB;YACE,MAAM,gBAAQ,CAAC,UAAU,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,SAAgB,iBAAiB,CAAC,UAAsB;IACtD,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,UAAU,CAAC,OAAO;YACrB,OAAO,EAAE,CAAC;QACZ,KAAK,UAAU,CAAC,OAAO;YACrB,OAAO,GAAG,CAAC;QACb,KAAK,UAAU,CAAC,QAAQ;YACtB,OAAO,GAAG,CAAC;QACb,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,IAAI,CAAC;QACd,KAAK,UAAU,CAAC,KAAK;YACnB,OAAO,KAAK,CAAC;QACf,KAAK,UAAU,CAAC,IAAI;YAClB,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED,SAAgB,iBAAiB,CAAC,SAAiB,EAAE,UAAkB;IACrE,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAiB,CAAC;AAC7E,CAAC","sourcesContent":["import { SdkError } from \"../error\";\n\nexport type Branded<T, Brand extends string> = T & { readonly __brand: Brand };\n\nexport type OrderBookId = Branded<string, \"OrderBookId\">;\nexport type PubkeyStr = Branded<string, \"PubkeyStr\">;\n\nexport function asOrderBookId(value: string): OrderBookId {\n return value as OrderBookId;\n}\n\nexport function asPubkeyStr(value: string): PubkeyStr {\n return value as PubkeyStr;\n}\n\nexport enum Side {\n Bid = \"bid\",\n Ask = \"ask\",\n}\n\nexport function parseSide(value: string): Side {\n if (value === \"bid\" || value === \"buy\") return Side.Bid;\n if (value === \"ask\" || value === \"sell\") return Side.Ask;\n throw SdkError.validation(`Invalid side: ${value}`);\n}\n\nexport function sideLabel(side: Side): \"Buy\" | \"Sell\" {\n return side === Side.Bid ? \"Buy\" : \"Sell\";\n}\n\nexport enum TimeInForce {\n Gtc = \"GTC\",\n Ioc = \"IOC\",\n Fok = \"FOK\",\n Alo = \"ALO\",\n}\n\nexport enum TriggerType {\n TakeProfit = \"TP\",\n StopLoss = \"SL\",\n}\n\nexport enum TriggerStatus {\n Created = \"created\",\n Triggered = \"triggered\",\n Failed = \"failed\",\n Expired = \"expired\",\n Invalidated = \"invalidated\",\n}\n\nexport enum OrderUpdateType {\n Placement = \"PLACEMENT\",\n Update = \"UPDATE\",\n Cancellation = \"CANCELLATION\",\n}\n\nexport enum TriggerUpdateType {\n Created = \"CREATED\",\n Triggered = \"TRIGGERED\",\n Failed = \"FAILED\",\n Expired = \"EXPIRED\",\n Invalidated = \"INVALIDATED\",\n}\n\nexport enum TriggerResultStatus {\n Filled = \"filled\",\n Accepted = \"accepted\",\n Rejected = \"rejected\",\n}\n\nexport enum DepositSource {\n Global = \"global\",\n Market = \"market\",\n}\n\nexport enum Resolution {\n Minute1 = \"1m\",\n Minute5 = \"5m\",\n Minute15 = \"15m\",\n Hour1 = \"1h\",\n Hour4 = \"4h\",\n Day1 = \"1d\",\n}\n\nexport function parseResolution(value: string): Resolution {\n switch (value) {\n case \"1m\":\n return Resolution.Minute1;\n case \"5m\":\n return Resolution.Minute5;\n case \"15m\":\n return Resolution.Minute15;\n case \"1h\":\n return Resolution.Hour1;\n case \"4h\":\n return Resolution.Hour4;\n case \"1d\":\n return Resolution.Day1;\n default:\n throw SdkError.validation(`Invalid resolution: ${value}`);\n }\n}\n\nexport function resolutionSeconds(resolution: Resolution): number {\n switch (resolution) {\n case Resolution.Minute1:\n return 60;\n case Resolution.Minute5:\n return 300;\n case Resolution.Minute15:\n return 900;\n case Resolution.Hour1:\n return 3600;\n case Resolution.Hour4:\n return 14400;\n case Resolution.Day1:\n return 86400;\n }\n}\n\nexport function deriveOrderbookId(baseToken: string, quoteToken: string): OrderBookId {\n return `${baseToken.slice(0, 8)}_${quoteToken.slice(0, 8)}` as OrderBookId;\n}\n\nexport interface SubmitOrderRequest {\n maker: string;\n nonce: number;\n salt: number;\n market_pubkey: string;\n base_token: string;\n quote_token: string;\n side: number;\n /** u64 amount — validated to fit in Number.MAX_SAFE_INTEGER at construction time */\n amount_in: number;\n /** u64 amount — validated to fit in Number.MAX_SAFE_INTEGER at construction time */\n amount_out: number;\n expiration: number;\n signature: string;\n orderbook_id: string;\n tif?: TimeInForce;\n trigger_price?: number;\n trigger_type?: TriggerType;\n deposit_source?: DepositSource;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { MarketEvent } from "../domain/market";
2
2
  import { type AuthUpdate, type UserUpdate } from "../domain/order/wire";
3
3
  import type { OrderBook, WsTickerData } from "../domain/orderbook";
4
- import type { DepositPrice, PriceHistory } from "../domain/price_history";
4
+ import type { DepositAssetPriceEvent, DepositPrice, PriceHistory } from "../domain/price_history";
5
5
  import type { WsTrade } from "../domain/trade";
6
6
  import type { OrderBookId, PubkeyStr, Resolution } from "../shared";
7
7
  export * from "./client.node";
@@ -56,6 +56,10 @@ export type MessageIn = {
56
56
  type: "deposit_price";
57
57
  version: number;
58
58
  data: DepositPrice;
59
+ } | {
60
+ type: "deposit_asset_price";
61
+ version: number;
62
+ data: DepositAssetPriceEvent;
59
63
  };
60
64
  export type Kind = MessageIn;
61
65
  export interface WsError {
@@ -113,5 +117,12 @@ export declare function subscribeMarket(marketPubkey: PubkeyStr): MessageOut;
113
117
  export declare function unsubscribeMarket(marketPubkey: PubkeyStr): MessageOut;
114
118
  export declare function subscribeDepositPrice(depositAsset: string, resolution: Resolution): MessageOut;
115
119
  export declare function unsubscribeDepositPrice(depositAsset: string, resolution: Resolution): MessageOut;
120
+ /**
121
+ * Subscribe to the live spot price for one deposit asset (snapshot +
122
+ * per-asset price ticks). Distinct from `subscribeDepositPrice`, which
123
+ * carries OHLCV candles per resolution.
124
+ */
125
+ export declare function subscribeDepositAssetPrice(depositAsset: string): MessageOut;
126
+ export declare function unsubscribeDepositAssetPrice(depositAsset: string): MessageOut;
116
127
  export declare function parseMessageIn(input: string): MessageIn;
117
128
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ws/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAuB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEpE,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,UAAU,GAClB;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,OAAO,iBAAiB,EAAE,eAAe,CAAA;CAAE,GAC1E;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,OAAO,iBAAiB,EAAE,iBAAiB,CAAA;CAAE,GAC9E;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvB,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,E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MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,UAAU,CAShG;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,CAK3E;AAED,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,CAK7E;AAgBD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAuBvD"}
package/dist/ws/index.js CHANGED
@@ -31,6 +31,8 @@ exports.subscribeMarket = subscribeMarket;
31
31
  exports.unsubscribeMarket = unsubscribeMarket;
32
32
  exports.subscribeDepositPrice = subscribeDepositPrice;
33
33
  exports.unsubscribeDepositPrice = unsubscribeDepositPrice;
34
+ exports.subscribeDepositAssetPrice = subscribeDepositAssetPrice;
35
+ exports.unsubscribeDepositAssetPrice = unsubscribeDepositAssetPrice;
34
36
  exports.parseMessageIn = parseMessageIn;
35
37
  const wire_1 = require("../domain/order/wire");
36
38
  const error_1 = require("../error");
@@ -199,6 +201,23 @@ function unsubscribeDepositPrice(depositAsset, resolution) {
199
201
  },
200
202
  };
201
203
  }
204
+ /**
205
+ * Subscribe to the live spot price for one deposit asset (snapshot +
206
+ * per-asset price ticks). Distinct from `subscribeDepositPrice`, which
207
+ * carries OHLCV candles per resolution.
208
+ */
209
+ function subscribeDepositAssetPrice(depositAsset) {
210
+ return {
211
+ method: "subscribe",
212
+ params: { type: "deposit_asset_price", deposit_asset: depositAsset },
213
+ };
214
+ }
215
+ function unsubscribeDepositAssetPrice(depositAsset) {
216
+ return {
217
+ method: "unsubscribe",
218
+ params: { type: "deposit_asset_price", deposit_asset: depositAsset },
219
+ };
220
+ }
202
221
  const VALID_MESSAGE_TYPES = new Set([
203
222
  "book_update",
204
223
  "pong",
@@ -210,6 +229,7 @@ const VALID_MESSAGE_TYPES = new Set([
210
229
  "ticker",
211
230
  "market",
212
231
  "deposit_price",
232
+ "deposit_asset_price",
213
233
  ]);
214
234
  function parseMessageIn(input) {
215
235
  const parsed = JSON.parse(input);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ws/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA0EA,wCAYC;AAED,oBAEC;AAED,wCAQC;AAED,4CAQC;AAED,0CAQC;AAED,8CAQC;AAED,sCAQC;AAED,0CAQC;AAED,sDAUC;AAED,0DASC;AAED,0CAQC;AAED,8CAQC;AAED,0CAQC;AAED,8CAQC;AAED,sDASC;AAED,0DASC;AAeD,wCAuBC;AAhRD,+CAA6F;AAI7F,oCAAmD;AACnD,gCAA6C;AAG7C,gDAA8B;AAC9B,kDAAgC;AAgDnB,QAAA,iBAAiB,GAAa;IACzC,GAAG,EAAE,IAAA,WAAK,EAAC,kBAAY,CAAC,IAAI,CAAC;IAC7B,SAAS,EAAE,IAAI;IACf,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,KAAK;IAC3B,cAAc,EAAE,MAAM;IACtB,aAAa,EAAE,MAAM;CACtB,CAAC;AAEF,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,uDAAc,CAAA;IACd,2CAAQ,CAAA;IACR,iDAAW,CAAA;IACX,+CAAU,CAAA;AACZ,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,CAAC;YACJ,OAAO,UAAU,CAAC,UAAU,CAAC;QAC/B,KAAK,CAAC;YACJ,OAAO,UAAU,CAAC,IAAI,CAAC;QACzB,KAAK,CAAC;YACJ,OAAO,UAAU,CAAC,OAAO,CAAC;QAC5B,KAAK,CAAC,CAAC;QACP;YACE,OAAO,UAAU,CAAC,MAAM,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,SAAgB,IAAI;IAClB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC;AAED,SAAgB,cAAc,CAAC,YAA2B;IACxD,OAAO;QACL,MAAM,EAAE,W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CAAC;AACjB,CAAC","sourcesContent":["import type { MarketEvent } from \"../domain/market\";\nimport { normalizeUserUpdate, type AuthUpdate, type UserUpdate } from \"../domain/order/wire\";\nimport type { OrderBook, WsTickerData } from \"../domain/orderbook\";\nimport type { DepositPrice, PriceHistory } from \"../domain/price_history\";\nimport type { WsTrade } from \"../domain/trade\";\nimport { WsError as WsErrorClass } from \"../error\";\nimport { LightconeEnv, wsUrl } from \"../env\";\nimport type { OrderBookId, PubkeyStr, Resolution } from \"../shared\";\n\nexport * from \"./client.node\";\nexport * from \"./subscriptions\";\nexport type { IWsClient } from \"./types\";\n\nexport type MessageOut =\n | { method: \"subscribe\"; params: import(\"./subscriptions\").SubscribeParams }\n | { method: \"unsubscribe\"; params: import(\"./subscriptions\").UnsubscribeParams }\n | { method: \"ping\" };\n\nexport type MessageIn =\n | { type: \"book_update\"; version: number; data: OrderBook }\n | { type: \"pong\"; version: number; data: Record<string, never> }\n | { type: \"user\"; version: number; data: UserUpdate }\n | { type: \"error\"; version: number; data: WsError }\n | { type: \"price_history\"; version: number; data: PriceHistory }\n | { type: \"trades\"; version: number; data: WsTrade }\n | { type: \"auth\"; version: number; data: AuthUpdate }\n | { type: \"ticker\"; version: number; data: WsTickerData }\n | { type: \"market\"; version: number; data: MarketEvent }\n | { type: \"deposit_price\"; version: number; data: DepositPrice };\n\nexport type Kind = MessageIn;\n\nexport interface WsError {\n error: string;\n code?: string;\n orderbook_id?: string;\n wallet_address?: string;\n deposit_asset?: string;\n hint?: string;\n details?: string;\n}\n\nexport type WsEvent =\n | { type: \"Message\"; message: MessageIn }\n | { type: \"Connected\" }\n | { type: \"Disconnected\"; code?: number; reason: string }\n | { type: \"Error\"; error: string }\n | { type: \"MaxReconnectReached\" };\n\nexport interface WsConfig {\n url: string;\n reconnect: boolean;\n maxReconnectAttempts: number;\n baseReconnectDelayMs: number;\n pingIntervalMs: number;\n pongTimeoutMs: number;\n}\n\nexport const WS_DEFAULT_CONFIG: WsConfig = {\n url: wsUrl(LightconeEnv.Prod),\n reconnect: true,\n maxReconnectAttempts: 10,\n baseReconnectDelayMs: 1_000,\n pingIntervalMs: 30_000,\n pongTimeoutMs: 10_000,\n};\n\nexport enum ReadyState {\n Connecting = 0,\n Open = 1,\n Closing = 2,\n Closed = 3,\n}\n\nexport function readyStateFrom(value: number): ReadyState {\n switch (value) {\n case 0:\n return ReadyState.Connecting;\n case 1:\n return ReadyState.Open;\n case 2:\n return ReadyState.Closing;\n case 3:\n default:\n return ReadyState.Closed;\n }\n}\n\nexport function ping(): MessageOut {\n return { method: \"ping\" };\n}\n\nexport function subscribeBooks(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"book_update\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function unsubscribeBooks(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"book_update\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function subscribeTrades(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"trades\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function unsubscribeTrades(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"trades\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function subscribeUser(walletAddress: PubkeyStr): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"user\",\n wallet_address: walletAddress,\n },\n };\n}\n\nexport function unsubscribeUser(walletAddress: PubkeyStr): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"user\",\n wallet_address: walletAddress,\n },\n };\n}\n\nexport function subscribePriceHistory(orderbookId: OrderBookId, resolution: Resolution): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"price_history\",\n orderbook_id: orderbookId,\n resolution,\n include_ohlcv: false,\n },\n };\n}\n\nexport function unsubscribePriceHistory(orderbookId: OrderBookId, resolution: Resolution): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"price_history\",\n orderbook_id: orderbookId,\n resolution,\n },\n };\n}\n\nexport function subscribeTicker(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"ticker\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function unsubscribeTicker(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"ticker\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function subscribeMarket(marketPubkey: PubkeyStr): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"market\",\n market_pubkey: marketPubkey,\n },\n };\n}\n\nexport function unsubscribeMarket(marketPubkey: PubkeyStr): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"market\",\n market_pubkey: marketPubkey,\n },\n };\n}\n\nexport function subscribeDepositPrice(depositAsset: string, resolution: Resolution): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"deposit_price\",\n deposit_asset: depositAsset,\n resolution,\n },\n };\n}\n\nexport function unsubscribeDepositPrice(depositAsset: string, resolution: Resolution): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"deposit_price\",\n deposit_asset: depositAsset,\n resolution,\n },\n };\n}\n\nconst VALID_MESSAGE_TYPES = new Set([\n \"book_update\",\n \"pong\",\n \"user\",\n \"error\",\n \"price_history\",\n \"trades\",\n \"auth\",\n \"ticker\",\n \"market\",\n \"deposit_price\",\n]);\n\nexport function parseMessageIn(input: string): MessageIn {\n const parsed: unknown = JSON.parse(input);\n if (typeof parsed !== \"object\" || parsed === null || !(\"type\" in parsed)) {\n throw new WsErrorClass(\"ProtocolError\", `Invalid WS message: missing \"type\" field`);\n }\n const obj = parsed as Record<string, unknown>;\n if (typeof obj.type !== \"string\" || !VALID_MESSAGE_TYPES.has(obj.type)) {\n throw new WsErrorClass(\"ProtocolError\", `Invalid WS message type: \"${String(obj.type)}\"`);\n }\n if (!(\"version\" in obj) || typeof obj.version !== \"number\") {\n throw new WsErrorClass(\"ProtocolError\", `Invalid WS message: missing or invalid \"version\" field`);\n }\n if (!(\"data\" in obj) || typeof obj.data !== \"object\" || obj.data === null) {\n throw new WsErrorClass(\"ProtocolError\", `Invalid WS message: missing or invalid \"data\" field`);\n }\n const message = parsed as MessageIn;\n if (message.type === \"user\") {\n return {\n ...message,\n data: normalizeUserUpdate(message.data as Parameters<typeof normalizeUserUpdate>[0]),\n };\n }\n return message;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ws/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA+EA,wCAYC;AAED,oBAEC;AAED,wCAQC;AAED,4CAQC;AAED,0CAQC;AAED,8CAQC;AAED,sCAQC;AAED,0CAQC;AAED,sDAUC;AAED,0DASC;AAED,0CAQC;AAED,8CAQC;AAED,0CAQC;AAED,8CAQC;AAED,sDASC;AAED,0DASC;AAOD,gEAKC;AAED,oEAKC;AAgBD,wCAuBC;AAzSD,+CAA6F;AAQ7F,oCAAmD;AACnD,gCAA6C;AAG7C,gDAA8B;AAC9B,kDAAgC;AAiDnB,QAAA,iBAAiB,GAAa;IACzC,GAAG,EAAE,IAAA,WAAK,EAAC,kBAAY,CAAC,IAAI,CAAC;IAC7B,SAAS,EAAE,IAAI;IACf,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,KAAK;IAC3B,cAAc,EAAE,MAAM;IACtB,aAAa,EAAE,MAAM;CACtB,CAAC;AAEF,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,uDAAc,CAAA;IACd,2CAAQ,CAAA;IACR,iDAAW,CAAA;IACX,+CAAU,CAAA;AACZ,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,CAAC;YACJ,OAAO,UAAU,CAAC,UAAU,CAAC;QAC/B,KAAK,CAAC;Y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MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5F,CAAC;IACD,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC3D,MAAM,IAAI,eAAY,CAAC,eAAe,EAAE,wDAAwD,CAAC,CAAC;IACpG,CAAC;IACD,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAC1E,MAAM,IAAI,eAAY,CAAC,eAAe,EAAE,qDAAqD,CAAC,CAAC;IACjG,CAAC;IACD,MAAM,OAAO,GAAG,MAAmB,CAAC;IACpC,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC5B,OAAO;YACL,GAAG,OAAO;YACV,IAAI,EAAE,IAAA,0BAAmB,EAAC,OAAO,CAAC,IAAiD,CAAC;SACrF,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { MarketEvent } from \"../domain/market\";\nimport { normalizeUserUpdate, type AuthUpdate, type UserUpdate } from \"../domain/order/wire\";\nimport type { OrderBook, WsTickerData } from \"../domain/orderbook\";\nimport type {\n DepositAssetPriceEvent,\n DepositPrice,\n PriceHistory,\n} from \"../domain/price_history\";\nimport type { WsTrade } from \"../domain/trade\";\nimport { WsError as WsErrorClass } from \"../error\";\nimport { LightconeEnv, wsUrl } from \"../env\";\nimport type { OrderBookId, PubkeyStr, Resolution } from \"../shared\";\n\nexport * from \"./client.node\";\nexport * from \"./subscriptions\";\nexport type { IWsClient } from \"./types\";\n\nexport type MessageOut =\n | { method: \"subscribe\"; params: import(\"./subscriptions\").SubscribeParams }\n | { method: \"unsubscribe\"; params: import(\"./subscriptions\").UnsubscribeParams }\n | { method: \"ping\" };\n\nexport type MessageIn =\n | { type: \"book_update\"; version: number; data: OrderBook }\n | { type: \"pong\"; version: number; data: Record<string, never> }\n | { type: \"user\"; version: number; data: UserUpdate }\n | { type: \"error\"; version: number; data: WsError }\n | { type: \"price_history\"; version: number; data: PriceHistory }\n | { type: \"trades\"; version: number; data: WsTrade }\n | { type: \"auth\"; version: number; data: AuthUpdate }\n | { type: \"ticker\"; version: number; data: WsTickerData }\n | { type: \"market\"; version: number; data: MarketEvent }\n | { type: \"deposit_price\"; version: number; data: DepositPrice }\n | { type: \"deposit_asset_price\"; version: number; data: DepositAssetPriceEvent };\n\nexport type Kind = MessageIn;\n\nexport interface WsError {\n error: string;\n code?: string;\n orderbook_id?: string;\n wallet_address?: string;\n deposit_asset?: string;\n hint?: string;\n details?: string;\n}\n\nexport type WsEvent =\n | { type: \"Message\"; message: MessageIn }\n | { type: \"Connected\" }\n | { type: \"Disconnected\"; code?: number; reason: string }\n | { type: \"Error\"; error: string }\n | { type: \"MaxReconnectReached\" };\n\nexport interface WsConfig {\n url: string;\n reconnect: boolean;\n maxReconnectAttempts: number;\n baseReconnectDelayMs: number;\n pingIntervalMs: number;\n pongTimeoutMs: number;\n}\n\nexport const WS_DEFAULT_CONFIG: WsConfig = {\n url: wsUrl(LightconeEnv.Prod),\n reconnect: true,\n maxReconnectAttempts: 10,\n baseReconnectDelayMs: 1_000,\n pingIntervalMs: 30_000,\n pongTimeoutMs: 10_000,\n};\n\nexport enum ReadyState {\n Connecting = 0,\n Open = 1,\n Closing = 2,\n Closed = 3,\n}\n\nexport function readyStateFrom(value: number): ReadyState {\n switch (value) {\n case 0:\n return ReadyState.Connecting;\n case 1:\n return ReadyState.Open;\n case 2:\n return ReadyState.Closing;\n case 3:\n default:\n return ReadyState.Closed;\n }\n}\n\nexport function ping(): MessageOut {\n return { method: \"ping\" };\n}\n\nexport function subscribeBooks(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"book_update\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function unsubscribeBooks(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"book_update\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function subscribeTrades(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"trades\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function unsubscribeTrades(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"trades\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function subscribeUser(walletAddress: PubkeyStr): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"user\",\n wallet_address: walletAddress,\n },\n };\n}\n\nexport function unsubscribeUser(walletAddress: PubkeyStr): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"user\",\n wallet_address: walletAddress,\n },\n };\n}\n\nexport function subscribePriceHistory(orderbookId: OrderBookId, resolution: Resolution): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"price_history\",\n orderbook_id: orderbookId,\n resolution,\n include_ohlcv: false,\n },\n };\n}\n\nexport function unsubscribePriceHistory(orderbookId: OrderBookId, resolution: Resolution): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"price_history\",\n orderbook_id: orderbookId,\n resolution,\n },\n };\n}\n\nexport function subscribeTicker(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"ticker\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function unsubscribeTicker(orderbookIds: OrderBookId[]): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"ticker\",\n orderbook_ids: orderbookIds,\n },\n };\n}\n\nexport function subscribeMarket(marketPubkey: PubkeyStr): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"market\",\n market_pubkey: marketPubkey,\n },\n };\n}\n\nexport function unsubscribeMarket(marketPubkey: PubkeyStr): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"market\",\n market_pubkey: marketPubkey,\n },\n };\n}\n\nexport function subscribeDepositPrice(depositAsset: string, resolution: Resolution): MessageOut {\n return {\n method: \"subscribe\",\n params: {\n type: \"deposit_price\",\n deposit_asset: depositAsset,\n resolution,\n },\n };\n}\n\nexport function unsubscribeDepositPrice(depositAsset: string, resolution: Resolution): MessageOut {\n return {\n method: \"unsubscribe\",\n params: {\n type: \"deposit_price\",\n deposit_asset: depositAsset,\n resolution,\n },\n };\n}\n\n/**\n * Subscribe to the live spot price for one deposit asset (snapshot +\n * per-asset price ticks). Distinct from `subscribeDepositPrice`, which\n * carries OHLCV candles per resolution.\n */\nexport function subscribeDepositAssetPrice(depositAsset: string): MessageOut {\n return {\n method: \"subscribe\",\n params: { type: \"deposit_asset_price\", deposit_asset: depositAsset },\n };\n}\n\nexport function unsubscribeDepositAssetPrice(depositAsset: string): MessageOut {\n return {\n method: \"unsubscribe\",\n params: { type: \"deposit_asset_price\", deposit_asset: depositAsset },\n };\n}\n\nconst VALID_MESSAGE_TYPES = new Set([\n \"book_update\",\n \"pong\",\n \"user\",\n \"error\",\n \"price_history\",\n \"trades\",\n \"auth\",\n \"ticker\",\n \"market\",\n \"deposit_price\",\n \"deposit_asset_price\",\n]);\n\nexport function parseMessageIn(input: string): MessageIn {\n const parsed: unknown = JSON.parse(input);\n if (typeof parsed !== \"object\" || parsed === null || !(\"type\" in parsed)) {\n throw new WsErrorClass(\"ProtocolError\", `Invalid WS message: missing \"type\" field`);\n }\n const obj = parsed as Record<string, unknown>;\n if (typeof obj.type !== \"string\" || !VALID_MESSAGE_TYPES.has(obj.type)) {\n throw new WsErrorClass(\"ProtocolError\", `Invalid WS message type: \"${String(obj.type)}\"`);\n }\n if (!(\"version\" in obj) || typeof obj.version !== \"number\") {\n throw new WsErrorClass(\"ProtocolError\", `Invalid WS message: missing or invalid \"version\" field`);\n }\n if (!(\"data\" in obj) || typeof obj.data !== \"object\" || obj.data === null) {\n throw new WsErrorClass(\"ProtocolError\", `Invalid WS message: missing or invalid \"data\" field`);\n }\n const message = parsed as MessageIn;\n if (message.type === \"user\") {\n return {\n ...message,\n data: normalizeUserUpdate(message.data as Parameters<typeof normalizeUserUpdate>[0]),\n };\n }\n return message;\n}\n"]}
@@ -23,6 +23,9 @@ export type SubscribeParams = {
23
23
  type: "deposit_price";
24
24
  deposit_asset: string;
25
25
  resolution: Resolution;
26
+ } | {
27
+ type: "deposit_asset_price";
28
+ deposit_asset: string;
26
29
  };
27
30
  export type UnsubscribeParams = {
28
31
  type: "book_update";
@@ -47,6 +50,9 @@ export type UnsubscribeParams = {
47
50
  type: "deposit_price";
48
51
  deposit_asset: string;
49
52
  resolution: Resolution;
53
+ } | {
54
+ type: "deposit_asset_price";
55
+ deposit_asset: string;
50
56
  };
51
57
  export interface Subscription {
52
58
  toSubscribeParams(): SubscribeParams;
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/ws/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEpE,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,aAAa,EAAE,WAAW,EAAE,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,aAAa,EAAE,WAAW,EAAE,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,SAAS,CAAA;CAAE,GAC3C;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,YAAY,EAAE,WAAW,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,aAAa,EAAE,WAAW,EAAE,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,QAAQ,CAAC;I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AI,EAAE,QAAQ,CAAC;IAAC,aAAa,EAAE,SAAS,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,GACxE;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC3B,iBAAiB,IAAI,eAAe,CAAC;IACrC,mBAAmB,IAAI,iBAAiB,CAAC;IACzC,kBAAkB,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC5D,eAAe,IAAI,MAAM,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAmB/D;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,eAAe,EAC1B,WAAW,EAAE,iBAAiB,GAC7B,OAAO,CA6BT"}
@@ -18,6 +18,8 @@ function subscriptionKey(params) {
18
18
  return `market:${params.market_pubkey}`;
19
19
  case "deposit_price":
20
20
  return `deposit_price:${params.deposit_asset}:${params.resolution}`;
21
+ case "deposit_asset_price":
22
+ return `deposit_asset_price:${params.deposit_asset}`;
21
23
  }
22
24
  }
23
25
  function unsubscribeMatches(subscribe, unsubscribe) {
@@ -41,6 +43,8 @@ function unsubscribeMatches(subscribe, unsubscribe) {
41
43
  case "deposit_price":
42
44
  return (subscribe.deposit_asset === unsubscribe.deposit_asset &&
43
45
  subscribe.resolution === unsubscribe.resolution);
46
+ case "deposit_asset_price":
47
+ return subscribe.deposit_asset === unsubscribe.deposit_asset;
44
48
  }
45
49
  }
46
50
  function idsKey(ids) {
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/ws/subscriptions.ts"],"names":[],"mappings":";;AAgCA,0CAiBC;AAED,gDA8BC;AAjDD,SAAgB,eAAe,CAAC,MAAuB;IACrD,QAAQ,MAAM,CAAC,I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pG,KAAK,eAAe;YAClB,OAAO,CACL,SAAS,CAAC,YAAY,KAAM,WAA6C,CAAC,YAAY;gBACtF,SAAS,CAAC,UAAU,KAAM,WAA0C,CAAC,UAAU,CAChF,CAAC;QACJ,KAAK,QAAQ;YACX,OAAO,SAAS,CAAC,aAAa,KAAM,WAA4C,CAAC,aAAa,CAAC;QACjG,KAAK,eAAe;YAClB,OAAO,CACL,SAAS,CAAC,aAAa,KAAM,WAAyC,CAAC,aAAa;gBACpF,SAAS,CAAC,UAAU,KAAM,WAA0C,CAAC,UAAU,CAChF,CAAC;IACN,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,GAAsB;IACpC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import type { OrderBookId, PubkeyStr, Resolution } from \"../shared\";\n\nexport type SubscribeParams =\n | { type: \"book_update\"; orderbook_ids: OrderBookId[] }\n | { type: \"trades\"; orderbook_ids: OrderBookId[] }\n | { type: \"user\"; wallet_address: PubkeyStr }\n | {\n type: \"price_history\";\n orderbook_id: OrderBookId;\n resolution: Resolution;\n include_ohlcv?: boolean;\n }\n | { type: \"ticker\"; orderbook_ids: OrderBookId[] }\n | { type: \"market\"; market_pubkey: PubkeyStr }\n | { type: \"deposit_price\"; deposit_asset: string; resolution: Resolution };\n\nexport type UnsubscribeParams =\n | { type: \"book_update\"; orderbook_ids: OrderBookId[] }\n | { type: \"trades\"; orderbook_ids: OrderBookId[] }\n | { type: \"user\"; wallet_address: PubkeyStr }\n | { type: \"price_history\"; orderbook_id: OrderBookId; resolution: Resolution }\n | { type: \"ticker\"; orderbook_ids: OrderBookId[] }\n | { type: \"market\"; market_pubkey: PubkeyStr }\n | { type: \"deposit_price\"; deposit_asset: string; resolution: Resolution };\n\nexport interface Subscription {\n toSubscribeParams(): SubscribeParams;\n toUnsubscribeParams(): UnsubscribeParams;\n matchesUnsubscribe(unsubscribe: UnsubscribeParams): boolean;\n subscriptionKey(): string;\n}\n\nexport function subscriptionKey(params: SubscribeParams): string {\n switch (params.type) {\n case \"book_update\":\n return `book:${idsKey(params.orderbook_ids)}`;\n case \"trades\":\n return `trades:${idsKey(params.orderbook_ids)}`;\n case \"user\":\n return `user:${params.wallet_address}`;\n case \"price_history\":\n return `price_history:${params.orderbook_id}:${params.resolution}`;\n case \"ticker\":\n return `ticker:${idsKey(params.orderbook_ids)}`;\n case \"market\":\n return `market:${params.market_pubkey}`;\n case \"deposit_price\":\n return `deposit_price:${params.deposit_asset}:${params.resolution}`;\n }\n}\n\nexport function unsubscribeMatches(\n subscribe: SubscribeParams,\n unsubscribe: UnsubscribeParams\n): boolean {\n if (subscribe.type !== unsubscribe.type) {\n return false;\n }\n\n switch (subscribe.type) {\n case \"book_update\":\n return idsKey(subscribe.orderbook_ids) === idsKey((unsubscribe as { orderbook_ids: OrderBookId[] }).orderbook_ids);\n case \"trades\":\n return idsKey(subscribe.orderbook_ids) === idsKey((unsubscribe as { orderbook_ids: OrderBookId[] }).orderbook_ids);\n case \"ticker\":\n return idsKey(subscribe.orderbook_ids) === idsKey((unsubscribe as { orderbook_ids: OrderBookId[] }).orderbook_ids);\n case \"user\":\n return subscribe.wallet_address === (unsubscribe as { wallet_address: PubkeyStr }).wallet_address;\n case \"price_history\":\n return (\n subscribe.orderbook_id === (unsubscribe as { orderbook_id: OrderBookId }).orderbook_id &&\n subscribe.resolution === (unsubscribe as { resolution: Resolution }).resolution\n );\n case \"market\":\n return subscribe.market_pubkey === (unsubscribe as { market_pubkey: PubkeyStr }).market_pubkey;\n case \"deposit_price\":\n return (\n subscribe.deposit_asset === (unsubscribe as { deposit_asset: string }).deposit_asset &&\n subscribe.resolution === (unsubscribe as { resolution: Resolution }).resolution\n );\n }\n}\n\nfunction idsKey(ids: readonly string[]): string {\n return [...ids].sort().join(\",\");\n}\n"]}
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/ws/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,QAAQ;YACX,OAAO,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,MAAM,CAAE,WAAgD,CAAC,aAAa,CAAC,CAAC;QACrH,KAAK,MAAM;YACT,OAAO,SAAS,CAAC,cAAc,KAAM,WAA6C,CAAC,cAAc,CAAC;QACpG,KAAK,eAAe;YAClB,OAAO,CACL,SAAS,CAAC,YAAY,KAAM,WAA6C,CAAC,YAAY;gBACtF,SAAS,CAAC,UAAU,KAAM,WAA0C,CAAC,UAAU,CAChF,CAAC;QACJ,KAAK,QAAQ;YACX,OAAO,SAAS,CAAC,aAAa,KAAM,WAA4C,CAAC,aAAa,CAAC;QACjG,KAAK,eAAe;YAClB,OAAO,CACL,SAAS,CAAC,aAAa,KAAM,WAAyC,CAAC,aAAa;gBACpF,SAAS,CAAC,UAAU,KAAM,WAA0C,CAAC,UAAU,CAChF,CAAC;QACJ,KAAK,qBAAqB;YACxB,OAAO,SAAS,CAAC,aAAa,KAAM,WAAyC,CAAC,aAAa,CAAC;IAChG,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,GAAsB;IACpC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import type { OrderBookId, PubkeyStr, Resolution } from \"../shared\";\n\nexport type SubscribeParams =\n | { type: \"book_update\"; orderbook_ids: OrderBookId[] }\n | { type: \"trades\"; orderbook_ids: OrderBookId[] }\n | { type: \"user\"; wallet_address: PubkeyStr }\n | {\n type: \"price_history\";\n orderbook_id: OrderBookId;\n resolution: Resolution;\n include_ohlcv?: boolean;\n }\n | { type: \"ticker\"; orderbook_ids: OrderBookId[] }\n | { type: \"market\"; market_pubkey: PubkeyStr }\n | { type: \"deposit_price\"; deposit_asset: string; resolution: Resolution }\n | { type: \"deposit_asset_price\"; deposit_asset: string };\n\nexport type UnsubscribeParams =\n | { type: \"book_update\"; orderbook_ids: OrderBookId[] }\n | { type: \"trades\"; orderbook_ids: OrderBookId[] }\n | { type: \"user\"; wallet_address: PubkeyStr }\n | { type: \"price_history\"; orderbook_id: OrderBookId; resolution: Resolution }\n | { type: \"ticker\"; orderbook_ids: OrderBookId[] }\n | { type: \"market\"; market_pubkey: PubkeyStr }\n | { type: \"deposit_price\"; deposit_asset: string; resolution: Resolution }\n | { type: \"deposit_asset_price\"; deposit_asset: string };\n\nexport interface Subscription {\n toSubscribeParams(): SubscribeParams;\n toUnsubscribeParams(): UnsubscribeParams;\n matchesUnsubscribe(unsubscribe: UnsubscribeParams): boolean;\n subscriptionKey(): string;\n}\n\nexport function subscriptionKey(params: SubscribeParams): string {\n switch (params.type) {\n case \"book_update\":\n return `book:${idsKey(params.orderbook_ids)}`;\n case \"trades\":\n return `trades:${idsKey(params.orderbook_ids)}`;\n case \"user\":\n return `user:${params.wallet_address}`;\n case \"price_history\":\n return `price_history:${params.orderbook_id}:${params.resolution}`;\n case \"ticker\":\n return `ticker:${idsKey(params.orderbook_ids)}`;\n case \"market\":\n return `market:${params.market_pubkey}`;\n case \"deposit_price\":\n return `deposit_price:${params.deposit_asset}:${params.resolution}`;\n case \"deposit_asset_price\":\n return `deposit_asset_price:${params.deposit_asset}`;\n }\n}\n\nexport function unsubscribeMatches(\n subscribe: SubscribeParams,\n unsubscribe: UnsubscribeParams\n): boolean {\n if (subscribe.type !== unsubscribe.type) {\n return false;\n }\n\n switch (subscribe.type) {\n case \"book_update\":\n return idsKey(subscribe.orderbook_ids) === idsKey((unsubscribe as { orderbook_ids: OrderBookId[] }).orderbook_ids);\n case \"trades\":\n return idsKey(subscribe.orderbook_ids) === idsKey((unsubscribe as { orderbook_ids: OrderBookId[] }).orderbook_ids);\n case \"ticker\":\n return idsKey(subscribe.orderbook_ids) === idsKey((unsubscribe as { orderbook_ids: OrderBookId[] }).orderbook_ids);\n case \"user\":\n return subscribe.wallet_address === (unsubscribe as { wallet_address: PubkeyStr }).wallet_address;\n case \"price_history\":\n return (\n subscribe.orderbook_id === (unsubscribe as { orderbook_id: OrderBookId }).orderbook_id &&\n subscribe.resolution === (unsubscribe as { resolution: Resolution }).resolution\n );\n case \"market\":\n return subscribe.market_pubkey === (unsubscribe as { market_pubkey: PubkeyStr }).market_pubkey;\n case \"deposit_price\":\n return (\n subscribe.deposit_asset === (unsubscribe as { deposit_asset: string }).deposit_asset &&\n subscribe.resolution === (unsubscribe as { resolution: Resolution }).resolution\n );\n case \"deposit_asset_price\":\n return subscribe.deposit_asset === (unsubscribe as { deposit_asset: string }).deposit_asset;\n }\n}\n\nfunction idsKey(ids: readonly string[]): string {\n return [...ids].sort().join(\",\");\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightconexyz/lightcone-sdk",
3
- "version": "0.5.2",
3
+ "version": "0.6.1",
4
4
  "description": "TypeScript SDK for Lightcone",
5
5
  "author": "Lightcone",
6
6
  "license": "MIT",