@polyester/sdk 0.36.0-devnet-20261112202000 → 0.36.0-devnet-20261114152753

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 (230) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/dist/catalogs/index.d.ts +2 -2
  3. package/dist/catalogs/snapshot-validation.js +3 -1
  4. package/dist/catalogs/snapshot-validation.js.map +1 -1
  5. package/dist/catalogs/zipper-catalog.d.ts +2 -0
  6. package/dist/catalogs/zipper-catalog.d.ts.map +1 -1
  7. package/dist/catalogs/zipper-catalog.js.map +1 -1
  8. package/dist/gen/ai/v1/assistant_pb.d.ts +211 -9
  9. package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
  10. package/dist/gen/ai/v1/assistant_pb.js +163 -73
  11. package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
  12. package/dist/gen/auth/v1/api_keys_pb.d.ts +62 -5
  13. package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
  14. package/dist/gen/auth/v1/api_keys_pb.js +50 -2
  15. package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
  16. package/dist/gen/auth/v1/policies_pb.d.ts +9 -1
  17. package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
  18. package/dist/gen/auth/v1/policies_pb.js +9 -1
  19. package/dist/gen/auth/v1/policies_pb.js.map +1 -1
  20. package/dist/gen/auth/v1/subaccounts_pb.d.ts +7 -1
  21. package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
  22. package/dist/gen/auth/v1/subaccounts_pb.js +7 -1
  23. package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
  24. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +10 -2
  25. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
  26. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
  27. package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +10 -5
  28. package/dist/gen/chain/lifecycle/v1/types_pb.d.ts.map +1 -1
  29. package/dist/gen/chain/lifecycle/v1/types_pb.js +10 -5
  30. package/dist/gen/chain/lifecycle/v1/types_pb.js.map +1 -1
  31. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +6 -1
  32. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -1
  33. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
  34. package/dist/gen/chain/zipper/v1/reason_pb.d.ts +6 -2
  35. package/dist/gen/chain/zipper/v1/reason_pb.d.ts.map +1 -1
  36. package/dist/gen/chain/zipper/v1/reason_pb.js.map +1 -1
  37. package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +47 -2
  38. package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
  39. package/dist/gen/chain/zipper/v1/zipper_pb.js +36 -2
  40. package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
  41. package/dist/gen/changelog/v1/changelog_pb.d.ts +488 -5
  42. package/dist/gen/changelog/v1/changelog_pb.d.ts.map +1 -1
  43. package/dist/gen/changelog/v1/changelog_pb.js +159 -15
  44. package/dist/gen/changelog/v1/changelog_pb.js.map +1 -1
  45. package/dist/gen/index.d.ts +2 -1
  46. package/dist/gen/index.js +2 -1
  47. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +128 -5
  48. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
  49. package/dist/gen/ledger/read/v1/ledger_read_pb.js +17 -3
  50. package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
  51. package/dist/gen/ledger/v1/catalog_pb.d.ts +11 -4
  52. package/dist/gen/ledger/v1/catalog_pb.d.ts.map +1 -1
  53. package/dist/gen/ledger/v1/catalog_pb.js +11 -4
  54. package/dist/gen/ledger/v1/catalog_pb.js.map +1 -1
  55. package/dist/gen/marketdata/v1/asset_info_pb.d.ts +178 -0
  56. package/dist/gen/marketdata/v1/asset_info_pb.d.ts.map +1 -0
  57. package/dist/gen/marketdata/v1/asset_info_pb.js +45 -0
  58. package/dist/gen/marketdata/v1/asset_info_pb.js.map +1 -0
  59. package/dist/gen/marketdata/v1/marketdata_pb.d.ts +12 -0
  60. package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
  61. package/dist/gen/marketdata/v1/marketdata_pb.js +6 -1
  62. package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
  63. package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +3 -2
  64. package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts.map +1 -1
  65. package/dist/gen/marketoverview/v1/marketoverview_pb.js.map +1 -1
  66. package/dist/gen/notifications/v1/notifications_pb.d.ts +154 -3
  67. package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -1
  68. package/dist/gen/notifications/v1/notifications_pb.js +102 -15
  69. package/dist/gen/notifications/v1/notifications_pb.js.map +1 -1
  70. package/dist/gen/orderbook/v1/orderbook_pb.d.ts +18 -10
  71. package/dist/gen/orderbook/v1/orderbook_pb.d.ts.map +1 -1
  72. package/dist/gen/orderbook/v1/orderbook_pb.js.map +1 -1
  73. package/dist/gen/orders/v1/orders_pb.d.ts +12 -1
  74. package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
  75. package/dist/gen/orders/v1/orders_pb.js +12 -1
  76. package/dist/gen/orders/v1/orders_pb.js.map +1 -1
  77. package/dist/gen/orders/v1/orders_read_pb.d.ts +6 -1
  78. package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
  79. package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
  80. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +12 -0
  81. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
  82. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +12 -0
  83. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
  84. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +13 -9
  85. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
  86. package/dist/gen/swap/quickswap/v1/quickswap_pb.js +10 -7
  87. package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
  88. package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +2 -2
  89. package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js.map +1 -1
  90. package/dist/gen/system/v1/system_pb.d.ts +408 -3
  91. package/dist/gen/system/v1/system_pb.d.ts.map +1 -1
  92. package/dist/gen/system/v1/system_pb.js +221 -3
  93. package/dist/gen/system/v1/system_pb.js.map +1 -1
  94. package/dist/gen/triggers/v1/triggers_pb.d.ts +12 -4
  95. package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
  96. package/dist/gen/triggers/v1/triggers_pb.js +6 -4
  97. package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
  98. package/dist/index.d.ts +13 -9
  99. package/dist/services/api-keys/api-keys.codecs.d.ts +14 -0
  100. package/dist/services/api-keys/api-keys.codecs.d.ts.map +1 -0
  101. package/dist/services/api-keys/api-keys.codecs.js +13 -1
  102. package/dist/services/api-keys/api-keys.codecs.js.map +1 -1
  103. package/dist/services/api-keys/api-keys.d.ts +2 -2
  104. package/dist/services/api-keys/api-keys.js +2 -2
  105. package/dist/services/api-keys/api-keys.js.map +1 -1
  106. package/dist/services/api-keys/api-keys.schemas.d.ts +46 -12
  107. package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
  108. package/dist/services/api-keys/api-keys.schemas.js +10 -4
  109. package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
  110. package/dist/services/api-keys/api-keys.types.d.ts +2 -1
  111. package/dist/services/assistant/assistant-events.schemas.d.ts +131 -71
  112. package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -1
  113. package/dist/services/assistant/assistant-events.schemas.js +20 -2
  114. package/dist/services/assistant/assistant-events.schemas.js.map +1 -1
  115. package/dist/services/assistant/assistant.codecs.d.ts +10 -1
  116. package/dist/services/assistant/assistant.codecs.d.ts.map +1 -1
  117. package/dist/services/assistant/assistant.codecs.js +41 -1
  118. package/dist/services/assistant/assistant.codecs.js.map +1 -1
  119. package/dist/services/assistant/assistant.schemas.d.ts +22 -4
  120. package/dist/services/assistant/assistant.schemas.d.ts.map +1 -1
  121. package/dist/services/assistant/assistant.schemas.js +27 -4
  122. package/dist/services/assistant/assistant.schemas.js.map +1 -1
  123. package/dist/services/assistant/assistant.types.d.ts +2 -2
  124. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +19 -19
  125. package/dist/services/balances/balances.d.ts +12 -1
  126. package/dist/services/balances/balances.d.ts.map +1 -1
  127. package/dist/services/balances/balances.js +37 -1
  128. package/dist/services/balances/balances.js.map +1 -1
  129. package/dist/services/balances/balances.schemas.d.ts +55 -1
  130. package/dist/services/balances/balances.schemas.d.ts.map +1 -1
  131. package/dist/services/balances/balances.schemas.js +22 -1
  132. package/dist/services/balances/balances.schemas.js.map +1 -1
  133. package/dist/services/balances/balances.types.d.ts +2 -2
  134. package/dist/services/changelog/changelog.codecs.d.ts +10 -1
  135. package/dist/services/changelog/changelog.codecs.d.ts.map +1 -1
  136. package/dist/services/changelog/changelog.codecs.js +13 -1
  137. package/dist/services/changelog/changelog.codecs.js.map +1 -1
  138. package/dist/services/changelog/changelog.d.ts +14 -1
  139. package/dist/services/changelog/changelog.d.ts.map +1 -1
  140. package/dist/services/changelog/changelog.js +22 -1
  141. package/dist/services/changelog/changelog.js.map +1 -1
  142. package/dist/services/changelog/changelog.schemas.d.ts +445 -19
  143. package/dist/services/changelog/changelog.schemas.d.ts.map +1 -1
  144. package/dist/services/changelog/changelog.schemas.js +94 -5
  145. package/dist/services/changelog/changelog.schemas.js.map +1 -1
  146. package/dist/services/changelog/changelog.types.d.ts +3 -3
  147. package/dist/services/checkpoints/checkpoints.schemas.d.ts +3 -3
  148. package/dist/services/claims/claims.schemas.d.ts +2 -2
  149. package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
  150. package/dist/services/lifecycle/lifecycle.codecs.d.ts +8 -1
  151. package/dist/services/lifecycle/lifecycle.codecs.d.ts.map +1 -1
  152. package/dist/services/lifecycle/lifecycle.codecs.js +62 -1
  153. package/dist/services/lifecycle/lifecycle.codecs.js.map +1 -1
  154. package/dist/services/lifecycle/lifecycle.schemas.d.ts +64 -63
  155. package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
  156. package/dist/services/lifecycle/lifecycle.schemas.js +2 -2
  157. package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
  158. package/dist/services/lifecycle/lifecycle.types.d.ts +2 -2
  159. package/dist/services/market-data/market-data.d.ts +7 -1
  160. package/dist/services/market-data/market-data.d.ts.map +1 -1
  161. package/dist/services/market-data/market-data.js +12 -1
  162. package/dist/services/market-data/market-data.js.map +1 -1
  163. package/dist/services/market-data/market-data.schemas.d.ts +108 -1
  164. package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
  165. package/dist/services/market-data/market-data.schemas.js +42 -2
  166. package/dist/services/market-data/market-data.schemas.js.map +1 -1
  167. package/dist/services/market-data/market-data.types.d.ts +2 -2
  168. package/dist/services/market-overview/market-overview.d.ts +1 -1
  169. package/dist/services/market-overview/market-overview.js +1 -1
  170. package/dist/services/market-overview/market-overview.js.map +1 -1
  171. package/dist/services/notifications/notifications.codecs.d.ts +8 -2
  172. package/dist/services/notifications/notifications.codecs.d.ts.map +1 -1
  173. package/dist/services/notifications/notifications.codecs.js +14 -2
  174. package/dist/services/notifications/notifications.codecs.js.map +1 -1
  175. package/dist/services/notifications/notifications.schemas.d.ts +91 -2
  176. package/dist/services/notifications/notifications.schemas.d.ts.map +1 -1
  177. package/dist/services/notifications/notifications.schemas.js +25 -1
  178. package/dist/services/notifications/notifications.schemas.js.map +1 -1
  179. package/dist/services/notifications/notifications.types.d.ts +2 -2
  180. package/dist/services/orderbook/orderbook.d.ts +2 -2
  181. package/dist/services/orderbook/orderbook.js +17 -12
  182. package/dist/services/orderbook/orderbook.js.map +1 -1
  183. package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
  184. package/dist/services/orders/order-errors.schemas.d.ts +2 -2
  185. package/dist/services/orders/orders-batch.schemas.d.ts +47 -47
  186. package/dist/services/orders/orders-input.schemas.d.ts +6 -6
  187. package/dist/services/orders/orders-output.schemas.d.ts +21 -21
  188. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
  189. package/dist/services/policies/shared.codecs.js +6 -3
  190. package/dist/services/policies/shared.codecs.js.map +1 -1
  191. package/dist/services/policies/shared.d.ts +1 -1
  192. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +3 -3
  193. package/dist/services/price-alerts/price-alerts.schemas.d.ts +10 -10
  194. package/dist/services/rewards/rewards.schemas.d.ts +4 -4
  195. package/dist/services/subaccounts/subaccounts.codecs.js +2 -1
  196. package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
  197. package/dist/services/subaccounts/subaccounts.schemas.d.ts +13 -13
  198. package/dist/services/system/system.codecs.d.ts +20 -0
  199. package/dist/services/system/system.codecs.d.ts.map +1 -0
  200. package/dist/services/system/system.codecs.js +57 -0
  201. package/dist/services/system/system.codecs.js.map +1 -0
  202. package/dist/services/system/system.d.ts +7 -0
  203. package/dist/services/system/system.d.ts.map +1 -1
  204. package/dist/services/system/system.js +13 -0
  205. package/dist/services/system/system.js.map +1 -1
  206. package/dist/services/system/system.schemas.d.ts +234 -0
  207. package/dist/services/system/system.schemas.d.ts.map +1 -0
  208. package/dist/services/system/system.schemas.js +78 -0
  209. package/dist/services/system/system.schemas.js.map +1 -0
  210. package/dist/services/system/system.types.d.ts +4 -0
  211. package/dist/services/trades/trades.schemas.d.ts +2 -2
  212. package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
  213. package/dist/services/triggers/triggers-output.schemas.d.ts +47 -47
  214. package/dist/services/triggers/triggers.d.ts +1 -1
  215. package/dist/services/triggers/triggers.js +1 -1
  216. package/dist/services/triggers/triggers.js.map +1 -1
  217. package/dist/services/zipper/zipper.schemas.d.ts +2 -2
  218. package/dist/services/zipper/zipper.schemas.d.ts.map +1 -1
  219. package/dist/services/zipper/zipper.schemas.js +9 -2
  220. package/dist/services/zipper/zipper.schemas.js.map +1 -1
  221. package/dist/services/zipper/zipper.types.d.ts +2 -2
  222. package/dist/shared/catalog-config.d.ts +13 -1
  223. package/dist/shared/catalog-config.d.ts.map +1 -1
  224. package/dist/shared/catalog-config.js +6 -1
  225. package/dist/shared/catalog-config.js.map +1 -1
  226. package/dist/shared/ledger-codes.d.ts +5 -3
  227. package/dist/shared/ledger-codes.d.ts.map +1 -1
  228. package/dist/shared/ledger-codes.js.map +1 -1
  229. package/dist/shared/rate-limit.schemas.d.ts +1 -1
  230. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { AccountSigner, AccountSignerConfig, AccountSignerFactory, HexAddress }
2
2
  import { CreatePolyesterEnvironmentParams, POLYESTER_DEVNET_ENVIRONMENT, POLYESTER_TESTNET_ENVIRONMENT, PolyesterAccountAbstractionEnvironment, PolyesterContractsEnvironment, PolyesterEntryPointConfig, PolyesterEnvironment, PolyesterSafeDeploymentConfig, createPolyesterEnvironment } from "./environment.js";
3
3
  import { CreatePolyesterAccountSignerParams } from "./account-signer/create-polyester-account-signer.js";
4
4
  import "./account-signer/index.js";
5
- import { AssetConfig, DepositWithdrawConfig, PairConfig, PairStatus, SpotConfig, ZipperAssetChainVariant, ZipperAssetConfig, ZipperChainConfig, ZipperChainContractConfig, ZipperMemoRequirement } from "./shared/catalog-config.js";
5
+ import { AssetConfig, DepositWithdrawConfig, PairConfig, PairStatus, SpotConfig, ZipperAssetChainVariant, ZipperAssetConfig, ZipperChainConfig, ZipperChainContractConfig, ZipperMemoRequirement, ZipperRouteStatus } from "./shared/catalog-config.js";
6
6
  import { OrderErrorCode, OrderErrorDetail } from "./services/orders/order-errors.schemas.js";
7
7
  import { RateLimitDetail, RateLimitFailureReason, RateLimitPolicyClass, RateLimitRefillModel, RateLimitScope } from "./shared/rate-limit.schemas.js";
8
8
  import { PolyesterErrorDetail, loadErrorDetailDecoders } from "./shared/error-detail.js";
@@ -19,17 +19,17 @@ import { ApiKeyPolicy, ApiKeyPolicyApplyInput, ApiKeyPolicyCreateInput, ApiKeyPo
19
19
  import { ApiKey, ApiKeyIdInput, ApiKeyStatus, ApiKeysCreateInput, ApiKeysListInput, ApiKeysUpdateInput, AssistantKeySpecInput, SetAssistantKeysInput } from "./services/api-keys/api-keys.schemas.js";
20
20
  import { SubaccountPolicy, SubaccountPolicyApplyInput, SubaccountPolicyCreateInput, SubaccountPolicyUpdateInput } from "./services/policies/subaccount-policies/subaccount-policies.schemas.js";
21
21
  import { AccountCodeValue, TransferCodeValue } from "./shared/ledger-codes.js";
22
- import { BalanceHistoryInput, BalanceHistoryResponse, BalanceRange, EquityGroupBy, EquityHistoryInput, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySnapshotResponse, formatLedgerBalance } from "./services/balances/balances.schemas.js";
22
+ import { BalanceHistoryInput, BalanceHistoryResponse, BalanceRange, EquityGroupBy, EquityHistoryInput, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, ExportStatementInput, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySnapshotResponse, StatementPage, formatLedgerBalance } from "./services/balances/balances.schemas.js";
23
23
  import { CreateSubaccountChallengeInput, CreateSubaccountInput, CreateSubaccountResult as CreateSubaccountResult$1, EffectiveSubaccountPermissions, GetSubaccountInput, InviteSubaccountMemberInput, ListSubaccountInvitesInput, RemoveSubaccountMemberInput, RespondSubaccountInviteInput, SetSubaccountMemberMfaRequirementInput, Subaccount, SubaccountActivityInput, SubaccountChallenge, SubaccountEvent, SubaccountIdInput, SubaccountInvite, SubaccountInviteStatus, SubaccountMember, SubaccountPermission, SubaccountPermissionDefinition, SubaccountRole, SubaccountRoleCatalog, SubaccountRoleDefinition, SubaccountStatus, UpdateSubaccountInput, UpdateSubaccountMemberRoleInput } from "./services/subaccounts/subaccounts.schemas.js";
24
24
  import { Candle, CandleColumnar, CandleColumnarInt, CandleInt, GetCandlesColumnsInput, GetCandlesInput, Timeframe } from "./services/candles/candles.schemas.js";
25
25
  import { ChainAnalyticsRange, GetUnifiedAssetBalancesInput, GetZippedAssetSupplyGroupInput, GetZippedAssetSupplyInput, UnifiedAssetBalancesResponse, ZippedAssetSupplyGroupResponse, ZippedAssetSupplyResponse, ZippedAssetSupplySeries } from "./services/chain-analytics/chain-analytics.schemas.js";
26
- import { GetMarketTradesInput, MarketTrade, TradeBackfill } from "./services/market-data/market-data.schemas.js";
26
+ import { AssetEditorialInfo, AssetInfo, GetMarketTradesInput, ListAssetInfoInput, MarketTrade, TradeBackfill } from "./services/market-data/market-data.schemas.js";
27
27
  import { CurrencyConversionConfig, CurrencyConversionRates, CurrencyMetadata, FiatConversionRate, FiatConversionSnapshot, ListMarketOverviewInput, MarketOverview, MarketOverviewOrderBy, MarketOverviewSort, MarketOverviewSparkline, SparklineIntervalName, SpotPairVolumeSeries, SpotVolumeHistoryInput, SpotVolumeHistoryResponse, StablecoinConversionRate } from "./services/market-overview/market-overview.schemas.js";
28
28
  import { GetOrderbookInput, OrderbookData, OrderbookLevel } from "./services/orderbook/orderbook.schemas.js";
29
29
  import { CreateOrderbookSubscriptionInput, OrderbookStreamHandlers, OrderbookSubscription } from "./services/orderbook/orderbook.js";
30
30
  import { HeatmapDepthValue, HeatmapIntervalValue, HeatmapQuantityModeValue } from "./services/heatmap/heatmap.codecs.js";
31
31
  import { GetOrderbookHeatmapInput, OrderbookHeatmapDeltaBucket, OrderbookHeatmapDeltaChain, OrderbookHeatmapDeltaLevels, OrderbookHeatmapKeyframe, OrderbookHeatmapLevels, OrderbookHeatmapLiveBucket, OrderbookHeatmapResponse } from "./services/heatmap/heatmap.schemas.js";
32
- import { GetLifecycleFlowInput, GetLifecycleFlowOutput, LifecycleAssetIds, LifecycleFlowDetail, LifecycleFlowState, LifecycleFlowStep, LifecycleFlowStepActivity, LifecycleFlowSummary, LifecycleFlowSummaryProgress, LifecycleFlowTimelineItem, LifecycleFlowTxMatch, LifecycleListOrderBy, LifecycleListScope, LifecycleReason, LifecycleRequestFee, LifecycleRequestFeeStatus, LifecycleSort, LifecycleTxLookupKind, LifecycleZipperReason, ListLifecycleFlowsByTxInput, ListLifecycleFlowsByTxOutput, ListLifecycleFlowsInput, ListLifecycleFlowsOutput } from "./services/lifecycle/lifecycle.schemas.js";
32
+ import { GetLifecycleFlowInput, GetLifecycleFlowOutput, LifecycleAssetIds, LifecycleFlowDetail, LifecycleFlowState, LifecycleFlowStep, LifecycleFlowStepActivity, LifecycleFlowSummary, LifecycleFlowSummaryProgress, LifecycleFlowTimelineItem, LifecycleFlowTxMatch, LifecycleListOrderBy, LifecycleListScope, LifecycleReason, LifecycleRequestFee, LifecycleRequestFeeStatus, LifecycleSort, LifecycleTxLookupKind, LifecycleZipperReason, LifecycleZipperReasonCode, ListLifecycleFlowsByTxInput, ListLifecycleFlowsByTxOutput, ListLifecycleFlowsInput, ListLifecycleFlowsOutput } from "./services/lifecycle/lifecycle.schemas.js";
33
33
  import { RiskPolicyInput, StopLossInput, TakeProfitInput, TrailingStopInput } from "./services/orders/orders-risk.schemas.js";
34
34
  import { Order, OrderDetails, OrderTransfer } from "./services/orders/orders-output.schemas.js";
35
35
  import { GetUserTradesInput, Trade } from "./services/trades/trades.schemas.js";
@@ -43,7 +43,7 @@ import { ListTriggersResult } from "./services/triggers/triggers.js";
43
43
  import { CancelPriceAlertInput, CreatePriceAlertInput, ListPriceAlertsInput, ListPriceAlertsResult, PriceAlert, UpdatePriceAlertInput, UpdatePriceAlertResult } from "./services/price-alerts/price-alerts.schemas.js";
44
44
  import { AccountNotification, AccountNotificationDetail, GetNotificationInput, ListNotificationsInput, ListNotificationsResult, MarkAllNotificationsReadInput, MarkNotificationsInput, NotificationCounts } from "./services/notifications/notifications.schemas.js";
45
45
  import { AssistantApprovalPreview, AssistantOrderPreview, AssistantRunEvent, AssistantView } from "./services/assistant/assistant-events.schemas.js";
46
- import { AssistantApprovalDecision, AssistantApprovalStatus, AssistantFailureCategory, AssistantKeyState, AssistantMemoryKind, AssistantMessageRole, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy } from "./services/assistant/assistant.codecs.js";
46
+ import { AssistantApprovalDecision, AssistantApprovalStatus, AssistantDisplaySetting, AssistantFailureCategory, AssistantKeyState, AssistantMemoryKind, AssistantMessageRole, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy } from "./services/assistant/assistant.codecs.js";
47
47
  import { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput } from "./services/assistant/assistant.schemas.js";
48
48
  import { LedgerTransfer, LedgerTransferSide, ListTransfersInput } from "./services/transfers/transfers.schemas.js";
49
49
  import { CreateInternalTransferInput, CreateInternalTransferResult, GetInternalTransferInput, GetInternalTransferResult, InternalTransferDestination, ResolvedInternalTransferDestination } from "./services/internal-transfers/internal-transfers.schemas.js";
@@ -60,7 +60,8 @@ import { SubscribeZippedAssetSupplyInput } from "./services/zipper/zipper.js";
60
60
  import { BeginMfaChallengeInput, BeginMfaChallengeResult, BeginPasskeyEnrollmentInput, BeginPasskeyEnrollmentResult, BeginTotpEnrollmentInput, BeginTotpEnrollmentResult, ClaimFreshStepUpInput, ClaimFreshStepUpResult, CompleteMfaChallengeResult, ConsumeFreshStepUpInput, DeleteMfaFactorInput, FinishPasskeyChallengeInput, FinishPasskeyEnrollmentInput, FinishPasskeyEnrollmentResult, FinishTotpEnrollmentInput, FinishTotpEnrollmentResult, ListMfaFactorsResult, MfaFactor, MfaSessionInfo, RegenerateRecoveryCodesInput, RegenerateRecoveryCodesResult, ReleaseFreshStepUpInput, UpdateMfaFactorInput, UpdateMfaFactorResult, VerifyRecoveryCodeChallengeInput, VerifyTotpChallengeInput } from "./services/mfa/mfa.schemas.js";
61
61
  import { ClaimCampaign, ClaimDailyRewardInput, ClaimDailyRewardResult, ClaimPayoutDelayReason, DailyClaimReward, DailyClaimStatus, DailyClaimTransfer } from "./services/claims/claims.schemas.js";
62
62
  import { Checkpoint, CheckpointAssetAmount, CheckpointBiggestTrade, CheckpointChainFlow, CheckpointEarnedBadge, CheckpointFlowTotal, CheckpointFundingDay, CheckpointFundingFlowSummary, CheckpointOrderToolCounts, CheckpointOrderTypeCounts, CheckpointPairActivity, CheckpointPortfolioValuePoint, CheckpointTimeInForceCounts, CheckpointVipTierChange, CheckpointVolumePoint, ListCheckpointsInput } from "./services/checkpoints/checkpoints.schemas.js";
63
- import { ChangelogChange, ChangelogChangeEntry, ChangelogPost, ChangelogPostSummary, ChangelogSection, GetChangelogPostInput, ListChangelogChangesInput, ListChangelogChangesResult, ListChangelogPostsInput, ListChangelogPostsResult } from "./services/changelog/changelog.schemas.js";
63
+ import { ChangelogChange, ChangelogChangeEntry, ChangelogDeploymentGroup, ChangelogDeploymentGroupSummary, ChangelogPost, ChangelogPostSummary, ChangelogSection, GetChangelogDeploymentGroupInput, GetChangelogPostInput, ListChangelogChangesInput, ListChangelogChangesResult, ListChangelogDeploymentGroupsInput, ListChangelogDeploymentGroupsResult, ListChangelogPostsInput, ListChangelogPostsResult } from "./services/changelog/changelog.schemas.js";
64
+ import { ListStatusEventsInput, ListStatusEventsResult, StatusEvent } from "./services/system/system.schemas.js";
64
65
  import { SystemVersion } from "./services/system/system.js";
65
66
  import { AcknowledgeRewardAwardInput, AcknowledgeRewardAwardResult, ListRewardAwardsInput, ListRewardAwardsResult, RewardAward, SetRewardDestinationInput, SetRewardDestinationResult } from "./services/rewards/rewards.schemas.js";
66
67
  import { NextVipTierThresholds, VipMetricQuality, VipMetricStatus, VipStatus, VipTier, VipTierCatalog } from "./services/vip/vip.schemas.js";
@@ -90,6 +91,7 @@ import { tsObjToNsString } from "./utils/time.js";
90
91
  import { EvmHex, checksumEvmAddress, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, isEvmAddress, isEvmAddressStrict, keccak256Hex } from "./utils/evm.js";
91
92
  import "./services/accounts/accounts.types.js";
92
93
  import "./services/address-book/address-book.types.js";
94
+ import { AssistantKeyPreset } from "./services/api-keys/api-keys.codecs.js";
93
95
  import "./services/api-keys/api-keys.types.js";
94
96
  import "./services/assistant/assistant.types.js";
95
97
  import "./services/auth/auth.types.js";
@@ -98,7 +100,7 @@ import "./services/auto-withdraw/auto-withdraw.types.js";
98
100
  import "./services/balances/balances.types.js";
99
101
  import "./services/candles/candles.types.js";
100
102
  import "./services/chain-analytics/chain-analytics.types.js";
101
- import { ChangelogAudience, ChangelogChangeCategory, ChangelogSort, ChangelogSurface } from "./services/changelog/changelog.codecs.js";
103
+ import { ChangelogAudience, ChangelogChangeAvailability, ChangelogChangeCategory, ChangelogEnvironment, ChangelogSort, ChangelogSurface } from "./services/changelog/changelog.codecs.js";
102
104
  import "./services/changelog/changelog.types.js";
103
105
  import { CheckpointBadge, CheckpointField } from "./services/checkpoints/checkpoints.codecs.js";
104
106
  import "./services/checkpoints/checkpoints.types.js";
@@ -114,7 +116,7 @@ import "./services/lifecycle/lifecycle.types.js";
114
116
  import "./services/market-data/market-data.types.js";
115
117
  import "./services/market-overview/market-overview.types.js";
116
118
  import "./services/mfa/mfa.types.js";
117
- import { NotificationCategory, NotificationReadState, NotificationType, TelegramApprovalAction } from "./services/notifications/notifications.codecs.js";
119
+ import { BrokerAllowlistAction, BrokerAllowlistEvent, NotificationCategory, NotificationReadState, NotificationType, TelegramApprovalAction } from "./services/notifications/notifications.codecs.js";
118
120
  import "./services/notifications/notifications.types.js";
119
121
  import "./services/orderbook/orderbook.types.js";
120
122
  import "./services/orders/orders.types.js";
@@ -129,6 +131,8 @@ import { RewardFulfillmentMethod, RewardFulfillmentState } from "./services/rewa
129
131
  import "./services/rewards/rewards.types.js";
130
132
  import "./services/social-verification/social-verification.types.js";
131
133
  import "./services/subaccounts/subaccounts.types.js";
134
+ import { StatusEventImpact, StatusEventKind, StatusEventService, StatusEventState } from "./services/system/system.codecs.js";
135
+ import "./services/system/system.types.js";
132
136
  import "./services/trades/trades.types.js";
133
137
  import "./services/trading-withdraws/trading-withdraws.types.js";
134
138
  import { TransferSideKind } from "./services/transfers/transfers.codecs.js";
@@ -136,4 +140,4 @@ import "./services/transfers/transfers.types.js";
136
140
  import "./services/triggers/triggers.types.js";
137
141
  import "./services/vip/vip.types.js";
138
142
  import "./services/zipper/zipper.types.js";
139
- export { type AccountCodeValue, type AccountIdentity, type AccountNotification, type AccountNotificationDetail, type AccountScope, type AccountScopedInput, type AccountSigner, type AccountSignerAuthEvents, type AccountSignerConfig, type CreateSubaccountResult as AccountSignerCreateSubaccountResult, type AccountSignerFactory, type AcknowledgeRewardAwardInput, type AcknowledgeRewardAwardResult, type ActiveAccountInfo, type AddressBook, type AddressBookAccountScope, type AddressBookEntries, type AddressBookEntriesView, type AddressBookEntry, type AddressBookRecentDestinationsView, type AddressBookTag, type AddressBookTagSummary, type AddressBookView, type AddressBookViewInvalidated, AlreadyExistsError, type ApiKey, type ApiKeyEd25519AuthProvider, type ApiKeyIdInput, type ApiKeyPolicy, type ApiKeyPolicyApplyInput, type ApiKeyPolicyCreateInput, type ApiKeyPolicyUpdateInput, type ApiKeyStatus, type ApiKeysCreateInput, type ApiKeysListInput, type ApiKeysUpdateInput, type AssetConfig, type AssistantApprovalDecision, type AssistantApprovalPreview, type AssistantApprovalStatus, type AssistantConversation, type AssistantFailureCategory, type AssistantKey, type AssistantKeySpecInput, type AssistantKeyState, type AssistantMemory, type AssistantMemoryKind, type AssistantMessage, type AssistantMessageRole, type AssistantOrderPreview, type AssistantOrderPriceField, type AssistantPriceOffsetDirection, type AssistantPriceRounding, type AssistantReferencePriceSource, type AssistantRunEvent, type AssistantRunIdInput, type AssistantTriggerChangeAction, type AssistantTriggerDirection, type AssistantUnfilledSlicePolicy, type AssistantView, type AuthCookieLocation, type AuthHydrationData, type AuthLoginMethod, type AuthState, type AuthTokenStorage, type AuthTokenStorageSetOptions, AuthenticationError, type AutoWithdrawCadence, type AutoWithdrawDestination, type AutoWithdrawDestinationInput, type AutoWithdrawHoldReason, type AutoWithdrawPause, type AutoWithdrawPauseReason, type AutoWithdrawPreview, type AutoWithdrawPreviewAsset, type AutoWithdrawPreviewStatus, type AutoWithdrawRule, type AutoWithdrawRun, type AutoWithdrawRunReason, type AutoWithdrawRunState, type AutoWithdrawSchedule, type AutoWithdrawScheduleInput, type AutoWithdrawScopedInput, type AutoWithdrawStep, type AutoWithdrawStepReason, type AutoWithdrawStepState, type AutoWithdrawWeekday, type BalanceHistoryInput, type BalanceHistoryResponse, type BalanceRange, type BatchCancelOrderInput, type BatchCancelOrderResult, type BatchCancelOrdersInput, type BatchCancelOrdersResult, type BatchCancelTriggerResult, type BatchCancelTriggersInput, type BatchCancelTriggersResult, type BatchCreateOrderResult, type BatchCreateOrdersInput, type BatchCreateOrdersResult, type BatchGuardApprovals, type BatchReplaceAdmissionItem, type BatchReplaceOrdersInput, type BatchReplaceOrdersResult, type BatchSignProtectedActionInput, type BeginMfaChallengeInput, type BeginMfaChallengeResult, type BeginPasskeyEnrollmentInput, type BeginPasskeyEnrollmentResult, type BeginTotpEnrollmentInput, type BeginTotpEnrollmentResult, type CancelAllAfterInput, type CancelAllAfterResult, type CancelAllOrdersInput, type CancelAllOrdersResponse, type CancelOcoInput, type CancelOcoResult, type CancelOrderInput, type CancelOrderResult, type CancelPriceAlertInput, type CancelTriggerInput, type CancelTriggerResult, type Candle, type CandleColumnar, type CandleColumnarInt, type CandleInt, type ChainAnalyticsRange, type ChangelogAudience, type ChangelogChange, type ChangelogChangeCategory, type ChangelogChangeEntry, type ChangelogPost, type ChangelogPostSummary, type ChangelogSection, type ChangelogSort, type ChangelogSurface, type Checkpoint, type CheckpointAssetAmount, type CheckpointBadge, type CheckpointBiggestTrade, type CheckpointChainFlow, type CheckpointEarnedBadge, type CheckpointField, type CheckpointFlowTotal, type CheckpointFundingDay, type CheckpointFundingFlowSummary, type CheckpointOrderToolCounts, type CheckpointOrderTypeCounts, type CheckpointPairActivity, type CheckpointPortfolioValuePoint, type CheckpointTimeInForceCounts, type CheckpointVipTierChange, type CheckpointVolumePoint, type ClaimCampaign, type ClaimDailyRewardInput, type ClaimDailyRewardResult, type ClaimFreshStepUpInput, type ClaimFreshStepUpResult, type ClaimGeneratedUsernameInput, ClaimOutcomeUnknownError, type ClaimOutcomeUnknownErrorOptions, type ClaimPayoutDelayReason, type ClaimPolicy, type ColumnarTimeWindow, type CompleteAssistantKeysInput, type CompleteMfaChallengeResult, ConfigurationError, type ConfirmVerificationInput, type ConnectChannelParams, type ConnectPrivateOrdersParams, type ConsumeFreshStepUpInput, type CookieAuthTokenStorageOptions, type CopyAddressBookEntryInput, type CreateAddressBookEntryInput, type CreateAddressBookTagInput, type CreateDepositAddressInput, type CreateGuardSignerWalletResult, type CreateInternalTransferInput, type CreateInternalTransferResult, type CreateOcoInput, type CreateOcoResult, type CreateOrderResult, type CreateOrderbookSubscriptionInput, type CreatePolyesterAccountSignerParams, type CreatePolyesterEnvironmentParams, type CreatePriceAlertInput, type CreateServerClientFromCookiesParams, type CreateServerClientFromRequestParams, type CreateSubaccountChallengeInput, type CreateSubaccountInput, type CreateSubaccountParams, type CreateSubaccountResult$1 as CreateSubaccountResult, type CreateSubaccountResult$1 as CreateSubaccountServiceResult, type CreateTradingWithdrawResult, type CreateTradingWithdrawToExternalChainInput, type CreateTradingWithdrawToExternalChainServiceInput, type CreateTradingWithdrawToFundingInput, type CreateTradingWithdrawToFundingServiceInput, type CreateTriggerInput, type CreateTriggerResult, type CreateWalletChallengeInput, type CurrencyConversionConfig, type CurrencyConversionRates, type CurrencyMetadata, type DailyClaimReward, type DailyClaimState, type DailyClaimStatus, type DailyClaimTransfer, type DecideAssistantApprovalInput, type DeleteAddressBookEntryInput, type DeleteAddressBookTagInput, type DeleteAssistantMemoryInput, type DeleteMfaFactorInput, type DepositAddress, type DepositWithdrawConfig, type EffectiveSubaccountPermissions, type EquityGroupBy, type EquityHistoryInput, type EquityHistoryResponse, type EquitySeries, type EquitySeriesGrouping, type EvmHex, type ExportGuardSignerWalletResult, type FiatConversionRate, type FiatConversionSnapshot, type FinishPasskeyChallengeInput, type FinishPasskeyEnrollmentInput, type FinishPasskeyEnrollmentResult, type FinishTotpEnrollmentInput, type FinishTotpEnrollmentResult, type GeneratedUsernameOffer, type GetAddressBookViewInput, type GetBatchReplaceStatusInput, type GetBatchReplaceStatusResult, type GetCandlesColumnsInput, type GetCandlesInput, type GetChangelogPostInput, type GetInternalTransferInput, type GetInternalTransferResult, type GetLifecycleFlowInput, type GetLifecycleFlowOutput, type GetMarketTradesInput, type GetNotificationInput, type GetOrderDetailsInput, type GetOrderbookHeatmapInput, type GetOrderbookInput, type GetSpotFeeRatesInput, type GetSubaccountInput, type GetTriggerInput, type GetUnifiedAssetBalancesInput, type GetUserTradesInput, type GetVerificationResponse, type GetWalletBalancesInput, type GetWalletBalancesResult, type GetZippedAssetSupplyGroupInput, type GetZippedAssetSupplyInput, type GuardApproval, type GuardSignerScopedInput, type GuardSignerStatus, type HeatmapDepthValue, type HeatmapIntervalValue, type HeatmapQuantityModeValue, type HexAddress, InternalServerError, type InternalTransferDestination, type InternalTransferStatus, type InternalTransferWhitelistEntries, type InternalTransferWhitelistEntry, type InviteSubaccountMemberInput, type JwtAuthProvider, type LadderDetailsOutput, type LedgerBalance, type LedgerTransfer, type LedgerTransferSide, type LifecycleAssetIds, type LifecycleFlowDetail, type LifecycleFlowState, type LifecycleFlowStep, type LifecycleFlowStepActivity, type LifecycleFlowSummary, type LifecycleFlowSummaryProgress, type LifecycleFlowTimelineItem, type LifecycleFlowTxMatch, type LifecycleListOrderBy, type LifecycleListScope, type LifecycleReason, type LifecycleRequestFee, type LifecycleRequestFeeStatus, type LifecycleSort, type LifecycleTxLookupKind, type LifecycleZipperReason, type ListAddressBookEntriesInput, type ListApiKeyPoliciesResponse, type ListAssistantConversationsInput, type ListAssistantConversationsResult, type ListAssistantMemoriesInput, type ListAssistantMemoriesResult, type ListAssistantMessagesInput, type ListAssistantMessagesResult, type ListAutoWithdrawRunsInput, type ListAutoWithdrawRunsResult, type ListChangelogChangesInput, type ListChangelogChangesResult, type ListChangelogPostsInput, type ListChangelogPostsResult, type ListCheckpointsInput, type ListDepositAddressesInput, type ListInternalTransferWhitelistEntriesInput, type ListLifecycleFlowsByTxInput, type ListLifecycleFlowsByTxOutput, type ListLifecycleFlowsInput, type ListLifecycleFlowsOutput, type ListMarketOverviewInput, type ListMfaFactorsResult, type ListNotificationsInput, type ListNotificationsResult, type ListPriceAlertsInput, type ListPriceAlertsResult, type ListRewardAwardsInput, type ListRewardAwardsResult, type ListSubaccountInvitesInput, type ListTransferCounterpartiesInput, type ListTransferDestinationsInput, type ListTransfersInput, type ListTriggerEventsInput, type ListTriggerEventsResult, type ListTriggersInput, type ListTriggersResult, type LoginOptions, type LoginResult, type LoginWithWalletInput, type LoginWithWalletResponse, type MarkAllNotificationsReadInput, type MarkNotificationsInput, type MarketOverview, type MarketOverviewOrderBy, type MarketOverviewSort, type MarketOverviewSparkline, type MarketTrade, type Me, MfaEnrollmentRequiredError, type MfaFactor, MfaLastFactorRequiredError, MfaRequiredError, type MfaSessionInfo, MfaVerificationError, type MfaVerificationFailureReason, type MirroredWithdrawWhitelistEntry, type ModifyOrderInput, type ModifyOrderResult, type ModifyTriggerInput, type ModifyTriggerResult, NetworkError, type NewOrderInput, type NextVipTierThresholds, NotImplementedError, type NotificationCategory, type NotificationCounts, type NotificationReadState, type NotificationType, type OpenOrdersInput, type Order, type OrderDetails, type OrderErrorCode, type OrderErrorDetail, type OrderHistoryInput, type OrderIntentInput, type OrderLineage, type OrderTransfer, type OrderbookData, type OrderbookHeatmapDeltaBucket, type OrderbookHeatmapDeltaChain, type OrderbookHeatmapDeltaLevels, type OrderbookHeatmapKeyframe, type OrderbookHeatmapLevels, type OrderbookHeatmapLiveBucket, type OrderbookHeatmapResponse, type OrderbookLevel, type OrderbookStreamHandlers, type OrderbookSubscription, OutcomeUnknownError, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_DEVNET_ENVIRONMENT, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, type PairConfig, type PairStatus, type PauseTriggerInput, type PauseTriggerResult, PermissionError, type PolicyAction, PolicyInUseError, PolicyLockedError, type PolicyMarketScope, PolicyScopeMismatchError, type PolyesterAccountAbstractionEnvironment, PolyesterBrowserClient, type PolyesterBrowserClientConfig, PolyesterBrowserCore, PolyesterClient, type PolyesterClientBaseConfig, type PolyesterClientConfig, type PolyesterContractsEnvironment, PolyesterCore, type PolyesterEntryPointConfig, type PolyesterEnvironment, PolyesterError, type PolyesterErrorCode, type PolyesterErrorDetail, type PolyesterErrorOptions, type PolyesterMutationOptions, type PolyesterRealtime, type PolyesterRealtimeAuthConfig, type PolyesterRequestOptions, type PolyesterSafeDeploymentConfig, PolyesterServerClient, type PolyesterServerClientConfig, PolyesterServerCore, type PolyesterServices, type PortfolioEquityHistoryInput, type PortfolioEquityHistoryResponse, type PortfolioEquitySeries, type PortfolioEquitySeriesGrouping, type PortfolioEquitySnapshotResponse, PreconditionFailedError, type PrepareAssistantKeysInput, type PrepareAssistantKeysResult, type PreparedAssistantKey, type PreparedTradingWithdraw, type PreviewOrderResult, type PriceAlert, type PriceAlertChannel, type PriceAlertDirection, type PriceAlertPriceSource, type PriceAlertStatus, type PriceAlertUpdateOutcome, type PrivateOrdersEvent, type Profile, type RateLimitConfig, type RateLimitDetail, RateLimitError, type RateLimitErrorOptions, type RateLimitFailureReason, type RateLimitPolicyClass, type RateLimitRefillModel, type RateLimitScope, type RealtimeConnection, type RealtimeConnectionState, type RealtimeConnectionStatus, RealtimeError, type RealtimeErrorOptions, type RegenerateRecoveryCodesInput, type RegenerateRecoveryCodesResult, type ReleaseFreshStepUpInput, type RemoveSubaccountMemberInput, RequestDeadlineExceededError, RequestError, RequestTooLargeError, type ResolveAccountInput, type ResolvedAccount, type ResolvedInternalTransferDestination, ResourceNotFoundError, type RespondSubaccountInviteInput, type ResumeTriggerInput, type ResumeTriggerResult, RevisionConflictError, type RewardAward, type RewardFulfillmentMethod, type RewardFulfillmentState, type RiskPolicyInput, type RotateGuardSignerWalletResult, type SdkSubscriptionErrorContext, type SendAssistantMessageInput, type ServerSessionCookieOptions, type ServerSessionSnapshot, ServiceUnavailableError, type SessionData, SessionElevationRequiredError, type SetAssistantKeysInput, type SetAutoWithdrawRuleEnabledInput, type SetAutoWithdrawRuleInput, type SetRewardDestinationInput, type SetRewardDestinationResult, type SetSubaccountMemberMfaRequirementInput, type SetTelegramApprovalLimitsInput, type SignProtectedActionInput, type SocialProvider, type SocialProviderInput, type SocialVerification, type SocialVerificationErrorCode, type SocialVerificationMethod, type SocialVerificationStatus, type SparklineIntervalName, type SpotConfig, type SpotFeeDiscount, type SpotFeeRate, type SpotFeeRateBreakdown, type SpotPairVolumeSeries, type SpotVolumeHistoryInput, type SpotVolumeHistoryResponse, type StablecoinConversionRate, StaleQuoteError, type StartVerificationInput, type StartVerificationResponse, StepUpRequiredError, type StopDetailsOutput, type StopLossInput, type Subaccount, type SubaccountActivityInput, type SubaccountChallenge, SubaccountChallengeInvalidError, type SubaccountEvent, type SubaccountIdInput, type SubaccountInvite, type SubaccountInviteStatus, type SubaccountMember, type SubaccountPermission, type SubaccountPermissionDefinition, type SubaccountPolicy, type SubaccountPolicyApplyInput, type SubaccountPolicyCreateInput, type SubaccountPolicyUpdateInput, type SubaccountRole, type SubaccountRoleCatalog, type SubaccountRoleDefinition, type SubaccountScopedInput, type SubaccountStatus, type SubscribeHandlers, type SubscribeZippedAssetSupplyInput, type SystemVersion, type TakeProfitInput, type TelegramApprovalAction, type TelegramApprovalLimits, type Timeframe, TimeoutError, TimestampSkewError, type Trade, type TradeBackfill, type TradingRateLimitClass, type TradingRateLimitRule, type TradingRateLimits, type TradingWithdrawSigningConfig, type TradingWithdrawWalletSigner, type TrailingDetailsOutput, type TrailingStopInput, type TransferCodeValue, type TransferCounterparties, type TransferCounterparty, type TransferDestination, type TransferDestinations, type TransferSideKind, TransientError, type Transports, type Trigger, type TriggerDetailsOutput, type TriggerEvent, type TwapDetailsOutput, type UnifiedAssetBalancesResponse, type UnlinkSocialAccountInput, type UpdateAddressBookEntryInput, type UpdateAddressBookTagInput, type UpdateMfaFactorInput, type UpdateMfaFactorResult, type UpdatePriceAlertInput, type UpdatePriceAlertResult, type UpdateProfileInput, type UpdateSubaccountInput, type UpdateSubaccountMemberRoleInput, UserOperationAlreadyKnownError, UserOperationNotExecutedError, UserOperationSendTimeoutError, type UsernameHistoryEntry, type ValidateWithdrawDestinationInput, type ValidateWithdrawDestinationResult, ValidationError, type VerificationReadyResponse, type VerifyRecoveryCodeChallengeInput, type VerifyTotpChallengeInput, type VipMetricQuality, type VipMetricStatus, type VipStatus, type VipTier, type VipTierCatalog, type WalletChallenge, type WatchAssistantRunInput, WithdrawDeadlineExpiredError, type WithdrawWhitelistView, type ZippedAssetSupplyBatch, type ZippedAssetSupplyGroupResponse, type ZippedAssetSupplyResponse, type ZippedAssetSupplySeries, type ZippedAssetSupplyUpdate, type ZipperAssetChainVariant, type ZipperAssetConfig, type ZipperChainConfig, type ZipperChainContractConfig, type ZipperMemoRequirement, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, createPolyesterServerCoreFromCookies, createPolyesterServerCoreFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatLedgerBalance, formatUserFacingError, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, isTimeoutAbortError, keccak256Hex, loadErrorDetailDecoders, mergeLedgerBalances, normalizeErrorMessage, resolveAuthCookieName, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
143
+ export { type AccountCodeValue, type AccountIdentity, type AccountNotification, type AccountNotificationDetail, type AccountScope, type AccountScopedInput, type AccountSigner, type AccountSignerAuthEvents, type AccountSignerConfig, type CreateSubaccountResult as AccountSignerCreateSubaccountResult, type AccountSignerFactory, type AcknowledgeRewardAwardInput, type AcknowledgeRewardAwardResult, type ActiveAccountInfo, type AddressBook, type AddressBookAccountScope, type AddressBookEntries, type AddressBookEntriesView, type AddressBookEntry, type AddressBookRecentDestinationsView, type AddressBookTag, type AddressBookTagSummary, type AddressBookView, type AddressBookViewInvalidated, AlreadyExistsError, type ApiKey, type ApiKeyEd25519AuthProvider, type ApiKeyIdInput, type ApiKeyPolicy, type ApiKeyPolicyApplyInput, type ApiKeyPolicyCreateInput, type ApiKeyPolicyUpdateInput, type ApiKeyStatus, type ApiKeysCreateInput, type ApiKeysListInput, type ApiKeysUpdateInput, type AssetConfig, type AssetEditorialInfo, type AssetInfo, type AssistantApprovalDecision, type AssistantApprovalPreview, type AssistantApprovalStatus, type AssistantConversation, type AssistantDisplaySetting, type AssistantFailureCategory, type AssistantKey, type AssistantKeyPreset, type AssistantKeySpecInput, type AssistantKeyState, type AssistantMemory, type AssistantMemoryKind, type AssistantMessage, type AssistantMessageRole, type AssistantOrderPreview, type AssistantOrderPriceField, type AssistantPriceOffsetDirection, type AssistantPriceRounding, type AssistantReferencePriceSource, type AssistantRunEvent, type AssistantRunIdInput, type AssistantTriggerChangeAction, type AssistantTriggerDirection, type AssistantUnfilledSlicePolicy, type AssistantView, type AuthCookieLocation, type AuthHydrationData, type AuthLoginMethod, type AuthState, type AuthTokenStorage, type AuthTokenStorageSetOptions, AuthenticationError, type AutoWithdrawCadence, type AutoWithdrawDestination, type AutoWithdrawDestinationInput, type AutoWithdrawHoldReason, type AutoWithdrawPause, type AutoWithdrawPauseReason, type AutoWithdrawPreview, type AutoWithdrawPreviewAsset, type AutoWithdrawPreviewStatus, type AutoWithdrawRule, type AutoWithdrawRun, type AutoWithdrawRunReason, type AutoWithdrawRunState, type AutoWithdrawSchedule, type AutoWithdrawScheduleInput, type AutoWithdrawScopedInput, type AutoWithdrawStep, type AutoWithdrawStepReason, type AutoWithdrawStepState, type AutoWithdrawWeekday, type BalanceHistoryInput, type BalanceHistoryResponse, type BalanceRange, type BatchCancelOrderInput, type BatchCancelOrderResult, type BatchCancelOrdersInput, type BatchCancelOrdersResult, type BatchCancelTriggerResult, type BatchCancelTriggersInput, type BatchCancelTriggersResult, type BatchCreateOrderResult, type BatchCreateOrdersInput, type BatchCreateOrdersResult, type BatchGuardApprovals, type BatchReplaceAdmissionItem, type BatchReplaceOrdersInput, type BatchReplaceOrdersResult, type BatchSignProtectedActionInput, type BeginMfaChallengeInput, type BeginMfaChallengeResult, type BeginPasskeyEnrollmentInput, type BeginPasskeyEnrollmentResult, type BeginTotpEnrollmentInput, type BeginTotpEnrollmentResult, type BrokerAllowlistAction, type BrokerAllowlistEvent, type CancelAllAfterInput, type CancelAllAfterResult, type CancelAllOrdersInput, type CancelAllOrdersResponse, type CancelOcoInput, type CancelOcoResult, type CancelOrderInput, type CancelOrderResult, type CancelPriceAlertInput, type CancelTriggerInput, type CancelTriggerResult, type Candle, type CandleColumnar, type CandleColumnarInt, type CandleInt, type ChainAnalyticsRange, type ChangelogAudience, type ChangelogChange, type ChangelogChangeAvailability, type ChangelogChangeCategory, type ChangelogChangeEntry, type ChangelogDeploymentGroup, type ChangelogDeploymentGroupSummary, type ChangelogEnvironment, type ChangelogPost, type ChangelogPostSummary, type ChangelogSection, type ChangelogSort, type ChangelogSurface, type Checkpoint, type CheckpointAssetAmount, type CheckpointBadge, type CheckpointBiggestTrade, type CheckpointChainFlow, type CheckpointEarnedBadge, type CheckpointField, type CheckpointFlowTotal, type CheckpointFundingDay, type CheckpointFundingFlowSummary, type CheckpointOrderToolCounts, type CheckpointOrderTypeCounts, type CheckpointPairActivity, type CheckpointPortfolioValuePoint, type CheckpointTimeInForceCounts, type CheckpointVipTierChange, type CheckpointVolumePoint, type ClaimCampaign, type ClaimDailyRewardInput, type ClaimDailyRewardResult, type ClaimFreshStepUpInput, type ClaimFreshStepUpResult, type ClaimGeneratedUsernameInput, ClaimOutcomeUnknownError, type ClaimOutcomeUnknownErrorOptions, type ClaimPayoutDelayReason, type ClaimPolicy, type ColumnarTimeWindow, type CompleteAssistantKeysInput, type CompleteMfaChallengeResult, ConfigurationError, type ConfirmVerificationInput, type ConnectChannelParams, type ConnectPrivateOrdersParams, type ConsumeFreshStepUpInput, type CookieAuthTokenStorageOptions, type CopyAddressBookEntryInput, type CreateAddressBookEntryInput, type CreateAddressBookTagInput, type CreateDepositAddressInput, type CreateGuardSignerWalletResult, type CreateInternalTransferInput, type CreateInternalTransferResult, type CreateOcoInput, type CreateOcoResult, type CreateOrderResult, type CreateOrderbookSubscriptionInput, type CreatePolyesterAccountSignerParams, type CreatePolyesterEnvironmentParams, type CreatePriceAlertInput, type CreateServerClientFromCookiesParams, type CreateServerClientFromRequestParams, type CreateSubaccountChallengeInput, type CreateSubaccountInput, type CreateSubaccountParams, type CreateSubaccountResult$1 as CreateSubaccountResult, type CreateSubaccountResult$1 as CreateSubaccountServiceResult, type CreateTradingWithdrawResult, type CreateTradingWithdrawToExternalChainInput, type CreateTradingWithdrawToExternalChainServiceInput, type CreateTradingWithdrawToFundingInput, type CreateTradingWithdrawToFundingServiceInput, type CreateTriggerInput, type CreateTriggerResult, type CreateWalletChallengeInput, type CurrencyConversionConfig, type CurrencyConversionRates, type CurrencyMetadata, type DailyClaimReward, type DailyClaimState, type DailyClaimStatus, type DailyClaimTransfer, type DecideAssistantApprovalInput, type DeleteAddressBookEntryInput, type DeleteAddressBookTagInput, type DeleteAssistantMemoryInput, type DeleteMfaFactorInput, type DepositAddress, type DepositWithdrawConfig, type EffectiveSubaccountPermissions, type EquityGroupBy, type EquityHistoryInput, type EquityHistoryResponse, type EquitySeries, type EquitySeriesGrouping, type EvmHex, type ExportGuardSignerWalletResult, type ExportStatementInput, type FiatConversionRate, type FiatConversionSnapshot, type FinishPasskeyChallengeInput, type FinishPasskeyEnrollmentInput, type FinishPasskeyEnrollmentResult, type FinishTotpEnrollmentInput, type FinishTotpEnrollmentResult, type GeneratedUsernameOffer, type GetAddressBookViewInput, type GetBatchReplaceStatusInput, type GetBatchReplaceStatusResult, type GetCandlesColumnsInput, type GetCandlesInput, type GetChangelogDeploymentGroupInput, type GetChangelogPostInput, type GetInternalTransferInput, type GetInternalTransferResult, type GetLifecycleFlowInput, type GetLifecycleFlowOutput, type GetMarketTradesInput, type GetNotificationInput, type GetOrderDetailsInput, type GetOrderbookHeatmapInput, type GetOrderbookInput, type GetSpotFeeRatesInput, type GetSubaccountInput, type GetTriggerInput, type GetUnifiedAssetBalancesInput, type GetUserTradesInput, type GetVerificationResponse, type GetWalletBalancesInput, type GetWalletBalancesResult, type GetZippedAssetSupplyGroupInput, type GetZippedAssetSupplyInput, type GuardApproval, type GuardSignerScopedInput, type GuardSignerStatus, type HeatmapDepthValue, type HeatmapIntervalValue, type HeatmapQuantityModeValue, type HexAddress, InternalServerError, type InternalTransferDestination, type InternalTransferStatus, type InternalTransferWhitelistEntries, type InternalTransferWhitelistEntry, type InviteSubaccountMemberInput, type JwtAuthProvider, type LadderDetailsOutput, type LedgerBalance, type LedgerTransfer, type LedgerTransferSide, type LifecycleAssetIds, type LifecycleFlowDetail, type LifecycleFlowState, type LifecycleFlowStep, type LifecycleFlowStepActivity, type LifecycleFlowSummary, type LifecycleFlowSummaryProgress, type LifecycleFlowTimelineItem, type LifecycleFlowTxMatch, type LifecycleListOrderBy, type LifecycleListScope, type LifecycleReason, type LifecycleRequestFee, type LifecycleRequestFeeStatus, type LifecycleSort, type LifecycleTxLookupKind, type LifecycleZipperReason, type LifecycleZipperReasonCode, type ListAddressBookEntriesInput, type ListApiKeyPoliciesResponse, type ListAssetInfoInput, type ListAssistantConversationsInput, type ListAssistantConversationsResult, type ListAssistantMemoriesInput, type ListAssistantMemoriesResult, type ListAssistantMessagesInput, type ListAssistantMessagesResult, type ListAutoWithdrawRunsInput, type ListAutoWithdrawRunsResult, type ListChangelogChangesInput, type ListChangelogChangesResult, type ListChangelogDeploymentGroupsInput, type ListChangelogDeploymentGroupsResult, type ListChangelogPostsInput, type ListChangelogPostsResult, type ListCheckpointsInput, type ListDepositAddressesInput, type ListInternalTransferWhitelistEntriesInput, type ListLifecycleFlowsByTxInput, type ListLifecycleFlowsByTxOutput, type ListLifecycleFlowsInput, type ListLifecycleFlowsOutput, type ListMarketOverviewInput, type ListMfaFactorsResult, type ListNotificationsInput, type ListNotificationsResult, type ListPriceAlertsInput, type ListPriceAlertsResult, type ListRewardAwardsInput, type ListRewardAwardsResult, type ListStatusEventsInput, type ListStatusEventsResult, type ListSubaccountInvitesInput, type ListTransferCounterpartiesInput, type ListTransferDestinationsInput, type ListTransfersInput, type ListTriggerEventsInput, type ListTriggerEventsResult, type ListTriggersInput, type ListTriggersResult, type LoginOptions, type LoginResult, type LoginWithWalletInput, type LoginWithWalletResponse, type MarkAllNotificationsReadInput, type MarkNotificationsInput, type MarketOverview, type MarketOverviewOrderBy, type MarketOverviewSort, type MarketOverviewSparkline, type MarketTrade, type Me, MfaEnrollmentRequiredError, type MfaFactor, MfaLastFactorRequiredError, MfaRequiredError, type MfaSessionInfo, MfaVerificationError, type MfaVerificationFailureReason, type MirroredWithdrawWhitelistEntry, type ModifyOrderInput, type ModifyOrderResult, type ModifyTriggerInput, type ModifyTriggerResult, NetworkError, type NewOrderInput, type NextVipTierThresholds, NotImplementedError, type NotificationCategory, type NotificationCounts, type NotificationReadState, type NotificationType, type OpenOrdersInput, type Order, type OrderDetails, type OrderErrorCode, type OrderErrorDetail, type OrderHistoryInput, type OrderIntentInput, type OrderLineage, type OrderTransfer, type OrderbookData, type OrderbookHeatmapDeltaBucket, type OrderbookHeatmapDeltaChain, type OrderbookHeatmapDeltaLevels, type OrderbookHeatmapKeyframe, type OrderbookHeatmapLevels, type OrderbookHeatmapLiveBucket, type OrderbookHeatmapResponse, type OrderbookLevel, type OrderbookStreamHandlers, type OrderbookSubscription, OutcomeUnknownError, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_DEVNET_ENVIRONMENT, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, type PairConfig, type PairStatus, type PauseTriggerInput, type PauseTriggerResult, PermissionError, type PolicyAction, PolicyInUseError, PolicyLockedError, type PolicyMarketScope, PolicyScopeMismatchError, type PolyesterAccountAbstractionEnvironment, PolyesterBrowserClient, type PolyesterBrowserClientConfig, PolyesterBrowserCore, PolyesterClient, type PolyesterClientBaseConfig, type PolyesterClientConfig, type PolyesterContractsEnvironment, PolyesterCore, type PolyesterEntryPointConfig, type PolyesterEnvironment, PolyesterError, type PolyesterErrorCode, type PolyesterErrorDetail, type PolyesterErrorOptions, type PolyesterMutationOptions, type PolyesterRealtime, type PolyesterRealtimeAuthConfig, type PolyesterRequestOptions, type PolyesterSafeDeploymentConfig, PolyesterServerClient, type PolyesterServerClientConfig, PolyesterServerCore, type PolyesterServices, type PortfolioEquityHistoryInput, type PortfolioEquityHistoryResponse, type PortfolioEquitySeries, type PortfolioEquitySeriesGrouping, type PortfolioEquitySnapshotResponse, PreconditionFailedError, type PrepareAssistantKeysInput, type PrepareAssistantKeysResult, type PreparedAssistantKey, type PreparedTradingWithdraw, type PreviewOrderResult, type PriceAlert, type PriceAlertChannel, type PriceAlertDirection, type PriceAlertPriceSource, type PriceAlertStatus, type PriceAlertUpdateOutcome, type PrivateOrdersEvent, type Profile, type RateLimitConfig, type RateLimitDetail, RateLimitError, type RateLimitErrorOptions, type RateLimitFailureReason, type RateLimitPolicyClass, type RateLimitRefillModel, type RateLimitScope, type RealtimeConnection, type RealtimeConnectionState, type RealtimeConnectionStatus, RealtimeError, type RealtimeErrorOptions, type RegenerateRecoveryCodesInput, type RegenerateRecoveryCodesResult, type ReleaseFreshStepUpInput, type RemoveSubaccountMemberInput, RequestDeadlineExceededError, RequestError, RequestTooLargeError, type ResolveAccountInput, type ResolvedAccount, type ResolvedInternalTransferDestination, ResourceNotFoundError, type RespondSubaccountInviteInput, type ResumeTriggerInput, type ResumeTriggerResult, RevisionConflictError, type RewardAward, type RewardFulfillmentMethod, type RewardFulfillmentState, type RiskPolicyInput, type RotateGuardSignerWalletResult, type SdkSubscriptionErrorContext, type SendAssistantMessageInput, type ServerSessionCookieOptions, type ServerSessionSnapshot, ServiceUnavailableError, type SessionData, SessionElevationRequiredError, type SetAssistantKeysInput, type SetAutoWithdrawRuleEnabledInput, type SetAutoWithdrawRuleInput, type SetRewardDestinationInput, type SetRewardDestinationResult, type SetSubaccountMemberMfaRequirementInput, type SetTelegramApprovalLimitsInput, type SignProtectedActionInput, type SocialProvider, type SocialProviderInput, type SocialVerification, type SocialVerificationErrorCode, type SocialVerificationMethod, type SocialVerificationStatus, type SparklineIntervalName, type SpotConfig, type SpotFeeDiscount, type SpotFeeRate, type SpotFeeRateBreakdown, type SpotPairVolumeSeries, type SpotVolumeHistoryInput, type SpotVolumeHistoryResponse, type StablecoinConversionRate, StaleQuoteError, type StartVerificationInput, type StartVerificationResponse, type StatementPage, type StatusEvent, type StatusEventImpact, type StatusEventKind, type StatusEventService, type StatusEventState, StepUpRequiredError, type StopDetailsOutput, type StopLossInput, type Subaccount, type SubaccountActivityInput, type SubaccountChallenge, SubaccountChallengeInvalidError, type SubaccountEvent, type SubaccountIdInput, type SubaccountInvite, type SubaccountInviteStatus, type SubaccountMember, type SubaccountPermission, type SubaccountPermissionDefinition, type SubaccountPolicy, type SubaccountPolicyApplyInput, type SubaccountPolicyCreateInput, type SubaccountPolicyUpdateInput, type SubaccountRole, type SubaccountRoleCatalog, type SubaccountRoleDefinition, type SubaccountScopedInput, type SubaccountStatus, type SubscribeHandlers, type SubscribeZippedAssetSupplyInput, type SystemVersion, type TakeProfitInput, type TelegramApprovalAction, type TelegramApprovalLimits, type Timeframe, TimeoutError, TimestampSkewError, type Trade, type TradeBackfill, type TradingRateLimitClass, type TradingRateLimitRule, type TradingRateLimits, type TradingWithdrawSigningConfig, type TradingWithdrawWalletSigner, type TrailingDetailsOutput, type TrailingStopInput, type TransferCodeValue, type TransferCounterparties, type TransferCounterparty, type TransferDestination, type TransferDestinations, type TransferSideKind, TransientError, type Transports, type Trigger, type TriggerDetailsOutput, type TriggerEvent, type TwapDetailsOutput, type UnifiedAssetBalancesResponse, type UnlinkSocialAccountInput, type UpdateAddressBookEntryInput, type UpdateAddressBookTagInput, type UpdateMfaFactorInput, type UpdateMfaFactorResult, type UpdatePriceAlertInput, type UpdatePriceAlertResult, type UpdateProfileInput, type UpdateSubaccountInput, type UpdateSubaccountMemberRoleInput, UserOperationAlreadyKnownError, UserOperationNotExecutedError, UserOperationSendTimeoutError, type UsernameHistoryEntry, type ValidateWithdrawDestinationInput, type ValidateWithdrawDestinationResult, ValidationError, type VerificationReadyResponse, type VerifyRecoveryCodeChallengeInput, type VerifyTotpChallengeInput, type VipMetricQuality, type VipMetricStatus, type VipStatus, type VipTier, type VipTierCatalog, type WalletChallenge, type WatchAssistantRunInput, WithdrawDeadlineExpiredError, type WithdrawWhitelistView, type ZippedAssetSupplyBatch, type ZippedAssetSupplyGroupResponse, type ZippedAssetSupplyResponse, type ZippedAssetSupplySeries, type ZippedAssetSupplyUpdate, type ZipperAssetChainVariant, type ZipperAssetConfig, type ZipperChainConfig, type ZipperChainContractConfig, type ZipperMemoRequirement, type ZipperRouteStatus, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, createPolyesterServerCoreFromCookies, createPolyesterServerCoreFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatLedgerBalance, formatUserFacingError, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, isTimeoutAbortError, keccak256Hex, loadErrorDetailDecoders, mergeLedgerBalances, normalizeErrorMessage, resolveAuthCookieName, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
@@ -0,0 +1,14 @@
1
+ import "../../gen/auth/v1/api_keys_pb.js";
2
+ //#region src/services/api-keys/api-keys.codecs.d.ts
3
+ /**
4
+ * Fixed permission sets for an assistant key, available on devnet only. `read_only` reads
5
+ * balances, orders, transfers, auto-withdraw rules, API keys, subaccounts, deposit addresses
6
+ * and account statements (and price alerts on the main account). `trade_with_approval` adds trading, swaps and deposit
7
+ * address creation, each trade only after the user approves it (and price alert management on
8
+ * the main account). No preset moves value out of the account.
9
+ */
10
+ declare const ASSISTANT_KEY_PRESET_VALUES: readonly ["read_only", "trade_with_approval"];
11
+ type AssistantKeyPreset = (typeof ASSISTANT_KEY_PRESET_VALUES)[number];
12
+ //#endregion
13
+ export { ASSISTANT_KEY_PRESET_VALUES, AssistantKeyPreset };
14
+ //# sourceMappingURL=api-keys.codecs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-keys.codecs.d.ts","names":[],"sources":["../../../src/services/api-keys/api-keys.codecs.ts"],"mappings":";;;;;;;;;cAiBa;KACD,6BAA6B"}
@@ -7,6 +7,18 @@ const API_KEY_STATUS_VALUES = [
7
7
  ];
8
8
  const API_KEY_UPDATE_STATUS_VALUES = ["active", "disabled"];
9
9
  /**
10
+ * Fixed permission sets for an assistant key, available on devnet only. `read_only` reads
11
+ * balances, orders, transfers, auto-withdraw rules, API keys, subaccounts, deposit addresses
12
+ * and account statements (and price alerts on the main account). `trade_with_approval` adds trading, swaps and deposit
13
+ * address creation, each trade only after the user approves it (and price alert management on
14
+ * the main account). No preset moves value out of the account.
15
+ */
16
+ const ASSISTANT_KEY_PRESET_VALUES = ["read_only", "trade_with_approval"];
17
+ const AssistantKeyPresetCodec = { inputToProto: {
18
+ read_only: 1,
19
+ trade_with_approval: 2
20
+ } };
21
+ /**
10
22
  * `assistant` keys belong to the Polyester AI assistant: their policy can never move value out
11
23
  * of the account. They are listed, updated and revoked like any key.
12
24
  */
@@ -28,6 +40,6 @@ const ApiKeyStatusCodec = {
28
40
  }
29
41
  };
30
42
  //#endregion
31
- export { API_KEY_STATUS_VALUES, API_KEY_UPDATE_STATUS_VALUES, ApiKeyPurposeCodec, ApiKeyStatusCodec };
43
+ export { API_KEY_STATUS_VALUES, API_KEY_UPDATE_STATUS_VALUES, ASSISTANT_KEY_PRESET_VALUES, ApiKeyPurposeCodec, ApiKeyStatusCodec, AssistantKeyPresetCodec };
32
44
 
33
45
  //# sourceMappingURL=api-keys.codecs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-keys.codecs.js","names":[],"sources":["../../../src/services/api-keys/api-keys.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/api_keys_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const API_KEY_STATUS_VALUES = [\"active\", \"revoked\", \"disabled\"] as const;\nexport type ApiKeyStatusLabel = (typeof API_KEY_STATUS_VALUES)[number];\nexport const API_KEY_UPDATE_STATUS_VALUES = [\"active\", \"disabled\"] as const;\nexport type ApiKeyUpdateStatusLabel = (typeof API_KEY_UPDATE_STATUS_VALUES)[number];\nexport const API_KEY_PURPOSE_VALUES = [\"standard\", \"assistant\"] as const;\nexport type ApiKeyPurposeLabel = (typeof API_KEY_PURPOSE_VALUES)[number];\n\n/**\n * `assistant` keys belong to the Polyester AI assistant: their policy can never move value out\n * of the account. They are listed, updated and revoked like any key.\n */\nexport const ApiKeyPurposeCodec = {\n protoToOutput: {\n [Proto.ApiKeyPurpose.PURPOSE_UNSPECIFIED]: \"unspecified\",\n [Proto.ApiKeyPurpose.STANDARD]: \"standard\",\n [Proto.ApiKeyPurpose.ASSISTANT]: \"assistant\",\n } satisfies ProtoToOutput<Proto.ApiKeyPurpose, ApiKeyPurposeLabel>,\n} as const;\n\nexport const ApiKeyStatusCodec = {\n inputToProto: {\n active: Proto.ApiKeyStatus.ACTIVE,\n disabled: Proto.ApiKeyStatus.DISABLED,\n } satisfies InputToProto<ApiKeyUpdateStatusLabel, Proto.ApiKeyStatus>,\n protoToOutput: {\n [Proto.ApiKeyStatus.API_KEY_STATUS_UNSPECIFIED]: \"unspecified\",\n [Proto.ApiKeyStatus.ACTIVE]: \"active\",\n [Proto.ApiKeyStatus.REVOKED]: \"revoked\",\n [Proto.ApiKeyStatus.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.ApiKeyStatus, ApiKeyStatusLabel>,\n} as const;\n"],"mappings":";;AAGA,MAAa,wBAAwB;CAAC;CAAU;CAAW;AAAU;AAErE,MAAa,+BAA+B,CAAC,UAAU,UAAU;;;;;AASjE,MAAa,qBAAqB,EAC9B,eAAe;EACgC,IAAA;EACX,IAAA;EACC,IAAA;AACrC,EACJ;AAEA,MAAa,oBAAoB;CAC7B,cAAc;EACV,QAAA;EACA,UAAA;CACJ;CACA,eAAe;GACsC,IAAA;GACpB,IAAA;GACC,IAAA;GACC,IAAA;CACnC;AACJ"}
1
+ {"version":3,"file":"api-keys.codecs.js","names":[],"sources":["../../../src/services/api-keys/api-keys.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/api_keys_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const API_KEY_STATUS_VALUES = [\"active\", \"revoked\", \"disabled\"] as const;\nexport type ApiKeyStatusLabel = (typeof API_KEY_STATUS_VALUES)[number];\nexport const API_KEY_UPDATE_STATUS_VALUES = [\"active\", \"disabled\"] as const;\nexport type ApiKeyUpdateStatusLabel = (typeof API_KEY_UPDATE_STATUS_VALUES)[number];\nexport const API_KEY_PURPOSE_VALUES = [\"standard\", \"assistant\"] as const;\nexport type ApiKeyPurposeLabel = (typeof API_KEY_PURPOSE_VALUES)[number];\n\n/**\n * Fixed permission sets for an assistant key, available on devnet only. `read_only` reads\n * balances, orders, transfers, auto-withdraw rules, API keys, subaccounts, deposit addresses\n * and account statements (and price alerts on the main account). `trade_with_approval` adds trading, swaps and deposit\n * address creation, each trade only after the user approves it (and price alert management on\n * the main account). No preset moves value out of the account.\n */\nexport const ASSISTANT_KEY_PRESET_VALUES = [\"read_only\", \"trade_with_approval\"] as const;\nexport type AssistantKeyPreset = (typeof ASSISTANT_KEY_PRESET_VALUES)[number];\n\nexport const AssistantKeyPresetCodec = {\n inputToProto: {\n read_only: Proto.AssistantKeyPreset.READ_ONLY,\n trade_with_approval: Proto.AssistantKeyPreset.TRADE_WITH_APPROVAL,\n } satisfies InputToProto<AssistantKeyPreset, Proto.AssistantKeyPreset>,\n} as const;\n\n/**\n * `assistant` keys belong to the Polyester AI assistant: their policy can never move value out\n * of the account. They are listed, updated and revoked like any key.\n */\nexport const ApiKeyPurposeCodec = {\n protoToOutput: {\n [Proto.ApiKeyPurpose.PURPOSE_UNSPECIFIED]: \"unspecified\",\n [Proto.ApiKeyPurpose.STANDARD]: \"standard\",\n [Proto.ApiKeyPurpose.ASSISTANT]: \"assistant\",\n } satisfies ProtoToOutput<Proto.ApiKeyPurpose, ApiKeyPurposeLabel>,\n} as const;\n\nexport const ApiKeyStatusCodec = {\n inputToProto: {\n active: Proto.ApiKeyStatus.ACTIVE,\n disabled: Proto.ApiKeyStatus.DISABLED,\n } satisfies InputToProto<ApiKeyUpdateStatusLabel, Proto.ApiKeyStatus>,\n protoToOutput: {\n [Proto.ApiKeyStatus.API_KEY_STATUS_UNSPECIFIED]: \"unspecified\",\n [Proto.ApiKeyStatus.ACTIVE]: \"active\",\n [Proto.ApiKeyStatus.REVOKED]: \"revoked\",\n [Proto.ApiKeyStatus.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.ApiKeyStatus, ApiKeyStatusLabel>,\n} as const;\n"],"mappings":";;AAGA,MAAa,wBAAwB;CAAC;CAAU;CAAW;AAAU;AAErE,MAAa,+BAA+B,CAAC,UAAU,UAAU;;;;;;;;AAYjE,MAAa,8BAA8B,CAAC,aAAa,qBAAqB;AAG9E,MAAa,0BAA0B,EACnC,cAAc;CACV,WAAA;CACA,qBAAA;AACJ,EACJ;;;;;AAMA,MAAa,qBAAqB,EAC9B,eAAe;EACgC,IAAA;EACX,IAAA;EACC,IAAA;AACrC,EACJ;AAEA,MAAa,oBAAoB;CAC7B,cAAc;EACV,QAAA;EACA,UAAA;CACJ;CACA,eAAe;GACsC,IAAA;GACpB,IAAA;GACC,IAAA;GACC,IAAA;CACnC;AACJ"}
@@ -41,9 +41,9 @@ declare class ApiKeysService {
41
41
  update(payload: v.InferInput<typeof ApiKeysUpdateInputSchema>, options?: PolyesterMutationOptions): Promise<ApiKey | null>;
42
42
  /**
43
43
  * Replaces the caller's Polyester AI assistant key set: one `assistant` key per account,
44
- * each bounded by its API policy, all or nothing. Register the keys `assistant.prepareKeys`
44
+ * each bounded by its API policy or a permission `preset`, all or nothing. Register the keys `assistant.prepareKeys`
45
45
  * returned before their deadline, then call `assistant.completeKeys`. Needs a fresh
46
- * `stepUpToken` for the whole set. A policy that allows moving value out throws
46
+ * `stepUpToken` for the whole set, including the policies its presets create. A policy that allows moving value out throws
47
47
  * `PreconditionFailedError` (`AUTH_ASSISTANT_KEY_ACTION_NOT_ALLOWED`).
48
48
  */
49
49
  setAssistantKeys(input: SetAssistantKeysInput, options?: PolyesterMutationOptions): Promise<ApiKey[]>;
@@ -66,9 +66,9 @@ var ApiKeysService = class {
66
66
  }
67
67
  /**
68
68
  * Replaces the caller's Polyester AI assistant key set: one `assistant` key per account,
69
- * each bounded by its API policy, all or nothing. Register the keys `assistant.prepareKeys`
69
+ * each bounded by its API policy or a permission `preset`, all or nothing. Register the keys `assistant.prepareKeys`
70
70
  * returned before their deadline, then call `assistant.completeKeys`. Needs a fresh
71
- * `stepUpToken` for the whole set. A policy that allows moving value out throws
71
+ * `stepUpToken` for the whole set, including the policies its presets create. A policy that allows moving value out throws
72
72
  * `PreconditionFailedError` (`AUTH_ASSISTANT_KEY_ACTION_NOT_ALLOWED`).
73
73
  */
74
74
  async setAssistantKeys(input, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"api-keys.js","names":["#client","Proto.ApiKeyService","#realtime","#resolver","ApiKeySchema","Proto.ApiKeySchema"],"sources":["../../../src/services/api-keys/api-keys.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/api_keys_pb.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport type * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport { keygenAsync } from \"@noble/ed25519\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport { ApiKeyPoliciesService } from \"../policies/api-key-policies/index.js\";\nimport {\n ApiKeyIdInputSchema,\n ApiKeysListInputSchema,\n ApiKeysCreateInputSchema,\n ApiKeysUpdateInputSchema,\n ApiKeySchema,\n ApiKeysSchema,\n SetAssistantKeysInputSchema,\n type ApiKey,\n type SetAssistantKeysInput,\n} from \"./api-keys.schemas.js\";\n\ninterface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {\n accountId: string;\n}\n\n/**\n * Manages API key metadata, client-generated Ed25519 keypairs, policies, and realtime API key updates.\n */\nexport class ApiKeysService {\n readonly policies: ApiKeyPoliciesService;\n\n #client: Client<typeof Proto.ApiKeyService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n\n constructor(\n transports: AuthApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.policies = new ApiKeyPoliciesService(transports);\n this.#client = createClient(Proto.ApiKeyService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n }\n\n /**\n * Returns non-revoked API keys owned by the caller, newest first, optionally scoped through an explicit or resolver-provided subaccount ID. API keys need `read-api-keys`; a key scoped to a sub-account sees only that sub-account's keys.\n */\n async list(\n params: v.InferInput<typeof ApiKeysListInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<ApiKey[]> {\n const resolved = resolveAccountScopedInput(params, this.#resolver);\n const validatedParams = parse(ApiKeysListInputSchema, resolved);\n const res = await this.#client.listApiKeys(\n removeUndefined(validatedParams),\n toConnectCallOptions(options),\n );\n\n return parse(ApiKeysSchema, res.apiKeys);\n }\n\n /**\n * Fetches one caller-owned API key by ak_... key ID and returns null when no matching key is returned. API keys need `read-api-keys`.\n */\n async get(\n input: v.InferInput<typeof ApiKeyIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<ApiKey | null> {\n const validatedInput = parse(ApiKeyIdInputSchema, input);\n const res = await this.#client.getApiKey(validatedInput, toConnectCallOptions(options));\n return res.apiKey ? parse(ApiKeySchema, res.apiKey) : null;\n }\n\n /**\n * Creates API key metadata using a client-generated Ed25519 public key; security settings may require MFA fresh step-up and retrying with stepUpToken.\n */\n async create(\n payload: v.InferInput<typeof ApiKeysCreateInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKey | null> {\n const resolved = resolveAccountScopedInput(payload, this.#resolver);\n const validatedPayload = parse(ApiKeysCreateInputSchema, resolved);\n const res = await this.#client.createApiKey(\n removeUndefined(validatedPayload),\n toConnectCallOptions(options),\n );\n return res.apiKey ? parse(ApiKeySchema, res.apiKey) : null;\n }\n\n /**\n * Permanently revokes the specified API key; revoked keys cannot authenticate again.\n */\n async delete(\n input: v.InferInput<typeof ApiKeyIdInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<void> {\n const validatedInput = parse(ApiKeyIdInputSchema, input);\n await this.#client.deleteApiKey(validatedInput, toConnectCallOptions(options));\n }\n\n /**\n * Updates mutable key metadata, ACTIVE/DISABLED status, IP whitelist replacement/clearing, and optional expiry; revocation must use delete.\n */\n async update(\n payload: v.InferInput<typeof ApiKeysUpdateInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKey | null> {\n const validatedPayload = parse(ApiKeysUpdateInputSchema, payload);\n const res = await this.#client.updateApiKey(\n removeUndefined(validatedPayload),\n toConnectCallOptions(options),\n );\n return res.apiKey ? parse(ApiKeySchema, res.apiKey) : null;\n }\n\n /**\n * Replaces the caller's Polyester AI assistant key set: one `assistant` key per account,\n * each bounded by its API policy, all or nothing. Register the keys `assistant.prepareKeys`\n * returned before their deadline, then call `assistant.completeKeys`. Needs a fresh\n * `stepUpToken` for the whole set. A policy that allows moving value out throws\n * `PreconditionFailedError` (`AUTH_ASSISTANT_KEY_ACTION_NOT_ALLOWED`).\n */\n async setAssistantKeys(\n input: SetAssistantKeysInput,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKey[]> {\n const request = parse(SetAssistantKeysInputSchema, input);\n const res = await this.#client.setAssistantKeys(\n { keys: request.keys.map((key) => removeUndefined(key)) },\n toConnectCallOptions(options),\n );\n return parse(ApiKeysSchema, res.apiKeys);\n }\n\n /** Lists the caller's non-revoked assistant keys, newest first. */\n async listAssistantKeys(options?: PolyesterRequestOptions): Promise<ApiKey[]> {\n const res = await this.#client.listAssistantKeys({}, toConnectCallOptions(options));\n return parse(ApiKeysSchema, res.apiKeys);\n }\n\n /**\n * Permanently revokes the caller's whole assistant key set; needs no step-up. Returns the\n * revoked key IDs, empty when the set was already empty.\n */\n async deleteAssistantKeys(options?: PolyesterMutationOptions): Promise<string[]> {\n const res = await this.#client.deleteAssistantKeys({}, toConnectCallOptions(options));\n return res.revokedKeyIds;\n }\n\n /**\n * Generates an Ed25519 keypair locally and returns public and secret key material as both hex strings and byte arrays; only the public key should be sent to the API.\n */\n async generateKeypair(): Promise<{\n publicKey: { hex: string; bytes: Uint8Array };\n secretKey: { hex: string; bytes: Uint8Array };\n }> {\n const { secretKey, publicKey } = await keygenAsync();\n return {\n publicKey: {\n hex: bytesToHex(publicKey),\n bytes: publicKey,\n },\n secretKey: {\n hex: bytesToHex(secretKey),\n bytes: secretKey,\n },\n };\n }\n\n /**\n * Subscribes to private API key updates for an account and emits normalized API key metadata from realtime protobuf publications.\n */\n subscribe(input: SubscribeApiKeysInput) {\n const channel = `private:auth:api-keys:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.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":";;;;;;;;;;;;;;AAoCA,IAAa,iBAAb,MAA4B;CACxB;CAEA;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAK,WAAW,IAAI,sBAAsB,UAAU;EACpD,KAAKA,UAAU,aAAaC,eAAqB,WAAW,OAAO;EACnE,KAAKC,YAAY;EACjB,KAAKC,YAAY;CACrB;;;;CAKA,MAAM,KACF,SAAsD,CAAC,GACvD,SACiB;EACjB,MAAM,WAAW,0BAA0B,QAAQ,KAAKA,SAAS;EACjE,MAAM,kBAAkB,MAAM,wBAAwB,QAAQ;EAC9D,MAAM,MAAM,MAAM,KAAKH,QAAQ,YAC3B,gBAAgB,eAAe,GAC/B,qBAAqB,OAAO,CAChC;EAEA,OAAO,MAAM,eAAe,IAAI,OAAO;CAC3C;;;;CAKA,MAAM,IACF,OACA,SACsB;EACtB,MAAM,iBAAiB,MAAM,qBAAqB,KAAK;EACvD,MAAM,MAAM,MAAM,KAAKA,QAAQ,UAAU,gBAAgB,qBAAqB,OAAO,CAAC;EACtF,OAAO,IAAI,SAAS,MAAMI,gBAAc,IAAI,MAAM,IAAI;CAC1D;;;;CAKA,MAAM,OACF,SACA,SACsB;EACtB,MAAM,WAAW,0BAA0B,SAAS,KAAKD,SAAS;EAClE,MAAM,mBAAmB,MAAM,0BAA0B,QAAQ;EACjE,MAAM,MAAM,MAAM,KAAKH,QAAQ,aAC3B,gBAAgB,gBAAgB,GAChC,qBAAqB,OAAO,CAChC;EACA,OAAO,IAAI,SAAS,MAAMI,gBAAc,IAAI,MAAM,IAAI;CAC1D;;;;CAKA,MAAM,OACF,OACA,SACa;EACb,MAAM,iBAAiB,MAAM,qBAAqB,KAAK;EACvD,MAAM,KAAKJ,QAAQ,aAAa,gBAAgB,qBAAqB,OAAO,CAAC;CACjF;;;;CAKA,MAAM,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{"version":3,"file":"api-keys.js","names":["#client","Proto.ApiKeyService","#realtime","#resolver","ApiKeySchema","Proto.ApiKeySchema"],"sources":["../../../src/services/api-keys/api-keys.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/api_keys_pb.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport type * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport { keygenAsync } from \"@noble/ed25519\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport { ApiKeyPoliciesService } from \"../policies/api-key-policies/index.js\";\nimport {\n ApiKeyIdInputSchema,\n ApiKeysListInputSchema,\n ApiKeysCreateInputSchema,\n ApiKeysUpdateInputSchema,\n ApiKeySchema,\n ApiKeysSchema,\n SetAssistantKeysInputSchema,\n type ApiKey,\n type SetAssistantKeysInput,\n} from \"./api-keys.schemas.js\";\n\ninterface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {\n accountId: string;\n}\n\n/**\n * Manages API key metadata, client-generated Ed25519 keypairs, policies, and realtime API key updates.\n */\nexport class ApiKeysService {\n readonly policies: ApiKeyPoliciesService;\n\n #client: Client<typeof Proto.ApiKeyService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n\n constructor(\n transports: AuthApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.policies = new ApiKeyPoliciesService(transports);\n this.#client = createClient(Proto.ApiKeyService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n }\n\n /**\n * Returns non-revoked API keys owned by the caller, newest first, optionally scoped through an explicit or resolver-provided subaccount ID. API keys need `read-api-keys`; a key scoped to a sub-account sees only that sub-account's keys.\n */\n async list(\n params: v.InferInput<typeof ApiKeysListInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<ApiKey[]> {\n const resolved = resolveAccountScopedInput(params, this.#resolver);\n const validatedParams = parse(ApiKeysListInputSchema, resolved);\n const res = await this.#client.listApiKeys(\n removeUndefined(validatedParams),\n toConnectCallOptions(options),\n );\n\n return parse(ApiKeysSchema, res.apiKeys);\n }\n\n /**\n * Fetches one caller-owned API key by ak_... key ID and returns null when no matching key is returned. API keys need `read-api-keys`.\n */\n async get(\n input: v.InferInput<typeof ApiKeyIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<ApiKey | null> {\n const validatedInput = parse(ApiKeyIdInputSchema, input);\n const res = await this.#client.getApiKey(validatedInput, toConnectCallOptions(options));\n return res.apiKey ? parse(ApiKeySchema, res.apiKey) : null;\n }\n\n /**\n * Creates API key metadata using a client-generated Ed25519 public key; security settings may require MFA fresh step-up and retrying with stepUpToken.\n */\n async create(\n payload: v.InferInput<typeof ApiKeysCreateInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKey | null> {\n const resolved = resolveAccountScopedInput(payload, this.#resolver);\n const validatedPayload = parse(ApiKeysCreateInputSchema, resolved);\n const res = await this.#client.createApiKey(\n removeUndefined(validatedPayload),\n toConnectCallOptions(options),\n );\n return res.apiKey ? parse(ApiKeySchema, res.apiKey) : null;\n }\n\n /**\n * Permanently revokes the specified API key; revoked keys cannot authenticate again.\n */\n async delete(\n input: v.InferInput<typeof ApiKeyIdInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<void> {\n const validatedInput = parse(ApiKeyIdInputSchema, input);\n await this.#client.deleteApiKey(validatedInput, toConnectCallOptions(options));\n }\n\n /**\n * Updates mutable key metadata, ACTIVE/DISABLED status, IP whitelist replacement/clearing, and optional expiry; revocation must use delete.\n */\n async update(\n payload: v.InferInput<typeof ApiKeysUpdateInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKey | null> {\n const validatedPayload = parse(ApiKeysUpdateInputSchema, payload);\n const res = await this.#client.updateApiKey(\n removeUndefined(validatedPayload),\n toConnectCallOptions(options),\n );\n return res.apiKey ? parse(ApiKeySchema, res.apiKey) : null;\n }\n\n /**\n * Replaces the caller's Polyester AI assistant key set: one `assistant` key per account,\n * each bounded by its API policy or a permission `preset`, all or nothing. Register the keys `assistant.prepareKeys`\n * returned before their deadline, then call `assistant.completeKeys`. Needs a fresh\n * `stepUpToken` for the whole set, including the policies its presets create. A policy that allows moving value out throws\n * `PreconditionFailedError` (`AUTH_ASSISTANT_KEY_ACTION_NOT_ALLOWED`).\n */\n async setAssistantKeys(\n input: SetAssistantKeysInput,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKey[]> {\n const request = parse(SetAssistantKeysInputSchema, input);\n const res = await this.#client.setAssistantKeys(\n { keys: request.keys.map((key) => removeUndefined(key)) },\n toConnectCallOptions(options),\n );\n return parse(ApiKeysSchema, res.apiKeys);\n }\n\n /** Lists the caller's non-revoked assistant keys, newest first. */\n async listAssistantKeys(options?: PolyesterRequestOptions): Promise<ApiKey[]> {\n const res = await this.#client.listAssistantKeys({}, toConnectCallOptions(options));\n return parse(ApiKeysSchema, res.apiKeys);\n }\n\n /**\n * Permanently revokes the caller's whole assistant key set; needs no step-up. Returns the\n * revoked key IDs, empty when the set was already empty.\n */\n async deleteAssistantKeys(options?: PolyesterMutationOptions): Promise<string[]> {\n const res = await this.#client.deleteAssistantKeys({}, toConnectCallOptions(options));\n return res.revokedKeyIds;\n }\n\n /**\n * Generates an Ed25519 keypair locally and returns public and secret key material as both hex strings and byte arrays; only the public key should be sent to the API.\n */\n async generateKeypair(): Promise<{\n publicKey: { hex: string; bytes: Uint8Array };\n secretKey: { hex: string; bytes: Uint8Array };\n }> {\n const { secretKey, publicKey } = await keygenAsync();\n return {\n publicKey: {\n hex: bytesToHex(publicKey),\n bytes: publicKey,\n },\n secretKey: {\n hex: bytesToHex(secretKey),\n bytes: secretKey,\n },\n };\n }\n\n /**\n * Subscribes to private API key updates for an account and emits normalized API key metadata from realtime protobuf publications.\n */\n subscribe(input: SubscribeApiKeysInput) {\n const channel = `private:auth:api-keys:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.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":";;;;;;;;;;;;;;AAoCA,IAAa,iBAAb,MAA4B;CACxB;CAEA;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAK,WAAW,IAAI,sBAAsB,UAAU;EACpD,KAAKA,UAAU,aAAaC,eAAqB,WAAW,OAAO;EACnE,KAAKC,YAAY;EACjB,KAAKC,YAAY;CACrB;;;;CAKA,MAAM,KACF,SAAsD,CAAC,GACvD,SACiB;EACjB,MAAM,WAAW,0BAA0B,QAAQ,KAAKA,SAAS;EACjE,MAAM,kBAAkB,MAAM,wBAAwB,QAAQ;EAC9D,MAAM,MAAM,MAAM,KAAKH,QAAQ,YAC3B,gBAAgB,eAAe,GAC/B,qBAAqB,OAAO,CAChC;EAEA,OAAO,MAAM,eAAe,IAAI,OAAO;CAC3C;;;;CAKA,MAAM,IACF,OACA,SACsB;EACtB,MAAM,iBAAiB,MAAM,qBAAqB,KAAK;EACvD,MAAM,MAAM,MAAM,KAAKA,QAAQ,UAAU,gBAAgB,qBAAqB,OAAO,CAAC;EACtF,OAAO,IAAI,SAAS,MAAMI,gBAAc,IAAI,MAAM,IAAI;CAC1D;;;;CAKA,MAAM,OACF,SACA,SACsB;EACtB,MAAM,WAAW,0BAA0B,SAAS,KAAKD,SAAS;EAClE,MAAM,mBAAmB,MAAM,0BAA0B,QAAQ;EACjE,MAAM,MAAM,MA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A8B;EACpC,MAAM,UAAU,yBAAyB,MAAM,UAAU;EAEzD,OAAO,KAAKE,UAAU,oBAAoB;GACtC;GACA,QAAQG;GACR,gBAAgB,SAAS;IACrB,MAAM,SAAS,MAAMD,gBAAc,IAAI;IACvC,MAAM,QAAQ,MAAM;GACxB;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
@@ -1,3 +1,4 @@
1
+ import { AssistantKeyPreset } from "../../gen/auth/v1/api_keys_pb.js";
1
2
  import * as v from "valibot";
2
3
  //#region src/services/api-keys/api-keys.schemas.d.ts
3
4
  declare const ApiKeyStatusSchema: v.PicklistSchema<readonly ["active", "revoked", "disabled"], undefined>;
@@ -181,7 +182,7 @@ declare const ApiKeySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
181
182
  type ApiKey = v.InferOutput<typeof ApiKeySchema>;
182
183
  /**
183
184
  * One account's key in the assistant key set. Spread a key from `assistant.prepareKeys` and add
184
- * its `policyId`; other fields (like `publicKeyHex`) are ignored.
185
+ * exactly one of `policyId` and `preset`; other fields (like `publicKeyHex`) are ignored.
185
186
  */
186
187
  declare const AssistantKeySpecInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
187
188
  /** Subaccount the key acts for; omit for the main account. */
@@ -198,7 +199,13 @@ declare const AssistantKeySpecInputSchema: v.SchemaWithPipe<readonly [v.ObjectSc
198
199
  from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>;
199
200
  }, undefined>, v.LengthAction<Uint8Array<ArrayBufferLike>, 32, "publicKeyEd25519 must be 32 bytes">]>;
200
201
  /** API policy that bounds the key. It must not allow moving value out of the account. */
201
- readonly policyId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
202
+ readonly policyId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, undefined>;
203
+ /**
204
+ * Permission preset that bounds the key instead of `policyId`. The key is bound to the
205
+ * account's policy named after the preset, created in the same change when missing; the
206
+ * returned key's `policyId` names it. Devnet only.
207
+ */
208
+ readonly preset: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["read_only", "trade_with_approval"], undefined>, v.TransformAction<"read_only" | "trade_with_approval", AssistantKeyPreset.READ_ONLY | AssistantKeyPreset.TRADE_WITH_APPROVAL>]>, undefined>;
202
209
  /** Epoch ms from `assistant.prepareKeys`; needed for a new key, not for one already registered. */
203
210
  readonly registrationDeadline: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
204
211
  /** 64-byte proof from `assistant.prepareKeys`; needed for a new key, not for one already registered. */
@@ -212,10 +219,18 @@ declare const AssistantKeySpecInputSchema: v.SchemaWithPipe<readonly [v.ObjectSc
212
219
  from(elements: Iterable<number>): Uint8Array<ArrayBuffer>;
213
220
  from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>;
214
221
  }, undefined>, v.LengthAction<Uint8Array<ArrayBufferLike>, 64, "registrationProof must be 64 bytes">]>, undefined>;
215
- }, undefined>, v.TransformAction<{
222
+ }, undefined>, v.CheckAction<{
223
+ subaccountId?: bigint | undefined;
224
+ publicKeyEd25519: Uint8Array<ArrayBufferLike>;
225
+ policyId?: bigint | undefined;
226
+ preset?: AssistantKeyPreset.READ_ONLY | AssistantKeyPreset.TRADE_WITH_APPROVAL | undefined;
227
+ registrationDeadline?: number | undefined;
228
+ registrationProof?: Uint8Array<ArrayBufferLike> | undefined;
229
+ }, "Set exactly one of policyId and preset.">, v.TransformAction<{
216
230
  subaccountId?: bigint | undefined;
217
231
  publicKeyEd25519: Uint8Array<ArrayBufferLike>;
218
- policyId: bigint;
232
+ policyId?: bigint | undefined;
233
+ preset?: AssistantKeyPreset.READ_ONLY | AssistantKeyPreset.TRADE_WITH_APPROVAL | undefined;
219
234
  registrationDeadline?: number | undefined;
220
235
  registrationProof?: Uint8Array<ArrayBufferLike> | undefined;
221
236
  }, {
@@ -223,7 +238,8 @@ declare const AssistantKeySpecInputSchema: v.SchemaWithPipe<readonly [v.ObjectSc
223
238
  registrationProof: Uint8Array<ArrayBufferLike>;
224
239
  subaccountId?: bigint | undefined;
225
240
  publicKeyEd25519: Uint8Array<ArrayBufferLike>;
226
- policyId: bigint;
241
+ policyId?: bigint | undefined;
242
+ preset?: AssistantKeyPreset.READ_ONLY | AssistantKeyPreset.TRADE_WITH_APPROVAL | undefined;
227
243
  }>]>;
228
244
  type AssistantKeySpecInput = v.InferInput<typeof AssistantKeySpecInputSchema>;
229
245
  declare const SetAssistantKeysInputSchema: v.StrictObjectSchema<{
@@ -243,7 +259,13 @@ declare const SetAssistantKeysInputSchema: v.StrictObjectSchema<{
243
259
  from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>;
244
260
  }, undefined>, v.LengthAction<Uint8Array<ArrayBufferLike>, 32, "publicKeyEd25519 must be 32 bytes">]>;
245
261
  /** API policy that bounds the key. It must not allow moving value out of the account. */
246
- readonly policyId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
262
+ readonly policyId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, undefined>;
263
+ /**
264
+ * Permission preset that bounds the key instead of `policyId`. The key is bound to the
265
+ * account's policy named after the preset, created in the same change when missing; the
266
+ * returned key's `policyId` names it. Devnet only.
267
+ */
268
+ readonly preset: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["read_only", "trade_with_approval"], undefined>, v.TransformAction<"read_only" | "trade_with_approval", AssistantKeyPreset.READ_ONLY | AssistantKeyPreset.TRADE_WITH_APPROVAL>]>, undefined>;
247
269
  /** Epoch ms from `assistant.prepareKeys`; needed for a new key, not for one already registered. */
248
270
  readonly registrationDeadline: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
249
271
  /** 64-byte proof from `assistant.prepareKeys`; needed for a new key, not for one already registered. */
@@ -257,10 +279,18 @@ declare const SetAssistantKeysInputSchema: v.StrictObjectSchema<{
257
279
  from(elements: Iterable<number>): Uint8Array<ArrayBuffer>;
258
280
  from<T>(elements: Iterable<T>, mapfn?: (v: T, k: number) => number, thisArg?: any): Uint8Array<ArrayBuffer>;
259
281
  }, undefined>, v.LengthAction<Uint8Array<ArrayBufferLike>, 64, "registrationProof must be 64 bytes">]>, undefined>;
260
- }, undefined>, v.TransformAction<{
282
+ }, undefined>, v.CheckAction<{
283
+ subaccountId?: bigint | undefined;
284
+ publicKeyEd25519: Uint8Array<ArrayBufferLike>;
285
+ policyId?: bigint | undefined;
286
+ preset?: AssistantKeyPreset.READ_ONLY | AssistantKeyPreset.TRADE_WITH_APPROVAL | undefined;
287
+ registrationDeadline?: number | undefined;
288
+ registrationProof?: Uint8Array<ArrayBufferLike> | undefined;
289
+ }, "Set exactly one of policyId and preset.">, v.TransformAction<{
261
290
  subaccountId?: bigint | undefined;
262
291
  publicKeyEd25519: Uint8Array<ArrayBufferLike>;
263
- policyId: bigint;
292
+ policyId?: bigint | undefined;
293
+ preset?: AssistantKeyPreset.READ_ONLY | AssistantKeyPreset.TRADE_WITH_APPROVAL | undefined;
264
294
  registrationDeadline?: number | undefined;
265
295
  registrationProof?: Uint8Array<ArrayBufferLike> | undefined;
266
296
  }, {
@@ -268,25 +298,29 @@ declare const SetAssistantKeysInputSchema: v.StrictObjectSchema<{
268
298
  registrationProof: Uint8Array<ArrayBufferLike>;
269
299
  subaccountId?: bigint | undefined;
270
300
  publicKeyEd25519: Uint8Array<ArrayBufferLike>;
271
- policyId: bigint;
301
+ policyId?: bigint | undefined;
302
+ preset?: AssistantKeyPreset.READ_ONLY | AssistantKeyPreset.TRADE_WITH_APPROVAL | undefined;
272
303
  }>]>, undefined>, v.MaxLengthAction<{
273
304
  registrationDeadline: import("@bufbuild/protobuf/wkt").Timestamp | undefined;
274
305
  registrationProof: Uint8Array<ArrayBufferLike>;
275
306
  subaccountId?: bigint | undefined;
276
307
  publicKeyEd25519: Uint8Array<ArrayBufferLike>;
277
- policyId: bigint;
308
+ policyId?: bigint | undefined;
309
+ preset?: AssistantKeyPreset.READ_ONLY | AssistantKeyPreset.TRADE_WITH_APPROVAL | undefined;
278
310
  }[], 64, "At most 64 assistant keys are allowed.">, v.CheckAction<{
279
311
  registrationDeadline: import("@bufbuild/protobuf/wkt").Timestamp | undefined;
280
312
  registrationProof: Uint8Array<ArrayBufferLike>;
281
313
  subaccountId?: bigint | undefined;
282
314
  publicKeyEd25519: Uint8Array<ArrayBufferLike>;
283
- policyId: bigint;
315
+ policyId?: bigint | undefined;
316
+ preset?: AssistantKeyPreset.READ_ONLY | AssistantKeyPreset.TRADE_WITH_APPROVAL | undefined;
284
317
  }[], "At most one assistant key per account is allowed.">, v.CheckAction<{
285
318
  registrationDeadline: import("@bufbuild/protobuf/wkt").Timestamp | undefined;
286
319
  registrationProof: Uint8Array<ArrayBufferLike>;
287
320
  subaccountId?: bigint | undefined;
288
321
  publicKeyEd25519: Uint8Array<ArrayBufferLike>;
289
- policyId: bigint;
322
+ policyId?: bigint | undefined;
323
+ preset?: AssistantKeyPreset.READ_ONLY | AssistantKeyPreset.TRADE_WITH_APPROVAL | undefined;
290
324
  }[], "Assistant public keys must be distinct.">]>;
291
325
  }, undefined>;
292
326
  type SetAssistantKeysInput = v.InferInput<typeof SetAssistantKeysInputSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"api-keys.schemas.d.ts","names":[],"sources":["../../../src/services/api-keys/api-keys.schemas.ts"],"mappings":";;cA4BM,oBAAkB,EAAA;KAGZ,eAAe,EAAE,mBAAmB;cAEnC,wBAAsB,EAAA,yBAAA,EAAA;;;;;;;;;;;KASvB,mBAAmB,EAAE,kBAAkB;cAEtC,qBAAmB,EAAA;;;KAIpB,gBAAgB,EAAE,kBAAkB;cAEnC,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAezB,qBAAqB,EAAE,kBAAkB;cAgCxC,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCzB,qBAAqB,EAAE,kBAAkB;cAExC,cAAY,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuCb,SAAS,EAAE,mBAAmB;;;;;cAUpC,6BAA2B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyBrB,wBAAwB,EAAE,kBAAkB;cAE3C,6BAA2B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgB5B,wBAAwB,EAAE,kBAAkB"}
1
+ {"version":3,"file":"api-keys.schemas.d.ts","names":[],"sources":["../../../src/services/api-keys/api-keys.schemas.ts"],"mappings":";;;cA8BM,oBAAkB,EAAA;KAGZ,eAAe,EAAE,mBAAmB;cAEnC,wBAAsB,EAAA,yBAAA,EAAA;;;;;;;;;;;KASvB,mBAAmB,EAAE,kBAAkB;cAEtC,qBAAmB,EAAA;;;KAIpB,gBAAgB,EAAE,kBAAkB;cAEnC,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAezB,qBAAqB,EAAE,kBAAkB;cAgCxC,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCzB,qBAAqB,EAAE,kBAAkB;cAExC,cAAY,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuCb,SAAS,EAAE,mBAAmB;;;;;cAUpC,6BAA2B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwCrB,wBAAwB,EAAE,kBAAkB;cAE3C,6BAA2B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgB5B,wBAAwB,EAAE,kBAAkB"}
@@ -4,7 +4,7 @@ import { enumLabelSchema } from "../../shared/proto-enum-codec.js";
4
4
  import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
5
5
  import { buildProtoPatch, defineProtoPatchFields } from "../../utils/proto-patch.js";
6
6
  import { msToTimestamp } from "../../utils/timestamp.js";
7
- import { API_KEY_STATUS_VALUES, API_KEY_UPDATE_STATUS_VALUES, ApiKeyPurposeCodec, ApiKeyStatusCodec } from "./api-keys.codecs.js";
7
+ import { API_KEY_STATUS_VALUES, API_KEY_UPDATE_STATUS_VALUES, ASSISTANT_KEY_PRESET_VALUES, ApiKeyPurposeCodec, ApiKeyStatusCodec, AssistantKeyPresetCodec } from "./api-keys.codecs.js";
8
8
  import * as v from "valibot";
9
9
  import { bytesToHex } from "@noble/hashes/utils.js";
10
10
  //#region src/services/api-keys/api-keys.schemas.ts
@@ -105,7 +105,7 @@ const ApiKeysSchema = v.array(ApiKeySchema);
105
105
  const BytesSchema = v.instance(Uint8Array);
106
106
  /**
107
107
  * One account's key in the assistant key set. Spread a key from `assistant.prepareKeys` and add
108
- * its `policyId`; other fields (like `publicKeyHex`) are ignored.
108
+ * exactly one of `policyId` and `preset`; other fields (like `publicKeyHex`) are ignored.
109
109
  */
110
110
  const AssistantKeySpecInputSchema = v.pipe(v.object({
111
111
  /** Subaccount the key acts for; omit for the main account. */
@@ -113,12 +113,18 @@ const AssistantKeySpecInputSchema = v.pipe(v.object({
113
113
  /** 32-byte Ed25519 public key from `assistant.prepareKeys`. */
114
114
  publicKeyEd25519: v.pipe(BytesSchema, v.length(32, "publicKeyEd25519 must be 32 bytes")),
115
115
  /** API policy that bounds the key. It must not allow moving value out of the account. */
116
- policyId: idInputSchema("policyId"),
116
+ policyId: v.optional(idInputSchema("policyId")),
117
+ /**
118
+ * Permission preset that bounds the key instead of `policyId`. The key is bound to the
119
+ * account's policy named after the preset, created in the same change when missing; the
120
+ * returned key's `policyId` names it. Devnet only.
121
+ */
122
+ preset: v.optional(v.pipe(v.picklist(ASSISTANT_KEY_PRESET_VALUES), v.transform((preset) => AssistantKeyPresetCodec.inputToProto[preset]))),
117
123
  /** Epoch ms from `assistant.prepareKeys`; needed for a new key, not for one already registered. */
118
124
  registrationDeadline: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER))),
119
125
  /** 64-byte proof from `assistant.prepareKeys`; needed for a new key, not for one already registered. */
120
126
  registrationProof: v.optional(v.pipe(BytesSchema, v.length(64, "registrationProof must be 64 bytes")))
121
- }), v.transform(({ registrationDeadline, registrationProof, ...key }) => ({
127
+ }), v.check(({ policyId, preset }) => policyId === void 0 !== (preset === void 0), "Set exactly one of policyId and preset."), v.transform(({ registrationDeadline, registrationProof, ...key }) => ({
122
128
  ...key,
123
129
  registrationDeadline: registrationDeadline === void 0 ? void 0 : msToTimestamp(registrationDeadline),
124
130
  registrationProof: registrationProof ?? /* @__PURE__ */ new Uint8Array()
@@ -1 +1 @@
1
- {"version":3,"file":"api-keys.schemas.js","names":[],"sources":["../../../src/services/api-keys/api-keys.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { msToTimestamp } from \"../../utils/timestamp.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../utils/time.js\";\nimport {\n OptionalPublicIdSchema,\n PublicIdOrEmptySchema,\n OptionalTimestampMsSchema,\n BigIntStringSchema,\n TimestampMsSchema,\n TimestampSchema,\n positiveBigintStringInputSchema,\n idInputSchema,\n optionalSubaccountIdInputSchema,\n} from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport {\n API_KEY_STATUS_VALUES,\n API_KEY_UPDATE_STATUS_VALUES,\n ApiKeyPurposeCodec,\n ApiKeyStatusCodec,\n} from \"./api-keys.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst ApiKeyStatusSchema = v.picklist(API_KEY_STATUS_VALUES);\nconst ApiKeyUpdateStatusSchema = v.picklist(API_KEY_UPDATE_STATUS_VALUES);\n\nexport type ApiKeyStatus = v.InferOutput<typeof ApiKeyStatusSchema>;\n\nexport const ApiKeysListInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n }),\n v.transform(({ account }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ApiKeysListInput = v.InferInput<typeof ApiKeysListInputSchema>;\n\nexport const ApiKeyIdInputSchema = v.strictObject({\n keyId: v.pipe(v.string(), v.trim(), v.minLength(1, \"keyId is required\")),\n});\n\nexport type ApiKeyIdInput = v.InferInput<typeof ApiKeyIdInputSchema>;\n\nexport const ApiKeysCreateInputSchema = v.pipe(\n v.strictObject({\n label: v.string(),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n ...AccountScopeInputEntries,\n ipWhitelist: v.optional(v.array(v.string()), []),\n publicKeyEd25519: v.instance(Uint8Array<ArrayBufferLike>),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ApiKeysCreateInput = v.InferInput<typeof ApiKeysCreateInputSchema>;\n\ntype ApiKeyPatch = {\n label?: string;\n icon?: string;\n color?: string;\n status?: v.InferOutput<typeof ApiKeyUpdateStatusSchema>;\n ipWhitelist?: string[];\n expiresAtIso?: string | null;\n};\n\nconst API_KEY_PATCH_FIELDS = defineProtoPatchFields<ApiKeyPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n icon: { path: \"icon\", encode: (icon) => ({ icon }) },\n color: { path: \"color\", encode: (color) => ({ color }) },\n status: {\n path: \"status\",\n encode: (status) => ({ status: ApiKeyStatusCodec.inputToProto[status] }),\n },\n ipWhitelist: {\n path: \"ip_whitelist\",\n encode: (ipWhitelist) => ({ ipWhitelist }),\n },\n expiresAtIso: {\n path: \"expires_at\",\n encode: (expiresAtIso) => {\n if (expiresAtIso === null) return {};\n return { expiresAt: msToTimestamp(new Date(expiresAtIso).getTime()) };\n },\n },\n});\n\nexport const ApiKeysUpdateInputSchema = v.pipe(\n v.strictObject({\n keyId: v.pipe(v.string(), v.trim(), v.minLength(1, \"keyId is required\")),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.string()),\n icon: v.optional(v.string()),\n color: v.optional(v.string()),\n status: v.optional(ApiKeyUpdateStatusSchema),\n ipWhitelist: v.optional(v.array(v.string())),\n expiresAtIso: v.optional(\n v.nullable(\n v.pipe(\n v.string(),\n v.check(\n (value) => Number.isFinite(Date.parse(value)),\n \"expiresAtIso must be a valid timestamp\",\n ),\n ),\n ),\n ),\n }),\n v.check(\n ({ label, icon, color, status, ipWhitelist, expiresAtIso }) =>\n label !== undefined ||\n icon !== undefined ||\n color !== undefined ||\n status !== undefined ||\n ipWhitelist !== undefined ||\n expiresAtIso !== undefined,\n \"At least one API key field must be provided\",\n ),\n v.transform(({ keyId, expectedRevision, ...input }) => {\n const { patch: apiKey, updateMask } = buildProtoPatch(input, API_KEY_PATCH_FIELDS);\n return { keyId, apiKey, updateMask, expectedRevision };\n }),\n);\n\nexport type ApiKeysUpdateInput = v.InferInput<typeof ApiKeysUpdateInputSchema>;\n\nexport const ApiKeySchema = v.pipe(\n v.object({\n keyId: v.string(),\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n ipWhitelist: v.optional(v.array(v.string()), []),\n subaccountId: OptionalPublicIdSchema,\n // Unset decodes to \"\", matching DEFAULT_API_KEY_POLICY.id.\n policyId: v.optional(PublicIdOrEmptySchema, 0n),\n createdAt: TimestampMsSchema,\n updatedAt: v.optional(TimestampSchema),\n lastUsedAt: OptionalTimestampMsSchema,\n publicKeyEd25519: v.instance(Uint8Array<ArrayBufferLike>),\n expiresAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => {\n const ms = tsObjToMs(v);\n return ms ? new Date(ms).toISOString() : undefined;\n }),\n ),\n status: enumLabelSchema(ApiKeyStatusCodec.protoToOutput),\n /** `\"standard\"`, `\"assistant\"`, or `\"unspecified\"` from older servers. */\n purpose: v.optional(enumLabelSchema(ApiKeyPurposeCodec.protoToOutput), 0),\n createdByActor: v.string(),\n revision: BigIntStringSchema,\n }),\n v.transform(({ subaccountId, updatedAt, ...rest }) => {\n const hex = bytesToHex(rest.publicKeyEd25519);\n return {\n ...rest,\n subaccountId,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n publicKeyHex: hex,\n };\n }),\n);\n\nexport type ApiKey = v.InferOutput<typeof ApiKeySchema>;\n\nexport const ApiKeysSchema = v.array(ApiKeySchema);\n\nconst BytesSchema = v.instance(Uint8Array<ArrayBufferLike>);\n\n/**\n * One account's key in the assistant key set. Spread a key from `assistant.prepareKeys` and add\n * its `policyId`; other fields (like `publicKeyHex`) are ignored.\n */\nconst AssistantKeySpecInputSchema = v.pipe(\n v.object({\n /** Subaccount the key acts for; omit for the main account. */\n subaccountId: optionalSubaccountIdInputSchema(),\n /** 32-byte Ed25519 public key from `assistant.prepareKeys`. */\n publicKeyEd25519: v.pipe(BytesSchema, v.length(32, \"publicKeyEd25519 must be 32 bytes\")),\n /** API policy that bounds the key. It must not allow moving value out of the account. */\n policyId: idInputSchema(\"policyId\"),\n /** Epoch ms from `assistant.prepareKeys`; needed for a new key, not for one already registered. */\n registrationDeadline: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),\n ),\n /** 64-byte proof from `assistant.prepareKeys`; needed for a new key, not for one already registered. */\n registrationProof: v.optional(\n v.pipe(BytesSchema, v.length(64, \"registrationProof must be 64 bytes\")),\n ),\n }),\n v.transform(({ registrationDeadline, registrationProof, ...key }) => ({\n ...key,\n registrationDeadline:\n registrationDeadline === undefined ? undefined : msToTimestamp(registrationDeadline),\n registrationProof: registrationProof ?? new Uint8Array(),\n })),\n);\n\nexport type AssistantKeySpecInput = v.InferInput<typeof AssistantKeySpecInputSchema>;\n\nexport const SetAssistantKeysInputSchema = v.strictObject({\n /** The complete set: at most one key per account, at most 64. An account left out loses its key. */\n keys: v.pipe(\n v.array(AssistantKeySpecInputSchema),\n v.maxLength(64, \"At most 64 assistant keys are allowed.\"),\n v.check(\n (keys) => new Set(keys.map((k) => k.subaccountId ?? 0n)).size === keys.length,\n \"At most one assistant key per account is allowed.\",\n ),\n v.check(\n (keys) => new Set(keys.map((k) => bytesToHex(k.publicKeyEd25519))).size === keys.length,\n \"Assistant public keys must be distinct.\",\n ),\n ),\n});\n\nexport type SetAssistantKeysInput = v.InferInput<typeof SetAssistantKeysInputSchema>;\n"],"mappings":";;;;;;;;;;AA4B2B,EAAE,SAAS,qBAAqB;AAC3D,MAAM,2BAA2B,EAAE,SAAS,4BAA4B;AAIx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AAW;AAC3D,EAAE,CACN;AAIA,MAAa,8BAA8B,EAAE,aAAa;;AAEtD,MAAM,EAAE,KACJ,EAAE,MAAM,2BAA2B,GACnC,EAAE,UAAU,IAAI,wCAAwC,GACxD,EAAE,OACG,SAAS,IAAI,IAAI,KAAK,KAAK,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,QACvE,mDACJ,GACA,EAAE,OACG,SAAS,IAAI,IAAI,KAAK,KAAK,MAAM,WAAW,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,QACjF,yCACJ,CACJ,EACJ,CAAC"}
1
+ {"version":3,"file":"api-keys.schemas.js","names":[],"sources":["../../../src/services/api-keys/api-keys.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { msToTimestamp } from \"../../utils/timestamp.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../utils/time.js\";\nimport {\n OptionalPublicIdSchema,\n PublicIdOrEmptySchema,\n OptionalTimestampMsSchema,\n BigIntStringSchema,\n TimestampMsSchema,\n TimestampSchema,\n positiveBigintStringInputSchema,\n idInputSchema,\n optionalSubaccountIdInputSchema,\n} from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport {\n API_KEY_STATUS_VALUES,\n API_KEY_UPDATE_STATUS_VALUES,\n ASSISTANT_KEY_PRESET_VALUES,\n ApiKeyPurposeCodec,\n AssistantKeyPresetCodec,\n ApiKeyStatusCodec,\n} from \"./api-keys.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst ApiKeyStatusSchema = v.picklist(API_KEY_STATUS_VALUES);\nconst ApiKeyUpdateStatusSchema = v.picklist(API_KEY_UPDATE_STATUS_VALUES);\n\nexport type ApiKeyStatus = v.InferOutput<typeof ApiKeyStatusSchema>;\n\nexport const ApiKeysListInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n }),\n v.transform(({ account }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ApiKeysListInput = v.InferInput<typeof ApiKeysListInputSchema>;\n\nexport const ApiKeyIdInputSchema = v.strictObject({\n keyId: v.pipe(v.string(), v.trim(), v.minLength(1, \"keyId is required\")),\n});\n\nexport type ApiKeyIdInput = v.InferInput<typeof ApiKeyIdInputSchema>;\n\nexport const ApiKeysCreateInputSchema = v.pipe(\n v.strictObject({\n label: v.string(),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n ...AccountScopeInputEntries,\n ipWhitelist: v.optional(v.array(v.string()), []),\n publicKeyEd25519: v.instance(Uint8Array<ArrayBufferLike>),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ApiKeysCreateInput = v.InferInput<typeof ApiKeysCreateInputSchema>;\n\ntype ApiKeyPatch = {\n label?: string;\n icon?: string;\n color?: string;\n status?: v.InferOutput<typeof ApiKeyUpdateStatusSchema>;\n ipWhitelist?: string[];\n expiresAtIso?: string | null;\n};\n\nconst API_KEY_PATCH_FIELDS = defineProtoPatchFields<ApiKeyPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n icon: { path: \"icon\", encode: (icon) => ({ icon }) },\n color: { path: \"color\", encode: (color) => ({ color }) },\n status: {\n path: \"status\",\n encode: (status) => ({ status: ApiKeyStatusCodec.inputToProto[status] }),\n },\n ipWhitelist: {\n path: \"ip_whitelist\",\n encode: (ipWhitelist) => ({ ipWhitelist }),\n },\n expiresAtIso: {\n path: \"expires_at\",\n encode: (expiresAtIso) => {\n if (expiresAtIso === null) return {};\n return { expiresAt: msToTimestamp(new Date(expiresAtIso).getTime()) };\n },\n },\n});\n\nexport const ApiKeysUpdateInputSchema = v.pipe(\n v.strictObject({\n keyId: v.pipe(v.string(), v.trim(), v.minLength(1, \"keyId is required\")),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.string()),\n icon: v.optional(v.string()),\n color: v.optional(v.string()),\n status: v.optional(ApiKeyUpdateStatusSchema),\n ipWhitelist: v.optional(v.array(v.string())),\n expiresAtIso: v.optional(\n v.nullable(\n v.pipe(\n v.string(),\n v.check(\n (value) => Number.isFinite(Date.parse(value)),\n \"expiresAtIso must be a valid timestamp\",\n ),\n ),\n ),\n ),\n }),\n v.check(\n ({ label, icon, color, status, ipWhitelist, expiresAtIso }) =>\n label !== undefined ||\n icon !== undefined ||\n color !== undefined ||\n status !== undefined ||\n ipWhitelist !== undefined ||\n expiresAtIso !== undefined,\n \"At least one API key field must be provided\",\n ),\n v.transform(({ keyId, expectedRevision, ...input }) => {\n const { patch: apiKey, updateMask } = buildProtoPatch(input, API_KEY_PATCH_FIELDS);\n return { keyId, apiKey, updateMask, expectedRevision };\n }),\n);\n\nexport type ApiKeysUpdateInput = v.InferInput<typeof ApiKeysUpdateInputSchema>;\n\nexport const ApiKeySchema = v.pipe(\n v.object({\n keyId: v.string(),\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n ipWhitelist: v.optional(v.array(v.string()), []),\n subaccountId: OptionalPublicIdSchema,\n // Unset decodes to \"\", matching DEFAULT_API_KEY_POLICY.id.\n policyId: v.optional(PublicIdOrEmptySchema, 0n),\n createdAt: TimestampMsSchema,\n updatedAt: v.optional(TimestampSchema),\n lastUsedAt: OptionalTimestampMsSchema,\n publicKeyEd25519: v.instance(Uint8Array<ArrayBufferLike>),\n expiresAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => {\n const ms = tsObjToMs(v);\n return ms ? new Date(ms).toISOString() : undefined;\n }),\n ),\n status: enumLabelSchema(ApiKeyStatusCodec.protoToOutput),\n /** `\"standard\"`, `\"assistant\"`, or `\"unspecified\"` from older servers. */\n purpose: v.optional(enumLabelSchema(ApiKeyPurposeCodec.protoToOutput), 0),\n createdByActor: v.string(),\n revision: BigIntStringSchema,\n }),\n v.transform(({ subaccountId, updatedAt, ...rest }) => {\n const hex = bytesToHex(rest.publicKeyEd25519);\n return {\n ...rest,\n subaccountId,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n publicKeyHex: hex,\n };\n }),\n);\n\nexport type ApiKey = v.InferOutput<typeof ApiKeySchema>;\n\nexport const ApiKeysSchema = v.array(ApiKeySchema);\n\nconst BytesSchema = v.instance(Uint8Array<ArrayBufferLike>);\n\n/**\n * One account's key in the assistant key set. Spread a key from `assistant.prepareKeys` and add\n * exactly one of `policyId` and `preset`; other fields (like `publicKeyHex`) are ignored.\n */\nconst AssistantKeySpecInputSchema = v.pipe(\n v.object({\n /** Subaccount the key acts for; omit for the main account. */\n subaccountId: optionalSubaccountIdInputSchema(),\n /** 32-byte Ed25519 public key from `assistant.prepareKeys`. */\n publicKeyEd25519: v.pipe(BytesSchema, v.length(32, \"publicKeyEd25519 must be 32 bytes\")),\n /** API policy that bounds the key. It must not allow moving value out of the account. */\n policyId: v.optional(idInputSchema(\"policyId\")),\n /**\n * Permission preset that bounds the key instead of `policyId`. The key is bound to the\n * account's policy named after the preset, created in the same change when missing; the\n * returned key's `policyId` names it. Devnet only.\n */\n preset: v.optional(\n v.pipe(\n v.picklist(ASSISTANT_KEY_PRESET_VALUES),\n v.transform((preset) => AssistantKeyPresetCodec.inputToProto[preset]),\n ),\n ),\n /** Epoch ms from `assistant.prepareKeys`; needed for a new key, not for one already registered. */\n registrationDeadline: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),\n ),\n /** 64-byte proof from `assistant.prepareKeys`; needed for a new key, not for one already registered. */\n registrationProof: v.optional(\n v.pipe(BytesSchema, v.length(64, \"registrationProof must be 64 bytes\")),\n ),\n }),\n v.check(\n ({ policyId, preset }) => (policyId === undefined) !== (preset === undefined),\n \"Set exactly one of policyId and preset.\",\n ),\n v.transform(({ registrationDeadline, registrationProof, ...key }) => ({\n ...key,\n registrationDeadline:\n registrationDeadline === undefined ? undefined : msToTimestamp(registrationDeadline),\n registrationProof: registrationProof ?? new Uint8Array(),\n })),\n);\n\nexport type AssistantKeySpecInput = v.InferInput<typeof AssistantKeySpecInputSchema>;\n\nexport const SetAssistantKeysInputSchema = v.strictObject({\n /** The complete set: at most one key per account, at most 64. An account left out loses its key. */\n keys: v.pipe(\n v.array(AssistantKeySpecInputSchema),\n v.maxLength(64, \"At most 64 assistant keys are allowed.\"),\n v.check(\n (keys) => new Set(keys.map((k) => k.subaccountId ?? 0n)).size === keys.length,\n \"At most one assistant key per account is allowed.\",\n ),\n v.check(\n (keys) => new Set(keys.map((k) => bytesToHex(k.publicKeyEd25519))).size === keys.length,\n \"Assistant public keys must be distinct.\",\n ),\n ),\n});\n\nexport type SetAssistantKeysInput = v.InferInput<typeof SetAssistantKeysInputSchema>;\n"],"mappings":";;;;;;;;;;AA8B2B,EAAE,SAAS,qBAAqB;AAC3D,MAAM,2BAA2B,EAAE,SAAS,4BAA4B;AAIxE,MAAa,yBAAyB,EAAE,KACpC,EAAE,aAAa,EACX,GAAG,yBACP,CAAC,GACD,EAAE,WAAW,EAAE,eAAe,EAC1B,cAAc,2BAA2B,OAAO,EACpD,EAAE,CACN;AAIA,MAAa,sBAAsB,EAAE,aAAa,EAC9C,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,GAAG,mBAAmB,CAAC,EAC3E,CAAC;AAID,MAAa,2BAA2B,EAAE,KACtC,EAAE,aAAa;CACX,OAAO,EAAE,OAAO;CAChB,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC/B,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAChC,GAAG;CACH,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO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I,KAAK,KAAK,MAAM,WAAW,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,QACjF,yCACJ,CACJ,EACJ,CAAC"}
@@ -1,2 +1,3 @@
1
1
  import { ApiKey, ApiKeyIdInput, ApiKeyStatus, ApiKeysCreateInput, ApiKeysListInput, ApiKeysUpdateInput, AssistantKeySpecInput, SetAssistantKeysInput } from "./api-keys.schemas.js";
2
- export type { ApiKey, ApiKeyIdInput, ApiKeyStatus, ApiKeysCreateInput, ApiKeysListInput, ApiKeysUpdateInput, AssistantKeySpecInput, SetAssistantKeysInput };
2
+ import { AssistantKeyPreset } from "./api-keys.codecs.js";
3
+ export type { ApiKey, ApiKeyIdInput, ApiKeyStatus, ApiKeysCreateInput, ApiKeysListInput, ApiKeysUpdateInput, AssistantKeyPreset, AssistantKeySpecInput, SetAssistantKeysInput };