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

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 (345) hide show
  1. package/CHANGELOG.md +66 -8
  2. package/dist/catalogs/index.d.ts +2 -2
  3. package/dist/catalogs/snapshot-validation.js +10 -1
  4. package/dist/catalogs/snapshot-validation.js.map +1 -1
  5. package/dist/catalogs/zipper-catalog.d.ts +2 -0
  6. package/dist/catalogs/zipper-catalog.d.ts.map +1 -1
  7. package/dist/catalogs/zipper-catalog.js.map +1 -1
  8. package/dist/catalogs/zipper-supply.d.ts +2 -0
  9. package/dist/catalogs/zipper-supply.d.ts.map +1 -1
  10. package/dist/catalogs/zipper-supply.js +7 -5
  11. package/dist/catalogs/zipper-supply.js.map +1 -1
  12. package/dist/client.d.ts +2 -0
  13. package/dist/client.d.ts.map +1 -1
  14. package/dist/client.js +2 -0
  15. package/dist/client.js.map +1 -1
  16. package/dist/gen/ai/v1/assistant_pb.d.ts +679 -13
  17. package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
  18. package/dist/gen/ai/v1/assistant_pb.js +355 -97
  19. package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
  20. package/dist/gen/alerts/v1/price_alerts_pb.d.ts +33 -4
  21. package/dist/gen/alerts/v1/price_alerts_pb.d.ts.map +1 -1
  22. package/dist/gen/alerts/v1/price_alerts_pb.js +23 -2
  23. package/dist/gen/alerts/v1/price_alerts_pb.js.map +1 -1
  24. package/dist/gen/auth/v1/activity_pb.d.ts +148 -0
  25. package/dist/gen/auth/v1/activity_pb.d.ts.map +1 -0
  26. package/dist/gen/auth/v1/activity_pb.js +40 -0
  27. package/dist/gen/auth/v1/activity_pb.js.map +1 -0
  28. package/dist/gen/auth/v1/api_keys_pb.d.ts +10 -4
  29. package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
  30. package/dist/gen/auth/v1/api_keys_pb.js +3 -1
  31. package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
  32. package/dist/gen/auth/v1/auth_pb.d.ts +61 -5
  33. package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
  34. package/dist/gen/auth/v1/auth_pb.js +23 -6
  35. package/dist/gen/auth/v1/auth_pb.js.map +1 -1
  36. package/dist/gen/auth/v1/mfa_pb.d.ts +140 -2
  37. package/dist/gen/auth/v1/mfa_pb.d.ts.map +1 -1
  38. package/dist/gen/auth/v1/mfa_pb.js +80 -8
  39. package/dist/gen/auth/v1/mfa_pb.js.map +1 -1
  40. package/dist/gen/auth/v1/policies_pb.d.ts +18 -3
  41. package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
  42. package/dist/gen/auth/v1/policies_pb.js +18 -3
  43. package/dist/gen/auth/v1/policies_pb.js.map +1 -1
  44. package/dist/gen/auth/v1/social_verification_pb.d.ts +36 -15
  45. package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
  46. package/dist/gen/auth/v1/social_verification_pb.js +1 -1
  47. package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
  48. package/dist/gen/auth/v1/subaccounts_pb.d.ts +15 -1
  49. package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
  50. package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
  51. package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
  52. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +6 -2
  53. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -1
  54. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
  55. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +104 -6
  56. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
  57. package/dist/gen/chain/withdraw/v1/withdraw_pb.js +49 -3
  58. package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
  59. package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +76 -3
  60. package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
  61. package/dist/gen/chain/zipper/v1/zipper_pb.js +46 -2
  62. package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
  63. package/dist/gen/index.d.ts +3 -1
  64. package/dist/gen/index.js +4 -2
  65. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +21 -139
  66. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
  67. package/dist/gen/ledger/read/v1/ledger_read_pb.js +16 -17
  68. package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
  69. package/dist/gen/ledger/read/v1/statement_export_pb.d.ts +236 -20
  70. package/dist/gen/ledger/read/v1/statement_export_pb.d.ts.map +1 -1
  71. package/dist/gen/ledger/read/v1/statement_export_pb.js +44 -10
  72. package/dist/gen/ledger/read/v1/statement_export_pb.js.map +1 -1
  73. package/dist/gen/ledger/v1/catalog_pb.d.ts +9 -1
  74. package/dist/gen/ledger/v1/catalog_pb.d.ts.map +1 -1
  75. package/dist/gen/ledger/v1/catalog_pb.js +9 -1
  76. package/dist/gen/ledger/v1/catalog_pb.js.map +1 -1
  77. package/dist/gen/marketdata/v1/asset_info_pb.d.ts +158 -7
  78. package/dist/gen/marketdata/v1/asset_info_pb.d.ts.map +1 -1
  79. package/dist/gen/marketdata/v1/asset_info_pb.js +56 -6
  80. package/dist/gen/marketdata/v1/asset_info_pb.js.map +1 -1
  81. package/dist/gen/notifications/v1/notifications_pb.d.ts +45 -6
  82. package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -1
  83. package/dist/gen/notifications/v1/notifications_pb.js +23 -5
  84. package/dist/gen/notifications/v1/notifications_pb.js.map +1 -1
  85. package/dist/gen/orders/v1/orders_pb.d.ts +105 -29
  86. package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
  87. package/dist/gen/orders/v1/orders_pb.js +14 -2
  88. package/dist/gen/orders/v1/orders_pb.js.map +1 -1
  89. package/dist/gen/orders/v1/orders_read_pb.d.ts +50 -20
  90. package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
  91. package/dist/gen/orders/v1/orders_read_pb.js +1 -1
  92. package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
  93. package/dist/gen/polyester/api/options_pb.d.ts +11 -2
  94. package/dist/gen/polyester/api/options_pb.d.ts.map +1 -1
  95. package/dist/gen/polyester/api/options_pb.js +13 -3
  96. package/dist/gen/polyester/api/options_pb.js.map +1 -1
  97. package/dist/gen/privatews/v1/private_ws_pb.d.ts +13 -3
  98. package/dist/gen/privatews/v1/private_ws_pb.d.ts.map +1 -1
  99. package/dist/gen/privatews/v1/private_ws_pb.js.map +1 -1
  100. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +126 -10
  101. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
  102. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +14 -6
  103. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
  104. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts +665 -0
  105. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts.map +1 -0
  106. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js +216 -0
  107. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js.map +1 -0
  108. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +166 -52
  109. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
  110. package/dist/gen/swap/quickswap/v1/quickswap_pb.js +50 -12
  111. package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
  112. package/dist/gen/system/v1/system_pb.d.ts +49 -2
  113. package/dist/gen/system/v1/system_pb.d.ts.map +1 -1
  114. package/dist/gen/system/v1/system_pb.js +18 -6
  115. package/dist/gen/system/v1/system_pb.js.map +1 -1
  116. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +150 -71
  117. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
  118. package/dist/gen/transfer/v1/internal_transfer_pb.js +56 -34
  119. package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
  120. package/dist/gen/triggers/v1/triggers_pb.d.ts +117 -16
  121. package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
  122. package/dist/gen/triggers/v1/triggers_pb.js +45 -2
  123. package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
  124. package/dist/index.d.ts +13 -9
  125. package/dist/realtime/client.js +5 -1
  126. package/dist/realtime/client.js.map +1 -1
  127. package/dist/realtime/snapshot-then-stream.js +5 -3
  128. package/dist/realtime/snapshot-then-stream.js.map +1 -1
  129. package/dist/services/account-activity/account-activity.d.ts +22 -0
  130. package/dist/services/account-activity/account-activity.d.ts.map +1 -0
  131. package/dist/services/account-activity/account-activity.js +32 -0
  132. package/dist/services/account-activity/account-activity.js.map +1 -0
  133. package/dist/services/account-activity/account-activity.schemas.d.ts +78 -0
  134. package/dist/services/account-activity/account-activity.schemas.d.ts.map +1 -0
  135. package/dist/services/account-activity/account-activity.schemas.js +44 -0
  136. package/dist/services/account-activity/account-activity.schemas.js.map +1 -0
  137. package/dist/services/account-activity/account-activity.types.d.ts +2 -0
  138. package/dist/services/account-activity/service.d.ts +8 -0
  139. package/dist/services/account-activity/service.d.ts.map +1 -0
  140. package/dist/services/account-activity/service.js +9 -0
  141. package/dist/services/account-activity/service.js.map +1 -0
  142. package/dist/services/address-book/address-book.schemas.js +2 -2
  143. package/dist/services/api-keys/api-keys.schemas.js +2 -2
  144. package/dist/services/assistant/assistant-events.schemas.d.ts +81 -81
  145. package/dist/services/assistant/assistant.codecs.d.ts +7 -2
  146. package/dist/services/assistant/assistant.codecs.d.ts.map +1 -1
  147. package/dist/services/assistant/assistant.codecs.js +18 -2
  148. package/dist/services/assistant/assistant.codecs.js.map +1 -1
  149. package/dist/services/assistant/assistant.d.ts +29 -2
  150. package/dist/services/assistant/assistant.d.ts.map +1 -1
  151. package/dist/services/assistant/assistant.js +44 -2
  152. package/dist/services/assistant/assistant.js.map +1 -1
  153. package/dist/services/assistant/assistant.schemas.d.ts +111 -6
  154. package/dist/services/assistant/assistant.schemas.d.ts.map +1 -1
  155. package/dist/services/assistant/assistant.schemas.js +74 -6
  156. package/dist/services/assistant/assistant.schemas.js.map +1 -1
  157. package/dist/services/assistant/assistant.types.d.ts +3 -3
  158. package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts +3 -1
  159. package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts.map +1 -1
  160. package/dist/services/auto-withdraw/auto-withdraw.codecs.js.map +1 -1
  161. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +15 -13
  162. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts.map +1 -1
  163. package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -0
  164. package/dist/services/auto-withdraw/auto-withdraw.schemas.js.map +1 -1
  165. package/dist/services/balances/balances.d.ts +1 -13
  166. package/dist/services/balances/balances.d.ts.map +1 -1
  167. package/dist/services/balances/balances.js +1 -45
  168. package/dist/services/balances/balances.js.map +1 -1
  169. package/dist/services/balances/balances.schemas.d.ts +1 -67
  170. package/dist/services/balances/balances.schemas.d.ts.map +1 -1
  171. package/dist/services/balances/balances.schemas.js +1 -22
  172. package/dist/services/balances/balances.schemas.js.map +1 -1
  173. package/dist/services/balances/balances.types.d.ts +2 -2
  174. package/dist/services/candles/candles.schemas.d.ts +10 -10
  175. package/dist/services/changelog/changelog.schemas.d.ts +38 -38
  176. package/dist/services/checkpoints/checkpoints.schemas.d.ts +3 -3
  177. package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +11 -11
  178. package/dist/services/dust-conversion/dust-conversion.schemas.d.ts.map +1 -1
  179. package/dist/services/dust-conversion/dust-conversion.schemas.js +1 -1
  180. package/dist/services/dust-conversion/dust-conversion.schemas.js.map +1 -1
  181. package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
  182. package/dist/services/internal-transfers/internal-transfers.codecs.d.ts +11 -6
  183. package/dist/services/internal-transfers/internal-transfers.codecs.d.ts.map +1 -1
  184. package/dist/services/internal-transfers/internal-transfers.codecs.js +6 -6
  185. package/dist/services/internal-transfers/internal-transfers.codecs.js.map +1 -1
  186. package/dist/services/internal-transfers/internal-transfers.d.ts +17 -10
  187. package/dist/services/internal-transfers/internal-transfers.d.ts.map +1 -1
  188. package/dist/services/internal-transfers/internal-transfers.js +21 -10
  189. package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
  190. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +43 -31
  191. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
  192. package/dist/services/internal-transfers/internal-transfers.schemas.js +23 -12
  193. package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
  194. package/dist/services/internal-transfers/internal-transfers.types.d.ts +2 -2
  195. package/dist/services/lifecycle/lifecycle.d.ts +1 -1
  196. package/dist/services/lifecycle/lifecycle.js +2 -3
  197. package/dist/services/lifecycle/lifecycle.js.map +1 -1
  198. package/dist/services/lifecycle/lifecycle.schemas.d.ts +40 -40
  199. package/dist/services/market-data/market-data.codecs.d.ts +8 -0
  200. package/dist/services/market-data/market-data.codecs.d.ts.map +1 -0
  201. package/dist/services/market-data/market-data.codecs.js +7 -1
  202. package/dist/services/market-data/market-data.codecs.js.map +1 -1
  203. package/dist/services/market-data/market-data.d.ts +3 -2
  204. package/dist/services/market-data/market-data.d.ts.map +1 -1
  205. package/dist/services/market-data/market-data.js +3 -2
  206. package/dist/services/market-data/market-data.js.map +1 -1
  207. package/dist/services/market-data/market-data.schemas.d.ts +332 -4
  208. package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
  209. package/dist/services/market-data/market-data.schemas.js +56 -8
  210. package/dist/services/market-data/market-data.schemas.js.map +1 -1
  211. package/dist/services/market-data/market-data.types.d.ts +3 -2
  212. package/dist/services/notifications/notifications.codecs.d.ts +1 -1
  213. package/dist/services/notifications/notifications.codecs.d.ts.map +1 -1
  214. package/dist/services/notifications/notifications.codecs.js +2 -1
  215. package/dist/services/notifications/notifications.codecs.js.map +1 -1
  216. package/dist/services/notifications/notifications.d.ts +4 -2
  217. package/dist/services/notifications/notifications.d.ts.map +1 -1
  218. package/dist/services/notifications/notifications.js +4 -2
  219. package/dist/services/notifications/notifications.js.map +1 -1
  220. package/dist/services/notifications/notifications.schemas.d.ts +63 -7
  221. package/dist/services/notifications/notifications.schemas.d.ts.map +1 -1
  222. package/dist/services/notifications/notifications.schemas.js +5 -0
  223. package/dist/services/notifications/notifications.schemas.js.map +1 -1
  224. package/dist/services/orderbook/orderbook.js +3 -2
  225. package/dist/services/orderbook/orderbook.js.map +1 -1
  226. package/dist/services/orders/order-enums.codecs.d.ts +2 -0
  227. package/dist/services/orders/order-errors.schemas.d.ts +50 -5
  228. package/dist/services/orders/order-errors.schemas.d.ts.map +1 -1
  229. package/dist/services/orders/order-errors.schemas.js +13 -3
  230. package/dist/services/orders/order-errors.schemas.js.map +1 -1
  231. package/dist/services/orders/orders-batch.schemas.d.ts +310 -70
  232. package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
  233. package/dist/services/orders/orders-input.schemas.d.ts +58 -11
  234. package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
  235. package/dist/services/orders/orders-input.schemas.js +1 -1
  236. package/dist/services/orders/orders-output.schemas.d.ts +13 -13
  237. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
  238. package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +1 -1
  239. package/dist/services/policies/shared.codecs.js +12 -6
  240. package/dist/services/policies/shared.codecs.js.map +1 -1
  241. package/dist/services/policies/shared.d.ts +1 -1
  242. package/dist/services/policies/shared.js +1 -1
  243. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +9 -9
  244. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +4 -30
  245. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
  246. package/dist/services/price-alerts/price-alerts.d.ts +5 -2
  247. package/dist/services/price-alerts/price-alerts.d.ts.map +1 -1
  248. package/dist/services/price-alerts/price-alerts.js +5 -2
  249. package/dist/services/price-alerts/price-alerts.js.map +1 -1
  250. package/dist/services/price-alerts/price-alerts.schemas.js +1 -1
  251. package/dist/services/rewards/rewards.schemas.d.ts +4 -4
  252. package/dist/services/social-verification/social-verification.schemas.d.ts +9 -0
  253. package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
  254. package/dist/services/social-verification/social-verification.schemas.js +9 -2
  255. package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
  256. package/dist/services/statement-exports/statement-exports.codecs.d.ts +3 -2
  257. package/dist/services/statement-exports/statement-exports.codecs.d.ts.map +1 -1
  258. package/dist/services/statement-exports/statement-exports.codecs.js +2 -1
  259. package/dist/services/statement-exports/statement-exports.codecs.js.map +1 -1
  260. package/dist/services/statement-exports/statement-exports.d.ts +25 -10
  261. package/dist/services/statement-exports/statement-exports.d.ts.map +1 -1
  262. package/dist/services/statement-exports/statement-exports.js +33 -10
  263. package/dist/services/statement-exports/statement-exports.js.map +1 -1
  264. package/dist/services/statement-exports/statement-exports.schemas.d.ts +38 -10
  265. package/dist/services/statement-exports/statement-exports.schemas.d.ts.map +1 -1
  266. package/dist/services/statement-exports/statement-exports.schemas.js +25 -6
  267. package/dist/services/statement-exports/statement-exports.schemas.js.map +1 -1
  268. package/dist/services/statement-exports/statement-exports.types.d.ts +2 -2
  269. package/dist/services/subaccounts/subaccounts.codecs.js +112 -38
  270. package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
  271. package/dist/services/subaccounts/subaccounts.d.ts +2 -1
  272. package/dist/services/subaccounts/subaccounts.d.ts.map +1 -1
  273. package/dist/services/subaccounts/subaccounts.js +3 -3
  274. package/dist/services/subaccounts/subaccounts.js.map +1 -1
  275. package/dist/services/subaccounts/subaccounts.schemas.d.ts +12 -5
  276. package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
  277. package/dist/services/subaccounts/subaccounts.schemas.js +10 -3
  278. package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
  279. package/dist/services/system/system.d.ts +12 -1
  280. package/dist/services/system/system.d.ts.map +1 -1
  281. package/dist/services/system/system.js +5 -0
  282. package/dist/services/system/system.js.map +1 -1
  283. package/dist/services/system/system.schemas.d.ts +13 -13
  284. package/dist/services/system/system.types.d.ts +2 -2
  285. package/dist/services/trades/trades.schemas.d.ts +2 -2
  286. package/dist/services/trading-withdraws/trading-withdraws.codecs.d.ts +8 -0
  287. package/dist/services/trading-withdraws/trading-withdraws.codecs.d.ts.map +1 -0
  288. package/dist/services/trading-withdraws/trading-withdraws.codecs.js +7 -1
  289. package/dist/services/trading-withdraws/trading-withdraws.codecs.js.map +1 -1
  290. package/dist/services/trading-withdraws/trading-withdraws.d.ts +2 -1
  291. package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
  292. package/dist/services/trading-withdraws/trading-withdraws.js +2 -1
  293. package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
  294. package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +15 -0
  295. package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
  296. package/dist/services/trading-withdraws/trading-withdraws.schemas.js +16 -2
  297. package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
  298. package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +2 -1
  299. package/dist/services/transfers/transfers.schemas.d.ts +4 -4
  300. package/dist/services/triggers/trigger-child-order.schemas.js +1 -1
  301. package/dist/services/triggers/trigger-child-order.schemas.js.map +1 -1
  302. package/dist/services/triggers/trigger-input.schemas.d.ts +10 -10
  303. package/dist/services/triggers/triggers-output.schemas.d.ts +170 -52
  304. package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
  305. package/dist/services/triggers/triggers-output.schemas.js +13 -3
  306. package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
  307. package/dist/services/triggers/triggers.codecs.d.ts +10 -0
  308. package/dist/services/triggers/triggers.codecs.d.ts.map +1 -0
  309. package/dist/services/triggers/triggers.codecs.js +7 -1
  310. package/dist/services/triggers/triggers.codecs.js.map +1 -1
  311. package/dist/services/triggers/triggers.d.ts +2 -2
  312. package/dist/services/triggers/triggers.js +2 -2
  313. package/dist/services/triggers/triggers.js.map +1 -1
  314. package/dist/services/zipper/zipper.d.ts.map +1 -1
  315. package/dist/services/zipper/zipper.js +13 -7
  316. package/dist/services/zipper/zipper.js.map +1 -1
  317. package/dist/services/zipper/zipper.schemas.d.ts +7 -2
  318. package/dist/services/zipper/zipper.schemas.d.ts.map +1 -1
  319. package/dist/services/zipper/zipper.schemas.js +29 -9
  320. package/dist/services/zipper/zipper.schemas.js.map +1 -1
  321. package/dist/services/zipper/zipper.types.d.ts +2 -2
  322. package/dist/shared/catalog-config.d.ts +16 -2
  323. package/dist/shared/catalog-config.d.ts.map +1 -1
  324. package/dist/shared/catalog-config.js.map +1 -1
  325. package/dist/shared/connect-error-mapping.d.ts.map +1 -1
  326. package/dist/shared/connect-error-mapping.js +27 -4
  327. package/dist/shared/connect-error-mapping.js.map +1 -1
  328. package/dist/shared/error-detail.d.ts +10 -0
  329. package/dist/shared/error-detail.d.ts.map +1 -1
  330. package/dist/shared/error-detail.js.map +1 -1
  331. package/dist/shared/error-details/auth.js +6 -0
  332. package/dist/shared/error-details/auth.js.map +1 -1
  333. package/dist/shared/errors.d.ts +5 -1
  334. package/dist/shared/errors.d.ts.map +1 -1
  335. package/dist/shared/errors.js +3 -0
  336. package/dist/shared/errors.js.map +1 -1
  337. package/dist/shared/ledger-codes.d.ts +3 -1
  338. package/dist/shared/ledger-codes.d.ts.map +1 -1
  339. package/dist/shared/ledger-codes.js +6 -3
  340. package/dist/shared/ledger-codes.js.map +1 -1
  341. package/dist/shared/rate-limit.schemas.d.ts +1 -1
  342. package/dist/wired-services.d.ts.map +1 -1
  343. package/dist/wired-services.js +3 -1
  344. package/dist/wired-services.js.map +1 -1
  345. package/package.json +1 -1
@@ -6,7 +6,7 @@ import { PolyesterRealtime } from "../../realtime/types.js";
6
6
  import "../../realtime/index.js";
7
7
  import { BaseSubscribeInput } from "../../shared/types.js";
8
8
  import { SdkScales } from "../../shared/decimal-surface.js";
9
- import { BalanceHistoryInput, BalanceHistoryResponse, EquityHistoryInput, EquityHistoryResponse, ExportStatementInput, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySnapshotResponse, Statement, StatementPage } from "./balances.schemas.js";
9
+ import { BalanceHistoryInput, BalanceHistoryResponse, EquityHistoryInput, EquityHistoryResponse, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySnapshotResponse } from "./balances.schemas.js";
10
10
  //#region src/services/balances/balances.d.ts
11
11
  interface SubscribeBalancesInput extends BaseSubscribeInput<LedgerBalance> {
12
12
  accountId: string;
@@ -37,18 +37,6 @@ declare class BalancesService {
37
37
  * Returns current root portfolio equity grouped by logical account and asset.
38
38
  */
39
39
  getPortfolioEquitySnapshot(options?: PolyesterRequestOptions): Promise<PortfolioEquitySnapshotResponse>;
40
- /**
41
- * Returns one page of the resolved account's statement as CSV: every balance movement in the
42
- * period, oldest first, with its fee and the balance after it. A page holds at most 2000
43
- * movements. API keys need `read-statements`. Use `exportStatementCsv` for the whole period.
44
- */
45
- exportStatement(input: ExportStatementInput, options?: PolyesterRequestOptions): Promise<StatementPage>;
46
- /**
47
- * Follows `nextPageToken` from the first page and returns the whole statement CSV, header
48
- * row first, with `completeThrough`; when it is before `endTime` the statement is partial.
49
- * The account is resolved once, so every page reads the same account.
50
- */
51
- exportStatementCsv(input: Omit<ExportStatementInput, "pageToken">, options?: PolyesterRequestOptions): Promise<Statement>;
52
40
  /**
53
41
  * Subscribes to private balance updates on private:ledger:balances:{accountId}:proto and emits every balance record as a decimal-string row. Records for assets unknown to the catalog route a CatalogLookupError to onError.
54
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"balances.d.ts","names":[],"sources":["../../../src/services/balances/balances.ts"],"mappings":";;;;;;;;;;UAuCU,+BAA+B,mBAAmB;EACxD;;;;;cAMS;;EAeL,YAAA,YAAY,mBACZ,UAAU,mBACV,UAAU,gCACV,QAAQ;;;;EAiBN,KACF,QAAO,oBACP,UAAU,0BACX,QAAQ;;;;EAgBL,kBACF,OAAO,qBACP,UAAU,0BACX,QAAQ;;;;EAWL,iBACF,OAAO,oBACP,UAAU,0BACX,QAAQ;;;;EAcL,0BACF,OAAO,6BACP,UAAU,0BACX,QAAQ;;;;EAaL,2BACF,UAAU,0BACX,QAAQ;;;;;;EAcL,gBACF,OAAO,sBACP,UAAU,0BACX,QAAQ;;;;;;EAeL,mBACF,OAAO,KAAK,oCACZ,UAAU,0BACX,QAAQ;;;;EAkBX,UAAU,OAAO"}
1
+ {"version":3,"file":"balances.d.ts","names":[],"sources":["../../../src/services/balances/balances.ts"],"mappings":";;;;;;;;;;UAkCU,+BAA+B,mBAAmB;EACxD;;;;;cAMS;;EAeL,YAAA,YAAY,mBACZ,UAAU,mBACV,UAAU,gCACV,QAAQ;;;;EAiBN,KACF,QAAO,oBACP,UAAU,0BACX,QAAQ;;;;EAgBL,kBACF,OAAO,qBACP,UAAU,0BACX,QAAQ;;;;EAWL,iBACF,OAAO,oBACP,UAAU,0BACX,QAAQ;;;;EAcL,0BACF,OAAO,6BACP,UAAU,0BACX,QAAQ;;;;EAaL,2BACF,UAAU,0BACX,QAAQ;;;;EAYX,UAAU,OAAO"}
@@ -1,10 +1,9 @@
1
1
  import { parse } from "../../shared/validation.js";
2
2
  import { toConnectCallOptions } from "../../shared/request-options.js";
3
- import { tsObjToMs } from "../../utils/time.js";
4
3
  import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
5
4
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
6
5
  import { accountScopeToSubaccountId } from "../../shared/account-scope.js";
7
- import { BalanceHistoryInputSchema, BalancesListInputSchema, EquityHistoryInputSchema, ExportStatementInputSchema, PortfolioEquityHistoryInputSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance } from "./balances.schemas.js";
6
+ import { BalanceHistoryInputSchema, BalancesListInputSchema, EquityHistoryInputSchema, PortfolioEquityHistoryInputSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance } from "./balances.schemas.js";
8
7
  import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
9
8
  import { createClient } from "@connectrpc/connect";
10
9
  //#region src/services/balances/balances.ts
@@ -77,49 +76,6 @@ var BalancesService = class {
77
76
  return parse(this.#portfolioEquitySnapshotResponseSchema, res);
78
77
  }
79
78
  /**
80
- * Returns one page of the resolved account's statement as CSV: every balance movement in the
81
- * period, oldest first, with its fee and the balance after it. A page holds at most 2000
82
- * movements. API keys need `read-statements`. Use `exportStatementCsv` for the whole period.
83
- */
84
- async exportStatement(input, options) {
85
- const resolved = resolveAccountScopedInput(input, this.#resolver);
86
- const request = parse(ExportStatementInputSchema, resolved);
87
- const { csv, nextPageToken, completeThrough } = await this.#client.exportStatement(request, toConnectCallOptions(options));
88
- return {
89
- csv,
90
- nextPageToken,
91
- completeThrough: tsObjToMs(completeThrough)
92
- };
93
- }
94
- /**
95
- * Follows `nextPageToken` from the first page and returns the whole statement CSV, header
96
- * row first, with `completeThrough`; when it is before `endTime` the statement is partial.
97
- * The account is resolved once, so every page reads the same account.
98
- */
99
- async exportStatementCsv(input, options) {
100
- const resolved = resolveAccountScopedInput(input, this.#resolver);
101
- const pinned = {
102
- ...resolved,
103
- account: resolved.account ?? "main"
104
- };
105
- let csv = "";
106
- let pageToken = "";
107
- let completeThrough;
108
- do {
109
- const page = await this.exportStatement({
110
- ...pinned,
111
- pageToken
112
- }, options);
113
- csv += page.csv;
114
- completeThrough = page.completeThrough;
115
- pageToken = page.nextPageToken;
116
- } while (pageToken);
117
- return {
118
- csv,
119
- completeThrough
120
- };
121
- }
122
- /**
123
79
  * Subscribes to private balance updates on private:ledger:balances:{accountId}:proto and emits every balance record as a decimal-string row. Records for assets unknown to the catalog route a CatalogLookupError to onError.
124
80
  */
125
81
  subscribe(input) {
@@ -1 +1 @@
1
- {"version":3,"file":"balances.js","names":["#client","Proto.LedgerReadService","#realtime","#resolver","#scales","#balanceHistoryResponseSchema","#equityHistoryResponseSchema","#portfolioEquityHistoryResponseSchema","#portfolioEquitySnapshotResponseSchema","Proto.AssetBalanceSchema"],"sources":["../../../src/services/balances/balances.ts"],"sourcesContent":["import * as Proto from \"../../gen/ledger/read/v1/ledger_read_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport { connectReadyGatedProtoChannel } from \"../../realtime/ready-gated-subscription.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { accountScopeToSubaccountId, type AccountScopedInput } from \"../../shared/account-scope.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n BalanceHistoryInputSchema,\n BalancesListInputSchema,\n EquityHistoryInputSchema,\n ExportStatementInputSchema,\n PortfolioEquityHistoryInputSchema,\n createBalanceHistoryResponseSchema,\n createEquityHistoryResponseSchema,\n formatLedgerBalance,\n createPortfolioEquityHistoryResponseSchema,\n createPortfolioEquitySnapshotResponseSchema,\n type LedgerBalance,\n type BalanceHistoryInput,\n type BalanceHistoryResponse,\n type EquityHistoryInput,\n type EquityHistoryResponse,\n type ExportStatementInput,\n type Statement,\n type StatementPage,\n type PortfolioEquityHistoryInput,\n type PortfolioEquityHistoryResponse,\n type PortfolioEquitySnapshotResponse,\n} from \"./balances.schemas.js\";\n\ninterface SubscribeBalancesInput extends BaseSubscribeInput<LedgerBalance> {\n accountId: string;\n}\n\n/**\n * Reads and streams ledger balances plus balance and equity history for the authenticated account scope.\n */\nexport class BalancesService {\n #client: Client<typeof Proto.LedgerReadService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #balanceHistoryResponseSchema: ReturnType<typeof createBalanceHistoryResponseSchema>;\n #equityHistoryResponseSchema: ReturnType<typeof createEquityHistoryResponseSchema>;\n #portfolioEquityHistoryResponseSchema: ReturnType<\n typeof createPortfolioEquityHistoryResponseSchema\n >;\n #portfolioEquitySnapshotResponseSchema: ReturnType<\n typeof createPortfolioEquitySnapshotResponseSchema\n >;\n\n constructor(\n transports: AuthApiTransports,\n realtime: PolyesterRealtime,\n resolver: SubaccountResolver | undefined,\n scales: SdkScales,\n ) {\n this.#client = createClient(Proto.LedgerReadService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n this.#scales = scales;\n this.#balanceHistoryResponseSchema = createBalanceHistoryResponseSchema();\n this.#equityHistoryResponseSchema = createEquityHistoryResponseSchema(scales);\n this.#portfolioEquityHistoryResponseSchema =\n createPortfolioEquityHistoryResponseSchema(scales);\n this.#portfolioEquitySnapshotResponseSchema =\n createPortfolioEquitySnapshotResponseSchema(scales);\n }\n\n /**\n * Returns current asset balances for the resolved root account or subaccount, including trading, funding, reserved, and available amounts as decimal strings.\n */\n async list(\n input: AccountScopedInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<LedgerBalance[]> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validated = parse(BalancesListInputSchema, resolved);\n const res = await this.#client.getBalances(\n {\n subaccountId: accountScopeToSubaccountId(validated.account),\n },\n toConnectCallOptions(options),\n );\n return res.balances.map(formatLedgerBalance);\n }\n\n /**\n * Returns columnar balance history for the resolved account scope over a selected range, optionally filtered by a non-negative integer ledger asset ID and account buckets. Ledger 0 or omission includes all assets.\n */\n async getBalanceHistory(\n input: BalanceHistoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<BalanceHistoryResponse> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validated = parse(BalanceHistoryInputSchema, resolved);\n const res = await this.#client.getBalanceHistory(validated, toConnectCallOptions(options));\n return parse(this.#balanceHistoryResponseSchema, res);\n }\n\n /**\n * Returns equity history series for the resolved account scope over a selected range, optionally grouped by account or asset and filtered by account buckets.\n */\n async getEquityHistory(\n input: EquityHistoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<EquityHistoryResponse> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validated = parse(EquityHistoryInputSchema, resolved);\n const res = await this.#client.getEquityHistorySeries(\n validated,\n toConnectCallOptions(options),\n );\n return parse(this.#equityHistoryResponseSchema, res);\n }\n\n /**\n * Returns root portfolio equity history grouped by the master account, leading owned subaccounts, and an optional remaining-subaccounts series.\n */\n async getPortfolioEquityHistory(\n input: PortfolioEquityHistoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<PortfolioEquityHistoryResponse> {\n await this.#scales.ready();\n const validated = parse(PortfolioEquityHistoryInputSchema, input);\n const res = await this.#client.getPortfolioEquityHistorySeries(\n validated,\n toConnectCallOptions(options),\n );\n return parse(this.#portfolioEquityHistoryResponseSchema, res);\n }\n\n /**\n * Returns current root portfolio equity grouped by logical account and asset.\n */\n async getPortfolioEquitySnapshot(\n options?: PolyesterRequestOptions,\n ): Promise<PortfolioEquitySnapshotResponse> {\n await this.#scales.ready();\n const res = await this.#client.getPortfolioEquitySnapshot(\n {},\n toConnectCallOptions(options),\n );\n return parse(this.#portfolioEquitySnapshotResponseSchema, res);\n }\n\n /**\n * Returns one page of the resolved account's statement as CSV: every balance movement in the\n * period, oldest first, with its fee and the balance after it. A page holds at most 2000\n * movements. API keys need `read-statements`. Use `exportStatementCsv` for the whole period.\n */\n async exportStatement(\n input: ExportStatementInput,\n options?: PolyesterRequestOptions,\n ): Promise<StatementPage> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(ExportStatementInputSchema, resolved);\n const { csv, nextPageToken, completeThrough } = await this.#client.exportStatement(\n request,\n toConnectCallOptions(options),\n );\n return { csv, nextPageToken, completeThrough: tsObjToMs(completeThrough) };\n }\n\n /**\n * Follows `nextPageToken` from the first page and returns the whole statement CSV, header\n * row first, with `completeThrough`; when it is before `endTime` the statement is partial.\n * The account is resolved once, so every page reads the same account.\n */\n async exportStatementCsv(\n input: Omit<ExportStatementInput, \"pageToken\">,\n options?: PolyesterRequestOptions,\n ): Promise<Statement> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const pinned = { ...resolved, account: resolved.account ?? (\"main\" as const) };\n let csv = \"\";\n let pageToken = \"\";\n let completeThrough: number | undefined;\n do {\n const page = await this.exportStatement({ ...pinned, pageToken }, options);\n csv += page.csv;\n completeThrough = page.completeThrough;\n pageToken = page.nextPageToken;\n } while (pageToken);\n return { csv, completeThrough };\n }\n\n /**\n * Subscribes to private balance updates on private:ledger:balances:{accountId}:proto and emits every balance record as a decimal-string row. Records for assets unknown to the catalog route a CatalogLookupError to onError.\n */\n subscribe(input: SubscribeBalancesInput): () => void {\n const channel = `private:ledger:balances:${input.accountId}:proto`;\n return connectReadyGatedProtoChannel(this.#realtime, {\n channel,\n schema: Proto.AssetBalanceSchema,\n ready: () => this.#scales.ready(),\n onPublication: (data) => {\n input.onEvent(formatLedgerBalance(data));\n },\n onConnected: input.onOpen,\n onDisconnected: input.onClose,\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA8CA,IAAa,kBAAb,MAA6B;CACzB;CAC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gB,MAAM;GACtB,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
1
+ {"version":3,"file":"balances.js","names":["#client","Proto.LedgerReadService","#realtime","#resolver","#scales","#balanceHistoryResponseSchema","#equityHistoryResponseSchema","#portfolioEquityHistoryResponseSchema","#portfolioEquitySnapshotResponseSchema","Proto.AssetBalanceSchema"],"sources":["../../../src/services/balances/balances.ts"],"sourcesContent":["import * as Proto from \"../../gen/ledger/read/v1/ledger_read_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport { connectReadyGatedProtoChannel } from \"../../realtime/ready-gated-subscription.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { accountScopeToSubaccountId, type AccountScopedInput } from \"../../shared/account-scope.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport {\n BalanceHistoryInputSchema,\n BalancesListInputSchema,\n EquityHistoryInputSchema,\n PortfolioEquityHistoryInputSchema,\n createBalanceHistoryResponseSchema,\n createEquityHistoryResponseSchema,\n formatLedgerBalance,\n createPortfolioEquityHistoryResponseSchema,\n createPortfolioEquitySnapshotResponseSchema,\n type LedgerBalance,\n type BalanceHistoryInput,\n type BalanceHistoryResponse,\n type EquityHistoryInput,\n type EquityHistoryResponse,\n type PortfolioEquityHistoryInput,\n type PortfolioEquityHistoryResponse,\n type PortfolioEquitySnapshotResponse,\n} from \"./balances.schemas.js\";\n\ninterface SubscribeBalancesInput extends BaseSubscribeInput<LedgerBalance> {\n accountId: string;\n}\n\n/**\n * Reads and streams ledger balances plus balance and equity history for the authenticated account scope.\n */\nexport class BalancesService {\n #client: Client<typeof Proto.LedgerReadService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #balanceHistoryResponseSchema: ReturnType<typeof createBalanceHistoryResponseSchema>;\n #equityHistoryResponseSchema: ReturnType<typeof createEquityHistoryResponseSchema>;\n #portfolioEquityHistoryResponseSchema: ReturnType<\n typeof createPortfolioEquityHistoryResponseSchema\n >;\n #portfolioEquitySnapshotResponseSchema: ReturnType<\n typeof createPortfolioEquitySnapshotResponseSchema\n >;\n\n constructor(\n transports: AuthApiTransports,\n realtime: PolyesterRealtime,\n resolver: SubaccountResolver | undefined,\n scales: SdkScales,\n ) {\n this.#client = createClient(Proto.LedgerReadService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n this.#scales = scales;\n this.#balanceHistoryResponseSchema = createBalanceHistoryResponseSchema();\n this.#equityHistoryResponseSchema = createEquityHistoryResponseSchema(scales);\n this.#portfolioEquityHistoryResponseSchema =\n createPortfolioEquityHistoryResponseSchema(scales);\n this.#portfolioEquitySnapshotResponseSchema =\n createPortfolioEquitySnapshotResponseSchema(scales);\n }\n\n /**\n * Returns current asset balances for the resolved root account or subaccount, including trading, funding, reserved, and available amounts as decimal strings.\n */\n async list(\n input: AccountScopedInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<LedgerBalance[]> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validated = parse(BalancesListInputSchema, resolved);\n const res = await this.#client.getBalances(\n {\n subaccountId: accountScopeToSubaccountId(validated.account),\n },\n toConnectCallOptions(options),\n );\n return res.balances.map(formatLedgerBalance);\n }\n\n /**\n * Returns columnar balance history for the resolved account scope over a selected range, optionally filtered by a non-negative integer ledger asset ID and account buckets. Ledger 0 or omission includes all assets.\n */\n async getBalanceHistory(\n input: BalanceHistoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<BalanceHistoryResponse> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validated = parse(BalanceHistoryInputSchema, resolved);\n const res = await this.#client.getBalanceHistory(validated, toConnectCallOptions(options));\n return parse(this.#balanceHistoryResponseSchema, res);\n }\n\n /**\n * Returns equity history series for the resolved account scope over a selected range, optionally grouped by account or asset and filtered by account buckets.\n */\n async getEquityHistory(\n input: EquityHistoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<EquityHistoryResponse> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validated = parse(EquityHistoryInputSchema, resolved);\n const res = await this.#client.getEquityHistorySeries(\n validated,\n toConnectCallOptions(options),\n );\n return parse(this.#equityHistoryResponseSchema, res);\n }\n\n /**\n * Returns root portfolio equity history grouped by the master account, leading owned subaccounts, and an optional remaining-subaccounts series.\n */\n async getPortfolioEquityHistory(\n input: PortfolioEquityHistoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<PortfolioEquityHistoryResponse> {\n await this.#scales.ready();\n const validated = parse(PortfolioEquityHistoryInputSchema, input);\n const res = await this.#client.getPortfolioEquityHistorySeries(\n validated,\n toConnectCallOptions(options),\n );\n return parse(this.#portfolioEquityHistoryResponseSchema, res);\n }\n\n /**\n * Returns current root portfolio equity grouped by logical account and asset.\n */\n async getPortfolioEquitySnapshot(\n options?: PolyesterRequestOptions,\n ): Promise<PortfolioEquitySnapshotResponse> {\n await this.#scales.ready();\n const res = await this.#client.getPortfolioEquitySnapshot(\n {},\n toConnectCallOptions(options),\n );\n return parse(this.#portfolioEquitySnapshotResponseSchema, res);\n }\n\n /**\n * Subscribes to private balance updates on private:ledger:balances:{accountId}:proto and emits every balance record as a decimal-string row. Records for assets unknown to the catalog route a CatalogLookupError to onError.\n */\n subscribe(input: SubscribeBalancesInput): () => void {\n const channel = `private:ledger:balances:${input.accountId}:proto`;\n return connectReadyGatedProtoChannel(this.#realtime, {\n channel,\n schema: Proto.AssetBalanceSchema,\n ready: () => this.#scales.ready(),\n onPublication: (data) => {\n input.onEvent(formatLedgerBalance(data));\n },\n onConnected: input.onOpen,\n onDisconnected: input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A8B,GAAG;CACvD;;;;CAKA,MAAM,0BACF,OACA,SACuC;EACvC,MAAM,KAAKF,QAAQ,MAAM;EACzB,MAAM,YAAY,MAAM,mCAAmC,KAAK;EAChE,MAAM,MAAM,MAAM,KAAKJ,QAAQ,gCAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,KAAKO,uCAAuC,GAAG;CAChE;;;;CAKA,MAAM,2BACF,SACwC;EACxC,MAAM,KAAKH,QAAQ,MAAM;EACzB,MAAM,MAAM,MAAM,KAAKJ,QAAQ,2BAC3B,CAAC,GACD,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,KAAKQ,wCAAwC,GAAG;CACjE;;;;CAKA,UAAU,OAA2C;EACjD,MAAM,UAAU,2BAA2B,MAAM,UAAU;EAC3D,OAAO,8BAA8B,KAAKN,WAAW;GACjD;GACA,QAAQO;GACR,aAAa,KAAKL,QAAQ,MAAM;GAChC,gBAAgB,SAAS;IACrB,MAAM,QAAQ,oBAAoB,IAAI,CAAC;GAC3C;GACA,aAAa,MAAM;GACnB,gBAAgB,MAAM;GACtB,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
@@ -75,72 +75,6 @@ declare const BalanceHistoryInputSchema: v.SchemaWithPipe<readonly [v.StrictObje
75
75
  accountCodes: (AccountCode.FUNDING | AccountCode.TRADING)[];
76
76
  }>]>;
77
77
  type BalanceHistoryInput = v.InferInput<typeof BalanceHistoryInputSchema>;
78
- declare const ExportStatementInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
79
- /** Period start, inclusive, in epoch milliseconds (UTC). */
80
- readonly startTime: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
81
- /** Period end, exclusive, in epoch milliseconds (UTC); at most 366 days after `startTime`. */
82
- readonly endTime: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
83
- /** Ledger asset ID to cover only that asset; omit or `0` for every asset. */
84
- readonly assetId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, 0>;
85
- /** Previous `nextPageToken`; reuse only with the same account, asset and period. */
86
- readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
87
- readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
88
- readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
89
- }, undefined>], undefined>, undefined>;
90
- }, undefined>, v.CheckAction<{
91
- startTime: number;
92
- endTime: number;
93
- assetId: number;
94
- pageToken: string;
95
- account?: "active" | "main" | {
96
- subaccountId: string;
97
- } | undefined;
98
- }, "endTime must be after startTime.">, v.CheckAction<{
99
- startTime: number;
100
- endTime: number;
101
- assetId: number;
102
- pageToken: string;
103
- account?: "active" | "main" | {
104
- subaccountId: string;
105
- } | undefined;
106
- }, "A statement period is at most 366 days.">, v.TransformAction<{
107
- startTime: number;
108
- endTime: number;
109
- assetId: number;
110
- pageToken: string;
111
- account?: "active" | "main" | {
112
- subaccountId: string;
113
- } | undefined;
114
- }, {
115
- subaccountId: bigint | undefined;
116
- startTime: import("@bufbuild/protobuf/wkt").Timestamp;
117
- endTime: import("@bufbuild/protobuf/wkt").Timestamp;
118
- assetId: number;
119
- pageToken: string;
120
- }>]>;
121
- type ExportStatementInput = v.InferInput<typeof ExportStatementInputSchema>;
122
- /**
123
- * One page of an account statement. `csv` is RFC 4180 UTF-8 text with CRLF line endings; only
124
- * the first page starts with the header row, so concatenating pages in order yields the whole
125
- * statement. Read columns by header name, since later releases may append columns, and keep
126
- * amounts as decimal strings. An empty `nextPageToken` means no more pages.
127
- */
128
- interface StatementPage {
129
- csv: string;
130
- nextPageToken: string;
131
- /**
132
- * The statement covers movements up to this time (epoch ms, exclusive): the earliest of
133
- * `endTime`, the first page's request time and the time account history is complete
134
- * through. Every page carries the same value. Before `endTime`, the statement is partial:
135
- * the rest appears in a statement requested later.
136
- */
137
- completeThrough: number | undefined;
138
- }
139
- /** A whole account statement: every page's CSV and the time it is complete through. */
140
- interface Statement {
141
- csv: string;
142
- completeThrough: number | undefined;
143
- }
144
78
  declare function createBalanceHistoryResponseSchema(): v.SchemaWithPipe<readonly [v.ObjectSchema<{
145
79
  readonly range: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "1d" | "7d" | "30d" | "90d" | "180d" | "365d">]>;
146
80
  readonly bucket: v.StringSchema<undefined>;
@@ -487,5 +421,5 @@ declare function createPortfolioEquitySnapshotResponseSchema(scales: SdkScales):
487
421
  }>]>;
488
422
  type PortfolioEquitySnapshotResponse = v.InferOutput<ReturnType<typeof createPortfolioEquitySnapshotResponseSchema>>;
489
423
  //#endregion
490
- export { BalanceHistoryInput, BalanceHistoryInputSchema, BalanceHistoryResponse, BalanceRange, BalanceRangeSchema, EquityGroupBy, EquityGroupBySchema, EquityHistoryInput, EquityHistoryInputSchema, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, EquitySeriesSchema, ExportStatementInput, ExportStatementInputSchema, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryInputSchema, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySeriesSchema, PortfolioEquitySnapshotResponse, Statement, StatementPage, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createLedgerBalanceSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance };
424
+ export { BalanceHistoryInput, BalanceHistoryInputSchema, BalanceHistoryResponse, BalanceRange, BalanceRangeSchema, EquityGroupBy, EquityGroupBySchema, EquityHistoryInput, EquityHistoryInputSchema, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, EquitySeriesSchema, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryInputSchema, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySeriesSchema, PortfolioEquitySnapshotResponse, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createLedgerBalanceSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance };
491
425
  //# sourceMappingURL=balances.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"balances.schemas.d.ts","names":[],"sources":["../../../src/services/balances/balances.schemas.ts"],"mappings":";;;;;;;;iBA2DgB,6BAAyB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASzB,oBAAoB,GAAG,eAA+B;KAY1D,gBAAgB,EAAE,YAAY,kBAAkB;cAQ/C,oBAAkB,EAAA;KAEnB,eAAe,EAAE,mBAAmB;cASnC,qBAAmB,EAAA;KAEpB,gBAAgB,EAAE,mBAAmB;cAEpC,2BAAyB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;KAwB1B,sBAAsB,EAAE,kBAAkB;cAOzC,4BAA0B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4B3B,uBAAuB,EAAE,kBAAkB;;;;;;;UAQtC;EACb;EACA;;;;;;;EAOA;;;UAIa;EACb;EACA;;iBAUY,sCAAkC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BtC,yBAAyB,EAAE,YACnC,kBAAkB;cAGT,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;KAwBzB,qBAAqB,EAAE,kBAAkB;cAExC,mCAAiC,EAAA;;;KAIlC,8BAA8B,EAAE,kBAAkB;KAmBlD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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmBjE,kCAAkC,EAAE,YAC5C,kBAAkB"}
@@ -1,10 +1,8 @@
1
- import { PROTOBUF_UINT32_MAX } from "../../shared/wire-bounds.js";
2
1
  import { PublicIdSchema, U128Schema } from "../../shared/schemas.js";
3
2
  import { enumLabel, enumLabelSchema } from "../../shared/proto-enum-codec.js";
4
3
  import { fromU128 } from "../../utils/u128.js";
5
4
  import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
6
5
  import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
7
- import { msToTimestamp } from "../../utils/timestamp.js";
8
6
  import { ACCOUNT_CODE_VALUES, AccountCodeCodec } from "../../shared/ledger-codes.js";
9
7
  import { BalanceRangeCodec, EquityGroupByCodec } from "./balances.codecs.js";
10
8
  import * as v from "valibot";
@@ -80,25 +78,6 @@ const BalanceHistoryInputSchema = v.pipe(v.strictObject({
80
78
  ...input,
81
79
  subaccountId: accountScopeToSubaccountId(account)
82
80
  })));
83
- /** The longest statement period the server accepts. */
84
- const MAX_STATEMENT_PERIOD_MS = 316224e5;
85
- const EpochMsInputSchema = v.pipe(v.number(), v.integer(), v.minValue(0));
86
- const ExportStatementInputSchema = v.pipe(v.strictObject({
87
- ...AccountScopeInputEntries,
88
- /** Period start, inclusive, in epoch milliseconds (UTC). */
89
- startTime: EpochMsInputSchema,
90
- /** Period end, exclusive, in epoch milliseconds (UTC); at most 366 days after `startTime`. */
91
- endTime: EpochMsInputSchema,
92
- /** Ledger asset ID to cover only that asset; omit or `0` for every asset. */
93
- assetId: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)), 0),
94
- /** Previous `nextPageToken`; reuse only with the same account, asset and period. */
95
- pageToken: v.optional(v.pipe(v.string(), v.trim()), "")
96
- }), v.check(({ startTime, endTime }) => endTime > startTime, "endTime must be after startTime."), v.check(({ startTime, endTime }) => endTime - startTime <= MAX_STATEMENT_PERIOD_MS, "A statement period is at most 366 days."), v.transform(({ account, startTime, endTime, ...input }) => ({
97
- ...input,
98
- subaccountId: accountScopeToSubaccountId(account),
99
- startTime: msToTimestamp(startTime),
100
- endTime: msToTimestamp(endTime)
101
- })));
102
81
  const BalanceSeriesSchema = v.object({
103
82
  assetId: v.number(),
104
83
  accountCode: v.number(),
@@ -273,6 +252,6 @@ function createPortfolioEquitySnapshotResponseSchema(scales) {
273
252
  })));
274
253
  }
275
254
  //#endregion
276
- export { BALANCE_RANGES, BalanceHistoryInputSchema, BalanceRangeSchema, BalancesListInputSchema, EQUITY_GROUP_BYS, EquityGroupBySchema, EquityHistoryInputSchema, EquitySeriesSchema, ExportStatementInputSchema, PortfolioEquityHistoryInputSchema, PortfolioEquitySeriesSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createLedgerBalanceSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance };
255
+ export { BALANCE_RANGES, BalanceHistoryInputSchema, BalanceRangeSchema, BalancesListInputSchema, EQUITY_GROUP_BYS, EquityGroupBySchema, EquityHistoryInputSchema, EquitySeriesSchema, PortfolioEquityHistoryInputSchema, PortfolioEquitySeriesSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createLedgerBalanceSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance };
277
256
 
278
257
  //# sourceMappingURL=balances.schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"balances.schemas.js","names":[],"sources":["../../../src/services/balances/balances.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport type * as ProtoLedgerRead from \"../../gen/ledger/read/v1/ledger_read_pb.js\";\nimport { fromU128 } from \"../../utils/u128.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport {\n AccountCodeCodec,\n ACCOUNT_CODE_VALUES,\n type AccountCodeValue,\n} from \"../../shared/ledger-codes.js\";\nimport { E18_SCALE, scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { BalanceRangeCodec, EquityGroupByCodec } from \"./balances.codecs.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { PublicIdSchema, U128Schema } from \"../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport { msToTimestamp } from \"../../utils/timestamp.js\";\n\n/**\n * Equity history values are quoted in the response's quote currency at a fixed\n * 4-decimal wire scale (proto: \"Equity in quote currency scaled by 1e4\").\n */\nconst EQUITY_SCALE = 4;\n\n/**\n * AssetBalance u128 fields on the ledger wire are always 18-decimal scaled\n * (PolyesterChain base units), independent of per-asset quantityScale used\n * elsewhere for order quantities and transfer inputs.\n */\nconst LedgerBalanceFieldsSchema = v.object({\n assetId: v.number(),\n trading: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n funding: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n reserved: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n available: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n tradingRevision: v.pipe(\n v.optional(v.bigint(), 0n),\n v.transform((value) => value.toString()),\n ),\n fundingRevision: v.pipe(\n v.optional(v.bigint(), 0n),\n v.transform((value) => value.toString()),\n ),\n});\n\nfunction toLedgerBalance(b: v.InferOutput<typeof LedgerBalanceFieldsSchema>) {\n return {\n assetId: b.assetId,\n funding: scaledToDecimalOutput(b.funding ?? 0n, E18_SCALE),\n trading: scaledToDecimalOutput(b.trading ?? 0n, E18_SCALE),\n reserved: scaledToDecimalOutput(b.reserved ?? 0n, E18_SCALE),\n available: scaledToDecimalOutput(b.available ?? 0n, E18_SCALE),\n tradingRevision: b.tradingRevision,\n fundingRevision: b.fundingRevision,\n };\n}\n\nexport function createLedgerBalanceSchema() {\n return v.pipe(LedgerBalanceFieldsSchema, v.transform(toLedgerBalance));\n}\n\n/**\n * Converts a `ledger.read.v1.AssetBalance` message to the `LedgerBalance` that `balances.list`\n * returns. Its U128 amounts are always at the 18-decimal ledger scale, whatever the asset's own\n * decimals, so the result needs no catalog.\n */\nexport function formatLedgerBalance(b: ProtoLedgerRead.AssetBalance): LedgerBalance {\n return toLedgerBalance({\n assetId: b.assetId,\n trading: fromU128(b.trading),\n funding: fromU128(b.funding),\n reserved: fromU128(b.reserved),\n available: fromU128(b.available),\n tradingRevision: (b.tradingRevision ?? 0n).toString(),\n fundingRevision: (b.fundingRevision ?? 0n).toString(),\n });\n}\n\nexport type LedgerBalance = v.InferOutput<ReturnType<typeof createLedgerBalanceSchema>>;\n\nexport const BalancesListInputSchema = v.strictObject(AccountScopeInputEntries);\n\nexport type BalancesListInput = v.InferInput<typeof BalancesListInputSchema>;\n\nexport const BALANCE_RANGES = [\"1d\", \"7d\", \"30d\", \"90d\", \"180d\", \"365d\"] as const;\n\nexport const BalanceRangeSchema = v.picklist(BALANCE_RANGES);\n\nexport type BalanceRange = v.InferOutput<typeof BalanceRangeSchema>;\n\nconst BalanceRangeInputSchema = v.pipe(\n BalanceRangeSchema,\n v.transform((value) => BalanceRangeCodec.inputToProto[value]),\n);\n\nexport const EQUITY_GROUP_BYS = [\"account\", \"asset\"] as const;\n\nexport const EquityGroupBySchema = v.picklist(EQUITY_GROUP_BYS);\n\nexport type EquityGroupBy = v.InferOutput<typeof EquityGroupBySchema>;\n\nexport const BalanceHistoryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n range: BalanceRangeInputSchema,\n ledger: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(4_294_967_295)),\n 0,\n ),\n accountCodes: v.optional(\n v.array(\n v.pipe(\n v.picklist(ACCOUNT_CODE_VALUES),\n v.transform((value) => AccountCodeCodec.inputToProto[value]),\n ),\n ),\n [],\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type BalanceHistoryInput = v.InferInput<typeof BalanceHistoryInputSchema>;\n\n/** The longest statement period the server accepts. */\nconst MAX_STATEMENT_PERIOD_MS = 366 * 24 * 60 * 60 * 1000;\n\nconst EpochMsInputSchema = v.pipe(v.number(), v.integer(), v.minValue(0));\n\nexport const ExportStatementInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** Period start, inclusive, in epoch milliseconds (UTC). */\n startTime: EpochMsInputSchema,\n /** Period end, exclusive, in epoch milliseconds (UTC); at most 366 days after `startTime`. */\n endTime: EpochMsInputSchema,\n /** Ledger asset ID to cover only that asset; omit or `0` for every asset. */\n assetId: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)),\n 0,\n ),\n /** Previous `nextPageToken`; reuse only with the same account, asset and period. */\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.check(({ startTime, endTime }) => endTime > startTime, \"endTime must be after startTime.\"),\n v.check(\n ({ startTime, endTime }) => endTime - startTime <= MAX_STATEMENT_PERIOD_MS,\n \"A statement period is at most 366 days.\",\n ),\n v.transform(({ account, startTime, endTime, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n startTime: msToTimestamp(startTime),\n endTime: msToTimestamp(endTime),\n })),\n);\n\nexport type ExportStatementInput = v.InferInput<typeof ExportStatementInputSchema>;\n\n/**\n * One page of an account statement. `csv` is RFC 4180 UTF-8 text with CRLF line endings; only\n * the first page starts with the header row, so concatenating pages in order yields the whole\n * statement. Read columns by header name, since later releases may append columns, and keep\n * amounts as decimal strings. An empty `nextPageToken` means no more pages.\n */\nexport interface StatementPage {\n csv: string;\n nextPageToken: string;\n /**\n * The statement covers movements up to this time (epoch ms, exclusive): the earliest of\n * `endTime`, the first page's request time and the time account history is complete\n * through. Every page carries the same value. Before `endTime`, the statement is partial:\n * the rest appears in a statement requested later.\n */\n completeThrough: number | undefined;\n}\n\n/** A whole account statement: every page's CSV and the time it is complete through. */\nexport interface Statement {\n csv: string;\n completeThrough: number | undefined;\n}\n\nconst BalanceSeriesSchema = v.object({\n assetId: v.number(),\n accountCode: v.number(),\n /** One exact 18-decimal U128 balance per point, like live ledger balances. */\n balance: v.array(U128Schema),\n});\n\nexport function createBalanceHistoryResponseSchema() {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n points: v.number(),\n series: v.array(BalanceSeriesSchema),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n points: data.points,\n series: data.series.map((s) => {\n return {\n assetId: s.assetId,\n accountCode: enumLabel(AccountCodeCodec.protoToOutput, s.accountCode),\n balance: s.balance.map((b) => scaledToDecimalOutput(fromU128(b), E18_SCALE)),\n };\n }),\n })),\n );\n}\n\nexport type BalanceHistoryResponse = v.InferOutput<\n ReturnType<typeof createBalanceHistoryResponseSchema>\n>;\n\nexport const EquityHistoryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n range: BalanceRangeInputSchema,\n accountCodes: v.optional(\n v.array(\n v.pipe(\n v.picklist(ACCOUNT_CODE_VALUES),\n v.transform((value) => AccountCodeCodec.inputToProto[value]),\n ),\n ),\n [],\n ),\n groupBy: v.pipe(\n v.optional(EquityGroupBySchema, \"account\"),\n v.transform((v) => EquityGroupByCodec.inputToProto[v ?? \"account\"]),\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type EquityHistoryInput = v.InferInput<typeof EquityHistoryInputSchema>;\n\nexport const PortfolioEquityHistoryInputSchema = v.strictObject({\n range: BalanceRangeInputSchema,\n});\n\nexport type PortfolioEquityHistoryInput = v.InferInput<typeof PortfolioEquityHistoryInputSchema>;\n\nconst EquitySeriesGroupingSchema = v.union([\n v.object({\n case: v.literal(\"account\"),\n value: v.object({\n accountCode: v.number(),\n name: v.string(),\n }),\n }),\n v.object({\n case: v.literal(\"asset\"),\n value: v.object({\n id: v.number(),\n symbol: v.string(),\n }),\n }),\n]);\n\nexport type EquitySeriesGrouping =\n | {\n type: \"account\";\n accountCode: DecodedEnum<AccountCodeValue>;\n name: string;\n }\n | {\n type: \"asset\";\n assetId: number;\n symbol: string;\n };\n\nexport const EquitySeriesSchema = v.pipe(\n v.object({\n grouping: EquitySeriesGroupingSchema,\n equityQ: v.array(v.bigint()),\n }),\n v.transform((series): { grouping: EquitySeriesGrouping; equity: string[] } => {\n const equity = series.equityQ.map((value) => scaledToDecimalOutput(value, EQUITY_SCALE));\n if (series.grouping.case === \"account\") {\n return {\n grouping: {\n type: \"account\",\n accountCode: enumLabel(\n AccountCodeCodec.protoToOutput,\n series.grouping.value.accountCode,\n ),\n name: series.grouping.value.name,\n },\n equity,\n };\n }\n\n return {\n grouping: {\n type: \"asset\",\n assetId: series.grouping.value.id,\n symbol: series.grouping.value.symbol,\n },\n equity,\n };\n }),\n);\n\nexport function createEquityHistoryResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n quoteAsset: v.string(),\n points: v.number(),\n series: v.array(EquitySeriesSchema),\n btcPricesQ: v.optional(v.array(v.bigint()), []),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n quoteAsset: data.quoteAsset,\n points: data.points,\n series: data.series,\n // BTC price in USDT at each timestamp, carried as price ticks on the wire.\n btcPrices: data.btcPricesQ.map((value) => scaledToDecimalOutput(value, scales.price())),\n })),\n );\n}\n\nexport type EquitySeries = v.InferOutput<typeof EquitySeriesSchema>;\nexport type EquityHistoryResponse = v.InferOutput<\n ReturnType<typeof createEquityHistoryResponseSchema>\n>;\n\nconst PortfolioAccountGroupingSchema = v.variant(\"remaining\", [\n v.object({\n accountId: PublicIdSchema,\n remaining: v.literal(false),\n }),\n v.object({\n accountId: v.optional(v.never()),\n remaining: v.literal(true),\n }),\n]);\n\nexport type PortfolioEquitySeriesGrouping =\n | { type: \"portfolioAccount\"; accountId: string; remaining: false }\n | { type: \"portfolioAccount\"; accountId?: never; remaining: true };\n\nexport const PortfolioEquitySeriesSchema = v.pipe(\n v.object({\n grouping: v.object({\n case: v.literal(\"portfolioAccount\"),\n value: PortfolioAccountGroupingSchema,\n }),\n equityQ: v.array(v.bigint()),\n }),\n v.transform((series): { grouping: PortfolioEquitySeriesGrouping; equity: string[] } => ({\n grouping: series.grouping.value.remaining\n ? { type: \"portfolioAccount\", remaining: true }\n : {\n type: \"portfolioAccount\",\n accountId: series.grouping.value.accountId,\n remaining: false,\n },\n equity: series.equityQ.map((value) => scaledToDecimalOutput(value, EQUITY_SCALE)),\n })),\n);\n\nexport function createPortfolioEquityHistoryResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n quoteAsset: v.string(),\n points: v.number(),\n series: v.array(PortfolioEquitySeriesSchema),\n btcPricesQ: v.optional(v.array(v.bigint()), []),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n quoteAsset: data.quoteAsset,\n points: data.points,\n series: data.series,\n btcPrices: data.btcPricesQ.map((value) => scaledToDecimalOutput(value, scales.price())),\n })),\n );\n}\n\nexport type PortfolioEquitySeries = v.InferOutput<typeof PortfolioEquitySeriesSchema>;\nexport type PortfolioEquityHistoryResponse = v.InferOutput<\n ReturnType<typeof createPortfolioEquityHistoryResponseSchema>\n>;\n\nconst PortfolioAccountEquitySchema = v.pipe(\n v.object({\n accountId: PublicIdSchema,\n equityQ: v.bigint(),\n topAssetIds: v.array(v.number()),\n }),\n v.transform((account) => ({\n accountId: account.accountId,\n equity: scaledToDecimalOutput(account.equityQ, EQUITY_SCALE),\n topAssetIds: account.topAssetIds,\n })),\n);\n\nconst PortfolioAssetEquitySchema = v.pipe(\n v.object({\n assetId: v.number(),\n balance: v.optional(U128Schema),\n equityQ: v.bigint(),\n }),\n v.transform((asset) => ({\n assetId: asset.assetId,\n balance: scaledToDecimalOutput(fromU128(asset.balance), E18_SCALE),\n equity: scaledToDecimalOutput(asset.equityQ, EQUITY_SCALE),\n })),\n);\n\nexport function createPortfolioEquitySnapshotResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n quoteAsset: v.string(),\n totalEquityQ: v.bigint(),\n accounts: v.array(PortfolioAccountEquitySchema),\n assets: v.array(PortfolioAssetEquitySchema),\n btcPriceQ: v.bigint(),\n }),\n v.transform((snapshot) => ({\n quoteAsset: snapshot.quoteAsset,\n totalEquity: scaledToDecimalOutput(snapshot.totalEquityQ, EQUITY_SCALE),\n accounts: snapshot.accounts,\n assets: snapshot.assets,\n btcPrice: scaledToDecimalOutput(snapshot.btcPriceQ, scales.price()),\n })),\n );\n}\n\nexport type PortfolioEquitySnapshotResponse = v.InferOutput<\n ReturnType<typeof createPortfolioEquitySnapshotResponseSchema>\n>;\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,MAAM,eAAe;;;;;;AAOrB,MAAM,4BAA4B,EAAE,OAAO;CACvC,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC7D,SAAS,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC7D,UAAU,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC9D,WAAW,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC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,CAAC;CAC1F,EAAE,CACN;AACJ;AAOA,MAAM,+BAA+B,EAAE,KACnC,EAAE,OAAO;CACL,WAAW;CACX,SAAS,EAAE,OAAO;CAClB,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC;AACnC,CAAC,GACD,EAAE,WAAW,aAAa;CACtB,WAAW,QAAQ;CACnB,QAAQ,sBAAsB,QAAQ,SAAS,YAAY;CAC3D,aAAa,QAAQ;AACzB,EAAE,CACN;AAEA,MAAM,6BAA6B,EAAE,KACjC,EAAE,OAAO;CACL,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,SAAS,UAAU;CAC9B,SAAS,EAAE,OAAO;AACtB,CAAC,GACD,EAAE,WAAW,WAAW;CACpB,SAAS,MAAM;CACf,SAAS,sBAAsB,SAAS,MAAM,OAAO,GAAA,EAAY;CACjE,QAAQ,sBAAsB,MAAM,SAAS,YAAY;AAC7D,EAAE,CACN;AAEA,SAAgB,4CAA4C,QAAmB;CAC3E,OAAO,EAAE,KACL,EAAE,OAAO;EACL,YAAY,EAAE,OAAO;EACrB,cAAc,EAAE,OAAO;EACvB,UAAU,EAAE,MAAM,4BAA4B;EAC9C,QAAQ,EAAE,MAAM,0BAA0B;EAC1C,WAAW,EAAE,OAAO;CACxB,CAAC,GACD,EAAE,WAAW,cAAc;EACvB,YAAY,SAAS;EACrB,aAAa,sBAAsB,SAAS,cAAc,YAAY;EACtE,UAAU,SAAS;EACnB,QAAQ,SAAS;EACjB,UAAU,sBAAsB,SAAS,WAAW,OAAO,MAAM,CAAC;CACtE,EAAE,CACN;AACJ"}
1
+ {"version":3,"file":"balances.schemas.js","names":[],"sources":["../../../src/services/balances/balances.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport type * as ProtoLedgerRead from \"../../gen/ledger/read/v1/ledger_read_pb.js\";\nimport { fromU128 } from \"../../utils/u128.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport {\n AccountCodeCodec,\n ACCOUNT_CODE_VALUES,\n type AccountCodeValue,\n} from \"../../shared/ledger-codes.js\";\nimport { E18_SCALE, scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { BalanceRangeCodec, EquityGroupByCodec } from \"./balances.codecs.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { PublicIdSchema, U128Schema } from \"../../shared/schemas.js\";\n\n/**\n * Equity history values are quoted in the response's quote currency at a fixed\n * 4-decimal wire scale (proto: \"Equity in quote currency scaled by 1e4\").\n */\nconst EQUITY_SCALE = 4;\n\n/**\n * AssetBalance u128 fields on the ledger wire are always 18-decimal scaled\n * (PolyesterChain base units), independent of per-asset quantityScale used\n * elsewhere for order quantities and transfer inputs.\n */\nconst LedgerBalanceFieldsSchema = v.object({\n assetId: v.number(),\n trading: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n funding: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n reserved: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n available: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n tradingRevision: v.pipe(\n v.optional(v.bigint(), 0n),\n v.transform((value) => value.toString()),\n ),\n fundingRevision: v.pipe(\n v.optional(v.bigint(), 0n),\n v.transform((value) => value.toString()),\n ),\n});\n\nfunction toLedgerBalance(b: v.InferOutput<typeof LedgerBalanceFieldsSchema>) {\n return {\n assetId: b.assetId,\n funding: scaledToDecimalOutput(b.funding ?? 0n, E18_SCALE),\n trading: scaledToDecimalOutput(b.trading ?? 0n, E18_SCALE),\n reserved: scaledToDecimalOutput(b.reserved ?? 0n, E18_SCALE),\n available: scaledToDecimalOutput(b.available ?? 0n, E18_SCALE),\n tradingRevision: b.tradingRevision,\n fundingRevision: b.fundingRevision,\n };\n}\n\nexport function createLedgerBalanceSchema() {\n return v.pipe(LedgerBalanceFieldsSchema, v.transform(toLedgerBalance));\n}\n\n/**\n * Converts a `ledger.read.v1.AssetBalance` message to the `LedgerBalance` that `balances.list`\n * returns. Its U128 amounts are always at the 18-decimal ledger scale, whatever the asset's own\n * decimals, so the result needs no catalog.\n */\nexport function formatLedgerBalance(b: ProtoLedgerRead.AssetBalance): LedgerBalance {\n return toLedgerBalance({\n assetId: b.assetId,\n trading: fromU128(b.trading),\n funding: fromU128(b.funding),\n reserved: fromU128(b.reserved),\n available: fromU128(b.available),\n tradingRevision: (b.tradingRevision ?? 0n).toString(),\n fundingRevision: (b.fundingRevision ?? 0n).toString(),\n });\n}\n\nexport type LedgerBalance = v.InferOutput<ReturnType<typeof createLedgerBalanceSchema>>;\n\nexport const BalancesListInputSchema = v.strictObject(AccountScopeInputEntries);\n\nexport type BalancesListInput = v.InferInput<typeof BalancesListInputSchema>;\n\nexport const BALANCE_RANGES = [\"1d\", \"7d\", \"30d\", \"90d\", \"180d\", \"365d\"] as const;\n\nexport const BalanceRangeSchema = v.picklist(BALANCE_RANGES);\n\nexport type BalanceRange = v.InferOutput<typeof BalanceRangeSchema>;\n\nconst BalanceRangeInputSchema = v.pipe(\n BalanceRangeSchema,\n v.transform((value) => BalanceRangeCodec.inputToProto[value]),\n);\n\nexport const EQUITY_GROUP_BYS = [\"account\", \"asset\"] as const;\n\nexport const EquityGroupBySchema = v.picklist(EQUITY_GROUP_BYS);\n\nexport type EquityGroupBy = v.InferOutput<typeof EquityGroupBySchema>;\n\nexport const BalanceHistoryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n range: BalanceRangeInputSchema,\n ledger: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(4_294_967_295)),\n 0,\n ),\n accountCodes: v.optional(\n v.array(\n v.pipe(\n v.picklist(ACCOUNT_CODE_VALUES),\n v.transform((value) => AccountCodeCodec.inputToProto[value]),\n ),\n ),\n [],\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type BalanceHistoryInput = v.InferInput<typeof BalanceHistoryInputSchema>;\n\nconst BalanceSeriesSchema = v.object({\n assetId: v.number(),\n accountCode: v.number(),\n /** One exact 18-decimal U128 balance per point, like live ledger balances. */\n balance: v.array(U128Schema),\n});\n\nexport function createBalanceHistoryResponseSchema() {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n points: v.number(),\n series: v.array(BalanceSeriesSchema),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n points: data.points,\n series: data.series.map((s) => {\n return {\n assetId: s.assetId,\n accountCode: enumLabel(AccountCodeCodec.protoToOutput, s.accountCode),\n balance: s.balance.map((b) => scaledToDecimalOutput(fromU128(b), E18_SCALE)),\n };\n }),\n })),\n );\n}\n\nexport type BalanceHistoryResponse = v.InferOutput<\n ReturnType<typeof createBalanceHistoryResponseSchema>\n>;\n\nexport const EquityHistoryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n range: BalanceRangeInputSchema,\n accountCodes: v.optional(\n v.array(\n v.pipe(\n v.picklist(ACCOUNT_CODE_VALUES),\n v.transform((value) => AccountCodeCodec.inputToProto[value]),\n ),\n ),\n [],\n ),\n groupBy: v.pipe(\n v.optional(EquityGroupBySchema, \"account\"),\n v.transform((v) => EquityGroupByCodec.inputToProto[v ?? \"account\"]),\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type EquityHistoryInput = v.InferInput<typeof EquityHistoryInputSchema>;\n\nexport const PortfolioEquityHistoryInputSchema = v.strictObject({\n range: BalanceRangeInputSchema,\n});\n\nexport type PortfolioEquityHistoryInput = v.InferInput<typeof PortfolioEquityHistoryInputSchema>;\n\nconst EquitySeriesGroupingSchema = v.union([\n v.object({\n case: v.literal(\"account\"),\n value: v.object({\n accountCode: v.number(),\n name: v.string(),\n }),\n }),\n v.object({\n case: v.literal(\"asset\"),\n value: v.object({\n id: v.number(),\n symbol: v.string(),\n }),\n }),\n]);\n\nexport type EquitySeriesGrouping =\n | {\n type: \"account\";\n accountCode: DecodedEnum<AccountCodeValue>;\n name: string;\n }\n | {\n type: \"asset\";\n assetId: number;\n symbol: string;\n };\n\nexport const EquitySeriesSchema = v.pipe(\n v.object({\n grouping: EquitySeriesGroupingSchema,\n equityQ: v.array(v.bigint()),\n }),\n v.transform((series): { grouping: EquitySeriesGrouping; equity: string[] } => {\n const equity = series.equityQ.map((value) => scaledToDecimalOutput(value, EQUITY_SCALE));\n if (series.grouping.case === \"account\") {\n return {\n grouping: {\n type: \"account\",\n accountCode: enumLabel(\n AccountCodeCodec.protoToOutput,\n series.grouping.value.accountCode,\n ),\n name: series.grouping.value.name,\n },\n equity,\n };\n }\n\n return {\n grouping: {\n type: \"asset\",\n assetId: series.grouping.value.id,\n symbol: series.grouping.value.symbol,\n },\n equity,\n };\n }),\n);\n\nexport function createEquityHistoryResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n quoteAsset: v.string(),\n points: v.number(),\n series: v.array(EquitySeriesSchema),\n btcPricesQ: v.optional(v.array(v.bigint()), []),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n quoteAsset: data.quoteAsset,\n points: data.points,\n series: data.series,\n // BTC price in USDT at each timestamp, carried as price ticks on the wire.\n btcPrices: data.btcPricesQ.map((value) => scaledToDecimalOutput(value, scales.price())),\n })),\n );\n}\n\nexport type EquitySeries = v.InferOutput<typeof EquitySeriesSchema>;\nexport type EquityHistoryResponse = v.InferOutput<\n ReturnType<typeof createEquityHistoryResponseSchema>\n>;\n\nconst PortfolioAccountGroupingSchema = v.variant(\"remaining\", [\n v.object({\n accountId: PublicIdSchema,\n remaining: v.literal(false),\n }),\n v.object({\n accountId: v.optional(v.never()),\n remaining: v.literal(true),\n }),\n]);\n\nexport type PortfolioEquitySeriesGrouping =\n | { type: \"portfolioAccount\"; accountId: string; remaining: false }\n | { type: \"portfolioAccount\"; accountId?: never; remaining: true };\n\nexport const PortfolioEquitySeriesSchema = v.pipe(\n v.object({\n grouping: v.object({\n case: v.literal(\"portfolioAccount\"),\n value: PortfolioAccountGroupingSchema,\n }),\n equityQ: v.array(v.bigint()),\n }),\n v.transform((series): { grouping: PortfolioEquitySeriesGrouping; equity: string[] } => ({\n grouping: series.grouping.value.remaining\n ? { type: \"portfolioAccount\", remaining: true }\n : {\n type: \"portfolioAccount\",\n accountId: series.grouping.value.accountId,\n remaining: false,\n },\n equity: series.equityQ.map((value) => scaledToDecimalOutput(value, EQUITY_SCALE)),\n })),\n);\n\nexport function createPortfolioEquityHistoryResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n quoteAsset: v.string(),\n points: v.number(),\n series: v.array(PortfolioEquitySeriesSchema),\n btcPricesQ: v.optional(v.array(v.bigint()), []),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n quoteAsset: data.quoteAsset,\n points: data.points,\n series: data.series,\n btcPrices: data.btcPricesQ.map((value) => scaledToDecimalOutput(value, scales.price())),\n })),\n );\n}\n\nexport type PortfolioEquitySeries = v.InferOutput<typeof PortfolioEquitySeriesSchema>;\nexport type PortfolioEquityHistoryResponse = v.InferOutput<\n ReturnType<typeof createPortfolioEquityHistoryResponseSchema>\n>;\n\nconst PortfolioAccountEquitySchema = v.pipe(\n v.object({\n accountId: PublicIdSchema,\n equityQ: v.bigint(),\n topAssetIds: v.array(v.number()),\n }),\n v.transform((account) => ({\n accountId: account.accountId,\n equity: scaledToDecimalOutput(account.equityQ, EQUITY_SCALE),\n topAssetIds: account.topAssetIds,\n })),\n);\n\nconst PortfolioAssetEquitySchema = v.pipe(\n v.object({\n assetId: v.number(),\n balance: v.optional(U128Schema),\n equityQ: v.bigint(),\n }),\n v.transform((asset) => ({\n assetId: asset.assetId,\n balance: scaledToDecimalOutput(fromU128(asset.balance), E18_SCALE),\n equity: scaledToDecimalOutput(asset.equityQ, EQUITY_SCALE),\n })),\n);\n\nexport function createPortfolioEquitySnapshotResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n quoteAsset: v.string(),\n totalEquityQ: v.bigint(),\n accounts: v.array(PortfolioAccountEquitySchema),\n assets: v.array(PortfolioAssetEquitySchema),\n btcPriceQ: v.bigint(),\n }),\n v.transform((snapshot) => ({\n quoteAsset: snapshot.quoteAsset,\n totalEquity: scaledToDecimalOutput(snapshot.totalEquityQ, EQUITY_SCALE),\n accounts: snapshot.accounts,\n assets: snapshot.assets,\n btcPrice: scaledToDecimalOutput(snapshot.btcPriceQ, scales.price()),\n })),\n );\n}\n\nexport type PortfolioEquitySnapshotResponse = v.InferOutput<\n ReturnType<typeof createPortfolioEquitySnapshotResponseSchema>\n>;\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAM,eAAe;;;;;;AAOrB,MAAM,4BAA4B,EAAE,OAAO;CACvC,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC7D,SAAS,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC7D,UAAU,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC9D,WAAW,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC/D,iBAAiB,EAAE,KACf,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE,GACzB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CACxB,CAAC,GACD,EAAE,WAAW,cAAc;EACvB,YAAY,SAAS;EACrB,aAAa,sBAAsB,SAAS,cAAc,YAAY;EACtE,UAAU,SAAS;EACnB,QAAQ,SAAS;EACjB,UAAU,sBAAsB,SAAS,WAAW,OAAO,MAAM,CAAC;CACtE,EAAE,CACN;AACJ"}
@@ -1,2 +1,2 @@
1
- import { BalanceHistoryInput, BalanceHistoryResponse, BalanceRange, EquityGroupBy, EquityHistoryInput, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, ExportStatementInput, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySnapshotResponse, Statement, StatementPage } from "./balances.schemas.js";
2
- export type { BalanceHistoryInput, BalanceHistoryResponse, BalanceRange, EquityGroupBy, EquityHistoryInput, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, ExportStatementInput, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySnapshotResponse, Statement, StatementPage };
1
+ import { BalanceHistoryInput, BalanceHistoryResponse, BalanceRange, EquityGroupBy, EquityHistoryInput, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySnapshotResponse } from "./balances.schemas.js";
2
+ export type { BalanceHistoryInput, BalanceHistoryResponse, BalanceRange, EquityGroupBy, EquityHistoryInput, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySnapshotResponse };
@@ -11,7 +11,7 @@ type TimestampInit = {
11
11
  };
12
12
  declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
13
13
  readonly symbolId: v.NumberSchema<undefined>;
14
- readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">>]>;
14
+ readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1mo">>]>;
15
15
  readonly tsSec: v.BigintSchema<undefined>;
16
16
  readonly open: v.BigintSchema<undefined>;
17
17
  readonly high: v.BigintSchema<undefined>;
@@ -22,7 +22,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
22
22
  readonly isClosed: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
23
23
  }, undefined>, v.TransformAction<{
24
24
  symbolId: number;
25
- timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
25
+ timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1mo">;
26
26
  tsSec: bigint;
27
27
  open: bigint;
28
28
  high: bigint;
@@ -33,7 +33,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
33
33
  isClosed: boolean;
34
34
  }, {
35
35
  symbolId: number;
36
- timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
36
+ timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1mo">;
37
37
  time: number;
38
38
  open: string;
39
39
  high: string;
@@ -46,7 +46,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
46
46
  declare const createCandleRowIntSchema: typeof createCandleRowSchema;
47
47
  declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
48
48
  readonly symbolId: v.NumberSchema<undefined>;
49
- readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">>]>;
49
+ readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1mo">>]>;
50
50
  readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
51
51
  readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
52
52
  readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
@@ -63,7 +63,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
63
63
  readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
64
64
  }, undefined>, v.TransformAction<{
65
65
  symbolId: number;
66
- timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
66
+ timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1mo">;
67
67
  tsSec: bigint[];
68
68
  open: bigint[];
69
69
  high: bigint[];
@@ -80,7 +80,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
80
80
  nextPageToken: string;
81
81
  }, {
82
82
  symbolId: number;
83
- timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
83
+ timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1mo">;
84
84
  time: number[];
85
85
  open: string[];
86
86
  high: string[];
@@ -100,7 +100,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
100
100
  }>]>;
101
101
  declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
102
102
  readonly symbolId: v.NumberSchema<undefined>;
103
- readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">>]>;
103
+ readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1mo">>]>;
104
104
  readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
105
105
  readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
106
106
  readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
@@ -117,7 +117,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
117
117
  readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
118
118
  }, undefined>, v.TransformAction<{
119
119
  symbolId: number;
120
- timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
120
+ timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1mo">;
121
121
  tsSec: bigint[];
122
122
  open: bigint[];
123
123
  high: bigint[];
@@ -134,7 +134,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
134
134
  nextPageToken: string;
135
135
  }, {
136
136
  symbolId: number;
137
- timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
137
+ timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1mo">;
138
138
  tsSec: number[];
139
139
  open: string[];
140
140
  high: string[];
@@ -158,7 +158,7 @@ type CandleColumnar = v.InferOutput<ReturnType<typeof createCandleColumnarSchema
158
158
  type CandleColumnarInt = v.InferOutput<ReturnType<typeof createCandleColumnarIntSchema>>;
159
159
  declare function createListCandlesInputSchema(): v.SchemaWithPipe<readonly [v.ObjectSchema<{
160
160
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
161
- readonly timeframe: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1s", "1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "12h", "1d", "3d", "1w", "1mo"], undefined>, v.TransformAction<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo", Timeframe$1.SEC_1 | Timeframe$1.MIN_1 | Timeframe$1.MIN_3 | Timeframe$1.MIN_5 | Timeframe$1.MIN_15 | Timeframe$1.MIN_30 | Timeframe$1.HOUR_1 | Timeframe$1.HOUR_2 | Timeframe$1.HOUR_4 | Timeframe$1.HOUR_6 | Timeframe$1.HOUR_8 | Timeframe$1.HOUR_12 | Timeframe$1.DAY_1 | Timeframe$1.DAY_3 | Timeframe$1.WEEK_1 | Timeframe$1.MONTH_1>]>;
161
+ readonly timeframe: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1s", "1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "12h", "1d", "3d", "1w", "1mo"], undefined>, v.TransformAction<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1mo", Timeframe$1.SEC_1 | Timeframe$1.MIN_1 | Timeframe$1.MIN_3 | Timeframe$1.MIN_5 | Timeframe$1.MIN_15 | Timeframe$1.MIN_30 | Timeframe$1.HOUR_1 | Timeframe$1.HOUR_2 | Timeframe$1.HOUR_4 | Timeframe$1.HOUR_6 | Timeframe$1.HOUR_8 | Timeframe$1.HOUR_12 | Timeframe$1.DAY_1 | Timeframe$1.DAY_3 | Timeframe$1.WEEK_1 | Timeframe$1.MONTH_1>]>;
162
162
  readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 10000, undefined>]>, undefined>;
163
163
  readonly includeIncomplete: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
164
164
  readonly includeReference: v.OptionalSchema<v.BooleanSchema<undefined>, false>;