@polyester/sdk 0.4.0 → 0.4.2

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 (296) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/_virtual/_rolldown/runtime.js +1 -15
  3. package/dist/catalogs/snapshot-validation.js +63 -63
  4. package/dist/catalogs/snapshot-validation.js.map +1 -1
  5. package/dist/core-client.d.ts +9 -0
  6. package/dist/core-client.d.ts.map +1 -1
  7. package/dist/core-client.js +21 -0
  8. package/dist/core-client.js.map +1 -1
  9. package/dist/gen/fees/v1/fees_pb.d.ts +124 -0
  10. package/dist/gen/fees/v1/fees_pb.d.ts.map +1 -0
  11. package/dist/gen/fees/v1/fees_pb.js +39 -0
  12. package/dist/gen/fees/v1/fees_pb.js.map +1 -0
  13. package/dist/gen/index.d.ts +4 -1
  14. package/dist/gen/index.js +4 -1
  15. package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +223 -0
  16. package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts.map +1 -0
  17. package/dist/gen/ratelimit/v1/ratelimit_pb.js +86 -0
  18. package/dist/gen/ratelimit/v1/ratelimit_pb.js.map +1 -0
  19. package/dist/gen/vip/v1/vip_pb.d.ts +277 -0
  20. package/dist/gen/vip/v1/vip_pb.d.ts.map +1 -0
  21. package/dist/gen/vip/v1/vip_pb.js +60 -0
  22. package/dist/gen/vip/v1/vip_pb.js.map +1 -0
  23. package/dist/index.d.ts +8 -1
  24. package/dist/services/accounts/accounts.js +1 -1
  25. package/dist/services/accounts/accounts.js.map +1 -1
  26. package/dist/services/accounts/accounts.schemas.d.ts +13 -13
  27. package/dist/services/accounts/accounts.schemas.d.ts.map +1 -1
  28. package/dist/services/accounts/accounts.schemas.js +11 -11
  29. package/dist/services/accounts/accounts.schemas.js.map +1 -1
  30. package/dist/services/address-book/address-book.js.map +1 -1
  31. package/dist/services/address-book/address-book.schemas.d.ts +751 -751
  32. package/dist/services/address-book/address-book.schemas.d.ts.map +1 -1
  33. package/dist/services/address-book/address-book.schemas.js +160 -159
  34. package/dist/services/address-book/address-book.schemas.js.map +1 -1
  35. package/dist/services/api-keys/api-keys.d.ts +6 -6
  36. package/dist/services/api-keys/api-keys.d.ts.map +1 -1
  37. package/dist/services/api-keys/api-keys.js.map +1 -1
  38. package/dist/services/api-keys/api-keys.schemas.d.ts +62 -62
  39. package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
  40. package/dist/services/api-keys/api-keys.schemas.js +34 -34
  41. package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
  42. package/dist/services/auth/auth.d.ts +39 -39
  43. package/dist/services/auth/auth.d.ts.map +1 -1
  44. package/dist/services/auth/auth.js +19 -18
  45. package/dist/services/auth/auth.js.map +1 -1
  46. package/dist/services/auth/profile/profile.d.ts +2 -2
  47. package/dist/services/auth/profile/profile.d.ts.map +1 -1
  48. package/dist/services/auth/profile/profile.js +3 -2
  49. package/dist/services/auth/profile/profile.js.map +1 -1
  50. package/dist/services/auth/profile/profile.schemas.d.ts +41 -41
  51. package/dist/services/auth/profile/profile.schemas.d.ts.map +1 -1
  52. package/dist/services/auth/profile/profile.schemas.js +27 -27
  53. package/dist/services/auth/profile/profile.schemas.js.map +1 -1
  54. package/dist/services/auth/session.schemas.js +17 -17
  55. package/dist/services/auth/session.schemas.js.map +1 -1
  56. package/dist/services/balances/balances.d.ts.map +1 -1
  57. package/dist/services/balances/balances.js +3 -2
  58. package/dist/services/balances/balances.js.map +1 -1
  59. package/dist/services/balances/balances.schemas.d.ts +95 -95
  60. package/dist/services/balances/balances.schemas.d.ts.map +1 -1
  61. package/dist/services/balances/balances.schemas.js +61 -61
  62. package/dist/services/balances/balances.schemas.js.map +1 -1
  63. package/dist/services/candles/candles.d.ts.map +1 -1
  64. package/dist/services/candles/candles.js +5 -4
  65. package/dist/services/candles/candles.js.map +1 -1
  66. package/dist/services/candles/candles.schemas.d.ts +64 -64
  67. package/dist/services/candles/candles.schemas.d.ts.map +1 -1
  68. package/dist/services/candles/candles.schemas.js +47 -47
  69. package/dist/services/candles/candles.schemas.js.map +1 -1
  70. package/dist/services/chain-analytics/chain-analytics.js.map +1 -1
  71. package/dist/services/chain-analytics/chain-analytics.schemas.d.ts +68 -68
  72. package/dist/services/chain-analytics/chain-analytics.schemas.d.ts.map +1 -1
  73. package/dist/services/chain-analytics/chain-analytics.schemas.js +29 -29
  74. package/dist/services/chain-analytics/chain-analytics.schemas.js.map +1 -1
  75. package/dist/services/deposit/deposit.js.map +1 -1
  76. package/dist/services/deposit/deposit.schemas.d.ts +17 -17
  77. package/dist/services/deposit/deposit.schemas.d.ts.map +1 -1
  78. package/dist/services/deposit/deposit.schemas.js +11 -11
  79. package/dist/services/deposit/deposit.schemas.js.map +1 -1
  80. package/dist/services/fees/fees.d.ts +19 -0
  81. package/dist/services/fees/fees.d.ts.map +1 -0
  82. package/dist/services/fees/fees.js +32 -0
  83. package/dist/services/fees/fees.js.map +1 -0
  84. package/dist/services/fees/fees.schemas.d.ts +28 -0
  85. package/dist/services/fees/fees.schemas.d.ts.map +1 -0
  86. package/dist/services/fees/fees.schemas.js +25 -0
  87. package/dist/services/fees/fees.schemas.js.map +1 -0
  88. package/dist/services/fees/fees.types.d.ts +2 -0
  89. package/dist/services/fees/index.d.ts +3 -0
  90. package/dist/services/guard-signer/guard-signer.js.map +1 -1
  91. package/dist/services/guard-signer/guard-signer.schemas.d.ts +75 -75
  92. package/dist/services/guard-signer/guard-signer.schemas.d.ts.map +1 -1
  93. package/dist/services/guard-signer/guard-signer.schemas.js +42 -42
  94. package/dist/services/guard-signer/guard-signer.schemas.js.map +1 -1
  95. package/dist/services/heatmap/heatmap.d.ts.map +1 -1
  96. package/dist/services/heatmap/heatmap.js +5 -4
  97. package/dist/services/heatmap/heatmap.js.map +1 -1
  98. package/dist/services/heatmap/heatmap.schemas.d.ts +138 -138
  99. package/dist/services/heatmap/heatmap.schemas.d.ts.map +1 -1
  100. package/dist/services/heatmap/heatmap.schemas.js +47 -47
  101. package/dist/services/heatmap/heatmap.schemas.js.map +1 -1
  102. package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
  103. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +53 -53
  104. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
  105. package/dist/services/internal-transfers/internal-transfers.schemas.js +27 -27
  106. package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
  107. package/dist/services/lifecycle/lifecycle.d.ts.map +1 -1
  108. package/dist/services/lifecycle/lifecycle.js +3 -2
  109. package/dist/services/lifecycle/lifecycle.js.map +1 -1
  110. package/dist/services/lifecycle/lifecycle.schemas.d.ts +614 -614
  111. package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
  112. package/dist/services/lifecycle/lifecycle.schemas.js +146 -146
  113. package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
  114. package/dist/services/market-data/market-data.d.ts.map +1 -1
  115. package/dist/services/market-data/market-data.js +4 -3
  116. package/dist/services/market-data/market-data.js.map +1 -1
  117. package/dist/services/market-data/market-data.schemas.d.ts +19 -19
  118. package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
  119. package/dist/services/market-data/market-data.schemas.js +50 -50
  120. package/dist/services/market-data/market-data.schemas.js.map +1 -1
  121. package/dist/services/market-overview/market-overview.d.ts.map +1 -1
  122. package/dist/services/market-overview/market-overview.js +3 -2
  123. package/dist/services/market-overview/market-overview.js.map +1 -1
  124. package/dist/services/market-overview/market-overview.schemas.d.ts +37 -37
  125. package/dist/services/market-overview/market-overview.schemas.d.ts.map +1 -1
  126. package/dist/services/market-overview/market-overview.schemas.js +33 -33
  127. package/dist/services/market-overview/market-overview.schemas.js.map +1 -1
  128. package/dist/services/mfa/mfa.js +1 -1
  129. package/dist/services/mfa/mfa.js.map +1 -1
  130. package/dist/services/mfa/mfa.schemas.d.ts +206 -206
  131. package/dist/services/mfa/mfa.schemas.d.ts.map +1 -1
  132. package/dist/services/mfa/mfa.schemas.js +83 -83
  133. package/dist/services/mfa/mfa.schemas.js.map +1 -1
  134. package/dist/services/orderbook/orderbook.d.ts +2 -2
  135. package/dist/services/orderbook/orderbook.d.ts.map +1 -1
  136. package/dist/services/orderbook/orderbook.js +3 -2
  137. package/dist/services/orderbook/orderbook.js.map +1 -1
  138. package/dist/services/orderbook/orderbook.schemas.d.ts +23 -23
  139. package/dist/services/orderbook/orderbook.schemas.d.ts.map +1 -1
  140. package/dist/services/orderbook/orderbook.schemas.js +15 -15
  141. package/dist/services/orderbook/orderbook.schemas.js.map +1 -1
  142. package/dist/services/orders/order-errors.schemas.d.ts +18 -18
  143. package/dist/services/orders/order-errors.schemas.d.ts.map +1 -1
  144. package/dist/services/orders/order-errors.schemas.js +8 -8
  145. package/dist/services/orders/order-errors.schemas.js.map +1 -1
  146. package/dist/services/orders/orders-batch.schemas.d.ts +492 -492
  147. package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
  148. package/dist/services/orders/orders-batch.schemas.js +117 -117
  149. package/dist/services/orders/orders-batch.schemas.js.map +1 -1
  150. package/dist/services/orders/orders-identifiers.schemas.js +5 -5
  151. package/dist/services/orders/orders-identifiers.schemas.js.map +1 -1
  152. package/dist/services/orders/orders-input.schemas.d.ts +648 -648
  153. package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
  154. package/dist/services/orders/orders-input.schemas.js +95 -95
  155. package/dist/services/orders/orders-input.schemas.js.map +1 -1
  156. package/dist/services/orders/orders-modify.schemas.d.ts +351 -351
  157. package/dist/services/orders/orders-modify.schemas.d.ts.map +1 -1
  158. package/dist/services/orders/orders-modify.schemas.js +44 -44
  159. package/dist/services/orders/orders-modify.schemas.js.map +1 -1
  160. package/dist/services/orders/orders-output.schemas.d.ts +179 -179
  161. package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
  162. package/dist/services/orders/orders-output.schemas.js +49 -49
  163. package/dist/services/orders/orders-output.schemas.js.map +1 -1
  164. package/dist/services/orders/orders-risk.schemas.d.ts +226 -226
  165. package/dist/services/orders/orders-risk.schemas.d.ts.map +1 -1
  166. package/dist/services/orders/orders-risk.schemas.js +69 -69
  167. package/dist/services/orders/orders-risk.schemas.js.map +1 -1
  168. package/dist/services/orders/orders.d.ts +6 -6
  169. package/dist/services/orders/orders.d.ts.map +1 -1
  170. package/dist/services/orders/orders.js +4 -3
  171. package/dist/services/orders/orders.js.map +1 -1
  172. package/dist/services/policies/api-key-policies/api-key-policies.d.ts +6 -6
  173. package/dist/services/policies/api-key-policies/api-key-policies.d.ts.map +1 -1
  174. package/dist/services/policies/api-key-policies/api-key-policies.js.map +1 -1
  175. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +105 -105
  176. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts.map +1 -1
  177. package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +49 -49
  178. package/dist/services/policies/api-key-policies/api-key-policies.schemas.js.map +1 -1
  179. package/dist/services/policies/shared.d.ts +5 -5
  180. package/dist/services/policies/shared.d.ts.map +1 -1
  181. package/dist/services/policies/shared.js +10 -10
  182. package/dist/services/policies/shared.js.map +1 -1
  183. package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts +6 -6
  184. package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts.map +1 -1
  185. package/dist/services/policies/subaccount-policies/subaccount-policies.js +3 -2
  186. package/dist/services/policies/subaccount-policies/subaccount-policies.js.map +1 -1
  187. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +124 -124
  188. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts.map +1 -1
  189. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +75 -75
  190. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
  191. package/dist/services/rate-limits/index.d.ts +4 -0
  192. package/dist/services/rate-limits/rate-limits.codecs.d.ts +6 -0
  193. package/dist/services/rate-limits/rate-limits.codecs.d.ts.map +1 -0
  194. package/dist/services/rate-limits/rate-limits.codecs.js +11 -0
  195. package/dist/services/rate-limits/rate-limits.codecs.js.map +1 -0
  196. package/dist/services/rate-limits/rate-limits.d.ts +24 -0
  197. package/dist/services/rate-limits/rate-limits.d.ts.map +1 -0
  198. package/dist/services/rate-limits/rate-limits.js +40 -0
  199. package/dist/services/rate-limits/rate-limits.js.map +1 -0
  200. package/dist/services/rate-limits/rate-limits.schemas.d.ts +58 -0
  201. package/dist/services/rate-limits/rate-limits.schemas.d.ts.map +1 -0
  202. package/dist/services/rate-limits/rate-limits.schemas.js +30 -0
  203. package/dist/services/rate-limits/rate-limits.schemas.js.map +1 -0
  204. package/dist/services/rate-limits/rate-limits.types.d.ts +3 -0
  205. package/dist/services/shared.js +11 -11
  206. package/dist/services/shared.js.map +1 -1
  207. package/dist/services/social-verification/social-verification.d.ts +3 -3
  208. package/dist/services/social-verification/social-verification.d.ts.map +1 -1
  209. package/dist/services/social-verification/social-verification.js.map +1 -1
  210. package/dist/services/social-verification/social-verification.schemas.d.ts +54 -54
  211. package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
  212. package/dist/services/social-verification/social-verification.schemas.js +28 -28
  213. package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
  214. package/dist/services/subaccounts/subaccounts.d.ts +14 -14
  215. package/dist/services/subaccounts/subaccounts.d.ts.map +1 -1
  216. package/dist/services/subaccounts/subaccounts.js +9 -8
  217. package/dist/services/subaccounts/subaccounts.js.map +1 -1
  218. package/dist/services/subaccounts/subaccounts.schemas.d.ts +137 -137
  219. package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
  220. package/dist/services/subaccounts/subaccounts.schemas.js +72 -72
  221. package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
  222. package/dist/services/trades/trades.d.ts +2 -2
  223. package/dist/services/trades/trades.d.ts.map +1 -1
  224. package/dist/services/trades/trades.js +3 -2
  225. package/dist/services/trades/trades.js.map +1 -1
  226. package/dist/services/trades/trades.schemas.d.ts +31 -31
  227. package/dist/services/trades/trades.schemas.d.ts.map +1 -1
  228. package/dist/services/trades/trades.schemas.js +24 -24
  229. package/dist/services/trades/trades.schemas.js.map +1 -1
  230. package/dist/services/trading-withdraws/trading-withdraws.js +1 -1
  231. package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
  232. package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +45 -45
  233. package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
  234. package/dist/services/trading-withdraws/trading-withdraws.schemas.js +36 -36
  235. package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
  236. package/dist/services/transfers/transfers.d.ts.map +1 -1
  237. package/dist/services/transfers/transfers.js +3 -2
  238. package/dist/services/transfers/transfers.js.map +1 -1
  239. package/dist/services/transfers/transfers.schemas.d.ts +42 -42
  240. package/dist/services/transfers/transfers.schemas.d.ts.map +1 -1
  241. package/dist/services/transfers/transfers.schemas.js +30 -30
  242. package/dist/services/transfers/transfers.schemas.js.map +1 -1
  243. package/dist/services/triggers/trigger-child-order.schemas.js +23 -23
  244. package/dist/services/triggers/trigger-child-order.schemas.js.map +1 -1
  245. package/dist/services/triggers/trigger-input.schemas.d.ts +226 -226
  246. package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
  247. package/dist/services/triggers/trigger-input.schemas.js +53 -53
  248. package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
  249. package/dist/services/triggers/triggers-output.schemas.d.ts +218 -218
  250. package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
  251. package/dist/services/triggers/triggers-output.schemas.js +152 -152
  252. package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
  253. package/dist/services/triggers/triggers.d.ts.map +1 -1
  254. package/dist/services/triggers/triggers.js +4 -3
  255. package/dist/services/triggers/triggers.js.map +1 -1
  256. package/dist/services/vip/index.d.ts +3 -0
  257. package/dist/services/vip/vip.d.ts +22 -0
  258. package/dist/services/vip/vip.d.ts.map +1 -0
  259. package/dist/services/vip/vip.js +35 -0
  260. package/dist/services/vip/vip.js.map +1 -0
  261. package/dist/services/vip/vip.schemas.d.ts +90 -0
  262. package/dist/services/vip/vip.schemas.d.ts.map +1 -0
  263. package/dist/services/vip/vip.schemas.js +47 -0
  264. package/dist/services/vip/vip.schemas.js.map +1 -0
  265. package/dist/services/vip/vip.types.d.ts +2 -0
  266. package/dist/services/whiteboard/whiteboard.js.map +1 -1
  267. package/dist/services/whiteboard/whiteboard.schemas.d.ts +379 -379
  268. package/dist/services/whiteboard/whiteboard.schemas.d.ts.map +1 -1
  269. package/dist/services/whiteboard/whiteboard.schemas.js +71 -71
  270. package/dist/services/whiteboard/whiteboard.schemas.js.map +1 -1
  271. package/dist/services/zipper/zipper.js.map +1 -1
  272. package/dist/services/zipper/zipper.schemas.d.ts +1 -1
  273. package/dist/services/zipper/zipper.schemas.js +54 -54
  274. package/dist/services/zipper/zipper.schemas.js.map +1 -1
  275. package/dist/shared/account-scope.d.ts +6 -6
  276. package/dist/shared/account-scope.d.ts.map +1 -1
  277. package/dist/shared/account-scope.js +3 -3
  278. package/dist/shared/account-scope.js.map +1 -1
  279. package/dist/shared/connect-error-mapping.js +2 -2
  280. package/dist/shared/connect-error-mapping.js.map +1 -1
  281. package/dist/shared/rate-limit.schemas.d.ts +12 -12
  282. package/dist/shared/rate-limit.schemas.d.ts.map +1 -1
  283. package/dist/shared/rate-limit.schemas.js +7 -7
  284. package/dist/shared/rate-limit.schemas.js.map +1 -1
  285. package/dist/shared/schemas.js +26 -26
  286. package/dist/shared/schemas.js.map +1 -1
  287. package/dist/shared/validation.js +1 -6
  288. package/dist/shared/validation.js.map +1 -1
  289. package/dist/utils/connect-order-errors.js +2 -2
  290. package/dist/utils/connect-order-errors.js.map +1 -1
  291. package/dist/wired-services.d.ts.map +1 -1
  292. package/dist/wired-services.js +6 -0
  293. package/dist/wired-services.js.map +1 -1
  294. package/package.json +3 -3
  295. package/dist/shared/validation.d.ts +0 -14
  296. package/dist/shared/validation.d.ts.map +0 -1
@@ -1,28 +1,28 @@
1
- import { validation_exports } from "../../shared/validation.js";
2
1
  import { requiredEnumLabel } from "../../shared/proto-enum-codec.js";
3
2
  import { OptionalTimestampSecondsInputSchema } from "../../shared/schemas.js";
4
3
  import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
5
4
  import { HEATMAP_DEPTH_VALUES, HEATMAP_INTERVAL_VALUES, HEATMAP_QUANTITY_MODE_VALUES, HeatmapDepthCodec, HeatmapIntervalCodec, HeatmapQuantityModeCodec } from "./heatmap.codecs.js";
5
+ import * as v from "valibot";
6
6
  //#region src/services/heatmap/heatmap.schemas.ts
7
- const IntervalInputSchema = validation_exports.pipe(validation_exports.optional(validation_exports.picklist(HEATMAP_INTERVAL_VALUES), "1s"), validation_exports.transform((value) => HeatmapIntervalCodec.inputToProto[value]));
8
- const DepthInputSchema = validation_exports.pipe(validation_exports.optional(validation_exports.picklist(HEATMAP_DEPTH_VALUES), 50), validation_exports.transform((value) => HeatmapDepthCodec.inputToProto[value]));
9
- const QuantityModeInputSchema = validation_exports.pipe(validation_exports.optional(validation_exports.picklist(HEATMAP_QUANTITY_MODE_VALUES), "close"), validation_exports.transform((value) => HeatmapQuantityModeCodec.inputToProto[value]));
7
+ const IntervalInputSchema = v.pipe(v.optional(v.picklist(HEATMAP_INTERVAL_VALUES), "1s"), v.transform((value) => HeatmapIntervalCodec.inputToProto[value]));
8
+ const DepthInputSchema = v.pipe(v.optional(v.picklist(HEATMAP_DEPTH_VALUES), 50), v.transform((value) => HeatmapDepthCodec.inputToProto[value]));
9
+ const QuantityModeInputSchema = v.pipe(v.optional(v.picklist(HEATMAP_QUANTITY_MODE_VALUES), "close"), v.transform((value) => HeatmapQuantityModeCodec.inputToProto[value]));
10
10
  function timestampFromTsSec(tsSec) {
11
11
  return {
12
12
  seconds: tsSec,
13
13
  nanos: 0
14
14
  };
15
15
  }
16
- const GetOrderbookHeatmapInputSchema = validation_exports.pipe(validation_exports.object({
17
- symbolId: validation_exports.pipe(validation_exports.number(), validation_exports.integer(), validation_exports.gtValue(0)),
16
+ const GetOrderbookHeatmapInputSchema = v.pipe(v.object({
17
+ symbolId: v.pipe(v.number(), v.integer(), v.gtValue(0)),
18
18
  interval: IntervalInputSchema,
19
19
  depth: DepthInputSchema,
20
20
  quantityMode: QuantityModeInputSchema,
21
- limit: validation_exports.pipe(validation_exports.number(), validation_exports.integer(), validation_exports.gtValue(0), validation_exports.maxValue(2e4)),
21
+ limit: v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(2e4)),
22
22
  startTsSec: OptionalTimestampSecondsInputSchema,
23
23
  endTsSec: OptionalTimestampSecondsInputSchema,
24
- pageToken: validation_exports.optional(validation_exports.pipe(validation_exports.string(), validation_exports.trim()), "")
25
- }), validation_exports.check((value) => value.pageToken !== "" || value.startTsSec != null || value.endTsSec != null, "pageToken, startTsSec, or endTsSec is required"), validation_exports.transform((value) => {
24
+ pageToken: v.optional(v.pipe(v.string(), v.trim()), "")
25
+ }), v.check((value) => value.pageToken !== "" || value.startTsSec != null || value.endTsSec != null, "pageToken, startTsSec, or endTsSec is required"), v.transform((value) => {
26
26
  const timeRange = value.pageToken !== "" ? void 0 : {
27
27
  startTime: value.startTsSec != null ? timestampFromTsSec(value.startTsSec) : void 0,
28
28
  endTime: value.endTsSec != null ? timestampFromTsSec(value.endTsSec) : void 0
@@ -43,11 +43,11 @@ function requiredIntervalLabelFor(value) {
43
43
  function requiredQuantityModeLabelFor(value) {
44
44
  return requiredEnumLabel(HeatmapQuantityModeCodec.protoToOutput, value, "OrderbookHeatmapResponseSchema", "quantity mode");
45
45
  }
46
- const TimestampSecondsSchema = validation_exports.pipe(validation_exports.bigint(), validation_exports.transform((value) => Number(value)));
47
- const Uint64StringSchema = validation_exports.pipe(validation_exports.bigint(), validation_exports.transform((value) => value.toString()));
48
- const OrderbookHeatmapLevelsRawSchema = validation_exports.object({
49
- priceTicks: validation_exports.array(validation_exports.bigint()),
50
- qtyScaled: validation_exports.array(validation_exports.bigint())
46
+ const TimestampSecondsSchema = v.pipe(v.bigint(), v.transform((value) => Number(value)));
47
+ const Uint64StringSchema = v.pipe(v.bigint(), v.transform((value) => value.toString()));
48
+ const OrderbookHeatmapLevelsRawSchema = v.object({
49
+ priceTicks: v.array(v.bigint()),
50
+ qtyScaled: v.array(v.bigint())
51
51
  });
52
52
  function convertHeatmapLevels(levels, priceScale, qtyScale) {
53
53
  return {
@@ -55,13 +55,13 @@ function convertHeatmapLevels(levels, priceScale, qtyScale) {
55
55
  qty: levels.qtyScaled.map((qty) => scaledToDecimalOutput(qty, qtyScale))
56
56
  };
57
57
  }
58
- const OrderbookHeatmapKeyframeRawSchema = validation_exports.object({
58
+ const OrderbookHeatmapKeyframeRawSchema = v.object({
59
59
  tsSec: TimestampSecondsSchema,
60
- bestBidTicks: validation_exports.bigint(),
61
- bestAskTicks: validation_exports.bigint(),
62
- midTicks: validation_exports.bigint(),
63
- bids: validation_exports.optional(OrderbookHeatmapLevelsRawSchema),
64
- asks: validation_exports.optional(OrderbookHeatmapLevelsRawSchema),
60
+ bestBidTicks: v.bigint(),
61
+ bestAskTicks: v.bigint(),
62
+ midTicks: v.bigint(),
63
+ bids: v.optional(OrderbookHeatmapLevelsRawSchema),
64
+ asks: v.optional(OrderbookHeatmapLevelsRawSchema),
65
65
  bookSeq: Uint64StringSchema
66
66
  });
67
67
  function convertHeatmapKeyframe(keyframe, priceScale, qtyScale) {
@@ -75,11 +75,11 @@ function convertHeatmapKeyframe(keyframe, priceScale, qtyScale) {
75
75
  bookSeq: keyframe.bookSeq
76
76
  };
77
77
  }
78
- const OrderbookHeatmapDeltaBucketRawSchema = validation_exports.object({
78
+ const OrderbookHeatmapDeltaBucketRawSchema = v.object({
79
79
  tsSec: TimestampSecondsSchema,
80
- bids: validation_exports.optional(OrderbookHeatmapLevelsRawSchema),
81
- asks: validation_exports.optional(OrderbookHeatmapLevelsRawSchema),
82
- updatesInBucket: validation_exports.number(),
80
+ bids: v.optional(OrderbookHeatmapLevelsRawSchema),
81
+ asks: v.optional(OrderbookHeatmapLevelsRawSchema),
82
+ updatesInBucket: v.number(),
83
83
  bookSeqStart: Uint64StringSchema,
84
84
  bookSeqEnd: Uint64StringSchema
85
85
  });
@@ -93,18 +93,18 @@ function convertHeatmapDeltaBucket(bucket, priceScale, qtyScale) {
93
93
  bookSeqEnd: bucket.bookSeqEnd
94
94
  };
95
95
  }
96
- const OrderbookHeatmapLiveBucketRawSchema = validation_exports.object({
97
- symbolId: validation_exports.number(),
98
- interval: validation_exports.pipe(validation_exports.number(), validation_exports.transform(requiredIntervalLabelFor)),
96
+ const OrderbookHeatmapLiveBucketRawSchema = v.object({
97
+ symbolId: v.number(),
98
+ interval: v.pipe(v.number(), v.transform(requiredIntervalLabelFor)),
99
99
  tsSec: TimestampSecondsSchema,
100
- isFinal: validation_exports.boolean(),
101
- bids: validation_exports.optional(OrderbookHeatmapLevelsRawSchema),
102
- asks: validation_exports.optional(OrderbookHeatmapLevelsRawSchema),
103
- updatesInBucket: validation_exports.number(),
100
+ isFinal: v.boolean(),
101
+ bids: v.optional(OrderbookHeatmapLevelsRawSchema),
102
+ asks: v.optional(OrderbookHeatmapLevelsRawSchema),
103
+ updatesInBucket: v.number(),
104
104
  bookSeqStart: Uint64StringSchema,
105
105
  bookSeqEnd: Uint64StringSchema,
106
- quantityMode: validation_exports.pipe(validation_exports.number(), validation_exports.transform(requiredQuantityModeLabelFor)),
107
- effectiveBinTicks: validation_exports.bigint()
106
+ quantityMode: v.pipe(v.number(), v.transform(requiredQuantityModeLabelFor)),
107
+ effectiveBinTicks: v.bigint()
108
108
  });
109
109
  function convertHeatmapLiveBucket(bucket, scales) {
110
110
  const priceScale = scales.price();
@@ -124,11 +124,11 @@ function convertHeatmapLiveBucket(bucket, scales) {
124
124
  };
125
125
  }
126
126
  function createOrderbookHeatmapLiveBucketSchema(scales) {
127
- return validation_exports.pipe(OrderbookHeatmapLiveBucketRawSchema, validation_exports.transform((bucket) => convertHeatmapLiveBucket(bucket, scales)));
127
+ return v.pipe(OrderbookHeatmapLiveBucketRawSchema, v.transform((bucket) => convertHeatmapLiveBucket(bucket, scales)));
128
128
  }
129
- const OrderbookHeatmapDeltaChainRawSchema = validation_exports.object({
130
- baseKeyframe: validation_exports.optional(OrderbookHeatmapKeyframeRawSchema),
131
- deltas: validation_exports.optional(validation_exports.array(OrderbookHeatmapDeltaBucketRawSchema), [])
129
+ const OrderbookHeatmapDeltaChainRawSchema = v.object({
130
+ baseKeyframe: v.optional(OrderbookHeatmapKeyframeRawSchema),
131
+ deltas: v.optional(v.array(OrderbookHeatmapDeltaBucketRawSchema), [])
132
132
  });
133
133
  function convertHeatmapDeltaChain(chain, priceScale, qtyScale) {
134
134
  return {
@@ -136,21 +136,21 @@ function convertHeatmapDeltaChain(chain, priceScale, qtyScale) {
136
136
  deltas: chain.deltas.map((bucket) => convertHeatmapDeltaBucket(bucket, priceScale, qtyScale))
137
137
  };
138
138
  }
139
- const OrderbookHeatmapResponseRawSchema = validation_exports.object({
140
- symbolId: validation_exports.number(),
141
- interval: validation_exports.pipe(validation_exports.number(), validation_exports.transform(requiredIntervalLabelFor)),
142
- depth: validation_exports.pipe(validation_exports.number(), validation_exports.transform((value) => requiredEnumLabel(HeatmapDepthCodec.protoToOutput, value, "OrderbookHeatmapResponseSchema", "depth"))),
143
- chain: validation_exports.optional(OrderbookHeatmapDeltaChainRawSchema),
139
+ const OrderbookHeatmapResponseRawSchema = v.object({
140
+ symbolId: v.number(),
141
+ interval: v.pipe(v.number(), v.transform(requiredIntervalLabelFor)),
142
+ depth: v.pipe(v.number(), v.transform((value) => requiredEnumLabel(HeatmapDepthCodec.protoToOutput, value, "OrderbookHeatmapResponseSchema", "depth"))),
143
+ chain: v.optional(OrderbookHeatmapDeltaChainRawSchema),
144
144
  lastPersistedTsSec: TimestampSecondsSchema,
145
145
  liveFromBookSeqEnd: Uint64StringSchema,
146
- hasLiveAnchor: validation_exports.boolean(),
147
- nextPageToken: validation_exports.optional(validation_exports.string(), ""),
146
+ hasLiveAnchor: v.boolean(),
147
+ nextPageToken: v.optional(v.string(), ""),
148
148
  serverTimeSec: TimestampSecondsSchema,
149
- quantityMode: validation_exports.pipe(validation_exports.number(), validation_exports.transform(requiredQuantityModeLabelFor)),
150
- liveBucket: validation_exports.optional(OrderbookHeatmapLiveBucketRawSchema)
149
+ quantityMode: v.pipe(v.number(), v.transform(requiredQuantityModeLabelFor)),
150
+ liveBucket: v.optional(OrderbookHeatmapLiveBucketRawSchema)
151
151
  });
152
152
  function createOrderbookHeatmapResponseSchema(scales) {
153
- return validation_exports.pipe(OrderbookHeatmapResponseRawSchema, validation_exports.transform((res) => {
153
+ return v.pipe(OrderbookHeatmapResponseRawSchema, v.transform((res) => {
154
154
  const priceScale = scales.price();
155
155
  const qtyScale = scales.baseQty(res.symbolId);
156
156
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"heatmap.schemas.js","names":["v"],"sources":["../../../src/services/heatmap/heatmap.schemas.ts"],"sourcesContent":["import * as v from \"../../shared/validation.js\";\nimport type {\n HeatmapDepth,\n HeatmapInterval,\n HeatmapQuantityMode,\n} from \"../../gen/marketdata/v1/heatmap_pb.js\";\nimport { OptionalTimestampSecondsInputSchema } from \"../../shared/schemas.js\";\nimport { requiredEnumLabel } 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: v.pipe(v.number(), v.integer(), v.gtValue(0)),\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 requiredIntervalLabelFor(value: number): DecodedEnum<HeatmapIntervalValue> {\n return requiredEnumLabel(\n HeatmapIntervalCodec.protoToOutput,\n value,\n \"OrderbookHeatmapResponseSchema\",\n \"interval\",\n );\n}\n\nfunction requiredQuantityModeLabelFor(value: number): DecodedEnum<HeatmapQuantityModeValue> {\n return requiredEnumLabel(\n HeatmapQuantityModeCodec.protoToOutput,\n value,\n \"OrderbookHeatmapResponseSchema\",\n \"quantity mode\",\n );\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(requiredIntervalLabelFor)),\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(requiredQuantityModeLabelFor)),\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(requiredIntervalLabelFor)),\n depth: v.pipe(\n v.number(),\n v.transform((value) =>\n requiredEnumLabel(\n HeatmapDepthCodec.protoToOutput,\n value,\n \"OrderbookHeatmapResponseSchema\",\n \"depth\",\n ),\n ),\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(requiredQuantityModeLabelFor)),\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 = HeatmapTimeRangeIn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mCAAmC;AAC9D,CAAC;AAED,SAAgB,qCAAqC,QAAmB;CACpE,OAAOA,mBAAE,KACL,mCACAA,mBAAE,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 type {\n HeatmapDepth,\n HeatmapInterval,\n HeatmapQuantityMode,\n} from \"../../gen/marketdata/v1/heatmap_pb.js\";\nimport { OptionalTimestampSecondsInputSchema } from \"../../shared/schemas.js\";\nimport { requiredEnumLabel } 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: v.pipe(v.number(), v.integer(), v.gtValue(0)),\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 requiredIntervalLabelFor(value: number): DecodedEnum<HeatmapIntervalValue> {\n return requiredEnumLabel(\n HeatmapIntervalCodec.protoToOutput,\n value,\n \"OrderbookHeatmapResponseSchema\",\n \"interval\",\n );\n}\n\nfunction requiredQuantityModeLabelFor(value: number): DecodedEnum<HeatmapQuantityModeValue> {\n return requiredEnumLabel(\n HeatmapQuantityModeCodec.protoToOutput,\n value,\n \"OrderbookHeatmapResponseSchema\",\n \"quantity mode\",\n );\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(requiredIntervalLabelFor)),\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(requiredQuantityModeLabelFor)),\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(requiredIntervalLabelFor)),\n depth: v.pipe(\n v.number(),\n v.transform((value) =>\n requiredEnumLabel(\n HeatmapDepthCodec.protoToOutput,\n value,\n \"OrderbookHeatmapResponseSchema\",\n \"depth\",\n ),\n ),\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(requiredQuantityModeLabelFor)),\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":";;;;;;AA4BA,MAAM,sBAAsB,EAAE,KAC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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 +1 @@
1
- {"version":3,"file":"internal-transfers.js","names":["#client","Proto.InternalTransferService","#resolver","#scales","#inputSchema","#resultSchema","v.parse"],"sources":["../../../src/services/internal-transfers/internal-transfers.ts"],"sourcesContent":["import { createClient, type Client, type Transport } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n} from \"../../shared/request-options.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport * as v from \"../../shared/validation.js\";\nimport {\n createCreateInternalTransferInputSchema,\n createCreateInternalTransferResultSchema,\n type CreateInternalTransferInput,\n type CreateInternalTransferResult,\n} from \"./internal-transfers.schemas.js\";\n\n/**\n * Creates authenticated Trading-to-Trading internal transfer requests.\n */\nexport class InternalTransfersService {\n #client: Client<typeof Proto.InternalTransferService>;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #inputSchema: ReturnType<typeof createCreateInternalTransferInputSchema>;\n #resultSchema: ReturnType<typeof createCreateInternalTransferResultSchema>;\n\n constructor(transport: Transport, resolver: SubaccountResolver | undefined, scales: SdkScales) {\n this.#client = createClient(Proto.InternalTransferService, transport);\n this.#resolver = resolver;\n this.#scales = scales;\n this.#inputSchema = createCreateInternalTransferInputSchema(scales);\n this.#resultSchema = createCreateInternalTransferResultSchema();\n }\n\n /**\n * Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, resolved destination, and status.\n */\n async create(\n input: CreateInternalTransferInput,\n options?: PolyesterMutationOptions,\n ): Promise<CreateInternalTransferResult> {\n await this.#scales.ready();\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = v.parse(this.#inputSchema, resolvedInput);\n const res = await this.#client.createInternalTransfer(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return v.parse(this.#resultSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;;;AAoBA,IAAa,2BAAb,MAAsC;CAClC;CACA;CACA;CACA;CACA;CAEA,YAAY,WAAsB,UAA0C,QAAmB;EAC3F,KAAKA,UAAU,aAAaC,yBAA+B,SAAS;EACpE,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,eAAe,wCAAwC,MAAM;EAClE,KAAKC,gBAAgB,yCAAyC;CAClE;;;;CAKA,MAAM,OACF,OACA,SACqC;EACrC,MAAM,KAAKF,QAAQ,MAAM;EACzB,MAAM,gBAAgB,0BAA0B,OAAO,KAAKD,SAAS;EACrE,MAAM,iBAAiBI,MAAQ,KAAKF,cAAc,aAAa;EAC/D,MAAM,MAAM,MAAM,KAAKJ,QAAQ,uBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAOM,MAAQ,KAAKD,eAAe,GAAG;CAC1C;AACJ"}
1
+ {"version":3,"file":"internal-transfers.js","names":["#client","Proto.InternalTransferService","#resolver","#scales","#inputSchema","#resultSchema"],"sources":["../../../src/services/internal-transfers/internal-transfers.ts"],"sourcesContent":["import { createClient, type Client, type Transport } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n} from \"../../shared/request-options.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n createCreateInternalTransferInputSchema,\n createCreateInternalTransferResultSchema,\n type CreateInternalTransferInput,\n type CreateInternalTransferResult,\n} from \"./internal-transfers.schemas.js\";\n\n/**\n * Creates authenticated Trading-to-Trading internal transfer requests.\n */\nexport class InternalTransfersService {\n #client: Client<typeof Proto.InternalTransferService>;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #inputSchema: ReturnType<typeof createCreateInternalTransferInputSchema>;\n #resultSchema: ReturnType<typeof createCreateInternalTransferResultSchema>;\n\n constructor(transport: Transport, resolver: SubaccountResolver | undefined, scales: SdkScales) {\n this.#client = createClient(Proto.InternalTransferService, transport);\n this.#resolver = resolver;\n this.#scales = scales;\n this.#inputSchema = createCreateInternalTransferInputSchema(scales);\n this.#resultSchema = createCreateInternalTransferResultSchema();\n }\n\n /**\n * Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, resolved destination, and status.\n */\n async create(\n input: CreateInternalTransferInput,\n options?: PolyesterMutationOptions,\n ): Promise<CreateInternalTransferResult> {\n await this.#scales.ready();\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(this.#inputSchema, resolvedInput);\n const res = await this.#client.createInternalTransfer(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return parse(this.#resultSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;;;AAoBA,IAAa,2BAAb,MAAsC;CAClC;CACA;CACA;CACA;CACA;CAEA,YAAY,WAAsB,UAA0C,QAAmB;EAC3F,KAAKA,UAAU,aAAaC,yBAA+B,SAAS;EACpE,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,eAAe,wCAAwC,MAAM;EAClE,KAAKC,gBAAgB,yCAAyC;CAClE;;;;CAKA,MAAM,OACF,OACA,SACqC;EACrC,MAAM,KAAKF,QAAQ,MAAM;EACzB,MAAM,gBAAgB,0BAA0B,OAAO,KAAKD,SAAS;EACrE,MAAM,iBAAiB,MAAM,KAAKE,cAAc,aAAa;EAC7D,MAAM,MAAM,MAAM,KAAKJ,QAAQ,uBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,KAAKK,eAAe,GAAG;CACxC;AACJ"}
@@ -1,17 +1,17 @@
1
- import { validation_d_exports } from "../../shared/validation.js";
2
1
  import { SdkScales } from "../../shared/decimal-surface.js";
3
2
  import { U128Value } from "../../utils/u128.js";
3
+ import * as v from "valibot";
4
4
  //#region src/services/internal-transfers/internal-transfers.schemas.d.ts
5
- declare const InternalTransferDestinationInputSchema: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.VariantSchema<"type", [validation_d_exports.StrictObjectSchema<{
6
- readonly type: validation_d_exports.LiteralSchema<"account", undefined>;
7
- readonly accountId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>, validation_d_exports.TransformAction<string, bigint>]>;
8
- }, undefined>, validation_d_exports.StrictObjectSchema<{
9
- readonly type: validation_d_exports.LiteralSchema<"subaccount", undefined>;
10
- readonly subaccountId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>, validation_d_exports.TransformAction<string, bigint>]>;
11
- }, undefined>, validation_d_exports.StrictObjectSchema<{
12
- readonly type: validation_d_exports.LiteralSchema<"smartAccountAddress", undefined>;
13
- readonly address: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>]>;
14
- }, undefined>], undefined>, validation_d_exports.TransformAction<{
5
+ declare const InternalTransferDestinationInputSchema: v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.StrictObjectSchema<{
6
+ readonly type: v.LiteralSchema<"account", undefined>;
7
+ readonly accountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
8
+ }, undefined>, v.StrictObjectSchema<{
9
+ readonly type: v.LiteralSchema<"subaccount", undefined>;
10
+ readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
11
+ }, undefined>, v.StrictObjectSchema<{
12
+ readonly type: v.LiteralSchema<"smartAccountAddress", undefined>;
13
+ readonly address: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
14
+ }, undefined>], undefined>, v.TransformAction<{
15
15
  type: "account";
16
16
  accountId: bigint;
17
17
  } | {
@@ -30,18 +30,18 @@ declare const InternalTransferDestinationInputSchema: validation_d_exports.Schem
30
30
  readonly case: "destinationSmartAccountAddress";
31
31
  readonly value: string;
32
32
  }>]>;
33
- type InternalTransferDestination = validation_d_exports.InferInput<typeof InternalTransferDestinationInputSchema>;
34
- declare function createCreateInternalTransferInputSchema(scales: SdkScales): validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StrictObjectSchema<{
35
- readonly destination: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.VariantSchema<"type", [validation_d_exports.StrictObjectSchema<{
36
- readonly type: validation_d_exports.LiteralSchema<"account", undefined>;
37
- readonly accountId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>, validation_d_exports.TransformAction<string, bigint>]>;
38
- }, undefined>, validation_d_exports.StrictObjectSchema<{
39
- readonly type: validation_d_exports.LiteralSchema<"subaccount", undefined>;
40
- readonly subaccountId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>, validation_d_exports.TransformAction<string, bigint>]>;
41
- }, undefined>, validation_d_exports.StrictObjectSchema<{
42
- readonly type: validation_d_exports.LiteralSchema<"smartAccountAddress", undefined>;
43
- readonly address: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>]>;
44
- }, undefined>], undefined>, validation_d_exports.TransformAction<{
33
+ type InternalTransferDestination = v.InferInput<typeof InternalTransferDestinationInputSchema>;
34
+ declare function createCreateInternalTransferInputSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
35
+ readonly destination: v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.StrictObjectSchema<{
36
+ readonly type: v.LiteralSchema<"account", undefined>;
37
+ readonly accountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
38
+ }, undefined>, v.StrictObjectSchema<{
39
+ readonly type: v.LiteralSchema<"subaccount", undefined>;
40
+ readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
41
+ }, undefined>, v.StrictObjectSchema<{
42
+ readonly type: v.LiteralSchema<"smartAccountAddress", undefined>;
43
+ readonly address: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
44
+ }, undefined>], undefined>, v.TransformAction<{
45
45
  type: "account";
46
46
  accountId: bigint;
47
47
  } | {
@@ -60,13 +60,13 @@ declare function createCreateInternalTransferInputSchema(scales: SdkScales): val
60
60
  readonly case: "destinationSmartAccountAddress";
61
61
  readonly value: string;
62
62
  }>]>;
63
- readonly assetId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.NumberSchema<undefined>, validation_d_exports.IntegerAction<number, undefined>, validation_d_exports.GtValueAction<number, 0, undefined>]>;
64
- readonly quantity: validation_d_exports.StringSchema<undefined>;
65
- readonly idempotencyKey: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>]>;
66
- readonly account: validation_d_exports.OptionalSchema<validation_d_exports.UnionSchema<[validation_d_exports.PicklistSchema<["active", "main"], undefined>, validation_d_exports.StrictObjectSchema<{
67
- readonly subaccountId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>]>;
63
+ readonly assetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>]>;
64
+ readonly quantity: v.StringSchema<undefined>;
65
+ readonly idempotencyKey: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
66
+ readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
67
+ readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
68
68
  }, undefined>], undefined>, undefined>;
69
- }, undefined>, validation_d_exports.TransformAction<{
69
+ }, undefined>, v.TransformAction<{
70
70
  destination: {
71
71
  readonly case: "destinationAccountId";
72
72
  readonly value: bigint;
@@ -99,12 +99,12 @@ declare function createCreateInternalTransferInputSchema(scales: SdkScales): val
99
99
  assetId: number;
100
100
  idempotencyKey: string;
101
101
  }>]>;
102
- type CreateInternalTransferInput = validation_d_exports.InferInput<ReturnType<typeof createCreateInternalTransferInputSchema>>;
103
- declare const ResolvedInternalTransferDestinationSchema: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.ObjectSchema<{
104
- readonly rootAccountPublicId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.OptionalSchema<validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction]>, undefined>, validation_d_exports.TransformAction<string | undefined, string | undefined>]>;
105
- readonly subaccountPublicId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.OptionalSchema<validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction]>, undefined>, validation_d_exports.TransformAction<string | undefined, string | undefined>]>;
106
- readonly smartAccountAddress: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.OptionalSchema<validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction]>, undefined>, validation_d_exports.TransformAction<string | undefined, string | undefined>]>;
107
- }, undefined>, validation_d_exports.TransformAction<{
102
+ type CreateInternalTransferInput = v.InferInput<ReturnType<typeof createCreateInternalTransferInputSchema>>;
103
+ declare const ResolvedInternalTransferDestinationSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
104
+ readonly rootAccountPublicId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, string | undefined>]>;
105
+ readonly subaccountPublicId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, string | undefined>]>;
106
+ readonly smartAccountAddress: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, string | undefined>]>;
107
+ }, undefined>, v.TransformAction<{
108
108
  rootAccountPublicId?: string | undefined;
109
109
  subaccountPublicId?: string | undefined;
110
110
  smartAccountAddress?: string | undefined;
@@ -113,23 +113,23 @@ declare const ResolvedInternalTransferDestinationSchema: validation_d_exports.Sc
113
113
  subaccountId: string | undefined;
114
114
  smartAccountAddress: string | undefined;
115
115
  }>]>;
116
- type ResolvedInternalTransferDestination = validation_d_exports.InferOutput<typeof ResolvedInternalTransferDestinationSchema>;
117
- declare function createCreateInternalTransferResultSchema(): validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.ObjectSchema<{
118
- readonly requestId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>]>;
119
- readonly transferId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>]>;
120
- readonly acceptedAtTsNs: validation_d_exports.BigintSchema<undefined>;
121
- readonly assetId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.NumberSchema<undefined>, validation_d_exports.IntegerAction<number, undefined>, validation_d_exports.GtValueAction<number, 0, undefined>]>;
122
- readonly assetCode: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>]>;
123
- readonly uAssetId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction, validation_d_exports.MinLengthAction<string, 1, undefined>]>;
124
- readonly amountE18: validation_d_exports.ObjectSchema<{
125
- readonly hi: validation_d_exports.BigintSchema<undefined>;
126
- readonly lo: validation_d_exports.BigintSchema<undefined>;
116
+ type ResolvedInternalTransferDestination = v.InferOutput<typeof ResolvedInternalTransferDestinationSchema>;
117
+ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<readonly [v.ObjectSchema<{
118
+ readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
119
+ readonly transferId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
120
+ readonly acceptedAtTsNs: v.BigintSchema<undefined>;
121
+ readonly assetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>]>;
122
+ readonly assetCode: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
123
+ readonly uAssetId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
124
+ readonly amountE18: v.ObjectSchema<{
125
+ readonly hi: v.BigintSchema<undefined>;
126
+ readonly lo: v.BigintSchema<undefined>;
127
127
  }, undefined>;
128
- readonly destination: validation_d_exports.OptionalSchema<validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.ObjectSchema<{
129
- readonly rootAccountPublicId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.OptionalSchema<validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction]>, undefined>, validation_d_exports.TransformAction<string | undefined, string | undefined>]>;
130
- readonly subaccountPublicId: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.OptionalSchema<validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction]>, undefined>, validation_d_exports.TransformAction<string | undefined, string | undefined>]>;
131
- readonly smartAccountAddress: validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.OptionalSchema<validation_d_exports.SchemaWithPipe<readonly [validation_d_exports.StringSchema<undefined>, validation_d_exports.TrimAction]>, undefined>, validation_d_exports.TransformAction<string | undefined, string | undefined>]>;
132
- }, undefined>, validation_d_exports.TransformAction<{
128
+ readonly destination: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
129
+ readonly rootAccountPublicId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, string | undefined>]>;
130
+ readonly subaccountPublicId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, string | undefined>]>;
131
+ readonly smartAccountAddress: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, string | undefined>]>;
132
+ }, undefined>, v.TransformAction<{
133
133
  rootAccountPublicId?: string | undefined;
134
134
  subaccountPublicId?: string | undefined;
135
135
  smartAccountAddress?: string | undefined;
@@ -138,7 +138,7 @@ declare function createCreateInternalTransferResultSchema(): validation_d_export
138
138
  subaccountId: string | undefined;
139
139
  smartAccountAddress: string | undefined;
140
140
  }>]>, undefined>;
141
- }, undefined>, validation_d_exports.TransformAction<{
141
+ }, undefined>, v.TransformAction<{
142
142
  requestId: string;
143
143
  transferId: string;
144
144
  acceptedAtTsNs: bigint;
@@ -168,7 +168,7 @@ declare function createCreateInternalTransferResultSchema(): validation_d_export
168
168
  smartAccountAddress: string | undefined;
169
169
  } | undefined;
170
170
  }>]>;
171
- type CreateInternalTransferResult = validation_d_exports.InferOutput<ReturnType<typeof createCreateInternalTransferResultSchema>>;
171
+ type CreateInternalTransferResult = v.InferOutput<ReturnType<typeof createCreateInternalTransferResultSchema>>;
172
172
  //#endregion
173
173
  export { CreateInternalTransferInput, CreateInternalTransferResult, InternalTransferDestination, InternalTransferDestinationInputSchema, ResolvedInternalTransferDestination, ResolvedInternalTransferDestinationSchema, createCreateInternalTransferInputSchema, createCreateInternalTransferResultSchema };
174
174
  //# sourceMappingURL=internal-transfers.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal-transfers.schemas.d.ts","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.schemas.ts"],"mappings":";;;;cAyBa,wCAAsC,qBAAA,yBAAA,qBAAA,uBAAA,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoCvC,8BAA8B,qBAAE,kBACjC;iBAGK,wCAAwC,QAAQ,YAAS,qBAAA,yBAAA,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAAA;;;;;;;;;;;;;;;KA0B7D,8BAA8B,qBAAE,WACxC,kBAAkB;cAYT,2CAAyC,qBAAA,yBAAA,qBAAA;;;;;;;;;;;;;KAa1C,sCAAsC,qBAAE,mBACzC;iBAGK,4CAAwC,qBAAA,yBAAA,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoB5C,+BAA+B,qBAAE,YACzC,kBAAkB"}
1
+ {"version":3,"file":"internal-transfers.schemas.d.ts","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.schemas.ts"],"mappings":";;;;cAyBa,wCAAsC,EAAA,yBAAA,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoCvC,8BAA8B,EAAE,kBACjC;iBAGK,wCAAwC,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAAA;;;;;;;;;;;;;;;KA0B7D,8BAA8B,EAAE,WACxC,kBAAkB;cAYT,2CAAyC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;KAa1C,sCAAsC,EAAE,mBACzC;iBAGK,4CAAwC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoB5C,+BAA+B,EAAE,YACzC,kBAAkB"}
@@ -1,30 +1,30 @@
1
- import { validation_exports } from "../../shared/validation.js";
2
1
  import { tsNsToMs } from "../../utils/time.js";
3
2
  import { idInputSchema } from "../../shared/schemas.js";
4
3
  import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
5
4
  import { quantityInputToE18, scaledToDecimalOutput } from "../../shared/decimal-surface.js";
6
5
  import { fromU128, toU128 } from "../../utils/u128.js";
7
6
  import { InternalTransferDestinationCodec } from "./internal-transfers.codecs.js";
7
+ import * as v from "valibot";
8
8
  //#region src/services/internal-transfers/internal-transfers.schemas.ts
9
- const U128Schema = validation_exports.object({
10
- hi: validation_exports.bigint(),
11
- lo: validation_exports.bigint()
9
+ const U128Schema = v.object({
10
+ hi: v.bigint(),
11
+ lo: v.bigint()
12
12
  });
13
13
  const IdSchema = idInputSchema;
14
- const InternalTransferDestinationInputSchema = validation_exports.pipe(validation_exports.variant("type", [
15
- validation_exports.strictObject({
16
- type: validation_exports.literal("account"),
14
+ const InternalTransferDestinationInputSchema = v.pipe(v.variant("type", [
15
+ v.strictObject({
16
+ type: v.literal("account"),
17
17
  accountId: IdSchema("accountId")
18
18
  }),
19
- validation_exports.strictObject({
20
- type: validation_exports.literal("subaccount"),
19
+ v.strictObject({
20
+ type: v.literal("subaccount"),
21
21
  subaccountId: IdSchema("subaccountId")
22
22
  }),
23
- validation_exports.strictObject({
24
- type: validation_exports.literal("smartAccountAddress"),
25
- address: validation_exports.pipe(validation_exports.string(), validation_exports.trim(), validation_exports.minLength(1))
23
+ v.strictObject({
24
+ type: v.literal("smartAccountAddress"),
25
+ address: v.pipe(v.string(), v.trim(), v.minLength(1))
26
26
  })
27
- ]), validation_exports.transform((destination) => {
27
+ ]), v.transform((destination) => {
28
28
  switch (destination.type) {
29
29
  case "account": return {
30
30
  case: InternalTransferDestinationCodec.inputToProtoCase.account,
@@ -41,13 +41,13 @@ const InternalTransferDestinationInputSchema = validation_exports.pipe(validatio
41
41
  }
42
42
  }));
43
43
  function createCreateInternalTransferInputSchema(scales) {
44
- return validation_exports.pipe(validation_exports.strictObject({
44
+ return v.pipe(v.strictObject({
45
45
  ...AccountScopeInputEntries,
46
46
  destination: InternalTransferDestinationInputSchema,
47
- assetId: validation_exports.pipe(validation_exports.number(), validation_exports.integer(), validation_exports.gtValue(0)),
48
- quantity: validation_exports.string(),
49
- idempotencyKey: validation_exports.pipe(validation_exports.string(), validation_exports.trim(), validation_exports.minLength(1))
50
- }), validation_exports.transform(({ account, quantity, ...input }) => ({
47
+ assetId: v.pipe(v.number(), v.integer(), v.gtValue(0)),
48
+ quantity: v.string(),
49
+ idempotencyKey: v.pipe(v.string(), v.trim(), v.minLength(1))
50
+ }), v.transform(({ account, quantity, ...input }) => ({
51
51
  ...input,
52
52
  amountE18: toU128(quantityInputToE18({
53
53
  scales,
@@ -57,28 +57,28 @@ function createCreateInternalTransferInputSchema(scales) {
57
57
  subaccountId: accountScopeToSubaccountId(account)
58
58
  })));
59
59
  }
60
- const NonEmptyResponseStringSchema = validation_exports.pipe(validation_exports.string(), validation_exports.trim(), validation_exports.minLength(1));
61
- const OptionalResponseStringSchema = validation_exports.pipe(validation_exports.optional(validation_exports.pipe(validation_exports.string(), validation_exports.trim())), validation_exports.transform((value) => value ? value : void 0));
62
- const ResolvedInternalTransferDestinationSchema = validation_exports.pipe(validation_exports.object({
60
+ const NonEmptyResponseStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));
61
+ const OptionalResponseStringSchema = v.pipe(v.optional(v.pipe(v.string(), v.trim())), v.transform((value) => value ? value : void 0));
62
+ const ResolvedInternalTransferDestinationSchema = v.pipe(v.object({
63
63
  rootAccountPublicId: OptionalResponseStringSchema,
64
64
  subaccountPublicId: OptionalResponseStringSchema,
65
65
  smartAccountAddress: OptionalResponseStringSchema
66
- }), validation_exports.transform(({ rootAccountPublicId, subaccountPublicId, smartAccountAddress }) => ({
66
+ }), v.transform(({ rootAccountPublicId, subaccountPublicId, smartAccountAddress }) => ({
67
67
  rootAccountId: rootAccountPublicId,
68
68
  subaccountId: subaccountPublicId,
69
69
  smartAccountAddress
70
70
  })));
71
71
  function createCreateInternalTransferResultSchema() {
72
- return validation_exports.pipe(validation_exports.object({
72
+ return v.pipe(v.object({
73
73
  requestId: NonEmptyResponseStringSchema,
74
74
  transferId: NonEmptyResponseStringSchema,
75
- acceptedAtTsNs: validation_exports.bigint(),
76
- assetId: validation_exports.pipe(validation_exports.number(), validation_exports.integer(), validation_exports.gtValue(0)),
75
+ acceptedAtTsNs: v.bigint(),
76
+ assetId: v.pipe(v.number(), v.integer(), v.gtValue(0)),
77
77
  assetCode: NonEmptyResponseStringSchema,
78
78
  uAssetId: NonEmptyResponseStringSchema,
79
79
  amountE18: U128Schema,
80
- destination: validation_exports.optional(ResolvedInternalTransferDestinationSchema)
81
- }), validation_exports.transform(({ acceptedAtTsNs, amountE18, ...result }) => ({
80
+ destination: v.optional(ResolvedInternalTransferDestinationSchema)
81
+ }), v.transform(({ acceptedAtTsNs, amountE18, ...result }) => ({
82
82
  ...result,
83
83
  acceptedAtUnixMs: tsNsToMs(acceptedAtTsNs),
84
84
  quantity: scaledToDecimalOutput(fromU128(amountE18), 18)
@@ -1 +1 @@
1
- {"version":3,"file":"internal-transfers.schemas.js","names":["v"],"sources":["../../../src/services/internal-transfers/internal-transfers.schemas.ts"],"sourcesContent":["import type { MessageInitShape } from \"@bufbuild/protobuf\";\nimport * as v from \"../../shared/validation.js\";\nimport type * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport { idInputSchema } from \"../../shared/schemas.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport {\n E18_SCALE,\n quantityInputToE18,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport { InternalTransferDestinationCodec } from \"./internal-transfers.codecs.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\n\nconst U128Schema = v.object({\n hi: v.bigint(),\n lo: v.bigint(),\n});\n\nconst IdSchema = idInputSchema;\n\nexport const InternalTransferDestinationInputSchema = v.pipe(\n v.variant(\"type\", [\n v.strictObject({\n type: v.literal(\"account\"),\n accountId: IdSchema(\"accountId\"),\n }),\n v.strictObject({\n type: v.literal(\"subaccount\"),\n subaccountId: IdSchema(\"subaccountId\"),\n }),\n v.strictObject({\n type: v.literal(\"smartAccountAddress\"),\n address: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n ]),\n v.transform((destination) => {\n switch (destination.type) {\n case \"account\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.account,\n value: destination.accountId,\n } as const;\n case \"subaccount\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.subaccount,\n value: destination.subaccountId,\n } as const;\n case \"smartAccountAddress\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.smartAccountAddress,\n value: destination.address,\n } as const;\n }\n }),\n);\n\nexport type InternalTransferDestination = v.InferInput<\n typeof InternalTransferDestinationInputSchema\n>;\n\nexport function createCreateInternalTransferInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n destination: InternalTransferDestinationInputSchema,\n assetId: v.pipe(v.number(), v.integer(), v.gtValue(0)),\n quantity: v.string(),\n idempotencyKey: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n v.transform(\n ({ account, quantity, ...input }) =>\n ({\n ...input,\n amountE18: toU128(\n quantityInputToE18({\n scales,\n assetId: input.assetId,\n quantity,\n }),\n ),\n subaccountId: accountScopeToSubaccountId(account),\n }) satisfies MessageInitShape<typeof Proto.CreateInternalTransferRequestSchema>,\n ),\n );\n}\n\nexport type CreateInternalTransferInput = v.InferInput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\nexport type CreateInternalTransferRequest = v.InferOutput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\n\nconst NonEmptyResponseStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\nconst OptionalResponseStringSchema = v.pipe(\n v.optional(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? value : undefined)),\n);\n\nexport const ResolvedInternalTransferDestinationSchema = v.pipe(\n v.object({\n rootAccountPublicId: OptionalResponseStringSchema,\n subaccountPublicId: OptionalResponseStringSchema,\n smartAccountAddress: OptionalResponseStringSchema,\n }),\n v.transform(({ rootAccountPublicId, subaccountPublicId, smartAccountAddress }) => ({\n rootAccountId: rootAccountPublicId,\n subaccountId: subaccountPublicId,\n smartAccountAddress,\n })),\n);\n\nexport type ResolvedInternalTransferDestination = v.InferOutput<\n typeof ResolvedInternalTransferDestinationSchema\n>;\n\nexport function createCreateInternalTransferResultSchema() {\n return v.pipe(\n v.object({\n requestId: NonEmptyResponseStringSchema,\n transferId: NonEmptyResponseStringSchema,\n acceptedAtTsNs: v.bigint(),\n assetId: v.pipe(v.number(), v.integer(), v.gtValue(0)),\n assetCode: NonEmptyResponseStringSchema,\n uAssetId: NonEmptyResponseStringSchema,\n amountE18: U128Schema,\n destination: v.optional(ResolvedInternalTransferDestinationSchema),\n }),\n v.transform(({ acceptedAtTsNs, amountE18, ...result }) => ({\n ...result,\n acceptedAtUnixMs: tsNsToMs(acceptedAtTsNs),\n quantity: scaledToDecimalOutput(fromU128(amountE18), E18_SCALE),\n })),\n );\n}\n\nexport type CreateInternalTransferResult = v.InferOutput<\n ReturnType<typeof createCreateInternalTransferResultSchema>\n>;\n"],"mappings":";;;;;;;;AAkBA,MAAM,aAAaA,mBAAE,OAAO;CACxB,IAAIA,mBAAE,OAAO;CACb,IAAIA,mBAAE,OAAO;AACjB,CAAC;AAED,MAAM,WAAW;AAEjB,MAAa,yCAAyCA,mBAAE,KACpDA,mBAAE,QAAQ,QAAQ;CACdA,mBAAE,aAAa;EACX,MAAMA,mBAAE,QAAQ,SAAS;EACzB,WAAW,SAAS,WAAW;CACnC,CAAC;CACDA,mBAAE,aAAa;EACX,MAAMA,mBAAE,QAAQ,YAAY;EAC5B,cAAc,SAAS,cAAc;CACzC,CAAC;CACDA,mBAAE,aAAa;EACX,MAAMA,mBAAE,QAAQ,qBAAqB;EACrC,SAASA,mBAAE,KAAKA,mBAAE,OAAO,GAAGA,mBAAE,KAAK,GAAGA,mBAAE,UAAU,CAAC,CAAC;CACxD,CAAC;AACL,CAAC,GACDA,mBAAE,W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ACJ,EAAE,CACN;AAMA,SAAgB,2CAA2C;CACvD,OAAOA,mBAAE,KACLA,mBAAE,OAAO;EACL,WAAW;EACX,YAAY;EACZ,gBAAgBA,mBAAE,OAAO;EACzB,SAASA,mBAAE,KAAKA,mBAAE,OAAO,GAAGA,mBAAE,QAAQ,GAAGA,mBAAE,QAAQ,CAAC,CAAC;EACrD,WAAW;EACX,UAAU;EACV,WAAW;EACX,aAAaA,mBAAE,SAAS,yCAAyC;CACrE,CAAC,GACDA,mBAAE,WAAW,EAAE,gBAAgB,WAAW,GAAG,cAAc;EACvD,GAAG;EACH,kBAAkB,SAAS,cAAc;EACzC,UAAU,sBAAsB,SAAS,SAAS,GAAA,EAAY;CAClE,EAAE,CACN;AACJ"}
1
+ {"version":3,"file":"internal-transfers.schemas.js","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.schemas.ts"],"sourcesContent":["import type { MessageInitShape } from \"@bufbuild/protobuf\";\nimport * as v from \"valibot\";\nimport type * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport { idInputSchema } from \"../../shared/schemas.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport {\n E18_SCALE,\n quantityInputToE18,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport { InternalTransferDestinationCodec } from \"./internal-transfers.codecs.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\n\nconst U128Schema = v.object({\n hi: v.bigint(),\n lo: v.bigint(),\n});\n\nconst IdSchema = idInputSchema;\n\nexport const InternalTransferDestinationInputSchema = v.pipe(\n v.variant(\"type\", [\n v.strictObject({\n type: v.literal(\"account\"),\n accountId: IdSchema(\"accountId\"),\n }),\n v.strictObject({\n type: v.literal(\"subaccount\"),\n subaccountId: IdSchema(\"subaccountId\"),\n }),\n v.strictObject({\n type: v.literal(\"smartAccountAddress\"),\n address: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n ]),\n v.transform((destination) => {\n switch (destination.type) {\n case \"account\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.account,\n value: destination.accountId,\n } as const;\n case \"subaccount\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.subaccount,\n value: destination.subaccountId,\n } as const;\n case \"smartAccountAddress\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.smartAccountAddress,\n value: destination.address,\n } as const;\n }\n }),\n);\n\nexport type InternalTransferDestination = v.InferInput<\n typeof InternalTransferDestinationInputSchema\n>;\n\nexport function createCreateInternalTransferInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n destination: InternalTransferDestinationInputSchema,\n assetId: v.pipe(v.number(), v.integer(), v.gtValue(0)),\n quantity: v.string(),\n idempotencyKey: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n v.transform(\n ({ account, quantity, ...input }) =>\n ({\n ...input,\n amountE18: toU128(\n quantityInputToE18({\n scales,\n assetId: input.assetId,\n quantity,\n }),\n ),\n subaccountId: accountScopeToSubaccountId(account),\n }) satisfies MessageInitShape<typeof Proto.CreateInternalTransferRequestSchema>,\n ),\n );\n}\n\nexport type CreateInternalTransferInput = v.InferInput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\nexport type CreateInternalTransferRequest = v.InferOutput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\n\nconst NonEmptyResponseStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\nconst OptionalResponseStringSchema = v.pipe(\n v.optional(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? value : undefined)),\n);\n\nexport const ResolvedInternalTransferDestinationSchema = v.pipe(\n v.object({\n rootAccountPublicId: OptionalResponseStringSchema,\n subaccountPublicId: OptionalResponseStringSchema,\n smartAccountAddress: OptionalResponseStringSchema,\n }),\n v.transform(({ rootAccountPublicId, subaccountPublicId, smartAccountAddress }) => ({\n rootAccountId: rootAccountPublicId,\n subaccountId: subaccountPublicId,\n smartAccountAddress,\n })),\n);\n\nexport type ResolvedInternalTransferDestination = v.InferOutput<\n typeof ResolvedInternalTransferDestinationSchema\n>;\n\nexport function createCreateInternalTransferResultSchema() {\n return v.pipe(\n v.object({\n requestId: NonEmptyResponseStringSchema,\n transferId: NonEmptyResponseStringSchema,\n acceptedAtTsNs: v.bigint(),\n assetId: v.pipe(v.number(), v.integer(), v.gtValue(0)),\n assetCode: NonEmptyResponseStringSchema,\n uAssetId: NonEmptyResponseStringSchema,\n amountE18: U128Schema,\n destination: v.optional(ResolvedInternalTransferDestinationSchema),\n }),\n v.transform(({ acceptedAtTsNs, amountE18, ...result }) => ({\n ...result,\n acceptedAtUnixMs: tsNsToMs(acceptedAtTsNs),\n quantity: scaledToDecimalOutput(fromU128(amountE18), E18_SCALE),\n })),\n );\n}\n\nexport type CreateInternalTransferResult = v.InferOutput<\n ReturnType<typeof createCreateInternalTransferResultSchema>\n>;\n"],"mappings":";;;;;;;;AAkBA,MAAM,aAAa,EAAE,OAAO;CACxB,IAAI,EAAE,OAAO;CACb,IAAI,EAAE,OAAO;AACjB,CAAC;AAED,MAAM,WAAW;AAEjB,MAAa,yCAAyC,EAAE,KACpD,EAAE,QAAQ,QAAQ;CACd,EAAE,aAAa;EACX,MAAM,EAAE,QAAQ,SAAS;EACzB,WAAW,SAAS,WAAW;CACnC,CAAC;CACD,EAAE,aAAa;EACX,MAAM,EAAE,QAAQ,YAAY;EAC5B,cAAc,SAAS,cAAc;CACzC,CAAC;CACD,EAAE,aAAa;EACX,MAAM,EAAE,QAAQ,qBAAqB;EACrC,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;CACxD,CAAC;AACL,CAAC,GACD,EAAE,WAAW,gBAAgB;CACzB,QAAQ,YAAY,MAApB;EACI,KAAK,WACD,OAAO;GACH,MAAM,iCAAiC,iBAAiB;GACxD,O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AO,GAAG,EAAE,QAAQ,GAAG,EAAE,QAAQ,CAAC,CAAC;EACrD,WAAW;EACX,UAAU;EACV,WAAW;EACX,aAAa,EAAE,SAAS,yCAAyC;CACrE,CAAC,GACD,EAAE,WAAW,EAAE,gBAAgB,WAAW,GAAG,cAAc;EACvD,GAAG;EACH,kBAAkB,SAAS,cAAc;EACzC,UAAU,sBAAsB,SAAS,SAAS,GAAA,EAAY;CAClE,EAAE,CACN;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.ts","names":[],"sources":["../../../src/services/lifecycle/lifecycle.ts"],"mappings":";;;;;;UAmCU,yCAAyC,mBAAmB;EAClE;;UAGM,0CAA0C,mBAAmB;EACnE;;;;;cAMS;;EAIG,YAAA,WAAW,WAAW,UAAU;;;;EAQtC,UACF,OAAO,yBACP,UAAU,0BACX,QAAQ;;;;EAUL,QACF,OAAO,uBACP,UAAU,0BACX,QAAQ;;;;EAYL,cACF,OAAO,6BACP,UAAU,0BACX,QAAQ;;;;EAYX,mBAAmB,OAAO;;;;EAqB1B,oBAAoB,OAAO"}
1
+ {"version":3,"file":"lifecycle.d.ts","names":[],"sources":["../../../src/services/lifecycle/lifecycle.ts"],"mappings":";;;;;;UAoCU,yCAAyC,mBAAmB;EAClE;;UAGM,0CAA0C,mBAAmB;EACnE;;;;;cAMS;;EAIG,YAAA,WAAW,WAAW,UAAU;;;;EAQtC,UACF,OAAO,yBACP,UAAU,0BACX,QAAQ;;;;EAUL,QACF,OAAO,uBACP,UAAU,0BACX,QAAQ;;;;EAYL,cACF,OAAO,6BACP,UAAU,0BACX,QAAQ;;;;EAYX,mBAAmB,OAAO;;;;EAqB1B,oBAAoB,OAAO"}