@polyester/sdk 0.36.0-devnet-20261115165158 → 0.36.0-devnet-20261116010019

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 (283) hide show
  1. package/CHANGELOG.md +42 -4
  2. package/dist/client.d.ts +4 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +4 -0
  5. package/dist/client.js.map +1 -1
  6. package/dist/gen/ai/v1/assistant_pb.d.ts +82 -4
  7. package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
  8. package/dist/gen/ai/v1/assistant_pb.js +66 -10
  9. package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
  10. package/dist/gen/auth/v1/api_keys_pb.d.ts +4 -4
  11. package/dist/gen/auth/v1/api_keys_pb.js +4 -4
  12. package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
  13. package/dist/gen/auth/v1/auth_pb.d.ts +26 -1
  14. package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
  15. package/dist/gen/auth/v1/auth_pb.js +18 -1
  16. package/dist/gen/auth/v1/auth_pb.js.map +1 -1
  17. package/dist/gen/auth/v1/policies_pb.d.ts +18 -1
  18. package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
  19. package/dist/gen/auth/v1/policies_pb.js +18 -1
  20. package/dist/gen/auth/v1/policies_pb.js.map +1 -1
  21. package/dist/gen/auth/v1/profile_pb.d.ts +7 -11
  22. package/dist/gen/auth/v1/profile_pb.d.ts.map +1 -1
  23. package/dist/gen/auth/v1/profile_pb.js +1 -1
  24. package/dist/gen/auth/v1/profile_pb.js.map +1 -1
  25. package/dist/gen/auth/v1/social_verification_pb.d.ts +44 -10
  26. package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
  27. package/dist/gen/auth/v1/social_verification_pb.js +1 -1
  28. package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
  29. package/dist/gen/auth/v1/subaccounts_pb.d.ts +17 -1
  30. package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
  31. package/dist/gen/auth/v1/subaccounts_pb.js +15 -1
  32. package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
  33. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +228 -38
  34. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
  35. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js +34 -10
  36. package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
  37. package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +12 -0
  38. package/dist/gen/chain/lifecycle/v1/types_pb.d.ts.map +1 -1
  39. package/dist/gen/chain/lifecycle/v1/types_pb.js +13 -1
  40. package/dist/gen/chain/lifecycle/v1/types_pb.js.map +1 -1
  41. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +6 -3
  42. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -1
  43. package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
  44. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +10 -1
  45. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
  46. package/dist/gen/chain/withdraw/v1/withdraw_pb.js +10 -1
  47. package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
  48. package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +10 -6
  49. package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
  50. package/dist/gen/chain/zipper/v1/zipper_pb.js +2 -2
  51. package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
  52. package/dist/gen/index.d.ts +3 -1
  53. package/dist/gen/index.js +4 -2
  54. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +57 -16
  55. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
  56. package/dist/gen/ledger/read/v1/ledger_read_pb.js +32 -1
  57. package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
  58. package/dist/gen/ledger/read/v1/statement_export_pb.d.ts +424 -0
  59. package/dist/gen/ledger/read/v1/statement_export_pb.d.ts.map +1 -0
  60. package/dist/gen/ledger/read/v1/statement_export_pb.js +154 -0
  61. package/dist/gen/ledger/read/v1/statement_export_pb.js.map +1 -0
  62. package/dist/gen/orders/v1/orders_pb.d.ts +28 -4
  63. package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
  64. package/dist/gen/orders/v1/orders_pb.js +1 -1
  65. package/dist/gen/orders/v1/orders_pb.js.map +1 -1
  66. package/dist/gen/orders/v1/orders_read_pb.d.ts +2 -1
  67. package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
  68. package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
  69. package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +12 -7
  70. package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts.map +1 -1
  71. package/dist/gen/ratelimit/v1/ratelimit_pb.js.map +1 -1
  72. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +22 -10
  73. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
  74. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +4 -2
  75. package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
  76. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +47 -11
  77. package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
  78. package/dist/gen/swap/quickswap/v1/quickswap_pb.js +35 -6
  79. package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
  80. package/dist/gen/transfer/v1/dust_conversion_pb.d.ts +741 -0
  81. package/dist/gen/transfer/v1/dust_conversion_pb.d.ts.map +1 -0
  82. package/dist/gen/transfer/v1/dust_conversion_pb.js +235 -0
  83. package/dist/gen/transfer/v1/dust_conversion_pb.js.map +1 -0
  84. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +367 -3
  85. package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
  86. package/dist/gen/transfer/v1/internal_transfer_pb.js +166 -4
  87. package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
  88. package/dist/gen/triggers/v1/triggers_pb.d.ts +10 -5
  89. package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
  90. package/dist/gen/triggers/v1/triggers_pb.js +4 -2
  91. package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
  92. package/dist/index.d.ts +13 -7
  93. package/dist/services/address-book/address-book.schemas.d.ts +2 -2
  94. package/dist/services/assistant/assistant-events.schemas.d.ts +66 -66
  95. package/dist/services/assistant/assistant.codecs.d.ts +7 -1
  96. package/dist/services/assistant/assistant.codecs.d.ts.map +1 -1
  97. package/dist/services/assistant/assistant.codecs.js +5 -1
  98. package/dist/services/assistant/assistant.codecs.js.map +1 -1
  99. package/dist/services/assistant/assistant.d.ts +4 -3
  100. package/dist/services/assistant/assistant.d.ts.map +1 -1
  101. package/dist/services/assistant/assistant.js +6 -4
  102. package/dist/services/assistant/assistant.js.map +1 -1
  103. package/dist/services/assistant/assistant.schemas.d.ts +40 -3
  104. package/dist/services/assistant/assistant.schemas.d.ts.map +1 -1
  105. package/dist/services/assistant/assistant.schemas.js +18 -4
  106. package/dist/services/assistant/assistant.schemas.js.map +1 -1
  107. package/dist/services/assistant/assistant.types.d.ts +3 -3
  108. package/dist/services/auth/profile/profile.d.ts +1 -1
  109. package/dist/services/auth/profile/profile.js +1 -1
  110. package/dist/services/auth/profile/profile.js.map +1 -1
  111. package/dist/services/auth/profile/profile.schemas.d.ts +0 -1
  112. package/dist/services/auth/profile/profile.schemas.d.ts.map +1 -1
  113. package/dist/services/auth/profile/profile.schemas.js +0 -1
  114. package/dist/services/auth/profile/profile.schemas.js.map +1 -1
  115. package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts +3 -1
  116. package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts.map +1 -1
  117. package/dist/services/auto-withdraw/auto-withdraw.codecs.js.map +1 -1
  118. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +19 -19
  119. package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -1
  120. package/dist/services/balances/balances.d.ts +4 -3
  121. package/dist/services/balances/balances.d.ts.map +1 -1
  122. package/dist/services/balances/balances.js +12 -4
  123. package/dist/services/balances/balances.js.map +1 -1
  124. package/dist/services/balances/balances.schemas.d.ts +30 -5
  125. package/dist/services/balances/balances.schemas.d.ts.map +1 -1
  126. package/dist/services/balances/balances.schemas.js +6 -10
  127. package/dist/services/balances/balances.schemas.js.map +1 -1
  128. package/dist/services/balances/balances.types.d.ts +2 -2
  129. package/dist/services/checkpoints/checkpoints.schemas.d.ts +2 -2
  130. package/dist/services/claims/claims.schemas.js +1 -1
  131. package/dist/services/dust-conversion/dust-conversion.codecs.d.ts +22 -0
  132. package/dist/services/dust-conversion/dust-conversion.codecs.d.ts.map +1 -0
  133. package/dist/services/dust-conversion/dust-conversion.codecs.js +22 -0
  134. package/dist/services/dust-conversion/dust-conversion.codecs.js.map +1 -0
  135. package/dist/services/dust-conversion/dust-conversion.d.ts +59 -0
  136. package/dist/services/dust-conversion/dust-conversion.d.ts.map +1 -0
  137. package/dist/services/dust-conversion/dust-conversion.js +87 -0
  138. package/dist/services/dust-conversion/dust-conversion.js.map +1 -0
  139. package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +561 -0
  140. package/dist/services/dust-conversion/dust-conversion.schemas.d.ts.map +1 -0
  141. package/dist/services/dust-conversion/dust-conversion.schemas.js +190 -0
  142. package/dist/services/dust-conversion/dust-conversion.schemas.js.map +1 -0
  143. package/dist/services/dust-conversion/dust-conversion.types.d.ts +3 -0
  144. package/dist/services/dust-conversion/service.d.ts +8 -0
  145. package/dist/services/dust-conversion/service.d.ts.map +1 -0
  146. package/dist/services/dust-conversion/service.js +9 -0
  147. package/dist/services/dust-conversion/service.js.map +1 -0
  148. package/dist/services/heatmap/heatmap.schemas.d.ts +3 -3
  149. package/dist/services/internal-transfers/internal-transfers.codecs.d.ts +13 -1
  150. package/dist/services/internal-transfers/internal-transfers.codecs.d.ts.map +1 -1
  151. package/dist/services/internal-transfers/internal-transfers.codecs.js +22 -2
  152. package/dist/services/internal-transfers/internal-transfers.codecs.js.map +1 -1
  153. package/dist/services/internal-transfers/internal-transfers.d.ts +14 -2
  154. package/dist/services/internal-transfers/internal-transfers.d.ts.map +1 -1
  155. package/dist/services/internal-transfers/internal-transfers.js +29 -3
  156. package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
  157. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +265 -5
  158. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
  159. package/dist/services/internal-transfers/internal-transfers.schemas.js +63 -5
  160. package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
  161. package/dist/services/internal-transfers/internal-transfers.types.d.ts +3 -3
  162. package/dist/services/lifecycle/lifecycle.codecs.d.ts +1 -1
  163. package/dist/services/lifecycle/lifecycle.codecs.d.ts.map +1 -1
  164. package/dist/services/lifecycle/lifecycle.codecs.js +1 -0
  165. package/dist/services/lifecycle/lifecycle.codecs.js.map +1 -1
  166. package/dist/services/lifecycle/lifecycle.d.ts +26 -8
  167. package/dist/services/lifecycle/lifecycle.d.ts.map +1 -1
  168. package/dist/services/lifecycle/lifecycle.js +39 -7
  169. package/dist/services/lifecycle/lifecycle.js.map +1 -1
  170. package/dist/services/lifecycle/lifecycle.schemas.d.ts +160 -136
  171. package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
  172. package/dist/services/lifecycle/lifecycle.schemas.js +44 -45
  173. package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
  174. package/dist/services/lifecycle/lifecycle.types.d.ts +2 -2
  175. package/dist/services/lifecycle/service.js +1 -1
  176. package/dist/services/lifecycle/service.js.map +1 -1
  177. package/dist/services/orderbook/orderbook.d.ts.map +1 -1
  178. package/dist/services/orderbook/orderbook.js +2 -1
  179. package/dist/services/orderbook/orderbook.js.map +1 -1
  180. package/dist/services/orderbook/orderbook.schemas.d.ts +10 -0
  181. package/dist/services/orderbook/orderbook.schemas.d.ts.map +1 -1
  182. package/dist/services/orderbook/orderbook.schemas.js +4 -1
  183. package/dist/services/orderbook/orderbook.schemas.js.map +1 -1
  184. package/dist/services/orders/order-errors.schemas.d.ts +11 -1
  185. package/dist/services/orders/order-errors.schemas.d.ts.map +1 -1
  186. package/dist/services/orders/order-errors.schemas.js +11 -1
  187. package/dist/services/orders/order-errors.schemas.js.map +1 -1
  188. package/dist/services/orders/orders-batch.schemas.d.ts +67 -27
  189. package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
  190. package/dist/services/orders/orders-identifiers.schemas.js +2 -1
  191. package/dist/services/orders/orders-identifiers.schemas.js.map +1 -1
  192. package/dist/services/orders/orders-input.schemas.d.ts +11 -4
  193. package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
  194. package/dist/services/orders/orders-input.schemas.js +1 -0
  195. package/dist/services/orders/orders-input.schemas.js.map +1 -1
  196. package/dist/services/orders/orders-output.schemas.d.ts +17 -17
  197. package/dist/services/orders/orders-output.schemas.js +1 -1
  198. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
  199. package/dist/services/policies/shared.codecs.js +9 -3
  200. package/dist/services/policies/shared.codecs.js.map +1 -1
  201. package/dist/services/policies/shared.d.ts +1 -1
  202. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +5 -5
  203. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts.map +1 -1
  204. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +2 -3
  205. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
  206. package/dist/services/price-alerts/price-alerts.schemas.d.ts +10 -10
  207. package/dist/services/rate-limits/rate-limits.d.ts +4 -1
  208. package/dist/services/rate-limits/rate-limits.d.ts.map +1 -1
  209. package/dist/services/rate-limits/rate-limits.js +4 -1
  210. package/dist/services/rate-limits/rate-limits.js.map +1 -1
  211. package/dist/services/rate-limits/rate-limits.schemas.d.ts +1 -0
  212. package/dist/services/rate-limits/rate-limits.schemas.d.ts.map +1 -1
  213. package/dist/services/rate-limits/rate-limits.schemas.js +1 -0
  214. package/dist/services/rate-limits/rate-limits.schemas.js.map +1 -1
  215. package/dist/services/rewards/rewards.schemas.d.ts +4 -4
  216. package/dist/services/social-verification/social-verification.codecs.js +6 -2
  217. package/dist/services/social-verification/social-verification.codecs.js.map +1 -1
  218. package/dist/services/social-verification/social-verification.d.ts +14 -3
  219. package/dist/services/social-verification/social-verification.d.ts.map +1 -1
  220. package/dist/services/social-verification/social-verification.js +14 -3
  221. package/dist/services/social-verification/social-verification.js.map +1 -1
  222. package/dist/services/social-verification/social-verification.schemas.d.ts +13 -3
  223. package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
  224. package/dist/services/social-verification/social-verification.schemas.js +12 -4
  225. package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
  226. package/dist/services/statement-exports/service.d.ts +8 -0
  227. package/dist/services/statement-exports/service.d.ts.map +1 -0
  228. package/dist/services/statement-exports/service.js +9 -0
  229. package/dist/services/statement-exports/service.js.map +1 -0
  230. package/dist/services/statement-exports/statement-exports.codecs.d.ts +17 -0
  231. package/dist/services/statement-exports/statement-exports.codecs.d.ts.map +1 -0
  232. package/dist/services/statement-exports/statement-exports.codecs.js +19 -0
  233. package/dist/services/statement-exports/statement-exports.codecs.js.map +1 -0
  234. package/dist/services/statement-exports/statement-exports.d.ts +34 -0
  235. package/dist/services/statement-exports/statement-exports.d.ts.map +1 -0
  236. package/dist/services/statement-exports/statement-exports.js +53 -0
  237. package/dist/services/statement-exports/statement-exports.js.map +1 -0
  238. package/dist/services/statement-exports/statement-exports.schemas.d.ts +269 -0
  239. package/dist/services/statement-exports/statement-exports.schemas.d.ts.map +1 -0
  240. package/dist/services/statement-exports/statement-exports.schemas.js +98 -0
  241. package/dist/services/statement-exports/statement-exports.schemas.js.map +1 -0
  242. package/dist/services/statement-exports/statement-exports.types.d.ts +3 -0
  243. package/dist/services/subaccounts/subaccounts.codecs.js +3 -1
  244. package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
  245. package/dist/services/subaccounts/subaccounts.schemas.d.ts +22 -22
  246. package/dist/services/system/system.schemas.d.ts +7 -7
  247. package/dist/services/trades/trades.schemas.d.ts +2 -2
  248. package/dist/services/trades/trades.schemas.js +1 -1
  249. package/dist/services/trading-withdraws/trading-withdraws.schemas.js +1 -1
  250. package/dist/services/transfers/transfers.schemas.js +1 -1
  251. package/dist/services/triggers/trigger-input.schemas.d.ts +5 -4
  252. package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
  253. package/dist/services/triggers/trigger-input.schemas.js +2 -2
  254. package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
  255. package/dist/services/triggers/triggers-output.schemas.d.ts +45 -35
  256. package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
  257. package/dist/services/zipper/zipper.schemas.d.ts.map +1 -1
  258. package/dist/services/zipper/zipper.schemas.js +10 -0
  259. package/dist/services/zipper/zipper.schemas.js.map +1 -1
  260. package/dist/shared/account-scope.js +4 -1
  261. package/dist/shared/account-scope.js.map +1 -1
  262. package/dist/shared/connect-error-mapping.d.ts.map +1 -1
  263. package/dist/shared/connect-error-mapping.js +3 -0
  264. package/dist/shared/connect-error-mapping.js.map +1 -1
  265. package/dist/shared/decimal-surface.d.ts.map +1 -1
  266. package/dist/shared/decimal-surface.js +4 -1
  267. package/dist/shared/decimal-surface.js.map +1 -1
  268. package/dist/shared/error-detail.d.ts +5 -0
  269. package/dist/shared/error-detail.d.ts.map +1 -1
  270. package/dist/shared/error-detail.js.map +1 -1
  271. package/dist/shared/error-details/auth.js +7 -2
  272. package/dist/shared/error-details/auth.js.map +1 -1
  273. package/dist/shared/error-details/withdraw.js +1 -1
  274. package/dist/shared/schemas.js +2 -2
  275. package/dist/shared/schemas.js.map +1 -1
  276. package/dist/utils/numbers.js +1 -10
  277. package/dist/utils/numbers.js.map +1 -1
  278. package/dist/utils/u128.js +1 -1
  279. package/dist/utils/u128.js.map +1 -1
  280. package/dist/wired-services.d.ts.map +1 -1
  281. package/dist/wired-services.js +5 -1
  282. package/dist/wired-services.js.map +1 -1
  283. package/package.json +1 -1
@@ -0,0 +1,190 @@
1
+ import { ErrorCode } from "../../gen/transfer/v1/internal_transfer_pb.js";
2
+ import { codeName } from "../../shared/error-detail.js";
3
+ import { OptionalTimestampMsSchema, U128Schema } from "../../shared/schemas.js";
4
+ import { enumLabelSchema } from "../../shared/proto-enum-codec.js";
5
+ import { fromU128 } from "../../utils/u128.js";
6
+ import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
7
+ import { PositiveUint32InputSchema } from "../shared.js";
8
+ import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
9
+ import { DustAssetEligibilityCodec, DustConversionStateCodec } from "./dust-conversion.codecs.js";
10
+ import * as v from "valibot";
11
+ //#region src/services/dust-conversion/dust-conversion.schemas.ts
12
+ const RequiredInputStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));
13
+ const ListDustBalancesInputSchema = v.pipe(v.strictObject({
14
+ ...AccountScopeInputEntries,
15
+ /** One of the response's `targets`; omit for the first. */
16
+ targetAssetId: v.optional(PositiveUint32InputSchema)
17
+ }), v.transform(({ account, targetAssetId }) => ({
18
+ subaccountId: accountScopeToSubaccountId(account),
19
+ targetAssetId
20
+ })));
21
+ const QuoteDustConversionInputSchema = v.pipe(v.strictObject({
22
+ ...AccountScopeInputEntries,
23
+ /** One of `listBalances`' `targets`. */
24
+ targetAssetId: PositiveUint32InputSchema
25
+ }), v.transform(({ account, targetAssetId }) => ({
26
+ subaccountId: accountScopeToSubaccountId(account),
27
+ targetAssetId
28
+ })));
29
+ const CreateDustConversionInputSchema = v.pipe(v.strictObject({
30
+ /** Must select the quote's account. */
31
+ ...AccountScopeInputEntries,
32
+ /** `quoteId` from `quote`, at most 30 seconds old. A quote converts once. */
33
+ quoteId: RequiredInputStringSchema,
34
+ /** Stable key collapsing retries for the account; reusing it returns the same conversion. */
35
+ idempotencyKey: RequiredInputStringSchema
36
+ }), v.transform(({ account, quoteId, idempotencyKey }) => ({
37
+ subaccountId: accountScopeToSubaccountId(account),
38
+ quoteId,
39
+ idempotencyKey
40
+ })));
41
+ const GetDustConversionInputSchema = v.pipe(v.strictObject({
42
+ ...AccountScopeInputEntries,
43
+ conversionId: RequiredInputStringSchema
44
+ }), v.transform(({ account, conversionId }) => ({
45
+ subaccountId: accountScopeToSubaccountId(account),
46
+ conversionId
47
+ })));
48
+ const ListDustConversionsInputSchema = v.pipe(v.strictObject({
49
+ ...AccountScopeInputEntries,
50
+ /** Page size: default 20, at most 100. */
51
+ limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(100))),
52
+ /** Previous `nextPageToken`; reuse only with the same account. */
53
+ pageToken: v.optional(v.pipe(v.string(), v.trim()))
54
+ }), v.transform(({ account, limit, pageToken }) => ({
55
+ subaccountId: accountScopeToSubaccountId(account),
56
+ limit,
57
+ pageToken
58
+ })));
59
+ /** Wire `*_e18` U128 → exact decimal string; an unset amount is `"0"`. */
60
+ function e18ToDecimal(value) {
61
+ return scaledToDecimalOutput(fromU128(value), 18);
62
+ }
63
+ const AmountE18Schema = v.optional(U128Schema);
64
+ /** Decimal scale a wire price may carry, as catalog scales are bounded. */
65
+ const PriceScaleSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(18));
66
+ /** One Trading balance judged for conversion. Amounts are decimal strings. */
67
+ const DustBalanceSchema = v.pipe(v.object({
68
+ assetId: v.number(),
69
+ amountE18: AmountE18Schema,
70
+ eligibility: enumLabelSchema(DustAssetEligibilityCodec.protoToOutput),
71
+ usdValueE18: AmountE18Schema
72
+ }), v.transform((balance) => ({
73
+ assetId: balance.assetId,
74
+ /** The whole available balance: what no open order or other reservation holds. */
75
+ amount: e18ToDecimal(balance.amountE18),
76
+ eligibility: balance.eligibility,
77
+ /** USD value, rounded down; null when the asset has no current price. */
78
+ usdValue: balance.usdValueE18 === void 0 ? null : e18ToDecimal(balance.usdValueE18)
79
+ })));
80
+ /** USD index price a quote used for one asset. */
81
+ const DustAssetPriceSchema = v.pipe(v.object({
82
+ assetId: v.number(),
83
+ priceTicks: v.bigint(),
84
+ priceScale: PriceScaleSchema,
85
+ asOf: OptionalTimestampMsSchema
86
+ }), v.transform((price) => ({
87
+ assetId: price.assetId,
88
+ /** USD per whole asset unit, exact. */
89
+ price: scaledToDecimalOutput(price.priceTicks, price.priceScale),
90
+ /** Time of the oldest index observation the price used. */
91
+ asOf: price.asOf ?? null
92
+ })));
93
+ const DustConversionSchema = v.pipe(v.object({
94
+ conversionId: v.pipe(v.string(), v.minLength(1)),
95
+ quoteId: v.pipe(v.string(), v.minLength(1)),
96
+ state: enumLabelSchema(DustConversionStateCodec.protoToOutput),
97
+ refusalCode: v.number(),
98
+ targetAssetId: v.number(),
99
+ sources: v.array(v.object({
100
+ assetId: v.number(),
101
+ amountE18: AmountE18Schema
102
+ })),
103
+ payoutE18: AmountE18Schema,
104
+ quotedPayoutE18: AmountE18Schema,
105
+ feeE18: AmountE18Schema,
106
+ feeBps: v.number(),
107
+ createdAt: OptionalTimestampMsSchema,
108
+ completedAt: OptionalTimestampMsSchema
109
+ }), v.transform((conversion) => ({
110
+ conversionId: conversion.conversionId,
111
+ /** The quote the conversion converted. */
112
+ quoteId: conversion.quoteId,
113
+ state: conversion.state,
114
+ /** Why a `refused` conversion was refused; null otherwise. */
115
+ refusalCode: conversion.refusalCode === 0 ? null : codeName(ErrorCode, conversion.refusalCode) ?? "UNSPECIFIED",
116
+ targetAssetId: conversion.targetAssetId,
117
+ /** Whole quoted balances moved, in asset id order. */
118
+ sources: conversion.sources.map((source) => ({
119
+ assetId: source.assetId,
120
+ amount: e18ToDecimal(source.amountE18)
121
+ })),
122
+ /** Target amount credited after the fee, at the index prices when it was created. */
123
+ payout: e18ToDecimal(conversion.payoutE18),
124
+ /** The payout the quote showed. */
125
+ quotedPayout: e18ToDecimal(conversion.quotedPayoutE18),
126
+ /** Fee taken from the payout, in the target asset. */
127
+ fee: e18ToDecimal(conversion.feeE18),
128
+ feeBps: conversion.feeBps,
129
+ createdAt: conversion.createdAt ?? null,
130
+ /** Null until `completed`. */
131
+ completedAt: conversion.completedAt ?? null
132
+ })));
133
+ const ListDustBalancesResultSchema = v.pipe(v.object({
134
+ targetAssetId: v.number(),
135
+ targets: v.array(v.number()),
136
+ feeBps: v.number(),
137
+ balances: v.array(DustBalanceSchema),
138
+ grossUsdE18: AmountE18Schema,
139
+ payoutE18: AmountE18Schema,
140
+ targetAvailable: v.boolean()
141
+ }), v.transform((result) => ({
142
+ /** Target the balances were judged for. */
143
+ targetAssetId: result.targetAssetId,
144
+ /** Every asset the account can convert dust into, in preference order. */
145
+ targets: result.targets,
146
+ /** Fee taken from the payout. */
147
+ feeBps: result.feeBps,
148
+ /** Every nonzero available Trading balance, in asset id order. */
149
+ balances: result.balances,
150
+ /** Eligible balances' total USD value, rounded down. */
151
+ grossUsd: e18ToDecimal(result.grossUsdE18),
152
+ /** Target amount they would bring now, after the fee. */
153
+ payout: e18ToDecimal(result.payoutE18),
154
+ /** False when the target cannot be paid now; `quote` is then refused. */
155
+ targetAvailable: result.targetAvailable
156
+ })));
157
+ const DustConversionQuoteSchema = v.pipe(v.object({
158
+ quoteId: v.string(),
159
+ expiresAt: OptionalTimestampMsSchema,
160
+ targetAssetId: v.number(),
161
+ feeBps: v.number(),
162
+ grossUsdE18: AmountE18Schema,
163
+ payoutE18: AmountE18Schema,
164
+ balances: v.array(DustBalanceSchema),
165
+ prices: v.array(DustAssetPriceSchema)
166
+ }), v.transform((quote) => ({
167
+ /** Pass to `create`. Empty when nothing converts; `balances` says why. */
168
+ quoteId: quote.quoteId,
169
+ /** After this, `create` refuses the quote with `DUST_QUOTE_EXPIRED`. */
170
+ expiresAt: quote.expiresAt ?? null,
171
+ targetAssetId: quote.targetAssetId,
172
+ /** Fee taken from the payout. */
173
+ feeBps: quote.feeBps,
174
+ /** Sources' total USD value, rounded down. */
175
+ grossUsd: e18ToDecimal(quote.grossUsdE18),
176
+ /** Target amount after the fee, rounded down to the target's quantity precision. */
177
+ payout: e18ToDecimal(quote.payoutE18),
178
+ /** Every nonzero available Trading balance, sources and others, in asset id order. */
179
+ balances: quote.balances,
180
+ /** Prices of the sources and the target, in asset id order. */
181
+ prices: quote.prices
182
+ })));
183
+ const ListDustConversionsResultSchema = v.object({
184
+ conversions: v.array(DustConversionSchema),
185
+ nextPageToken: v.optional(v.string(), "")
186
+ });
187
+ //#endregion
188
+ export { CreateDustConversionInputSchema, DustAssetPriceSchema, DustBalanceSchema, DustConversionQuoteSchema, DustConversionSchema, GetDustConversionInputSchema, ListDustBalancesInputSchema, ListDustBalancesResultSchema, ListDustConversionsInputSchema, ListDustConversionsResultSchema, QuoteDustConversionInputSchema };
189
+
190
+ //# sourceMappingURL=dust-conversion.schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dust-conversion.schemas.js","names":[],"sources":["../../../src/services/dust-conversion/dust-conversion.schemas.ts"],"sourcesContent":["import type { MessageInitShape } from \"@bufbuild/protobuf\";\nimport * as v from \"valibot\";\nimport type * as Proto from \"../../gen/transfer/v1/dust_conversion_pb.js\";\nimport { ErrorCode } from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { E18_SCALE, scaledToDecimalOutput } from \"../../shared/decimal-surface.js\";\nimport { codeName } from \"../../shared/error-detail.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport { OptionalTimestampMsSchema, U128Schema } from \"../../shared/schemas.js\";\nimport { fromU128, type U128Value } from \"../../utils/u128.js\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport { DustAssetEligibilityCodec, DustConversionStateCodec } from \"./dust-conversion.codecs.js\";\n\nconst RequiredInputStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nexport const ListDustBalancesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** One of the response's `targets`; omit for the first. */\n targetAssetId: v.optional(PositiveUint32InputSchema),\n }),\n v.transform(\n ({ account, targetAssetId }) =>\n ({\n subaccountId: accountScopeToSubaccountId(account),\n targetAssetId,\n }) satisfies MessageInitShape<typeof Proto.ListDustBalancesRequestSchema>,\n ),\n);\n\nexport type ListDustBalancesInput = v.InferInput<typeof ListDustBalancesInputSchema>;\n\nexport const QuoteDustConversionInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** One of `listBalances`' `targets`. */\n targetAssetId: PositiveUint32InputSchema,\n }),\n v.transform(\n ({ account, targetAssetId }) =>\n ({\n subaccountId: accountScopeToSubaccountId(account),\n targetAssetId,\n }) satisfies MessageInitShape<typeof Proto.QuoteDustConversionRequestSchema>,\n ),\n);\n\nexport type QuoteDustConversionInput = v.InferInput<typeof QuoteDustConversionInputSchema>;\n\nexport const CreateDustConversionInputSchema = v.pipe(\n v.strictObject({\n /** Must select the quote's account. */\n ...AccountScopeInputEntries,\n /** `quoteId` from `quote`, at most 30 seconds old. A quote converts once. */\n quoteId: RequiredInputStringSchema,\n /** Stable key collapsing retries for the account; reusing it returns the same conversion. */\n idempotencyKey: RequiredInputStringSchema,\n }),\n v.transform(\n ({ account, quoteId, idempotencyKey }) =>\n ({\n subaccountId: accountScopeToSubaccountId(account),\n quoteId,\n idempotencyKey,\n }) satisfies MessageInitShape<typeof Proto.CreateDustConversionRequestSchema>,\n ),\n);\n\nexport type CreateDustConversionInput = v.InferInput<typeof CreateDustConversionInputSchema>;\n\nexport const GetDustConversionInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n conversionId: RequiredInputStringSchema,\n }),\n v.transform(\n ({ account, conversionId }) =>\n ({\n subaccountId: accountScopeToSubaccountId(account),\n conversionId,\n }) satisfies MessageInitShape<typeof Proto.GetDustConversionRequestSchema>,\n ),\n);\n\nexport type GetDustConversionInput = v.InferInput<typeof GetDustConversionInputSchema>;\n\nexport const ListDustConversionsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** Page size: default 20, at most 100. */\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(100))),\n /** Previous `nextPageToken`; reuse only with the same account. */\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n }),\n v.transform(\n ({ account, limit, pageToken }) =>\n ({\n subaccountId: accountScopeToSubaccountId(account),\n limit,\n pageToken,\n }) satisfies MessageInitShape<typeof Proto.ListDustConversionsRequestSchema>,\n ),\n);\n\nexport type ListDustConversionsInput = v.InferInput<typeof ListDustConversionsInputSchema>;\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/** Decimal scale a wire price may carry, as catalog scales are bounded. */\nconst PriceScaleSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(18));\n\n/** One Trading balance judged for conversion. Amounts are decimal strings. */\nexport const DustBalanceSchema = v.pipe(\n v.object({\n assetId: v.number(),\n amountE18: AmountE18Schema,\n eligibility: enumLabelSchema(DustAssetEligibilityCodec.protoToOutput),\n usdValueE18: AmountE18Schema,\n }),\n v.transform((balance) => ({\n assetId: balance.assetId,\n /** The whole available balance: what no open order or other reservation holds. */\n amount: e18ToDecimal(balance.amountE18),\n eligibility: balance.eligibility,\n /** USD value, rounded down; null when the asset has no current price. */\n usdValue: balance.usdValueE18 === undefined ? null : e18ToDecimal(balance.usdValueE18),\n })),\n);\n\nexport type DustBalance = v.InferOutput<typeof DustBalanceSchema>;\n\n/** USD index price a quote used for one asset. */\nexport const DustAssetPriceSchema = v.pipe(\n v.object({\n assetId: v.number(),\n priceTicks: v.bigint(),\n priceScale: PriceScaleSchema,\n asOf: OptionalTimestampMsSchema,\n }),\n v.transform((price) => ({\n assetId: price.assetId,\n /** USD per whole asset unit, exact. */\n price: scaledToDecimalOutput(price.priceTicks, price.priceScale),\n /** Time of the oldest index observation the price used. */\n asOf: price.asOf ?? null,\n })),\n);\n\nexport type DustAssetPrice = v.InferOutput<typeof DustAssetPriceSchema>;\n\nexport const DustConversionSchema = v.pipe(\n v.object({\n conversionId: v.pipe(v.string(), v.minLength(1)),\n quoteId: v.pipe(v.string(), v.minLength(1)),\n state: enumLabelSchema(DustConversionStateCodec.protoToOutput),\n refusalCode: v.number(),\n targetAssetId: v.number(),\n sources: v.array(v.object({ assetId: v.number(), amountE18: AmountE18Schema })),\n payoutE18: AmountE18Schema,\n quotedPayoutE18: AmountE18Schema,\n feeE18: AmountE18Schema,\n feeBps: v.number(),\n createdAt: OptionalTimestampMsSchema,\n completedAt: OptionalTimestampMsSchema,\n }),\n v.transform((conversion) => ({\n conversionId: conversion.conversionId,\n /** The quote the conversion converted. */\n quoteId: conversion.quoteId,\n state: conversion.state,\n /** Why a `refused` conversion was refused; null otherwise. */\n refusalCode:\n conversion.refusalCode === ErrorCode.UNSPECIFIED\n ? null\n : (codeName(ErrorCode, conversion.refusalCode) ?? \"UNSPECIFIED\"),\n targetAssetId: conversion.targetAssetId,\n /** Whole quoted balances moved, in asset id order. */\n sources: conversion.sources.map((source) => ({\n assetId: source.assetId,\n amount: e18ToDecimal(source.amountE18),\n })),\n /** Target amount credited after the fee, at the index prices when it was created. */\n payout: e18ToDecimal(conversion.payoutE18),\n /** The payout the quote showed. */\n quotedPayout: e18ToDecimal(conversion.quotedPayoutE18),\n /** Fee taken from the payout, in the target asset. */\n fee: e18ToDecimal(conversion.feeE18),\n feeBps: conversion.feeBps,\n createdAt: conversion.createdAt ?? null,\n /** Null until `completed`. */\n completedAt: conversion.completedAt ?? null,\n })),\n);\n\n/** One conversion of the account's dust into a target asset. Amounts are decimal strings. */\nexport type DustConversion = v.InferOutput<typeof DustConversionSchema>;\n\nexport const ListDustBalancesResultSchema = v.pipe(\n v.object({\n targetAssetId: v.number(),\n targets: v.array(v.number()),\n feeBps: v.number(),\n balances: v.array(DustBalanceSchema),\n grossUsdE18: AmountE18Schema,\n payoutE18: AmountE18Schema,\n targetAvailable: v.boolean(),\n }),\n v.transform((result) => ({\n /** Target the balances were judged for. */\n targetAssetId: result.targetAssetId,\n /** Every asset the account can convert dust into, in preference order. */\n targets: result.targets,\n /** Fee taken from the payout. */\n feeBps: result.feeBps,\n /** Every nonzero available Trading balance, in asset id order. */\n balances: result.balances,\n /** Eligible balances' total USD value, rounded down. */\n grossUsd: e18ToDecimal(result.grossUsdE18),\n /** Target amount they would bring now, after the fee. */\n payout: e18ToDecimal(result.payoutE18),\n /** False when the target cannot be paid now; `quote` is then refused. */\n targetAvailable: result.targetAvailable,\n })),\n);\n\n/** The account's balances judged for one target. Reserves nothing. */\nexport type ListDustBalancesResult = v.InferOutput<typeof ListDustBalancesResultSchema>;\n\nexport const DustConversionQuoteSchema = v.pipe(\n v.object({\n quoteId: v.string(),\n expiresAt: OptionalTimestampMsSchema,\n targetAssetId: v.number(),\n feeBps: v.number(),\n grossUsdE18: AmountE18Schema,\n payoutE18: AmountE18Schema,\n balances: v.array(DustBalanceSchema),\n prices: v.array(DustAssetPriceSchema),\n }),\n v.transform((quote) => ({\n /** Pass to `create`. Empty when nothing converts; `balances` says why. */\n quoteId: quote.quoteId,\n /** After this, `create` refuses the quote with `DUST_QUOTE_EXPIRED`. */\n expiresAt: quote.expiresAt ?? null,\n targetAssetId: quote.targetAssetId,\n /** Fee taken from the payout. */\n feeBps: quote.feeBps,\n /** Sources' total USD value, rounded down. */\n grossUsd: e18ToDecimal(quote.grossUsdE18),\n /** Target amount after the fee, rounded down to the target's quantity precision. */\n payout: e18ToDecimal(quote.payoutE18),\n /** Every nonzero available Trading balance, sources and others, in asset id order. */\n balances: quote.balances,\n /** Prices of the sources and the target, in asset id order. */\n prices: quote.prices,\n })),\n);\n\n/** A quote valid for 30 seconds. Reserves nothing. */\nexport type DustConversionQuote = v.InferOutput<typeof DustConversionQuoteSchema>;\n\nexport const ListDustConversionsResultSchema = v.object({\n conversions: v.array(DustConversionSchema),\n nextPageToken: v.optional(v.string(), \"\"),\n});\n\n/** One page of conversions, newest first; an empty `nextPageToken` means no more. */\nexport type ListDustConversionsResult = v.InferOutput<typeof ListDustConversionsResultSchema>;\n"],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ import { CreateDustConversionInput, DustAssetPrice, DustBalance, DustConversion, DustConversionQuote, GetDustConversionInput, ListDustBalancesInput, ListDustBalancesResult, ListDustConversionsInput, ListDustConversionsResult, QuoteDustConversionInput } from "./dust-conversion.schemas.js";
2
+ import { DustAssetEligibility, DustConversionRefusalCode, DustConversionState } from "./dust-conversion.codecs.js";
3
+ export type { CreateDustConversionInput, DustAssetEligibility, DustAssetPrice, DustBalance, DustConversion, DustConversionQuote, DustConversionRefusalCode, DustConversionState, GetDustConversionInput, ListDustBalancesInput, ListDustBalancesResult, ListDustConversionsInput, ListDustConversionsResult, QuoteDustConversionInput };
@@ -0,0 +1,8 @@
1
+ import { DustConversionService } from "./dust-conversion.js";
2
+ import { PolyesterCore } from "../../core-client.js";
3
+ //#region src/services/dust-conversion/service.d.ts
4
+ /** Returns the client's DustConversionService, creating it on first use. */
5
+ declare const dustConversionService: (client: PolyesterCore) => DustConversionService;
6
+ //#endregion
7
+ export { dustConversionService };
8
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","names":[],"sources":["../../../src/services/dust-conversion/service.ts"],"mappings":";;;;cAIa,wBAAqB,QAArB,kBAAqB"}
@@ -0,0 +1,9 @@
1
+ import { defineService } from "../../core-client.js";
2
+ import { DustConversionService } from "./dust-conversion.js";
3
+ //#region src/services/dust-conversion/service.ts
4
+ /** Returns the client's DustConversionService, creating it on first use. */
5
+ const dustConversionService = defineService((context) => new DustConversionService(context.transports, context.resolver));
6
+ //#endregion
7
+ export { dustConversionService };
8
+
9
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","names":[],"sources":["../../../src/services/dust-conversion/service.ts"],"sourcesContent":["import { defineService } from \"../../core-client.js\";\nimport { DustConversionService } from \"./dust-conversion.js\";\n\n/** Returns the client's DustConversionService, creating it on first use. */\nexport const dustConversionService = defineService(\n (context) => new DustConversionService(context.transports, context.resolver),\n);\n"],"mappings":";;;;AAIA,MAAa,wBAAwB,eAChC,YAAY,IAAI,sBAAsB,QAAQ,YAAY,QAAQ,QAAQ,CAC/E"}
@@ -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" | 5 | 10 | 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" | 5 | 10 | 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" | 5 | 10 | 20 | 100 | 200 | 500 | 1000 | 50;
351
351
  chain: {
352
352
  baseKeyframe: {
353
353
  tsSec: number;
@@ -1,6 +1,18 @@
1
+ import { ErrorCode } from "../../gen/transfer/v1/internal_transfer_pb.js";
1
2
  //#region src/services/internal-transfers/internal-transfers.codecs.d.ts
2
3
  declare const INTERNAL_TRANSFER_STATUS_VALUES: readonly ["accepted", "rejected", "failed"];
3
4
  type InternalTransferStatus = (typeof INTERNAL_TRANSFER_STATUS_VALUES)[number];
5
+ declare const INTERNAL_TRANSFER_BATCH_STATUS_VALUES: readonly ["submitted", "refused"];
6
+ /** `"submitted"`: every leg passed its checks and ran; `"refused"`: no leg ran and nothing moved. */
7
+ type InternalTransferBatchStatus = (typeof INTERNAL_TRANSFER_BATCH_STATUS_VALUES)[number];
8
+ declare const INTERNAL_TRANSFER_BATCH_LEG_STATUS_VALUES: readonly ["accepted", "pending", "refused", "not_submitted"];
9
+ /**
10
+ * `"pending"`: the outcome is not known yet; read it with `internalTransfers.get` by the leg's
11
+ * `requestId`, or retry the batch with the same idempotency key. A retry also runs `"refused"`
12
+ * and `"not_submitted"` legs again.
13
+ */
14
+ type InternalTransferBatchLegStatus = (typeof INTERNAL_TRANSFER_BATCH_LEG_STATUS_VALUES)[number];
15
+ type InternalTransferErrorCode = keyof typeof ErrorCode;
4
16
  //#endregion
5
- export { INTERNAL_TRANSFER_STATUS_VALUES, InternalTransferStatus };
17
+ export { INTERNAL_TRANSFER_BATCH_LEG_STATUS_VALUES, INTERNAL_TRANSFER_BATCH_STATUS_VALUES, INTERNAL_TRANSFER_STATUS_VALUES, InternalTransferBatchLegStatus, InternalTransferBatchStatus, InternalTransferErrorCode, InternalTransferStatus };
6
18
  //# sourceMappingURL=internal-transfers.codecs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal-transfers.codecs.d.ts","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.codecs.ts"],"mappings":";cAuBa;KAED,iCAAiC"}
1
+ {"version":3,"file":"internal-transfers.codecs.d.ts","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.codecs.ts"],"mappings":";;cAuBa;KAED,iCAAiC;cAEhC;;KAGD,sCAAsC;cAUrC;;;;;;KAYD,yCACA;KAYA,yCAAyC"}
@@ -1,10 +1,30 @@
1
- import "../../gen/transfer/v1/internal_transfer_pb.js";
1
+ import { ErrorCode } from "../../gen/transfer/v1/internal_transfer_pb.js";
2
2
  //#region src/services/internal-transfers/internal-transfers.codecs.ts
3
3
  const InternalTransferDestinationCodec = { inputToProtoCase: {
4
4
  account: "destinationAccountId",
5
5
  subaccount: "destinationSubaccountId",
6
6
  smartAccountAddress: "destinationSmartAccountAddress"
7
7
  } };
8
+ const InternalTransferBatchStatusCodec = { protoToOutput: {
9
+ [0]: "unspecified",
10
+ [1]: "submitted",
11
+ [2]: "refused"
12
+ } };
13
+ const InternalTransferBatchLegStatusCodec = { protoToOutput: {
14
+ [0]: "unspecified",
15
+ [1]: "accepted",
16
+ [2]: "pending",
17
+ [3]: "refused",
18
+ [4]: "not_submitted"
19
+ } };
20
+ /**
21
+ * Names a transfer error code like the `internal_transfer` error detail does. A code newer
22
+ * than this build reads as `"UNSPECIFIED"` instead of failing the whole response.
23
+ */
24
+ function internalTransferErrorCodeName(code) {
25
+ const name = ErrorCode[code];
26
+ return typeof name === "string" ? name : "UNSPECIFIED";
27
+ }
8
28
  const InternalTransferStatusCodec = { protoToOutput: {
9
29
  [0]: "unspecified",
10
30
  [1]: "accepted",
@@ -12,6 +32,6 @@ const InternalTransferStatusCodec = { protoToOutput: {
12
32
  [3]: "failed"
13
33
  } };
14
34
  //#endregion
15
- export { InternalTransferDestinationCodec, InternalTransferStatusCodec };
35
+ export { InternalTransferBatchLegStatusCodec, InternalTransferBatchStatusCodec, InternalTransferDestinationCodec, InternalTransferStatusCodec, internalTransferErrorCodeName };
16
36
 
17
37
  //# sourceMappingURL=internal-transfers.codecs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal-transfers.codecs.js","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport type { ProtoToOutput } from \"../../utils/types.js\";\n\nexport const INTERNAL_TRANSFER_DESTINATION_TYPE_VALUES = [\n \"account\",\n \"subaccount\",\n \"smartAccountAddress\",\n] as const;\n\nexport type InternalTransferDestinationType =\n (typeof INTERNAL_TRANSFER_DESTINATION_TYPE_VALUES)[number];\n\nexport const InternalTransferDestinationCodec = {\n inputToProtoCase: {\n account: \"destinationAccountId\",\n subaccount: \"destinationSubaccountId\",\n smartAccountAddress: \"destinationSmartAccountAddress\",\n } satisfies Record<\n InternalTransferDestinationType,\n \"destinationAccountId\" | \"destinationSubaccountId\" | \"destinationSmartAccountAddress\"\n >,\n} as const;\n\nexport const INTERNAL_TRANSFER_STATUS_VALUES = [\"accepted\", \"rejected\", \"failed\"] as const;\n\nexport type InternalTransferStatus = (typeof INTERNAL_TRANSFER_STATUS_VALUES)[number];\n\nexport const InternalTransferStatusCodec = {\n protoToOutput: {\n [Proto.InternalTransferStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.InternalTransferStatus.ACCEPTED]: \"accepted\",\n [Proto.InternalTransferStatus.REJECTED]: \"rejected\",\n [Proto.InternalTransferStatus.FAILED]: \"failed\",\n } satisfies ProtoToOutput<Proto.InternalTransferStatus, InternalTransferStatus>,\n} as const;\n"],"mappings":";;AAYA,MAAa,mCAAmC,EAC5C,kBAAkB;CACd,SAAS;CACT,YAAY;CACZ,qBAAqB;AACzB,EAIJ;AAMA,MAAa,8BAA8B,EACvC,eAAe;EACiC,IAAA;EACH,IAAA;EACA,IAAA;EACF,IAAA;AAC3C,EACJ"}
1
+ {"version":3,"file":"internal-transfers.codecs.js","names":["Proto.ErrorCode"],"sources":["../../../src/services/internal-transfers/internal-transfers.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport type { ProtoToOutput } from \"../../utils/types.js\";\n\nexport const INTERNAL_TRANSFER_DESTINATION_TYPE_VALUES = [\n \"account\",\n \"subaccount\",\n \"smartAccountAddress\",\n] as const;\n\nexport type InternalTransferDestinationType =\n (typeof INTERNAL_TRANSFER_DESTINATION_TYPE_VALUES)[number];\n\nexport const InternalTransferDestinationCodec = {\n inputToProtoCase: {\n account: \"destinationAccountId\",\n subaccount: \"destinationSubaccountId\",\n smartAccountAddress: \"destinationSmartAccountAddress\",\n } satisfies Record<\n InternalTransferDestinationType,\n \"destinationAccountId\" | \"destinationSubaccountId\" | \"destinationSmartAccountAddress\"\n >,\n} as const;\n\nexport const INTERNAL_TRANSFER_STATUS_VALUES = [\"accepted\", \"rejected\", \"failed\"] as const;\n\nexport type InternalTransferStatus = (typeof INTERNAL_TRANSFER_STATUS_VALUES)[number];\n\nexport const INTERNAL_TRANSFER_BATCH_STATUS_VALUES = [\"submitted\", \"refused\"] as const;\n\n/** `\"submitted\"`: every leg passed its checks and ran; `\"refused\"`: no leg ran and nothing moved. */\nexport type InternalTransferBatchStatus = (typeof INTERNAL_TRANSFER_BATCH_STATUS_VALUES)[number];\n\nexport const InternalTransferBatchStatusCodec = {\n protoToOutput: {\n [Proto.InternalTransferBatchStatus.BATCH_STATUS_UNSPECIFIED]: \"unspecified\",\n [Proto.InternalTransferBatchStatus.BATCH_SUBMITTED]: \"submitted\",\n [Proto.InternalTransferBatchStatus.BATCH_REFUSED]: \"refused\",\n } satisfies ProtoToOutput<Proto.InternalTransferBatchStatus, InternalTransferBatchStatus>,\n} as const;\n\nexport const INTERNAL_TRANSFER_BATCH_LEG_STATUS_VALUES = [\n \"accepted\",\n \"pending\",\n \"refused\",\n \"not_submitted\",\n] as const;\n\n/**\n * `\"pending\"`: the outcome is not known yet; read it with `internalTransfers.get` by the leg's\n * `requestId`, or retry the batch with the same idempotency key. A retry also runs `\"refused\"`\n * and `\"not_submitted\"` legs again.\n */\nexport type InternalTransferBatchLegStatus =\n (typeof INTERNAL_TRANSFER_BATCH_LEG_STATUS_VALUES)[number];\n\nexport const InternalTransferBatchLegStatusCodec = {\n protoToOutput: {\n [Proto.InternalTransferBatchLegStatus.LEG_STATUS_UNSPECIFIED]: \"unspecified\",\n [Proto.InternalTransferBatchLegStatus.LEG_ACCEPTED]: \"accepted\",\n [Proto.InternalTransferBatchLegStatus.LEG_PENDING]: \"pending\",\n [Proto.InternalTransferBatchLegStatus.LEG_REFUSED]: \"refused\",\n [Proto.InternalTransferBatchLegStatus.LEG_NOT_SUBMITTED]: \"not_submitted\",\n } satisfies ProtoToOutput<Proto.InternalTransferBatchLegStatus, InternalTransferBatchLegStatus>,\n} as const;\n\nexport type InternalTransferErrorCode = keyof typeof Proto.ErrorCode;\n\n/**\n * Names a transfer error code like the `internal_transfer` error detail does. A code newer\n * than this build reads as `\"UNSPECIFIED\"` instead of failing the whole response.\n */\nexport function internalTransferErrorCodeName(code: number): InternalTransferErrorCode {\n const name: unknown = Proto.ErrorCode[code];\n return typeof name === \"string\" ? (name as InternalTransferErrorCode) : \"UNSPECIFIED\";\n}\n\nexport const InternalTransferStatusCodec = {\n protoToOutput: {\n [Proto.InternalTransferStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.InternalTransferStatus.ACCEPTED]: \"accepted\",\n [Proto.InternalTransferStatus.REJECTED]: \"rejected\",\n [Proto.InternalTransferStatus.FAILED]: \"failed\",\n } satisfies ProtoToOutput<Proto.InternalTransferStatus, InternalTransferStatus>,\n} as const;\n"],"mappings":";;AAYA,MAAa,mCAAmC,EAC5C,kBAAkB;CACd,SAAS;CACT,YAAY;CACZ,qBAAqB;AACzB,EAIJ;AAWA,MAAa,mCAAmC,EAC5C,eAAe;EACmD,IAAA;EACT,IAAA;EACF,IAAA;AACvD,EACJ;AAiBA,MAAa,sCAAsC,EAC/C,eAAe;EACoD,IAAA;EACV,IAAA;EACD,IAAA;EACA,IAAA;EACM,IAAA;AAC9D,EACJ;;;;;AAQA,SAAgB,8BAA8B,MAAyC;CACnF,MAAM,OAAgBA,UAAgB;CACtC,OAAO,OAAO,SAAS,WAAY,OAAqC;AAC5E;AAEA,MAAa,8BAA8B,EACvC,eAAe;EACiC,IAAA;EACH,IAAA;EACA,IAAA;EACF,IAAA;AAC3C,EACJ"}
@@ -2,7 +2,7 @@ import { AuthApiTransports } from "../../shared/transports.js";
2
2
  import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js";
3
3
  import { SubaccountResolver } from "../subaccount-resolver.js";
4
4
  import { SdkScales } from "../../shared/decimal-surface.js";
5
- import { CreateInternalTransferInput, CreateInternalTransferResult, GetInternalTransferInput, GetInternalTransferResult } from "./internal-transfers.schemas.js";
5
+ import { BatchCreateInternalTransfersInput, BatchCreateInternalTransfersResult, CreateInternalTransferInput, CreateInternalTransferResult, GetInternalTransferInput, GetInternalTransferResult } from "./internal-transfers.schemas.js";
6
6
  //#region src/services/internal-transfers/internal-transfers.d.ts
7
7
  /**
8
8
  * Creates and reads authenticated Trading-to-Trading internal transfer requests.
@@ -14,10 +14,22 @@ declare class InternalTransfersService {
14
14
  * Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, the lifecycle `flowId`, resolved destination, and status. Rejections and failures, such as insufficient funds or a missing step-up, raise errors instead of returning a result.
15
15
  */
16
16
  create(input: CreateInternalTransferInput, options?: PolyesterMutationOptions): Promise<CreateInternalTransferResult>;
17
+ /**
18
+ * Submits up to 10 transfers under one idempotency key and one MFA check. Every leg passes
19
+ * the same checks as `create` first; if one fails, the batch is `"refused"`: nothing moves,
20
+ * no step-up is used, the failing legs carry their `errorCode` and the rest are
21
+ * `"not_submitted"`. Otherwise the legs run in order and are not atomic: a leg can be
22
+ * `"refused"`, for example for insufficient balance, after earlier legs were accepted. Read
23
+ * each leg's `status`; a `"pending"` leg is like a timed-out `create`: read it with `get` by
24
+ * its `requestId`, or retry the batch with the same key and legs. Recent MFA covers the root
25
+ * owner moving funds between its own accounts or to allowlisted destinations; any other leg
26
+ * needs one fresh step-up for the whole batch.
27
+ */
28
+ batchCreate(input: BatchCreateInternalTransfersInput, options?: PolyesterMutationOptions): Promise<BatchCreateInternalTransfersResult>;
17
29
  /**
18
30
  * Reads an accepted transfer of the resolved source account by exactly one of `requestId` or
19
31
  * `transferId`, and returns both IDs, the lifecycle `flowId` and the acceptance time. Use it
20
- * to reconcile a transfer without resubmitting it; pass `flowId` to `lifecycle.getFlow`,
32
+ * to reconcile a transfer without resubmitting it; pass `flowId` to `lifecycle.getAccountFlow`,
21
33
  * whose ledger settlement step carries the transfer ID. An unknown, pending or inaccessible
22
34
  * transfer is a `ResourceNotFoundError`, including briefly after a delegate is granted access.
23
35
  * Session JWT only; API keys are refused. Moves no money and needs no step-up.
@@ -1 +1 @@
1
- {"version":3,"file":"internal-transfers.d.ts","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.ts"],"mappings":";;;;;;;;;cA0Ba;;EAQL,YAAA,YAAY,mBACZ,UAAU,gCACV,QAAQ;;;;EAYN,OACF,OAAO,6BACP,UAAU,2BACX,QAAQ;;;;;;;;;EAmBL,IACF,OAAO,0BACP,UAAU,0BACX,QAAQ"}
1
+ {"version":3,"file":"internal-transfers.d.ts","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.ts"],"mappings":";;;;;;;;;cAkCa;;EASL,YAAA,YAAY,mBACZ,UAAU,gCACV,QAAQ;;;;EAaN,OACF,OAAO,6BACP,UAAU,2BACX,QAAQ;;;;;;;;;;;;EAsBL,YACF,OAAO,mCACP,UAAU,2BACX,QAAQ;;;;;;;;;EAwBL,IACF,OAAO,0BACP,UAAU,0BACX,QAAQ"}
@@ -2,8 +2,8 @@ import { InternalTransferService } from "../../gen/transfer/v1/internal_transfer
2
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
- import { resolveAccountScopedInput } from "../subaccount-resolver.js";
6
- import { GetInternalTransferInputSchema, GetInternalTransferResultSchema, createCreateInternalTransferInputSchema, createCreateInternalTransferResultSchema } from "./internal-transfers.schemas.js";
5
+ import { resolveAccountScope, resolveAccountScopedInput } from "../subaccount-resolver.js";
6
+ import { BatchCreateInternalTransfersResultSchema, GetInternalTransferInputSchema, GetInternalTransferResultSchema, createBatchCreateInternalTransfersInputSchema, createCreateInternalTransferInputSchema, createCreateInternalTransferResultSchema } from "./internal-transfers.schemas.js";
7
7
  import { createClient } from "@connectrpc/connect";
8
8
  //#region src/services/internal-transfers/internal-transfers.ts
9
9
  /**
@@ -15,12 +15,14 @@ var InternalTransfersService = class {
15
15
  #scales;
16
16
  #inputSchema;
17
17
  #resultSchema;
18
+ #batchInputSchema;
18
19
  constructor(transports, resolver, scales) {
19
20
  this.#client = createClient(InternalTransferService, transports.authApi);
20
21
  this.#resolver = resolver;
21
22
  this.#scales = scales;
22
23
  this.#inputSchema = createCreateInternalTransferInputSchema(scales);
23
24
  this.#resultSchema = createCreateInternalTransferResultSchema();
25
+ this.#batchInputSchema = createBatchCreateInternalTransfersInputSchema(scales);
24
26
  }
25
27
  /**
26
28
  * Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, the lifecycle `flowId`, resolved destination, and status. Rejections and failures, such as insufficient funds or a missing step-up, raise errors instead of returning a result.
@@ -33,9 +35,33 @@ var InternalTransfersService = class {
33
35
  return parse(this.#resultSchema, res);
34
36
  }
35
37
  /**
38
+ * Submits up to 10 transfers under one idempotency key and one MFA check. Every leg passes
39
+ * the same checks as `create` first; if one fails, the batch is `"refused"`: nothing moves,
40
+ * no step-up is used, the failing legs carry their `errorCode` and the rest are
41
+ * `"not_submitted"`. Otherwise the legs run in order and are not atomic: a leg can be
42
+ * `"refused"`, for example for insufficient balance, after earlier legs were accepted. Read
43
+ * each leg's `status`; a `"pending"` leg is like a timed-out `create`: read it with `get` by
44
+ * its `requestId`, or retry the batch with the same key and legs. Recent MFA covers the root
45
+ * owner moving funds between its own accounts or to allowlisted destinations; any other leg
46
+ * needs one fresh step-up for the whole batch.
47
+ */
48
+ async batchCreate(input, options) {
49
+ await this.#scales.ready();
50
+ const legs = Array.isArray(input?.legs) ? input.legs.map((leg) => ({
51
+ ...leg,
52
+ account: resolveAccountScope(leg?.account, this.#resolver)
53
+ })) : input?.legs;
54
+ const request = parse(this.#batchInputSchema, {
55
+ ...input,
56
+ legs
57
+ });
58
+ const res = await this.#client.batchCreateInternalTransfers(request, toConnectCallOptions(options));
59
+ return parse(BatchCreateInternalTransfersResultSchema, res);
60
+ }
61
+ /**
36
62
  * Reads an accepted transfer of the resolved source account by exactly one of `requestId` or
37
63
  * `transferId`, and returns both IDs, the lifecycle `flowId` and the acceptance time. Use it
38
- * to reconcile a transfer without resubmitting it; pass `flowId` to `lifecycle.getFlow`,
64
+ * to reconcile a transfer without resubmitting it; pass `flowId` to `lifecycle.getAccountFlow`,
39
65
  * whose ledger settlement step carries the transfer ID. An unknown, pending or inaccessible
40
66
  * transfer is a `ResourceNotFoundError`, including briefly after a delegate is granted access.
41
67
  * Session JWT only; API keys are refused. Moves no money and needs no step-up.
@@ -1 +1 @@
1
- {"version":3,"file":"internal-transfers.js","names":["#client","Proto.InternalTransferService","#resolver","#scales","#inputSchema","#resultSchema"],"sources":["../../../src/services/internal-transfers/internal-transfers.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n createCreateInternalTransferInputSchema,\n createCreateInternalTransferResultSchema,\n type CreateInternalTransferInput,\n type CreateInternalTransferResult,\n GetInternalTransferInputSchema,\n GetInternalTransferResultSchema,\n type GetInternalTransferInput,\n type GetInternalTransferResult,\n} from \"./internal-transfers.schemas.js\";\n\n/**\n * Creates and reads authenticated Trading-to-Trading internal transfer requests.\n */\nexport class InternalTransfersService {\n #client: Client<typeof Proto.InternalTransferService>;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #inputSchema: ReturnType<typeof createCreateInternalTransferInputSchema>;\n #resultSchema: ReturnType<typeof createCreateInternalTransferResultSchema>;\n\n constructor(\n transports: AuthApiTransports,\n resolver: SubaccountResolver | undefined,\n scales: SdkScales,\n ) {\n this.#client = createClient(Proto.InternalTransferService, transports.authApi);\n this.#resolver = resolver;\n this.#scales = scales;\n this.#inputSchema = createCreateInternalTransferInputSchema(scales);\n this.#resultSchema = createCreateInternalTransferResultSchema();\n }\n\n /**\n * Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, the lifecycle `flowId`, resolved destination, and status. Rejections and failures, such as insufficient funds or a missing step-up, raise errors instead of returning a result.\n */\n async create(\n input: CreateInternalTransferInput,\n options?: PolyesterMutationOptions,\n ): Promise<CreateInternalTransferResult> {\n await this.#scales.ready();\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(this.#inputSchema, resolvedInput);\n const res = await this.#client.createInternalTransfer(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return parse(this.#resultSchema, res);\n }\n\n /**\n * Reads an accepted transfer of the resolved source account by exactly one of `requestId` or\n * `transferId`, and returns both IDs, the lifecycle `flowId` and the acceptance time. Use it\n * to reconcile a transfer without resubmitting it; pass `flowId` to `lifecycle.getFlow`,\n * whose ledger settlement step carries the transfer ID. An unknown, pending or inaccessible\n * transfer is a `ResourceNotFoundError`, including briefly after a delegate is granted access.\n * Session JWT only; API keys are refused. Moves no money and needs no step-up.\n */\n async get(\n input: GetInternalTransferInput,\n options?: PolyesterRequestOptions,\n ): Promise<GetInternalTransferResult> {\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(GetInternalTransferInputSchema, resolvedInput);\n const res = await this.#client.getInternalTransfer(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(GetInternalTransferResultSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;;;AA0BA,IAAa,2BAAb,MAAsC;CAClC;CACA;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,QACF;EACE,KAAKA,UAAU,aAAaC,yBAA+B,WAAW,OAAO;EAC7E,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,eAAe,wCAAwC,MAAM;EAClE,KAAKC,gBAAgB,yCAAyC;CAClE;;;;CAKA,MAAM,OACF,OACA,SACqC;EACrC,MAAM,KAAKF,QAAQ,MAAM;EACzB,MAAM,gBAAgB,0BAA0B,OAAO,KAAKD,SAAS;EACrE,MAAM,iBAAiB,MAAM,KAAKE,cAAc,aAAa;EAC7D,MAAM,MAAM,MAAM,KAAKJ,QAAQ,uBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,KAAKK,eAAe,GAAG;CACxC;;;;;;;;;CAUA,MAAM,IACF,OACA,SACkC;EAClC,MAAM,gBAAgB,0BAA0B,OAAO,KAAKH,SAAS;EACrE,MAAM,UAAU,MAAM,gCAAgC,aAAa;EACnE,MAAM,MAAM,MAAM,KAAKF,QAAQ,oBAC3B,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,iCAAiC,GAAG;CACrD;AACJ"}
1
+ {"version":3,"file":"internal-transfers.js","names":["#client","Proto.InternalTransferService","#resolver","#scales","#inputSchema","#resultSchema","#batchInputSchema"],"sources":["../../../src/services/internal-transfers/internal-transfers.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport {\n type SubaccountResolver,\n resolveAccountScope,\n resolveAccountScopedInput,\n} from \"../subaccount-resolver.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n BatchCreateInternalTransfersResultSchema,\n createBatchCreateInternalTransfersInputSchema,\n type BatchCreateInternalTransfersInput,\n type BatchCreateInternalTransfersResult,\n createCreateInternalTransferInputSchema,\n createCreateInternalTransferResultSchema,\n type CreateInternalTransferInput,\n type CreateInternalTransferResult,\n GetInternalTransferInputSchema,\n GetInternalTransferResultSchema,\n type GetInternalTransferInput,\n type GetInternalTransferResult,\n} from \"./internal-transfers.schemas.js\";\n\n/**\n * Creates and reads authenticated Trading-to-Trading internal transfer requests.\n */\nexport class InternalTransfersService {\n #client: Client<typeof Proto.InternalTransferService>;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #inputSchema: ReturnType<typeof createCreateInternalTransferInputSchema>;\n #resultSchema: ReturnType<typeof createCreateInternalTransferResultSchema>;\n #batchInputSchema: ReturnType<typeof createBatchCreateInternalTransfersInputSchema>;\n\n constructor(\n transports: AuthApiTransports,\n resolver: SubaccountResolver | undefined,\n scales: SdkScales,\n ) {\n this.#client = createClient(Proto.InternalTransferService, transports.authApi);\n this.#resolver = resolver;\n this.#scales = scales;\n this.#inputSchema = createCreateInternalTransferInputSchema(scales);\n this.#resultSchema = createCreateInternalTransferResultSchema();\n this.#batchInputSchema = createBatchCreateInternalTransfersInputSchema(scales);\n }\n\n /**\n * Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, the lifecycle `flowId`, resolved destination, and status. Rejections and failures, such as insufficient funds or a missing step-up, raise errors instead of returning a result.\n */\n async create(\n input: CreateInternalTransferInput,\n options?: PolyesterMutationOptions,\n ): Promise<CreateInternalTransferResult> {\n await this.#scales.ready();\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(this.#inputSchema, resolvedInput);\n const res = await this.#client.createInternalTransfer(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return parse(this.#resultSchema, res);\n }\n\n /**\n * Submits up to 10 transfers under one idempotency key and one MFA check. Every leg passes\n * the same checks as `create` first; if one fails, the batch is `\"refused\"`: nothing moves,\n * no step-up is used, the failing legs carry their `errorCode` and the rest are\n * `\"not_submitted\"`. Otherwise the legs run in order and are not atomic: a leg can be\n * `\"refused\"`, for example for insufficient balance, after earlier legs were accepted. Read\n * each leg's `status`; a `\"pending\"` leg is like a timed-out `create`: read it with `get` by\n * its `requestId`, or retry the batch with the same key and legs. Recent MFA covers the root\n * owner moving funds between its own accounts or to allowlisted destinations; any other leg\n * needs one fresh step-up for the whole batch.\n */\n async batchCreate(\n input: BatchCreateInternalTransfersInput,\n options?: PolyesterMutationOptions,\n ): Promise<BatchCreateInternalTransfersResult> {\n await this.#scales.ready();\n const legs = Array.isArray(input?.legs)\n ? input.legs.map((leg) => ({\n ...leg,\n account: resolveAccountScope(leg?.account, this.#resolver),\n }))\n : input?.legs;\n const request = parse(this.#batchInputSchema, { ...input, legs });\n const res = await this.#client.batchCreateInternalTransfers(\n request,\n toConnectCallOptions(options),\n );\n return parse(BatchCreateInternalTransfersResultSchema, res);\n }\n\n /**\n * Reads an accepted transfer of the resolved source account by exactly one of `requestId` or\n * `transferId`, and returns both IDs, the lifecycle `flowId` and the acceptance time. Use it\n * to reconcile a transfer without resubmitting it; pass `flowId` to `lifecycle.getAccountFlow`,\n * whose ledger settlement step carries the transfer ID. An unknown, pending or inaccessible\n * transfer is a `ResourceNotFoundError`, including briefly after a delegate is granted access.\n * Session JWT only; API keys are refused. Moves no money and needs no step-up.\n */\n async get(\n input: GetInternalTransferInput,\n options?: PolyesterRequestOptions,\n ): Promise<GetInternalTransferResult> {\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(GetInternalTransferInputSchema, resolvedInput);\n const res = await this.#client.getInternalTransfer(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(GetInternalTransferResultSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;;;AAkCA,IAAa,2BAAb,MAAsC;CAClC;CACA;CACA;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,QACF;EACE,KAAKA,UAAU,aAAaC,yBAA+B,WAAW,OAAO;EAC7E,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,eAAe,wCAAwC,MAAM;EAClE,KAAKC,gBAAgB,yCAAyC;EAC9D,KAAKC,oBAAoB,8CAA8C,MAAM;CACjF;;;;CAKA,MAAM,OACF,OACA,SACqC;EACrC,MAAM,KAAKH,QAAQ,MAAM;EACzB,MAAM,gBAAgB,0BAA0B,OAAO,KAAKD,SAAS;EACrE,MAAM,iBAAiB,MAAM,KAAKE,cAAc,aAAa;EAC7D,MAAM,MAAM,MAAM,KAAKJ,QAAQ,uBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,KAAKK,eAAe,GAAG;CACxC;;;;;;;;;;;;CAaA,MAAM,YACF,OACA,SAC2C;EAC3C,MAAM,KAAKF,QAAQ,MAAM;EACzB,MAAM,OAAO,MAAM,QAAQ,OAAO,IAAI,IAChC,MAAM,KAAK,KAAK,SAAS;GACrB,GAAG;GACH,SAAS,oBAAoB,KAAK,SAAS,KAAKD,SAAS;EAC7D,EAAE,IACF,OAAO;EACb,MAAM,UAAU,MAAM,KAAKI,mBAAmB;GAAE,GAAG;GAAO;EAAK,CAAC;EAChE,MAAM,MAAM,MAAM,KAAKN,QAAQ,6BAC3B,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,0CAA0C,GAAG;CAC9D;;;;;;;;;CAUA,MAAM,IACF,OACA,SACkC;EAClC,MAAM,gBAAgB,0BAA0B,OAAO,KAAKE,SAAS;EACrE,MAAM,UAAU,MAAM,gCAAgC,aAAa;EACnE,MAAM,MAAM,MAAM,KAAKF,QAAQ,oBAC3B,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,iCAAiC,GAAG;CACrD;AACJ"}