@polyester/sdk 0.31.0 → 0.32.0-devnet-20261102134326

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 (378) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +7 -0
  3. package/dist/browser-core.d.ts.map +1 -1
  4. package/dist/browser-core.js.map +1 -1
  5. package/dist/catalogs/market-data-catalog.d.ts +2 -0
  6. package/dist/catalogs/market-data-catalog.d.ts.map +1 -1
  7. package/dist/catalogs/market-data-catalog.js +1 -0
  8. package/dist/catalogs/market-data-catalog.js.map +1 -1
  9. package/dist/catalogs/snapshot-validation.js +6 -0
  10. package/dist/catalogs/snapshot-validation.js.map +1 -1
  11. package/dist/client.d.ts +2 -2
  12. package/dist/client.js +2 -2
  13. package/dist/client.js.map +1 -1
  14. package/dist/core-client.d.ts.map +1 -1
  15. package/dist/core-client.js +1 -0
  16. package/dist/core-client.js.map +1 -1
  17. package/dist/gen/auth/v1/api_keys_pb.d.ts +6 -3
  18. package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
  19. package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
  20. package/dist/gen/auth/v1/auth_pb.d.ts +16 -2
  21. package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
  22. package/dist/gen/auth/v1/auth_pb.js +16 -2
  23. package/dist/gen/auth/v1/auth_pb.js.map +1 -1
  24. package/dist/gen/auth/v1/policies_pb.d.ts +26 -2
  25. package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
  26. package/dist/gen/auth/v1/policies_pb.js +26 -2
  27. package/dist/gen/auth/v1/policies_pb.js.map +1 -1
  28. package/dist/gen/auth/v1/subaccounts_pb.d.ts +41 -17
  29. package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
  30. package/dist/gen/auth/v1/subaccounts_pb.js +20 -3
  31. package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
  32. package/dist/gen/chain/analytics/v1/analytics_read_pb.d.ts.map +1 -1
  33. package/dist/gen/chain/analytics/v1/analytics_read_pb.js +2 -1
  34. package/dist/gen/chain/analytics/v1/analytics_read_pb.js.map +1 -1
  35. package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +10 -6
  36. package/dist/gen/chain/deposit/v1/deposit_pb.d.ts.map +1 -1
  37. package/dist/gen/chain/deposit/v1/deposit_pb.js +2 -1
  38. package/dist/gen/chain/deposit/v1/deposit_pb.js.map +1 -1
  39. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +32 -2
  40. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
  41. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js +2 -2
  42. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
  43. package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +19 -3
  44. package/dist/gen/chain/lifecycle/v1/types_pb.d.ts.map +1 -1
  45. package/dist/gen/chain/lifecycle/v1/types_pb.js +18 -2
  46. package/dist/gen/chain/lifecycle/v1/types_pb.js.map +1 -1
  47. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +840 -0
  48. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -0
  49. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js +351 -0
  50. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -0
  51. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +22 -2
  52. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
  53. package/dist/gen/chain/withdraw/v1/withdraw_pb.js +17 -1
  54. package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
  55. package/dist/gen/chain/zipper/v1/reason_pb.d.ts +14 -0
  56. package/dist/gen/chain/zipper/v1/reason_pb.d.ts.map +1 -1
  57. package/dist/gen/chain/zipper/v1/reason_pb.js +15 -1
  58. package/dist/gen/chain/zipper/v1/reason_pb.js.map +1 -1
  59. package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts +1134 -0
  60. package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts.map +1 -0
  61. package/dist/gen/checkpoints/v1/checkpoints_pb.js +327 -0
  62. package/dist/gen/checkpoints/v1/checkpoints_pb.js.map +1 -0
  63. package/dist/gen/claims/v1/claims_pb.d.ts +61 -4
  64. package/dist/gen/claims/v1/claims_pb.d.ts.map +1 -1
  65. package/dist/gen/claims/v1/claims_pb.js +26 -1
  66. package/dist/gen/claims/v1/claims_pb.js.map +1 -1
  67. package/dist/gen/fees/v1/fees_pb.d.ts.map +1 -1
  68. package/dist/gen/fees/v1/fees_pb.js +2 -1
  69. package/dist/gen/fees/v1/fees_pb.js.map +1 -1
  70. package/dist/gen/index.d.ts +7 -5
  71. package/dist/gen/index.js +12 -10
  72. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +45 -3
  73. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
  74. package/dist/gen/ledger/read/v1/ledger_read_pb.js +19 -7
  75. package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
  76. package/dist/gen/marketdata/v1/marketdata_pb.d.ts +248 -27
  77. package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
  78. package/dist/gen/marketdata/v1/marketdata_pb.js +73 -20
  79. package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
  80. package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +2 -1
  81. package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts.map +1 -1
  82. package/dist/gen/marketoverview/v1/marketoverview_pb.js.map +1 -1
  83. package/dist/gen/orderbook/v1/orderbook_pb.d.ts +16 -4
  84. package/dist/gen/orderbook/v1/orderbook_pb.d.ts.map +1 -1
  85. package/dist/gen/orderbook/v1/orderbook_pb.js +1 -1
  86. package/dist/gen/orderbook/v1/orderbook_pb.js.map +1 -1
  87. package/dist/gen/orders/v1/orders_pb.d.ts +1222 -63
  88. package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
  89. package/dist/gen/orders/v1/orders_pb.js +971 -44
  90. package/dist/gen/orders/v1/orders_pb.js.map +1 -1
  91. package/dist/gen/orders/v1/orders_read_pb.d.ts +214 -25
  92. package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
  93. package/dist/gen/orders/v1/orders_read_pb.js +159 -20
  94. package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
  95. package/dist/gen/polyester/api/options_pb.d.ts +8 -1
  96. package/dist/gen/polyester/api/options_pb.d.ts.map +1 -1
  97. package/dist/gen/polyester/api/options_pb.js +8 -1
  98. package/dist/gen/polyester/api/options_pb.js.map +1 -1
  99. package/dist/gen/privatews/v1/private_ws_pb.d.ts +1419 -0
  100. package/dist/gen/privatews/v1/private_ws_pb.d.ts.map +1 -0
  101. package/dist/gen/privatews/v1/private_ws_pb.js +551 -0
  102. package/dist/gen/privatews/v1/private_ws_pb.js.map +1 -0
  103. package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +1 -0
  104. package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts.map +1 -1
  105. package/dist/gen/ratelimit/v1/ratelimit_pb.js +1 -1
  106. package/dist/gen/ratelimit/v1/ratelimit_pb.js.map +1 -1
  107. package/dist/gen/rewards/v1/rewards_pb.d.ts +6 -0
  108. package/dist/gen/rewards/v1/rewards_pb.d.ts.map +1 -1
  109. package/dist/gen/rewards/v1/rewards_pb.js +1 -1
  110. package/dist/gen/rewards/v1/rewards_pb.js.map +1 -1
  111. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +2108 -0
  112. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -0
  113. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +522 -0
  114. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -0
  115. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +2296 -0
  116. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -0
  117. package/dist/gen/swap/quickswap/v1/quickswap_pb.js +1014 -0
  118. package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -0
  119. package/dist/gen/swap/v1/swap_pb.d.ts +958 -0
  120. package/dist/gen/swap/v1/swap_pb.d.ts.map +1 -0
  121. package/dist/gen/swap/v1/swap_pb.js +434 -0
  122. package/dist/gen/swap/v1/swap_pb.js.map +1 -0
  123. package/dist/gen/tradews/v1/trade_ws_pb.d.ts +68 -3
  124. package/dist/gen/tradews/v1/trade_ws_pb.d.ts.map +1 -1
  125. package/dist/gen/tradews/v1/trade_ws_pb.js +1 -1
  126. package/dist/gen/tradews/v1/trade_ws_pb.js.map +1 -1
  127. package/dist/gen/triggers/v1/triggers_pb.d.ts +612 -33
  128. package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
  129. package/dist/gen/triggers/v1/triggers_pb.js +437 -20
  130. package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
  131. package/dist/gen/vip/v1/vip_pb.d.ts +95 -7
  132. package/dist/gen/vip/v1/vip_pb.d.ts.map +1 -1
  133. package/dist/gen/vip/v1/vip_pb.js +53 -5
  134. package/dist/gen/vip/v1/vip_pb.js.map +1 -1
  135. package/dist/index.d.ts +9 -7
  136. package/dist/index.js +2 -2
  137. package/dist/realtime/client.d.ts +3 -0
  138. package/dist/realtime/client.d.ts.map +1 -1
  139. package/dist/realtime/client.js +76 -24
  140. package/dist/realtime/client.js.map +1 -1
  141. package/dist/realtime/index.d.ts +2 -1
  142. package/dist/realtime/private-orders.d.ts +38 -0
  143. package/dist/realtime/private-orders.d.ts.map +1 -0
  144. package/dist/realtime/private-orders.js +594 -0
  145. package/dist/realtime/private-orders.js.map +1 -0
  146. package/dist/realtime/ready-gated-subscription.js +10 -4
  147. package/dist/realtime/ready-gated-subscription.js.map +1 -1
  148. package/dist/realtime/types.d.ts +3 -0
  149. package/dist/realtime/types.d.ts.map +1 -1
  150. package/dist/services/auth/account-signer-auth.d.ts +5 -3
  151. package/dist/services/auth/account-signer-auth.d.ts.map +1 -1
  152. package/dist/services/auth/account-signer-auth.js +21 -3
  153. package/dist/services/auth/account-signer-auth.js.map +1 -1
  154. package/dist/services/auth/profile/profile.schemas.js +1 -1
  155. package/dist/services/balances/balances.js +1 -1
  156. package/dist/services/balances/balances.schemas.d.ts +3 -3
  157. package/dist/services/candles/candles.codecs.js +15 -0
  158. package/dist/services/candles/candles.codecs.js.map +1 -1
  159. package/dist/services/candles/candles.schemas.d.ts +13 -13
  160. package/dist/services/checkpoints/checkpoints.codecs.d.ts +8 -0
  161. package/dist/services/checkpoints/checkpoints.codecs.d.ts.map +1 -0
  162. package/dist/services/checkpoints/checkpoints.codecs.js +36 -0
  163. package/dist/services/checkpoints/checkpoints.codecs.js.map +1 -0
  164. package/dist/services/checkpoints/checkpoints.d.ts +22 -0
  165. package/dist/services/checkpoints/checkpoints.d.ts.map +1 -0
  166. package/dist/services/checkpoints/checkpoints.js +31 -0
  167. package/dist/services/checkpoints/checkpoints.js.map +1 -0
  168. package/dist/services/checkpoints/checkpoints.schemas.d.ts +437 -0
  169. package/dist/services/checkpoints/checkpoints.schemas.d.ts.map +1 -0
  170. package/dist/services/checkpoints/checkpoints.schemas.js +176 -0
  171. package/dist/services/checkpoints/checkpoints.schemas.js.map +1 -0
  172. package/dist/services/checkpoints/checkpoints.types.d.ts +3 -0
  173. package/dist/services/checkpoints/service.d.ts +8 -0
  174. package/dist/services/checkpoints/service.d.ts.map +1 -0
  175. package/dist/services/checkpoints/service.js +9 -0
  176. package/dist/services/checkpoints/service.js.map +1 -0
  177. package/dist/services/claims/claims.codecs.d.ts +1 -1
  178. package/dist/services/claims/claims.codecs.d.ts.map +1 -1
  179. package/dist/services/claims/claims.codecs.js +2 -1
  180. package/dist/services/claims/claims.codecs.js.map +1 -1
  181. package/dist/services/claims/claims.d.ts +13 -5
  182. package/dist/services/claims/claims.d.ts.map +1 -1
  183. package/dist/services/claims/claims.js +15 -6
  184. package/dist/services/claims/claims.js.map +1 -1
  185. package/dist/services/claims/claims.schemas.d.ts +13 -3
  186. package/dist/services/claims/claims.schemas.d.ts.map +1 -1
  187. package/dist/services/claims/claims.schemas.js +10 -4
  188. package/dist/services/claims/claims.schemas.js.map +1 -1
  189. package/dist/services/claims/claims.types.d.ts +2 -2
  190. package/dist/services/heatmap/heatmap.schemas.d.ts +13 -13
  191. package/dist/services/lifecycle/lifecycle.codecs.d.ts +1 -1
  192. package/dist/services/lifecycle/lifecycle.codecs.d.ts.map +1 -1
  193. package/dist/services/lifecycle/lifecycle.codecs.js +4 -2
  194. package/dist/services/lifecycle/lifecycle.codecs.js.map +1 -1
  195. package/dist/services/lifecycle/lifecycle.schemas.d.ts +185 -135
  196. package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
  197. package/dist/services/lifecycle/lifecycle.schemas.js +7 -1
  198. package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
  199. package/dist/services/market-data/market-data.codecs.js +2 -1
  200. package/dist/services/market-data/market-data.codecs.js.map +1 -1
  201. package/dist/services/market-data/market-data.d.ts +10 -1
  202. package/dist/services/market-data/market-data.d.ts.map +1 -1
  203. package/dist/services/market-data/market-data.js +21 -9
  204. package/dist/services/market-data/market-data.js.map +1 -1
  205. package/dist/services/market-data/market-data.schemas.d.ts +29 -2
  206. package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
  207. package/dist/services/market-data/market-data.schemas.js +53 -4
  208. package/dist/services/market-data/market-data.schemas.js.map +1 -1
  209. package/dist/services/market-data/market-data.types.d.ts +2 -2
  210. package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
  211. package/dist/services/orderbook/orderbook.d.ts +2 -1
  212. package/dist/services/orderbook/orderbook.d.ts.map +1 -1
  213. package/dist/services/orderbook/orderbook.js +17 -2
  214. package/dist/services/orderbook/orderbook.js.map +1 -1
  215. package/dist/services/orderbook/orderbook.schemas.d.ts +5 -1
  216. package/dist/services/orderbook/orderbook.schemas.d.ts.map +1 -1
  217. package/dist/services/orderbook/orderbook.schemas.js +2 -0
  218. package/dist/services/orderbook/orderbook.schemas.js.map +1 -1
  219. package/dist/services/orders/order-enums.codecs.js +7 -1
  220. package/dist/services/orders/order-enums.codecs.js.map +1 -1
  221. package/dist/services/orders/order-errors.schemas.d.ts +4 -2
  222. package/dist/services/orders/order-errors.schemas.d.ts.map +1 -1
  223. package/dist/services/orders/order-errors.schemas.js +4 -1
  224. package/dist/services/orders/order-errors.schemas.js.map +1 -1
  225. package/dist/services/orders/orders-batch.schemas.d.ts +375 -54
  226. package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
  227. package/dist/services/orders/orders-batch.schemas.js +12 -2
  228. package/dist/services/orders/orders-batch.schemas.js.map +1 -1
  229. package/dist/services/orders/orders-input.schemas.d.ts +551 -9
  230. package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
  231. package/dist/services/orders/orders-input.schemas.js +23 -5
  232. package/dist/services/orders/orders-input.schemas.js.map +1 -1
  233. package/dist/services/orders/orders-modify.schemas.d.ts +106 -1
  234. package/dist/services/orders/orders-modify.schemas.d.ts.map +1 -1
  235. package/dist/services/orders/orders-modify.schemas.js +1 -1
  236. package/dist/services/orders/orders-output.schemas.d.ts +80 -61
  237. package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
  238. package/dist/services/orders/orders-output.schemas.js +15 -22
  239. package/dist/services/orders/orders-output.schemas.js.map +1 -1
  240. package/dist/services/orders/orders-risk.schemas.d.ts +69 -1
  241. package/dist/services/orders/orders-risk.schemas.d.ts.map +1 -1
  242. package/dist/services/orders/orders-risk.schemas.js +21 -11
  243. package/dist/services/orders/orders-risk.schemas.js.map +1 -1
  244. package/dist/services/orders/orders.codecs.js +26 -2
  245. package/dist/services/orders/orders.codecs.js.map +1 -1
  246. package/dist/services/orders/orders.d.ts +31 -5
  247. package/dist/services/orders/orders.d.ts.map +1 -1
  248. package/dist/services/orders/orders.js +53 -15
  249. package/dist/services/orders/orders.js.map +1 -1
  250. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
  251. package/dist/services/policies/shared.codecs.js +8 -2
  252. package/dist/services/policies/shared.codecs.js.map +1 -1
  253. package/dist/services/policies/shared.d.ts +1 -1
  254. package/dist/services/policies/shared.d.ts.map +1 -1
  255. package/dist/services/policies/shared.js +4 -1
  256. package/dist/services/policies/shared.js.map +1 -1
  257. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +9 -9
  258. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +1 -1
  259. package/dist/services/subaccounts/subaccounts.codecs.js +4 -1
  260. package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
  261. package/dist/services/subaccounts/subaccounts.d.ts +1 -1
  262. package/dist/services/subaccounts/subaccounts.d.ts.map +1 -1
  263. package/dist/services/subaccounts/subaccounts.js +1 -2
  264. package/dist/services/subaccounts/subaccounts.js.map +1 -1
  265. package/dist/services/subaccounts/subaccounts.schemas.d.ts +10 -10
  266. package/dist/services/trades/trades.d.ts +2 -0
  267. package/dist/services/trades/trades.d.ts.map +1 -1
  268. package/dist/services/trades/trades.js +6 -6
  269. package/dist/services/trades/trades.js.map +1 -1
  270. package/dist/services/trades/trades.schemas.d.ts +2 -2
  271. package/dist/services/trades/trades.schemas.js +1 -1
  272. package/dist/services/trading-withdraws/trading-withdraws.d.ts +9 -5
  273. package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
  274. package/dist/services/trading-withdraws/trading-withdraws.js +45 -26
  275. package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
  276. package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +12 -0
  277. package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
  278. package/dist/services/trading-withdraws/trading-withdraws.schemas.js +26 -6
  279. package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
  280. package/dist/services/trailing-oneof-inputs.js +6 -1
  281. package/dist/services/trailing-oneof-inputs.js.map +1 -1
  282. package/dist/services/transfers/transfers.d.ts +2 -0
  283. package/dist/services/transfers/transfers.d.ts.map +1 -1
  284. package/dist/services/transfers/transfers.js +6 -11
  285. package/dist/services/transfers/transfers.js.map +1 -1
  286. package/dist/services/transfers/transfers.schemas.d.ts +4 -1
  287. package/dist/services/transfers/transfers.schemas.d.ts.map +1 -1
  288. package/dist/services/transfers/transfers.schemas.js +3 -1
  289. package/dist/services/transfers/transfers.schemas.js.map +1 -1
  290. package/dist/services/triggers/trigger-child-order.schemas.js +23 -18
  291. package/dist/services/triggers/trigger-child-order.schemas.js.map +1 -1
  292. package/dist/services/triggers/trigger-input.schemas.d.ts +291 -28
  293. package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
  294. package/dist/services/triggers/trigger-input.schemas.js +38 -22
  295. package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
  296. package/dist/services/triggers/triggers-output.schemas.d.ts +183 -59
  297. package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
  298. package/dist/services/triggers/triggers-output.schemas.js +28 -20
  299. package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
  300. package/dist/services/triggers/triggers.codecs.js +66 -3
  301. package/dist/services/triggers/triggers.codecs.js.map +1 -1
  302. package/dist/services/triggers/triggers.d.ts +6 -2
  303. package/dist/services/triggers/triggers.d.ts.map +1 -1
  304. package/dist/services/triggers/triggers.js +10 -8
  305. package/dist/services/triggers/triggers.js.map +1 -1
  306. package/dist/services/vip/vip.js +1 -1
  307. package/dist/services/vip/vip.schemas.d.ts +23 -1
  308. package/dist/services/vip/vip.schemas.d.ts.map +1 -1
  309. package/dist/services/vip/vip.schemas.js +20 -2
  310. package/dist/services/vip/vip.schemas.js.map +1 -1
  311. package/dist/services/vip/vip.types.d.ts +2 -2
  312. package/dist/shared/catalog-config.d.ts +14 -2
  313. package/dist/shared/catalog-config.d.ts.map +1 -1
  314. package/dist/shared/catalog-config.js +2 -1
  315. package/dist/shared/catalog-config.js.map +1 -1
  316. package/dist/shared/connect-error-mapping.d.ts +3 -0
  317. package/dist/shared/connect-error-mapping.d.ts.map +1 -1
  318. package/dist/shared/connect-error-mapping.js +45 -6
  319. package/dist/shared/connect-error-mapping.js.map +1 -1
  320. package/dist/shared/errors.d.ts +79 -6
  321. package/dist/shared/errors.d.ts.map +1 -1
  322. package/dist/shared/errors.js +92 -4
  323. package/dist/shared/errors.js.map +1 -1
  324. package/dist/shared/rate-limit.schemas.d.ts +1 -1
  325. package/dist/shared/request-options.d.ts +7 -0
  326. package/dist/shared/request-options.d.ts.map +1 -1
  327. package/dist/shared/request-options.js +6 -1
  328. package/dist/shared/request-options.js.map +1 -1
  329. package/dist/shared/schemas.js +1 -1
  330. package/dist/shared/subscription-errors.js +12 -1
  331. package/dist/shared/subscription-errors.js.map +1 -1
  332. package/dist/shared/transports.d.ts.map +1 -1
  333. package/dist/shared/transports.js +9 -2
  334. package/dist/shared/transports.js.map +1 -1
  335. package/dist/shared/wire-bounds.js +3 -1
  336. package/dist/shared/wire-bounds.js.map +1 -1
  337. package/dist/smart-account/index.d.ts +2 -1
  338. package/dist/smart-account/index.js +2 -1
  339. package/dist/smart-account/smart-account.d.ts +5 -4
  340. package/dist/smart-account/smart-account.d.ts.map +1 -1
  341. package/dist/smart-account/smart-account.js +37 -8
  342. package/dist/smart-account/smart-account.js.map +1 -1
  343. package/dist/utils/numbers.js +4 -1
  344. package/dist/utils/numbers.js.map +1 -1
  345. package/dist/wired-services.js +5 -5
  346. package/dist/wired-services.js.map +1 -1
  347. package/package.json +9 -4
  348. package/dist/gen/collab/v1/whiteboard_pb.d.ts +0 -829
  349. package/dist/gen/collab/v1/whiteboard_pb.d.ts.map +0 -1
  350. package/dist/gen/collab/v1/whiteboard_pb.js +0 -250
  351. package/dist/gen/collab/v1/whiteboard_pb.js.map +0 -1
  352. package/dist/gen/layout/v1/layout_pb.d.ts +0 -1289
  353. package/dist/gen/layout/v1/layout_pb.d.ts.map +0 -1
  354. package/dist/gen/layout/v1/layout_pb.js +0 -313
  355. package/dist/gen/layout/v1/layout_pb.js.map +0 -1
  356. package/dist/gen/polychart/events/v1/polychart_events_pb.d.ts +0 -192
  357. package/dist/gen/polychart/events/v1/polychart_events_pb.d.ts.map +0 -1
  358. package/dist/gen/polychart/events/v1/polychart_events_pb.js +0 -57
  359. package/dist/gen/polychart/events/v1/polychart_events_pb.js.map +0 -1
  360. package/dist/gen/polychart/v1/polychart_pb.d.ts +0 -1208
  361. package/dist/gen/polychart/v1/polychart_pb.d.ts.map +0 -1
  362. package/dist/gen/polychart/v1/polychart_pb.js +0 -244
  363. package/dist/gen/polychart/v1/polychart_pb.js.map +0 -1
  364. package/dist/services/whiteboard/service.d.ts +0 -8
  365. package/dist/services/whiteboard/service.d.ts.map +0 -1
  366. package/dist/services/whiteboard/service.js +0 -9
  367. package/dist/services/whiteboard/service.js.map +0 -1
  368. package/dist/services/whiteboard/whiteboard.codecs.js +0 -55
  369. package/dist/services/whiteboard/whiteboard.codecs.js.map +0 -1
  370. package/dist/services/whiteboard/whiteboard.d.ts +0 -42
  371. package/dist/services/whiteboard/whiteboard.d.ts.map +0 -1
  372. package/dist/services/whiteboard/whiteboard.js +0 -76
  373. package/dist/services/whiteboard/whiteboard.js.map +0 -1
  374. package/dist/services/whiteboard/whiteboard.schemas.d.ts +0 -771
  375. package/dist/services/whiteboard/whiteboard.schemas.d.ts.map +0 -1
  376. package/dist/services/whiteboard/whiteboard.schemas.js +0 -132
  377. package/dist/services/whiteboard/whiteboard.schemas.js.map +0 -1
  378. package/dist/services/whiteboard/whiteboard.types.d.ts +0 -2
@@ -27,7 +27,7 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
27
27
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
28
28
  }, undefined>, undefined>, readonly []>;
29
29
  readonly spotMarketScope: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"all" | "allowlist">>]>;
30
- readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[]>]>;
30
+ readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[]>]>;
31
31
  readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
32
32
  readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
33
33
  readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -50,7 +50,7 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
50
50
  symbolId: number;
51
51
  }[];
52
52
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
53
- actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
53
+ actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
54
54
  isTemplate: boolean;
55
55
  sourceTemplateId?: string | undefined;
56
56
  createdAt: number;
@@ -69,7 +69,7 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
69
69
  symbolId: number;
70
70
  }[];
71
71
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
72
- actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
72
+ actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
73
73
  isTemplate: boolean;
74
74
  sourceTemplateId?: string | undefined;
75
75
  createdAt: number;
@@ -85,7 +85,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
85
85
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
86
86
  }, undefined>, undefined>, readonly []>;
87
87
  readonly spotMarketScope: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"all" | "allowlist">>]>;
88
- readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[]>]>;
88
+ readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[]>]>;
89
89
  readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
90
90
  readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
91
91
  readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -108,7 +108,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
108
108
  symbolId: number;
109
109
  }[];
110
110
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
111
- actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
111
+ actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
112
112
  isTemplate: boolean;
113
113
  sourceTemplateId?: string | undefined;
114
114
  createdAt: number;
@@ -127,7 +127,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
127
127
  symbolId: number;
128
128
  }[];
129
129
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
130
- actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
130
+ actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
131
131
  isTemplate: boolean;
132
132
  sourceTemplateId?: string | undefined;
133
133
  createdAt: number;
@@ -144,7 +144,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
144
144
  symbolId: number;
145
145
  }[];
146
146
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
147
- actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
147
+ actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
148
148
  isTemplate: boolean;
149
149
  sourceTemplateId?: string | undefined;
150
150
  createdAt: number;
@@ -160,7 +160,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
160
160
  symbolId: number;
161
161
  }[];
162
162
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
163
- actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
163
+ actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
164
164
  isTemplate: boolean;
165
165
  sourceTemplateId?: string | undefined;
166
166
  createdAt: number;
@@ -174,7 +174,7 @@ declare const CreateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
174
174
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
175
175
  }, undefined>, undefined>, readonly []>;
176
176
  readonly spotMarketScope: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["all", "allowlist"], undefined>, v.TransformAction<"all" | "allowlist", MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST>]>;
177
- readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, readonly []>, v.TransformAction<("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[], (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[]>]>;
177
+ readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>, undefined>, readonly []>, v.TransformAction<("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[], (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[]>]>;
178
178
  readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
179
179
  readonly assignToKeyId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
180
180
  }, undefined>, v.TransformAction<{
@@ -184,7 +184,7 @@ declare const CreateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
184
184
  symbolId: number;
185
185
  }[];
186
186
  spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
187
- actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
187
+ actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
188
188
  isTemplate: boolean;
189
189
  assignToKeyId?: string | undefined;
190
190
  }, {
@@ -195,7 +195,7 @@ declare const CreateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
195
195
  symbolId: number;
196
196
  }[];
197
197
  spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
198
- actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
198
+ actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
199
199
  isTemplate: boolean;
200
200
  };
201
201
  assignToKeyId: string | undefined;
@@ -210,7 +210,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
210
210
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
211
211
  }, undefined>, undefined>, undefined>;
212
212
  readonly spotMarketScope: v.OptionalSchema<v.PicklistSchema<readonly ["all", "allowlist"], undefined>, undefined>;
213
- readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, undefined>;
213
+ readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>, undefined>, undefined>;
214
214
  readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
215
215
  }, undefined>, v.CheckAction<{
216
216
  policyId: bigint;
@@ -221,7 +221,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
221
221
  symbolId: number;
222
222
  }[] | undefined;
223
223
  spotMarketScope?: "all" | "allowlist" | undefined;
224
- actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
224
+ actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[] | undefined;
225
225
  isTemplate?: boolean | undefined;
226
226
  }, "At least one API key policy field must be provided">, v.TransformAction<{
227
227
  policyId: bigint;
@@ -232,7 +232,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
232
232
  symbolId: number;
233
233
  }[] | undefined;
234
234
  spotMarketScope?: "all" | "allowlist" | undefined;
235
- actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
235
+ actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[] | undefined;
236
236
  isTemplate?: boolean | undefined;
237
237
  }, {
238
238
  policyId: bigint;
@@ -247,7 +247,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
247
247
  } & {
248
248
  spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
249
249
  } & {
250
- actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
250
+ actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
251
251
  } & {
252
252
  isTemplate: boolean;
253
253
  }>;
@@ -22,7 +22,10 @@ const PolicyActionCodec = {
22
22
  [6]: "read-spot",
23
23
  [8]: "read-internal-transfers",
24
24
  [11]: "read-address-book",
25
- [12]: "manage-address-book"
25
+ [12]: "manage-address-book",
26
+ [14]: "read-auto-withdraw",
27
+ [15]: "manage-auto-withdraw",
28
+ [16]: "swap"
26
29
  },
27
30
  inputToProto: {
28
31
  "trade-spot": 1,
@@ -32,7 +35,10 @@ const PolicyActionCodec = {
32
35
  "read-spot": 6,
33
36
  "read-internal-transfers": 8,
34
37
  "read-address-book": 11,
35
- "manage-address-book": 12
38
+ "manage-address-book": 12,
39
+ "read-auto-withdraw": 14,
40
+ "manage-auto-withdraw": 15,
41
+ swap: 16
36
42
  }
37
43
  };
38
44
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"shared.codecs.js","names":[],"sources":["../../../src/services/policies/shared.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/policies_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const POLICY_ACTION_LABELS = [\n \"trade-spot\",\n \"internal-transfer\",\n \"external-withdraw\",\n \"read-balances\",\n \"read-spot\",\n \"read-internal-transfers\",\n \"read-address-book\",\n \"manage-address-book\",\n] as const;\nexport type PolicyActionLabel = (typeof POLICY_ACTION_LABELS)[number];\n\nexport const POLICY_MARKET_SCOPE_LABELS = [\"all\", \"allowlist\"] as const;\nexport type PolicyMarketScopeLabel = (typeof POLICY_MARKET_SCOPE_LABELS)[number];\n\nexport const PolicyMarketScopeCodec = {\n inputToProto: {\n all: Proto.MarketScope_Value.ALL,\n allowlist: Proto.MarketScope_Value.ALLOWLIST,\n } satisfies Record<PolicyMarketScopeLabel, Proto.MarketScope_Value>,\n protoToOutput: {\n [Proto.MarketScope_Value.UNSPECIFIED]: \"unspecified\",\n [Proto.MarketScope_Value.ALL]: \"all\",\n [Proto.MarketScope_Value.ALLOWLIST]: \"allowlist\",\n } satisfies ProtoToOutput<Proto.MarketScope_Value, PolicyMarketScopeLabel>,\n} as const;\n\nexport const PolicyActionCodec = {\n protoToOutput: {\n [Proto.PolicyAction.UNSPECIFIED]: \"unspecified\",\n [Proto.PolicyAction.TRADE_SPOT]: \"trade-spot\",\n [Proto.PolicyAction.INTERNAL_TRANSFER]: \"internal-transfer\",\n [Proto.PolicyAction.EXTERNAL_WITHDRAW]: \"external-withdraw\",\n [Proto.PolicyAction.READ_BALANCES]: \"read-balances\",\n [Proto.PolicyAction.READ_SPOT]: \"read-spot\",\n [Proto.PolicyAction.READ_INTERNAL_TRANSFERS]: \"read-internal-transfers\",\n [Proto.PolicyAction.READ_ADDRESS_BOOK]: \"read-address-book\",\n [Proto.PolicyAction.MANAGE_ADDRESS_BOOK]: \"manage-address-book\",\n } satisfies ProtoToOutput<Proto.PolicyAction, PolicyActionLabel>,\n inputToProto: {\n \"trade-spot\": Proto.PolicyAction.TRADE_SPOT,\n \"internal-transfer\": Proto.PolicyAction.INTERNAL_TRANSFER,\n \"external-withdraw\": Proto.PolicyAction.EXTERNAL_WITHDRAW,\n \"read-balances\": Proto.PolicyAction.READ_BALANCES,\n \"read-spot\": Proto.PolicyAction.READ_SPOT,\n \"read-internal-transfers\": Proto.PolicyAction.READ_INTERNAL_TRANSFERS,\n \"read-address-book\": Proto.PolicyAction.READ_ADDRESS_BOOK,\n \"manage-address-book\": Proto.PolicyAction.MANAGE_ADDRESS_BOOK,\n } satisfies Record<PolicyActionLabel, Proto.PolicyAction>,\n} as const;\n\n/**\n * Returns the display label for a policy market scope.\n */\nexport function policyMarketScopeLabelFor(value: number): DecodedEnum<PolicyMarketScopeLabel> {\n return enumLabel(PolicyMarketScopeCodec.protoToOutput, value);\n}\n\n/**\n * Returns the display label for a policy action.\n */\nexport function policyActionLabelFor(value: number): DecodedEnum<PolicyActionLabel> {\n return enumLabel(PolicyActionCodec.protoToOutput, value);\n}\n"],"mappings":";;;AAmBA,MAAa,yBAAyB;CAClC,cAAc;EACV,KAAA;EACA,WAAA;CACJ;CACA,eAAe;GAC4B,IAAA;GACR,IAAA;GACM,IAAA;CACzC;AACJ;AAEA,MAAa,oBAAoB;CAC7B,eAAe;GACuB,IAAA;GACD,IAAA;GACO,IAAA;GACA,IAAA;GACJ,IAAA;GACJ,IAAA;GACc,IAAA;GACN,KAAA;GACE,KAAA;CAC9C;CACA,cAAc;EACV,cAAA;EACA,qBAAA;EACA,qBAAA;EACA,iBAAA;EACA,aAAA;EACA,2BAAA;EACA,qBAAA;EACA,uBAAA;CACJ;AACJ;;;;AAKA,SAAgB,0BAA0B,OAAoD;CAC1F,OAAO,UAAU,uBAAuB,eAAe,KAAK;AAChE;;;;AAKA,SAAgB,qBAAqB,OAA+C;CAChF,OAAO,UAAU,kBAAkB,eAAe,KAAK;AAC3D"}
1
+ {"version":3,"file":"shared.codecs.js","names":[],"sources":["../../../src/services/policies/shared.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/policies_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const POLICY_ACTION_LABELS = [\n \"trade-spot\",\n \"internal-transfer\",\n \"external-withdraw\",\n \"read-balances\",\n \"read-spot\",\n \"read-internal-transfers\",\n \"read-address-book\",\n \"manage-address-book\",\n \"read-auto-withdraw\",\n \"manage-auto-withdraw\",\n \"swap\",\n] as const;\nexport type PolicyActionLabel = (typeof POLICY_ACTION_LABELS)[number];\n\nexport const POLICY_MARKET_SCOPE_LABELS = [\"all\", \"allowlist\"] as const;\nexport type PolicyMarketScopeLabel = (typeof POLICY_MARKET_SCOPE_LABELS)[number];\n\nexport const PolicyMarketScopeCodec = {\n inputToProto: {\n all: Proto.MarketScope_Value.ALL,\n allowlist: Proto.MarketScope_Value.ALLOWLIST,\n } satisfies Record<PolicyMarketScopeLabel, Proto.MarketScope_Value>,\n protoToOutput: {\n [Proto.MarketScope_Value.UNSPECIFIED]: \"unspecified\",\n [Proto.MarketScope_Value.ALL]: \"all\",\n [Proto.MarketScope_Value.ALLOWLIST]: \"allowlist\",\n } satisfies ProtoToOutput<Proto.MarketScope_Value, PolicyMarketScopeLabel>,\n} as const;\n\nexport const PolicyActionCodec = {\n protoToOutput: {\n [Proto.PolicyAction.UNSPECIFIED]: \"unspecified\",\n [Proto.PolicyAction.TRADE_SPOT]: \"trade-spot\",\n [Proto.PolicyAction.INTERNAL_TRANSFER]: \"internal-transfer\",\n [Proto.PolicyAction.EXTERNAL_WITHDRAW]: \"external-withdraw\",\n [Proto.PolicyAction.READ_BALANCES]: \"read-balances\",\n [Proto.PolicyAction.READ_SPOT]: \"read-spot\",\n [Proto.PolicyAction.READ_INTERNAL_TRANSFERS]: \"read-internal-transfers\",\n [Proto.PolicyAction.READ_ADDRESS_BOOK]: \"read-address-book\",\n [Proto.PolicyAction.MANAGE_ADDRESS_BOOK]: \"manage-address-book\",\n [Proto.PolicyAction.READ_AUTO_WITHDRAW]: \"read-auto-withdraw\",\n [Proto.PolicyAction.MANAGE_AUTO_WITHDRAW]: \"manage-auto-withdraw\",\n [Proto.PolicyAction.SWAP]: \"swap\",\n } satisfies ProtoToOutput<Proto.PolicyAction, PolicyActionLabel>,\n inputToProto: {\n \"trade-spot\": Proto.PolicyAction.TRADE_SPOT,\n \"internal-transfer\": Proto.PolicyAction.INTERNAL_TRANSFER,\n \"external-withdraw\": Proto.PolicyAction.EXTERNAL_WITHDRAW,\n \"read-balances\": Proto.PolicyAction.READ_BALANCES,\n \"read-spot\": Proto.PolicyAction.READ_SPOT,\n \"read-internal-transfers\": Proto.PolicyAction.READ_INTERNAL_TRANSFERS,\n \"read-address-book\": Proto.PolicyAction.READ_ADDRESS_BOOK,\n \"manage-address-book\": Proto.PolicyAction.MANAGE_ADDRESS_BOOK,\n \"read-auto-withdraw\": Proto.PolicyAction.READ_AUTO_WITHDRAW,\n \"manage-auto-withdraw\": Proto.PolicyAction.MANAGE_AUTO_WITHDRAW,\n swap: Proto.PolicyAction.SWAP,\n } satisfies Record<PolicyActionLabel, Proto.PolicyAction>,\n} as const;\n\n/**\n * Returns the display label for a policy market scope.\n */\nexport function policyMarketScopeLabelFor(value: number): DecodedEnum<PolicyMarketScopeLabel> {\n return enumLabel(PolicyMarketScopeCodec.protoToOutput, value);\n}\n\n/**\n * Returns the display label for a policy action.\n */\nexport function policyActionLabelFor(value: number): DecodedEnum<PolicyActionLabel> {\n return enumLabel(PolicyActionCodec.protoToOutput, value);\n}\n"],"mappings":";;;AAsBA,MAAa,yBAAyB;CAClC,cAAc;EACV,KAAA;EACA,WAAA;CACJ;CACA,eAAe;GAC4B,IAAA;GACR,IAAA;GACM,IAAA;CACzC;AACJ;AAEA,MAAa,oBAAoB;CAC7B,eAAe;GACuB,IAAA;GACD,IAAA;GACO,IAAA;GACA,IAAA;GACJ,IAAA;GACJ,IAAA;GACc,IAAA;GACN,KAAA;GACE,KAAA;GACD,KAAA;GACE,KAAA;GAChB,KAAA;CAC/B;CACA,cAAc;EACV,cAAA;EACA,qBAAA;EACA,qBAAA;EACA,iBAAA;EACA,aAAA;EACA,2BAAA;EACA,qBAAA;EACA,uBAAA;EACA,sBAAA;EACA,wBAAA;EACA,MAAA;CACJ;AACJ;;;;AAKA,SAAgB,0BAA0B,OAAoD;CAC1F,OAAO,UAAU,uBAAuB,eAAe,KAAK;AAChE;;;;AAKA,SAAgB,qBAAqB,OAA+C;CAChF,OAAO,UAAU,kBAAkB,eAAe,KAAK;AAC3D"}
@@ -1,6 +1,6 @@
1
1
  import * as v from "valibot";
2
2
  //#region src/services/policies/shared.d.ts
3
- declare const PolicyActionEnumSchema: v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>;
3
+ declare const PolicyActionEnumSchema: v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>;
4
4
  declare const PolicyMarketScopeEnumSchema: v.PicklistSchema<readonly ["all", "allowlist"], undefined>;
5
5
  type PolicyMarketScope = v.InferOutput<typeof PolicyMarketScopeEnumSchema>;
6
6
  type PolicyAction = v.InferOutput<typeof PolicyActionEnumSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","names":[],"sources":["../../../src/services/policies/shared.ts"],"mappings":";;cAsBa,wBAAsB,EAAA;cAEtB,6BAA2B,EAAA;KAC5B,oBAAoB,EAAE,mBAAmB;KAEzC,eAAe,EAAE,mBAAmB"}
1
+ {"version":3,"file":"shared.d.ts","names":[],"sources":["../../../src/services/policies/shared.ts"],"mappings":";;cAyBa,wBAAsB,EAAA;cAEtB,6BAA2B,EAAA;KAC5B,oBAAoB,EAAE,mBAAmB;KAEzC,eAAe,EAAE,mBAAmB"}
@@ -11,7 +11,10 @@ const POLICY_ACTIONS = [
11
11
  "read-spot",
12
12
  "read-internal-transfers",
13
13
  "read-address-book",
14
- "manage-address-book"
14
+ "manage-address-book",
15
+ "read-auto-withdraw",
16
+ "manage-auto-withdraw",
17
+ "swap"
15
18
  ];
16
19
  const POLICY_MARKET_SCOPES = ["all", "allowlist"];
17
20
  const ProtoPolicyActionEnumSchema = v.number();
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","names":[],"sources":["../../../src/services/policies/shared.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { idToBigInt } from \"../../utils/base58-id.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\n\nexport const SpotMarketRuleSchema = v.object({\n symbolId: SymbolIdInputSchema,\n});\n\nexport const POLICY_ACTIONS = [\n \"trade-spot\",\n \"internal-transfer\",\n \"external-withdraw\",\n \"read-balances\",\n \"read-spot\",\n \"read-internal-transfers\",\n \"read-address-book\",\n \"manage-address-book\",\n] as const;\n\nexport const POLICY_MARKET_SCOPES = [\"all\", \"allowlist\"] as const;\n\nexport const ProtoPolicyActionEnumSchema = v.number();\nexport const PolicyActionEnumSchema = v.picklist(POLICY_ACTIONS);\nexport const ProtoPolicyMarketScopeEnumSchema = v.number();\nexport const PolicyMarketScopeEnumSchema = v.picklist(POLICY_MARKET_SCOPES);\nexport type PolicyMarketScope = v.InferOutput<typeof PolicyMarketScopeEnumSchema>;\n\nexport type PolicyAction = v.InferOutput<typeof PolicyActionEnumSchema>;\n\nexport const PolicyIdSchema = v.pipe(\n v.string(),\n v.trim(),\n v.minLength(1),\n v.transform((v) => idToBigInt(v, \"policyId\")),\n);\n"],"mappings":";;;;AAIA,MAAa,uBAAuB,EAAE,OAAO,EACzC,UAAU,oBACd,CAAC;AAED,MAAa,iBAAiB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAEA,MAAa,uBAAuB,CAAC,OAAO,WAAW;AAEvD,MAAa,8BAA8B,EAAE,OAAO;AACpD,MAAa,yBAAyB,EAAE,SAAS,cAAc;AAC/D,MAAa,mCAAmC,EAAE,OAAO;AACzD,MAAa,8BAA8B,EAAE,SAAS,oBAAoB;AAK1E,MAAa,iBAAiB,EAAE,KAC5B,EAAE,OAAO,GACT,EAAE,KAAK,GACP,EAAE,UAAU,CAAC,GACb,EAAE,WAAW,MAAM,WAAW,GAAG,UAAU,CAAC,CAChD"}
1
+ {"version":3,"file":"shared.js","names":[],"sources":["../../../src/services/policies/shared.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { idToBigInt } from \"../../utils/base58-id.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\n\nexport const SpotMarketRuleSchema = v.object({\n symbolId: SymbolIdInputSchema,\n});\n\nexport const POLICY_ACTIONS = [\n \"trade-spot\",\n \"internal-transfer\",\n \"external-withdraw\",\n \"read-balances\",\n \"read-spot\",\n \"read-internal-transfers\",\n \"read-address-book\",\n \"manage-address-book\",\n \"read-auto-withdraw\",\n \"manage-auto-withdraw\",\n \"swap\",\n] as const;\n\nexport const POLICY_MARKET_SCOPES = [\"all\", \"allowlist\"] as const;\n\nexport const ProtoPolicyActionEnumSchema = v.number();\nexport const PolicyActionEnumSchema = v.picklist(POLICY_ACTIONS);\nexport const ProtoPolicyMarketScopeEnumSchema = v.number();\nexport const PolicyMarketScopeEnumSchema = v.picklist(POLICY_MARKET_SCOPES);\nexport type PolicyMarketScope = v.InferOutput<typeof PolicyMarketScopeEnumSchema>;\n\nexport type PolicyAction = v.InferOutput<typeof PolicyActionEnumSchema>;\n\nexport const PolicyIdSchema = v.pipe(\n v.string(),\n v.trim(),\n v.minLength(1),\n v.transform((v) => idToBigInt(v, \"policyId\")),\n);\n"],"mappings":";;;;AAIA,MAAa,uBAAuB,EAAE,OAAO,EACzC,UAAU,oBACd,CAAC;AAED,MAAa,iBAAiB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAEA,MAAa,uBAAuB,CAAC,OAAO,WAAW;AAEvD,MAAa,8BAA8B,EAAE,OAAO;AACpD,MAAa,yBAAyB,EAAE,SAAS,cAAc;AAC/D,MAAa,mCAAmC,EAAE,OAAO;AACzD,MAAa,8BAA8B,EAAE,SAAS,oBAAoB;AAK1E,MAAa,iBAAiB,EAAE,KAC5B,EAAE,OAAO,GACT,EAAE,KAAK,GACP,EAAE,UAAU,CAAC,GACb,EAAE,WAAW,MAAM,WAAW,GAAG,UAAU,CAAC,CAChD"}
@@ -38,7 +38,7 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
38
38
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
39
39
  }, undefined>, undefined>, readonly []>;
40
40
  readonly spotMarketScope: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"all" | "allowlist">>]>;
41
- readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[]>]>;
41
+ readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[]>]>;
42
42
  readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
43
43
  readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
44
44
  readonly maxOrderNotional: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
@@ -79,7 +79,7 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
79
79
  symbolId: number;
80
80
  }[];
81
81
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
82
- actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
82
+ actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
83
83
  isTemplate: boolean;
84
84
  sourceTemplateId?: string | undefined;
85
85
  maxOrderNotional: string;
@@ -104,7 +104,7 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
104
104
  symbolId: number;
105
105
  }[];
106
106
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
107
- actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
107
+ actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
108
108
  isTemplate: boolean;
109
109
  sourceTemplateId?: string | undefined;
110
110
  maxOpenOrders: number;
@@ -124,7 +124,7 @@ declare const CreateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
124
124
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
125
125
  }, undefined>, undefined>, readonly []>;
126
126
  readonly spotMarketScope: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["all", "allowlist"], undefined>, v.TransformAction<"all" | "allowlist", MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST>]>;
127
- readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, readonly []>, v.TransformAction<("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[], (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[]>]>;
127
+ readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>, undefined>, readonly []>, v.TransformAction<("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[], (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[]>]>;
128
128
  readonly maxOrderSize: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, bigint>]>, undefined>, null>, v.TransformAction<bigint | null, bigint>]>;
129
129
  readonly maxOpenOrders: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>, null>, v.TransformAction<number | null, number>]>;
130
130
  readonly tradingHalted: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
@@ -139,7 +139,7 @@ declare const CreateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
139
139
  symbolId: number;
140
140
  }[];
141
141
  spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
142
- actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
142
+ actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
143
143
  maxOrderSize: bigint;
144
144
  maxOpenOrders: number;
145
145
  tradingHalted: boolean;
@@ -159,7 +159,7 @@ declare const CreateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
159
159
  symbolId: number;
160
160
  }[];
161
161
  spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
162
- actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
162
+ actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
163
163
  maxOpenOrders: number;
164
164
  tradingHalted: boolean;
165
165
  };
@@ -175,7 +175,7 @@ declare const UpdateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
175
175
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
176
176
  }, undefined>, undefined>, undefined>;
177
177
  readonly spotMarketScope: v.OptionalSchema<v.PicklistSchema<readonly ["all", "allowlist"], undefined>, undefined>;
178
- readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, undefined>;
178
+ readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>, undefined>, undefined>;
179
179
  readonly maxOrderSize: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, bigint>]>, undefined>, undefined>;
180
180
  readonly maxOpenOrders: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>, undefined>;
181
181
  readonly tradingHalted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
@@ -191,7 +191,7 @@ declare const UpdateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
191
191
  symbolId: number;
192
192
  }[] | undefined;
193
193
  spotMarketScope?: "all" | "allowlist" | undefined;
194
- actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
194
+ actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[] | undefined;
195
195
  maxOrderSize?: bigint | null | undefined;
196
196
  maxOpenOrders?: number | null | undefined;
197
197
  tradingHalted?: boolean | undefined;
@@ -207,7 +207,7 @@ declare const UpdateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
207
207
  symbolId: number;
208
208
  }[] | undefined;
209
209
  spotMarketScope?: "all" | "allowlist" | undefined;
210
- actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
210
+ actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[] | undefined;
211
211
  maxOrderSize?: bigint | null | undefined;
212
212
  maxOpenOrders?: number | null | undefined;
213
213
  tradingHalted?: boolean | undefined;
@@ -1,7 +1,7 @@
1
1
  import { idToBigInt } from "../../../utils/base58-id.js";
2
+ import { PROTOBUF_UINT32_MAX } from "../../../shared/wire-bounds.js";
2
3
  import { toIntOrZero } from "../../../utils/numbers.js";
3
4
  import { tsObjToMs, tsObjToNsString } from "../../../utils/time.js";
4
- import { PROTOBUF_UINT32_MAX } from "../../../shared/wire-bounds.js";
5
5
  import { BigIntStringSchema, OptionalNumberToIntOrZeroSchema, OptionalPublicIdSchema, OptionalTimestampMsSchema, PublicIdSchema, TimestampMsSchema, TimestampSchema, idInputSchema, optionalSubaccountIdInputSchema, positiveBigintStringInputSchema } from "../../../shared/schemas.js";
6
6
  import { decimalInputToScaled, scaledToDecimalOutput } from "../../../shared/decimal-surface.js";
7
7
  import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../../shared/account-scope.js";
@@ -51,7 +51,10 @@ const SubaccountPermissionCodec = { protoToOutput: {
51
51
  [22]: "create_deposit_address",
52
52
  [23]: "read_deposit_addresses",
53
53
  [24]: "read_guard_signer_status",
54
- [25]: "manage_guard_signer"
54
+ [25]: "manage_guard_signer",
55
+ [26]: "read_auto_withdraw",
56
+ [27]: "manage_auto_withdraw",
57
+ [28]: "swap"
55
58
  } };
56
59
  const InviteActionCodec = { inputToProto: {
57
60
  accept: 1,
@@ -1 +1 @@
1
- {"version":3,"file":"subaccounts.codecs.js","names":[],"sources":["../../../src/services/subaccounts/subaccounts.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\nexport type SubaccountRoleValue = (typeof SUBACCOUNT_ROLE_VALUES)[number];\n\nexport const SUBACCOUNT_PERMISSION_VALUES = [\n \"read_subaccount\",\n \"update_subaccount\",\n \"read_balances\",\n \"read_spot\",\n \"trade_spot\",\n \"read_internal_transfers\",\n \"internal_transfer\",\n \"external_withdraw\",\n \"read_address_book\",\n \"manage_address_book\",\n \"read_members\",\n \"manage_members\",\n \"read_invites\",\n \"manage_invites\",\n \"read_api_keys\",\n \"manage_api_keys\",\n \"read_subaccount_policy\",\n \"manage_subaccount_policy\",\n \"read_activity\",\n \"read_activity_security_details\",\n \"manage_member_mfa_requirement\",\n \"create_deposit_address\",\n \"read_deposit_addresses\",\n \"read_guard_signer_status\",\n \"manage_guard_signer\",\n] as const;\nexport type SubaccountPermissionValue = (typeof SUBACCOUNT_PERMISSION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_ACTION_VALUES = [\"accept\", \"decline\", \"cancel\"] as const;\nexport type SubaccountInviteActionValue = (typeof SUBACCOUNT_INVITE_ACTION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_STATUS_VALUES = [\n \"pending\",\n \"accepted\",\n \"declined\",\n \"cancelled\",\n] as const;\nexport type SubaccountInviteStatusValue = (typeof SUBACCOUNT_INVITE_STATUS_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_DIRECTION_VALUES = [\"\", \"incoming\", \"outgoing\"] as const;\nexport type SubaccountInviteDirectionValue = (typeof SUBACCOUNT_INVITE_DIRECTION_VALUES)[number];\n\nexport const SUBACCOUNT_STATUS_VALUES = [\"active\", \"disabled\"] as const;\nexport type SubaccountStatusValue = (typeof SUBACCOUNT_STATUS_VALUES)[number];\n\nexport const ACTIVITY_ENTITY_KIND_VALUES = [\n \"account\",\n \"session\",\n \"api_key\",\n \"subaccount\",\n \"member\",\n \"policy\",\n \"invite\",\n \"security\",\n \"destination\",\n] as const;\nexport type ActivityEntityKindValue = (typeof ACTIVITY_ENTITY_KIND_VALUES)[number];\n\nexport const ACTIVITY_EVENT_ACTION_VALUES = [\n \"created\",\n \"updated\",\n \"deleted\",\n \"enabled\",\n \"disabled\",\n \"removed\",\n \"role_set\",\n \"received\",\n \"replied\",\n \"failed\",\n \"revoked\",\n \"blocked\",\n \"hold_placed\",\n \"hold_released\",\n] as const;\nexport type ActivityEventActionValue = (typeof ACTIVITY_EVENT_ACTION_VALUES)[number];\n\nexport const ACTIVITY_EVENT_SOURCE_VALUES = [\"web\", \"mobile\", \"api\"] as const;\nexport type ActivityEventSourceValue = (typeof ACTIVITY_EVENT_SOURCE_VALUES)[number];\n\nexport const SubaccountRoleCodec = {\n inputToProto: {\n owner: Proto.SubaccountRole.OWNER,\n admin: Proto.SubaccountRole.ADMIN,\n treasury: Proto.SubaccountRole.TREASURY,\n leveraged_trader: Proto.SubaccountRole.LEVERAGED_TRADER,\n trader: Proto.SubaccountRole.TRADER,\n viewer: Proto.SubaccountRole.VIEWER,\n } satisfies InputToProto<SubaccountRoleValue, Proto.SubaccountRole>,\n protoToOutput: {\n [Proto.SubaccountRole.SUBACCOUNT_ROLE_UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountRole.OWNER]: \"owner\",\n [Proto.SubaccountRole.ADMIN]: \"admin\",\n [Proto.SubaccountRole.TREASURY]: \"treasury\",\n [Proto.SubaccountRole.LEVERAGED_TRADER]: \"leveraged_trader\",\n [Proto.SubaccountRole.TRADER]: \"trader\",\n [Proto.SubaccountRole.VIEWER]: \"viewer\",\n } satisfies ProtoToOutput<Proto.SubaccountRole, SubaccountRoleValue>,\n} as const;\n\nexport const SubaccountPermissionCodec = {\n protoToOutput: {\n [Proto.SubaccountPermission.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT]: \"read_subaccount\",\n [Proto.SubaccountPermission.UPDATE_SUBACCOUNT]: \"update_subaccount\",\n [Proto.SubaccountPermission.READ_BALANCES]: \"read_balances\",\n [Proto.SubaccountPermission.READ_SPOT]: \"read_spot\",\n [Proto.SubaccountPermission.TRADE_SPOT]: \"trade_spot\",\n [Proto.SubaccountPermission.READ_INTERNAL_TRANSFERS]: \"read_internal_transfers\",\n [Proto.SubaccountPermission.INTERNAL_TRANSFER]: \"internal_transfer\",\n [Proto.SubaccountPermission.EXTERNAL_WITHDRAW]: \"external_withdraw\",\n [Proto.SubaccountPermission.READ_ADDRESS_BOOK]: \"read_address_book\",\n [Proto.SubaccountPermission.MANAGE_ADDRESS_BOOK]: \"manage_address_book\",\n [Proto.SubaccountPermission.READ_MEMBERS]: \"read_members\",\n [Proto.SubaccountPermission.MANAGE_MEMBERS]: \"manage_members\",\n [Proto.SubaccountPermission.READ_INVITES]: \"read_invites\",\n [Proto.SubaccountPermission.MANAGE_INVITES]: \"manage_invites\",\n [Proto.SubaccountPermission.READ_API_KEYS]: \"read_api_keys\",\n [Proto.SubaccountPermission.MANAGE_API_KEYS]: \"manage_api_keys\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT_POLICY]: \"read_subaccount_policy\",\n [Proto.SubaccountPermission.MANAGE_SUBACCOUNT_POLICY]: \"manage_subaccount_policy\",\n [Proto.SubaccountPermission.READ_ACTIVITY]: \"read_activity\",\n [Proto.SubaccountPermission.READ_ACTIVITY_SECURITY_DETAILS]:\n \"read_activity_security_details\",\n [Proto.SubaccountPermission.MANAGE_MEMBER_MFA_REQUIREMENT]: \"manage_member_mfa_requirement\",\n [Proto.SubaccountPermission.CREATE_DEPOSIT_ADDRESS]: \"create_deposit_address\",\n [Proto.SubaccountPermission.READ_DEPOSIT_ADDRESSES]: \"read_deposit_addresses\",\n [Proto.SubaccountPermission.READ_GUARD_SIGNER_STATUS]: \"read_guard_signer_status\",\n [Proto.SubaccountPermission.MANAGE_GUARD_SIGNER]: \"manage_guard_signer\",\n } satisfies ProtoToOutput<Proto.SubaccountPermission, SubaccountPermissionValue>,\n} as const;\n\nexport const InviteActionCodec = {\n inputToProto: {\n accept: Proto.SubaccountInviteAction.ACCEPT,\n decline: Proto.SubaccountInviteAction.DECLINE,\n cancel: Proto.SubaccountInviteAction.CANCEL,\n } satisfies InputToProto<SubaccountInviteActionValue, Proto.SubaccountInviteAction>,\n} as const;\n\nexport const InviteStatusCodec = {\n protoToOutput: {\n [Proto.SubaccountInviteStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountInviteStatus.PENDING]: \"pending\",\n [Proto.SubaccountInviteStatus.ACCEPTED]: \"accepted\",\n [Proto.SubaccountInviteStatus.DECLINED]: \"declined\",\n [Proto.SubaccountInviteStatus.CANCELLED]: \"cancelled\",\n } satisfies ProtoToOutput<Proto.SubaccountInviteStatus, SubaccountInviteStatusValue>,\n} as const;\n\nexport const SubaccountInviteDirectionCodec = {\n inputToProto: {\n \"\": Proto.SubaccountInviteDirection.DIRECTION_UNSPECIFIED,\n incoming: Proto.SubaccountInviteDirection.INCOMING,\n outgoing: Proto.SubaccountInviteDirection.OUTGOING,\n } satisfies InputToProto<SubaccountInviteDirectionValue, Proto.SubaccountInviteDirection>,\n} as const;\n\nexport const SubaccountStatusCodec = {\n inputToProto: {\n active: Proto.SubaccountStatus.ACTIVE,\n disabled: Proto.SubaccountStatus.DISABLED,\n } satisfies InputToProto<SubaccountStatusValue, Proto.SubaccountStatus>,\n protoToOutput: {\n [Proto.SubaccountStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountStatus.ACTIVE]: \"active\",\n [Proto.SubaccountStatus.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.SubaccountStatus, SubaccountStatusValue>,\n} as const;\n\nexport const ActivityEntityKindCodec = {\n protoToOutput: {\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_ACCOUNT]: \"account\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SESSION]: \"session\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_API_KEY]: \"api_key\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SUBACCOUNT]: \"subaccount\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_MEMBER]: \"member\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_POLICY]: \"policy\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_INVITE]: \"invite\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SECURITY]: \"security\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_DESTINATION]: \"destination\",\n } satisfies ProtoToOutput<Proto.ActivityEntityKind, ActivityEntityKindValue>,\n} as const;\n\nexport const ActivityEventActionCodec = {\n protoToOutput: {\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_CREATED]: \"created\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UPDATED]: \"updated\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DELETED]: \"deleted\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ENABLED]: \"enabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DISABLED]: \"disabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REMOVED]: \"removed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ROLE_SET]: \"role_set\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_RECEIVED]: \"received\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REPLIED]: \"replied\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_FAILED]: \"failed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REVOKED]: \"revoked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_BLOCKED]: \"blocked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_PLACED]: \"hold_placed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_RELEASED]: \"hold_released\",\n } satisfies ProtoToOutput<Proto.ActivityEventAction, ActivityEventActionValue>,\n} as const;\n\nexport const ActivityEventSourceCodec = {\n protoToOutput: {\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_WEB]: \"web\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_MOBILE]: \"mobile\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_API]: \"api\",\n } satisfies ProtoToOutput<Proto.ActivityEventSource, ActivityEventSourceValue>,\n} as const;\n"],"mappings":";;AAqDA,MAAa,qCAAqC;CAAC;CAAI;CAAY;AAAU;AAG7E,MAAa,2BAA2B,CAAC,UAAU,UAAU;AAqC7D,MAAa,sBAAsB;CAC/B,cAAc;EACV,OAAA;EACA,OAAA;EACA,UAAA;EACA,kBAAA;EACA,QAAA;EACA,QAAA;CACJ;CACA,eAAe;GACyC,IAAA;GACtB,IAAA;GACA,IAAA;GACG,IAAA;GACQ,IAAA;GACV,IAAA;GACA,IAAA;CACnC;AACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EAC+B,IAAA;EACI,IAAA;EACE,IAAA;EACJ,IAAA;EACJ,IAAA;EACC,IAAA;EACa,IAAA;EACN,IAAA;EACA,IAAA;EACA,IAAA;EACE,KAAA;EACP,KAAA;EACE,KAAA;EACF,KAAA;EACE,KAAA;EACD,KAAA;EACE,KAAA;EACO,KAAA;EACE,KAAA;EACX,KAAA;EAExC,KAAA;EACwD,KAAA;EACP,KAAA;EACA,KAAA;EACE,KAAA;EACL,KAAA;AACtD,EACJ;AAEA,MAAa,oBAAoB,EAC7B,cAAc;CACV,QAAA;CACA,SAAA;CACA,QAAA;AACJ,EACJ;AAEA,MAAa,oBAAoB,EAC7B,eAAe;EACiC,IAAA;EACJ,IAAA;EACC,IAAA;EACA,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,iCAAiC,EAC1C,cAAc;CACV,IAAA;CACA,UAAA;CACA,UAAA;AACJ,EACJ;AAEA,MAAa,wBAAwB;CACjC,cAAc;EACV,QAAA;EACA,UAAA;CACJ;CACA,eAAe;GAC2B,IAAA;GACL,IAAA;GACE,IAAA;CACvC;AACJ;AAEA,MAAa,0BAA0B,EACnC,eAAe;EAC6C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACG,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACE,IAAA;EACG,IAAA;AAC5D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACA,IAAA;EACC,IAAA;EACD,IAAA;EACC,IAAA;EACA,IAAA;EACD,IAAA;EACD,KAAA;EACC,KAAA;EACA,KAAA;EACI,KAAA;EACE,KAAA;AAC/D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACR,IAAA;EACG,IAAA;EACH,IAAA;AACrD,EACJ"}
1
+ {"version":3,"file":"subaccounts.codecs.js","names":[],"sources":["../../../src/services/subaccounts/subaccounts.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\nexport type SubaccountRoleValue = (typeof SUBACCOUNT_ROLE_VALUES)[number];\n\nexport const SUBACCOUNT_PERMISSION_VALUES = [\n \"read_subaccount\",\n \"update_subaccount\",\n \"read_balances\",\n \"read_spot\",\n \"trade_spot\",\n \"read_internal_transfers\",\n \"internal_transfer\",\n \"external_withdraw\",\n \"read_address_book\",\n \"manage_address_book\",\n \"read_members\",\n \"manage_members\",\n \"read_invites\",\n \"manage_invites\",\n \"read_api_keys\",\n \"manage_api_keys\",\n \"read_subaccount_policy\",\n \"manage_subaccount_policy\",\n \"read_activity\",\n \"read_activity_security_details\",\n \"manage_member_mfa_requirement\",\n \"create_deposit_address\",\n \"read_deposit_addresses\",\n \"read_guard_signer_status\",\n \"manage_guard_signer\",\n \"read_auto_withdraw\",\n \"manage_auto_withdraw\",\n \"swap\",\n] as const;\nexport type SubaccountPermissionValue = (typeof SUBACCOUNT_PERMISSION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_ACTION_VALUES = [\"accept\", \"decline\", \"cancel\"] as const;\nexport type SubaccountInviteActionValue = (typeof SUBACCOUNT_INVITE_ACTION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_STATUS_VALUES = [\n \"pending\",\n \"accepted\",\n \"declined\",\n \"cancelled\",\n] as const;\nexport type SubaccountInviteStatusValue = (typeof SUBACCOUNT_INVITE_STATUS_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_DIRECTION_VALUES = [\"\", \"incoming\", \"outgoing\"] as const;\nexport type SubaccountInviteDirectionValue = (typeof SUBACCOUNT_INVITE_DIRECTION_VALUES)[number];\n\nexport const SUBACCOUNT_STATUS_VALUES = [\"active\", \"disabled\"] as const;\nexport type SubaccountStatusValue = (typeof SUBACCOUNT_STATUS_VALUES)[number];\n\nexport const ACTIVITY_ENTITY_KIND_VALUES = [\n \"account\",\n \"session\",\n \"api_key\",\n \"subaccount\",\n \"member\",\n \"policy\",\n \"invite\",\n \"security\",\n \"destination\",\n] as const;\nexport type ActivityEntityKindValue = (typeof ACTIVITY_ENTITY_KIND_VALUES)[number];\n\nexport const ACTIVITY_EVENT_ACTION_VALUES = [\n \"created\",\n \"updated\",\n \"deleted\",\n \"enabled\",\n \"disabled\",\n \"removed\",\n \"role_set\",\n \"received\",\n \"replied\",\n \"failed\",\n \"revoked\",\n \"blocked\",\n \"hold_placed\",\n \"hold_released\",\n] as const;\nexport type ActivityEventActionValue = (typeof ACTIVITY_EVENT_ACTION_VALUES)[number];\n\nexport const ACTIVITY_EVENT_SOURCE_VALUES = [\"web\", \"mobile\", \"api\"] as const;\nexport type ActivityEventSourceValue = (typeof ACTIVITY_EVENT_SOURCE_VALUES)[number];\n\nexport const SubaccountRoleCodec = {\n inputToProto: {\n owner: Proto.SubaccountRole.OWNER,\n admin: Proto.SubaccountRole.ADMIN,\n treasury: Proto.SubaccountRole.TREASURY,\n leveraged_trader: Proto.SubaccountRole.LEVERAGED_TRADER,\n trader: Proto.SubaccountRole.TRADER,\n viewer: Proto.SubaccountRole.VIEWER,\n } satisfies InputToProto<SubaccountRoleValue, Proto.SubaccountRole>,\n protoToOutput: {\n [Proto.SubaccountRole.SUBACCOUNT_ROLE_UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountRole.OWNER]: \"owner\",\n [Proto.SubaccountRole.ADMIN]: \"admin\",\n [Proto.SubaccountRole.TREASURY]: \"treasury\",\n [Proto.SubaccountRole.LEVERAGED_TRADER]: \"leveraged_trader\",\n [Proto.SubaccountRole.TRADER]: \"trader\",\n [Proto.SubaccountRole.VIEWER]: \"viewer\",\n } satisfies ProtoToOutput<Proto.SubaccountRole, SubaccountRoleValue>,\n} as const;\n\nexport const SubaccountPermissionCodec = {\n protoToOutput: {\n [Proto.SubaccountPermission.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT]: \"read_subaccount\",\n [Proto.SubaccountPermission.UPDATE_SUBACCOUNT]: \"update_subaccount\",\n [Proto.SubaccountPermission.READ_BALANCES]: \"read_balances\",\n [Proto.SubaccountPermission.READ_SPOT]: \"read_spot\",\n [Proto.SubaccountPermission.TRADE_SPOT]: \"trade_spot\",\n [Proto.SubaccountPermission.READ_INTERNAL_TRANSFERS]: \"read_internal_transfers\",\n [Proto.SubaccountPermission.INTERNAL_TRANSFER]: \"internal_transfer\",\n [Proto.SubaccountPermission.EXTERNAL_WITHDRAW]: \"external_withdraw\",\n [Proto.SubaccountPermission.READ_ADDRESS_BOOK]: \"read_address_book\",\n [Proto.SubaccountPermission.MANAGE_ADDRESS_BOOK]: \"manage_address_book\",\n [Proto.SubaccountPermission.READ_MEMBERS]: \"read_members\",\n [Proto.SubaccountPermission.MANAGE_MEMBERS]: \"manage_members\",\n [Proto.SubaccountPermission.READ_INVITES]: \"read_invites\",\n [Proto.SubaccountPermission.MANAGE_INVITES]: \"manage_invites\",\n [Proto.SubaccountPermission.READ_API_KEYS]: \"read_api_keys\",\n [Proto.SubaccountPermission.MANAGE_API_KEYS]: \"manage_api_keys\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT_POLICY]: \"read_subaccount_policy\",\n [Proto.SubaccountPermission.MANAGE_SUBACCOUNT_POLICY]: \"manage_subaccount_policy\",\n [Proto.SubaccountPermission.READ_ACTIVITY]: \"read_activity\",\n [Proto.SubaccountPermission.READ_ACTIVITY_SECURITY_DETAILS]:\n \"read_activity_security_details\",\n [Proto.SubaccountPermission.MANAGE_MEMBER_MFA_REQUIREMENT]: \"manage_member_mfa_requirement\",\n [Proto.SubaccountPermission.CREATE_DEPOSIT_ADDRESS]: \"create_deposit_address\",\n [Proto.SubaccountPermission.READ_DEPOSIT_ADDRESSES]: \"read_deposit_addresses\",\n [Proto.SubaccountPermission.READ_GUARD_SIGNER_STATUS]: \"read_guard_signer_status\",\n [Proto.SubaccountPermission.MANAGE_GUARD_SIGNER]: \"manage_guard_signer\",\n [Proto.SubaccountPermission.READ_AUTO_WITHDRAW]: \"read_auto_withdraw\",\n [Proto.SubaccountPermission.MANAGE_AUTO_WITHDRAW]: \"manage_auto_withdraw\",\n [Proto.SubaccountPermission.SWAP]: \"swap\",\n } satisfies ProtoToOutput<Proto.SubaccountPermission, SubaccountPermissionValue>,\n} as const;\n\nexport const InviteActionCodec = {\n inputToProto: {\n accept: Proto.SubaccountInviteAction.ACCEPT,\n decline: Proto.SubaccountInviteAction.DECLINE,\n cancel: Proto.SubaccountInviteAction.CANCEL,\n } satisfies InputToProto<SubaccountInviteActionValue, Proto.SubaccountInviteAction>,\n} as const;\n\nexport const InviteStatusCodec = {\n protoToOutput: {\n [Proto.SubaccountInviteStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountInviteStatus.PENDING]: \"pending\",\n [Proto.SubaccountInviteStatus.ACCEPTED]: \"accepted\",\n [Proto.SubaccountInviteStatus.DECLINED]: \"declined\",\n [Proto.SubaccountInviteStatus.CANCELLED]: \"cancelled\",\n } satisfies ProtoToOutput<Proto.SubaccountInviteStatus, SubaccountInviteStatusValue>,\n} as const;\n\nexport const SubaccountInviteDirectionCodec = {\n inputToProto: {\n \"\": Proto.SubaccountInviteDirection.DIRECTION_UNSPECIFIED,\n incoming: Proto.SubaccountInviteDirection.INCOMING,\n outgoing: Proto.SubaccountInviteDirection.OUTGOING,\n } satisfies InputToProto<SubaccountInviteDirectionValue, Proto.SubaccountInviteDirection>,\n} as const;\n\nexport const SubaccountStatusCodec = {\n inputToProto: {\n active: Proto.SubaccountStatus.ACTIVE,\n disabled: Proto.SubaccountStatus.DISABLED,\n } satisfies InputToProto<SubaccountStatusValue, Proto.SubaccountStatus>,\n protoToOutput: {\n [Proto.SubaccountStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountStatus.ACTIVE]: \"active\",\n [Proto.SubaccountStatus.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.SubaccountStatus, SubaccountStatusValue>,\n} as const;\n\nexport const ActivityEntityKindCodec = {\n protoToOutput: {\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_ACCOUNT]: \"account\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SESSION]: \"session\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_API_KEY]: \"api_key\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SUBACCOUNT]: \"subaccount\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_MEMBER]: \"member\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_POLICY]: \"policy\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_INVITE]: \"invite\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SECURITY]: \"security\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_DESTINATION]: \"destination\",\n } satisfies ProtoToOutput<Proto.ActivityEntityKind, ActivityEntityKindValue>,\n} as const;\n\nexport const ActivityEventActionCodec = {\n protoToOutput: {\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_CREATED]: \"created\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UPDATED]: \"updated\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DELETED]: \"deleted\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ENABLED]: \"enabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DISABLED]: \"disabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REMOVED]: \"removed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ROLE_SET]: \"role_set\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_RECEIVED]: \"received\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REPLIED]: \"replied\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_FAILED]: \"failed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REVOKED]: \"revoked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_BLOCKED]: \"blocked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_PLACED]: \"hold_placed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_RELEASED]: \"hold_released\",\n } satisfies ProtoToOutput<Proto.ActivityEventAction, ActivityEventActionValue>,\n} as const;\n\nexport const ActivityEventSourceCodec = {\n protoToOutput: {\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_WEB]: \"web\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_MOBILE]: \"mobile\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_API]: \"api\",\n } satisfies ProtoToOutput<Proto.ActivityEventSource, ActivityEventSourceValue>,\n} as const;\n"],"mappings":";;AAwDA,MAAa,qCAAqC;CAAC;CAAI;CAAY;AAAU;AAG7E,MAAa,2BAA2B,CAAC,UAAU,UAAU;AAqC7D,MAAa,sBAAsB;CAC/B,cAAc;EACV,OAAA;EACA,OAAA;EACA,UAAA;EACA,kBAAA;EACA,QAAA;EACA,QAAA;CACJ;CACA,eAAe;GACyC,IAAA;GACtB,IAAA;GACA,IAAA;GACG,IAAA;GACQ,IAAA;GACV,IAAA;GACA,IAAA;CACnC;AACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EAC+B,IAAA;EACI,IAAA;EACE,IAAA;EACJ,IAAA;EACJ,IAAA;EACC,IAAA;EACa,IAAA;EACN,IAAA;EACA,IAAA;EACA,IAAA;EACE,KAAA;EACP,KAAA;EACE,KAAA;EACF,KAAA;EACE,KAAA;EACD,KAAA;EACE,KAAA;EACO,KAAA;EACE,KAAA;EACX,KAAA;EAExC,KAAA;EACwD,KAAA;EACP,KAAA;EACA,KAAA;EACE,KAAA;EACL,KAAA;EACD,KAAA;EACE,KAAA;EAChB,KAAA;AACvC,EACJ;AAEA,MAAa,oBAAoB,EAC7B,cAAc;CACV,QAAA;CACA,SAAA;CACA,QAAA;AACJ,EACJ;AAEA,MAAa,oBAAoB,EAC7B,eAAe;EACiC,IAAA;EACJ,IAAA;EACC,IAAA;EACA,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,iCAAiC,EAC1C,cAAc;CACV,IAAA;CACA,UAAA;CACA,UAAA;AACJ,EACJ;AAEA,MAAa,wBAAwB;CACjC,cAAc;EACV,QAAA;EACA,UAAA;CACJ;CACA,eAAe;GAC2B,IAAA;GACL,IAAA;GACE,IAAA;CACvC;AACJ;AAEA,MAAa,0BAA0B,EACnC,eAAe;EAC6C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACG,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACE,IAAA;EACG,IAAA;AAC5D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACA,IAAA;EACC,IAAA;EACD,IAAA;EACC,IAAA;EACA,IAAA;EACD,IAAA;EACD,KAAA;EACC,KAAA;EACA,KAAA;EACI,KAAA;EACE,KAAA;AAC/D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACR,IAAA;EACG,IAAA;EACH,IAAA;AACrD,EACJ"}
@@ -33,7 +33,7 @@ declare class SubaccountsService {
33
33
  subaccounts: v.InferOutput<typeof SubaccountSchema>[];
34
34
  }>;
35
35
  /**
36
- * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, balances, members, and outgoing invites; throws if the subaccount is missing.
36
+ * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, members, and outgoing invites; throws if the subaccount is missing.
37
37
  */
38
38
  get(input: v.InferInput<typeof SubaccountIdInputSchema>, options?: PolyesterRequestOptions): Promise<Subaccount & {
39
39
  apiKeys: ApiKey[];
@@ -1 +1 @@
1
- {"version":3,"file":"subaccounts.d.ts","names":[],"sources":["../../../src/services/subaccounts/subaccounts.ts"],"mappings":";;;;;;;;;;;;;;UAsDU,kCAAkC,mBAAmB;EAC3D;;UAGM,8BAA8B,mBAAmB;EACvD;;;;;cAMS;;WACA,UAAU;EASf,YAAA,YAAY,4BACZ,UAAU,mBACV,WAAW;;;;EAaT,KAAK,UAAU,0BAA0B;IAC3C;IACA,aAAa,EAAE,mBAAmB;;;;;EAYhC,IACF,OAAO,EAAE,kBAAkB,0BAC3B,UAAU,0BACX,QACC;IACI,SAAS;IACT,QAAQ;IACR,SAAS;IACT,SAAS;;;;;;;EAqCX,gBACF,OAAO,EAAE,kBAAkB,uCAC3B,UAAU,0BACX,QAAQ;;;;EAYL,OACF,OAAO,EAAE,kBAAkB,8BAC3B,UAAU,2BACX,QAAQ;;;;EAYL,O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X,QAAQ;;;;EAYL,OACF,OAAO,EAAE,kBAAkB,8BAC3B,UAAU,2BACX,QAAQ;;;;EAaL,aACF,OAAO,EAAE,kBAAkB,oCAC3B,UAAU,2BACX,QAAQ;;;;EAYL,aACF,OAAO,EAAE,kBAAkB,oCAC3B,UAAU,2BACX,QAAQ;;;;EAYL,iBACF,OAAO,EAAE,kBAAkB,wCAC3B,UAAU,2BACX,QAAQ;;;;EAYL,wBACF,OAAO,EAAE,kBAAkB,+CAC3B,UAAU,2BACX,QAAQ;;;;;EAaL,YACF,OAAO,EAAE,kBAAkB,mCAC3B,UAAU,0BACX,QAAQ;;;;EAYL,UAAU,UAAU,0BAA0B,QAAQ;;;;EAWtD,wBACF,OAAO,EAAE,kBAAkB,0BAC3B,UAAU,0BACX,QAAQ;;;;EAYL,YACF,OAAO,EAAE,kBAAkB,0BAC3B,UAAU,0BACX,QAAQ;;;;EAYL,cACF,OAAO,EAAE,kBAAkB,qCAC3B,UAAU,2BACX,QAAQ;;;;EAYL,WACF,OAAO,EAAE,kBAAkB,gCAC3B,UAAU,0BACX;IAAU,QAAQ;IAAmB;;;;;EAexC,UAAU,OAAO;;;;EAmBjB,iBAAiB,OAAO"}
@@ -39,7 +39,7 @@ var SubaccountsService = class {
39
39
  };
40
40
  }
41
41
  /**
42
- * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, balances, members, and outgoing invites; throws if the subaccount is missing.
42
+ * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, members, and outgoing invites; throws if the subaccount is missing.
43
43
  */
44
44
  async get(input, options) {
45
45
  const validatedInput = parse(SubaccountIdInputSchema, input);
@@ -47,7 +47,6 @@ var SubaccountsService = class {
47
47
  const res = await this.#viewClient.getSubaccount({
48
48
  subaccountId: validatedInput.subaccountId,
49
49
  includeApiKeys: true,
50
- includeBalances: true,
51
50
  includeMembers: true,
52
51
  includeInvites: true,
53
52
  includePolicy: true,
@@ -1 +1 @@
1
- {"version":3,"file":"subaccounts.js","names":["#client","Proto.SubaccountService","#viewClient","Proto.SubaccountViewService","#publicRoleClient","Proto.SubaccountRoleService","#authRoleClient","#realtime","SubaccountSchema","ApiKeySchema","Proto.SubaccountSchema","ProtoApiKeys.ApiKeySchema"],"sources":["../../../src/services/subaccounts/subaccounts.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport * as ProtoApiKeys from \"../../gen/auth/v1/api_keys_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type ApiKey, ApiKeySchema } from \"../api-keys/index.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport {\n DEFAULT_SUBACCOUNT_POLICY,\n SubaccountPoliciesService,\n type SubaccountPolicy,\n SubaccountPolicySchema,\n} from \"../policies/subaccount-policies/index.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport type { SubaccountResolver } from \"../subaccount-resolver.js\";\nimport {\n CreateSubaccountChallengeInputSchema,\n CreateSubaccountInputSchema,\n CreateSubaccountResultSchema,\n SubaccountChallengeSchema,\n UpdateSubaccountInputSchema,\n InviteSubaccountMemberInputSchema,\n RemoveSubaccountMemberInputSchema,\n UpdateSubaccountMemberRoleInputSchema,\n ListSubaccountInvitesInputSchema,\n RespondSubaccountInviteInputSchema,\n SubaccountActivityInputSchema,\n SubaccountSchema,\n SubaccountMemberSchema,\n SubaccountInviteSchema,\n SubaccountActivityEventSchema,\n SetSubaccountMemberMfaRequirementInputSchema,\n SubaccountIdInputSchema,\n SubaccountMutationResultSchema,\n SubaccountRoleCatalogSchema,\n EffectiveSubaccountPermissionsSchema,\n type CreateSubaccountResult,\n type SubaccountChallenge,\n type Subaccount,\n type SubaccountMember,\n type SubaccountInvite,\n type SubaccountEvent,\n type SubaccountMutationResult,\n type SubaccountRoleCatalog,\n type EffectiveSubaccountPermissions,\n} from \"./subaccounts.schemas.js\";\n\ninterface SubscribeSubaccountsInput extends BaseSubscribeInput<Subaccount> {\n accountId: string;\n}\n\ninterface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {\n accountId: string;\n}\n\n/**\n * Reads the public role catalog and creates, manages, shares, audits, and subscribes to subaccounts visible to the authenticated caller.\n */\nexport class SubaccountsService {\n readonly policies: SubaccountPoliciesService;\n\n #client: Client<typeof Proto.SubaccountService>;\n #viewClient: Client<typeof Proto.SubaccountViewService>;\n #publicRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #authRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #realtime: PolyesterRealtime;\n\n constructor(\n transports: AuthAndPublicApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.policies = new SubaccountPoliciesService(transports, realtime, resolver);\n this.#client = createClient(Proto.SubaccountService, transports.authApi);\n this.#viewClient = createClient(Proto.SubaccountViewService, transports.authApi);\n this.#publicRoleClient = createClient(Proto.SubaccountRoleService, transports.publicApi);\n this.#authRoleClient = createClient(Proto.SubaccountRoleService, transports.authApi);\n this.#realtime = realtime;\n }\n\n /**\n * Returns subaccounts owned by or shared with the caller plus totalCreated, including soft-deleted ones. Use `createChallenge` for the canonical next smart-account address and salt.\n */\n async list(options?: PolyesterRequestOptions): Promise<{\n totalCreated: number;\n subaccounts: v.InferOutput<typeof SubaccountSchema>[];\n }> {\n const res = await this.#client.listSubaccounts({}, toConnectCallOptions(options));\n return {\n totalCreated: res.totalCreated,\n subaccounts: parse(v.array(SubaccountSchema), res.subaccounts),\n };\n }\n\n /**\n * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, balances, members, and outgoing invites; throws if the subaccount is missing.\n */\n async get(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<\n Subaccount & {\n apiKeys: ApiKey[];\n policy: SubaccountPolicy;\n members: SubaccountMember[];\n invites: SubaccountInvite[];\n }\n > {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const subaccountId = formatId(validatedInput.subaccountId);\n const res = await this.#viewClient.getSubaccount(\n {\n subaccountId: validatedInput.subaccountId,\n includeApiKeys: true,\n includeBalances: true,\n includeMembers: true,\n includeInvites: true,\n includePolicy: true,\n invitesDirection: Proto.SubaccountInviteDirection.OUTGOING,\n },\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(`Subaccount not found: ${subaccountId}`);\n\n return {\n ...parse(SubaccountSchema, res.subaccount),\n policy: res.policy\n ? parse(SubaccountPolicySchema, res.policy)\n : DEFAULT_SUBACCOUNT_POLICY,\n apiKeys: parse(v.optional(v.array(ApiKeySchema), []), res.apiKeys),\n members: parse(v.optional(v.array(SubaccountMemberSchema), []), res.members),\n invites: v\n .parse(v.optional(v.array(SubaccountInviteSchema), []), res.invites)\n .filter((invite) => invite.subaccountId === subaccountId),\n };\n }\n\n /**\n * Requests the canonical next smart account and a short-lived EIP-191 authorization message\n * bound to the authenticated root and the selected owner EOA. Sign the exact message through\n * the returned smart account, then pass it to `create`. A new challenge replaces the previous one.\n */\n async createChallenge(\n input: v.InferInput<typeof CreateSubaccountChallengeInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountChallenge> {\n const validatedInput = parse(CreateSubaccountChallengeInputSchema, input);\n const res = await this.#client.createSubaccountChallenge(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountChallengeSchema, res);\n }\n\n /**\n * Creates a new subaccount under the caller's root account using the smart-account address, message, and smart-account signature from `createChallenge`.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CreateSubaccountResult> {\n const validatedInput = parse(CreateSubaccountInputSchema, input);\n const res = await this.#client.createSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(CreateSubaccountResultSchema, res);\n }\n\n /**\n * Updates mutable subaccount display/status fields such as label and active/disabled status.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Subaccount> {\n const validatedInput = parse(UpdateSubaccountInputSchema, input);\n const res = await this.#client.updateSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(\"Failed to update subaccount\");\n return parse(SubaccountSchema, res.subaccount);\n }\n\n /**\n * Creates or refreshes a pending invitation granting a role on a subaccount to another root account.\n */\n async inviteMember(\n input: v.InferInput<typeof InviteSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(InviteSubaccountMemberInputSchema, input);\n const res = await this.#client.inviteSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Removes delegated access for a subaccount member by grantee account ID.\n */\n async removeMember(\n input: v.InferInput<typeof RemoveSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(RemoveSubaccountMemberInputSchema, input);\n const res = await this.#client.removeSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Changes an existing delegated member's role without sending a new invitation.\n */\n async updateMemberRole(\n input: v.InferInput<typeof UpdateSubaccountMemberRoleInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(UpdateSubaccountMemberRoleInputSchema, input);\n const res = await this.#client.updateSubaccountMemberRole(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Enables or disables the owner-controlled MFA requirement for delegated interactive member actions on a subaccount.\n */\n async setMemberMfaRequirement(\n input: v.InferInput<typeof SetSubaccountMemberMfaRequirementInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(SetSubaccountMemberMfaRequirementInputSchema, input);\n const res = await this.#client.setSubaccountMemberMFARequirement(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Returns the caller's subaccount invitations, newest first. Omit `direction` to include both\n * incoming and outgoing invitations, or pass `\"incoming\"` or `\"outgoing\"` to filter.\n */\n async listInvites(\n input: v.InferInput<typeof ListSubaccountInvitesInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountInvite[]> {\n const validatedInput = parse(ListSubaccountInvitesInputSchema, input);\n const res = await this.#client.listSubaccountInvites(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountInviteSchema), res.invites);\n }\n\n /**\n * Returns the public built-in role and permission catalog with display metadata and per-role permission sets.\n */\n async listRoles(options?: PolyesterRequestOptions): Promise<SubaccountRoleCatalog> {\n const res = await this.#publicRoleClient.listSubaccountRoles(\n {},\n toConnectCallOptions(options),\n );\n return parse(SubaccountRoleCatalogSchema, res);\n }\n\n /**\n * Returns the caller's current role, effective role-granted permissions, and attached policy ID for a subaccount.\n */\n async getEffectivePermissions(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<EffectiveSubaccountPermissions> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#authRoleClient.getEffectiveSubaccountPermissions(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(EffectiveSubaccountPermissionsSchema, res);\n }\n\n /**\n * Returns the owner and delegated members for a subaccount, including role and MFA enrollment status.\n */\n async listMembers(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountMember[]> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#client.listSubaccountMembers(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountMemberSchema), res.members);\n }\n\n /**\n * Accepts or rejects an incoming invite, or cancels an outgoing invite, returning the updated invitation.\n */\n async respondInvite(\n input: v.InferInput<typeof RespondSubaccountInviteInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(RespondSubaccountInviteInputSchema, input);\n const res = await this.#client.respondSubaccountInvite(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Returns paginated audit/activity events for a subaccount, newest first, with a non-negative integer limit from 0 through 200 and opaque cursor pagination.\n */\n async listEvents(\n input: v.InferInput<typeof SubaccountActivityInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<{ events: SubaccountEvent[]; nextPageToken: string }> {\n const validatedInput = parse(SubaccountActivityInputSchema, input);\n const res = await this.#viewClient.listSubaccountActivity(\n validatedInput,\n toConnectCallOptions(options),\n );\n return {\n events: parse(v.optional(v.array(SubaccountActivityEventSchema), []), res.events),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Subscribes to private subaccount updates for an account and emits normalized subaccount records.\n */\n subscribe(input: SubscribeSubaccountsInput) {\n const channel = `private:auth:subaccounts:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.SubaccountSchema,\n onPublication: (data) => {\n const subaccount = parse(SubaccountSchema, data);\n input.onEvent(subaccount);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n\n /**\n * Subscribes to private API key updates for an account through the subaccount realtime channel helper.\n */\n subscribeApiKeys(input: SubscribeApiKeysInput) {\n const channel = `private:auth:api-keys:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: ProtoApiKeys.ApiKeySchema,\n onPublication: (data) => {\n const apiKey = parse(ApiKeySchema, data);\n input.onEvent(apiKey);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n on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;;;CAKA,MAAM,WACF,OACA,SAC6D;EAC7D,MAAM,iBAAiB,MAAM,+BAA+B,KAAK;EACjE,MAAM,MAAM,MAAM,KAAKE,YAAY,uBAC/B,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,QAAQ,MAAM,EAAE,SAAS,EAAE,MAAM,6BAA6B,GAAG,CAAC,CAAC,GAAG,IAAI,MAAM;GAChF,eAAe,IAAI;EACvB;CACJ;;;;CAKA,UAAU,OAAkC;EACxC,MAAM,UAAU,4BAA4B,MAAM,UAAU;EAE5D,OAAO,KAAKK,UAAU,oBAAoB;GACtC;GACA,QAAQG;GACR,gBAAgB,SAAS;IACrB,MAAM,aAAa,MAAMF,oBAAkB,IAAI;IAC/C,MAAM,QAAQ,UAAU;GAC5B;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;;;;CAKA,iBAAiB,OAA8B;EAC3C,MAAM,UAAU,yBAAyB,MAAM,UAAU;EAEzD,OAAO,KAAKD,UAAU,oBAAoB;GACtC;GACA,QAAQI;GACR,gBAAgB,SAAS;IACrB,MAAM,SAAS,MAAMF,gBAAc,IAAI;IACvC,MAAM,QAAQ,MAAM;GACxB;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
1
+ {"version":3,"file":"subaccounts.js","names":["#client","Proto.SubaccountService","#viewClient","Proto.SubaccountViewService","#publicRoleClient","Proto.SubaccountRoleService","#authRoleClient","#realtime","SubaccountSchema","ApiKeySchema","Proto.SubaccountSchema","ProtoApiKeys.ApiKeySchema"],"sources":["../../../src/services/subaccounts/subaccounts.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport * as ProtoApiKeys from \"../../gen/auth/v1/api_keys_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type ApiKey, ApiKeySchema } from \"../api-keys/index.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport {\n DEFAULT_SUBACCOUNT_POLICY,\n SubaccountPoliciesService,\n type SubaccountPolicy,\n SubaccountPolicySchema,\n} from \"../policies/subaccount-policies/index.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport type { SubaccountResolver } from \"../subaccount-resolver.js\";\nimport {\n CreateSubaccountChallengeInputSchema,\n CreateSubaccountInputSchema,\n CreateSubaccountResultSchema,\n SubaccountChallengeSchema,\n UpdateSubaccountInputSchema,\n InviteSubaccountMemberInputSchema,\n RemoveSubaccountMemberInputSchema,\n UpdateSubaccountMemberRoleInputSchema,\n ListSubaccountInvitesInputSchema,\n RespondSubaccountInviteInputSchema,\n SubaccountActivityInputSchema,\n SubaccountSchema,\n SubaccountMemberSchema,\n SubaccountInviteSchema,\n SubaccountActivityEventSchema,\n SetSubaccountMemberMfaRequirementInputSchema,\n SubaccountIdInputSchema,\n SubaccountMutationResultSchema,\n SubaccountRoleCatalogSchema,\n EffectiveSubaccountPermissionsSchema,\n type CreateSubaccountResult,\n type SubaccountChallenge,\n type Subaccount,\n type SubaccountMember,\n type SubaccountInvite,\n type SubaccountEvent,\n type SubaccountMutationResult,\n type SubaccountRoleCatalog,\n type EffectiveSubaccountPermissions,\n} from \"./subaccounts.schemas.js\";\n\ninterface SubscribeSubaccountsInput extends BaseSubscribeInput<Subaccount> {\n accountId: string;\n}\n\ninterface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {\n accountId: string;\n}\n\n/**\n * Reads the public role catalog and creates, manages, shares, audits, and subscribes to subaccounts visible to the authenticated caller.\n */\nexport class SubaccountsService {\n readonly policies: SubaccountPoliciesService;\n\n #client: Client<typeof Proto.SubaccountService>;\n #viewClient: Client<typeof Proto.SubaccountViewService>;\n #publicRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #authRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #realtime: PolyesterRealtime;\n\n constructor(\n transports: AuthAndPublicApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.policies = new SubaccountPoliciesService(transports, realtime, resolver);\n this.#client = createClient(Proto.SubaccountService, transports.authApi);\n this.#viewClient = createClient(Proto.SubaccountViewService, transports.authApi);\n this.#publicRoleClient = createClient(Proto.SubaccountRoleService, transports.publicApi);\n this.#authRoleClient = createClient(Proto.SubaccountRoleService, transports.authApi);\n this.#realtime = realtime;\n }\n\n /**\n * Returns subaccounts owned by or shared with the caller plus totalCreated, including soft-deleted ones. Use `createChallenge` for the canonical next smart-account address and salt.\n */\n async list(options?: PolyesterRequestOptions): Promise<{\n totalCreated: number;\n subaccounts: v.InferOutput<typeof SubaccountSchema>[];\n }> {\n const res = await this.#client.listSubaccounts({}, toConnectCallOptions(options));\n return {\n totalCreated: res.totalCreated,\n subaccounts: parse(v.array(SubaccountSchema), res.subaccounts),\n };\n }\n\n /**\n * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, members, and outgoing invites; throws if the subaccount is missing.\n */\n async get(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<\n Subaccount & {\n apiKeys: ApiKey[];\n policy: SubaccountPolicy;\n members: SubaccountMember[];\n invites: SubaccountInvite[];\n }\n > {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const subaccountId = formatId(validatedInput.subaccountId);\n const res = await this.#viewClient.getSubaccount(\n {\n subaccountId: validatedInput.subaccountId,\n includeApiKeys: true,\n includeMembers: true,\n includeInvites: true,\n includePolicy: true,\n invitesDirection: Proto.SubaccountInviteDirection.OUTGOING,\n },\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(`Subaccount not found: ${subaccountId}`);\n\n return {\n ...parse(SubaccountSchema, res.subaccount),\n policy: res.policy\n ? parse(SubaccountPolicySchema, res.policy)\n : DEFAULT_SUBACCOUNT_POLICY,\n apiKeys: parse(v.optional(v.array(ApiKeySchema), []), res.apiKeys),\n members: parse(v.optional(v.array(SubaccountMemberSchema), []), res.members),\n invites: v\n .parse(v.optional(v.array(SubaccountInviteSchema), []), res.invites)\n .filter((invite) => invite.subaccountId === subaccountId),\n };\n }\n\n /**\n * Requests the canonical next smart account and a short-lived EIP-191 authorization message\n * bound to the authenticated root and the selected owner EOA. Sign the exact message through\n * the returned smart account, then pass it to `create`. A new challenge replaces the previous one.\n */\n async createChallenge(\n input: v.InferInput<typeof CreateSubaccountChallengeInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountChallenge> {\n const validatedInput = parse(CreateSubaccountChallengeInputSchema, input);\n const res = await this.#client.createSubaccountChallenge(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountChallengeSchema, res);\n }\n\n /**\n * Creates a new subaccount under the caller's root account using the smart-account address, message, and smart-account signature from `createChallenge`.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CreateSubaccountResult> {\n const validatedInput = parse(CreateSubaccountInputSchema, input);\n const res = await this.#client.createSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(CreateSubaccountResultSchema, res);\n }\n\n /**\n * Updates mutable subaccount display/status fields such as label and active/disabled status.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Subaccount> {\n const validatedInput = parse(UpdateSubaccountInputSchema, input);\n const res = await this.#client.updateSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(\"Failed to update subaccount\");\n return parse(SubaccountSchema, res.subaccount);\n }\n\n /**\n * Creates or refreshes a pending invitation granting a role on a subaccount to another root account.\n */\n async inviteMember(\n input: v.InferInput<typeof InviteSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(InviteSubaccountMemberInputSchema, input);\n const res = await this.#client.inviteSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Removes delegated access for a subaccount member by grantee account ID.\n */\n async removeMember(\n input: v.InferInput<typeof RemoveSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(RemoveSubaccountMemberInputSchema, input);\n const res = await this.#client.removeSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Changes an existing delegated member's role without sending a new invitation.\n */\n async updateMemberRole(\n input: v.InferInput<typeof UpdateSubaccountMemberRoleInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(UpdateSubaccountMemberRoleInputSchema, input);\n const res = await this.#client.updateSubaccountMemberRole(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Enables or disables the owner-controlled MFA requirement for delegated interactive member actions on a subaccount.\n */\n async setMemberMfaRequirement(\n input: v.InferInput<typeof SetSubaccountMemberMfaRequirementInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(SetSubaccountMemberMfaRequirementInputSchema, input);\n const res = await this.#client.setSubaccountMemberMFARequirement(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Returns the caller's subaccount invitations, newest first. Omit `direction` to include both\n * incoming and outgoing invitations, or pass `\"incoming\"` or `\"outgoing\"` to filter.\n */\n async listInvites(\n input: v.InferInput<typeof ListSubaccountInvitesInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountInvite[]> {\n const validatedInput = parse(ListSubaccountInvitesInputSchema, input);\n const res = await this.#client.listSubaccountInvites(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountInviteSchema), res.invites);\n }\n\n /**\n * Returns the public built-in role and permission catalog with display metadata and per-role permission sets.\n */\n async listRoles(options?: PolyesterRequestOptions): Promise<SubaccountRoleCatalog> {\n const res = await this.#publicRoleClient.listSubaccountRoles(\n {},\n toConnectCallOptions(options),\n );\n return parse(SubaccountRoleCatalogSchema, res);\n }\n\n /**\n * Returns the caller's current role, effective role-granted permissions, and attached policy ID for a subaccount.\n */\n async getEffectivePermissions(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<EffectiveSubaccountPermissions> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#authRoleClient.getEffectiveSubaccountPermissions(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(EffectiveSubaccountPermissionsSchema, res);\n }\n\n /**\n * Returns the owner and delegated members for a subaccount, including role and MFA enrollment status.\n */\n async listMembers(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountMember[]> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#client.listSubaccountMembers(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountMemberSchema), res.members);\n }\n\n /**\n * Accepts or rejects an incoming invite, or cancels an outgoing invite, returning the updated invitation.\n */\n async respondInvite(\n input: v.InferInput<typeof RespondSubaccountInviteInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(RespondSubaccountInviteInputSchema, input);\n const res = await this.#client.respondSubaccountInvite(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Returns paginated audit/activity events for a subaccount, newest first, with a non-negative integer limit from 0 through 200 and opaque cursor pagination.\n */\n async listEvents(\n input: v.InferInput<typeof SubaccountActivityInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<{ events: SubaccountEvent[]; nextPageToken: string }> {\n const validatedInput = parse(SubaccountActivityInputSchema, input);\n const res = await this.#viewClient.listSubaccountActivity(\n validatedInput,\n toConnectCallOptions(options),\n );\n return {\n events: parse(v.optional(v.array(SubaccountActivityEventSchema), []), res.events),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Subscribes to private subaccount updates for an account and emits normalized subaccount records.\n */\n subscribe(input: SubscribeSubaccountsInput) {\n const channel = `private:auth:subaccounts:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.SubaccountSchema,\n onPublication: (data) => {\n const subaccount = parse(SubaccountSchema, data);\n input.onEvent(subaccount);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n\n /**\n * Subscribes to private API key updates for an account through the subaccount realtime channel helper.\n */\n subscribeApiKeys(input: SubscribeApiKeysInput) {\n const channel = `private:auth:api-keys:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: ProtoApiKeys.ApiKeySchema,\n onPublication: (data) => {\n const apiKey = parse(ApiKeySchema, data);\n input.onEvent(apiKey);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiEA,IAAa,qBAAb,MAAgC;CAC5B;CAEA;CACA;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAK,WAAW,IAAI,0BAA0B,YAAY,UAAU,QAAQ;EAC5E,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,OAAO;EACvE,KAAKC,cAAc,aAAaC,uBAA6B,WAAW,OAAO;EAC/E,KAAKC,oBAAoB,aAAaC,uBAA6B,WAAW,SAAS;EACvF,KAAKC,kBAAk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