@polyester/sdk 0.36.0-devnet-20261120015159 → 0.36.0-devnet-20261120040128

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 (203) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/dist/client.d.ts +2 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +2 -0
  5. package/dist/client.js.map +1 -1
  6. package/dist/gen/ai/v1/assistant_pb.d.ts +1 -1
  7. package/dist/gen/ai/v1/assistant_pb.js +1 -1
  8. package/dist/gen/alerts/v1/price_alerts_pb.d.ts +1 -1
  9. package/dist/gen/auth/v1/activity_pb.d.ts +1 -1
  10. package/dist/gen/auth/v1/address_book_pb.d.ts +1 -1
  11. package/dist/gen/auth/v1/address_book_pb.js +1 -1
  12. package/dist/gen/auth/v1/api_keys_pb.d.ts +1 -1
  13. package/dist/gen/auth/v1/auth_pb.d.ts +1 -1
  14. package/dist/gen/auth/v1/auth_pb.js +1 -1
  15. package/dist/gen/auth/v1/connected_apps_pb.d.ts +1 -1
  16. package/dist/gen/auth/v1/mfa_pb.d.ts +1 -1
  17. package/dist/gen/auth/v1/policies_pb.d.ts +1 -1
  18. package/dist/gen/auth/v1/profile_pb.d.ts +1 -1
  19. package/dist/gen/auth/v1/resolve_pb.d.ts +1 -1
  20. package/dist/gen/auth/v1/social_verification_pb.d.ts +1 -1
  21. package/dist/gen/auth/v1/subaccounts_pb.d.ts +1 -1
  22. package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
  23. package/dist/gen/chain/analytics/v1/analytics_read_pb.d.ts +1 -1
  24. package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +1 -1
  25. package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts +1 -1
  26. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +1 -1
  27. package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +1 -1
  28. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +1 -1
  29. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +1 -1
  30. package/dist/gen/chain/zipper/v1/reason_pb.d.ts +1 -1
  31. package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +1 -1
  32. package/dist/gen/changelog/v1/changelog_pb.d.ts +1 -1
  33. package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts +1 -1
  34. package/dist/gen/claims/v1/claims_pb.d.ts +1 -1
  35. package/dist/gen/fees/v1/fees_pb.d.ts +1 -1
  36. package/dist/gen/index.d.ts +1 -1
  37. package/dist/gen/index.js +27 -27
  38. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +1 -1
  39. package/dist/gen/ledger/read/v1/statement_export_pb.d.ts +1 -1
  40. package/dist/gen/marketdata/v1/asset_info_pb.d.ts +1 -1
  41. package/dist/gen/marketdata/v1/heatmap_pb.d.ts +1 -1
  42. package/dist/gen/marketdata/v1/marketdata_pb.d.ts +1 -1
  43. package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +1 -1
  44. package/dist/gen/notifications/v1/notifications_pb.d.ts +1 -1
  45. package/dist/gen/orderbook/v1/orderbook_pb.d.ts +1 -1
  46. package/dist/gen/orders/v1/orders_pb.d.ts +1 -1
  47. package/dist/gen/orders/v1/orders_read_pb.d.ts +1 -1
  48. package/dist/gen/polyester/api/v1/request_error_pb.d.ts +1 -1
  49. package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts +1 -1
  50. package/dist/gen/polyester/type/v1/u128_pb.d.ts +1 -1
  51. package/dist/gen/privatews/v1/private_ws_pb.d.ts +1 -1
  52. package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +1 -1
  53. package/dist/gen/rewards/v1/rewards_pb.d.ts +1 -1
  54. package/dist/gen/strategies/v1/strategies_pb.d.ts +1 -1
  55. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +1 -1
  56. package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts +1 -1
  57. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +1 -1
  58. package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +1 -1
  59. package/dist/gen/swap/v1/swap_pb.d.ts +1 -1
  60. package/dist/gen/system/v1/system_pb.d.ts +1 -1
  61. package/dist/gen/tradews/v1/trade_ws_pb.d.ts +1 -1
  62. package/dist/gen/transfer/v1/dust_conversion_pb.d.ts +1 -1
  63. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +1 -1
  64. package/dist/gen/triggers/v1/triggers_pb.d.ts +1 -1
  65. package/dist/gen/vip/v1/vip_pb.d.ts +1 -1
  66. package/dist/index.d.ts +4 -1
  67. package/dist/services/account-activity/account-activity.js +1 -1
  68. package/dist/services/account-activity/account-activity.schemas.d.ts +6 -6
  69. package/dist/services/accounts/accounts.js +1 -1
  70. package/dist/services/accounts/accounts.schemas.js +1 -1
  71. package/dist/services/address-book/address-book.js +1 -1
  72. package/dist/services/address-book/address-book.schemas.d.ts +2 -2
  73. package/dist/services/api-keys/api-keys.js +1 -1
  74. package/dist/services/api-keys/api-keys.schemas.d.ts +3 -3
  75. package/dist/services/assistant/assistant-events.schemas.d.ts +28 -28
  76. package/dist/services/assistant/assistant.js +1 -1
  77. package/dist/services/assistant/assistant.schemas.d.ts +1 -1
  78. package/dist/services/auth/profile/profile.js +1 -1
  79. package/dist/services/auto-withdraw/auto-withdraw.js +1 -1
  80. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts.map +1 -1
  81. package/dist/services/auto-withdraw/auto-withdraw.schemas.js +5 -12
  82. package/dist/services/auto-withdraw/auto-withdraw.schemas.js.map +1 -1
  83. package/dist/services/balances/balances.js +1 -1
  84. package/dist/services/balances/balances.schemas.d.ts +3 -3
  85. package/dist/services/candles/candles.js +1 -1
  86. package/dist/services/chain-analytics/chain-analytics.js +1 -1
  87. package/dist/services/changelog/changelog.js +1 -1
  88. package/dist/services/changelog/changelog.schemas.d.ts +38 -38
  89. package/dist/services/checkpoints/checkpoints.js +1 -1
  90. package/dist/services/claims/claims.js +1 -1
  91. package/dist/services/claims/claims.schemas.d.ts +2 -2
  92. package/dist/services/claims/claims.schemas.js +1 -1
  93. package/dist/services/connected-apps/connected-apps.js +1 -1
  94. package/dist/services/deposit/deposit.js +1 -1
  95. package/dist/services/dust-conversion/dust-conversion.js +1 -1
  96. package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +8 -8
  97. package/dist/services/dust-conversion/dust-conversion.schemas.js +1 -1
  98. package/dist/services/fees/fees.js +1 -1
  99. package/dist/services/guard-signer/guard-signer.js +1 -1
  100. package/dist/services/heatmap/heatmap.js +1 -1
  101. package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
  102. package/dist/services/internal-transfers/internal-transfers.js +1 -1
  103. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +6 -6
  104. package/dist/services/lifecycle/lifecycle.js +1 -1
  105. package/dist/services/lifecycle/lifecycle.schemas.d.ts +66 -66
  106. package/dist/services/lifecycle/lifecycle.schemas.js +2 -2
  107. package/dist/services/market-data/market-data.js +1 -1
  108. package/dist/services/market-overview/market-overview.js +1 -1
  109. package/dist/services/market-overview/market-overview.schemas.js +1 -1
  110. package/dist/services/notifications/notifications.js +1 -1
  111. package/dist/services/orderbook/orderbook.js +1 -1
  112. package/dist/services/orders/order-errors.schemas.d.ts +9 -9
  113. package/dist/services/orders/order-errors.schemas.js +1 -1
  114. package/dist/services/orders/orders-batch.schemas.d.ts +97 -97
  115. package/dist/services/orders/orders-batch.schemas.js +1 -1
  116. package/dist/services/orders/orders-input.schemas.d.ts +16 -16
  117. package/dist/services/orders/orders-input.schemas.js +1 -1
  118. package/dist/services/orders/orders-modify.schemas.js +1 -1
  119. package/dist/services/orders/orders-output.schemas.d.ts +16 -16
  120. package/dist/services/orders/orders-risk.schemas.js +2 -2
  121. package/dist/services/orders/orders.js +2 -2
  122. package/dist/services/policies/api-key-policies/api-key-policies.js +1 -1
  123. package/dist/services/policies/shared.codecs.js +1 -1
  124. package/dist/services/policies/subaccount-policies/subaccount-policies.js +1 -1
  125. package/dist/services/price-alerts/price-alerts.js +1 -1
  126. package/dist/services/rate-limits/rate-limits.js +1 -1
  127. package/dist/services/rewards/rewards.js +1 -1
  128. package/dist/services/rewards/rewards.schemas.d.ts +4 -4
  129. package/dist/services/social-verification/social-verification.js +1 -1
  130. package/dist/services/social-verification/social-verification.schemas.js +1 -1
  131. package/dist/services/statement-exports/statement-exports.js +1 -1
  132. package/dist/services/statement-exports/statement-exports.schemas.d.ts +6 -6
  133. package/dist/services/strategies/strategies.js +1 -1
  134. package/dist/services/strategies/strategies.schemas.d.ts +1 -1
  135. package/dist/services/subaccounts/subaccounts.js +2 -2
  136. package/dist/services/subaccounts/subaccounts.schemas.d.ts +16 -16
  137. package/dist/services/swap/service.d.ts +8 -0
  138. package/dist/services/swap/service.d.ts.map +1 -0
  139. package/dist/services/swap/service.js +9 -0
  140. package/dist/services/swap/service.js.map +1 -0
  141. package/dist/services/swap/swap.codecs.d.ts +19 -0
  142. package/dist/services/swap/swap.codecs.d.ts.map +1 -0
  143. package/dist/services/swap/swap.codecs.js +39 -0
  144. package/dist/services/swap/swap.codecs.js.map +1 -0
  145. package/dist/services/swap/swap.d.ts +51 -0
  146. package/dist/services/swap/swap.d.ts.map +1 -0
  147. package/dist/services/swap/swap.js +71 -0
  148. package/dist/services/swap/swap.js.map +1 -0
  149. package/dist/services/swap/swap.schemas.d.ts +520 -0
  150. package/dist/services/swap/swap.schemas.d.ts.map +1 -0
  151. package/dist/services/swap/swap.schemas.js +213 -0
  152. package/dist/services/swap/swap.schemas.js.map +1 -0
  153. package/dist/services/swap/swap.types.d.ts +3 -0
  154. package/dist/services/system/system.js +1 -1
  155. package/dist/services/system/system.schemas.d.ts +13 -13
  156. package/dist/services/trades/trades.js +1 -1
  157. package/dist/services/trades/trades.schemas.d.ts +1 -1
  158. package/dist/services/trading-withdraws/trading-withdraws.js +1 -1
  159. package/dist/services/trading-withdraws/trading-withdraws.schemas.js +1 -1
  160. package/dist/services/trading-withdraws/wallet-message.js +1 -1
  161. package/dist/services/transfers/transfers.js +1 -1
  162. package/dist/services/transfers/transfers.schemas.d.ts +1 -1
  163. package/dist/services/triggers/trigger-child-order.schemas.js +2 -2
  164. package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
  165. package/dist/services/triggers/trigger-input.schemas.js +2 -2
  166. package/dist/services/triggers/triggers-output.schemas.d.ts +53 -53
  167. package/dist/services/triggers/triggers.js +1 -1
  168. package/dist/services/vip/vip.js +1 -1
  169. package/dist/services/vip/vip.schemas.d.ts +3 -3
  170. package/dist/services/vip/vip.schemas.js +1 -1
  171. package/dist/services/zipper/zipper.js +1 -1
  172. package/dist/services/zipper/zipper.schemas.js +1 -1
  173. package/dist/shared/connect-error-mapping.d.ts.map +1 -1
  174. package/dist/shared/connect-error-mapping.js +1 -0
  175. package/dist/shared/connect-error-mapping.js.map +1 -1
  176. package/dist/shared/decimal-surface.d.ts.map +1 -1
  177. package/dist/shared/decimal-surface.js +11 -1
  178. package/dist/shared/decimal-surface.js.map +1 -1
  179. package/dist/shared/error-detail.d.ts +16 -4
  180. package/dist/shared/error-detail.d.ts.map +1 -1
  181. package/dist/shared/error-detail.js +1 -0
  182. package/dist/shared/error-detail.js.map +1 -1
  183. package/dist/shared/error-details/alerts.js +1 -1
  184. package/dist/shared/error-details/assistant.js +1 -1
  185. package/dist/shared/error-details/auth.js +1 -1
  186. package/dist/shared/error-details/claims.js +1 -1
  187. package/dist/shared/error-details/internal-transfer.js +1 -1
  188. package/dist/shared/error-details/ledger.js +1 -1
  189. package/dist/shared/error-details/market-overview.js +1 -1
  190. package/dist/shared/error-details/notifications.js +1 -1
  191. package/dist/shared/error-details/orders.js +1 -1
  192. package/dist/shared/error-details/profile.js +1 -1
  193. package/dist/shared/error-details/rate-limit.js +1 -1
  194. package/dist/shared/error-details/strategies.js +1 -1
  195. package/dist/shared/error-details/swap.js +22 -0
  196. package/dist/shared/error-details/swap.js.map +1 -0
  197. package/dist/shared/error-details/withdraw.js +1 -1
  198. package/dist/shared/rate-limit.schemas.d.ts +1 -1
  199. package/dist/shared/rate-limit.schemas.js +1 -1
  200. package/dist/wired-services.d.ts.map +1 -1
  201. package/dist/wired-services.js +23 -21
  202. package/dist/wired-services.js.map +1 -1
  203. package/package.json +1 -1
@@ -0,0 +1,213 @@
1
+ import { removeUndefined } from "../../utils/remove-undefined.js";
2
+ import { formatId } from "../../utils/base58-id.js";
3
+ import { OptionalPublicIdSchema, OptionalTimestampMsSchema, PublicIdSchema, U128Schema, idInputSchema } from "../../shared/schemas.js";
4
+ import { enumLabel, enumLabelSchema } from "../../shared/proto-enum-codec.js";
5
+ import { fromU128, toU128 } from "../../utils/u128.js";
6
+ import { decimalInputToE18, scaledToDecimalOutput } from "../../shared/decimal-surface.js";
7
+ import { msToTimestamp } from "../../utils/timestamp.js";
8
+ import { PositiveUint32InputSchema } from "../shared.js";
9
+ import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
10
+ import { SwapOrderStatusCodec, SwapReasonCodec, SwapSideCodec, SwapStatusCodec } from "./swap.codecs.js";
11
+ import * as v from "valibot";
12
+ //#region src/services/swap/swap.schemas.ts
13
+ const IdempotencyKeySchema = v.pipe(v.string(), v.minLength(1));
14
+ /** Positive decimal string → wire U128 in 18-decimal units. */
15
+ function e18AmountInputSchema(field) {
16
+ return v.pipe(v.string(), v.transform((value) => decimalInputToE18(field, value)), v.check((scaled) => scaled > 0n, `${field} must be greater than 0`), v.transform(toU128));
17
+ }
18
+ const SwapTermsInputEntries = {
19
+ /** Defaults to the active subaccount, else the root account (or an API key's bound subaccount). */
20
+ ...AccountScopeInputEntries,
21
+ /** Unified asset ID spent, as in balances and internal transfers. */
22
+ sourceAssetId: PositiveUint32InputSchema,
23
+ /** Unified asset ID received. */
24
+ destinationAssetId: PositiveUint32InputSchema,
25
+ /**
26
+ * Source amount to spend, as a decimal string (up to 18 decimal places). Only whole order
27
+ * steps of the market trade; the rest stays on the account.
28
+ */
29
+ amount: e18AmountInputSchema("amount")
30
+ };
31
+ function toTerms({ account, sourceAssetId, destinationAssetId, amount }) {
32
+ return removeUndefined({
33
+ subaccountId: accountScopeToSubaccountId(account),
34
+ sourceAssetId,
35
+ destinationAssetId,
36
+ amount: {
37
+ case: "amountE18",
38
+ value: amount
39
+ }
40
+ });
41
+ }
42
+ const QuoteSwapInputSchema = v.pipe(v.strictObject({
43
+ ...SwapTermsInputEntries,
44
+ /** Accepted shortfall from the expected output, in basis points (1 to 1000). */
45
+ maxSlippageBps: PositiveUint32InputSchema
46
+ }), v.transform(({ maxSlippageBps, ...terms }) => ({
47
+ terms: toTerms(terms),
48
+ maxSlippageBps
49
+ })));
50
+ const CreateSwapInputSchema = v.pipe(v.strictObject({
51
+ ...SwapTermsInputEntries,
52
+ /**
53
+ * Minimum destination amount after fees for the whole amount, as a decimal string;
54
+ * usually the quote's `minAmountOut`.
55
+ */
56
+ minAmountOut: e18AmountInputSchema("minAmountOut"),
57
+ /** The accepted quote's `expiresAt` (epoch ms). Refused with `QUOTE_EXPIRED` after it. */
58
+ quoteExpiresAt: v.pipe(v.number(), v.safeInteger(), v.gtValue(0)),
59
+ /**
60
+ * Caller-chosen key, unique per caller. The same key and request return the same swap;
61
+ * the same key with a different request is `IDEMPOTENCY_CONFLICT`.
62
+ */
63
+ idempotencyKey: IdempotencyKeySchema
64
+ }), v.transform(({ minAmountOut, quoteExpiresAt, idempotencyKey, ...terms }) => ({
65
+ idempotencyKey,
66
+ terms: toTerms(terms),
67
+ minAmountOutE18: minAmountOut,
68
+ quoteExpiresAt: msToTimestamp(quoteExpiresAt)
69
+ })));
70
+ const GetSwapInputSchema = v.pipe(v.union([v.strictObject({ swapId: idInputSchema("swapId") }), v.strictObject({ idempotencyKey: IdempotencyKeySchema })]), v.transform((input) => ({ selector: "swapId" in input ? {
71
+ case: "swapId",
72
+ value: input.swapId
73
+ } : {
74
+ case: "idempotencyKey",
75
+ value: input.idempotencyKey
76
+ } })));
77
+ /** Wire `*_e18` U128 → exact decimal string; an unset amount is `"0"`. */
78
+ function e18ToDecimal(value) {
79
+ return scaledToDecimalOutput(fromU128(value), 18);
80
+ }
81
+ const AmountE18Schema = v.optional(U128Schema);
82
+ /** Root account is `null`. */
83
+ const SubaccountIdOutputSchema = v.pipe(OptionalPublicIdSchema, v.transform((id) => id ?? null));
84
+ const SwapQuoteLegSchema = v.pipe(v.object({
85
+ symbolId: v.number(),
86
+ side: enumLabelSchema(SwapSideCodec.protoToOutput),
87
+ averagePrice: v.string(),
88
+ priceImpactBps: v.number(),
89
+ takerFeeRatePercent: v.string(),
90
+ feeE18: AmountE18Schema,
91
+ feeAssetId: v.number()
92
+ }), v.transform(({ feeE18, ...leg }) => ({
93
+ symbolId: leg.symbolId,
94
+ side: leg.side,
95
+ /** Estimated average fill price, quote per base, for display. */
96
+ averagePrice: leg.averagePrice,
97
+ /** Distance of `averagePrice` from the best price, in bps, rounded up. */
98
+ priceImpactBps: leg.priceImpactBps,
99
+ /** The account's spot taker fee rate in percent, e.g. `"0.1"`. */
100
+ takerFeeRatePercent: leg.takerFeeRatePercent,
101
+ /** Estimated fee, in `feeAssetId` (the asset the leg receives). */
102
+ fee: e18ToDecimal(feeE18),
103
+ feeAssetId: leg.feeAssetId
104
+ })));
105
+ const SwapTermsOutputSchema = v.object({
106
+ subaccountId: v.bigint(),
107
+ sourceAssetId: v.number(),
108
+ destinationAssetId: v.number(),
109
+ amount: v.object({
110
+ case: v.literal("amountE18"),
111
+ value: U128Schema
112
+ })
113
+ });
114
+ const SwapQuoteSchema = v.pipe(v.object({
115
+ terms: SwapTermsOutputSchema,
116
+ legs: v.array(SwapQuoteLegSchema),
117
+ expectedAmountOutE18: AmountE18Schema,
118
+ minAmountOutE18: AmountE18Schema,
119
+ quotedAt: OptionalTimestampMsSchema,
120
+ expiresAt: OptionalTimestampMsSchema
121
+ }), v.transform((quote) => ({
122
+ /** Subaccount the quote is for; `null` for the root account. */
123
+ subaccountId: quote.terms.subaccountId === 0n ? null : formatId(quote.terms.subaccountId),
124
+ sourceAssetId: quote.terms.sourceAssetId,
125
+ destinationAssetId: quote.terms.destinationAssetId,
126
+ /** Source amount quoted. */
127
+ amount: e18ToDecimal(quote.terms.amount.value),
128
+ /** Markets the swap trades on, in order; a direct swap has one. */
129
+ legs: quote.legs,
130
+ /** Estimated destination amount after fees at current depth. */
131
+ expectedAmountOut: e18ToDecimal(quote.expectedAmountOutE18),
132
+ /** Destination amount after fees at the requested slippage; pass to `create`. */
133
+ minAmountOut: e18ToDecimal(quote.minAmountOutE18),
134
+ quotedAt: quote.quotedAt ?? null,
135
+ /** 30 seconds after `quotedAt`; pass to `create` as `quoteExpiresAt`. */
136
+ expiresAt: quote.expiresAt ?? null
137
+ })));
138
+ const SwapOrderSchema = v.pipe(v.object({
139
+ orderId: v.bigint(),
140
+ symbolId: v.number(),
141
+ side: enumLabelSchema(SwapSideCodec.protoToOutput),
142
+ leg: v.number(),
143
+ status: enumLabelSchema(SwapOrderStatusCodec.protoToOutput),
144
+ limitPriceTicks: v.bigint(),
145
+ spentE18: AmountE18Schema,
146
+ receivedE18: AmountE18Schema,
147
+ feeE18: AmountE18Schema
148
+ }), v.transform((order) => ({
149
+ /** Spot order ID once the market accepted it; `null` before. */
150
+ orderId: order.orderId === 0n ? null : formatId(order.orderId),
151
+ symbolId: order.symbolId,
152
+ side: order.side,
153
+ /** Zero-based position of the order's market in the route. */
154
+ leg: order.leg,
155
+ status: order.status,
156
+ /** IOC limit price, quote per base: the worst price that nets the minimum rate. */
157
+ limitPrice: scaledToDecimalOutput(order.limitPriceTicks, 9),
158
+ /** Spent in settled fills, fees in the spent asset included. */
159
+ spent: e18ToDecimal(order.spentE18),
160
+ /** Received in settled fills, after fees. */
161
+ received: e18ToDecimal(order.receivedE18),
162
+ /** Fee on settled fills, in the asset the order receives. */
163
+ fee: e18ToDecimal(order.feeE18)
164
+ })));
165
+ const SwapSchema = v.pipe(v.object({
166
+ swapId: PublicIdSchema,
167
+ idempotencyKey: v.string(),
168
+ subaccountId: SubaccountIdOutputSchema,
169
+ sourceAssetId: v.number(),
170
+ destinationAssetId: v.number(),
171
+ amountE18: AmountE18Schema,
172
+ minAmountOutE18: AmountE18Schema,
173
+ status: enumLabelSchema(SwapStatusCodec.protoToOutput),
174
+ reason: v.number(),
175
+ isTerminal: v.boolean(),
176
+ executedAmountE18: AmountE18Schema,
177
+ unspentAmountE18: AmountE18Schema,
178
+ receivedAmountE18: AmountE18Schema,
179
+ feeE18: AmountE18Schema,
180
+ orders: v.array(SwapOrderSchema),
181
+ createdAt: OptionalTimestampMsSchema
182
+ }), v.transform((swap) => ({
183
+ swapId: swap.swapId,
184
+ idempotencyKey: swap.idempotencyKey,
185
+ /** Subaccount funding the swap; `null` for the root account. */
186
+ subaccountId: swap.subaccountId,
187
+ sourceAssetId: swap.sourceAssetId,
188
+ destinationAssetId: swap.destinationAssetId,
189
+ /** Source amount requested. */
190
+ amount: e18ToDecimal(swap.amountE18),
191
+ /** Minimum destination amount after fees for the whole amount. */
192
+ minAmountOut: e18ToDecimal(swap.minAmountOutE18),
193
+ status: swap.status,
194
+ /** Why a `partially_completed` or `failed` swap did not trade everything; null otherwise. */
195
+ reason: swap.reason === 0 ? null : enumLabel(SwapReasonCodec.protoToOutput, swap.reason),
196
+ /** True once `status` is `completed`, `partially_completed` or `failed`; stop polling. */
197
+ isTerminal: swap.isTerminal,
198
+ /** Source spent in settled fills. */
199
+ executedAmount: e18ToDecimal(swap.executedAmountE18),
200
+ /** Source not spent; it never left the account. Final once `isTerminal`. */
201
+ unspentAmount: e18ToDecimal(swap.unspentAmountE18),
202
+ /** Destination received after fees. */
203
+ receivedAmount: e18ToDecimal(swap.receivedAmountE18),
204
+ /** Total fee, in the destination asset. */
205
+ fee: e18ToDecimal(swap.feeE18),
206
+ /** Spot orders, in placement order. */
207
+ orders: swap.orders,
208
+ createdAt: swap.createdAt ?? null
209
+ })));
210
+ //#endregion
211
+ export { CreateSwapInputSchema, GetSwapInputSchema, QuoteSwapInputSchema, SwapOrderSchema, SwapQuoteLegSchema, SwapQuoteSchema, SwapSchema };
212
+
213
+ //# sourceMappingURL=swap.schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swap.schemas.js","names":[],"sources":["../../../src/services/swap/swap.schemas.ts"],"sourcesContent":["import type { MessageInitShape } from \"@bufbuild/protobuf\";\nimport * as v from \"valibot\";\nimport type * as Proto from \"../../gen/swap/v1/swap_pb.js\";\nimport { PRICE_SCALE } from \"../../catalogs/readers.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n type AccountScope,\n} from \"../../shared/account-scope.js\";\nimport {\n E18_SCALE,\n decimalInputToE18,\n scaledToDecimalOutput,\n} from \"../../shared/decimal-surface.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n idInputSchema,\n OptionalPublicIdSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n U128Schema,\n} from \"../../shared/schemas.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { msToTimestamp } from \"../../utils/timestamp.js\";\nimport { fromU128, toU128, type U128Value } from \"../../utils/u128.js\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport {\n SwapOrderStatusCodec,\n SwapReasonCodec,\n SwapSideCodec,\n SwapStatusCodec,\n} from \"./swap.codecs.js\";\n\n// Sent exactly as given: trimming would make \" k \" and \"k\" the same idempotency key.\nconst IdempotencyKeySchema = v.pipe(v.string(), v.minLength(1));\n\n/** Positive decimal string → wire U128 in 18-decimal units. */\nfunction e18AmountInputSchema(field: string) {\n return v.pipe(\n v.string(),\n v.transform((value) => decimalInputToE18(field, value)),\n v.check((scaled) => scaled > 0n, `${field} must be greater than 0`),\n v.transform(toU128),\n );\n}\n\nconst SwapTermsInputEntries = {\n /** Defaults to the active subaccount, else the root account (or an API key's bound subaccount). */\n ...AccountScopeInputEntries,\n /** Unified asset ID spent, as in balances and internal transfers. */\n sourceAssetId: PositiveUint32InputSchema,\n /** Unified asset ID received. */\n destinationAssetId: PositiveUint32InputSchema,\n /**\n * Source amount to spend, as a decimal string (up to 18 decimal places). Only whole order\n * steps of the market trade; the rest stays on the account.\n */\n amount: e18AmountInputSchema(\"amount\"),\n};\n\ntype SwapTermsInput = {\n account?: AccountScope;\n sourceAssetId: number;\n destinationAssetId: number;\n amount: U128Value;\n};\n\nfunction toTerms({ account, sourceAssetId, destinationAssetId, amount }: SwapTermsInput) {\n return removeUndefined({\n subaccountId: accountScopeToSubaccountId(account),\n sourceAssetId,\n destinationAssetId,\n amount: { case: \"amountE18\" as const, value: amount },\n }) satisfies MessageInitShape<typeof Proto.SwapTermsSchema>;\n}\n\nexport const QuoteSwapInputSchema = v.pipe(\n v.strictObject({\n ...SwapTermsInputEntries,\n /** Accepted shortfall from the expected output, in basis points (1 to 1000). */\n maxSlippageBps: PositiveUint32InputSchema,\n }),\n v.transform(\n ({ maxSlippageBps, ...terms }) =>\n ({\n terms: toTerms(terms),\n maxSlippageBps,\n }) satisfies MessageInitShape<typeof Proto.QuoteSwapRequestSchema>,\n ),\n);\n\nexport type QuoteSwapInput = v.InferInput<typeof QuoteSwapInputSchema>;\n\nexport const CreateSwapInputSchema = v.pipe(\n v.strictObject({\n ...SwapTermsInputEntries,\n /**\n * Minimum destination amount after fees for the whole amount, as a decimal string;\n * usually the quote's `minAmountOut`.\n */\n minAmountOut: e18AmountInputSchema(\"minAmountOut\"),\n /** The accepted quote's `expiresAt` (epoch ms). Refused with `QUOTE_EXPIRED` after it. */\n quoteExpiresAt: v.pipe(v.number(), v.safeInteger(), v.gtValue(0)),\n /**\n * Caller-chosen key, unique per caller. The same key and request return the same swap;\n * the same key with a different request is `IDEMPOTENCY_CONFLICT`.\n */\n idempotencyKey: IdempotencyKeySchema,\n }),\n v.transform(\n ({ minAmountOut, quoteExpiresAt, idempotencyKey, ...terms }) =>\n ({\n idempotencyKey,\n terms: toTerms(terms),\n minAmountOutE18: minAmountOut,\n quoteExpiresAt: msToTimestamp(quoteExpiresAt),\n }) satisfies MessageInitShape<typeof Proto.CreateSwapRequestSchema>,\n ),\n);\n\nexport type CreateSwapInput = v.InferInput<typeof CreateSwapInputSchema>;\n\nexport const GetSwapInputSchema = v.pipe(\n v.union([\n v.strictObject({ swapId: idInputSchema(\"swapId\") }),\n v.strictObject({ idempotencyKey: IdempotencyKeySchema }),\n ]),\n v.transform(\n (input) =>\n ({\n selector:\n \"swapId\" in input\n ? { case: \"swapId\", value: input.swapId }\n : { case: \"idempotencyKey\", value: input.idempotencyKey },\n }) satisfies MessageInitShape<typeof Proto.GetSwapRequestSchema>,\n ),\n);\n\n/** Select a swap by `swapId`, or by the `idempotencyKey` it was created with. */\nexport type GetSwapInput = v.InferInput<typeof GetSwapInputSchema>;\n\n/** Wire `*_e18` U128 → exact decimal string; an unset amount is `\"0\"`. */\nfunction e18ToDecimal(value: U128Value | undefined): string {\n return scaledToDecimalOutput(fromU128(value), E18_SCALE);\n}\n\nconst AmountE18Schema = v.optional(U128Schema);\n\n/** Root account is `null`. */\nconst SubaccountIdOutputSchema = v.pipe(\n OptionalPublicIdSchema,\n v.transform((id) => id ?? null),\n);\n\nexport const SwapQuoteLegSchema = v.pipe(\n v.object({\n symbolId: v.number(),\n side: enumLabelSchema(SwapSideCodec.protoToOutput),\n averagePrice: v.string(),\n priceImpactBps: v.number(),\n takerFeeRatePercent: v.string(),\n feeE18: AmountE18Schema,\n feeAssetId: v.number(),\n }),\n v.transform(({ feeE18, ...leg }) => ({\n symbolId: leg.symbolId,\n side: leg.side,\n /** Estimated average fill price, quote per base, for display. */\n averagePrice: leg.averagePrice,\n /** Distance of `averagePrice` from the best price, in bps, rounded up. */\n priceImpactBps: leg.priceImpactBps,\n /** The account's spot taker fee rate in percent, e.g. `\"0.1\"`. */\n takerFeeRatePercent: leg.takerFeeRatePercent,\n /** Estimated fee, in `feeAssetId` (the asset the leg receives). */\n fee: e18ToDecimal(feeE18),\n feeAssetId: leg.feeAssetId,\n })),\n);\n\nexport type SwapQuoteLeg = v.InferOutput<typeof SwapQuoteLegSchema>;\n\nconst SwapTermsOutputSchema = v.object({\n subaccountId: v.bigint(),\n sourceAssetId: v.number(),\n destinationAssetId: v.number(),\n amount: v.object({ case: v.literal(\"amountE18\"), value: U128Schema }),\n});\n\nexport const SwapQuoteSchema = v.pipe(\n v.object({\n terms: SwapTermsOutputSchema,\n legs: v.array(SwapQuoteLegSchema),\n expectedAmountOutE18: AmountE18Schema,\n minAmountOutE18: AmountE18Schema,\n quotedAt: OptionalTimestampMsSchema,\n expiresAt: OptionalTimestampMsSchema,\n }),\n v.transform((quote) => ({\n /** Subaccount the quote is for; `null` for the root account. */\n subaccountId: quote.terms.subaccountId === 0n ? null : formatId(quote.terms.subaccountId),\n sourceAssetId: quote.terms.sourceAssetId,\n destinationAssetId: quote.terms.destinationAssetId,\n /** Source amount quoted. */\n amount: e18ToDecimal(quote.terms.amount.value),\n /** Markets the swap trades on, in order; a direct swap has one. */\n legs: quote.legs,\n /** Estimated destination amount after fees at current depth. */\n expectedAmountOut: e18ToDecimal(quote.expectedAmountOutE18),\n /** Destination amount after fees at the requested slippage; pass to `create`. */\n minAmountOut: e18ToDecimal(quote.minAmountOutE18),\n quotedAt: quote.quotedAt ?? null,\n /** 30 seconds after `quotedAt`; pass to `create` as `quoteExpiresAt`. */\n expiresAt: quote.expiresAt ?? null,\n })),\n);\n\n/** An estimate from current order-book depth. Reserves nothing; only `minAmountOut` binds. */\nexport type SwapQuote = v.InferOutput<typeof SwapQuoteSchema>;\n\nexport const SwapOrderSchema = v.pipe(\n v.object({\n orderId: v.bigint(),\n symbolId: v.number(),\n side: enumLabelSchema(SwapSideCodec.protoToOutput),\n leg: v.number(),\n status: enumLabelSchema(SwapOrderStatusCodec.protoToOutput),\n limitPriceTicks: v.bigint(),\n spentE18: AmountE18Schema,\n receivedE18: AmountE18Schema,\n feeE18: AmountE18Schema,\n }),\n v.transform((order) => ({\n /** Spot order ID once the market accepted it; `null` before. */\n orderId: order.orderId === 0n ? null : formatId(order.orderId),\n symbolId: order.symbolId,\n side: order.side,\n /** Zero-based position of the order's market in the route. */\n leg: order.leg,\n status: order.status,\n /** IOC limit price, quote per base: the worst price that nets the minimum rate. */\n limitPrice: scaledToDecimalOutput(order.limitPriceTicks, PRICE_SCALE),\n /** Spent in settled fills, fees in the spent asset included. */\n spent: e18ToDecimal(order.spentE18),\n /** Received in settled fills, after fees. */\n received: e18ToDecimal(order.receivedE18),\n /** Fee on settled fills, in the asset the order receives. */\n fee: e18ToDecimal(order.feeE18),\n })),\n);\n\nexport type SwapOrder = v.InferOutput<typeof SwapOrderSchema>;\n\nexport const SwapSchema = v.pipe(\n v.object({\n swapId: PublicIdSchema,\n idempotencyKey: v.string(),\n subaccountId: SubaccountIdOutputSchema,\n sourceAssetId: v.number(),\n destinationAssetId: v.number(),\n amountE18: AmountE18Schema,\n minAmountOutE18: AmountE18Schema,\n status: enumLabelSchema(SwapStatusCodec.protoToOutput),\n reason: v.number(),\n isTerminal: v.boolean(),\n executedAmountE18: AmountE18Schema,\n unspentAmountE18: AmountE18Schema,\n receivedAmountE18: AmountE18Schema,\n feeE18: AmountE18Schema,\n orders: v.array(SwapOrderSchema),\n createdAt: OptionalTimestampMsSchema,\n }),\n v.transform((swap) => ({\n swapId: swap.swapId,\n idempotencyKey: swap.idempotencyKey,\n /** Subaccount funding the swap; `null` for the root account. */\n subaccountId: swap.subaccountId,\n sourceAssetId: swap.sourceAssetId,\n destinationAssetId: swap.destinationAssetId,\n /** Source amount requested. */\n amount: e18ToDecimal(swap.amountE18),\n /** Minimum destination amount after fees for the whole amount. */\n minAmountOut: e18ToDecimal(swap.minAmountOutE18),\n status: swap.status,\n /** Why a `partially_completed` or `failed` swap did not trade everything; null otherwise. */\n reason: swap.reason === 0 ? null : enumLabel(SwapReasonCodec.protoToOutput, swap.reason),\n /** True once `status` is `completed`, `partially_completed` or `failed`; stop polling. */\n isTerminal: swap.isTerminal,\n /** Source spent in settled fills. */\n executedAmount: e18ToDecimal(swap.executedAmountE18),\n /** Source not spent; it never left the account. Final once `isTerminal`. */\n unspentAmount: e18ToDecimal(swap.unspentAmountE18),\n /** Destination received after fees. */\n receivedAmount: e18ToDecimal(swap.receivedAmountE18),\n /** Total fee, in the destination asset. */\n fee: e18ToDecimal(swap.feeE18),\n /** Spot orders, in placement order. */\n orders: swap.orders,\n createdAt: swap.createdAt ?? null,\n })),\n);\n\n/** One swap and its outcome. Amounts are decimal strings and count settled fills only. */\nexport type Swap = v.InferOutput<typeof SwapSchema>;\n"],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ import { CreateSwapInput, GetSwapInput, QuoteSwapInput, Swap, SwapOrder, SwapQuote, SwapQuoteLeg } from "./swap.schemas.js";
2
+ import { SwapErrorCode, SwapOrderStatus, SwapReason, SwapStatus } from "./swap.codecs.js";
3
+ export type { CreateSwapInput, GetSwapInput, QuoteSwapInput, Swap, SwapErrorCode, SwapOrder, SwapOrderStatus, SwapQuote, SwapQuoteLeg, SwapReason, SwapStatus };
@@ -1,7 +1,7 @@
1
+ import { SystemService as SystemService$1 } from "../../gen/system/v1/system_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
- import { SystemService as SystemService$1 } from "../../gen/system/v1/system_pb.js";
5
5
  import { ListStatusEventsInputSchema, ListStatusEventsResultSchema } from "./system.schemas.js";
6
6
  import { createClient } from "@connectrpc/connect";
7
7
  //#region src/services/system/system.ts
@@ -11,7 +11,7 @@ declare const ListStatusEventsInputSchema: v.SchemaWithPipe<readonly [v.StrictOb
11
11
  /** Previous `nextPageToken`; resend the same `states` and `kinds` with it. */
12
12
  readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
13
13
  }, undefined>, v.TransformAction<{
14
- states?: ("canceled" | "scheduled" | "in_progress" | "completed")[] | undefined;
14
+ states?: ("canceled" | "completed" | "scheduled" | "in_progress")[] | undefined;
15
15
  kinds?: ("maintenance" | "incident")[] | undefined;
16
16
  limit?: number | undefined;
17
17
  pageToken?: string | undefined;
@@ -26,7 +26,7 @@ type ListStatusEventsInput = v.InferInput<typeof ListStatusEventsInputSchema>;
26
26
  declare const StatusEventSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
27
27
  readonly id: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
28
28
  readonly kind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "maintenance" | "incident">]>;
29
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "canceled" | "scheduled" | "in_progress" | "completed">]>;
29
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "canceled" | "completed" | "scheduled" | "in_progress">]>;
30
30
  readonly title: v.StringSchema<undefined>;
31
31
  readonly message: v.StringSchema<undefined>;
32
32
  readonly startTime: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
@@ -43,7 +43,7 @@ declare const StatusEventSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
43
43
  seconds: bigint;
44
44
  nanos: number;
45
45
  } | undefined, number | undefined>]>;
46
- readonly services: v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "api" | "deposits" | "withdrawals" | "transfers" | "trading" | "accounts" | "market_data" | "quickswap" | "app">]>, undefined>;
46
+ readonly services: v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "accounts" | "api" | "market_data" | "quickswap" | "deposits" | "withdrawals" | "transfers" | "app">]>, undefined>;
47
47
  readonly markets: v.ArraySchema<v.StringSchema<undefined>, undefined>;
48
48
  readonly updatedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
49
49
  readonly seconds: v.BigintSchema<undefined>;
@@ -77,12 +77,12 @@ declare const StatusEventSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
77
77
  }, undefined>, v.TransformAction<{
78
78
  id: string;
79
79
  kind: "unspecified" | "maintenance" | "incident";
80
- state: "unspecified" | "canceled" | "scheduled" | "in_progress" | "completed";
80
+ state: "unspecified" | "canceled" | "completed" | "scheduled" | "in_progress";
81
81
  title: string;
82
82
  message: string;
83
83
  startTime?: number | undefined;
84
84
  endTime?: number | undefined;
85
- services: ("unspecified" | "api" | "deposits" | "withdrawals" | "transfers" | "trading" | "accounts" | "market_data" | "quickswap" | "app")[];
85
+ services: ("unspecified" | "trading" | "accounts" | "api" | "market_data" | "quickswap" | "deposits" | "withdrawals" | "transfers" | "app")[];
86
86
  markets: string[];
87
87
  updatedAt?: number | undefined;
88
88
  impact: "unspecified" | "degraded" | "partial_outage" | "major_outage";
@@ -98,13 +98,13 @@ declare const StatusEventSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
98
98
  /** Stable across updates; match events across pages by it. */
99
99
  id: string;
100
100
  kind: "unspecified" | "maintenance" | "incident";
101
- state: "unspecified" | "canceled" | "scheduled" | "in_progress" | "completed";
101
+ state: "unspecified" | "canceled" | "completed" | "scheduled" | "in_progress";
102
102
  title: string;
103
103
  message: string;
104
104
  startTime: number | null;
105
105
  /** Always set for maintenance; null for an incident with no expected end yet. */
106
106
  endTime: number | null;
107
- services: ("unspecified" | "api" | "deposits" | "withdrawals" | "transfers" | "trading" | "accounts" | "market_data" | "quickswap" | "app")[];
107
+ services: ("unspecified" | "trading" | "accounts" | "api" | "market_data" | "quickswap" | "deposits" | "withdrawals" | "transfers" | "app")[];
108
108
  /** Affected market symbols such as `"BTC-USDT"`; empty when not limited to markets. */
109
109
  markets: string[];
110
110
  /** Affected asset codes such as `"SOL"`; empty when not limited to assets. */
@@ -128,7 +128,7 @@ declare const ListStatusEventsResultSchema: v.ObjectSchema<{
128
128
  readonly events: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
129
129
  readonly id: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
130
130
  readonly kind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "maintenance" | "incident">]>;
131
- readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "canceled" | "scheduled" | "in_progress" | "completed">]>;
131
+ readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "canceled" | "completed" | "scheduled" | "in_progress">]>;
132
132
  readonly title: v.StringSchema<undefined>;
133
133
  readonly message: v.StringSchema<undefined>;
134
134
  readonly startTime: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
@@ -145,7 +145,7 @@ declare const ListStatusEventsResultSchema: v.ObjectSchema<{
145
145
  seconds: bigint;
146
146
  nanos: number;
147
147
  } | undefined, number | undefined>]>;
148
- readonly services: v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "api" | "deposits" | "withdrawals" | "transfers" | "trading" | "accounts" | "market_data" | "quickswap" | "app">]>, undefined>;
148
+ readonly services: v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "accounts" | "api" | "market_data" | "quickswap" | "deposits" | "withdrawals" | "transfers" | "app">]>, undefined>;
149
149
  readonly markets: v.ArraySchema<v.StringSchema<undefined>, undefined>;
150
150
  readonly updatedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
151
151
  readonly seconds: v.BigintSchema<undefined>;
@@ -179,12 +179,12 @@ declare const ListStatusEventsResultSchema: v.ObjectSchema<{
179
179
  }, undefined>, v.TransformAction<{
180
180
  id: string;
181
181
  kind: "unspecified" | "maintenance" | "incident";
182
- state: "unspecified" | "canceled" | "scheduled" | "in_progress" | "completed";
182
+ state: "unspecified" | "canceled" | "completed" | "scheduled" | "in_progress";
183
183
  title: string;
184
184
  message: string;
185
185
  startTime?: number | undefined;
186
186
  endTime?: number | undefined;
187
- services: ("unspecified" | "api" | "deposits" | "withdrawals" | "transfers" | "trading" | "accounts" | "market_data" | "quickswap" | "app")[];
187
+ services: ("unspecified" | "trading" | "accounts" | "api" | "market_data" | "quickswap" | "deposits" | "withdrawals" | "transfers" | "app")[];
188
188
  markets: string[];
189
189
  updatedAt?: number | undefined;
190
190
  impact: "unspecified" | "degraded" | "partial_outage" | "major_outage";
@@ -200,13 +200,13 @@ declare const ListStatusEventsResultSchema: v.ObjectSchema<{
200
200
  /** Stable across updates; match events across pages by it. */
201
201
  id: string;
202
202
  kind: "unspecified" | "maintenance" | "incident";
203
- state: "unspecified" | "canceled" | "scheduled" | "in_progress" | "completed";
203
+ state: "unspecified" | "canceled" | "completed" | "scheduled" | "in_progress";
204
204
  title: string;
205
205
  message: string;
206
206
  startTime: number | null;
207
207
  /** Always set for maintenance; null for an incident with no expected end yet. */
208
208
  endTime: number | null;
209
- services: ("unspecified" | "api" | "deposits" | "withdrawals" | "transfers" | "trading" | "accounts" | "market_data" | "quickswap" | "app")[];
209
+ services: ("unspecified" | "trading" | "accounts" | "api" | "market_data" | "quickswap" | "deposits" | "withdrawals" | "transfers" | "app")[];
210
210
  /** Affected market symbols such as `"BTC-USDT"`; empty when not limited to markets. */
211
211
  markets: string[];
212
212
  /** Affected asset codes such as `"SOL"`; empty when not limited to assets. */
@@ -1,10 +1,10 @@
1
+ import { OrdersReadService, UserTradeBatchSchema } from "../../gen/orders/v1/orders_read_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 { deliverBatch } from "../../shared/subscription-errors.js";
5
6
  import { createCatalogRefreshQueue, hasKnownSymbol, withCatalogRefresh } from "../../shared/decimal-surface.js";
6
7
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
7
- import { OrdersReadService, UserTradeBatchSchema } from "../../gen/orders/v1/orders_read_pb.js";
8
8
  import { GetUserTradesInputSchema, formatUserTrade } from "./trades.schemas.js";
9
9
  import { createOrderTransferSchema } from "../orders/orders-output.schemas.js";
10
10
  import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
@@ -169,7 +169,7 @@ declare const GetUserTradesInputSchema: v.SchemaWithPipe<readonly [v.UnionSchema
169
169
  readonly orderId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
170
170
  readonly lineageId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, v.CheckAction<bigint, `${string} must be greater than zero`>]>;
171
171
  readonly throughGeneration: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
172
- }, undefined>], undefined>], ({ input }: v.UnionIssue<v.NumberIssue | v.StringIssue | v.BooleanIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1> | v.PicklistIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 1> | v.UnionIssue<v.StringIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1> | v.PicklistIssue> | v.GtValueIssue<number, 0> | v.MaxValueIssue<number, 4294967295> | v.CheckIssue<bigint> | v.MaxValueIssue<number, 1000> | v.NeverIssue | v.UnionIssue<v.NumberIssue | v.StringIssue | v.BooleanIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1> | v.PicklistIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 1> | v.UnionIssue<v.StringIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1> | v.PicklistIssue> | v.GtValueIssue<number, 0> | v.MaxValueIssue<number, 4294967295> | v.CheckIssue<bigint> | v.MaxValueIssue<number, 1000> | v.NeverIssue>>) => "Provide at most one of orderId or lineageId" | "throughGeneration requires lineageId" | "symbolId is required when afterMatchId is set" | "Invalid trade filters">, v.TransformAction<{
172
+ }, undefined>], undefined>], ({ input }: v.UnionIssue<v.NumberIssue | v.StringIssue | v.BooleanIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1> | v.PicklistIssue | v.UnionIssue<v.StringIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1> | v.PicklistIssue> | v.IntegerIssue<number> | v.GtValueIssue<number, 0> | v.MaxValueIssue<number, 4294967295> | v.MinValueIssue<number, 1> | v.CheckIssue<bigint> | v.MaxValueIssue<number, 1000> | v.NeverIssue | v.UnionIssue<v.NumberIssue | v.StringIssue | v.BooleanIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1> | v.PicklistIssue | v.UnionIssue<v.StringIssue | v.StrictObjectIssue | v.MinLengthIssue<string, 1> | v.PicklistIssue> | v.IntegerIssue<number> | v.GtValueIssue<number, 0> | v.MaxValueIssue<number, 4294967295> | v.MinValueIssue<number, 1> | v.CheckIssue<bigint> | v.MaxValueIssue<number, 1000> | v.NeverIssue>>) => "Provide at most one of orderId or lineageId" | "throughGeneration requires lineageId" | "symbolId is required when afterMatchId is set" | "Invalid trade filters">, v.TransformAction<{
173
173
  symbolId?: number | undefined;
174
174
  afterMatchId?: undefined;
175
175
  side?: Side.BUY | Side.SELL | undefined;
@@ -1,3 +1,4 @@
1
+ import { TradingWithdrawIntentPayloadSchema, WithdrawService } from "../../gen/chain/withdraw/v1/withdraw_pb.js";
1
2
  import { ConfigurationError, ValidationError } from "../../shared/errors.js";
2
3
  import { signApiKeyEd25519Payload } from "../../shared/transports.js";
3
4
  import { checksumEvmAddress, evmHexToBytes } from "../../utils/evm.js";
@@ -7,7 +8,6 @@ import { toConnectCallOptions } from "../../shared/request-options.js";
7
8
  import { idToBigInt } from "../../utils/base58-id.js";
8
9
  import { toU128 } from "../../utils/u128.js";
9
10
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
10
- import { TradingWithdrawIntentPayloadSchema, WithdrawService } from "../../gen/chain/withdraw/v1/withdraw_pb.js";
11
11
  import { CreateTradingToFundingBatchResultSchema, CreateTradingWithdrawResultSchema, CreateWalletTradingWithdrawResultSchema, GetWalletBalancesInputSchema, GetWalletBalancesResultSchema, ValidateWithdrawDestinationInputSchema, ValidateWithdrawDestinationResultSchema, createCreateTradingToFundingBatchInputSchema, createCreateTradingWithdrawToExternalChainInputSchema, createCreateTradingWithdrawToFundingInputSchema, renewTradingWithdrawPayload } from "./trading-withdraws.schemas.js";
12
12
  import { buildTradingToFundingBatchWalletMessage, buildTradingWithdrawWalletMessage } from "./wallet-message.js";
13
13
  import { create, toBinary } from "@bufbuild/protobuf";
@@ -1,3 +1,4 @@
1
+ import "../../gen/chain/withdraw/v1/withdraw_pb.js";
1
2
  import { ConfigurationError } from "../../shared/errors.js";
2
3
  import { U128Schema } from "../../shared/schemas.js";
3
4
  import { enumLabelSchema } from "../../shared/proto-enum-codec.js";
@@ -5,7 +6,6 @@ import { fromU128, toU128 } from "../../utils/u128.js";
5
6
  import { quantityInputToE18, scaledToDecimalOutput } from "../../shared/decimal-surface.js";
6
7
  import { PositiveUint32InputSchema } from "../shared.js";
7
8
  import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
8
- import "../../gen/chain/withdraw/v1/withdraw_pb.js";
9
9
  import { TradingWithdrawActionCodec, WalletAssetUnavailableReasonCodec, WithdrawDestinationValidationCodeCodec } from "./trading-withdraws.codecs.js";
10
10
  import * as v from "valibot";
11
11
  //#region src/services/trading-withdraws/trading-withdraws.schemas.ts
@@ -1,6 +1,6 @@
1
+ import "../../gen/chain/withdraw/v1/withdraw_pb.js";
1
2
  import { ValidationError } from "../../shared/errors.js";
2
3
  import { isEvmAddress } from "../../utils/evm.js";
3
- import "../../gen/chain/withdraw/v1/withdraw_pb.js";
4
4
  //#region src/services/trading-withdraws/wallet-message.ts
5
5
  function messageAddress(value, field) {
6
6
  const address = value.trim();
@@ -1,7 +1,7 @@
1
+ import { LedgerReadService, TransferRowBatchSchema } 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
4
  import { deliverBatch } from "../../shared/subscription-errors.js";
4
- import { LedgerReadService, TransferRowBatchSchema } from "../../gen/ledger/read/v1/ledger_read_pb.js";
5
5
  import { resolveAccountScopedInput } from "../subaccount-resolver.js";
6
6
  import { LedgerTransferSchema, ListTransfersInputSchema } from "./transfers.schemas.js";
7
7
  import { createClient } from "@connectrpc/connect";
@@ -85,7 +85,7 @@ declare const LedgerTransferSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
85
85
  amount: string;
86
86
  balanceAfter: string | undefined;
87
87
  type: "unspecified" | "internal_transfer" | "deposit" | "withdraw" | "maker_fee" | "taker_fee" | "trade_base" | "trade_quote" | "rebate" | "funding_to_trading" | "trading_to_funding" | "trading_withdraw_reserve" | "funding_user_transfer" | "trading_withdraw_request_fee" | "trading_withdraw_fee_leg" | "quickswap_polyester_fee" | "quickswap_broker_fee" | "quickswap_affiliate_fee" | "fee_sweep" | "fee_refill" | "system_adjustment" | "withdraw_failed" | "internal_batch";
88
- accountCode: "unspecified" | "funding" | "trading";
88
+ accountCode: "unspecified" | "trading" | "funding";
89
89
  timestamp: number;
90
90
  isDebit: boolean;
91
91
  linkId: string | undefined;
@@ -1,8 +1,8 @@
1
+ import "../../gen/orders/v1/orders_pb.js";
2
+ import { TriggerLimitFokSchema, TriggerLimitGtcSchema, TriggerLimitIocSchema, TriggerMarketIocSchema, TwapLimitGtcSchema, TwapMarketIocSchema } from "../../gen/triggers/v1/triggers_pb.js";
1
3
  import { positiveDecimalInputToScaled } from "../../shared/decimal-surface.js";
2
4
  import { BpsStringOrNumberInputSchema, NoneInputSchema, SymbolIdInputSchema } from "../shared.js";
3
5
  import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
4
- import "../../gen/orders/v1/orders_pb.js";
5
- import { TriggerLimitFokSchema, TriggerLimitGtcSchema, TriggerLimitIocSchema, TriggerMarketIocSchema, TwapLimitGtcSchema, TwapMarketIocSchema } from "../../gen/triggers/v1/triggers_pb.js";
6
6
  import { FEE_ASSET_VALUES, FeeAssetCodec, ORDER_SIDE_VALUES, OrderSideCodec, SELF_TRADE_PREVENTION_MODE_VALUES, SelfTradePreventionModeCodec } from "../orders/order-enums.codecs.js";
7
7
  import { MAX_SELLING_SLIPPAGE_BPS, MAX_SLIPPAGE_BPS, parseSlippageInput } from "../trailing-oneof-inputs.js";
8
8
  import { create } from "@bufbuild/protobuf";
@@ -1118,7 +1118,7 @@ declare const ListTriggersInputSchema: v.SchemaWithPipe<readonly [v.StrictObject
1118
1118
  /** Both legs of the OCO created with this client list ID. */
1119
1119
  readonly clientListId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 36, undefined>, v.RegexAction<string, "clientListId has an invalid format">]>, undefined>;
1120
1120
  readonly symbolId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
1121
- readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "canceled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("created" | "failed" | "canceled" | "running" | "paused" | "armed" | "completed")[] | undefined, (TriggerStatus.STATUS_CREATED | TriggerStatus.STATUS_ARMED | TriggerStatus.STATUS_RUNNING | TriggerStatus.STATUS_COMPLETED | TriggerStatus.STATUS_CANCELED | TriggerStatus.STATUS_FAILED | TriggerStatus.STATUS_PAUSED)[]>]>;
1121
+ readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "canceled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("failed" | "canceled" | "created" | "completed" | "running" | "paused" | "armed")[] | undefined, (TriggerStatus.STATUS_CREATED | TriggerStatus.STATUS_ARMED | TriggerStatus.STATUS_RUNNING | TriggerStatus.STATUS_COMPLETED | TriggerStatus.STATUS_CANCELED | TriggerStatus.STATUS_FAILED | TriggerStatus.STATUS_PAUSED)[]>]>;
1122
1122
  readonly triggerType: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["stop_loss", "take_profit", "trailing_stop", "twap", "ladder"], undefined>, undefined>, v.TransformAction<"twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop" | undefined, TriggerType>]>;
1123
1123
  readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, 50>;
1124
1124
  readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
@@ -1565,7 +1565,7 @@ declare const ListTriggerEventsInputSchema: v.SchemaWithPipe<readonly [v.StrictO
1565
1565
  readonly triggerId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, v.CheckAction<bigint, `${string} must be greater than zero`>]>;
1566
1566
  }, undefined>, v.TransformAction<{
1567
1567
  limit?: number | undefined;
1568
- eventType?: "updated" | "failed" | "canceled" | "armed" | "fired" | "activated" | "fire_refused" | undefined;
1568
+ eventType?: "failed" | "canceled" | "updated" | "armed" | "fired" | "activated" | "fire_refused" | undefined;
1569
1569
  pageToken: string;
1570
1570
  account?: "active" | "main" | {
1571
1571
  subaccountId: string;
@@ -1,3 +1,5 @@
1
+ import "../../gen/orders/v1/orders_pb.js";
2
+ import "../../gen/triggers/v1/triggers_pb.js";
1
3
  import { ValidationError } from "../../shared/errors.js";
2
4
  import { idToBigInt } from "../../utils/base58-id.js";
3
5
  import { PROTOBUF_INT64_MAX } from "../../shared/wire-bounds.js";
@@ -6,8 +8,6 @@ import { optionalIdInputSchema } from "../../shared/schemas.js";
6
8
  import { positiveDecimalInputToScaled } from "../../shared/decimal-surface.js";
7
9
  import { BpsStringOrNumberInputSchema, NoneInputSchema, SymbolIdInputSchema } from "../shared.js";
8
10
  import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
9
- import "../../gen/orders/v1/orders_pb.js";
10
- import "../../gen/triggers/v1/triggers_pb.js";
11
11
  import { OrderSideCodec, TriggerPriceSourceInputSchema } from "../orders/order-enums.codecs.js";
12
12
  import { OrderIdempotencyKeyPattern, OrderRequestIdInputSchema, positiveOrderIdInputSchema } from "../orders/orders-identifiers.schemas.js";
13
13
  import { MAX_SELLING_SLIPPAGE_BPS, parseTrailingDistanceInput } from "../trailing-oneof-inputs.js";