@polyester/sdk 0.36.0-devnet-20261118141710 → 0.36.0-devnet-20261119010940

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 (239) hide show
  1. package/CHANGELOG.md +32 -2
  2. package/dist/client.d.ts +2 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +2 -0
  5. package/dist/client.js.map +1 -1
  6. package/dist/gen/ai/v1/assistant_pb.d.ts +5 -6
  7. package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
  8. package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
  9. package/dist/gen/auth/v1/address_book_pb.d.ts +1 -1
  10. package/dist/gen/auth/v1/address_book_pb.js +1 -1
  11. package/dist/gen/auth/v1/address_book_pb.js.map +1 -1
  12. package/dist/gen/auth/v1/api_keys_pb.d.ts +70 -9
  13. package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
  14. package/dist/gen/auth/v1/api_keys_pb.js +16 -1
  15. package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
  16. package/dist/gen/auth/v1/auth_pb.d.ts +74 -5
  17. package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
  18. package/dist/gen/auth/v1/auth_pb.js +58 -6
  19. package/dist/gen/auth/v1/auth_pb.js.map +1 -1
  20. package/dist/gen/auth/v1/connected_apps_pb.d.ts +382 -0
  21. package/dist/gen/auth/v1/connected_apps_pb.d.ts.map +1 -0
  22. package/dist/gen/auth/v1/connected_apps_pb.js +107 -0
  23. package/dist/gen/auth/v1/connected_apps_pb.js.map +1 -0
  24. package/dist/gen/auth/v1/mfa_pb.d.ts +2 -140
  25. package/dist/gen/auth/v1/mfa_pb.d.ts.map +1 -1
  26. package/dist/gen/auth/v1/mfa_pb.js +8 -80
  27. package/dist/gen/auth/v1/mfa_pb.js.map +1 -1
  28. package/dist/gen/auth/v1/policies_pb.d.ts +164 -41
  29. package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
  30. package/dist/gen/auth/v1/policies_pb.js +36 -3
  31. package/dist/gen/auth/v1/policies_pb.js.map +1 -1
  32. package/dist/gen/auth/v1/social_verification_pb.d.ts +4 -4
  33. package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
  34. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +17 -10
  35. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
  36. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
  37. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +3 -1
  38. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
  39. package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
  40. package/dist/gen/fees/v1/fees_pb.d.ts +2 -1
  41. package/dist/gen/fees/v1/fees_pb.d.ts.map +1 -1
  42. package/dist/gen/fees/v1/fees_pb.js.map +1 -1
  43. package/dist/gen/index.d.ts +8 -5
  44. package/dist/gen/index.js +8 -5
  45. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +3 -2
  46. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
  47. package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
  48. package/dist/gen/marketdata/v1/heatmap_pb.d.ts +9 -58
  49. package/dist/gen/marketdata/v1/heatmap_pb.d.ts.map +1 -1
  50. package/dist/gen/marketdata/v1/heatmap_pb.js +8 -57
  51. package/dist/gen/marketdata/v1/heatmap_pb.js.map +1 -1
  52. package/dist/gen/notifications/v1/notifications_pb.d.ts +141 -4
  53. package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -1
  54. package/dist/gen/notifications/v1/notifications_pb.js +94 -16
  55. package/dist/gen/notifications/v1/notifications_pb.js.map +1 -1
  56. package/dist/gen/orderbook/v1/orderbook_pb.d.ts +14 -12
  57. package/dist/gen/orderbook/v1/orderbook_pb.d.ts.map +1 -1
  58. package/dist/gen/orderbook/v1/orderbook_pb.js +6 -1
  59. package/dist/gen/orderbook/v1/orderbook_pb.js.map +1 -1
  60. package/dist/gen/orders/v1/orders_pb.d.ts +66 -18
  61. package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
  62. package/dist/gen/orders/v1/orders_pb.js +1 -1
  63. package/dist/gen/orders/v1/orders_pb.js.map +1 -1
  64. package/dist/gen/orders/v1/orders_read_pb.d.ts +8 -0
  65. package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
  66. package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
  67. package/dist/gen/polyester/api/options_pb.d.ts +2 -1
  68. package/dist/gen/polyester/api/options_pb.d.ts.map +1 -1
  69. package/dist/gen/polyester/api/options_pb.js +2 -1
  70. package/dist/gen/polyester/api/options_pb.js.map +1 -1
  71. package/dist/gen/polyester/api/v1/request_error_pb.d.ts +66 -0
  72. package/dist/gen/polyester/api/v1/request_error_pb.d.ts.map +1 -0
  73. package/dist/gen/polyester/api/v1/request_error_pb.js +49 -0
  74. package/dist/gen/polyester/api/v1/request_error_pb.js.map +1 -0
  75. package/dist/gen/polyester/type/v1/depth_tier_pb.d.ts +98 -0
  76. package/dist/gen/polyester/type/v1/depth_tier_pb.d.ts.map +1 -0
  77. package/dist/gen/polyester/type/v1/depth_tier_pb.js +104 -0
  78. package/dist/gen/polyester/type/v1/depth_tier_pb.js.map +1 -0
  79. package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +42 -23
  80. package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts.map +1 -1
  81. package/dist/gen/ratelimit/v1/ratelimit_pb.js +14 -2
  82. package/dist/gen/ratelimit/v1/ratelimit_pb.js.map +1 -1
  83. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +126 -13
  84. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
  85. package/dist/gen/swap/quickswap/v1/quickswap_pb.js +100 -28
  86. package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
  87. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +5 -3
  88. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
  89. package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
  90. package/dist/gen/triggers/v1/triggers_pb.d.ts +25 -3
  91. package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
  92. package/dist/gen/triggers/v1/triggers_pb.js +18 -1
  93. package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
  94. package/dist/index.d.ts +5 -3
  95. package/dist/realtime/ready-gated-subscription.js +1 -1
  96. package/dist/realtime/snapshot-then-stream.js +2 -0
  97. package/dist/realtime/snapshot-then-stream.js.map +1 -1
  98. package/dist/services/account-activity/account-activity.schemas.d.ts +4 -4
  99. package/dist/services/address-book/address-book.js +1 -1
  100. package/dist/services/address-book/address-book.schemas.d.ts +2 -2
  101. package/dist/services/api-keys/api-keys.codecs.d.ts +6 -1
  102. package/dist/services/api-keys/api-keys.codecs.d.ts.map +1 -1
  103. package/dist/services/api-keys/api-keys.codecs.js +19 -7
  104. package/dist/services/api-keys/api-keys.codecs.js.map +1 -1
  105. package/dist/services/api-keys/api-keys.js +1 -1
  106. package/dist/services/api-keys/api-keys.schemas.d.ts +12 -4
  107. package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
  108. package/dist/services/api-keys/api-keys.schemas.js +15 -6
  109. package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
  110. package/dist/services/api-keys/api-keys.types.d.ts +2 -2
  111. package/dist/services/assistant/assistant-events.schemas.d.ts +30 -30
  112. package/dist/services/assistant/assistant.schemas.d.ts +2 -2
  113. package/dist/services/auth/auth.d.ts +4 -0
  114. package/dist/services/auth/auth.d.ts.map +1 -1
  115. package/dist/services/auth/auth.js +12 -2
  116. package/dist/services/auth/auth.js.map +1 -1
  117. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +3 -3
  118. package/dist/services/balances/balances.js +1 -1
  119. package/dist/services/candles/candles.schemas.d.ts +10 -10
  120. package/dist/services/changelog/changelog.schemas.d.ts +22 -22
  121. package/dist/services/checkpoints/checkpoints.schemas.d.ts +1 -1
  122. package/dist/services/connected-apps/connected-apps.d.ts +46 -0
  123. package/dist/services/connected-apps/connected-apps.d.ts.map +1 -0
  124. package/dist/services/connected-apps/connected-apps.js +69 -0
  125. package/dist/services/connected-apps/connected-apps.js.map +1 -0
  126. package/dist/services/connected-apps/connected-apps.schemas.d.ts +132 -0
  127. package/dist/services/connected-apps/connected-apps.schemas.d.ts.map +1 -0
  128. package/dist/services/connected-apps/connected-apps.schemas.js +68 -0
  129. package/dist/services/connected-apps/connected-apps.schemas.js.map +1 -0
  130. package/dist/services/connected-apps/connected-apps.types.d.ts +2 -0
  131. package/dist/services/connected-apps/service.d.ts +8 -0
  132. package/dist/services/connected-apps/service.d.ts.map +1 -0
  133. package/dist/services/connected-apps/service.js +9 -0
  134. package/dist/services/connected-apps/service.js.map +1 -0
  135. package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +2 -2
  136. package/dist/services/heatmap/heatmap.codecs.d.ts +1 -0
  137. package/dist/services/heatmap/heatmap.codecs.d.ts.map +1 -1
  138. package/dist/services/heatmap/heatmap.codecs.js +2 -27
  139. package/dist/services/heatmap/heatmap.codecs.js.map +1 -1
  140. package/dist/services/heatmap/heatmap.schemas.d.ts +9 -8
  141. package/dist/services/heatmap/heatmap.schemas.d.ts.map +1 -1
  142. package/dist/services/heatmap/heatmap.schemas.js +4 -3
  143. package/dist/services/heatmap/heatmap.schemas.js.map +1 -1
  144. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +6 -6
  145. package/dist/services/lifecycle/lifecycle.js +1 -1
  146. package/dist/services/lifecycle/lifecycle.js.map +1 -1
  147. package/dist/services/lifecycle/lifecycle.schemas.d.ts +91 -91
  148. package/dist/services/notifications/notifications.codecs.d.ts +6 -3
  149. package/dist/services/notifications/notifications.codecs.d.ts.map +1 -1
  150. package/dist/services/notifications/notifications.codecs.js +14 -3
  151. package/dist/services/notifications/notifications.codecs.js.map +1 -1
  152. package/dist/services/notifications/notifications.schemas.d.ts +97 -3
  153. package/dist/services/notifications/notifications.schemas.d.ts.map +1 -1
  154. package/dist/services/notifications/notifications.schemas.js +18 -1
  155. package/dist/services/notifications/notifications.schemas.js.map +1 -1
  156. package/dist/services/notifications/notifications.types.d.ts +2 -2
  157. package/dist/services/orderbook/orderbook.codecs.js +1 -1
  158. package/dist/services/orderbook/orderbook.codecs.js.map +1 -1
  159. package/dist/services/orderbook/orderbook.d.ts +2 -2
  160. package/dist/services/orderbook/orderbook.d.ts.map +1 -1
  161. package/dist/services/orderbook/orderbook.js +8 -10
  162. package/dist/services/orderbook/orderbook.js.map +1 -1
  163. package/dist/services/orderbook/orderbook.schemas.d.ts +3 -6
  164. package/dist/services/orderbook/orderbook.schemas.d.ts.map +1 -1
  165. package/dist/services/orderbook/orderbook.schemas.js +5 -5
  166. package/dist/services/orderbook/orderbook.schemas.js.map +1 -1
  167. package/dist/services/orders/order-errors.schemas.d.ts +9 -9
  168. package/dist/services/orders/orders-batch.schemas.d.ts +106 -102
  169. package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
  170. package/dist/services/orders/orders-batch.schemas.js +2 -0
  171. package/dist/services/orders/orders-batch.schemas.js.map +1 -1
  172. package/dist/services/orders/orders-input.schemas.d.ts +23 -15
  173. package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
  174. package/dist/services/orders/orders-input.schemas.js +7 -2
  175. package/dist/services/orders/orders-input.schemas.js.map +1 -1
  176. package/dist/services/orders/orders-output.schemas.d.ts +8 -8
  177. package/dist/services/orders/orders.d.ts.map +1 -1
  178. package/dist/services/orders/orders.js +47 -43
  179. package/dist/services/orders/orders.js.map +1 -1
  180. package/dist/services/policies/api-key-policies/api-key-policies.d.ts +4 -1
  181. package/dist/services/policies/api-key-policies/api-key-policies.d.ts.map +1 -1
  182. package/dist/services/policies/api-key-policies/api-key-policies.js +5 -2
  183. package/dist/services/policies/api-key-policies/api-key-policies.js.map +1 -1
  184. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +25 -15
  185. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts.map +1 -1
  186. package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +3 -0
  187. package/dist/services/policies/api-key-policies/api-key-policies.schemas.js.map +1 -1
  188. package/dist/services/policies/shared.codecs.js +25 -5
  189. package/dist/services/policies/shared.codecs.js.map +1 -1
  190. package/dist/services/policies/shared.d.ts +1 -1
  191. package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts +4 -1
  192. package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts.map +1 -1
  193. package/dist/services/policies/subaccount-policies/subaccount-policies.js +5 -2
  194. package/dist/services/policies/subaccount-policies/subaccount-policies.js.map +1 -1
  195. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +11 -3
  196. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts.map +1 -1
  197. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +4 -0
  198. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
  199. package/dist/services/rate-limits/rate-limits.codecs.d.ts +1 -1
  200. package/dist/services/rate-limits/rate-limits.codecs.js +2 -1
  201. package/dist/services/rate-limits/rate-limits.codecs.js.map +1 -1
  202. package/dist/services/rate-limits/rate-limits.schemas.d.ts +4 -4
  203. package/dist/services/statement-exports/statement-exports.schemas.d.ts +6 -6
  204. package/dist/services/subaccounts/subaccounts.js +2 -2
  205. package/dist/services/subaccounts/subaccounts.schemas.d.ts +20 -20
  206. package/dist/services/system/system.schemas.d.ts +13 -13
  207. package/dist/services/trades/trades.d.ts.map +1 -1
  208. package/dist/services/trades/trades.js +12 -4
  209. package/dist/services/trades/trades.js.map +1 -1
  210. package/dist/services/trades/trades.schemas.d.ts +1 -1
  211. package/dist/services/transfers/transfers.js +1 -1
  212. package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
  213. package/dist/services/triggers/triggers-output.schemas.d.ts +57 -57
  214. package/dist/services/triggers/triggers.codecs.d.ts.map +1 -1
  215. package/dist/services/triggers/triggers.codecs.js +2 -0
  216. package/dist/services/triggers/triggers.codecs.js.map +1 -1
  217. package/dist/services/triggers/triggers.d.ts.map +1 -1
  218. package/dist/services/triggers/triggers.js +14 -10
  219. package/dist/services/triggers/triggers.js.map +1 -1
  220. package/dist/shared/connect-error-mapping.d.ts.map +1 -1
  221. package/dist/shared/connect-error-mapping.js +5 -2
  222. package/dist/shared/connect-error-mapping.js.map +1 -1
  223. package/dist/shared/decimal-surface.d.ts +6 -0
  224. package/dist/shared/decimal-surface.d.ts.map +1 -1
  225. package/dist/shared/decimal-surface.js +65 -1
  226. package/dist/shared/decimal-surface.js.map +1 -1
  227. package/dist/shared/depth-tier.js +46 -0
  228. package/dist/shared/depth-tier.js.map +1 -0
  229. package/dist/shared/error-detail.d.ts +6 -0
  230. package/dist/shared/error-detail.d.ts.map +1 -1
  231. package/dist/shared/error-detail.js +2 -1
  232. package/dist/shared/error-detail.js.map +1 -1
  233. package/dist/shared/error-details/request.js +16 -0
  234. package/dist/shared/error-details/request.js.map +1 -0
  235. package/dist/shared/rate-limit.schemas.d.ts +1 -1
  236. package/dist/wired-services.d.ts.map +1 -1
  237. package/dist/wired-services.js +6 -4
  238. package/dist/wired-services.js.map +1 -1
  239. package/package.json +1 -1
@@ -218,7 +218,7 @@ declare const DustConversionSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
218
218
  quoteId: string;
219
219
  state: "unspecified" | "processing" | "completed" | "refused";
220
220
  /** Why a `refused` conversion was refused; null otherwise. */
221
- refusalCode: "UNSPECIFIED" | "UNAUTHENTICATED" | "RATE_LIMIT_EXCEEDED" | "CONFLICT" | "INVALID_REQUEST" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | "PERMISSION_DENIED" | "FAILED_PRECONDITION" | "SUBACCOUNT_NOT_FOUND" | "INSUFFICIENT_FUNDS" | "NOT_FOUND" | "INVALID_SUBACCOUNT_ID" | "SOURCE_ACCOUNT_INACTIVE" | "UNSUPPORTED_ASSET" | "INVALID_AMOUNT" | "INVALID_DESTINATION" | "DESTINATION_NOT_FOUND" | "DESTINATION_INACTIVE" | "SAME_SOURCE_DESTINATION" | "DESTINATION_NOT_WHITELISTED" | "SMART_ACCOUNT_UNAVAILABLE" | "STEP_UP_UNAVAILABLE" | "IDEMPOTENCY_CONFLICT" | "FUNDS_LOCK_CONFLICT" | "CAPITAL_VIEW_UNAVAILABLE" | "ACCOUNT_SHARD_UNAVAILABLE" | "POLICY_DENIED" | "DUST_QUOTE_EXPIRED" | "DUST_PRICE_MOVED" | "DUST_NOT_ELIGIBLE" | "DUST_WINDOW_ACTIVE" | "DUST_DAILY_LIMIT" | "DUST_BUSY" | "DUST_TARGET_UNAVAILABLE" | "DUST_BALANCE_CHANGED" | "DUST_CONVERSION_FAILED" | "BATCH_TOO_MANY_SOURCES" | null;
221
+ refusalCode: "UNSPECIFIED" | "UNAUTHENTICATED" | "RATE_LIMIT_EXCEEDED" | "CONFLICT" | "INVALID_REQUEST" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | "PERMISSION_DENIED" | "FAILED_PRECONDITION" | "SUBACCOUNT_NOT_FOUND" | "INSUFFICIENT_FUNDS" | "INVALID_SUBACCOUNT_ID" | "SOURCE_ACCOUNT_INACTIVE" | "UNSUPPORTED_ASSET" | "INVALID_AMOUNT" | "INVALID_DESTINATION" | "DESTINATION_NOT_FOUND" | "DESTINATION_INACTIVE" | "SAME_SOURCE_DESTINATION" | "DESTINATION_NOT_WHITELISTED" | "SMART_ACCOUNT_UNAVAILABLE" | "STEP_UP_UNAVAILABLE" | "IDEMPOTENCY_CONFLICT" | "FUNDS_LOCK_CONFLICT" | "CAPITAL_VIEW_UNAVAILABLE" | "ACCOUNT_SHARD_UNAVAILABLE" | "POLICY_DENIED" | "NOT_FOUND" | "DUST_QUOTE_EXPIRED" | "DUST_PRICE_MOVED" | "DUST_NOT_ELIGIBLE" | "DUST_WINDOW_ACTIVE" | "DUST_DAILY_LIMIT" | "DUST_BUSY" | "DUST_TARGET_UNAVAILABLE" | "DUST_BALANCE_CHANGED" | "DUST_CONVERSION_FAILED" | "BATCH_TOO_MANY_SOURCES" | null;
222
222
  targetAssetId: number;
223
223
  /** Whole quoted balances moved, in asset id order. */
224
224
  sources: {
@@ -534,7 +534,7 @@ declare const ListDustConversionsResultSchema: v.ObjectSchema<{
534
534
  quoteId: string;
535
535
  state: "unspecified" | "processing" | "completed" | "refused";
536
536
  /** Why a `refused` conversion was refused; null otherwise. */
537
- refusalCode: "UNSPECIFIED" | "UNAUTHENTICATED" | "RATE_LIMIT_EXCEEDED" | "CONFLICT" | "INVALID_REQUEST" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | "PERMISSION_DENIED" | "FAILED_PRECONDITION" | "SUBACCOUNT_NOT_FOUND" | "INSUFFICIENT_FUNDS" | "NOT_FOUND" | "INVALID_SUBACCOUNT_ID" | "SOURCE_ACCOUNT_INACTIVE" | "UNSUPPORTED_ASSET" | "INVALID_AMOUNT" | "INVALID_DESTINATION" | "DESTINATION_NOT_FOUND" | "DESTINATION_INACTIVE" | "SAME_SOURCE_DESTINATION" | "DESTINATION_NOT_WHITELISTED" | "SMART_ACCOUNT_UNAVAILABLE" | "STEP_UP_UNAVAILABLE" | "IDEMPOTENCY_CONFLICT" | "FUNDS_LOCK_CONFLICT" | "CAPITAL_VIEW_UNAVAILABLE" | "ACCOUNT_SHARD_UNAVAILABLE" | "POLICY_DENIED" | "DUST_QUOTE_EXPIRED" | "DUST_PRICE_MOVED" | "DUST_NOT_ELIGIBLE" | "DUST_WINDOW_ACTIVE" | "DUST_DAILY_LIMIT" | "DUST_BUSY" | "DUST_TARGET_UNAVAILABLE" | "DUST_BALANCE_CHANGED" | "DUST_CONVERSION_FAILED" | "BATCH_TOO_MANY_SOURCES" | null;
537
+ refusalCode: "UNSPECIFIED" | "UNAUTHENTICATED" | "RATE_LIMIT_EXCEEDED" | "CONFLICT" | "INVALID_REQUEST" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | "PERMISSION_DENIED" | "FAILED_PRECONDITION" | "SUBACCOUNT_NOT_FOUND" | "INSUFFICIENT_FUNDS" | "INVALID_SUBACCOUNT_ID" | "SOURCE_ACCOUNT_INACTIVE" | "UNSUPPORTED_ASSET" | "INVALID_AMOUNT" | "INVALID_DESTINATION" | "DESTINATION_NOT_FOUND" | "DESTINATION_INACTIVE" | "SAME_SOURCE_DESTINATION" | "DESTINATION_NOT_WHITELISTED" | "SMART_ACCOUNT_UNAVAILABLE" | "STEP_UP_UNAVAILABLE" | "IDEMPOTENCY_CONFLICT" | "FUNDS_LOCK_CONFLICT" | "CAPITAL_VIEW_UNAVAILABLE" | "ACCOUNT_SHARD_UNAVAILABLE" | "POLICY_DENIED" | "NOT_FOUND" | "DUST_QUOTE_EXPIRED" | "DUST_PRICE_MOVED" | "DUST_NOT_ELIGIBLE" | "DUST_WINDOW_ACTIVE" | "DUST_DAILY_LIMIT" | "DUST_BUSY" | "DUST_TARGET_UNAVAILABLE" | "DUST_BALANCE_CHANGED" | "DUST_CONVERSION_FAILED" | "BATCH_TOO_MANY_SOURCES" | null;
538
538
  targetAssetId: number;
539
539
  /** Whole quoted balances moved, in asset id order. */
540
540
  sources: {
@@ -2,6 +2,7 @@ import "../../gen/marketdata/v1/heatmap_pb.js";
2
2
  //#region src/services/heatmap/heatmap.codecs.d.ts
3
3
  declare const HEATMAP_INTERVAL_VALUES: readonly ["1s", "1m", "5m", "1h"];
4
4
  type HeatmapIntervalValue = (typeof HEATMAP_INTERVAL_VALUES)[number];
5
+ /** Every `DepthTier` except 5000, which the heatmap refuses. */
5
6
  declare const HEATMAP_DEPTH_VALUES: readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000];
6
7
  type HeatmapDepthValue = (typeof HEATMAP_DEPTH_VALUES)[number];
7
8
  declare const HEATMAP_QUANTITY_MODE_VALUES: readonly ["close", "peak"];
@@ -1 +1 @@
1
- {"version":3,"file":"heatmap.codecs.d.ts","names":[],"sources":["../../../src/services/heatmap/heatmap.codecs.ts"],"mappings":";;cAOa;KACD,+BAA+B;cAE9B;KACD,4BAA4B;cAE3B;KACD,mCAAmC"}
1
+ {"version":3,"file":"heatmap.codecs.d.ts","names":[],"sources":["../../../src/services/heatmap/heatmap.codecs.ts"],"mappings":";;cAGa;KACD,+BAA+B;;cAG9B;KACD,4BAA4B;cAE3B;KACD,mCAAmC"}
@@ -6,6 +6,7 @@ const HEATMAP_INTERVAL_VALUES = [
6
6
  "5m",
7
7
  "1h"
8
8
  ];
9
+ /** Every `DepthTier` except 5000, which the heatmap refuses. */
9
10
  const HEATMAP_DEPTH_VALUES = [
10
11
  1,
11
12
  5,
@@ -33,32 +34,6 @@ const HeatmapIntervalCodec = {
33
34
  [4]: "1h"
34
35
  }
35
36
  };
36
- const HeatmapDepthCodec = {
37
- inputToProto: {
38
- 1: 1,
39
- 5: 2,
40
- 10: 3,
41
- 20: 4,
42
- 50: 5,
43
- 100: 6,
44
- 200: 7,
45
- 500: 8,
46
- 1e3: 9
47
- },
48
- protoToOutput: {
49
- [0]: "unspecified",
50
- [1]: 1,
51
- [2]: 5,
52
- [3]: 10,
53
- [4]: 20,
54
- [5]: 50,
55
- [6]: 100,
56
- [7]: 200,
57
- [8]: 500,
58
- [9]: 1e3
59
- },
60
- supportedDepths: HEATMAP_DEPTH_VALUES
61
- };
62
37
  const HeatmapQuantityModeCodec = {
63
38
  inputToProto: {
64
39
  close: 1,
@@ -71,6 +46,6 @@ const HeatmapQuantityModeCodec = {
71
46
  }
72
47
  };
73
48
  //#endregion
74
- export { HEATMAP_DEPTH_VALUES, HEATMAP_INTERVAL_VALUES, HEATMAP_QUANTITY_MODE_VALUES, HeatmapDepthCodec, HeatmapIntervalCodec, HeatmapQuantityModeCodec };
49
+ export { HEATMAP_DEPTH_VALUES, HEATMAP_INTERVAL_VALUES, HEATMAP_QUANTITY_MODE_VALUES, HeatmapIntervalCodec, HeatmapQuantityModeCodec };
75
50
 
76
51
  //# sourceMappingURL=heatmap.codecs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"heatmap.codecs.js","names":[],"sources":["../../../src/services/heatmap/heatmap.codecs.ts"],"sourcesContent":["import {\n HeatmapDepth,\n HeatmapInterval,\n HeatmapQuantityMode,\n} from \"../../gen/marketdata/v1/heatmap_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const HEATMAP_INTERVAL_VALUES = [\"1s\", \"1m\", \"5m\", \"1h\"] as const;\nexport type HeatmapIntervalValue = (typeof HEATMAP_INTERVAL_VALUES)[number];\n\nexport const HEATMAP_DEPTH_VALUES = [1, 5, 10, 20, 50, 100, 200, 500, 1000] as const;\nexport type HeatmapDepthValue = (typeof HEATMAP_DEPTH_VALUES)[number];\n\nexport const HEATMAP_QUANTITY_MODE_VALUES = [\"close\", \"peak\"] as const;\nexport type HeatmapQuantityModeValue = (typeof HEATMAP_QUANTITY_MODE_VALUES)[number];\n\nexport const HeatmapIntervalCodec = {\n inputToProto: {\n \"1s\": HeatmapInterval.INTERVAL_1S,\n \"1m\": HeatmapInterval.INTERVAL_1M,\n \"5m\": HeatmapInterval.INTERVAL_5M,\n \"1h\": HeatmapInterval.INTERVAL_1H,\n } satisfies InputToProto<HeatmapIntervalValue, HeatmapInterval>,\n protoToOutput: {\n [HeatmapInterval.INTERVAL_UNSPECIFIED]: \"unspecified\",\n [HeatmapInterval.INTERVAL_1S]: \"1s\",\n [HeatmapInterval.INTERVAL_1M]: \"1m\",\n [HeatmapInterval.INTERVAL_5M]: \"5m\",\n [HeatmapInterval.INTERVAL_1H]: \"1h\",\n } satisfies ProtoToOutput<HeatmapInterval, HeatmapIntervalValue>,\n} as const;\n\nexport const HeatmapDepthCodec = {\n inputToProto: {\n 1: HeatmapDepth.DEPTH_1,\n 5: HeatmapDepth.DEPTH_5,\n 10: HeatmapDepth.DEPTH_10,\n 20: HeatmapDepth.DEPTH_20,\n 50: HeatmapDepth.DEPTH_50,\n 100: HeatmapDepth.DEPTH_100,\n 200: HeatmapDepth.DEPTH_200,\n 500: HeatmapDepth.DEPTH_500,\n 1000: HeatmapDepth.DEPTH_1000,\n } satisfies InputToProto<HeatmapDepthValue, HeatmapDepth>,\n protoToOutput: {\n [HeatmapDepth.DEPTH_UNSPECIFIED]: \"unspecified\",\n [HeatmapDepth.DEPTH_1]: 1,\n [HeatmapDepth.DEPTH_5]: 5,\n [HeatmapDepth.DEPTH_10]: 10,\n [HeatmapDepth.DEPTH_20]: 20,\n [HeatmapDepth.DEPTH_50]: 50,\n [HeatmapDepth.DEPTH_100]: 100,\n [HeatmapDepth.DEPTH_200]: 200,\n [HeatmapDepth.DEPTH_500]: 500,\n [HeatmapDepth.DEPTH_1000]: 1000,\n } satisfies ProtoToOutput<HeatmapDepth, HeatmapDepthValue>,\n supportedDepths: HEATMAP_DEPTH_VALUES,\n} as const;\n\nexport const HeatmapQuantityModeCodec = {\n inputToProto: {\n close: HeatmapQuantityMode.CLOSE,\n peak: HeatmapQuantityMode.PEAK,\n } satisfies InputToProto<HeatmapQuantityModeValue, HeatmapQuantityMode>,\n protoToOutput: {\n [HeatmapQuantityMode.QTY_MODE_UNSPECIFIED]: \"unspecified\",\n [HeatmapQuantityMode.CLOSE]: \"close\",\n [HeatmapQuantityMode.PEAK]: \"peak\",\n } satisfies ProtoToOutput<HeatmapQuantityMode, HeatmapQuantityModeValue>,\n} as const;\n"],"mappings":";;AAOA,MAAa,0BAA0B;CAAC;CAAM;CAAM;CAAM;AAAI;AAG9D,MAAa,uBAAuB;CAAC;CAAG;CAAG;CAAI;CAAI;CAAI;CAAK;CAAK;CAAK;AAAI;AAG1E,MAAa,+BAA+B,CAAC,SAAS,MAAM;AAG5D,MAAa,uBAAuB;CAChC,cAAc;EACV,MAAA;EACA,MAAA;EACA,MAAA;EACA,MAAA;CACJ;CACA,eAAe;GAC6B,IAAA;GACT,IAAA;GACA,IAAA;GACA,IAAA;GACA,IAAA;CACnC;AACJ;AAEA,MAAa,oBAAoB;CAC7B,cAAc;EACV,GAAA;EACA,GAAA;EACA,IAAA;EACA,IAAA;EACA,IAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA;CACJ;CACA,eAAe;GACuB,IAAA;GACV,IAAA;GACA,IAAA;GACC,IAAA;GACA,IAAA;GACA,IAAA;GACC,IAAA;GACA,IAAA;GACA,IAAA;GACC,IAAA;CAC/B;CACA,iBAAiB;AACrB;AAEA,MAAa,2BAA2B;CACpC,cAAc;EACV,OAAA;EACA,MAAA;CACJ;CACA,eAAe;GACiC,IAAA;GACf,IAAA;GACD,IAAA;CAChC;AACJ"}
1
+ {"version":3,"file":"heatmap.codecs.js","names":[],"sources":["../../../src/services/heatmap/heatmap.codecs.ts"],"sourcesContent":["import { HeatmapInterval, HeatmapQuantityMode } from \"../../gen/marketdata/v1/heatmap_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const HEATMAP_INTERVAL_VALUES = [\"1s\", \"1m\", \"5m\", \"1h\"] as const;\nexport type HeatmapIntervalValue = (typeof HEATMAP_INTERVAL_VALUES)[number];\n\n/** Every `DepthTier` except 5000, which the heatmap refuses. */\nexport const HEATMAP_DEPTH_VALUES = [1, 5, 10, 20, 50, 100, 200, 500, 1000] as const;\nexport type HeatmapDepthValue = (typeof HEATMAP_DEPTH_VALUES)[number];\n\nexport const HEATMAP_QUANTITY_MODE_VALUES = [\"close\", \"peak\"] as const;\nexport type HeatmapQuantityModeValue = (typeof HEATMAP_QUANTITY_MODE_VALUES)[number];\n\nexport const HeatmapIntervalCodec = {\n inputToProto: {\n \"1s\": HeatmapInterval.INTERVAL_1S,\n \"1m\": HeatmapInterval.INTERVAL_1M,\n \"5m\": HeatmapInterval.INTERVAL_5M,\n \"1h\": HeatmapInterval.INTERVAL_1H,\n } satisfies InputToProto<HeatmapIntervalValue, HeatmapInterval>,\n protoToOutput: {\n [HeatmapInterval.INTERVAL_UNSPECIFIED]: \"unspecified\",\n [HeatmapInterval.INTERVAL_1S]: \"1s\",\n [HeatmapInterval.INTERVAL_1M]: \"1m\",\n [HeatmapInterval.INTERVAL_5M]: \"5m\",\n [HeatmapInterval.INTERVAL_1H]: \"1h\",\n } satisfies ProtoToOutput<HeatmapInterval, HeatmapIntervalValue>,\n} as const;\n\nexport const HeatmapQuantityModeCodec = {\n inputToProto: {\n close: HeatmapQuantityMode.CLOSE,\n peak: HeatmapQuantityMode.PEAK,\n } satisfies InputToProto<HeatmapQuantityModeValue, HeatmapQuantityMode>,\n protoToOutput: {\n [HeatmapQuantityMode.QTY_MODE_UNSPECIFIED]: \"unspecified\",\n [HeatmapQuantityMode.CLOSE]: \"close\",\n [HeatmapQuantityMode.PEAK]: \"peak\",\n } satisfies ProtoToOutput<HeatmapQuantityMode, HeatmapQuantityModeValue>,\n} as const;\n"],"mappings":";;AAGA,MAAa,0BAA0B;CAAC;CAAM;CAAM;CAAM;AAAI;;AAI9D,MAAa,uBAAuB;CAAC;CAAG;CAAG;CAAI;CAAI;CAAI;CAAK;CAAK;CAAK;AAAI;AAG1E,MAAa,+BAA+B,CAAC,SAAS,MAAM;AAG5D,MAAa,uBAAuB;CAChC,cAAc;EACV,MAAA;EACA,MAAA;EACA,MAAA;EACA,MAAA;CACJ;CACA,eAAe;GAC6B,IAAA;GACT,IAAA;GACA,IAAA;GACA,IAAA;GACA,IAAA;CACnC;AACJ;AAEA,MAAa,2BAA2B;CACpC,cAAc;EACV,OAAA;EACA,MAAA;CACJ;CACA,eAAe;GACiC,IAAA;GACf,IAAA;GACD,IAAA;CAChC;AACJ"}
@@ -1,4 +1,5 @@
1
- import { HeatmapDepth, HeatmapInterval, HeatmapQuantityMode } from "../../gen/marketdata/v1/heatmap_pb.js";
1
+ import { DepthTier } from "../../gen/polyester/type/v1/depth_tier_pb.js";
2
+ import { HeatmapInterval, HeatmapQuantityMode } from "../../gen/marketdata/v1/heatmap_pb.js";
2
3
  import { DecodedEnum } from "../../utils/types.js";
3
4
  import { SdkScales } from "../../shared/decimal-surface.js";
4
5
  import * as v from "valibot";
@@ -14,7 +15,7 @@ type TimestampInit = {
14
15
  declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
15
16
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
16
17
  readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"1s" | "1m" | "5m" | "1h", HeatmapInterval>]>;
17
- readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<1 | 10 | 5 | 20 | 100 | 200 | 500 | 1000 | 50, HeatmapDepth>]>;
18
+ readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<1 | 5 | 10 | 20 | 200 | 100 | 1000 | 500 | 50, DepthTier>]>;
18
19
  readonly quantityMode: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["close", "peak"], undefined>, "close">, v.TransformAction<"close" | "peak", HeatmapQuantityMode>]>;
19
20
  readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 20000, undefined>]>;
20
21
  readonly startTsSec: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>, v.TransformAction<number, bigint>]>, undefined>;
@@ -23,7 +24,7 @@ declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.Objec
23
24
  }, undefined>, v.CheckAction<{
24
25
  symbolId: number;
25
26
  interval: HeatmapInterval;
26
- depth: HeatmapDepth;
27
+ depth: DepthTier;
27
28
  quantityMode: HeatmapQuantityMode;
28
29
  limit: number;
29
30
  startTsSec?: bigint | undefined;
@@ -32,7 +33,7 @@ declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.Objec
32
33
  }, "pageToken, startTsSec, or endTsSec is required">, v.TransformAction<{
33
34
  symbolId: number;
34
35
  interval: HeatmapInterval;
35
- depth: HeatmapDepth;
36
+ depth: DepthTier;
36
37
  quantityMode: HeatmapQuantityMode;
37
38
  limit: number;
38
39
  startTsSec?: bigint | undefined;
@@ -41,7 +42,7 @@ declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.Objec
41
42
  }, {
42
43
  symbolId: number;
43
44
  interval: HeatmapInterval;
44
- depth: HeatmapDepth;
45
+ depth: DepthTier;
45
46
  quantityMode: HeatmapQuantityMode;
46
47
  limit: number;
47
48
  pageToken: string;
@@ -227,7 +228,7 @@ type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;
227
228
  declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
228
229
  readonly symbolId: v.NumberSchema<undefined>;
229
230
  readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "5m" | "1h">>]>;
230
- readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 1 | "unspecified" | 10 | 5 | 20 | 100 | 200 | 500 | 1000 | 50>]>;
231
+ readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 1 | "unspecified" | 5 | 10 | 20 | 200 | 100 | 1000 | 500 | 50 | 5000>]>;
231
232
  readonly chain: v.OptionalSchema<v.ObjectSchema<{
232
233
  readonly baseKeyframe: v.OptionalSchema<v.ObjectSchema<{
233
234
  readonly tsSec: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
@@ -287,7 +288,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
287
288
  }, undefined>, v.TransformAction<{
288
289
  symbolId: number;
289
290
  interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
290
- depth: 1 | "unspecified" | 10 | 5 | 20 | 100 | 200 | 500 | 1000 | 50;
291
+ depth: 1 | "unspecified" | 5 | 10 | 20 | 200 | 100 | 1000 | 500 | 50 | 5000;
291
292
  chain?: {
292
293
  baseKeyframe?: {
293
294
  tsSec: number;
@@ -347,7 +348,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
347
348
  }, {
348
349
  symbolId: number;
349
350
  interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
350
- depth: 1 | "unspecified" | 10 | 5 | 20 | 100 | 200 | 500 | 1000 | 50;
351
+ depth: 1 | "unspecified" | 5 | 10 | 20 | 200 | 100 | 1000 | 500 | 50 | 5000;
351
352
  chain: {
352
353
  baseKeyframe: {
353
354
  tsSec: number;
@@ -1 +1 @@
1
- {"version":3,"file":"heatmap.schemas.d.ts","names":[],"sources":["../../../src/services/heatmap/heatmap.schemas.ts"],"mappings":";;;;;KAsBK;EACD,YAAY;EACZ,UAAU;;KAGT;EAAkB;EAAiB;;cAqB3B,gCAA8B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0DrC,iCAA+B,EAAA;;;;KAKhC,4BAA4B,EAAE,mBAAmB;iBAE7C,qBACL,QAAQ,2BACR,oBACA;;;;KAQQ,yBAAyB,kBAAkB;KAE3C,8BAA8B;cAEpC,mCAAiC,EAAA;;;;;;;;;;;;;;;KAUlC,8BAA8B,EAAE,mBAAmB;iBAE/C,uBACL,U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mCAAiC,EAAA;;;;;;;;;;;;;;;KAUlC,8BAA8B,EAAE,mBAAmB;iBAE/C,uBACL,UAAU,6BACV,oBACA;;;;;;;;;;;;;;;KAaQ,2BAA2B,kBAAkB;cAEnD,sCAAoC,EAAA;;;;;;;;;;;;;;KASrC,iCAAiC,EAAE,mBAAmB;iBAElD,0BACL,QAAQ,gCACR,oBACA;;;;;;;;;;;;;;KAYQ,8BAA8B,kBAAkB;cAEtD,qCAAmC,EAAA;;;;;;;;;;;;;;;;;;;KAcpC,gCAAgC,EAAE,mBAAmB;iBAEjD,yBAAyB,QAAQ,+BAA+B,QAAQ;;;;;;;;;;;;;;;;;;;KAkBrE,6BAA6B,kBAAkB;cASrD,qCAAmC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAKpC,gCAAgC,EAAE,mBAAmB;iBAEjD,yBACL,OAAO,+BACP,oBACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAYQ,6BAA6B,kBAAkB;iBAmB3C,qCAAqC,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2B1D,2BAA2B,EAAE,kBAAkB;KAE/C,2BAA2B,EAAE,YACrC,kBAAkB"}
@@ -2,11 +2,12 @@ import { OptionalTimestampSecondsInputSchema } from "../../shared/schemas.js";
2
2
  import { enumLabel } from "../../shared/proto-enum-codec.js";
3
3
  import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
4
4
  import { SymbolIdInputSchema } from "../shared.js";
5
- import { HEATMAP_DEPTH_VALUES, HEATMAP_INTERVAL_VALUES, HEATMAP_QUANTITY_MODE_VALUES, HeatmapDepthCodec, HeatmapIntervalCodec, HeatmapQuantityModeCodec } from "./heatmap.codecs.js";
5
+ import { HEATMAP_DEPTH_VALUES, HEATMAP_INTERVAL_VALUES, HEATMAP_QUANTITY_MODE_VALUES, HeatmapIntervalCodec, HeatmapQuantityModeCodec } from "./heatmap.codecs.js";
6
+ import { DepthTierCodec } from "../../shared/depth-tier.js";
6
7
  import * as v from "valibot";
7
8
  //#region src/services/heatmap/heatmap.schemas.ts
8
9
  const IntervalInputSchema = v.pipe(v.optional(v.picklist(HEATMAP_INTERVAL_VALUES), "1s"), v.transform((value) => HeatmapIntervalCodec.inputToProto[value]));
9
- const DepthInputSchema = v.pipe(v.optional(v.picklist(HEATMAP_DEPTH_VALUES), 50), v.transform((value) => HeatmapDepthCodec.inputToProto[value]));
10
+ const DepthInputSchema = v.pipe(v.optional(v.picklist(HEATMAP_DEPTH_VALUES), 50), v.transform((value) => DepthTierCodec.inputToProto[value]));
10
11
  const QuantityModeInputSchema = v.pipe(v.optional(v.picklist(HEATMAP_QUANTITY_MODE_VALUES), "close"), v.transform((value) => HeatmapQuantityModeCodec.inputToProto[value]));
11
12
  function timestampFromTsSec(tsSec) {
12
13
  return {
@@ -140,7 +141,7 @@ function convertHeatmapDeltaChain(chain, priceScale, qtyScale) {
140
141
  const OrderbookHeatmapResponseRawSchema = v.object({
141
142
  symbolId: v.number(),
142
143
  interval: v.pipe(v.number(), v.transform(intervalLabelFor)),
143
- depth: v.pipe(v.number(), v.transform((value) => enumLabel(HeatmapDepthCodec.protoToOutput, value))),
144
+ depth: v.pipe(v.number(), v.transform((value) => enumLabel(DepthTierCodec.protoToOutput, value))),
144
145
  chain: v.optional(OrderbookHeatmapDeltaChainRawSchema),
145
146
  lastPersistedTsSec: TimestampSecondsSchema,
146
147
  liveFromBookSeqEnd: Uint64StringSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"heatmap.schemas.js","names":[],"sources":["../../../src/services/heatmap/heatmap.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\nimport type {\n HeatmapDepth,\n HeatmapInterval,\n HeatmapQuantityMode,\n} from \"../../gen/marketdata/v1/heatmap_pb.js\";\nimport { OptionalTimestampSecondsInputSchema } from \"../../shared/schemas.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport { scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport {\n HEATMAP_DEPTH_VALUES,\n HEATMAP_INTERVAL_VALUES,\n HEATMAP_QUANTITY_MODE_VALUES,\n HeatmapDepthCodec,\n HeatmapIntervalCodec,\n HeatmapQuantityModeCodec,\n type HeatmapIntervalValue,\n type HeatmapQuantityModeValue,\n} from \"./heatmap.codecs.js\";\n\ntype HeatmapTimeRangeInit = {\n startTime?: TimestampInit;\n endTime?: TimestampInit;\n};\n\ntype TimestampInit = { seconds: bigint; nanos: number };\n\nconst IntervalInputSchema = v.pipe(\n v.optional(v.picklist(HEATMAP_INTERVAL_VALUES), \"1s\"),\n v.transform((value): HeatmapInterval => HeatmapIntervalCodec.inputToProto[value]),\n);\n\nconst DepthInputSchema = v.pipe(\n v.optional(v.picklist(HEATMAP_DEPTH_VALUES), 50),\n v.transform((value): HeatmapDepth => HeatmapDepthCodec.inputToProto[value]),\n);\n\nconst QuantityModeInputSchema = v.pipe(\n v.optional(v.picklist(HEATMAP_QUANTITY_MODE_VALUES), \"close\"),\n v.transform((value): HeatmapQuantityMode => HeatmapQuantityModeCodec.inputToProto[value]),\n);\n\nfunction timestampFromTsSec(tsSec: bigint): TimestampInit {\n return { seconds: tsSec, nanos: 0 };\n}\n\nexport const GetOrderbookHeatmapInputSchema = v.pipe(\n v.object({\n symbolId: SymbolIdInputSchema,\n interval: IntervalInputSchema,\n depth: DepthInputSchema,\n quantityMode: QuantityModeInputSchema,\n limit: v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(20_000)),\n startTsSec: OptionalTimestampSecondsInputSchema,\n endTsSec: OptionalTimestampSecondsInputSchema,\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.check(\n (value) => value.pageToken !== \"\" || value.startTsSec != null || value.endTsSec != null,\n \"pageToken, startTsSec, or endTsSec is required\",\n ),\n v.transform((value) => {\n const timeRange: HeatmapTimeRangeInit | undefined =\n value.pageToken !== \"\"\n ? undefined\n : {\n startTime:\n value.startTsSec != null\n ? timestampFromTsSec(value.startTsSec)\n : undefined,\n endTime:\n value.endTsSec != null ? timestampFromTsSec(value.endTsSec) : undefined,\n };\n\n return {\n symbolId: value.symbolId,\n interval: value.interval,\n depth: value.depth,\n quantityMode: value.quantityMode,\n limit: value.limit,\n pageToken: value.pageToken,\n timeRange,\n };\n }),\n);\n\nfunction intervalLabelFor(value: number): DecodedEnum<HeatmapIntervalValue> {\n return enumLabel(HeatmapIntervalCodec.protoToOutput, value);\n}\n\nfunction quantityModeLabelFor(value: number): DecodedEnum<HeatmapQuantityModeValue> {\n return enumLabel(HeatmapQuantityModeCodec.protoToOutput, value);\n}\n\nconst TimestampSecondsSchema = v.pipe(\n v.bigint(),\n v.transform((value) => Number(value)),\n);\n\nconst Uint64StringSchema = v.pipe(\n v.bigint(),\n v.transform((value) => value.toString()),\n);\n\nconst OrderbookHeatmapLevelsRawSchema = v.object({\n priceTicks: v.array(v.bigint()),\n qtyScaled: v.array(v.bigint()),\n});\n\ntype OrderbookHeatmapLevelsRaw = v.InferOutput<typeof OrderbookHeatmapLevelsRawSchema>;\n\nfunction convertHeatmapLevels(\n levels: OrderbookHeatmapLevelsRaw,\n priceScale: number,\n qtyScale: number,\n) {\n return {\n price: levels.priceTicks.map((tick) => scaledToDecimalOutput(tick, priceScale)),\n qty: levels.qtyScaled.map((qty) => scaledToDecimalOutput(qty, qtyScale)),\n };\n}\n\nexport type OrderbookHeatmapLevels = ReturnType<typeof convertHeatmapLevels>;\n\nexport type OrderbookHeatmapDeltaLevels = OrderbookHeatmapLevels;\n\nconst OrderbookHeatmapKeyframeRawSchema = v.object({\n tsSec: TimestampSecondsSchema,\n bestBidTicks: v.bigint(),\n bestAskTicks: v.bigint(),\n midTicks: v.bigint(),\n bids: v.optional(OrderbookHeatmapLevelsRawSchema),\n asks: v.optional(OrderbookHeatmapLevelsRawSchema),\n bookSeq: Uint64StringSchema,\n});\n\ntype OrderbookHeatmapKeyframeRaw = v.InferOutput<typeof OrderbookHeatmapKeyframeRawSchema>;\n\nfunction convertHeatmapKeyframe(\n keyframe: OrderbookHeatmapKeyframeRaw,\n priceScale: number,\n qtyScale: number,\n) {\n return {\n tsSec: keyframe.tsSec,\n bestBid: scaledToDecimalOutput(keyframe.bestBidTicks, priceScale),\n bestAsk: scaledToDecimalOutput(keyframe.bestAskTicks, priceScale),\n mid: scaledToDecimalOutput(keyframe.midTicks, priceScale),\n bids: keyframe.bids ? convertHeatmapLevels(keyframe.bids, priceScale, qtyScale) : undefined,\n asks: keyframe.asks ? convertHeatmapLevels(keyframe.asks, priceScale, qtyScale) : undefined,\n bookSeq: keyframe.bookSeq,\n };\n}\n\nexport type OrderbookHeatmapKeyframe = ReturnType<typeof convertHeatmapKeyframe>;\n\nconst OrderbookHeatmapDeltaBucketRawSchema = v.object({\n tsSec: TimestampSecondsSchema,\n bids: v.optional(OrderbookHeatmapLevelsRawSchema),\n asks: v.optional(OrderbookHeatmapLevelsRawSchema),\n updatesInBucket: v.number(),\n bookSeqStart: Uint64StringSchema,\n bookSeqEnd: Uint64StringSchema,\n});\n\ntype OrderbookHeatmapDeltaBucketRaw = v.InferOutput<typeof OrderbookHeatmapDeltaBucketRawSchema>;\n\nfunction convertHeatmapDeltaBucket(\n bucket: OrderbookHeatmapDeltaBucketRaw,\n priceScale: number,\n qtyScale: number,\n) {\n return {\n tsSec: bucket.tsSec,\n bids: bucket.bids ? convertHeatmapLevels(bucket.bids, priceScale, qtyScale) : undefined,\n asks: bucket.asks ? convertHeatmapLevels(bucket.asks, priceScale, qtyScale) : undefined,\n updatesInBucket: bucket.updatesInBucket,\n bookSeqStart: bucket.bookSeqStart,\n bookSeqEnd: bucket.bookSeqEnd,\n };\n}\n\nexport type OrderbookHeatmapDeltaBucket = ReturnType<typeof convertHeatmapDeltaBucket>;\n\nconst OrderbookHeatmapLiveBucketRawSchema = v.object({\n symbolId: v.number(),\n interval: v.pipe(v.number(), v.transform(intervalLabelFor)),\n tsSec: TimestampSecondsSchema,\n isFinal: v.boolean(),\n bids: v.optional(OrderbookHeatmapLevelsRawSchema),\n asks: v.optional(OrderbookHeatmapLevelsRawSchema),\n updatesInBucket: v.number(),\n bookSeqStart: Uint64StringSchema,\n bookSeqEnd: Uint64StringSchema,\n quantityMode: v.pipe(v.number(), v.transform(quantityModeLabelFor)),\n effectiveBinTicks: v.bigint(),\n});\n\ntype OrderbookHeatmapLiveBucketRaw = v.InferOutput<typeof OrderbookHeatmapLiveBucketRawSchema>;\n\nfunction convertHeatmapLiveBucket(bucket: OrderbookHeatmapLiveBucketRaw, scales: SdkScales) {\n const priceScale = scales.price();\n const qtyScale = scales.baseQty(bucket.symbolId);\n return {\n symbolId: bucket.symbolId,\n interval: bucket.interval,\n tsSec: bucket.tsSec,\n isFinal: bucket.isFinal,\n bids: bucket.bids ? convertHeatmapLevels(bucket.bids, priceScale, qtyScale) : undefined,\n asks: bucket.asks ? convertHeatmapLevels(bucket.asks, priceScale, qtyScale) : undefined,\n updatesInBucket: bucket.updatesInBucket,\n bookSeqStart: bucket.bookSeqStart,\n bookSeqEnd: bucket.bookSeqEnd,\n quantityMode: bucket.quantityMode,\n effectiveBinSize: scaledToDecimalOutput(bucket.effectiveBinTicks, priceScale),\n };\n}\n\nexport type OrderbookHeatmapLiveBucket = ReturnType<typeof convertHeatmapLiveBucket>;\n\nexport function createOrderbookHeatmapLiveBucketSchema(scales: SdkScales) {\n return v.pipe(\n OrderbookHeatmapLiveBucketRawSchema,\n v.transform((bucket) => convertHeatmapLiveBucket(bucket, scales)),\n );\n}\n\nconst OrderbookHeatmapDeltaChainRawSchema = v.object({\n baseKeyframe: v.optional(OrderbookHeatmapKeyframeRawSchema),\n deltas: v.optional(v.array(OrderbookHeatmapDeltaBucketRawSchema), []),\n});\n\ntype OrderbookHeatmapDeltaChainRaw = v.InferOutput<typeof OrderbookHeatmapDeltaChainRawSchema>;\n\nfunction convertHeatmapDeltaChain(\n chain: OrderbookHeatmapDeltaChainRaw,\n priceScale: number,\n qtyScale: number,\n) {\n return {\n baseKeyframe: chain.baseKeyframe\n ? convertHeatmapKeyframe(chain.baseKeyframe, priceScale, qtyScale)\n : undefined,\n deltas: chain.deltas.map((bucket) =>\n convertHeatmapDeltaBucket(bucket, priceScale, qtyScale),\n ),\n };\n}\n\nexport type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;\n\nconst OrderbookHeatmapResponseRawSchema = v.object({\n symbolId: v.number(),\n interval: v.pipe(v.number(), v.transform(intervalLabelFor)),\n depth: v.pipe(\n v.number(),\n v.transform((value) => enumLabel(HeatmapDepthCodec.protoToOutput, value)),\n ),\n chain: v.optional(OrderbookHeatmapDeltaChainRawSchema),\n lastPersistedTsSec: TimestampSecondsSchema,\n liveFromBookSeqEnd: Uint64StringSchema,\n hasLiveAnchor: v.boolean(),\n nextPageToken: v.optional(v.string(), \"\"),\n serverTimeSec: TimestampSecondsSchema,\n quantityMode: v.pipe(v.number(), v.transform(quantityModeLabelFor)),\n liveBucket: v.optional(OrderbookHeatmapLiveBucketRawSchema),\n});\n\nexport function createOrderbookHeatmapResponseSchema(scales: SdkScales) {\n return v.pipe(\n OrderbookHeatmapResponseRawSchema,\n v.transform((res) => {\n const priceScale = scales.price();\n const qtyScale = scales.baseQty(res.symbolId);\n return {\n symbolId: res.symbolId,\n interval: res.interval,\n depth: res.depth,\n chain: res.chain\n ? convertHeatmapDeltaChain(res.chain, priceScale, qtyScale)\n : undefined,\n lastPersistedTsSec: res.lastPersistedTsSec,\n liveFromBookSeqEnd: res.liveFromBookSeqEnd,\n hasLiveAnchor: res.hasLiveAnchor,\n nextPageToken: res.nextPageToken,\n serverTimeSec: res.serverTimeSec,\n quantityMode: res.quantityMode,\n liveBucket: res.liveBucket\n ? convertHeatmapLiveBucket(res.liveBucket, scales)\n : undefined,\n };\n }),\n );\n}\n\nexport type GetOrderbookHeatmapInput = v.InferInput<typeof GetOrderbookHeatmapInputSchema>;\nexport type ParsedGetOrderbookHeatmapInput = v.InferOutput<typeof GetOrderbookHeatmapInputSchema>;\nexport type OrderbookHeatmapResponse = v.InferOutput<\n ReturnType<typeof createOrderbookHeatmapResponseSchema>\n>;\nexport type ParsedHeatmapTimeRange = HeatmapTimeRangeInit;\n"],"mappings":";;;;;;;AA6BA,MAAM,sBAAsB,EAAE,KAC1B,EAAE,SAAS,EAAE,SAAS,uBAAuB,GAAG,IAAI,GACpD,EAAE,WAAW,UAA2B,qBAAqB,aAAa,MAAM,CACpF;AAEA,MAAM,mBAAmB,EAAE,KACvB,EAAE,SAAS,EAAE,SAAS,oBAAoB,GAAG,EAAE,GAC/C,EAAE,WAAW,UAAwB,kBAAkB,aAAa,MAAM,CAC9E;AAEA,MAAM,0BAA0B,EAAE,KAC9B,EAAE,SAAS,EAAE,SAAS,4BAA4B,GAAG,OAAO,GAC5D,EAAE,WAAW,UAA+B,yBAAyB,aAAa,MAAM,CAC5F;AAEA,SAAS,mBAAmB,OAA8B;CACtD,OAAO;EAAE,SAAS;EAAO,OAAO;CAAE;AACtC;AAEA,MAAa,iCAAiC,EAAE,KAC5C,EAAE,OAAO;CACL,UAAU;CACV,UAAU;CACV,OAAO;CACP,cAAc;CACd,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAM,CAAC;CACvE,YAAY;CACZ,UAAU;CACV,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC1D,CAAC,GACD,EAAE,OACG,UAAU,MAAM,cAAc,MAAM,MAAM,c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,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,oBAAoB,CAAC;CAClE,YAAY,EAAE,SAAS,mCAAmC;AAC9D,CAAC;AAED,SAAgB,qCAAqC,QAAmB;CACpE,OAAO,EAAE,KACL,mCACA,EAAE,WAAW,QAAQ;EACjB,MAAM,aAAa,OAAO,MAAM;EAChC,MAAM,WAAW,OAAO,QAAQ,IAAI,QAAQ;EAC5C,OAAO;GACH,UAAU,IAAI;GACd,UAAU,IAAI;GACd,OAAO,IAAI;GACX,OAAO,IAAI,QACL,yBAAyB,IAAI,OAAO,YAAY,QAAQ,IACxD,KAAA;GACN,oBAAoB,IAAI;GACxB,oBAAoB,IAAI;GACxB,eAAe,IAAI;GACnB,eAAe,IAAI;GACnB,eAAe,IAAI;GACnB,cAAc,IAAI;GAClB,YAAY,IAAI,aACV,yBAAyB,IAAI,YAAY,MAAM,IAC/C,KAAA;EACV;CACJ,CAAC,CACL;AACJ"}
1
+ {"version":3,"file":"heatmap.schemas.js","names":[],"sources":["../../../src/services/heatmap/heatmap.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\nimport type { HeatmapInterval, HeatmapQuantityMode } from \"../../gen/marketdata/v1/heatmap_pb.js\";\nimport type { DepthTier } from \"../../gen/polyester/type/v1/depth_tier_pb.js\";\nimport { DepthTierCodec } from \"../../shared/depth-tier.js\";\nimport { OptionalTimestampSecondsInputSchema } from \"../../shared/schemas.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport { scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport {\n HEATMAP_DEPTH_VALUES,\n HEATMAP_INTERVAL_VALUES,\n HEATMAP_QUANTITY_MODE_VALUES,\n HeatmapIntervalCodec,\n HeatmapQuantityModeCodec,\n type HeatmapIntervalValue,\n type HeatmapQuantityModeValue,\n} from \"./heatmap.codecs.js\";\n\ntype HeatmapTimeRangeInit = {\n startTime?: TimestampInit;\n endTime?: TimestampInit;\n};\n\ntype TimestampInit = { seconds: bigint; nanos: number };\n\nconst IntervalInputSchema = v.pipe(\n v.optional(v.picklist(HEATMAP_INTERVAL_VALUES), \"1s\"),\n v.transform((value): HeatmapInterval => HeatmapIntervalCodec.inputToProto[value]),\n);\n\nconst DepthInputSchema = v.pipe(\n v.optional(v.picklist(HEATMAP_DEPTH_VALUES), 50),\n v.transform((value): DepthTier => DepthTierCodec.inputToProto[value]),\n);\n\nconst QuantityModeInputSchema = v.pipe(\n v.optional(v.picklist(HEATMAP_QUANTITY_MODE_VALUES), \"close\"),\n v.transform((value): HeatmapQuantityMode => HeatmapQuantityModeCodec.inputToProto[value]),\n);\n\nfunction timestampFromTsSec(tsSec: bigint): TimestampInit {\n return { seconds: tsSec, nanos: 0 };\n}\n\nexport const GetOrderbookHeatmapInputSchema = v.pipe(\n v.object({\n symbolId: SymbolIdInputSchema,\n interval: IntervalInputSchema,\n depth: DepthInputSchema,\n quantityMode: QuantityModeInputSchema,\n limit: v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(20_000)),\n startTsSec: OptionalTimestampSecondsInputSchema,\n endTsSec: OptionalTimestampSecondsInputSchema,\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.check(\n (value) => value.pageToken !== \"\" || value.startTsSec != null || value.endTsSec != null,\n \"pageToken, startTsSec, or endTsSec is required\",\n ),\n v.transform((value) => {\n const timeRange: HeatmapTimeRangeInit | undefined =\n value.pageToken !== \"\"\n ? undefined\n : {\n startTime:\n value.startTsSec != null\n ? timestampFromTsSec(value.startTsSec)\n : undefined,\n endTime:\n value.endTsSec != null ? timestampFromTsSec(value.endTsSec) : undefined,\n };\n\n return {\n symbolId: value.symbolId,\n interval: value.interval,\n depth: value.depth,\n quantityMode: value.quantityMode,\n limit: value.limit,\n pageToken: value.pageToken,\n timeRange,\n };\n }),\n);\n\nfunction intervalLabelFor(value: number): DecodedEnum<HeatmapIntervalValue> {\n return enumLabel(HeatmapIntervalCodec.protoToOutput, value);\n}\n\nfunction quantityModeLabelFor(value: number): DecodedEnum<HeatmapQuantityModeValue> {\n return enumLabel(HeatmapQuantityModeCodec.protoToOutput, value);\n}\n\nconst TimestampSecondsSchema = v.pipe(\n v.bigint(),\n v.transform((value) => Number(value)),\n);\n\nconst Uint64StringSchema = v.pipe(\n v.bigint(),\n v.transform((value) => value.toString()),\n);\n\nconst OrderbookHeatmapLevelsRawSchema = v.object({\n priceTicks: v.array(v.bigint()),\n qtyScaled: v.array(v.bigint()),\n});\n\ntype OrderbookHeatmapLevelsRaw = v.InferOutput<typeof OrderbookHeatmapLevelsRawSchema>;\n\nfunction convertHeatmapLevels(\n levels: OrderbookHeatmapLevelsRaw,\n priceScale: number,\n qtyScale: number,\n) {\n return {\n price: levels.priceTicks.map((tick) => scaledToDecimalOutput(tick, priceScale)),\n qty: levels.qtyScaled.map((qty) => scaledToDecimalOutput(qty, qtyScale)),\n };\n}\n\nexport type OrderbookHeatmapLevels = ReturnType<typeof convertHeatmapLevels>;\n\nexport type OrderbookHeatmapDeltaLevels = OrderbookHeatmapLevels;\n\nconst OrderbookHeatmapKeyframeRawSchema = v.object({\n tsSec: TimestampSecondsSchema,\n bestBidTicks: v.bigint(),\n bestAskTicks: v.bigint(),\n midTicks: v.bigint(),\n bids: v.optional(OrderbookHeatmapLevelsRawSchema),\n asks: v.optional(OrderbookHeatmapLevelsRawSchema),\n bookSeq: Uint64StringSchema,\n});\n\ntype OrderbookHeatmapKeyframeRaw = v.InferOutput<typeof OrderbookHeatmapKeyframeRawSchema>;\n\nfunction convertHeatmapKeyframe(\n keyframe: OrderbookHeatmapKeyframeRaw,\n priceScale: number,\n qtyScale: number,\n) {\n return {\n tsSec: keyframe.tsSec,\n bestBid: scaledToDecimalOutput(keyframe.bestBidTicks, priceScale),\n bestAsk: scaledToDecimalOutput(keyframe.bestAskTicks, priceScale),\n mid: scaledToDecimalOutput(keyframe.midTicks, priceScale),\n bids: keyframe.bids ? convertHeatmapLevels(keyframe.bids, priceScale, qtyScale) : undefined,\n asks: keyframe.asks ? convertHeatmapLevels(keyframe.asks, priceScale, qtyScale) : undefined,\n bookSeq: keyframe.bookSeq,\n };\n}\n\nexport type OrderbookHeatmapKeyframe = ReturnType<typeof convertHeatmapKeyframe>;\n\nconst OrderbookHeatmapDeltaBucketRawSchema = v.object({\n tsSec: TimestampSecondsSchema,\n bids: v.optional(OrderbookHeatmapLevelsRawSchema),\n asks: v.optional(OrderbookHeatmapLevelsRawSchema),\n updatesInBucket: v.number(),\n bookSeqStart: Uint64StringSchema,\n bookSeqEnd: Uint64StringSchema,\n});\n\ntype OrderbookHeatmapDeltaBucketRaw = v.InferOutput<typeof OrderbookHeatmapDeltaBucketRawSchema>;\n\nfunction convertHeatmapDeltaBucket(\n bucket: OrderbookHeatmapDeltaBucketRaw,\n priceScale: number,\n qtyScale: number,\n) {\n return {\n tsSec: bucket.tsSec,\n bids: bucket.bids ? convertHeatmapLevels(bucket.bids, priceScale, qtyScale) : undefined,\n asks: bucket.asks ? convertHeatmapLevels(bucket.asks, priceScale, qtyScale) : undefined,\n updatesInBucket: bucket.updatesInBucket,\n bookSeqStart: bucket.bookSeqStart,\n bookSeqEnd: bucket.bookSeqEnd,\n };\n}\n\nexport type OrderbookHeatmapDeltaBucket = ReturnType<typeof convertHeatmapDeltaBucket>;\n\nconst OrderbookHeatmapLiveBucketRawSchema = v.object({\n symbolId: v.number(),\n interval: v.pipe(v.number(), v.transform(intervalLabelFor)),\n tsSec: TimestampSecondsSchema,\n isFinal: v.boolean(),\n bids: v.optional(OrderbookHeatmapLevelsRawSchema),\n asks: v.optional(OrderbookHeatmapLevelsRawSchema),\n updatesInBucket: v.number(),\n bookSeqStart: Uint64StringSchema,\n bookSeqEnd: Uint64StringSchema,\n quantityMode: v.pipe(v.number(), v.transform(quantityModeLabelFor)),\n effectiveBinTicks: v.bigint(),\n});\n\ntype OrderbookHeatmapLiveBucketRaw = v.InferOutput<typeof OrderbookHeatmapLiveBucketRawSchema>;\n\nfunction convertHeatmapLiveBucket(bucket: OrderbookHeatmapLiveBucketRaw, scales: SdkScales) {\n const priceScale = scales.price();\n const qtyScale = scales.baseQty(bucket.symbolId);\n return {\n symbolId: bucket.symbolId,\n interval: bucket.interval,\n tsSec: bucket.tsSec,\n isFinal: bucket.isFinal,\n bids: bucket.bids ? convertHeatmapLevels(bucket.bids, priceScale, qtyScale) : undefined,\n asks: bucket.asks ? convertHeatmapLevels(bucket.asks, priceScale, qtyScale) : undefined,\n updatesInBucket: bucket.updatesInBucket,\n bookSeqStart: bucket.bookSeqStart,\n bookSeqEnd: bucket.bookSeqEnd,\n quantityMode: bucket.quantityMode,\n effectiveBinSize: scaledToDecimalOutput(bucket.effectiveBinTicks, priceScale),\n };\n}\n\nexport type OrderbookHeatmapLiveBucket = ReturnType<typeof convertHeatmapLiveBucket>;\n\nexport function createOrderbookHeatmapLiveBucketSchema(scales: SdkScales) {\n return v.pipe(\n OrderbookHeatmapLiveBucketRawSchema,\n v.transform((bucket) => convertHeatmapLiveBucket(bucket, scales)),\n );\n}\n\nconst OrderbookHeatmapDeltaChainRawSchema = v.object({\n baseKeyframe: v.optional(OrderbookHeatmapKeyframeRawSchema),\n deltas: v.optional(v.array(OrderbookHeatmapDeltaBucketRawSchema), []),\n});\n\ntype OrderbookHeatmapDeltaChainRaw = v.InferOutput<typeof OrderbookHeatmapDeltaChainRawSchema>;\n\nfunction convertHeatmapDeltaChain(\n chain: OrderbookHeatmapDeltaChainRaw,\n priceScale: number,\n qtyScale: number,\n) {\n return {\n baseKeyframe: chain.baseKeyframe\n ? convertHeatmapKeyframe(chain.baseKeyframe, priceScale, qtyScale)\n : undefined,\n deltas: chain.deltas.map((bucket) =>\n convertHeatmapDeltaBucket(bucket, priceScale, qtyScale),\n ),\n };\n}\n\nexport type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;\n\nconst OrderbookHeatmapResponseRawSchema = v.object({\n symbolId: v.number(),\n interval: v.pipe(v.number(), v.transform(intervalLabelFor)),\n depth: v.pipe(\n v.number(),\n v.transform((value) => enumLabel(DepthTierCodec.protoToOutput, value)),\n ),\n chain: v.optional(OrderbookHeatmapDeltaChainRawSchema),\n lastPersistedTsSec: TimestampSecondsSchema,\n liveFromBookSeqEnd: Uint64StringSchema,\n hasLiveAnchor: v.boolean(),\n nextPageToken: v.optional(v.string(), \"\"),\n serverTimeSec: TimestampSecondsSchema,\n quantityMode: v.pipe(v.number(), v.transform(quantityModeLabelFor)),\n liveBucket: v.optional(OrderbookHeatmapLiveBucketRawSchema),\n});\n\nexport function createOrderbookHeatmapResponseSchema(scales: SdkScales) {\n return v.pipe(\n OrderbookHeatmapResponseRawSchema,\n v.transform((res) => {\n const priceScale = scales.price();\n const qtyScale = scales.baseQty(res.symbolId);\n return {\n symbolId: res.symbolId,\n interval: res.interval,\n depth: res.depth,\n chain: res.chain\n ? convertHeatmapDeltaChain(res.chain, priceScale, qtyScale)\n : undefined,\n lastPersistedTsSec: res.lastPersistedTsSec,\n liveFromBookSeqEnd: res.liveFromBookSeqEnd,\n hasLiveAnchor: res.hasLiveAnchor,\n nextPageToken: res.nextPageToken,\n serverTimeSec: res.serverTimeSec,\n quantityMode: res.quantityMode,\n liveBucket: res.liveBucket\n ? convertHeatmapLiveBucket(res.liveBucket, scales)\n : undefined,\n };\n }),\n );\n}\n\nexport type GetOrderbookHeatmapInput = v.InferInput<typeof GetOrderbookHeatmapInputSchema>;\nexport type ParsedGetOrderbookHeatmapInput = v.InferOutput<typeof GetOrderbookHeatmapInputSchema>;\nexport type OrderbookHeatmapResponse = v.InferOutput<\n ReturnType<typeof createOrderbookHeatmapResponseSchema>\n>;\nexport type ParsedHeatmapTimeRange = HeatmapTimeRangeInit;\n"],"mappings":";;;;;;;;AA0BA,MAAM,sBAAsB,EAAE,KAC1B,EAAE,SAAS,EAAE,SAAS,uBAAuB,GAAG,IAAI,GACpD,EAAE,WAAW,UA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IAAI,aACV,yBAAyB,IAAI,YAAY,MAAM,IAC/C,KAAA;EACV;CACJ,CAAC,CACL;AACJ"}
@@ -138,7 +138,7 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
138
138
  subaccountId: string | undefined;
139
139
  smartAccountAddress: string | undefined;
140
140
  }>]>, undefined>;
141
- readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "rejected" | "accepted">]>;
141
+ readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "accepted" | "rejected">]>;
142
142
  /** Lifecycle flow ID for `lifecycle.getAccountFlow`; empty when the server did not return one. */
143
143
  readonly flowId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
144
144
  }, undefined>, v.TransformAction<{
@@ -157,7 +157,7 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
157
157
  subaccountId: string | undefined;
158
158
  smartAccountAddress: string | undefined;
159
159
  } | undefined;
160
- status: "unspecified" | "failed" | "rejected" | "accepted";
160
+ status: "unspecified" | "failed" | "accepted" | "rejected";
161
161
  flowId: string;
162
162
  }, {
163
163
  acceptedAtUnixMs: number;
@@ -174,7 +174,7 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
174
174
  subaccountId: string | undefined;
175
175
  smartAccountAddress: string | undefined;
176
176
  } | undefined;
177
- status: "unspecified" | "failed" | "rejected" | "accepted";
177
+ status: "unspecified" | "failed" | "accepted" | "rejected";
178
178
  flowId: string;
179
179
  }>]>;
180
180
  type CreateInternalTransferResult = v.InferOutput<ReturnType<typeof createCreateInternalTransferResultSchema>>;
@@ -349,7 +349,7 @@ declare const InternalTransferBatchLegResultSchema: v.SchemaWithPipe<readonly [v
349
349
  creditedAtNs: string | undefined;
350
350
  quantity: string | undefined;
351
351
  /** Why the leg caused its batch's refusal; unset for every other leg. */
352
- errorCode: "UNSPECIFIED" | "UNAUTHENTICATED" | "RATE_LIMIT_EXCEEDED" | "CONFLICT" | "INVALID_REQUEST" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | "PERMISSION_DENIED" | "FAILED_PRECONDITION" | "SUBACCOUNT_NOT_FOUND" | "INSUFFICIENT_FUNDS" | "NOT_FOUND" | "INVALID_SUBACCOUNT_ID" | "SOURCE_ACCOUNT_INACTIVE" | "UNSUPPORTED_ASSET" | "INVALID_AMOUNT" | "INVALID_DESTINATION" | "DESTINATION_NOT_FOUND" | "DESTINATION_INACTIVE" | "SAME_SOURCE_DESTINATION" | "DESTINATION_NOT_WHITELISTED" | "SMART_ACCOUNT_UNAVAILABLE" | "STEP_UP_UNAVAILABLE" | "IDEMPOTENCY_CONFLICT" | "FUNDS_LOCK_CONFLICT" | "CAPITAL_VIEW_UNAVAILABLE" | "ACCOUNT_SHARD_UNAVAILABLE" | "POLICY_DENIED" | "DUST_QUOTE_EXPIRED" | "DUST_PRICE_MOVED" | "DUST_NOT_ELIGIBLE" | "DUST_WINDOW_ACTIVE" | "DUST_DAILY_LIMIT" | "DUST_BUSY" | "DUST_TARGET_UNAVAILABLE" | "DUST_BALANCE_CHANGED" | "DUST_CONVERSION_FAILED" | "BATCH_TOO_MANY_SOURCES" | undefined;
352
+ errorCode: "UNSPECIFIED" | "UNAUTHENTICATED" | "RATE_LIMIT_EXCEEDED" | "CONFLICT" | "INVALID_REQUEST" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | "PERMISSION_DENIED" | "FAILED_PRECONDITION" | "SUBACCOUNT_NOT_FOUND" | "INSUFFICIENT_FUNDS" | "INVALID_SUBACCOUNT_ID" | "SOURCE_ACCOUNT_INACTIVE" | "UNSUPPORTED_ASSET" | "INVALID_AMOUNT" | "INVALID_DESTINATION" | "DESTINATION_NOT_FOUND" | "DESTINATION_INACTIVE" | "SAME_SOURCE_DESTINATION" | "DESTINATION_NOT_WHITELISTED" | "SMART_ACCOUNT_UNAVAILABLE" | "STEP_UP_UNAVAILABLE" | "IDEMPOTENCY_CONFLICT" | "FUNDS_LOCK_CONFLICT" | "CAPITAL_VIEW_UNAVAILABLE" | "ACCOUNT_SHARD_UNAVAILABLE" | "POLICY_DENIED" | "NOT_FOUND" | "DUST_QUOTE_EXPIRED" | "DUST_PRICE_MOVED" | "DUST_NOT_ELIGIBLE" | "DUST_WINDOW_ACTIVE" | "DUST_DAILY_LIMIT" | "DUST_BUSY" | "DUST_TARGET_UNAVAILABLE" | "DUST_BALANCE_CHANGED" | "DUST_CONVERSION_FAILED" | "BATCH_TOO_MANY_SOURCES" | undefined;
353
353
  legIndex: number;
354
354
  status: "unspecified" | "processing" | "credited" | "not_moved";
355
355
  transferId?: string | undefined;
@@ -370,7 +370,7 @@ declare const BatchCreateInternalTransfersResultSchema: v.ObjectSchema<{
370
370
  * it was accepted for processing.
371
371
  */
372
372
  readonly requestId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, string | undefined>]>;
373
- readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "processing" | "accepted" | "refused">]>;
373
+ readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "processing" | "refused" | "accepted">]>;
374
374
  /** One result per leg, in request order. */
375
375
  readonly legs: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
376
376
  readonly legIndex: v.NumberSchema<undefined>;
@@ -427,7 +427,7 @@ declare const BatchCreateInternalTransfersResultSchema: v.ObjectSchema<{
427
427
  creditedAtNs: string | undefined;
428
428
  quantity: string | undefined;
429
429
  /** Why the leg caused its batch's refusal; unset for every other leg. */
430
- errorCode: "UNSPECIFIED" | "UNAUTHENTICATED" | "RATE_LIMIT_EXCEEDED" | "CONFLICT" | "INVALID_REQUEST" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | "PERMISSION_DENIED" | "FAILED_PRECONDITION" | "SUBACCOUNT_NOT_FOUND" | "INSUFFICIENT_FUNDS" | "NOT_FOUND" | "INVALID_SUBACCOUNT_ID" | "SOURCE_ACCOUNT_INACTIVE" | "UNSUPPORTED_ASSET" | "INVALID_AMOUNT" | "INVALID_DESTINATION" | "DESTINATION_NOT_FOUND" | "DESTINATION_INACTIVE" | "SAME_SOURCE_DESTINATION" | "DESTINATION_NOT_WHITELISTED" | "SMART_ACCOUNT_UNAVAILABLE" | "STEP_UP_UNAVAILABLE" | "IDEMPOTENCY_CONFLICT" | "FUNDS_LOCK_CONFLICT" | "CAPITAL_VIEW_UNAVAILABLE" | "ACCOUNT_SHARD_UNAVAILABLE" | "POLICY_DENIED" | "DUST_QUOTE_EXPIRED" | "DUST_PRICE_MOVED" | "DUST_NOT_ELIGIBLE" | "DUST_WINDOW_ACTIVE" | "DUST_DAILY_LIMIT" | "DUST_BUSY" | "DUST_TARGET_UNAVAILABLE" | "DUST_BALANCE_CHANGED" | "DUST_CONVERSION_FAILED" | "BATCH_TOO_MANY_SOURCES" | undefined;
430
+ errorCode: "UNSPECIFIED" | "UNAUTHENTICATED" | "RATE_LIMIT_EXCEEDED" | "CONFLICT" | "INVALID_REQUEST" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | "PERMISSION_DENIED" | "FAILED_PRECONDITION" | "SUBACCOUNT_NOT_FOUND" | "INSUFFICIENT_FUNDS" | "INVALID_SUBACCOUNT_ID" | "SOURCE_ACCOUNT_INACTIVE" | "UNSUPPORTED_ASSET" | "INVALID_AMOUNT" | "INVALID_DESTINATION" | "DESTINATION_NOT_FOUND" | "DESTINATION_INACTIVE" | "SAME_SOURCE_DESTINATION" | "DESTINATION_NOT_WHITELISTED" | "SMART_ACCOUNT_UNAVAILABLE" | "STEP_UP_UNAVAILABLE" | "IDEMPOTENCY_CONFLICT" | "FUNDS_LOCK_CONFLICT" | "CAPITAL_VIEW_UNAVAILABLE" | "ACCOUNT_SHARD_UNAVAILABLE" | "POLICY_DENIED" | "NOT_FOUND" | "DUST_QUOTE_EXPIRED" | "DUST_PRICE_MOVED" | "DUST_NOT_ELIGIBLE" | "DUST_WINDOW_ACTIVE" | "DUST_DAILY_LIMIT" | "DUST_BUSY" | "DUST_TARGET_UNAVAILABLE" | "DUST_BALANCE_CHANGED" | "DUST_CONVERSION_FAILED" | "BATCH_TOO_MANY_SOURCES" | undefined;
431
431
  legIndex: number;
432
432
  status: "unspecified" | "processing" | "credited" | "not_moved";
433
433
  transferId?: string | undefined;
@@ -82,7 +82,7 @@ var LifecycleService = class {
82
82
  * Subscribes to open lifecycle flow summary updates, using private:chain:lifecycle:flows:{accountId}:proto when `accountId` is set and the public all-accounts flow channel only when it is omitted.
83
83
  */
84
84
  subscribeOpenFlows(input) {
85
- const channel = input.accountId === void 0 ? "public:chain:lifecycle:flows:proto" : `private:chain:lifecycle:flows:${input.accountId}:proto`;
85
+ const channel = input.accountId === void 0 ? "public:chain:lifecycle:flows:proto" : `private:chain:lifecycle:flows:${input.accountId.trim()}:proto`;
86
86
  return this.#realtime.connectProtoChannel({
87
87
  channel,
88
88
  schema: FlowSummaryViewSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.js","names":["#client","#authClient","#realtime","#resolver"],"sources":["../../../src/services/lifecycle/lifecycle.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport { create } from \"@bufbuild/protobuf\";\nimport {\n FlowDetailViewSchema,\n FlowSummaryViewSchema,\n GetFlowByIdRequestSchema,\n LifecycleReadService,\n} from \"../../gen/chain/lifecycle/v1/lifecycle_read_pb.js\";\nimport type { PolyesterRealtime } from \"../../realtime/types.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport { resolveAccountScopedInput, type SubaccountResolver } from \"../subaccount-resolver.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { isDev } from \"../../utils/is-dev.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n GetLifecycleAccountFlowInputSchema,\n GetLifecycleFlowInputSchema,\n GetLifecycleFlowOutputSchema,\n LifecycleFlowDetailSchema,\n LifecycleFlowSummarySchema,\n ListLifecycleFlowsByTxOutputSchema,\n ListLifecycleFlowsByTxInputSchema,\n ListLifecycleFlowsOutputSchema,\n ListLifecycleFlowsInputSchema,\n ListLifecycleAccountFlowsInputSchema,\n type GetLifecycleAccountFlowInput,\n type GetLifecycleFlowInput,\n type GetLifecycleFlowOutput,\n type LifecycleFlowDetail,\n type LifecycleFlowSummary,\n type ListLifecycleFlowsByTxInput,\n type ListLifecycleFlowsByTxOutput,\n type ListLifecycleFlowsInput,\n type ListLifecycleAccountFlowsInput,\n type ListLifecycleFlowsOutput,\n} from \"./lifecycle.schemas.js\";\n\ninterface SubscribeOpenLifecycleFlowsInput extends BaseSubscribeInput<LifecycleFlowSummary> {\n accountId?: string;\n}\n\ninterface SubscribeLifecycleFlowDetailInput extends BaseSubscribeInput<LifecycleFlowDetail> {\n flowId: string;\n}\n\n/**\n * Reads and streams chain lifecycle flow state, history, progress, and transaction matches.\n */\nexport class LifecycleService {\n #client: Client<typeof LifecycleReadService>;\n #authClient: Client<typeof LifecycleReadService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n\n constructor(\n transports: AuthAndPublicApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.#client = createClient(LifecycleReadService, transports.publicApi);\n this.#authClient = createClient(LifecycleReadService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n }\n\n /**\n * Returns paginated lifecycle flow summaries filtered by kind, state, scope, account selector, transaction reference, chain ids, and asset ids. The response is ordered by the selected timestamp and includes an opaque next page token.\n *\n * Lists only flows a chain transaction started. With an `accountSelector` (a smart\n * account address), the list holds the flows the account owns and the transfers it\n * receives from other accounts; each row's `participation` says which. Pass\n * `participation: \"owner\"` for the owned flows only. A `pageToken` only resumes the\n * request it came from: change nothing but `limit` between pages. Use `listAccountFlows`\n * for every flow of the signed-in account.\n */\n async listFlows(\n input: ListLifecycleFlowsInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListLifecycleFlowsOutput> {\n const parsedInput = parse(ListLifecycleFlowsInputSchema, input);\n const response = await this.#client.listFlows(parsedInput, toConnectCallOptions(options));\n const res = parse(ListLifecycleFlowsOutputSchema, response);\n return res;\n }\n\n /**\n * Lists the signed-in account's flows: the ones it owns and the transfers it receives,\n * including flows no chain transaction started, such as transfers between Trading accounts.\n * Each row's `participation` says which. Takes the same filters as `listFlows`; a\n * `pageToken` only resumes the request it came from. API keys need `read-funding-flows`.\n */\n async listAccountFlows(\n input: ListLifecycleAccountFlowsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListLifecycleFlowsOutput> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(ListLifecycleAccountFlowsInputSchema, resolved);\n const response = await this.#authClient.listAccountFlows(\n request,\n toConnectCallOptions(options),\n );\n return parse(ListLifecycleFlowsOutputSchema, response);\n }\n\n /**\n * Fetches one flow the signed-in account owns or receives, including one no chain\n * transaction started. A flow the account takes no part in throws `ResourceNotFoundError`. API keys\n * need `read-funding-flows`.\n */\n async getAccountFlow(\n input: GetLifecycleAccountFlowInput,\n options?: PolyesterRequestOptions,\n ): Promise<GetLifecycleFlowOutput> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(GetLifecycleAccountFlowInputSchema, resolved);\n const response = await this.#authClient.getAccountFlow(\n request,\n toConnectCallOptions(options),\n );\n return parse(GetLifecycleFlowOutputSchema, response);\n }\n\n /**\n * Fetches one lifecycle flow by its public flow id and returns summary, factual steps,\n * timeline, and live-state detail when available. Finds only flows a chain transaction\n * started; the account reads its other flows with `getAccountFlow`.\n */\n async getFlow(\n input: GetLifecycleFlowInput,\n options?: PolyesterRequestOptions,\n ): Promise<GetLifecycleFlowOutput> {\n const parsedInput = parse(GetLifecycleFlowInputSchema, input);\n const response = await this.#client.getFlowById(\n create(GetFlowByIdRequestSchema, parsedInput),\n toConnectCallOptions(options),\n );\n return parse(GetLifecycleFlowOutputSchema, response);\n }\n\n /**\n * Searches lifecycle flows that reference a 0x-prefixed transaction hash, using source-only or any-reference lookup mode. A single transaction may match zero, one, or many flows.\n */\n async listFlowsByTx(\n input: ListLifecycleFlowsByTxInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListLifecycleFlowsByTxOutput> {\n const parsedInput = parse(ListLifecycleFlowsByTxInputSchema, input);\n const response = await this.#client.listFlowsByTx(\n parsedInput,\n toConnectCallOptions(options),\n );\n return parse(ListLifecycleFlowsByTxOutputSchema, response);\n }\n\n /**\n * Subscribes to open lifecycle flow summary updates, using private:chain:lifecycle:flows:{accountId}:proto when `accountId` is set and the public all-accounts flow channel only when it is omitted.\n */\n subscribeOpenFlows(input: SubscribeOpenLifecycleFlowsInput): () => void {\n const channel =\n input.accountId === undefined\n ? \"public:chain:lifecycle:flows:proto\"\n : `private:chain:lifecycle:flows:${input.accountId}:proto`;\n return this.#realtime.connectProtoChannel({\n channel,\n schema: FlowSummaryViewSchema,\n onPublication: (data) => {\n const flow = parse(LifecycleFlowSummarySchema, data);\n input.onEvent(flow);\n },\n onConnected: input.onOpen,\n onDisconnected: input.onClose,\n onError: input.onError,\n });\n }\n\n /**\n * Subscribes to detail updates for one lifecycle flow on public:chain:lifecycle:flow:{flowId}:proto. Invalid flow ids are rejected locally with a no-op unsubscribe function.\n */\n subscribeFlowDetail(input: SubscribeLifecycleFlowDetailInput): () => void {\n const parsedFlowId = v.safeParse(GetLifecycleFlowInputSchema, { flowId: input.flowId });\n if (!parsedFlowId.success) {\n if (isDev()) {\n console.error(\n \"[LifecycleService] flowId is required for flow detail subscription.\",\n );\n }\n return () => {};\n }\n\n const channel = `public:chain:lifecycle:flow:${parsedFlowId.output.flowId}:proto`;\n return this.#realtime.connectProtoChannel({\n channel,\n schema: FlowDetailViewSchema,\n onPublication: (data) => {\n const flow = parse(LifecycleFlowDetailSchema, data);\n input.onEvent(flow);\n },\n onConnected: input.onOpen,\n onDisconnected: input.onClose,\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAqDA,IAAa,mBAAb,MAA8B;CAC1B;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAKA,UAAU,aAAa,sBAAsB,WAAW,SAAS;EACtE,KAAKC,cAAc,aAAa,sBAAsB,WAAW,OAAO;EACxE,KAAKC,YAAY;EACjB,KAAKC,YAAY;CACrB;;;;;;;;;;;CAYA,MAAM,UACF,OACA,SACiC;EACjC,MAAM,cAAc,MAAM,+BAA+B,KAAK;EAC9D,MAAM,WAAW,MAAM,KAAKH,QAAQ,UAAU,aAAa,qBAAqB,OAAO,CAAC;EAExF,OADY,MAAM,gCAAgC,QACzC;CACb;;;;;;;CAQA,MAAM,iBACF,QAAwC,CAAC,GACzC,SACiC;EACjC,MAAM,WAAW,0BAA0B,OAAO,KAAKG,SAAS;EAChE,MAAM,UAAU,MAAM,sCAAsC,QAAQ;EACpE,MAAM,WAAW,MAAM,KAAKF,YAAY,iBACpC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,gCAAgC,QAAQ;CACzD;;;;;;CAOA,MAAM,eACF,OACA,SAC+B;EAC/B,MAAM,WAAW,0BAA0B,OAAO,KAAKE,SAAS;EAChE,MAAM,UAAU,MAAM,oCAAoC,QAAQ;EAClE,MAAM,WAAW,MAAM,KAAKF,YAAY,eACpC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,8BAA8B,QAAQ;CACvD;;;;;;CAOA,MAAM,QACF,OACA,SAC+B;EAC/B,MAAM,cAAc,MAAM,6BAA6B,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKD,QAAQ,YAChC,OAAO,0BAA0B,WAAW,GAC5C,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,8BAA8B,QAAQ;CACvD;;;;CAKA,MAAM,cACF,OACA,SACqC;EACrC,MAAM,cAAc,MAAM,mCAAmC,KAAK;EAClE,MAAM,WAAW,MAAM,KAAKA,QAAQ,cAChC,aACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,oCAAoC,QAAQ;CAC7D;;;;CAKA,mBAAmB,OAAqD;EACpE,MAAM,UACF,MAAM,cAAc,KAAA,IACd,uCACA,iCAAiC,MAAM,UAAU;EAC3D,OAAO,KAAKE,UAAU,oBAAoB;GACtC;GACA,QAAQ;GACR,gBAAgB,SAAS;IACrB,MAAM,OAAO,MAAM,4BAA4B,IAAI;IACnD,MAAM,QAAQ,IAAI;GACtB;GACA,aAAa,MAAM;GACnB,gBAAgB,MAAM;GACtB,SAAS,MAAM;EACnB,CAAC;CACL;;;;CAKA,oBAAoB,OAAsD;EACtE,MAAM,eAAe,EAAE,UAAU,6BAA6B,EAAE,QAAQ,MAAM,OAAO,CAAC;EACtF,IAAI,CAAC,aAAa,SAAS;GACvB,IAAI,MAAM,GACN,QAAQ,MACJ,qEACJ;GAEJ,aAAa,CAAC;EAClB;EAEA,MAAM,UAAU,+BAA+B,aAAa,OAAO,OAAO;EAC1E,OAAO,KAAKA,UAAU,oBAAoB;GACtC;GACA,QAAQ;GACR,gBAAgB,SAAS;IACrB,MAAM,OAAO,MAAM,2BAA2B,IAAI;IAClD,MAAM,QAAQ,IAAI;GACtB;GACA,aAAa,MAAM;GACnB,gBAAgB,MAAM;GACtB,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
1
+ {"version":3,"file":"lifecycle.js","names":["#client","#authClient","#realtime","#resolver"],"sources":["../../../src/services/lifecycle/lifecycle.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport { create } from \"@bufbuild/protobuf\";\nimport {\n FlowDetailViewSchema,\n FlowSummaryViewSchema,\n GetFlowByIdRequestSchema,\n LifecycleReadService,\n} from \"../../gen/chain/lifecycle/v1/lifecycle_read_pb.js\";\nimport type { PolyesterRealtime } from \"../../realtime/types.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport { resolveAccountScopedInput, type SubaccountResolver } from \"../subaccount-resolver.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { isDev } from \"../../utils/is-dev.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n GetLifecycleAccountFlowInputSchema,\n GetLifecycleFlowInputSchema,\n GetLifecycleFlowOutputSchema,\n LifecycleFlowDetailSchema,\n LifecycleFlowSummarySchema,\n ListLifecycleFlowsByTxOutputSchema,\n ListLifecycleFlowsByTxInputSchema,\n ListLifecycleFlowsOutputSchema,\n ListLifecycleFlowsInputSchema,\n ListLifecycleAccountFlowsInputSchema,\n type GetLifecycleAccountFlowInput,\n type GetLifecycleFlowInput,\n type GetLifecycleFlowOutput,\n type LifecycleFlowDetail,\n type LifecycleFlowSummary,\n type ListLifecycleFlowsByTxInput,\n type ListLifecycleFlowsByTxOutput,\n type ListLifecycleFlowsInput,\n type ListLifecycleAccountFlowsInput,\n type ListLifecycleFlowsOutput,\n} from \"./lifecycle.schemas.js\";\n\ninterface SubscribeOpenLifecycleFlowsInput extends BaseSubscribeInput<LifecycleFlowSummary> {\n accountId?: string;\n}\n\ninterface SubscribeLifecycleFlowDetailInput extends BaseSubscribeInput<LifecycleFlowDetail> {\n flowId: string;\n}\n\n/**\n * Reads and streams chain lifecycle flow state, history, progress, and transaction matches.\n */\nexport class LifecycleService {\n #client: Client<typeof LifecycleReadService>;\n #authClient: Client<typeof LifecycleReadService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n\n constructor(\n transports: AuthAndPublicApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.#client = createClient(LifecycleReadService, transports.publicApi);\n this.#authClient = createClient(LifecycleReadService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n }\n\n /**\n * Returns paginated lifecycle flow summaries filtered by kind, state, scope, account selector, transaction reference, chain ids, and asset ids. The response is ordered by the selected timestamp and includes an opaque next page token.\n *\n * Lists only flows a chain transaction started. With an `accountSelector` (a smart\n * account address), the list holds the flows the account owns and the transfers it\n * receives from other accounts; each row's `participation` says which. Pass\n * `participation: \"owner\"` for the owned flows only. A `pageToken` only resumes the\n * request it came from: change nothing but `limit` between pages. Use `listAccountFlows`\n * for every flow of the signed-in account.\n */\n async listFlows(\n input: ListLifecycleFlowsInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListLifecycleFlowsOutput> {\n const parsedInput = parse(ListLifecycleFlowsInputSchema, input);\n const response = await this.#client.listFlows(parsedInput, toConnectCallOptions(options));\n const res = parse(ListLifecycleFlowsOutputSchema, response);\n return res;\n }\n\n /**\n * Lists the signed-in account's flows: the ones it owns and the transfers it receives,\n * including flows no chain transaction started, such as transfers between Trading accounts.\n * Each row's `participation` says which. Takes the same filters as `listFlows`; a\n * `pageToken` only resumes the request it came from. API keys need `read-funding-flows`.\n */\n async listAccountFlows(\n input: ListLifecycleAccountFlowsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListLifecycleFlowsOutput> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(ListLifecycleAccountFlowsInputSchema, resolved);\n const response = await this.#authClient.listAccountFlows(\n request,\n toConnectCallOptions(options),\n );\n return parse(ListLifecycleFlowsOutputSchema, response);\n }\n\n /**\n * Fetches one flow the signed-in account owns or receives, including one no chain\n * transaction started. A flow the account takes no part in throws `ResourceNotFoundError`. API keys\n * need `read-funding-flows`.\n */\n async getAccountFlow(\n input: GetLifecycleAccountFlowInput,\n options?: PolyesterRequestOptions,\n ): Promise<GetLifecycleFlowOutput> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(GetLifecycleAccountFlowInputSchema, resolved);\n const response = await this.#authClient.getAccountFlow(\n request,\n toConnectCallOptions(options),\n );\n return parse(GetLifecycleFlowOutputSchema, response);\n }\n\n /**\n * Fetches one lifecycle flow by its public flow id and returns summary, factual steps,\n * timeline, and live-state detail when available. Finds only flows a chain transaction\n * started; the account reads its other flows with `getAccountFlow`.\n */\n async getFlow(\n input: GetLifecycleFlowInput,\n options?: PolyesterRequestOptions,\n ): Promise<GetLifecycleFlowOutput> {\n const parsedInput = parse(GetLifecycleFlowInputSchema, input);\n const response = await this.#client.getFlowById(\n create(GetFlowByIdRequestSchema, parsedInput),\n toConnectCallOptions(options),\n );\n return parse(GetLifecycleFlowOutputSchema, response);\n }\n\n /**\n * Searches lifecycle flows that reference a 0x-prefixed transaction hash, using source-only or any-reference lookup mode. A single transaction may match zero, one, or many flows.\n */\n async listFlowsByTx(\n input: ListLifecycleFlowsByTxInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListLifecycleFlowsByTxOutput> {\n const parsedInput = parse(ListLifecycleFlowsByTxInputSchema, input);\n const response = await this.#client.listFlowsByTx(\n parsedInput,\n toConnectCallOptions(options),\n );\n return parse(ListLifecycleFlowsByTxOutputSchema, response);\n }\n\n /**\n * Subscribes to open lifecycle flow summary updates, using private:chain:lifecycle:flows:{accountId}:proto when `accountId` is set and the public all-accounts flow channel only when it is omitted.\n */\n subscribeOpenFlows(input: SubscribeOpenLifecycleFlowsInput): () => void {\n const channel =\n input.accountId === undefined\n ? \"public:chain:lifecycle:flows:proto\"\n : `private:chain:lifecycle:flows:${input.accountId.trim()}:proto`;\n return this.#realtime.connectProtoChannel({\n channel,\n schema: FlowSummaryViewSchema,\n onPublication: (data) => {\n const flow = parse(LifecycleFlowSummarySchema, data);\n input.onEvent(flow);\n },\n onConnected: input.onOpen,\n onDisconnected: input.onClose,\n onError: input.onError,\n });\n }\n\n /**\n * Subscribes to detail updates for one lifecycle flow on public:chain:lifecycle:flow:{flowId}:proto. Invalid flow ids are rejected locally with a no-op unsubscribe function.\n */\n subscribeFlowDetail(input: SubscribeLifecycleFlowDetailInput): () => void {\n const parsedFlowId = v.safeParse(GetLifecycleFlowInputSchema, { flowId: input.flowId });\n if (!parsedFlowId.success) {\n if (isDev()) {\n console.error(\n \"[LifecycleService] flowId is required for flow detail subscription.\",\n );\n }\n return () => {};\n }\n\n const channel = `public:chain:lifecycle:flow:${parsedFlowId.output.flowId}:proto`;\n return this.#realtime.connectProtoChannel({\n channel,\n schema: FlowDetailViewSchema,\n onPublication: (data) => {\n const flow = parse(LifecycleFlowDetailSchema, data);\n input.onEvent(flow);\n },\n onConnected: input.onOpen,\n onDisconnected: input.onClose,\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAqDA,IAAa,mBAAb,MAA8B;CAC1B;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAKA,UAAU,aAAa,sBAAsB,WAAW,SAAS;EACtE,KAAKC,cAAc,aAAa,sBAAsB,WAAW,OAAO;EACxE,KAAKC,YAAY;EACjB,KAAKC,YAAY;CACrB;;;;;;;;;;;CAYA,MAAM,UACF,OACA,SACiC;EACjC,MAAM,cAAc,MAAM,+BAA+B,KAAK;EAC9D,MAAM,WAAW,MAAM,KAAKH,QAAQ,UAAU,aAAa,qBAAqB,OAAO,CAAC;EAExF,OADY,MAAM,gCAAgC,QACzC;CACb;;;;;;;CAQA,MAAM,iBACF,QAAwC,CAAC,GACzC,SACiC;EACjC,MAAM,WAAW,0BAA0B,OAAO,KAAKG,SAAS;EAChE,MAAM,UAAU,MAAM,sCAAsC,QAAQ;EACpE,MAAM,WAAW,MAAM,KAAKF,YAAY,iBACpC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,gCAAgC,QAAQ;CACzD;;;;;;CAOA,MAAM,eACF,OACA,SAC+B;EAC/B,MAAM,WAAW,0BAA0B,OAAO,KAAKE,SAAS;EAChE,MAAM,UAAU,MAAM,oCAAoC,QAAQ;EAClE,MAAM,WAAW,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