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

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 (160) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/dist/browser-core.js +1 -1
  3. package/dist/gen/ai/v1/assistant_pb.d.ts +1 -1
  4. package/dist/gen/ai/v1/assistant_pb.js +1 -1
  5. package/dist/gen/alerts/v1/price_alerts_pb.d.ts +1 -1
  6. package/dist/gen/auth/v1/address_book_pb.d.ts +1 -1
  7. package/dist/gen/auth/v1/api_keys_pb.d.ts +1 -1
  8. package/dist/gen/auth/v1/auth_pb.d.ts +1 -1
  9. package/dist/gen/auth/v1/mfa_pb.d.ts +1 -1
  10. package/dist/gen/auth/v1/policies_pb.d.ts +1 -1
  11. package/dist/gen/auth/v1/profile_pb.d.ts +1 -1
  12. package/dist/gen/auth/v1/resolve_pb.d.ts +1 -1
  13. package/dist/gen/auth/v1/social_verification_pb.d.ts +1 -1
  14. package/dist/gen/auth/v1/subaccounts_pb.d.ts +1 -1
  15. package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
  16. package/dist/gen/chain/analytics/v1/analytics_read_pb.d.ts +1 -1
  17. package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +1 -1
  18. package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts +1 -1
  19. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +1 -1
  20. package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +1 -1
  21. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +1 -1
  22. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +1 -1
  23. package/dist/gen/chain/zipper/v1/reason_pb.d.ts +1 -1
  24. package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +1 -1
  25. package/dist/gen/changelog/v1/changelog_pb.d.ts +1 -1
  26. package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts +1 -1
  27. package/dist/gen/claims/v1/claims_pb.d.ts +1 -1
  28. package/dist/gen/fees/v1/fees_pb.d.ts +1 -1
  29. package/dist/gen/index.js +20 -20
  30. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +1 -1
  31. package/dist/gen/marketdata/v1/heatmap_pb.d.ts +1 -1
  32. package/dist/gen/marketdata/v1/marketdata_pb.d.ts +1 -1
  33. package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +1 -1
  34. package/dist/gen/notifications/v1/notifications_pb.d.ts +1 -1
  35. package/dist/gen/orderbook/v1/orderbook_pb.d.ts +1 -1
  36. package/dist/gen/orders/v1/orders_pb.d.ts +1 -1
  37. package/dist/gen/orders/v1/orders_read_pb.d.ts +1 -1
  38. package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts +1 -1
  39. package/dist/gen/polyester/type/v1/u128_pb.d.ts +1 -1
  40. package/dist/gen/privatews/v1/private_ws_pb.d.ts +1 -1
  41. package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +1 -1
  42. package/dist/gen/rewards/v1/rewards_pb.d.ts +1 -1
  43. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +1 -1
  44. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +1 -1
  45. package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +1 -1
  46. package/dist/gen/swap/v1/swap_pb.d.ts +1 -1
  47. package/dist/gen/system/v1/system_pb.d.ts +1 -1
  48. package/dist/gen/tradews/v1/trade_ws_pb.d.ts +1 -1
  49. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +1 -1
  50. package/dist/gen/triggers/v1/triggers_pb.d.ts +1 -1
  51. package/dist/gen/vip/v1/vip_pb.d.ts +1 -1
  52. package/dist/index.js +1 -1
  53. package/dist/realtime/snapshot-then-stream.js +1 -1
  54. package/dist/server-core.js +3 -3
  55. package/dist/services/accounts/accounts.js +1 -1
  56. package/dist/services/accounts/accounts.schemas.js +1 -1
  57. package/dist/services/address-book/address-book.js +1 -1
  58. package/dist/services/api-keys/api-keys.js +1 -1
  59. package/dist/services/api-keys/api-keys.schemas.js +1 -1
  60. package/dist/services/assistant/assistant-events.schemas.d.ts +27 -27
  61. package/dist/services/assistant/assistant.codecs.d.ts +1 -1
  62. package/dist/services/assistant/assistant.codecs.js +1 -1
  63. package/dist/services/assistant/assistant.codecs.js.map +1 -1
  64. package/dist/services/assistant/assistant.d.ts +3 -3
  65. package/dist/services/assistant/assistant.js +4 -4
  66. package/dist/services/assistant/assistant.js.map +1 -1
  67. package/dist/services/assistant/assistant.schemas.d.ts +1 -1
  68. package/dist/services/assistant/assistant.schemas.js +1 -1
  69. package/dist/services/auth/account-signer-auth.js +2 -2
  70. package/dist/services/auth/auth.js +1 -1
  71. package/dist/services/auth/profile/profile.js +2 -2
  72. package/dist/services/auto-withdraw/auto-withdraw.js +1 -1
  73. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +19 -19
  74. package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -1
  75. package/dist/services/balances/balances.js +1 -1
  76. package/dist/services/candles/candles.js +2 -2
  77. package/dist/services/chain-analytics/chain-analytics.js +1 -1
  78. package/dist/services/changelog/changelog.js +1 -1
  79. package/dist/services/checkpoints/checkpoints.js +1 -1
  80. package/dist/services/claims/claims.js +1 -1
  81. package/dist/services/claims/claims.schemas.js +1 -1
  82. package/dist/services/deposit/deposit.js +1 -1
  83. package/dist/services/fees/fees.js +1 -1
  84. package/dist/services/guard-signer/guard-signer.js +1 -1
  85. package/dist/services/guard-signer/guard-signer.schemas.js +1 -1
  86. package/dist/services/heatmap/heatmap.js +2 -2
  87. package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
  88. package/dist/services/internal-transfers/internal-transfers.js +1 -1
  89. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +3 -3
  90. package/dist/services/lifecycle/lifecycle.js +3 -3
  91. package/dist/services/lifecycle/lifecycle.schemas.d.ts +2 -2
  92. package/dist/services/lifecycle/lifecycle.schemas.js +2 -2
  93. package/dist/services/market-data/market-data.js +2 -2
  94. package/dist/services/market-overview/market-overview.js +2 -2
  95. package/dist/services/market-overview/market-overview.schemas.js +1 -1
  96. package/dist/services/notifications/notifications.js +1 -1
  97. package/dist/services/notifications/notifications.schemas.d.ts +9 -1
  98. package/dist/services/notifications/notifications.schemas.d.ts.map +1 -1
  99. package/dist/services/orderbook/orderbook.js +1 -1
  100. package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
  101. package/dist/services/orders/order-errors.schemas.js +1 -1
  102. package/dist/services/orders/orders-batch.schemas.d.ts +7 -7
  103. package/dist/services/orders/orders-batch.schemas.js +2 -2
  104. package/dist/services/orders/orders-input.schemas.d.ts +1 -1
  105. package/dist/services/orders/orders-input.schemas.js +2 -2
  106. package/dist/services/orders/orders-modify.schemas.js +2 -2
  107. package/dist/services/orders/orders-output.schemas.d.ts +16 -16
  108. package/dist/services/orders/orders-output.schemas.js +1 -1
  109. package/dist/services/orders/orders-risk.schemas.js +3 -3
  110. package/dist/services/orders/orders.js +2 -2
  111. package/dist/services/policies/api-key-policies/api-key-policies.js +1 -1
  112. package/dist/services/policies/shared.codecs.js +1 -1
  113. package/dist/services/policies/subaccount-policies/subaccount-policies.js +2 -2
  114. package/dist/services/price-alerts/price-alerts.codecs.d.ts +1 -1
  115. package/dist/services/price-alerts/price-alerts.codecs.js +3 -3
  116. package/dist/services/price-alerts/price-alerts.codecs.js.map +1 -1
  117. package/dist/services/price-alerts/price-alerts.d.ts +2 -2
  118. package/dist/services/price-alerts/price-alerts.js +3 -3
  119. package/dist/services/price-alerts/price-alerts.js.map +1 -1
  120. package/dist/services/price-alerts/price-alerts.schemas.d.ts +11 -11
  121. package/dist/services/rate-limits/rate-limits.js +1 -1
  122. package/dist/services/rewards/rewards.js +1 -1
  123. package/dist/services/rewards/rewards.schemas.d.ts +4 -4
  124. package/dist/services/social-verification/social-verification.js +1 -1
  125. package/dist/services/social-verification/social-verification.schemas.js +1 -1
  126. package/dist/services/subaccounts/subaccounts.js +3 -3
  127. package/dist/services/subaccounts/subaccounts.schemas.d.ts +5 -5
  128. package/dist/services/system/system.js +1 -1
  129. package/dist/services/trades/trades.js +2 -2
  130. package/dist/services/trades/trades.schemas.d.ts +1 -1
  131. package/dist/services/trading-withdraws/trading-withdraws.js +1 -1
  132. package/dist/services/trading-withdraws/trading-withdraws.schemas.js +1 -1
  133. package/dist/services/trading-withdraws/wallet-message.js +1 -1
  134. package/dist/services/transfers/transfers.js +2 -2
  135. package/dist/services/triggers/trigger-child-order.schemas.js +3 -3
  136. package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
  137. package/dist/services/triggers/trigger-input.schemas.js +2 -2
  138. package/dist/services/triggers/triggers-output.schemas.d.ts +28 -28
  139. package/dist/services/triggers/triggers.js +2 -2
  140. package/dist/services/vip/vip.js +1 -1
  141. package/dist/services/vip/vip.schemas.d.ts +3 -3
  142. package/dist/services/vip/vip.schemas.js +1 -1
  143. package/dist/services/zipper/zipper.js +1 -1
  144. package/dist/services/zipper/zipper.schemas.js +1 -1
  145. package/dist/shared/error-details/alerts.js +1 -1
  146. package/dist/shared/error-details/assistant.js +1 -1
  147. package/dist/shared/error-details/auth.js +1 -1
  148. package/dist/shared/error-details/claims.js +1 -1
  149. package/dist/shared/error-details/internal-transfer.js +1 -1
  150. package/dist/shared/error-details/ledger.js +1 -1
  151. package/dist/shared/error-details/market-overview.js +1 -1
  152. package/dist/shared/error-details/notifications.js +1 -1
  153. package/dist/shared/error-details/orders.js +1 -1
  154. package/dist/shared/error-details/profile.js +1 -1
  155. package/dist/shared/error-details/rate-limit.js +1 -1
  156. package/dist/shared/error-details/withdraw.js +1 -1
  157. package/dist/shared/rate-limit.schemas.js +1 -1
  158. package/dist/utils/cookies.js +1 -1
  159. package/dist/wired-services.js +17 -17
  160. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"assistant.js","names":["#client","Proto.AssistantService","#scales"],"sources":["../../../src/services/assistant/assistant.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { formatRunEvent, type AssistantRunEvent } from \"./assistant-events.schemas.js\";\nimport { ApprovalStatusCodec, type AssistantApprovalStatus } from \"./assistant.codecs.js\";\nimport {\n AssistantRunIdInputSchema,\n CompleteAssistantKeysInputSchema,\n DecideAssistantApprovalInputSchema,\n DeleteAssistantMemoryInputSchema,\n formatAssistantKey,\n formatConversation,\n formatMemory,\n formatMessage,\n formatPrepareAssistantKeysResult,\n formatTelegramApprovalLimits,\n ListAssistantConversationsInputSchema,\n ListAssistantMemoriesInputSchema,\n ListAssistantMessagesInputSchema,\n PrepareAssistantKeysInputSchema,\n SendAssistantMessageInputSchema,\n SetTelegramApprovalLimitsInputSchema,\n WatchAssistantRunInputSchema,\n type AssistantKey,\n type AssistantRunIdInput,\n type CompleteAssistantKeysInput,\n type DecideAssistantApprovalInput,\n type DeleteAssistantMemoryInput,\n type ListAssistantConversationsInput,\n type ListAssistantConversationsResult,\n type ListAssistantMemoriesInput,\n type ListAssistantMemoriesResult,\n type ListAssistantMessagesInput,\n type ListAssistantMessagesResult,\n type PrepareAssistantKeysInput,\n type PrepareAssistantKeysResult,\n type SendAssistantMessageInput,\n type SetTelegramApprovalLimitsInput,\n type TelegramApprovalLimits,\n type WatchAssistantRunInput,\n} from \"./assistant.schemas.js\";\n\n/**\n * The Polyester trading assistant. `sendMessage` starts a run that answers the message;\n * follow it with `watchRun`. A run continues on the server when nobody watches it. Actions that\n * change the account wait for `decideApproval`. Needs a session login; every conversation, run,\n * approval and memory belongs to the signed-in user. Errors carry\n * `detail: { service: \"assistant\", code }`.\n */\nexport class AssistantService {\n #client: Client<typeof Proto.AssistantService>;\n #scales: SdkScales;\n\n constructor(transports: AuthApiTransports, scales: SdkScales) {\n this.#client = createClient(Proto.AssistantService, transports.authApi);\n this.#scales = scales;\n }\n\n /**\n * Records the message and starts a run that answers it; returns once the run is recorded.\n * Idempotent per `idempotencyKey`: repeat the request unchanged to resolve an unknown\n * outcome. A conversation runs one run at a time (`RUN_ACTIVE`).\n */\n async sendMessage(\n input: SendAssistantMessageInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ runId: string; conversationId: string }> {\n const request = parse(SendAssistantMessageInputSchema, input);\n const response = await this.#client.sendMessage(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n runId: formatId(response.runId),\n conversationId: formatId(response.conversationId),\n };\n }\n\n /**\n * Streams a run's events in `seq` order: the recorded events after `afterSeq`, then new ones\n * as they are recorded. Ends after `run_completed` or `run_failed`; watching an ended run\n * replays it. The server may end the stream early: call again with the last `seq` received\n * as `afterSeq` to continue without gaps or repeats. Abort with `options.signal`.\n */\n async *watchRun(\n input: WatchAssistantRunInput,\n options?: PolyesterRequestOptions,\n ): AsyncGenerator<AssistantRunEvent, void, undefined> {\n const request = parse(WatchAssistantRunInputSchema, input);\n await this.#scales.ready();\n for await (const response of this.#client.watchRun(\n request,\n toConnectCallOptions(options),\n )) {\n if (response.event) yield formatRunEvent(response.event, this.#scales);\n }\n }\n\n /**\n * Asks an active run to stop; it then ends with `run_failed` category `cancelled`.\n * Cancelling an ended run succeeds and changes nothing.\n */\n async cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void> {\n const request = parse(AssistantRunIdInputSchema, input);\n await this.#client.cancelRun(request, toConnectCallOptions(options));\n }\n\n /**\n * Approves or rejects a pending approval from an `approval_requested` event. An approved\n * action runs exactly as its summary says, at most once. Repeating the same decision returns\n * the recorded status.\n */\n async decideApproval(\n input: DecideAssistantApprovalInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantApprovalStatus | \"unspecified\"> {\n const request = parse(DecideAssistantApprovalInputSchema, input);\n const response = await this.#client.decideApproval(request, toConnectCallOptions(options));\n return enumLabel(ApprovalStatusCodec.protoToOutput, response.status);\n }\n\n /** Lists the caller's conversations, most recently updated first. */\n async listConversations(\n input: ListAssistantConversationsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantConversationsResult> {\n const request = parse(ListAssistantConversationsInputSchema, input);\n const response = await this.#client.listConversations(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n conversations: response.conversations.map(formatConversation),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Lists one conversation's messages, newest first. */\n async listMessages(\n input: ListAssistantMessagesInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMessagesResult> {\n const request = parse(ListAssistantMessagesInputSchema, input);\n const response = await this.#client.listMessages(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n messages: response.messages.map(formatMessage),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /**\n * Lists what the assistant remembers about the caller, newest first. A `profile` memory\n * applies to every answer; the others are used when relevant.\n */\n async listMemories(\n input: ListAssistantMemoriesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMemoriesResult> {\n const request = parse(ListAssistantMemoriesInputSchema, input);\n const response = await this.#client.listMemories(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n memories: response.memories.map(formatMemory),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Makes the assistant forget one memory. Deleting a deleted memory succeeds. */\n async deleteMemory(\n input: DeleteAssistantMemoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<void> {\n const request = parse(DeleteAssistantMemoryInputSchema, input);\n await this.#client.deleteMemory(request, toConnectCallOptions(options));\n }\n\n /**\n * Step 1 of giving the assistant keys: the assistant generates one Ed25519 key pair per\n * account and returns the public keys with their registration proofs. Register them with\n * `apiKeys.setAssistantKeys` (with a fresh `stepUpToken`) before `expiresAt`, then call\n * `completeKeys`. The step-up token goes to `setAssistantKeys` only, never to the assistant.\n */\n async prepareKeys(\n input: PrepareAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<PrepareAssistantKeysResult> {\n const request = parse(PrepareAssistantKeysInputSchema, input);\n const response = await this.#client.prepareAssistantKeys(\n { accounts: request.accounts.map((account) => removeUndefined(account)) },\n toConnectCallOptions(options),\n );\n return formatPrepareAssistantKeysResult(response);\n }\n\n /**\n * Finishes a key setup once `apiKeys.setAssistantKeys` registered its keys; returns the keys\n * the assistant now holds. Completing a completed setup returns the keys again.\n */\n async completeKeys(\n input: CompleteAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantKey[]> {\n const request = parse(CompleteAssistantKeysInputSchema, input);\n const response = await this.#client.completeAssistantKeys(\n request,\n toConnectCallOptions(options),\n );\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Lists the keys the assistant holds, at most one per account. An account without one has\n * no account tools. Revoke them with `apiKeys.deleteAssistantKeys`.\n */\n async listKeys(options?: PolyesterRequestOptions): Promise<AssistantKey[]> {\n const response = await this.#client.listAssistantKeys({}, toConnectCallOptions(options));\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Returns the caller's limits on what they may approve from Telegram, in US dollars of\n * notional value, and the value approved from Telegram in the last 24 hours while a limit\n * was set. Limits apply to placing, swapping, modifying and resuming; cancelling, pausing\n * and rejecting are never limited.\n */\n async getTelegramApprovalLimits(\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits & { approvedLast24hUsd: string }> {\n const response = await this.#client.getTelegramApprovalLimits(\n {},\n toConnectCallOptions(options),\n );\n return {\n ...formatTelegramApprovalLimits(response.limits),\n approvedLast24hUsd: response.approvedLast24hUsd,\n };\n }\n\n /**\n * Replaces both Telegram approval limits: a limit left out is turned off. Only a signed-in\n * session sets them; they apply to the next approval from Telegram. Returns the limits as\n * recorded.\n */\n async setTelegramApprovalLimits(\n input: SetTelegramApprovalLimitsInput,\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits> {\n const limits = parse(SetTelegramApprovalLimitsInputSchema, input);\n const response = await this.#client.setTelegramApprovalLimits(\n { limits: removeUndefined(limits) },\n toConnectCallOptions(options),\n );\n return formatTelegramApprovalLimits(response.limits);\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"assistant.js","names":["#client","Proto.AssistantService","#scales"],"sources":["../../../src/services/assistant/assistant.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { formatRunEvent, type AssistantRunEvent } from \"./assistant-events.schemas.js\";\nimport { ApprovalStatusCodec, type AssistantApprovalStatus } from \"./assistant.codecs.js\";\nimport {\n AssistantRunIdInputSchema,\n CompleteAssistantKeysInputSchema,\n DecideAssistantApprovalInputSchema,\n DeleteAssistantMemoryInputSchema,\n formatAssistantKey,\n formatConversation,\n formatMemory,\n formatMessage,\n formatPrepareAssistantKeysResult,\n formatTelegramApprovalLimits,\n ListAssistantConversationsInputSchema,\n ListAssistantMemoriesInputSchema,\n ListAssistantMessagesInputSchema,\n PrepareAssistantKeysInputSchema,\n SendAssistantMessageInputSchema,\n SetTelegramApprovalLimitsInputSchema,\n WatchAssistantRunInputSchema,\n type AssistantKey,\n type AssistantRunIdInput,\n type CompleteAssistantKeysInput,\n type DecideAssistantApprovalInput,\n type DeleteAssistantMemoryInput,\n type ListAssistantConversationsInput,\n type ListAssistantConversationsResult,\n type ListAssistantMemoriesInput,\n type ListAssistantMemoriesResult,\n type ListAssistantMessagesInput,\n type ListAssistantMessagesResult,\n type PrepareAssistantKeysInput,\n type PrepareAssistantKeysResult,\n type SendAssistantMessageInput,\n type SetTelegramApprovalLimitsInput,\n type TelegramApprovalLimits,\n type WatchAssistantRunInput,\n} from \"./assistant.schemas.js\";\n\n/**\n * The Polyester trading assistant. `sendMessage` starts a run that answers the message;\n * follow it with `watchRun`. A run continues on the server when nobody watches it. Actions that\n * change the account wait for `decideApproval`. Needs a session login; every conversation, run,\n * approval and memory belongs to the signed-in user. Errors carry\n * `detail: { service: \"assistant\", code }`.\n */\nexport class AssistantService {\n #client: Client<typeof Proto.AssistantService>;\n #scales: SdkScales;\n\n constructor(transports: AuthApiTransports, scales: SdkScales) {\n this.#client = createClient(Proto.AssistantService, transports.authApi);\n this.#scales = scales;\n }\n\n /**\n * Records the message and starts a run that answers it; returns once the run is recorded.\n * Idempotent per `idempotencyKey`: repeat the request unchanged to resolve an unknown\n * outcome. A conversation runs one run at a time (`RUN_ACTIVE`).\n */\n async sendMessage(\n input: SendAssistantMessageInput,\n options?: PolyesterRequestOptions,\n ): Promise<{ runId: string; conversationId: string }> {\n const request = parse(SendAssistantMessageInputSchema, input);\n const response = await this.#client.sendMessage(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n runId: formatId(response.runId),\n conversationId: formatId(response.conversationId),\n };\n }\n\n /**\n * Streams a run's events in `seq` order: the recorded events after `afterSeq`, then new ones\n * as they are recorded. Ends after `run_completed` or `run_failed`; watching an ended run\n * replays it. The server may end the stream early: call again with the last `seq` received\n * as `afterSeq` to continue without gaps or repeats. Abort with `options.signal`.\n */\n async *watchRun(\n input: WatchAssistantRunInput,\n options?: PolyesterRequestOptions,\n ): AsyncGenerator<AssistantRunEvent, void, undefined> {\n const request = parse(WatchAssistantRunInputSchema, input);\n await this.#scales.ready();\n for await (const response of this.#client.watchRun(\n request,\n toConnectCallOptions(options),\n )) {\n if (response.event) yield formatRunEvent(response.event, this.#scales);\n }\n }\n\n /**\n * Asks an active run to stop; it then ends with `run_failed` category `canceled`.\n * Canceling an ended run succeeds and changes nothing.\n */\n async cancelRun(input: AssistantRunIdInput, options?: PolyesterRequestOptions): Promise<void> {\n const request = parse(AssistantRunIdInputSchema, input);\n await this.#client.cancelRun(request, toConnectCallOptions(options));\n }\n\n /**\n * Approves or rejects a pending approval from an `approval_requested` event. An approved\n * action runs exactly as its summary says, at most once. Repeating the same decision returns\n * the recorded status.\n */\n async decideApproval(\n input: DecideAssistantApprovalInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantApprovalStatus | \"unspecified\"> {\n const request = parse(DecideAssistantApprovalInputSchema, input);\n const response = await this.#client.decideApproval(request, toConnectCallOptions(options));\n return enumLabel(ApprovalStatusCodec.protoToOutput, response.status);\n }\n\n /** Lists the caller's conversations, most recently updated first. */\n async listConversations(\n input: ListAssistantConversationsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantConversationsResult> {\n const request = parse(ListAssistantConversationsInputSchema, input);\n const response = await this.#client.listConversations(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n conversations: response.conversations.map(formatConversation),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Lists one conversation's messages, newest first. */\n async listMessages(\n input: ListAssistantMessagesInput,\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMessagesResult> {\n const request = parse(ListAssistantMessagesInputSchema, input);\n const response = await this.#client.listMessages(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n messages: response.messages.map(formatMessage),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /**\n * Lists what the assistant remembers about the caller, newest first. A `profile` memory\n * applies to every answer; the others are used when relevant.\n */\n async listMemories(\n input: ListAssistantMemoriesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListAssistantMemoriesResult> {\n const request = parse(ListAssistantMemoriesInputSchema, input);\n const response = await this.#client.listMemories(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return {\n memories: response.memories.map(formatMemory),\n nextPageToken: response.nextPageToken,\n };\n }\n\n /** Makes the assistant forget one memory. Deleting a deleted memory succeeds. */\n async deleteMemory(\n input: DeleteAssistantMemoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<void> {\n const request = parse(DeleteAssistantMemoryInputSchema, input);\n await this.#client.deleteMemory(request, toConnectCallOptions(options));\n }\n\n /**\n * Step 1 of giving the assistant keys: the assistant generates one Ed25519 key pair per\n * account and returns the public keys with their registration proofs. Register them with\n * `apiKeys.setAssistantKeys` (with a fresh `stepUpToken`) before `expiresAt`, then call\n * `completeKeys`. The step-up token goes to `setAssistantKeys` only, never to the assistant.\n */\n async prepareKeys(\n input: PrepareAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<PrepareAssistantKeysResult> {\n const request = parse(PrepareAssistantKeysInputSchema, input);\n const response = await this.#client.prepareAssistantKeys(\n { accounts: request.accounts.map((account) => removeUndefined(account)) },\n toConnectCallOptions(options),\n );\n return formatPrepareAssistantKeysResult(response);\n }\n\n /**\n * Finishes a key setup once `apiKeys.setAssistantKeys` registered its keys; returns the keys\n * the assistant now holds. Completing a completed setup returns the keys again.\n */\n async completeKeys(\n input: CompleteAssistantKeysInput,\n options?: PolyesterRequestOptions,\n ): Promise<AssistantKey[]> {\n const request = parse(CompleteAssistantKeysInputSchema, input);\n const response = await this.#client.completeAssistantKeys(\n request,\n toConnectCallOptions(options),\n );\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Lists the keys the assistant holds, at most one per account. An account without one has\n * no account tools. Revoke them with `apiKeys.deleteAssistantKeys`.\n */\n async listKeys(options?: PolyesterRequestOptions): Promise<AssistantKey[]> {\n const response = await this.#client.listAssistantKeys({}, toConnectCallOptions(options));\n return response.keys.map(formatAssistantKey);\n }\n\n /**\n * Returns the caller's limits on what they may approve from Telegram, in US dollars of\n * notional value, and the value approved from Telegram in the last 24 hours while a limit\n * was set. Limits apply to placing, swapping, modifying and resuming; canceling, pausing\n * and rejecting are never limited.\n */\n async getTelegramApprovalLimits(\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits & { approvedLast24hUsd: string }> {\n const response = await this.#client.getTelegramApprovalLimits(\n {},\n toConnectCallOptions(options),\n );\n return {\n ...formatTelegramApprovalLimits(response.limits),\n approvedLast24hUsd: response.approvedLast24hUsd,\n };\n }\n\n /**\n * Replaces both Telegram approval limits: a limit left out is turned off. Only a signed-in\n * session sets them; they apply to the next approval from Telegram. Returns the limits as\n * recorded.\n */\n async setTelegramApprovalLimits(\n input: SetTelegramApprovalLimitsInput,\n options?: PolyesterRequestOptions,\n ): Promise<TelegramApprovalLimits> {\n const limits = parse(SetTelegramApprovalLimitsInputSchema, input);\n const response = await this.#client.setTelegramApprovalLimits(\n { limits: removeUndefined(limits) },\n toConnectCallOptions(options),\n );\n return formatTelegramApprovalLimits(response.limits);\n }\n}\n"],"mappings":"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"}
@@ -126,7 +126,7 @@ declare function formatMemory(m: Memory): {
126
126
  createdAt: number | undefined;
127
127
  /** Omitted when the conversation it was learned in is unknown. */
128
128
  conversationId: string | undefined;
129
- kind: "unspecified" | "fact" | "planning_figure" | "profile";
129
+ kind: "unspecified" | "profile" | "fact" | "planning_figure";
130
130
  };
131
131
  type AssistantMemory = ReturnType<typeof formatMemory>;
132
132
  declare function formatAssistantKey(k: AssistantKey$1): {
@@ -3,8 +3,8 @@ import { tsObjToMs } from "../../utils/time.js";
3
3
  import { idInputSchema, optionalSubaccountIdInputSchema } from "../../shared/schemas.js";
4
4
  import { enumLabel } from "../../shared/proto-enum-codec.js";
5
5
  import { ASSISTANT_APPROVAL_DECISION_VALUES, ApprovalDecisionCodec, AssistantKeyStateCodec, MemoryKindCodec, MessageRoleCodec } from "./assistant.codecs.js";
6
- import { bytesToHex } from "@noble/hashes/utils.js";
7
6
  import * as v from "valibot";
7
+ import { bytesToHex } from "@noble/hashes/utils.js";
8
8
  //#region src/services/assistant/assistant.schemas.ts
9
9
  const IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));
10
10
  function pageInputEntries(maxLimit) {
@@ -1,10 +1,10 @@
1
+ import { AuthSessionStore } from "./session.js";
2
+ import { getJwtTimeToExpiry, isJwtValid } from "../../utils/jwt.js";
1
3
  import { AuthenticationError, ConfigurationError } from "../../shared/errors.js";
2
4
  import { toPolyesterError } from "../../shared/connect-error-mapping.js";
3
5
  import { AuthService } from "./auth.js";
4
- import { AuthSessionStore } from "./session.js";
5
6
  import { assertAccountSigner, resolveAccountSigner } from "../../account-signer/types.js";
6
7
  import { EventEmitter } from "../../utils/event-emitter.js";
7
- import { getJwtTimeToExpiry, isJwtValid } from "../../utils/jwt.js";
8
8
  import { createAuthTokenStorageSetOptions } from "./token-storage.js";
9
9
  //#region src/services/auth/account-signer-auth.ts
10
10
  /**
@@ -5,8 +5,8 @@ import { OptionalTimestampMsSchema, PublicIdSchema, TimestampSchema } from "../.
5
5
  import { ProfileService } from "./profile/profile.js";
6
6
  import { MfaSessionInfoSchema } from "../mfa/mfa.schemas.js";
7
7
  import { WalletAddressSchema, WalletChallengeMessageSchema, WalletChallengeUriSchema } from "./wallet-challenge.schemas.js";
8
- import { createClient } from "@connectrpc/connect";
9
8
  import * as v from "valibot";
9
+ import { createClient } from "@connectrpc/connect";
10
10
  //#region src/services/auth/auth.ts
11
11
  const CreateWalletChallengeInputSchema = v.strictObject({
12
12
  smartAccountAddress: WalletAddressSchema,
@@ -1,10 +1,10 @@
1
- import { parse } from "../../../shared/validation.js";
2
1
  import { AccountIdentitySchema, ProfileService as ProfileService$1 } from "../../../gen/auth/v1/profile_pb.js";
2
+ import { parse } from "../../../shared/validation.js";
3
3
  import { removeUndefined } from "../../../utils/remove-undefined.js";
4
4
  import { toConnectCallOptions } from "../../../shared/request-options.js";
5
5
  import { AccountIdentitySchema as AccountIdentitySchema$1, ClaimGeneratedUsernameInputSchema, GeneratedUsernameOfferSchema, ProfileSchema, UpdateProfileInputSchema, UsernameHistoryEntrySchema } from "./profile.schemas.js";
6
- import { createClient } from "@connectrpc/connect";
7
6
  import * as v from "valibot";
7
+ import { createClient } from "@connectrpc/connect";
8
8
  //#region src/services/auth/profile/profile.ts
9
9
  /**
10
10
  * Manages the authenticated account's public profile and realtime identity updates.
@@ -1,10 +1,10 @@
1
+ import { AutoWithdrawService as AutoWithdrawService$1 } from "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
1
2
  import { PolyesterError, RevisionConflictError } from "../../shared/errors.js";
2
3
  import { toPolyesterError } from "../../shared/connect-error-mapping.js";
3
4
  import { parse } from "../../shared/validation.js";
4
5
  import { removeUndefined } from "../../utils/remove-undefined.js";
5
6
  import { toConnectCallOptions } from "../../shared/request-options.js";
6
7
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
7
- import { AutoWithdrawService as AutoWithdrawService$1 } from "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
8
8
  import { AutoWithdrawPreviewSchema, AutoWithdrawRuleSchema, AutoWithdrawScopedInputSchema, ListAutoWithdrawRunsInputSchema, ListAutoWithdrawRunsResultSchema, SetAutoWithdrawRuleEnabledInputSchema, SetAutoWithdrawRuleInputSchema } from "./auto-withdraw.schemas.js";
9
9
  import { Code, ConnectError, createClient } from "@connectrpc/connect";
10
10
  //#region src/services/auto-withdraw/auto-withdraw.ts
@@ -500,7 +500,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
500
500
  readonly hi: v.BigintSchema<undefined>;
501
501
  readonly lo: v.BigintSchema<undefined>;
502
502
  }, undefined>, undefined>;
503
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted">]>;
503
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted">]>;
504
504
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
505
505
  readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
506
506
  readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
@@ -524,7 +524,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
524
524
  hi: bigint;
525
525
  lo: bigint;
526
526
  } | undefined;
527
- state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
527
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
528
528
  reason: AutoWithdrawStepReason | null;
529
529
  intentId: string;
530
530
  txHash: string;
@@ -538,7 +538,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
538
538
  txHash: string | null;
539
539
  assetId: number;
540
540
  destinationAddress: string;
541
- state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
541
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
542
542
  reason: AutoWithdrawStepReason | null;
543
543
  }>]>;
544
544
  /**
@@ -559,7 +559,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
559
559
  seconds: bigint;
560
560
  nanos: number;
561
561
  }, number>]>;
562
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped">]>;
562
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped">]>;
563
563
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawRunReason | null>]>;
564
564
  readonly steps: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
565
565
  readonly assetId: v.NumberSchema<undefined>;
@@ -581,7 +581,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
581
581
  readonly hi: v.BigintSchema<undefined>;
582
582
  readonly lo: v.BigintSchema<undefined>;
583
583
  }, undefined>, undefined>;
584
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted">]>;
584
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted">]>;
585
585
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
586
586
  readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
587
587
  readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
@@ -605,7 +605,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
605
605
  hi: bigint;
606
606
  lo: bigint;
607
607
  } | undefined;
608
- state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
608
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
609
609
  reason: AutoWithdrawStepReason | null;
610
610
  intentId: string;
611
611
  txHash: string;
@@ -619,7 +619,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
619
619
  txHash: string | null;
620
620
  assetId: number;
621
621
  destinationAddress: string;
622
- state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
622
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
623
623
  reason: AutoWithdrawStepReason | null;
624
624
  }>]>, undefined>;
625
625
  readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -640,7 +640,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
640
640
  runSeq: string;
641
641
  ruleVersion: number;
642
642
  scheduledFor: number;
643
- state: "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped";
643
+ state: "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped";
644
644
  reason: AutoWithdrawRunReason | null;
645
645
  steps: {
646
646
  destinationChainId: number;
@@ -652,7 +652,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
652
652
  txHash: string | null;
653
653
  assetId: number;
654
654
  destinationAddress: string;
655
- state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
655
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
656
656
  reason: AutoWithdrawStepReason | null;
657
657
  }[];
658
658
  createdAt: number;
@@ -662,7 +662,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
662
662
  runSeq: string;
663
663
  ruleVersion: number;
664
664
  scheduledFor: number;
665
- state: "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped";
665
+ state: "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped";
666
666
  reason: AutoWithdrawRunReason | null;
667
667
  steps: {
668
668
  destinationChainId: number;
@@ -674,7 +674,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
674
674
  txHash: string | null;
675
675
  assetId: number;
676
676
  destinationAddress: string;
677
- state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
677
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
678
678
  reason: AutoWithdrawStepReason | null;
679
679
  }[];
680
680
  createdAt: number;
@@ -692,7 +692,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
692
692
  seconds: bigint;
693
693
  nanos: number;
694
694
  }, number>]>;
695
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped">]>;
695
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped">]>;
696
696
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawRunReason | null>]>;
697
697
  readonly steps: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
698
698
  readonly assetId: v.NumberSchema<undefined>;
@@ -714,7 +714,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
714
714
  readonly hi: v.BigintSchema<undefined>;
715
715
  readonly lo: v.BigintSchema<undefined>;
716
716
  }, undefined>, undefined>;
717
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted">]>;
717
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted">]>;
718
718
  readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
719
719
  readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
720
720
  readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
@@ -738,7 +738,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
738
738
  hi: bigint;
739
739
  lo: bigint;
740
740
  } | undefined;
741
- state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
741
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
742
742
  reason: AutoWithdrawStepReason | null;
743
743
  intentId: string;
744
744
  txHash: string;
@@ -752,7 +752,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
752
752
  txHash: string | null;
753
753
  assetId: number;
754
754
  destinationAddress: string;
755
- state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
755
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
756
756
  reason: AutoWithdrawStepReason | null;
757
757
  }>]>, undefined>;
758
758
  readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
@@ -773,7 +773,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
773
773
  runSeq: string;
774
774
  ruleVersion: number;
775
775
  scheduledFor: number;
776
- state: "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped";
776
+ state: "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped";
777
777
  reason: AutoWithdrawRunReason | null;
778
778
  steps: {
779
779
  destinationChainId: number;
@@ -785,7 +785,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
785
785
  txHash: string | null;
786
786
  assetId: number;
787
787
  destinationAddress: string;
788
- state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
788
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
789
789
  reason: AutoWithdrawStepReason | null;
790
790
  }[];
791
791
  createdAt: number;
@@ -795,7 +795,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
795
795
  runSeq: string;
796
796
  ruleVersion: number;
797
797
  scheduledFor: number;
798
- state: "unspecified" | "failed" | "planned" | "paying" | "completed" | "partially_failed" | "skipped";
798
+ state: "unspecified" | "planned" | "paying" | "completed" | "partially_failed" | "failed" | "skipped";
799
799
  reason: AutoWithdrawRunReason | null;
800
800
  steps: {
801
801
  destinationChainId: number;
@@ -807,7 +807,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
807
807
  txHash: string | null;
808
808
  assetId: number;
809
809
  destinationAddress: string;
810
- state: "unspecified" | "failed" | "completed" | "skipped" | "pending" | "submitting" | "submitted";
810
+ state: "unspecified" | "completed" | "failed" | "skipped" | "pending" | "submitting" | "submitted";
811
811
  reason: AutoWithdrawStepReason | null;
812
812
  }[];
813
813
  createdAt: number;
@@ -1,3 +1,4 @@
1
+ import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
1
2
  import { ValidationError } from "../../shared/errors.js";
2
3
  import { PROTOBUF_UINT32_MAX } from "../../shared/wire-bounds.js";
3
4
  import { BigIntStringSchema, OptionalTimestampMsSchema, PublicIdOrEmptySchema, TimestampMsSchema, U128Schema } from "../../shared/schemas.js";
@@ -6,7 +7,6 @@ import { decimalInputToScaled, scaledToDecimalOutput } from "../../shared/decima
6
7
  import { PositiveUint32InputSchema } from "../shared.js";
7
8
  import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
8
9
  import { fromU128, toU128 } from "../../utils/u128.js";
9
- import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
10
10
  import { AUTO_WITHDRAW_WEEKDAY_VALUES, AutoWithdrawCadenceCodec, AutoWithdrawPreviewStatusCodec, AutoWithdrawRunStateCodec, AutoWithdrawStepStateCodec, AutoWithdrawWeekdayCodec } from "./auto-withdraw.codecs.js";
11
11
  import * as v from "valibot";
12
12
  //#region src/services/auto-withdraw/auto-withdraw.schemas.ts
@@ -1,6 +1,6 @@
1
+ import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { toConnectCallOptions } from "../../shared/request-options.js";
3
- import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
4
4
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
5
5
  import { accountScopeToSubaccountId } from "../../shared/account-scope.js";
6
6
  import { BalanceHistoryInputSchema, BalancesListInputSchema, EquityHistoryInputSchema, PortfolioEquityHistoryInputSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance } from "./balances.schemas.js";
@@ -1,12 +1,12 @@
1
+ import { CandlePointSchema, MarketDataService } from "../../gen/marketdata/v1/marketdata_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { toConnectCallOptions } from "../../shared/request-options.js";
3
4
  import { SymbolIdInputSchema } from "../shared.js";
4
- import { CandlePointSchema, MarketDataService } from "../../gen/marketdata/v1/marketdata_pb.js";
5
5
  import { TimeframeCodec } from "./candles.codecs.js";
6
6
  import { ListCandlesInputSchema, TimeframeSchema, createCandleColumnarIntSchema, createCandleColumnarSchema, formatCandleRow } from "./candles.schemas.js";
7
7
  import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
8
- import { createClient } from "@connectrpc/connect";
9
8
  import * as v from "valibot";
9
+ import { createClient } from "@connectrpc/connect";
10
10
  //#region src/services/candles/candles.ts
11
11
  const SubscribeCandlesParamsSchema = v.object({
12
12
  symbolId: SymbolIdInputSchema,
@@ -1,6 +1,6 @@
1
+ import { ChainAnalyticsService as ChainAnalyticsService$1 } from "../../gen/chain/analytics/v1/analytics_read_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { toConnectCallOptions } from "../../shared/request-options.js";
3
- import { ChainAnalyticsService as ChainAnalyticsService$1 } from "../../gen/chain/analytics/v1/analytics_read_pb.js";
4
4
  import { GetUnifiedAssetBalancesInputSchema, GetZippedAssetSupplyGroupInputSchema, GetZippedAssetSupplyInputSchema, createUnifiedAssetBalancesResponseSchema, createZippedAssetSupplyGroupResponseSchema, createZippedAssetSupplyResponseSchema } from "./chain-analytics.schemas.js";
5
5
  import { createClient } from "@connectrpc/connect";
6
6
  //#region src/services/chain-analytics/chain-analytics.ts
@@ -1,6 +1,6 @@
1
+ import { ChangelogService as ChangelogService$1 } from "../../gen/changelog/v1/changelog_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { toConnectCallOptions } from "../../shared/request-options.js";
3
- import { ChangelogService as ChangelogService$1 } from "../../gen/changelog/v1/changelog_pb.js";
4
4
  import { GetChangelogPostInputSchema, GetChangelogPostResultSchema, ListChangelogChangesInputSchema, ListChangelogChangesResultSchema, ListChangelogPostsInputSchema, ListChangelogPostsResultSchema } from "./changelog.schemas.js";
5
5
  import { createClient } from "@connectrpc/connect";
6
6
  //#region src/services/changelog/changelog.ts
@@ -1,6 +1,6 @@
1
+ import { CheckpointService } from "../../gen/checkpoints/v1/checkpoints_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { toConnectCallOptions } from "../../shared/request-options.js";
3
- import { CheckpointService } from "../../gen/checkpoints/v1/checkpoints_pb.js";
4
4
  import { ListCheckpointsInputSchema, ListCheckpointsResultSchema } from "./checkpoints.schemas.js";
5
5
  import { createClient } from "@connectrpc/connect";
6
6
  //#region src/services/checkpoints/checkpoints.ts
@@ -1,6 +1,6 @@
1
+ import { ClaimsService as ClaimsService$1 } from "../../gen/claims/v1/claims_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { toConnectCallOptions } from "../../shared/request-options.js";
3
- import { ClaimsService as ClaimsService$1 } from "../../gen/claims/v1/claims_pb.js";
4
4
  import { ClaimDailyRewardInputSchema, ClaimDailyRewardResultSchema, DailyClaimStatusSchema } from "./claims.schemas.js";
5
5
  import { createClient } from "@connectrpc/connect";
6
6
  //#region src/services/claims/claims.ts
@@ -1,8 +1,8 @@
1
+ import { ErrorCode } from "../../gen/claims/v1/claims_pb.js";
1
2
  import { OptionalPublicIdSchema, OptionalTimestampMsSchema, U128Schema, optionalSubaccountIdInputSchema } from "../../shared/schemas.js";
2
3
  import { enumLabelSchema } from "../../shared/proto-enum-codec.js";
3
4
  import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
4
5
  import { fromU128 } from "../../utils/u128.js";
5
- import { ErrorCode } from "../../gen/claims/v1/claims_pb.js";
6
6
  import { ClaimPolicyCodec, DailyClaimStateCodec } from "./claims.codecs.js";
7
7
  import * as v from "valibot";
8
8
  //#region src/services/claims/claims.schemas.ts
@@ -1,8 +1,8 @@
1
+ import { DepositAddressService } from "../../gen/chain/deposit/v1/deposit_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { removeUndefined } from "../../utils/remove-undefined.js";
3
4
  import { toConnectCallOptions } from "../../shared/request-options.js";
4
5
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
5
- import { DepositAddressService } from "../../gen/chain/deposit/v1/deposit_pb.js";
6
6
  import { CreateDepositAddressInputSchema, DepositAddressSchema, DepositAddressesSchema, ListDepositAddressesInputSchema } from "./deposit.schemas.js";
7
7
  import { createClient } from "@connectrpc/connect";
8
8
  //#region src/services/deposit/deposit.ts
@@ -1,8 +1,8 @@
1
+ import { FeeService } from "../../gen/fees/v1/fees_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { removeUndefined } from "../../utils/remove-undefined.js";
3
4
  import { toConnectCallOptions } from "../../shared/request-options.js";
4
5
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
5
- import { FeeService } from "../../gen/fees/v1/fees_pb.js";
6
6
  import { GetSpotFeeRatesInputSchema, SpotFeeRatesSchema } from "./fees.schemas.js";
7
7
  import { createClient } from "@connectrpc/connect";
8
8
  //#region src/services/fees/fees.ts
@@ -1,8 +1,8 @@
1
+ import { GuardSignerService as GuardSignerService$1 } from "../../gen/chain/guard/v1/guard_signer_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { removeUndefined } from "../../utils/remove-undefined.js";
3
4
  import { toConnectCallOptions } from "../../shared/request-options.js";
4
5
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
5
- import { GuardSignerService as GuardSignerService$1 } from "../../gen/chain/guard/v1/guard_signer_pb.js";
6
6
  import { BatchGuardApprovalsSchema, BatchSignProtectedActionInputSchema, CreateGuardSignerWalletResultSchema, ExportGuardSignerWalletResultSchema, GuardApprovalSchema, GuardSignerScopedInputSchema, GuardSignerStatusSchema, RotateGuardSignerWalletResultSchema, SignProtectedActionInputSchema } from "./guard-signer.schemas.js";
7
7
  import { formatConnectError, isResourceNotFoundError } from "../../utils/errors.js";
8
8
  import { createClient } from "@connectrpc/connect";
@@ -1,8 +1,8 @@
1
1
  import { PositiveUint32InputSchema } from "../shared.js";
2
2
  import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
3
3
  import { PROTECTED_ACTION_VALUES, ProtectedActionCodec } from "./guard-signer.codecs.js";
4
- import { bytesToHex } from "@noble/hashes/utils.js";
5
4
  import * as v from "valibot";
5
+ import { bytesToHex } from "@noble/hashes/utils.js";
6
6
  //#region src/services/guard-signer/guard-signer.schemas.ts
7
7
  const HexAddressSchema = v.pipe(v.string(), v.trim(), v.regex(/^0x[0-9a-fA-F]{40}$/));
8
8
  const WhitelistAddressSchema = v.pipe(v.string(), v.trim(), v.minLength(1));
@@ -1,13 +1,13 @@
1
+ import { HeatmapLiveBucketSchema, HeatmapService as HeatmapService$1, HeatmapTimeRangeSchema } from "../../gen/marketdata/v1/heatmap_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { toConnectCallOptions } from "../../shared/request-options.js";
3
4
  import { SymbolIdInputSchema } from "../shared.js";
4
5
  import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
5
- import { HeatmapLiveBucketSchema, HeatmapService as HeatmapService$1, HeatmapTimeRangeSchema } from "../../gen/marketdata/v1/heatmap_pb.js";
6
6
  import { HEATMAP_INTERVAL_VALUES } from "./heatmap.codecs.js";
7
7
  import { GetOrderbookHeatmapInputSchema, createOrderbookHeatmapLiveBucketSchema, createOrderbookHeatmapResponseSchema } from "./heatmap.schemas.js";
8
+ import * as v from "valibot";
8
9
  import { create } from "@bufbuild/protobuf";
9
10
  import { createClient } from "@connectrpc/connect";
10
- import * as v from "valibot";
11
11
  //#region src/services/heatmap/heatmap.ts
12
12
  const SubscribeHeatmapLiveParamsSchema = v.object({
13
13
  symbolId: SymbolIdInputSchema,
@@ -14,7 +14,7 @@ type TimestampInit = {
14
14
  declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
15
15
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
16
16
  readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"1s" | "1m" | "5m" | "1h", HeatmapInterval>]>;
17
- readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<1 | 5 | 10 | 20 | 100 | 200 | 500 | 1000 | 50, HeatmapDepth>]>;
17
+ readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<1 | 10 | 5 | 20 | 100 | 200 | 500 | 1000 | 50, HeatmapDepth>]>;
18
18
  readonly quantityMode: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["close", "peak"], undefined>, "close">, v.TransformAction<"close" | "peak", HeatmapQuantityMode>]>;
19
19
  readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 20000, undefined>]>;
20
20
  readonly startTsSec: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>, v.TransformAction<number, bigint>]>, undefined>;
@@ -227,7 +227,7 @@ type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;
227
227
  declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
228
228
  readonly symbolId: v.NumberSchema<undefined>;
229
229
  readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "5m" | "1h">>]>;
230
- readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 1 | 5 | 10 | 20 | "unspecified" | 100 | 200 | 500 | 1000 | 50>]>;
230
+ readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 1 | "unspecified" | 10 | 5 | 20 | 100 | 200 | 500 | 1000 | 50>]>;
231
231
  readonly chain: v.OptionalSchema<v.ObjectSchema<{
232
232
  readonly baseKeyframe: v.OptionalSchema<v.ObjectSchema<{
233
233
  readonly tsSec: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
@@ -287,7 +287,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
287
287
  }, undefined>, v.TransformAction<{
288
288
  symbolId: number;
289
289
  interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
290
- depth: 1 | 5 | 10 | 20 | "unspecified" | 100 | 200 | 500 | 1000 | 50;
290
+ depth: 1 | "unspecified" | 10 | 5 | 20 | 100 | 200 | 500 | 1000 | 50;
291
291
  chain?: {
292
292
  baseKeyframe?: {
293
293
  tsSec: number;
@@ -347,7 +347,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
347
347
  }, {
348
348
  symbolId: number;
349
349
  interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
350
- depth: 1 | 5 | 10 | 20 | "unspecified" | 100 | 200 | 500 | 1000 | 50;
350
+ depth: 1 | "unspecified" | 10 | 5 | 20 | 100 | 200 | 500 | 1000 | 50;
351
351
  chain: {
352
352
  baseKeyframe: {
353
353
  tsSec: number;
@@ -1,8 +1,8 @@
1
+ import { InternalTransferService } from "../../gen/transfer/v1/internal_transfer_pb.js";
1
2
  import { parse } from "../../shared/validation.js";
2
3
  import { removeUndefined } from "../../utils/remove-undefined.js";
3
4
  import { toConnectCallOptions } from "../../shared/request-options.js";
4
5
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
5
- import { InternalTransferService } from "../../gen/transfer/v1/internal_transfer_pb.js";
6
6
  import { GetInternalTransferInputSchema, GetInternalTransferResultSchema, createCreateInternalTransferInputSchema, createCreateInternalTransferResultSchema } from "./internal-transfers.schemas.js";
7
7
  import { createClient } from "@connectrpc/connect";
8
8
  //#region src/services/internal-transfers/internal-transfers.ts
@@ -138,7 +138,7 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
138
138
  subaccountId: string | undefined;
139
139
  smartAccountAddress: string | undefined;
140
140
  }>]>, undefined>;
141
- readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "accepted" | "rejected" | "failed">]>;
141
+ readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "accepted" | "rejected">]>;
142
142
  /** Lifecycle flow ID for `lifecycle.getFlow`; empty when the server did not return one. */
143
143
  readonly flowId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
144
144
  }, undefined>, v.TransformAction<{
@@ -157,7 +157,7 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
157
157
  subaccountId: string | undefined;
158
158
  smartAccountAddress: string | undefined;
159
159
  } | undefined;
160
- status: "unspecified" | "accepted" | "rejected" | "failed";
160
+ status: "unspecified" | "failed" | "accepted" | "rejected";
161
161
  flowId: string;
162
162
  }, {
163
163
  acceptedAtUnixMs: number;
@@ -172,7 +172,7 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
172
172
  subaccountId: string | undefined;
173
173
  smartAccountAddress: string | undefined;
174
174
  } | undefined;
175
- status: "unspecified" | "accepted" | "rejected" | "failed";
175
+ status: "unspecified" | "failed" | "accepted" | "rejected";
176
176
  flowId: string;
177
177
  }>]>;
178
178
  type CreateInternalTransferResult = v.InferOutput<ReturnType<typeof createCreateInternalTransferResultSchema>>;
@@ -1,11 +1,11 @@
1
+ import { isDev } from "../../utils/is-dev.js";
2
+ import { FlowDetailViewSchema, FlowSummaryViewSchema, GetFlowByIdRequestSchema, LifecycleReadService } from "../../gen/chain/lifecycle/v1/lifecycle_read_pb.js";
1
3
  import { parse } from "../../shared/validation.js";
2
4
  import { toConnectCallOptions } from "../../shared/request-options.js";
3
- import { FlowDetailViewSchema, FlowSummaryViewSchema, GetFlowByIdRequestSchema, LifecycleReadService } from "../../gen/chain/lifecycle/v1/lifecycle_read_pb.js";
4
- import { isDev } from "../../utils/is-dev.js";
5
5
  import { GetLifecycleFlowInputSchema, GetLifecycleFlowOutputSchema, LifecycleFlowDetailSchema, LifecycleFlowSummarySchema, ListLifecycleFlowsByTxInputSchema, ListLifecycleFlowsByTxOutputSchema, ListLifecycleFlowsInputSchema, ListLifecycleFlowsOutputSchema } from "./lifecycle.schemas.js";
6
+ import * as v from "valibot";
6
7
  import { create } from "@bufbuild/protobuf";
7
8
  import { createClient } from "@connectrpc/connect";
8
- import * as v from "valibot";
9
9
  //#region src/services/lifecycle/lifecycle.ts
10
10
  /**
11
11
  * Reads and streams chain lifecycle flow state, history, progress, and transaction matches.
@@ -7,7 +7,7 @@ declare const LifecycleAssetIdsSchema: v.ObjectSchema<{
7
7
  readonly zippedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
8
8
  readonly unifiedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
9
9
  }, undefined>;
10
- declare const LifecycleFlowStateEnumSchema: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "pending_source" | "pending_polyester_chain" | "pending_ledger" | "dropped" | "refunded">]>;
10
+ declare const LifecycleFlowStateEnumSchema: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "completed" | "failed" | "pending_source" | "pending_polyester_chain" | "pending_ledger" | "dropped" | "refunded">]>;
11
11
  declare const LifecycleZipperReasonSchema: v.ObjectSchema<{
12
12
  readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
13
13
  readonly reasonId: v.StringSchema<undefined>;
@@ -17,7 +17,7 @@ declare const ListLifecycleFlowsInputSchema: v.SchemaWithPipe<readonly [v.Strict
17
17
  readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 500, undefined>]>, 100>;
18
18
  readonly sort: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["newest", "oldest"], undefined>, "newest">, v.TransformAction<"newest" | "oldest", Sort.NEWEST | Sort.OLDEST>]>;
19
19
  readonly flowKind: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["deposit", "withdraw", "transfer"], undefined>, undefined>, v.TransformAction<"deposit" | "withdraw" | "transfer" | undefined, FlowKind>]>;
20
- readonly flowState: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["pending_source", "pending_polyester_chain", "pending_ledger", "completed", "failed", "dropped", "refunded"], undefined>, undefined>, v.TransformAction<"failed" | "completed" | "pending_source" | "pending_polyester_chain" | "pending_ledger" | "dropped" | "refunded" | undefined, FlowState>]>;
20
+ readonly flowState: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["pending_source", "pending_polyester_chain", "pending_ledger", "completed", "failed", "dropped", "refunded"], undefined>, undefined>, v.TransformAction<"completed" | "failed" | "pending_source" | "pending_polyester_chain" | "pending_ledger" | "dropped" | "refunded" | undefined, FlowState>]>;
21
21
  readonly txRef: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "txHash is required.">, v.CheckAction<string, "txHash must be a valid EVM hash or chain-native transaction id.">, v.TransformAction<string, string>]>, undefined>;
22
22
  readonly scope: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["all", "open", "terminal"], undefined>, "all">, v.TransformAction<"open" | "all" | "terminal", ListScope.LIST_ALL | ListScope.LIST_OPEN_ONLY | ListScope.LIST_TERMINAL_ONLY>]>;
23
23
  readonly accountSelector: v.OptionalSchema<v.SchemaWithPipe<readonly [v.VariantSchema<"kind", [v.StrictObjectSchema<{
@@ -1,10 +1,10 @@
1
+ import "../../gen/chain/lifecycle/v1/types_pb.js";
2
+ import "../../gen/chain/lifecycle/v1/lifecycle_read_pb.js";
1
3
  import { idToBigInt } from "../../utils/base58-id.js";
2
4
  import { PublicIdSchema } from "../../shared/schemas.js";
3
5
  import { enumLabelSchema } from "../../shared/proto-enum-codec.js";
4
6
  import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
5
7
  import { fromU128 } from "../../utils/u128.js";
6
- import "../../gen/chain/lifecycle/v1/types_pb.js";
7
- import "../../gen/chain/lifecycle/v1/lifecycle_read_pb.js";
8
8
  import { LIFECYCLE_FLOW_KIND_VALUES, LIFECYCLE_FLOW_PARTICIPATION_VALUES, LIFECYCLE_FLOW_STATE_VALUES, LIFECYCLE_LIST_ORDER_BY_VALUES, LIFECYCLE_LIST_SCOPE_VALUES, LIFECYCLE_SORT_VALUES, LIFECYCLE_TX_LOOKUP_KIND_VALUES, LifecycleFlowDomainCodec, LifecycleFlowKindCodec, LifecycleFlowParticipationCodec, LifecycleFlowStateCodec, LifecycleFlowStepActivityKindCodec, LifecycleFlowStepCodec, LifecycleFlowTimelineStatusCodec, LifecycleListOrderByCodec, LifecycleListScopeCodec, LifecycleRequestFeeStatusCodec, LifecycleSortCodec, LifecycleSourceCodec, LifecycleTxLookupKindCodec, lifecycleReasonFromCode } from "./lifecycle.codecs.js";
9
9
  import * as v from "valibot";
10
10
  //#region src/services/lifecycle/lifecycle.schemas.ts