@polyester/sdk 0.7.0 → 0.8.0

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 (69) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/gen/auth/v1/api_keys_pb.d.ts +1 -1
  3. package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
  4. package/dist/gen/auth/v1/policies_pb.d.ts +47 -337
  5. package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
  6. package/dist/gen/auth/v1/policies_pb.js +49 -73
  7. package/dist/gen/auth/v1/policies_pb.js.map +1 -1
  8. package/dist/gen/orders/v1/orders_pb.d.ts +32 -1
  9. package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
  10. package/dist/gen/orders/v1/orders_pb.js +25 -1
  11. package/dist/gen/orders/v1/orders_pb.js.map +1 -1
  12. package/dist/gen/triggers/v1/triggers_pb.d.ts +22 -2
  13. package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
  14. package/dist/gen/triggers/v1/triggers_pb.js +7 -1
  15. package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
  16. package/dist/index.d.ts +3 -3
  17. package/dist/services/lifecycle/lifecycle.schemas.d.ts +42 -42
  18. package/dist/services/orders/order-errors.schemas.d.ts +1 -1
  19. package/dist/services/orders/orders-batch.schemas.d.ts +20 -20
  20. package/dist/services/orders/orders-input.schemas.d.ts +4 -4
  21. package/dist/services/orders/orders-modify.schemas.d.ts +3 -2
  22. package/dist/services/orders/orders-modify.schemas.d.ts.map +1 -1
  23. package/dist/services/orders/orders-modify.schemas.js +5 -3
  24. package/dist/services/orders/orders-modify.schemas.js.map +1 -1
  25. package/dist/services/orders/orders-output.schemas.d.ts +6 -6
  26. package/dist/services/orders/orders.d.ts +1 -1
  27. package/dist/services/orders/orders.js +1 -1
  28. package/dist/services/orders/orders.js.map +1 -1
  29. package/dist/services/policies/api-key-policies/api-key-policies.d.ts +2 -2
  30. package/dist/services/policies/api-key-policies/api-key-policies.js +2 -2
  31. package/dist/services/policies/api-key-policies/api-key-policies.js.map +1 -1
  32. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -140
  33. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts.map +1 -1
  34. package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +5 -53
  35. package/dist/services/policies/api-key-policies/api-key-policies.schemas.js.map +1 -1
  36. package/dist/services/policies/shared.codecs.js +4 -12
  37. package/dist/services/policies/shared.codecs.js.map +1 -1
  38. package/dist/services/policies/shared.d.ts +1 -1
  39. package/dist/services/policies/shared.d.ts.map +1 -1
  40. package/dist/services/policies/shared.js +3 -11
  41. package/dist/services/policies/shared.js.map +1 -1
  42. package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts +1 -1
  43. package/dist/services/policies/subaccount-policies/subaccount-policies.js +1 -1
  44. package/dist/services/policies/subaccount-policies/subaccount-policies.js.map +1 -1
  45. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +10 -206
  46. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts.map +1 -1
  47. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +9 -115
  48. package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
  49. package/dist/services/subaccounts/subaccounts.schemas.d.ts +5 -5
  50. package/dist/services/triggers/trigger-input.schemas.d.ts +14 -7
  51. package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
  52. package/dist/services/triggers/trigger-input.schemas.js +13 -3
  53. package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
  54. package/dist/services/triggers/triggers-output.schemas.d.ts +15 -15
  55. package/dist/services/triggers/triggers.codecs.js +6 -3
  56. package/dist/services/triggers/triggers.codecs.js.map +1 -1
  57. package/dist/services/triggers/triggers.d.ts +2 -2
  58. package/dist/services/triggers/triggers.js +2 -2
  59. package/dist/services/triggers/triggers.js.map +1 -1
  60. package/dist/services/triggers/triggers.types.d.ts +3 -3
  61. package/dist/shared/schemas.js +2 -2
  62. package/dist/shared/schemas.js.map +1 -1
  63. package/dist/shared/transports.js +6 -1
  64. package/dist/shared/transports.js.map +1 -1
  65. package/dist/shared/wire-bounds.js +3 -1
  66. package/dist/shared/wire-bounds.js.map +1 -1
  67. package/dist/utils/numbers.js +1 -10
  68. package/dist/utils/numbers.js.map +1 -1
  69. package/package.json +1 -1
@@ -74,7 +74,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
74
74
  }, undefined>, undefined>;
75
75
  readonly origin: v.OptionalSchema<v.ObjectSchema<{
76
76
  readonly scope: v.SchemaWithPipe<readonly [v.EnumSchema<typeof OrderOriginScope, undefined>, v.TransformAction<OrderOriginScope, "unspecified" | "direct" | "attached_risk" | "standalone_trigger" | "system">]>;
77
- readonly triggerType: v.SchemaWithPipe<readonly [v.EnumSchema<typeof OrderTriggerType, undefined>, v.TransformAction<OrderTriggerType, "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop">]>;
77
+ readonly triggerType: v.SchemaWithPipe<readonly [v.EnumSchema<typeof OrderTriggerType, undefined>, v.TransformAction<OrderTriggerType, "unspecified" | "stop_loss" | "take_profit" | "trailing_stop" | "twap" | "ladder">]>;
78
78
  readonly triggerId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
79
79
  readonly parentOrderId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
80
80
  readonly childSeq: v.NumberSchema<undefined>;
@@ -155,7 +155,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
155
155
  } | undefined;
156
156
  origin?: {
157
157
  scope: "unspecified" | "direct" | "attached_risk" | "standalone_trigger" | "system";
158
- triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
158
+ triggerType: "unspecified" | "stop_loss" | "take_profit" | "trailing_stop" | "twap" | "ladder";
159
159
  triggerId?: string | undefined;
160
160
  parentOrderId?: string | undefined;
161
161
  childSeq: number;
@@ -174,7 +174,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
174
174
  marketClientRefPrice?: string | undefined;
175
175
  origin?: {
176
176
  scope: "unspecified" | "direct" | "attached_risk" | "standalone_trigger" | "system";
177
- triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
177
+ triggerType: "unspecified" | "stop_loss" | "take_profit" | "trailing_stop" | "twap" | "ladder";
178
178
  triggerId?: string | undefined;
179
179
  parentOrderId?: string | undefined;
180
180
  childSeq: number;
@@ -348,7 +348,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
348
348
  }, undefined>, undefined>;
349
349
  readonly origin: v.OptionalSchema<v.ObjectSchema<{
350
350
  readonly scope: v.SchemaWithPipe<readonly [v.EnumSchema<typeof OrderOriginScope, undefined>, v.TransformAction<OrderOriginScope, "unspecified" | "direct" | "attached_risk" | "standalone_trigger" | "system">]>;
351
- readonly triggerType: v.SchemaWithPipe<readonly [v.EnumSchema<typeof OrderTriggerType, undefined>, v.TransformAction<OrderTriggerType, "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop">]>;
351
+ readonly triggerType: v.SchemaWithPipe<readonly [v.EnumSchema<typeof OrderTriggerType, undefined>, v.TransformAction<OrderTriggerType, "unspecified" | "stop_loss" | "take_profit" | "trailing_stop" | "twap" | "ladder">]>;
352
352
  readonly triggerId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
353
353
  readonly parentOrderId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
354
354
  readonly childSeq: v.NumberSchema<undefined>;
@@ -429,7 +429,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
429
429
  } | undefined;
430
430
  origin?: {
431
431
  scope: "unspecified" | "direct" | "attached_risk" | "standalone_trigger" | "system";
432
- triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
432
+ triggerType: "unspecified" | "stop_loss" | "take_profit" | "trailing_stop" | "twap" | "ladder";
433
433
  triggerId?: string | undefined;
434
434
  parentOrderId?: string | undefined;
435
435
  childSeq: number;
@@ -448,7 +448,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
448
448
  marketClientRefPrice?: string | undefined;
449
449
  origin?: {
450
450
  scope: "unspecified" | "direct" | "attached_risk" | "standalone_trigger" | "system";
451
- triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
451
+ triggerType: "unspecified" | "stop_loss" | "take_profit" | "trailing_stop" | "twap" | "ladder";
452
452
  triggerId?: string | undefined;
453
453
  parentOrderId?: string | undefined;
454
454
  childSeq: number;
@@ -55,7 +55,7 @@ declare class OrdersService {
55
55
  */
56
56
  batchCancel(input: BatchCancelOrdersInput, options?: PolyesterMutationOptions): Promise<BatchCancelOrdersResult>;
57
57
  /**
58
- * Applies a price, quantity, client id, or attached-risk patch to one open order using the backend modify behavior policy. A requestId is generated when omitted; provide a stable value when retrying the same logical modification.
58
+ * Applies a price, quantity, client id, or attached-risk patch to one open order. The symbol ID routes policy checks and quantity scaling. A requestId is generated when omitted; provide a stable value when retrying the same logical modification.
59
59
  */
60
60
  modify(input: ModifyOrderInput, options?: PolyesterMutationOptions): Promise<ModifyOrderResult>;
61
61
  /**
@@ -149,7 +149,7 @@ var OrdersService = class {
149
149
  return result;
150
150
  }
151
151
  /**
152
- * Applies a price, quantity, client id, or attached-risk patch to one open order using the backend modify behavior policy. A requestId is generated when omitted; provide a stable value when retrying the same logical modification.
152
+ * Applies a price, quantity, client id, or attached-risk patch to one open order. The symbol ID routes policy checks and quantity scaling. A requestId is generated when omitted; provide a stable value when retrying the same logical modification.
153
153
  */
154
154
  async modify(input, options) {
155
155
  await this.#scales.ready();
@@ -1 +1 @@
1
- {"version":3,"file":"orders.js","names":["#readClient","ProtoRead.OrdersReadService","#writeClient","ProtoWrite.OrdersService","#realtime","#resolver","#scales","#orderSchema","#orderDetailsSchema","#newOrderInputSchema","#modifyOrderInputSchema","#batchCreateOrdersInputSchema","ProtoRead.OrderSchema"],"sources":["../../../src/services/orders/orders.ts"],"sourcesContent":["import * as ProtoRead from \"../../gen/orders/v1/orders_read_pb.js\";\nimport * as ProtoWrite from \"../../gen/orders/v1/orders_pb.js\";\nimport { createClient, type Client, type Transport } from \"@connectrpc/connect\";\nimport { publicationHandlerErrorContext } from \"../../shared/subscription-errors.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.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 { PolyesterRealtime } from \"../../realtime/types.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport { createReadyGate, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { getOrderErrorDetail } from \"../../utils/connect-order-errors.js\";\nimport { formatConnectError, isResourceNotFoundError } from \"../../utils/errors.js\";\nimport {\n OpenOrdersInputSchema,\n OrderHistoryInputSchema,\n type NewOrderInput,\n createNewOrderInputSchema,\n CancelOrderInputSchema,\n CancelOrderResultSchema,\n type CancelOrderResult,\n CancelAllOrdersInputSchema,\n CancelAllOrdersResponseSchema,\n type CancelAllOrdersResponse,\n type Order,\n GetOrderDetailsInputSchema,\n createCreateOrderResultSchema,\n createPreviewOrderResultSchema,\n type PreviewOrderResult,\n type ModifyOrderInput,\n assertKnownModifyOrderInputKeys,\n createModifyOrderInputSchema,\n ModifyOrderResultSchema,\n type CreateOrderResult,\n type ModifyOrderResult,\n type OrderDetails,\n createOrderSchema,\n createOrderDetailsSchema,\n CancelAllAfterInputSchema,\n CancelAllAfterResultSchema,\n type CancelAllAfterInput,\n type CancelAllAfterResult,\n BatchCancelOrdersInputSchema,\n BatchCancelOrdersResultSchema,\n type BatchCancelOrdersInput,\n type BatchCancelOrdersResult,\n createBatchCreateOrdersResultSchema,\n type BatchCreateOrdersInput,\n type BatchCreateOrdersResult,\n BatchReplaceOrdersResultSchema,\n type BatchReplaceOrdersInput,\n type BatchReplaceOrdersResult,\n GetBatchReplaceStatusInputSchema,\n GetBatchReplaceStatusResultSchema,\n type GetBatchReplaceStatusInput,\n type GetBatchReplaceStatusResult,\n assertKnownBatchReplaceOrderItemInputKeys,\n createBatchCreateOrdersInputSchema,\n createBatchReplaceOrdersInputSchema,\n} from \"./orders.schemas.js\";\n\nfunction hasKnownOrderSymbol(scales: SdkScales, order: { symbolId: number }): boolean {\n try {\n scales.baseQty(order.symbolId);\n return true;\n } catch {\n return false;\n }\n}\n\nconst MISCLASSIFIED_ORDER_NOT_FOUND_MESSAGE = \"order not found\";\n\nfunction isOrderNotFoundError(error: unknown): boolean {\n return (\n isResourceNotFoundError(error) ||\n getOrderErrorDetail(error)?.code === \"NOT_FOUND\" ||\n formatConnectError(error, \"\").toLowerCase() === MISCLASSIFIED_ORDER_NOT_FOUND_MESSAGE\n );\n}\n\ninterface SubscribeOrdersInput extends BaseSubscribeInput<Order> {\n accountId: string;\n}\n\nfunction createMutationRequestId(): string {\n return (\n globalThis.crypto?.randomUUID?.() ??\n `req_${Date.now()}_${Math.random().toString(16).slice(2)}`\n );\n}\n\nfunction assertBatchResultCount(operation: string, requested: number, returned: number): void {\n if (requested !== returned) {\n throw new Error(\n `${operation} returned ${returned} results for ${requested} requested items.`,\n );\n }\n}\n\n/**\n * Manages account-scoped spot orders across read, write, and realtime order update surfaces.\n */\nexport class OrdersService {\n #readClient: Client<typeof ProtoRead.OrdersReadService>;\n #writeClient: Client<typeof ProtoWrite.OrdersService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #orderSchema: ReturnType<typeof createOrderSchema>;\n #orderDetailsSchema: ReturnType<typeof createOrderDetailsSchema>;\n #newOrderInputSchema: ReturnType<typeof createNewOrderInputSchema>;\n #modifyOrderInputSchema: ReturnType<typeof createModifyOrderInputSchema>;\n #batchCreateOrdersInputSchema: ReturnType<typeof createBatchCreateOrdersInputSchema>;\n\n constructor(\n transport: Transport,\n realtime: PolyesterRealtime,\n resolver: SubaccountResolver | undefined,\n scales: SdkScales,\n ) {\n this.#readClient = createClient(ProtoRead.OrdersReadService, transport);\n this.#writeClient = createClient(ProtoWrite.OrdersService, transport);\n this.#realtime = realtime;\n this.#resolver = resolver;\n this.#scales = scales;\n this.#orderSchema = createOrderSchema(scales);\n this.#orderDetailsSchema = createOrderDetailsSchema(scales);\n this.#newOrderInputSchema = createNewOrderInputSchema(scales);\n this.#modifyOrderInputSchema = createModifyOrderInputSchema(scales);\n this.#batchCreateOrdersInputSchema = createBatchCreateOrdersInputSchema(scales);\n }\n\n /**\n * Returns open orders for the resolved root account or subaccount, with optional symbol, trigger ID, side, pagination, and attached-risk inclusion filters. Results are paginated with a server-determined page size: a single call is not the full set of open orders — keep calling with the returned nextPageToken until it is empty.\n */\n async listOpen(\n input: v.InferInput<typeof OpenOrdersInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<{ orders: Order[]; nextPageToken: string }> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(OpenOrdersInputSchema, resolved);\n const res = await this.#readClient.getOpenOrders(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return {\n orders: parse(\n v.array(this.#orderSchema),\n res.orders.filter((order) => hasKnownOrderSymbol(this.#scales, order)),\n ),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Returns historical orders for the resolved account scope, supporting symbol, trigger ID, side, status, time range, pagination, and attached-risk filters. Results are paginated with the backend nextPageToken.\n */\n async listHistory(\n input: v.InferInput<typeof OrderHistoryInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<{ orders: Order[]; nextPageToken: string }> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(OrderHistoryInputSchema, resolved);\n const res = await this.#readClient.getOrderHistory(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return {\n orders: parse(\n v.array(this.#orderSchema),\n res.orders.filter((order) => hasKnownOrderSymbol(this.#scales, order)),\n ),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Evaluates one complete order intent against current market, policy, risk, and balance state without creating an order, reserving funds, or claiming its client order ID.\n */\n async preview(\n input: NewOrderInput,\n options?: PolyesterRequestOptions,\n ): Promise<PreviewOrderResult> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(this.#newOrderInputSchema, resolved);\n const response = await this.#writeClient.previewOrder(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(createPreviewOrderResultSchema(this.#scales, input.symbol), response);\n }\n\n /**\n * Places a spot order with an explicit market-IOC, limit-GTC, limit-IOC, or limit-FOK execution policy and optional attached risk controls. clientOrderId is the caller-controlled idempotency key and should be reused only for the same logical order.\n */\n async create(\n input: NewOrderInput,\n options?: PolyesterMutationOptions,\n ): Promise<CreateOrderResult> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(this.#newOrderInputSchema, resolved);\n const requestPayload = removeUndefined(validatedInput);\n const res = await this.#writeClient.createOrder(\n requestPayload,\n toConnectCallOptions(options),\n );\n return parse(createCreateOrderResultSchema(this.#scales, input.symbol), res);\n }\n\n /**\n * Places 1–20 spot orders in one best-effort request. Results preserve item order and report admission as accepted or rejected; accepted orders still require lifecycle reconciliation. Supply a clientOrderId for each item and a stable requestId when an ambiguous batch may be retried.\n */\n async batchCreate(\n input: BatchCreateOrdersInput,\n options?: PolyesterMutationOptions,\n ): Promise<BatchCreateOrdersResult> {\n await this.#scales.ready();\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n const request = parse(this.#batchCreateOrdersInputSchema, resolved);\n const response = await this.#writeClient.batchCreateOrders(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n const result = parse(\n createBatchCreateOrdersResultSchema(\n this.#scales,\n input.items.map((item) => item.symbol),\n ),\n response,\n );\n assertBatchResultCount(\"batchCreate\", input.items.length, result.results.length);\n return result;\n }\n\n /**\n * Requests cancellation of one order in the resolved account scope by order id or client order id, with optional symbol routing. The response acknowledges the cancellation request, not the order's final lifecycle state; reconcile through order reads or realtime before releasing local state. A missing target remains a {@link ResourceNotFoundError}; callers performing desired-state cleanup may treat that error as success when the order could already have filled or left the book.\n */\n async cancel(\n input: v.InferInput<typeof CancelOrderInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CancelOrderResult> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n\n const validated = parse(CancelOrderInputSchema, resolved);\n\n const res = await this.#writeClient.cancelOrder(\n {\n key: validated.key,\n symbolId: validated.symbolId,\n subaccountId: validated.subaccountId,\n },\n toConnectCallOptions(options),\n );\n return parse(CancelOrderResultSchema, res);\n }\n\n /**\n * Cancels 1–50 explicit orders in one best-effort request. Results preserve item order and acknowledge cancellation admission rather than final order state. Supply a stable requestId when an ambiguous batch may be retried.\n */\n async batchCancel(\n input: BatchCancelOrdersInput,\n options?: PolyesterMutationOptions,\n ): Promise<BatchCancelOrdersResult> {\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n const request = parse(BatchCancelOrdersInputSchema, resolved);\n const response = await this.#writeClient.batchCancelOrders(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n const result = parse(BatchCancelOrdersResultSchema, response);\n assertBatchResultCount(\"batchCancel\", input.items.length, result.results.length);\n return result;\n }\n\n /**\n * Applies a price, quantity, client id, or attached-risk patch to one open order using the backend modify behavior policy. A requestId is generated when omitted; provide a stable value when retrying the same logical modification.\n */\n async modify(\n input: ModifyOrderInput,\n options?: PolyesterMutationOptions,\n ): Promise<ModifyOrderResult> {\n await this.#scales.ready();\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n assertKnownModifyOrderInputKeys(resolved);\n const validated = parse(this.#modifyOrderInputSchema, resolved);\n const res = await this.#writeClient.modifyOrder(\n removeUndefined(validated),\n toConnectCallOptions(options),\n );\n return parse(ModifyOrderResultSchema, res);\n }\n\n /**\n * Replaces 1–50 same-symbol orders and returns an index-stable durable admission receipt. Reuse requestId only when retrying the same logical batch; use the returned batchRequestId for later status reads.\n */\n async batchReplace(\n input: BatchReplaceOrdersInput,\n options?: PolyesterMutationOptions,\n ): Promise<BatchReplaceOrdersResult> {\n await this.#scales.ready();\n for (const item of input.items) {\n assertKnownBatchReplaceOrderItemInputKeys(item);\n }\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n const request = parse(\n createBatchReplaceOrdersInputSchema(this.#scales, input.symbolId),\n resolved,\n );\n const response = await this.#writeClient.batchReplaceOrders(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n const result = parse(BatchReplaceOrdersResultSchema, response);\n assertBatchResultCount(\"batchReplace\", input.items.length, result.results.length);\n return result;\n }\n\n /**\n * Reads the durable per-item execution status for a batch replacement receipt.\n */\n async getBatchReplaceStatus(\n input: GetBatchReplaceStatusInput,\n options?: PolyesterRequestOptions,\n ): Promise<GetBatchReplaceStatusResult> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(GetBatchReplaceStatusInputSchema, resolved);\n const response = await this.#readClient.getBatchReplaceStatus(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(GetBatchReplaceStatusResultSchema, response);\n }\n\n /**\n * Cancels all matching open orders for the resolved account scope, optionally narrowed by symbol and side, with dry-run preview. A requestId is generated when omitted; provide a stable value when retrying the same logical bulk cancellation.\n */\n async cancelAll(\n input: v.InferInput<typeof CancelAllOrdersInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CancelAllOrdersResponse> {\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n const validated = parse(CancelAllOrdersInputSchema, resolved);\n const res = await this.#writeClient.cancelAllOrders(\n removeUndefined(validated),\n toConnectCallOptions(options),\n );\n return parse(CancelAllOrdersResponseSchema, res);\n }\n\n /**\n * Arms, refreshes, or disables the account dead-man switch. timeoutSec 0 disables it; 10–120 arms it. Generate a new requestId for each deliberate heartbeat, but reuse the same ID when retrying one ambiguous heartbeat.\n */\n async cancelAllAfter(\n input: CancelAllAfterInput,\n options?: PolyesterMutationOptions,\n ): Promise<CancelAllAfterResult> {\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n const request = parse(CancelAllAfterInputSchema, resolved);\n const response = await this.#writeClient.cancelAllAfter(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(CancelAllAfterResultSchema, response);\n }\n\n /**\n * Fetches one order by id or client order id and returns its order, trades, and transfer details when found. Returns null when the requested order is not found.\n */\n async getDetails(\n input: v.InferInput<typeof GetOrderDetailsInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<OrderDetails | null> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(GetOrderDetailsInputSchema, resolved);\n let res: ProtoRead.GetOrderResponse;\n try {\n res = await this.#readClient.getOrder(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n } catch (error) {\n if (isOrderNotFoundError(error)) return null;\n throw error;\n }\n if (!res.order) return null;\n return parse(this.#orderDetailsSchema, res);\n }\n\n /**\n * Subscribes to private order updates on private:spot:orders:{accountId}:proto and emits parsed order records until the returned unsubscribe function is called.\n */\n subscribe(input: SubscribeOrdersInput): () => void {\n const channel = `private:spot:orders:${input.accountId}:proto`;\n const gate = createReadyGate(\n () => this.#scales.ready(),\n (error) => input.onError?.(publicationHandlerErrorContext(channel, error)),\n );\n return this.#realtime.connectProtoChannel({\n channel,\n schema: ProtoRead.OrderSchema,\n onPublication: (data) => {\n gate.run(() => {\n const order = parse(this.#orderSchema, data);\n input.onEvent(order);\n });\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkEA,SAAS,oBAAoB,QAAmB,OAAsC;CAClF,IAAI;EACA,OAAO,QAAQ,MAAM,QAAQ;EAC7B,OAAO;CACX,QAAQ;EACJ,OAAO;CACX;AACJ;AAEA,MAAM,wCAAwC;AAE9C,SAAS,qBAAqB,OAAyB;CACnD,OACI,wBAAwB,KAAK,KAC7B,oBAAoB,KAAK,CAAC,EAAE,SAAS,eACrC,mBAAmB,OAAO,EAAE,CAAC,CAAC,YAAY,MAAM;AAExD;AAMA,SAAS,0BAAkC;CACvC,OACI,WAAW,QAAQ,aAAa,KAChC,OAAO,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC;AAE/D;AAEA,SAAS,uBAAuB,WAAmB,WAAmB,UAAwB;CAC1F,IAAI,cAAc,UACd,MAAM,IAAI,MACN,GAAG,UAAU,YAAY,SAAS,eAAe,UAAU,kBAC/D;AAER;;;;AAKA,IAAa,gBAAb,MAA2B;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YACI,WACA,UACA,UACA,QACF;EACE,KAAKA,cAAc,aAAaC,mBAA6B,SAAS;EACtE,KAAKC,eAAe,aAAaC,iBAA0B,SAAS;EACpE,KAAKC,YAAY;EAC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,MAAM,UAAU;EACvD,MAAM,OAAO,sBACH,KAAKF,QAAQ,MAAM,IACxB,UAAU,MAAM,UAAU,+BAA+B,SAAS,KAAK,CAAC,CAC7E;EACA,OAAO,KAAKF,UAAU,oBAAoB;GACtC;GACA,QAAQQ;GACR,gBAAgB,SAAS;IACrB,KAAK,UAAU;KACX,MAAM,QAAQ,MAAM,KAAKL,cAAc,IAAI;KAC3C,MAAM,QAAQ,KAAK;IACvB,CAAC;GACL;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
1
+ {"version":3,"file":"orders.js","names":["#readClient","ProtoRead.OrdersReadService","#writeClient","ProtoWrite.OrdersService","#realtime","#resolver","#scales","#orderSchema","#orderDetailsSchema","#newOrderInputSchema","#modifyOrderInputSchema","#batchCreateOrdersInputSchema","ProtoRead.OrderSchema"],"sources":["../../../src/services/orders/orders.ts"],"sourcesContent":["import * as ProtoRead from \"../../gen/orders/v1/orders_read_pb.js\";\nimport * as ProtoWrite from \"../../gen/orders/v1/orders_pb.js\";\nimport { createClient, type Client, type Transport } from \"@connectrpc/connect\";\nimport { publicationHandlerErrorContext } from \"../../shared/subscription-errors.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.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 { PolyesterRealtime } from \"../../realtime/types.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport { createReadyGate, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { getOrderErrorDetail } from \"../../utils/connect-order-errors.js\";\nimport { formatConnectError, isResourceNotFoundError } from \"../../utils/errors.js\";\nimport {\n OpenOrdersInputSchema,\n OrderHistoryInputSchema,\n type NewOrderInput,\n createNewOrderInputSchema,\n CancelOrderInputSchema,\n CancelOrderResultSchema,\n type CancelOrderResult,\n CancelAllOrdersInputSchema,\n CancelAllOrdersResponseSchema,\n type CancelAllOrdersResponse,\n type Order,\n GetOrderDetailsInputSchema,\n createCreateOrderResultSchema,\n createPreviewOrderResultSchema,\n type PreviewOrderResult,\n type ModifyOrderInput,\n assertKnownModifyOrderInputKeys,\n createModifyOrderInputSchema,\n ModifyOrderResultSchema,\n type CreateOrderResult,\n type ModifyOrderResult,\n type OrderDetails,\n createOrderSchema,\n createOrderDetailsSchema,\n CancelAllAfterInputSchema,\n CancelAllAfterResultSchema,\n type CancelAllAfterInput,\n type CancelAllAfterResult,\n BatchCancelOrdersInputSchema,\n BatchCancelOrdersResultSchema,\n type BatchCancelOrdersInput,\n type BatchCancelOrdersResult,\n createBatchCreateOrdersResultSchema,\n type BatchCreateOrdersInput,\n type BatchCreateOrdersResult,\n BatchReplaceOrdersResultSchema,\n type BatchReplaceOrdersInput,\n type BatchReplaceOrdersResult,\n GetBatchReplaceStatusInputSchema,\n GetBatchReplaceStatusResultSchema,\n type GetBatchReplaceStatusInput,\n type GetBatchReplaceStatusResult,\n assertKnownBatchReplaceOrderItemInputKeys,\n createBatchCreateOrdersInputSchema,\n createBatchReplaceOrdersInputSchema,\n} from \"./orders.schemas.js\";\n\nfunction hasKnownOrderSymbol(scales: SdkScales, order: { symbolId: number }): boolean {\n try {\n scales.baseQty(order.symbolId);\n return true;\n } catch {\n return false;\n }\n}\n\nconst MISCLASSIFIED_ORDER_NOT_FOUND_MESSAGE = \"order not found\";\n\nfunction isOrderNotFoundError(error: unknown): boolean {\n return (\n isResourceNotFoundError(error) ||\n getOrderErrorDetail(error)?.code === \"NOT_FOUND\" ||\n formatConnectError(error, \"\").toLowerCase() === MISCLASSIFIED_ORDER_NOT_FOUND_MESSAGE\n );\n}\n\ninterface SubscribeOrdersInput extends BaseSubscribeInput<Order> {\n accountId: string;\n}\n\nfunction createMutationRequestId(): string {\n return (\n globalThis.crypto?.randomUUID?.() ??\n `req_${Date.now()}_${Math.random().toString(16).slice(2)}`\n );\n}\n\nfunction assertBatchResultCount(operation: string, requested: number, returned: number): void {\n if (requested !== returned) {\n throw new Error(\n `${operation} returned ${returned} results for ${requested} requested items.`,\n );\n }\n}\n\n/**\n * Manages account-scoped spot orders across read, write, and realtime order update surfaces.\n */\nexport class OrdersService {\n #readClient: Client<typeof ProtoRead.OrdersReadService>;\n #writeClient: Client<typeof ProtoWrite.OrdersService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #orderSchema: ReturnType<typeof createOrderSchema>;\n #orderDetailsSchema: ReturnType<typeof createOrderDetailsSchema>;\n #newOrderInputSchema: ReturnType<typeof createNewOrderInputSchema>;\n #modifyOrderInputSchema: ReturnType<typeof createModifyOrderInputSchema>;\n #batchCreateOrdersInputSchema: ReturnType<typeof createBatchCreateOrdersInputSchema>;\n\n constructor(\n transport: Transport,\n realtime: PolyesterRealtime,\n resolver: SubaccountResolver | undefined,\n scales: SdkScales,\n ) {\n this.#readClient = createClient(ProtoRead.OrdersReadService, transport);\n this.#writeClient = createClient(ProtoWrite.OrdersService, transport);\n this.#realtime = realtime;\n this.#resolver = resolver;\n this.#scales = scales;\n this.#orderSchema = createOrderSchema(scales);\n this.#orderDetailsSchema = createOrderDetailsSchema(scales);\n this.#newOrderInputSchema = createNewOrderInputSchema(scales);\n this.#modifyOrderInputSchema = createModifyOrderInputSchema(scales);\n this.#batchCreateOrdersInputSchema = createBatchCreateOrdersInputSchema(scales);\n }\n\n /**\n * Returns open orders for the resolved root account or subaccount, with optional symbol, trigger ID, side, pagination, and attached-risk inclusion filters. Results are paginated with a server-determined page size: a single call is not the full set of open orders — keep calling with the returned nextPageToken until it is empty.\n */\n async listOpen(\n input: v.InferInput<typeof OpenOrdersInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<{ orders: Order[]; nextPageToken: string }> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(OpenOrdersInputSchema, resolved);\n const res = await this.#readClient.getOpenOrders(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return {\n orders: parse(\n v.array(this.#orderSchema),\n res.orders.filter((order) => hasKnownOrderSymbol(this.#scales, order)),\n ),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Returns historical orders for the resolved account scope, supporting symbol, trigger ID, side, status, time range, pagination, and attached-risk filters. Results are paginated with the backend nextPageToken.\n */\n async listHistory(\n input: v.InferInput<typeof OrderHistoryInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<{ orders: Order[]; nextPageToken: string }> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(OrderHistoryInputSchema, resolved);\n const res = await this.#readClient.getOrderHistory(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return {\n orders: parse(\n v.array(this.#orderSchema),\n res.orders.filter((order) => hasKnownOrderSymbol(this.#scales, order)),\n ),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Evaluates one complete order intent against current market, policy, risk, and balance state without creating an order, reserving funds, or claiming its client order ID.\n */\n async preview(\n input: NewOrderInput,\n options?: PolyesterRequestOptions,\n ): Promise<PreviewOrderResult> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(this.#newOrderInputSchema, resolved);\n const response = await this.#writeClient.previewOrder(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(createPreviewOrderResultSchema(this.#scales, input.symbol), response);\n }\n\n /**\n * Places a spot order with an explicit market-IOC, limit-GTC, limit-IOC, or limit-FOK execution policy and optional attached risk controls. clientOrderId is the caller-controlled idempotency key and should be reused only for the same logical order.\n */\n async create(\n input: NewOrderInput,\n options?: PolyesterMutationOptions,\n ): Promise<CreateOrderResult> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(this.#newOrderInputSchema, resolved);\n const requestPayload = removeUndefined(validatedInput);\n const res = await this.#writeClient.createOrder(\n requestPayload,\n toConnectCallOptions(options),\n );\n return parse(createCreateOrderResultSchema(this.#scales, input.symbol), res);\n }\n\n /**\n * Places 1–20 spot orders in one best-effort request. Results preserve item order and report admission as accepted or rejected; accepted orders still require lifecycle reconciliation. Supply a clientOrderId for each item and a stable requestId when an ambiguous batch may be retried.\n */\n async batchCreate(\n input: BatchCreateOrdersInput,\n options?: PolyesterMutationOptions,\n ): Promise<BatchCreateOrdersResult> {\n await this.#scales.ready();\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n const request = parse(this.#batchCreateOrdersInputSchema, resolved);\n const response = await this.#writeClient.batchCreateOrders(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n const result = parse(\n createBatchCreateOrdersResultSchema(\n this.#scales,\n input.items.map((item) => item.symbol),\n ),\n response,\n );\n assertBatchResultCount(\"batchCreate\", input.items.length, result.results.length);\n return result;\n }\n\n /**\n * Requests cancellation of one order in the resolved account scope by order id or client order id, with optional symbol routing. The response acknowledges the cancellation request, not the order's final lifecycle state; reconcile through order reads or realtime before releasing local state. A missing target remains a {@link ResourceNotFoundError}; callers performing desired-state cleanup may treat that error as success when the order could already have filled or left the book.\n */\n async cancel(\n input: v.InferInput<typeof CancelOrderInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CancelOrderResult> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n\n const validated = parse(CancelOrderInputSchema, resolved);\n\n const res = await this.#writeClient.cancelOrder(\n {\n key: validated.key,\n symbolId: validated.symbolId,\n subaccountId: validated.subaccountId,\n },\n toConnectCallOptions(options),\n );\n return parse(CancelOrderResultSchema, res);\n }\n\n /**\n * Cancels 1–50 explicit orders in one best-effort request. Results preserve item order and acknowledge cancellation admission rather than final order state. Supply a stable requestId when an ambiguous batch may be retried.\n */\n async batchCancel(\n input: BatchCancelOrdersInput,\n options?: PolyesterMutationOptions,\n ): Promise<BatchCancelOrdersResult> {\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n const request = parse(BatchCancelOrdersInputSchema, resolved);\n const response = await this.#writeClient.batchCancelOrders(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n const result = parse(BatchCancelOrdersResultSchema, response);\n assertBatchResultCount(\"batchCancel\", input.items.length, result.results.length);\n return result;\n }\n\n /**\n * Applies a price, quantity, client id, or attached-risk patch to one open order. The symbol ID routes policy checks and quantity scaling. A requestId is generated when omitted; provide a stable value when retrying the same logical modification.\n */\n async modify(\n input: ModifyOrderInput,\n options?: PolyesterMutationOptions,\n ): Promise<ModifyOrderResult> {\n await this.#scales.ready();\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n assertKnownModifyOrderInputKeys(resolved);\n const validated = parse(this.#modifyOrderInputSchema, resolved);\n const res = await this.#writeClient.modifyOrder(\n removeUndefined(validated),\n toConnectCallOptions(options),\n );\n return parse(ModifyOrderResultSchema, res);\n }\n\n /**\n * Replaces 1–50 same-symbol orders and returns an index-stable durable admission receipt. Reuse requestId only when retrying the same logical batch; use the returned batchRequestId for later status reads.\n */\n async batchReplace(\n input: BatchReplaceOrdersInput,\n options?: PolyesterMutationOptions,\n ): Promise<BatchReplaceOrdersResult> {\n await this.#scales.ready();\n for (const item of input.items) {\n assertKnownBatchReplaceOrderItemInputKeys(item);\n }\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n const request = parse(\n createBatchReplaceOrdersInputSchema(this.#scales, input.symbolId),\n resolved,\n );\n const response = await this.#writeClient.batchReplaceOrders(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n const result = parse(BatchReplaceOrdersResultSchema, response);\n assertBatchResultCount(\"batchReplace\", input.items.length, result.results.length);\n return result;\n }\n\n /**\n * Reads the durable per-item execution status for a batch replacement receipt.\n */\n async getBatchReplaceStatus(\n input: GetBatchReplaceStatusInput,\n options?: PolyesterRequestOptions,\n ): Promise<GetBatchReplaceStatusResult> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(GetBatchReplaceStatusInputSchema, resolved);\n const response = await this.#readClient.getBatchReplaceStatus(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(GetBatchReplaceStatusResultSchema, response);\n }\n\n /**\n * Cancels all matching open orders for the resolved account scope, optionally narrowed by symbol and side, with dry-run preview. A requestId is generated when omitted; provide a stable value when retrying the same logical bulk cancellation.\n */\n async cancelAll(\n input: v.InferInput<typeof CancelAllOrdersInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CancelAllOrdersResponse> {\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n const validated = parse(CancelAllOrdersInputSchema, resolved);\n const res = await this.#writeClient.cancelAllOrders(\n removeUndefined(validated),\n toConnectCallOptions(options),\n );\n return parse(CancelAllOrdersResponseSchema, res);\n }\n\n /**\n * Arms, refreshes, or disables the account dead-man switch. timeoutSec 0 disables it; 10–120 arms it. Generate a new requestId for each deliberate heartbeat, but reuse the same ID when retrying one ambiguous heartbeat.\n */\n async cancelAllAfter(\n input: CancelAllAfterInput,\n options?: PolyesterMutationOptions,\n ): Promise<CancelAllAfterResult> {\n const resolved = {\n ...resolveAccountScopedInput(input, this.#resolver),\n requestId: input.requestId ?? createMutationRequestId(),\n };\n const request = parse(CancelAllAfterInputSchema, resolved);\n const response = await this.#writeClient.cancelAllAfter(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(CancelAllAfterResultSchema, response);\n }\n\n /**\n * Fetches one order by id or client order id and returns its order, trades, and transfer details when found. Returns null when the requested order is not found.\n */\n async getDetails(\n input: v.InferInput<typeof GetOrderDetailsInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<OrderDetails | null> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(GetOrderDetailsInputSchema, resolved);\n let res: ProtoRead.GetOrderResponse;\n try {\n res = await this.#readClient.getOrder(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n } catch (error) {\n if (isOrderNotFoundError(error)) return null;\n throw error;\n }\n if (!res.order) return null;\n return parse(this.#orderDetailsSchema, res);\n }\n\n /**\n * Subscribes to private order updates on private:spot:orders:{accountId}:proto and emits parsed order records until the returned unsubscribe function is called.\n */\n subscribe(input: SubscribeOrdersInput): () => void {\n const channel = `private:spot:orders:${input.accountId}:proto`;\n const gate = createReadyGate(\n () => this.#scales.ready(),\n (error) => input.onError?.(publicationHandlerErrorContext(channel, error)),\n );\n return this.#realtime.connectProtoChannel({\n channel,\n schema: ProtoRead.OrderSchema,\n onPublication: (data) => {\n gate.run(() => {\n const order = parse(this.#orderSchema, data);\n input.onEvent(order);\n });\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkEA,SAAS,oBAAoB,QAAmB,OAAsC;CAClF,IAAI;EACA,OAAO,QAAQ,MAAM,QAAQ;EAC7B,OAAO;CACX,QAAQ;EACJ,OAAO;CACX;AACJ;AAEA,MAAM,wCAAwC;AAE9C,SAAS,qBAAqB,OAAyB;CACnD,OACI,wBAAwB,KAAK,KAC7B,oBAAoB,KAAK,CAAC,EAAE,SAAS,eACrC,mBAAmB,OAAO,EAAE,CAAC,CAAC,YAAY,MAAM;AAExD;AAMA,SAAS,0BAAkC;CACvC,OACI,WAAW,QAAQ,aAAa,KAChC,OAAO,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC;AAE/D;AAEA,SAAS,uBAAuB,WAAmB,WAAmB,UAAwB;CAC1F,IAAI,c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AI;GACA,MAAM,MAAM,KAAKL,YAAY,SACzB,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACJ,SAAS,OAAO;GACZ,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,MAAM;EACV;EACA,IAAI,CAAC,IAAI,OAAO,OAAO;EACvB,OAAO,MAAM,KAAKQ,qBAAqB,GAAG;CAC9C;;;;CAKA,UAAU,OAAyC;EAC/C,MAAM,UAAU,uBAAuB,MAAM,UAAU;EACvD,MAAM,OAAO,sBACH,KAAKF,QAAQ,MAAM,IACxB,UAAU,MAAM,UAAU,+BAA+B,SAAS,KAAK,CAAC,CAC7E;EACA,OAAO,KAAKF,UAAU,oBAAoB;GACtC;GACA,QAAQQ;GACR,gBAAgB,SAAS;IACrB,KAAK,UAAU;KACX,MAAM,QAAQ,MAAM,KAAKL,cAAc,IAAI;KAC3C,MAAM,QAAQ,KAAK;IACvB,CAAC;GACL;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
@@ -18,7 +18,7 @@ declare class ApiKeyPoliciesService {
18
18
  */
19
19
  get(input: v.InferInput<typeof GetApiKeyPolicyInputSchema>, options?: PolyesterRequestOptions): Promise<ApiKeyPolicy>;
20
20
  /**
21
- * Creates an API key policy template with market scopes, allowed actions, notional/transfer limits, and optional immediate assignment to a key.
21
+ * Creates an API key policy template with a spot-market scope, allowed actions, and optional immediate assignment to a key.
22
22
  */
23
23
  create(input: v.InferInput<typeof CreateApiKeyPolicyInputSchema>, options?: PolyesterMutationOptions): Promise<ApiKeyPolicy>;
24
24
  /**
@@ -30,7 +30,7 @@ declare class ApiKeyPoliciesService {
30
30
  */
31
31
  delete(policyId: string, options?: PolyesterMutationOptions): Promise<void>;
32
32
  /**
33
- * Attaches a policy to an API key, or clears the key-specific policy when policyId is null.
33
+ * Attaches a policy to an API key. Passing a null policyId clears the binding and leaves the key with no permissions.
34
34
  */
35
35
  apply(input: v.InferInput<typeof ApplyApiKeyPolicyInputSchema>, options?: PolyesterMutationOptions): Promise<void>;
36
36
  }
@@ -36,7 +36,7 @@ var ApiKeyPoliciesService = class {
36
36
  return parse(ApiKeyPolicySchema, res.policy);
37
37
  }
38
38
  /**
39
- * Creates an API key policy template with market scopes, allowed actions, notional/transfer limits, and optional immediate assignment to a key.
39
+ * Creates an API key policy template with a spot-market scope, allowed actions, and optional immediate assignment to a key.
40
40
  */
41
41
  async create(input, options) {
42
42
  const validatedInput = parse(CreateApiKeyPolicyInputSchema, input);
@@ -61,7 +61,7 @@ var ApiKeyPoliciesService = class {
61
61
  await this.#client.deleteApiPolicy({ policyId: validatedPolicyId }, toConnectCallOptions(options));
62
62
  }
63
63
  /**
64
- * Attaches a policy to an API key, or clears the key-specific policy when policyId is null.
64
+ * Attaches a policy to an API key. Passing a null policyId clears the binding and leaves the key with no permissions.
65
65
  */
66
66
  async apply(input, options) {
67
67
  const validatedInput = parse(ApplyApiKeyPolicyInputSchema, input);
@@ -1 +1 @@
1
- {"version":3,"file":"api-key-policies.js","names":["#client","Proto.PolicyService"],"sources":["../../../../src/services/policies/api-key-policies/api-key-policies.ts"],"sourcesContent":["import * as Proto from \"../../../gen/auth/v1/policies_pb.js\";\nimport { createClient, type Client, type Transport } from \"@connectrpc/connect\";\nimport type * as v from \"valibot\";\nimport { parse } from \"../../../shared/validation.js\";\nimport { removeUndefined } from \"../../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../../shared/request-options.js\";\nimport {\n ApiKeyPolicySchema,\n ListApiKeyPoliciesResponseSchema,\n CreateApiKeyPolicyInputSchema,\n UpdateApiKeyPolicyInputSchema,\n ApplyApiKeyPolicyInputSchema,\n DEFAULT_API_KEY_POLICY,\n type ApiKeyPolicy,\n ListApiKeyPoliciesInputSchema,\n GetApiKeyPolicyInputSchema,\n} from \"./api-key-policies.schemas.js\";\nimport { PolicyIdSchema } from \"../shared.js\";\n\n/**\n * Manages reusable API key policy templates and their assignment to API keys.\n */\nexport class ApiKeyPoliciesService {\n #client: Client<typeof Proto.PolicyService>;\n\n constructor(transport: Transport) {\n this.#client = createClient(Proto.PolicyService, transport);\n }\n\n /**\n * Returns API key policy templates available to the caller.\n */\n async list(\n input: v.InferInput<typeof ListApiKeyPoliciesInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<ApiKeyPolicy[]> {\n const request = parse(ListApiKeyPoliciesInputSchema, input);\n const res = await this.#client.listApiPolicies(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(ListApiKeyPoliciesResponseSchema, res);\n }\n\n /**\n * Fetches an API key policy by base58 policy ID, falling back to the SDK default no-permissions policy when no ID or policy is returned.\n */\n async get(\n input: v.InferInput<typeof GetApiKeyPolicyInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<ApiKeyPolicy> {\n const { policyId, keyId } = parse(GetApiKeyPolicyInputSchema, input);\n if (!policyId) return DEFAULT_API_KEY_POLICY;\n const res = await this.#client.getApiPolicy(\n removeUndefined({ policyId, keyId }),\n toConnectCallOptions(options),\n );\n if (!res.policy) return DEFAULT_API_KEY_POLICY;\n return parse(ApiKeyPolicySchema, res.policy);\n }\n\n /**\n * Creates an API key policy template with market scopes, allowed actions, notional/transfer limits, and optional immediate assignment to a key.\n */\n async create(\n input: v.InferInput<typeof CreateApiKeyPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKeyPolicy> {\n const validatedInput = parse(CreateApiKeyPolicyInputSchema, input);\n const res = await this.#client.createApiPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!res.policy) throw new Error(\"Failed to create API key policy\");\n return parse(ApiKeyPolicySchema, res.policy);\n }\n\n /**\n * Updates selected API key policy fields using optimistic concurrency.\n */\n async update(\n input: v.InferInput<typeof UpdateApiKeyPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKeyPolicy> {\n const validatedInput = parse(UpdateApiKeyPolicyInputSchema, input);\n const res = await this.#client.updateApiPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!res.policy) throw new Error(\"Failed to update API key policy\");\n return parse(ApiKeyPolicySchema, res.policy);\n }\n\n /**\n * Deletes an API key policy template when it is not in use.\n */\n async delete(policyId: string, options?: PolyesterMutationOptions): Promise<void> {\n const validatedPolicyId = parse(PolicyIdSchema, policyId);\n await this.#client.deleteApiPolicy(\n { policyId: validatedPolicyId },\n toConnectCallOptions(options),\n );\n }\n\n /**\n * Attaches a policy to an API key, or clears the key-specific policy when policyId is null.\n */\n async apply(\n input: v.InferInput<typeof ApplyApiKeyPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<void> {\n const validatedInput = parse(ApplyApiKeyPolicyInputSchema, input);\n await this.#client.setApiKeyPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AA0BA,IAAa,wBAAb,MAAmC;CAC/B;CAEA,YAAY,WAAsB;EAC9B,KAAKA,UAAU,aAAaC,eAAqB,SAAS;CAC9D;;;;CAKA,MAAM,KACF,QAA4D,CAAC,GAC7D,SACuB;EACvB,MAAM,UAAU,MAAM,+BAA+B,KAAK;EAC1D,MAAM,MAAM,MAAM,KAAKD,QAAQ,gBAC3B,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,kCAAkC,GAAG;CACtD;;;;CAKA,MAAM,IACF,OACA,SACqB;EACrB,MAAM,EAAE,UAAU,UAAU,MAAM,4BAA4B,KAAK;EACnE,IAAI,CAAC,UAAU,OAAO;EACtB,MAAM,MAAM,MAAM,KAAKA,QAAQ,aAC3B,gBAAgB;GAAE;GAAU;EAAM,CAAC,GACnC,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,IAAI,QAAQ,OAAO;EACxB,OAAO,MAAM,oBAAoB,IAAI,MAAM;CAC/C;;;;CAKA,MAAM,OACF,OACA,SACqB;EACrB,MAAM,iBAAiB,MAAM,+BAA+B,KAAK;EACjE,MAAM,MAAM,MAAM,KAAKA,QAAQ,gBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,IAAI,QAAQ,MAAM,IAAI,MAAM,iCAAiC;EAClE,OAAO,MAAM,oBAAoB,IAAI,MAAM;CAC/C;;;;CAKA,MAAM,OACF,OACA,SACqB;EACrB,MAAM,iBAAiB,MAAM,+BAA+B,KAAK;EACjE,MAAM,MAAM,MAAM,KAAKA,QAAQ,gBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,IAAI,QAAQ,MAAM,IAAI,MAAM,iCAAiC;EAClE,OAAO,MAAM,oBAAoB,IAAI,MAAM;CAC/C;;;;CAKA,MAAM,OAAO,UAAkB,SAAmD;EAC9E,MAAM,oBAAoB,MAAM,gBAAgB,QAAQ;EACxD,MAAM,KAAKA,QAAQ,gBACf,EAAE,UAAU,kBAAkB,GAC9B,qBAAqB,OAAO,CAChC;CACJ;;;;CAKA,MAAM,MACF,OACA,SACa;EACb,MAAM,iBAAiB,MAAM,8BAA8B,KAAK;EAChE,MAAM,KAAKA,QAAQ,gBACf,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;CACJ;AACJ"}
1
+ {"version":3,"file":"api-key-policies.js","names":["#client","Proto.PolicyService"],"sources":["../../../../src/services/policies/api-key-policies/api-key-policies.ts"],"sourcesContent":["import * as Proto from \"../../../gen/auth/v1/policies_pb.js\";\nimport { createClient, type Client, type Transport } from \"@connectrpc/connect\";\nimport type * as v from \"valibot\";\nimport { parse } from \"../../../shared/validation.js\";\nimport { removeUndefined } from \"../../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../../shared/request-options.js\";\nimport {\n ApiKeyPolicySchema,\n ListApiKeyPoliciesResponseSchema,\n CreateApiKeyPolicyInputSchema,\n UpdateApiKeyPolicyInputSchema,\n ApplyApiKeyPolicyInputSchema,\n DEFAULT_API_KEY_POLICY,\n type ApiKeyPolicy,\n ListApiKeyPoliciesInputSchema,\n GetApiKeyPolicyInputSchema,\n} from \"./api-key-policies.schemas.js\";\nimport { PolicyIdSchema } from \"../shared.js\";\n\n/**\n * Manages reusable API key policy templates and their assignment to API keys.\n */\nexport class ApiKeyPoliciesService {\n #client: Client<typeof Proto.PolicyService>;\n\n constructor(transport: Transport) {\n this.#client = createClient(Proto.PolicyService, transport);\n }\n\n /**\n * Returns API key policy templates available to the caller.\n */\n async list(\n input: v.InferInput<typeof ListApiKeyPoliciesInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<ApiKeyPolicy[]> {\n const request = parse(ListApiKeyPoliciesInputSchema, input);\n const res = await this.#client.listApiPolicies(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(ListApiKeyPoliciesResponseSchema, res);\n }\n\n /**\n * Fetches an API key policy by base58 policy ID, falling back to the SDK default no-permissions policy when no ID or policy is returned.\n */\n async get(\n input: v.InferInput<typeof GetApiKeyPolicyInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<ApiKeyPolicy> {\n const { policyId, keyId } = parse(GetApiKeyPolicyInputSchema, input);\n if (!policyId) return DEFAULT_API_KEY_POLICY;\n const res = await this.#client.getApiPolicy(\n removeUndefined({ policyId, keyId }),\n toConnectCallOptions(options),\n );\n if (!res.policy) return DEFAULT_API_KEY_POLICY;\n return parse(ApiKeyPolicySchema, res.policy);\n }\n\n /**\n * Creates an API key policy template with a spot-market scope, allowed actions, and optional immediate assignment to a key.\n */\n async create(\n input: v.InferInput<typeof CreateApiKeyPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKeyPolicy> {\n const validatedInput = parse(CreateApiKeyPolicyInputSchema, input);\n const res = await this.#client.createApiPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!res.policy) throw new Error(\"Failed to create API key policy\");\n return parse(ApiKeyPolicySchema, res.policy);\n }\n\n /**\n * Updates selected API key policy fields using optimistic concurrency.\n */\n async update(\n input: v.InferInput<typeof UpdateApiKeyPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<ApiKeyPolicy> {\n const validatedInput = parse(UpdateApiKeyPolicyInputSchema, input);\n const res = await this.#client.updateApiPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!res.policy) throw new Error(\"Failed to update API key policy\");\n return parse(ApiKeyPolicySchema, res.policy);\n }\n\n /**\n * Deletes an API key policy template when it is not in use.\n */\n async delete(policyId: string, options?: PolyesterMutationOptions): Promise<void> {\n const validatedPolicyId = parse(PolicyIdSchema, policyId);\n await this.#client.deleteApiPolicy(\n { policyId: validatedPolicyId },\n toConnectCallOptions(options),\n );\n }\n\n /**\n * Attaches a policy to an API key. Passing a null policyId clears the binding and leaves the key with no permissions.\n */\n async apply(\n input: v.InferInput<typeof ApplyApiKeyPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<void> {\n const validatedInput = parse(ApplyApiKeyPolicyInputSchema, input);\n await this.#client.setApiKeyPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AA0BA,IAAa,wBAAb,MAAmC;CAC/B;CAEA,YAAY,WAAsB;EAC9B,KAAKA,UAAU,aAAaC,eAAqB,SAAS;CAC9D;;;;CAKA,MAAM,KACF,QAA4D,CAAC,GAC7D,SACuB;EACvB,MAAM,UAAU,MAAM,+BAA+B,KAAK;EAC1D,MAAM,MAAM,MAAM,KAAKD,QAAQ,gBAC3B,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,kCAAkC,GAAG;CACtD;;;;CAKA,MAAM,IACF,OACA,SACqB;EACrB,MAAM,EAAE,UAAU,UAAU,MAAM,4BAA4B,KAAK;EACnE,IAAI,CAAC,UAAU,OAAO;EACtB,MAAM,MAAM,MAAM,KAAKA,QAAQ,aAC3B,gBAAgB;GAAE;GAAU;EAAM,CAAC,GACnC,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,IAAI,QAAQ,OAAO;EACxB,OAAO,MAAM,oBAAoB,IAAI,MAAM;CAC/C;;;;CAKA,MAAM,OACF,OACA,SACqB;EACrB,MAAM,iBAAiB,MAAM,+BAA+B,KAAK;EACjE,MAAM,MAAM,MAAM,KAAKA,QAAQ,gBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,IAAI,QAAQ,MAAM,IAAI,MAAM,iCAAiC;EAClE,OAAO,MAAM,oBAAoB,IAAI,MAAM;CAC/C;;;;CAKA,MAAM,OACF,OACA,SACqB;EACrB,MAAM,iBAAiB,MAAM,+BAA+B,KAAK;EACjE,MAAM,MAAM,MAAM,KAAKA,QAAQ,gBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,IAAI,QAAQ,MAAM,IAAI,MAAM,iCAAiC;EAClE,OAAO,MAAM,oBAAoB,IAAI,MAAM;CAC/C;;;;CAKA,MAAM,OAAO,UAAkB,SAAmD;EAC9E,MAAM,oBAAoB,MAAM,gBAAgB,QAAQ;EACxD,MAAM,KAAKA,QAAQ,gBACf,EAAE,UAAU,kBAAkB,GAC9B,qBAAqB,OAAO,CAChC;CACJ;;;;CAKA,MAAM,MACF,OACA,SACa;EACb,MAAM,iBAAiB,MAAM,8BAA8B,KAAK;EAChE,MAAM,KAAKA,QAAQ,gBACf,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;CACJ;AACJ"}
@@ -27,17 +27,9 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
27
27
  readonly symbol: v.StringSchema<undefined>;
28
28
  }, undefined>, undefined>, readonly []>;
29
29
  readonly spotMarketScope: v.SchemaWithPipe<readonly [v.EnumSchema<typeof MarketScope_Value, undefined>, v.TransformAction<MarketScope_Value, DecodedEnum<"all" | "allowlist">>]>;
30
- readonly perpMarketScope: v.SchemaWithPipe<readonly [v.EnumSchema<typeof MarketScope_Value, undefined>, v.TransformAction<MarketScope_Value, DecodedEnum<"all" | "allowlist">>]>;
31
- readonly perpMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
32
- readonly symbol: v.StringSchema<undefined>;
33
- readonly maxLeverageX: v.NumberSchema<undefined>;
34
- }, undefined>, undefined>, readonly []>;
35
- readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.EnumSchema<typeof PolicyAction, undefined>, undefined>, readonly []>, v.TransformAction<v.EnumValues<typeof PolicyAction>[], DecodedEnum<"trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists">[]>]>;
30
+ readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.EnumSchema<typeof PolicyAction, undefined>, undefined>, readonly []>, v.TransformAction<v.EnumValues<typeof PolicyAction>[], DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[]>]>;
36
31
  readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
37
32
  readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
38
- readonly maxOrderNotional: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, number | undefined>]>;
39
- readonly dailyInternalTransferOutLimit: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
40
- readonly dailyWithdrawLimit: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
41
33
  readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
42
34
  readonly seconds: v.BigintSchema<undefined>;
43
35
  readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
@@ -58,17 +50,9 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
58
50
  symbol: string;
59
51
  }[];
60
52
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
61
- perpMarketScope: DecodedEnum<"all" | "allowlist">;
62
- perpMarkets: {
63
- symbol: string;
64
- maxLeverageX: number;
65
- }[];
66
- actions: DecodedEnum<"trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists">[];
53
+ actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
67
54
  isTemplate: boolean;
68
55
  sourceTemplateId?: string | undefined;
69
- maxOrderNotional?: number | undefined;
70
- dailyInternalTransferOutLimit: number;
71
- dailyWithdrawLimit: number;
72
56
  createdAt: number;
73
57
  updatedAt: {
74
58
  seconds: bigint;
@@ -85,17 +69,9 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
85
69
  symbol: string;
86
70
  }[];
87
71
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
88
- perpMarketScope: DecodedEnum<"all" | "allowlist">;
89
- perpMarkets: {
90
- symbol: string;
91
- maxLeverageX: number;
92
- }[];
93
- actions: DecodedEnum<"trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists">[];
72
+ actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
94
73
  isTemplate: boolean;
95
74
  sourceTemplateId?: string | undefined;
96
- maxOrderNotional?: number | undefined;
97
- dailyInternalTransferOutLimit: number;
98
- dailyWithdrawLimit: number;
99
75
  createdAt: number;
100
76
  revision: string;
101
77
  }>]>;
@@ -109,17 +85,9 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
109
85
  readonly symbol: v.StringSchema<undefined>;
110
86
  }, undefined>, undefined>, readonly []>;
111
87
  readonly spotMarketScope: v.SchemaWithPipe<readonly [v.EnumSchema<typeof MarketScope_Value, undefined>, v.TransformAction<MarketScope_Value, DecodedEnum<"all" | "allowlist">>]>;
112
- readonly perpMarketScope: v.SchemaWithPipe<readonly [v.EnumSchema<typeof MarketScope_Value, undefined>, v.TransformAction<MarketScope_Value, DecodedEnum<"all" | "allowlist">>]>;
113
- readonly perpMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
114
- readonly symbol: v.StringSchema<undefined>;
115
- readonly maxLeverageX: v.NumberSchema<undefined>;
116
- }, undefined>, undefined>, readonly []>;
117
- readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.EnumSchema<typeof PolicyAction, undefined>, undefined>, readonly []>, v.TransformAction<v.EnumValues<typeof PolicyAction>[], DecodedEnum<"trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists">[]>]>;
88
+ readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.EnumSchema<typeof PolicyAction, undefined>, undefined>, readonly []>, v.TransformAction<v.EnumValues<typeof PolicyAction>[], DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[]>]>;
118
89
  readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
119
90
  readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
120
- readonly maxOrderNotional: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, number | undefined>]>;
121
- readonly dailyInternalTransferOutLimit: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
122
- readonly dailyWithdrawLimit: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
123
91
  readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
124
92
  readonly seconds: v.BigintSchema<undefined>;
125
93
  readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
@@ -140,17 +108,9 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
140
108
  symbol: string;
141
109
  }[];
142
110
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
143
- perpMarketScope: DecodedEnum<"all" | "allowlist">;
144
- perpMarkets: {
145
- symbol: string;
146
- maxLeverageX: number;
147
- }[];
148
- actions: DecodedEnum<"trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists">[];
111
+ actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
149
112
  isTemplate: boolean;
150
113
  sourceTemplateId?: string | undefined;
151
- maxOrderNotional?: number | undefined;
152
- dailyInternalTransferOutLimit: number;
153
- dailyWithdrawLimit: number;
154
114
  createdAt: number;
155
115
  updatedAt: {
156
116
  seconds: bigint;
@@ -167,17 +127,9 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
167
127
  symbol: string;
168
128
  }[];
169
129
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
170
- perpMarketScope: DecodedEnum<"all" | "allowlist">;
171
- perpMarkets: {
172
- symbol: string;
173
- maxLeverageX: number;
174
- }[];
175
- actions: DecodedEnum<"trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists">[];
130
+ actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
176
131
  isTemplate: boolean;
177
132
  sourceTemplateId?: string | undefined;
178
- maxOrderNotional?: number | undefined;
179
- dailyInternalTransferOutLimit: number;
180
- dailyWithdrawLimit: number;
181
133
  createdAt: number;
182
134
  revision: string;
183
135
  }>]>, undefined>, readonly []>;
@@ -192,17 +144,9 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
192
144
  symbol: string;
193
145
  }[];
194
146
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
195
- perpMarketScope: DecodedEnum<"all" | "allowlist">;
196
- perpMarkets: {
197
- symbol: string;
198
- maxLeverageX: number;
199
- }[];
200
- actions: DecodedEnum<"trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists">[];
147
+ actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
201
148
  isTemplate: boolean;
202
149
  sourceTemplateId?: string | undefined;
203
- maxOrderNotional?: number | undefined;
204
- dailyInternalTransferOutLimit: number;
205
- dailyWithdrawLimit: number;
206
150
  createdAt: number;
207
151
  revision: string;
208
152
  }[];
@@ -216,17 +160,9 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
216
160
  symbol: string;
217
161
  }[];
218
162
  spotMarketScope: DecodedEnum<"all" | "allowlist">;
219
- perpMarketScope: DecodedEnum<"all" | "allowlist">;
220
- perpMarkets: {
221
- symbol: string;
222
- maxLeverageX: number;
223
- }[];
224
- actions: DecodedEnum<"trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists">[];
163
+ actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
225
164
  isTemplate: boolean;
226
165
  sourceTemplateId?: string | undefined;
227
- maxOrderNotional?: number | undefined;
228
- dailyInternalTransferOutLimit: number;
229
- dailyWithdrawLimit: number;
230
166
  createdAt: number;
231
167
  revision: string;
232
168
  }[]>]>;
@@ -237,16 +173,8 @@ declare const CreateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
237
173
  readonly spotMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
238
174
  readonly symbol: v.StringSchema<undefined>;
239
175
  }, undefined>, undefined>, readonly []>;
240
- readonly perpMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
241
- readonly symbol: v.StringSchema<undefined>;
242
- readonly maxLeverageX: v.NumberSchema<undefined>;
243
- }, undefined>, undefined>, readonly []>;
244
176
  readonly spotMarketScope: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["all", "allowlist"], undefined>, v.TransformAction<"all" | "allowlist", MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST>]>;
245
- readonly perpMarketScope: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["all", "allowlist"], undefined>, v.TransformAction<"all" | "allowlist", MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST>]>;
246
- readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "trade-perp", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-perp", "read-internal-transfers", "read-external-withdrawals", "read-transfer-controls", "manage-address-book", "manage-transfer-whitelists"], undefined>, undefined>, readonly []>, v.TransformAction<("trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists")[], (PolicyAction.TRADE_SPOT | PolicyAction.TRADE_PERP | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_PERP | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_EXTERNAL_WITHDRAWALS | PolicyAction.READ_TRANSFER_CONTROLS | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.MANAGE_TRANSFER_WHITELISTS)[]>]>;
247
- readonly maxOrderNotional: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, bigint>]>;
248
- readonly dailyInternalTransferLimit: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, bigint>]>;
249
- readonly dailyWithdrawLimit: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, bigint>]>;
177
+ readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, readonly []>, v.TransformAction<("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[], (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[]>]>;
250
178
  readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
251
179
  readonly assignToKeyId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
252
180
  }, undefined>, v.TransformAction<{
@@ -255,35 +183,19 @@ declare const CreateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
255
183
  spotMarkets: {
256
184
  symbol: string;
257
185
  }[];
258
- perpMarkets: {
259
- symbol: string;
260
- maxLeverageX: number;
261
- }[];
262
186
  spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
263
- perpMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
264
- actions: (PolicyAction.TRADE_SPOT | PolicyAction.TRADE_PERP | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_PERP | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_EXTERNAL_WITHDRAWALS | PolicyAction.READ_TRANSFER_CONTROLS | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.MANAGE_TRANSFER_WHITELISTS)[];
265
- maxOrderNotional: bigint;
266
- dailyInternalTransferLimit: bigint;
267
- dailyWithdrawLimit: bigint;
187
+ actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
268
188
  isTemplate: boolean;
269
189
  assignToKeyId?: string | undefined;
270
190
  }, {
271
191
  policy: {
272
- dailyInternalTransferOutLimit: bigint;
273
192
  name: string;
274
193
  description: string;
275
194
  spotMarkets: {
276
195
  symbol: string;
277
196
  }[];
278
- perpMarkets: {
279
- symbol: string;
280
- maxLeverageX: number;
281
- }[];
282
197
  spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
283
- perpMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
284
- actions: (PolicyAction.TRADE_SPOT | PolicyAction.TRADE_PERP | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_PERP | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_EXTERNAL_WITHDRAWALS | PolicyAction.READ_TRANSFER_CONTROLS | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.MANAGE_TRANSFER_WHITELISTS)[];
285
- maxOrderNotional: bigint;
286
- dailyWithdrawLimit: bigint;
198
+ actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
287
199
  isTemplate: boolean;
288
200
  };
289
201
  assignToKeyId: string | undefined;
@@ -297,16 +209,8 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
297
209
  readonly spotMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
298
210
  readonly symbol: v.StringSchema<undefined>;
299
211
  }, undefined>, undefined>, undefined>;
300
- readonly perpMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
301
- readonly symbol: v.StringSchema<undefined>;
302
- readonly maxLeverageX: v.NumberSchema<undefined>;
303
- }, undefined>, undefined>, undefined>;
304
212
  readonly spotMarketScope: v.OptionalSchema<v.PicklistSchema<readonly ["all", "allowlist"], undefined>, undefined>;
305
- readonly perpMarketScope: v.OptionalSchema<v.PicklistSchema<readonly ["all", "allowlist"], undefined>, undefined>;
306
- readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "trade-perp", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-perp", "read-internal-transfers", "read-external-withdrawals", "read-transfer-controls", "manage-address-book", "manage-transfer-whitelists"], undefined>, undefined>, undefined>;
307
- readonly maxOrderNotional: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
308
- readonly dailyInternalTransferLimit: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
309
- readonly dailyWithdrawLimit: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
213
+ readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, undefined>;
310
214
  readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
311
215
  }, undefined>, v.CheckAction<{
312
216
  policyId: bigint;
@@ -316,16 +220,8 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
316
220
  spotMarkets?: {
317
221
  symbol: string;
318
222
  }[] | undefined;
319
- perpMarkets?: {
320
- symbol: string;
321
- maxLeverageX: number;
322
- }[] | undefined;
323
223
  spotMarketScope?: "all" | "allowlist" | undefined;
324
- perpMarketScope?: "all" | "allowlist" | undefined;
325
- actions?: ("trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists")[] | undefined;
326
- maxOrderNotional?: number | null | undefined;
327
- dailyInternalTransferLimit?: number | null | undefined;
328
- dailyWithdrawLimit?: number | null | undefined;
224
+ actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
329
225
  isTemplate?: boolean | undefined;
330
226
  }, "At least one API key policy field must be provided">, v.TransformAction<{
331
227
  policyId: bigint;
@@ -335,16 +231,8 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
335
231
  spotMarkets?: {
336
232
  symbol: string;
337
233
  }[] | undefined;
338
- perpMarkets?: {
339
- symbol: string;
340
- maxLeverageX: number;
341
- }[] | undefined;
342
234
  spotMarketScope?: "all" | "allowlist" | undefined;
343
- perpMarketScope?: "all" | "allowlist" | undefined;
344
- actions?: ("trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists")[] | undefined;
345
- maxOrderNotional?: number | null | undefined;
346
- dailyInternalTransferLimit?: number | null | undefined;
347
- dailyWithdrawLimit?: number | null | undefined;
235
+ actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
348
236
  isTemplate?: boolean | undefined;
349
237
  }, {
350
238
  policyId: bigint;
@@ -356,23 +244,10 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
356
244
  spotMarkets: {
357
245
  symbol: string;
358
246
  }[];
359
- } & {
360
- perpMarkets: {
361
- symbol: string;
362
- maxLeverageX: number;
363
- }[];
364
247
  } & {
365
248
  spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
366
249
  } & {
367
- perpMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
368
- } & {
369
- actions: (PolicyAction.TRADE_SPOT | PolicyAction.TRADE_PERP | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_PERP | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_EXTERNAL_WITHDRAWALS | PolicyAction.READ_TRANSFER_CONTROLS | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.MANAGE_TRANSFER_WHITELISTS)[];
370
- } & {
371
- maxOrderNotional: bigint;
372
- } & {
373
- dailyInternalTransferOutLimit: bigint;
374
- } & {
375
- dailyWithdrawLimit: bigint;
250
+ actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
376
251
  } & {
377
252
  isTemplate: boolean;
378
253
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"api-key-policies.schemas.d.ts","names":[],"sources":["../../../../src/services/policies/api-key-policies/api-key-policies.schemas.ts"],"mappings":";;;;cAiCa,+BAA6B,EAAA;;;cAM7B,4BAA0B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;cAiB1B,oBAAkB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4CnB,eAAe,EAAE,mBAAmB;cAEnC,kCAAgC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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