@polyester/sdk 0.35.0 → 0.36.0-devnet-20261112144059
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.
- package/CHANGELOG.md +48 -0
- package/dist/catalogs/snapshot-validation.js +5 -0
- package/dist/catalogs/snapshot-validation.js.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +144 -2
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.js +32 -2
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts +11 -5
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts.map +1 -1
- package/dist/gen/alerts/v1/price_alerts_pb.js +3 -1
- package/dist/gen/alerts/v1/price_alerts_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +14 -1
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +14 -1
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +14 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +14 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.d.ts +7 -1
- package/dist/gen/changelog/v1/changelog_pb.d.ts.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.js +7 -1
- package/dist/gen/changelog/v1/changelog_pb.js.map +1 -1
- package/dist/gen/index.d.ts +2 -1
- package/dist/gen/index.js +2 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +57 -5
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +10 -4
- package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.d.ts +827 -0
- package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -0
- package/dist/gen/notifications/v1/notifications_pb.js +346 -0
- package/dist/gen/notifications/v1/notifications_pb.js.map +1 -0
- package/dist/gen/orders/v1/orders_pb.d.ts +247 -19
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +188 -66
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +73 -5
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js +40 -5
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +1195 -190
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +317 -7
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +369 -6
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +237 -14
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts +39 -1
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts.map +1 -1
- package/dist/gen/tradews/v1/trade_ws_pb.js +2 -1
- package/dist/gen/tradews/v1/trade_ws_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +526 -13
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +126 -26
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/services/assistant/assistant-events.schemas.d.ts +57 -39
- package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -1
- package/dist/services/assistant/assistant.d.ts +16 -1
- package/dist/services/assistant/assistant.d.ts.map +1 -1
- package/dist/services/assistant/assistant.js +24 -1
- package/dist/services/assistant/assistant.js.map +1 -1
- package/dist/services/assistant/assistant.schemas.d.ts +13 -1
- package/dist/services/assistant/assistant.schemas.d.ts.map +1 -1
- package/dist/services/assistant/assistant.schemas.js +15 -1
- package/dist/services/assistant/assistant.schemas.js.map +1 -1
- package/dist/services/assistant/assistant.types.d.ts +2 -2
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +22 -22
- package/dist/services/changelog/changelog.codecs.d.ts +1 -1
- package/dist/services/changelog/changelog.codecs.d.ts.map +1 -1
- package/dist/services/changelog/changelog.codecs.js +6 -3
- package/dist/services/changelog/changelog.codecs.js.map +1 -1
- package/dist/services/changelog/changelog.schemas.d.ts +19 -19
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +3 -3
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +13 -13
- package/dist/services/market-data/market-data.schemas.js +16 -1
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/notifications/notifications.codecs.d.ts +16 -0
- package/dist/services/notifications/notifications.codecs.d.ts.map +1 -0
- package/dist/services/notifications/notifications.codecs.js +40 -0
- package/dist/services/notifications/notifications.codecs.js.map +1 -0
- package/dist/services/notifications/notifications.d.ts +41 -0
- package/dist/services/notifications/notifications.d.ts.map +1 -0
- package/dist/services/notifications/notifications.js +67 -0
- package/dist/services/notifications/notifications.js.map +1 -0
- package/dist/services/notifications/notifications.schemas.d.ts +154 -0
- package/dist/services/notifications/notifications.schemas.d.ts.map +1 -0
- package/dist/services/notifications/notifications.schemas.js +116 -0
- package/dist/services/notifications/notifications.schemas.js.map +1 -0
- package/dist/services/notifications/notifications.types.d.ts +3 -0
- package/dist/services/notifications/service.d.ts +8 -0
- package/dist/services/notifications/service.d.ts.map +1 -0
- package/dist/services/notifications/service.js +9 -0
- package/dist/services/notifications/service.js.map +1 -0
- package/dist/services/orders/order-enums.codecs.js +12 -4
- package/dist/services/orders/order-enums.codecs.js.map +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +2688 -417
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +5 -3
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +4828 -1265
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +104 -32
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +40 -22
- package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-output.schemas.js +8 -0
- package/dist/services/orders/orders-output.schemas.js.map +1 -1
- package/dist/services/orders/orders-risk.schemas.d.ts +1 -1
- package/dist/services/orders/orders-risk.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-risk.schemas.js +1 -1
- package/dist/services/orders/orders-risk.schemas.js.map +1 -1
- package/dist/services/orders/orders.codecs.js +3 -0
- package/dist/services/orders/orders.codecs.js.map +1 -1
- package/dist/services/orders/orders.d.ts +3 -1
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +5 -12
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
- package/dist/services/policies/shared.codecs.js +9 -3
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +3 -3
- package/dist/services/price-alerts/price-alerts.d.ts +10 -5
- package/dist/services/price-alerts/price-alerts.d.ts.map +1 -1
- package/dist/services/price-alerts/price-alerts.js +10 -5
- package/dist/services/price-alerts/price-alerts.js.map +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +4 -4
- package/dist/services/subaccounts/subaccounts.codecs.js +3 -1
- package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +7 -7
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +271 -41
- package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.js +51 -3
- package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +235 -24
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.js +49 -2
- package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
- package/dist/services/triggers/triggers.codecs.js +7 -2
- package/dist/services/triggers/triggers.codecs.js.map +1 -1
- package/dist/services/triggers/triggers.d.ts +25 -3
- package/dist/services/triggers/triggers.d.ts.map +1 -1
- package/dist/services/triggers/triggers.js +49 -3
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/services/triggers/triggers.schemas.d.ts +3 -3
- package/dist/services/triggers/triggers.types.d.ts +3 -3
- package/dist/services/vip/vip.schemas.d.ts +3 -3
- package/dist/shared/catalog-config.d.ts +6 -0
- package/dist/shared/catalog-config.d.ts.map +1 -1
- package/dist/shared/catalog-config.js.map +1 -1
- package/dist/shared/error-detail.d.ts +6 -2
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +1 -0
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/notifications.js +15 -0
- package/dist/shared/error-details/notifications.js.map +1 -0
- package/dist/shared/request-id.d.ts +6 -0
- package/dist/shared/request-id.d.ts.map +1 -0
- package/dist/shared/request-id.js +17 -0
- package/dist/shared/request-id.js.map +1 -0
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +2 -0
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders-input.schemas.d.ts","names":[],"sources":["../../../src/services/orders/orders-input.schemas.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"orders-input.schemas.d.ts","names":[],"sources":["../../../src/services/orders/orders-input.schemas.ts"],"mappings":";;;;;cA+Ea,uBAAqB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAatB,kBAAkB,EAAE,kBAAkB;cAErC,yBAAuB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkBxB,oBAAoB,EAAE,kBAAkB;iBAqSpC,6BAA6B,QAAQ,YAAS,EAAA,yBAAA,EAAA,yBAAA,EAAA,aAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BtE,qBAAqB,EAAE,YAAY,kBAAkB"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { PROTOBUF_INT64_MAX } from "../../shared/wire-bounds.js";
|
|
1
2
|
import { tsNsToMs } from "../../utils/time.js";
|
|
2
3
|
import { OptionalPublicIdSchema, OptionalTimestampMsSchema, PublicIdSchema, TimestampMsSchema, optionalIdInputSchema, optionalUint64DecimalFilterSchema } from "../../shared/schemas.js";
|
|
3
4
|
import { enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
5
|
+
import { CatalogConversionError } from "../../catalogs/types.js";
|
|
4
6
|
import { positiveDecimalInputToScaled, scaledToDecimalOutput } from "../../shared/decimal-surface.js";
|
|
5
7
|
import { SideSchema, SymbolIdInputSchema } from "../shared.js";
|
|
6
8
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
7
9
|
import { msToTimestamp } from "../../utils/timestamp.js";
|
|
8
|
-
import { LimitFokSchema, LimitGtcSchema, LimitGtdSchema, LimitIocSchema, MarketIocSchema } from "../../gen/orders/v1/orders_pb.js";
|
|
9
|
-
import { FEE_ASSET_VALUES, FeeAssetCodec, OrderSideCodec, SELF_TRADE_PREVENTION_MODE_VALUES, SelfTradePreventionModeCodec } from "./order-enums.codecs.js";
|
|
10
|
+
import { LimitFokSchema, LimitGtcSchema, LimitGtdSchema, LimitIocSchema, MarketIocSchema, StaticPegSchema } from "../../gen/orders/v1/orders_pb.js";
|
|
11
|
+
import { FEE_ASSET_VALUES, FeeAssetCodec, OrderSideCodec, PEG_REFERENCE_VALUES, PegReferenceCodec, SELF_TRADE_PREVENTION_MODE_VALUES, SelfTradePreventionModeCodec } from "./order-enums.codecs.js";
|
|
10
12
|
import { CancelAllListingStatusCodec, CancelAllOrdersStatusCodec, CancelOrderStatusCodec, ORDER_STATUS_FILTER_VALUES, OrderStatusFilterCodec } from "./orders.codecs.js";
|
|
11
13
|
import { ClientOrderIdInputSchema, OptionalClientOrderIdInputSchema, OrderIdInputSchema, OrderRequestIdInputSchema } from "./orders-identifiers.schemas.js";
|
|
12
14
|
import { MAX_SELLING_SLIPPAGE_BPS } from "../trailing-oneof-inputs.js";
|
|
@@ -51,6 +53,16 @@ const OrderHistoryInputSchema = v.pipe(v.strictObject({
|
|
|
51
53
|
})));
|
|
52
54
|
const DecimalInputStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));
|
|
53
55
|
const GtdExpireAtSchema = v.pipe(v.number(), v.integer(), v.minValue(-9223372036854), v.maxValue(9223372036854));
|
|
56
|
+
const PROTOBUF_INT64_MIN = -PROTOBUF_INT64_MAX - 1n;
|
|
57
|
+
/** Static entry peg: the limit price is taken once, at entry, from the selected book side. */
|
|
58
|
+
const StaticPegInputSchema = v.pipe(v.strictObject({
|
|
59
|
+
reference: v.picklist(PEG_REFERENCE_VALUES),
|
|
60
|
+
/** Signed count of the pair's tick size added to the reference, not a price. Defaults to 0. */
|
|
61
|
+
offsetTicks: v.optional(v.pipe(v.union([v.bigint(), v.pipe(v.number(), v.safeInteger(), v.transform((n) => BigInt(n)))]), v.check((offset) => offset >= PROTOBUF_INT64_MIN && offset <= 9223372036854775807n, "peg.offsetTicks must fit a signed 64-bit integer")), 0n)
|
|
62
|
+
}), v.transform(({ reference, offsetTicks }) => create(StaticPegSchema, {
|
|
63
|
+
reference: PegReferenceCodec.inputToProto[reference],
|
|
64
|
+
offsetTicks
|
|
65
|
+
})));
|
|
54
66
|
function createOrderIntentBaseEntries(scales) {
|
|
55
67
|
return {
|
|
56
68
|
symbolId: SymbolIdInputSchema,
|
|
@@ -59,7 +71,9 @@ function createOrderIntentBaseEntries(scales) {
|
|
|
59
71
|
clientOrderId: OptionalClientOrderIdInputSchema,
|
|
60
72
|
feeAsset: v.pipe(v.optional(FeeAssetSchema), v.transform((v) => v ? FeeAssetCodec.inputToProto[v] : void 0)),
|
|
61
73
|
selfTradePreventionMode: v.pipe(v.optional(SelfTradePreventionModeSchema), v.transform((v) => v ? SelfTradePreventionModeCodec.inputToProto[v] : void 0)),
|
|
62
|
-
risk: createRiskPolicyInputSchema(scales)
|
|
74
|
+
risk: createRiskPolicyInputSchema(scales),
|
|
75
|
+
/** Takes the limit price from the book at entry; `execution.price` stays the BUY cap or SELL floor. */
|
|
76
|
+
peg: v.optional(StaticPegInputSchema)
|
|
63
77
|
};
|
|
64
78
|
}
|
|
65
79
|
const SELLING_SLIPPAGE_MESSAGE = `maxSlippageBps must be between 1 and ${MAX_SELLING_SLIPPAGE_BPS} for a market order that sells`;
|
|
@@ -68,49 +82,99 @@ function sellingSlippageWithinCap(input) {
|
|
|
68
82
|
const slippage = input.side === 2 && input.execution.case === "marketIoc" ? input.execution.value.maxSlippage : void 0;
|
|
69
83
|
return slippage?.case !== "maxSlippageBps" || slippage.value <= 9999;
|
|
70
84
|
}
|
|
85
|
+
/** Quote-proceeds sizing, static peg and iceberg combinations the exchange refuses. */
|
|
86
|
+
function orderIntentRuleViolation(input) {
|
|
87
|
+
const ioc = input.execution.case === "marketIoc" || input.execution.case === "limitIoc";
|
|
88
|
+
if (input.quoteProceeds !== void 0 && (input.side !== 2 || !ioc)) return "quoteProceeds is supported only for SELL market IOC and SELL limit IOC orders";
|
|
89
|
+
if (input.quoteProceeds !== void 0 && input.risk !== void 0) return "quoteProceeds cannot be combined with attached risk";
|
|
90
|
+
if (input.peg !== void 0 && (input.qty === void 0 || input.execution.case === "marketIoc" || input.risk !== void 0)) return "peg requires qty sizing, a limit execution and no attached risk";
|
|
91
|
+
if (input.execution.displayQty !== void 0 && input.risk !== void 0) return "execution.displayQty cannot be combined with attached risk";
|
|
92
|
+
}
|
|
71
93
|
function createOrderIntentInputObjectSchema(scales) {
|
|
72
94
|
const baseEntries = createOrderIntentBaseEntries(scales);
|
|
73
|
-
return v.pipe(v.union([
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
95
|
+
return v.pipe(v.union([
|
|
96
|
+
v.strictObject({
|
|
97
|
+
...baseEntries,
|
|
98
|
+
qty: DecimalInputStringSchema,
|
|
99
|
+
maxQuoteDebit: v.optional(v.never()),
|
|
100
|
+
quoteProceeds: v.optional(v.never())
|
|
101
|
+
}),
|
|
102
|
+
v.strictObject({
|
|
103
|
+
...baseEntries,
|
|
104
|
+
qty: v.optional(v.never()),
|
|
105
|
+
maxQuoteDebit: DecimalInputStringSchema,
|
|
106
|
+
quoteProceeds: v.optional(v.never())
|
|
107
|
+
}),
|
|
108
|
+
v.strictObject({
|
|
109
|
+
...baseEntries,
|
|
110
|
+
qty: v.optional(v.never()),
|
|
111
|
+
maxQuoteDebit: v.optional(v.never()),
|
|
112
|
+
/** SELL IOC only: sells until its proceeds before fees reach this quote amount. */
|
|
113
|
+
quoteProceeds: DecimalInputStringSchema
|
|
114
|
+
})
|
|
115
|
+
]), v.check((input) => input.maxQuoteDebit === void 0 || input.side === 1 && (input.execution.case === "marketIoc" || input.execution.case === "limitIoc"), "maxQuoteDebit is supported only for BUY market IOC and BUY limit IOC orders"), v.check((input) => input.side !== 2 || input.feeAsset === void 0 || input.feeAsset === 1, "SELL orders must use the quote fee asset"), v.check((input) => sellingSlippageWithinCap(input), SELLING_SLIPPAGE_MESSAGE), v.check((input) => attachedTrailingLimitMatchesSide(input), ATTACHED_TRAILING_LIMIT_SIDE_MESSAGE), v.check((input) => orderIntentRuleViolation(input) === void 0, (issue) => orderIntentRuleViolation(issue.input) ?? ""));
|
|
82
116
|
}
|
|
83
117
|
function createScopedOrderIntentInputObjectSchema(scales) {
|
|
84
118
|
const baseEntries = {
|
|
85
119
|
...AccountScopeInputEntries,
|
|
86
120
|
...createOrderIntentBaseEntries(scales)
|
|
87
121
|
};
|
|
88
|
-
return v.pipe(v.union([
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
122
|
+
return v.pipe(v.union([
|
|
123
|
+
v.strictObject({
|
|
124
|
+
...baseEntries,
|
|
125
|
+
qty: DecimalInputStringSchema,
|
|
126
|
+
maxQuoteDebit: v.optional(v.never()),
|
|
127
|
+
quoteProceeds: v.optional(v.never())
|
|
128
|
+
}),
|
|
129
|
+
v.strictObject({
|
|
130
|
+
...baseEntries,
|
|
131
|
+
qty: v.optional(v.never()),
|
|
132
|
+
maxQuoteDebit: DecimalInputStringSchema,
|
|
133
|
+
quoteProceeds: v.optional(v.never())
|
|
134
|
+
}),
|
|
135
|
+
v.strictObject({
|
|
136
|
+
...baseEntries,
|
|
137
|
+
qty: v.optional(v.never()),
|
|
138
|
+
maxQuoteDebit: v.optional(v.never()),
|
|
139
|
+
/** SELL IOC only: sells until its proceeds before fees reach this quote amount. */
|
|
140
|
+
quoteProceeds: DecimalInputStringSchema
|
|
141
|
+
})
|
|
142
|
+
]), v.check((input) => input.maxQuoteDebit === void 0 || input.side === 1 && (input.execution.case === "marketIoc" || input.execution.case === "limitIoc"), "maxQuoteDebit is supported only for BUY market IOC and BUY limit IOC orders"), v.check((input) => input.side !== 2 || input.feeAsset === void 0 || input.feeAsset === 1, "SELL orders must use the quote fee asset"), v.check((input) => sellingSlippageWithinCap(input), SELLING_SLIPPAGE_MESSAGE), v.check((input) => attachedTrailingLimitMatchesSide(input), ATTACHED_TRAILING_LIMIT_SIDE_MESSAGE), v.check((input) => orderIntentRuleViolation(input) === void 0, (issue) => orderIntentRuleViolation(issue.input) ?? ""));
|
|
97
143
|
}
|
|
98
144
|
function toOrderIntent(input, scales) {
|
|
99
|
-
const { risk, qty, maxQuoteDebit, ...intent } = input;
|
|
145
|
+
const { risk, qty, maxQuoteDebit, quoteProceeds, execution, ...intent } = input;
|
|
146
|
+
const baseQtyScale = scales.baseQty(intent.symbolId);
|
|
100
147
|
const sizing = qty !== void 0 ? {
|
|
101
148
|
case: "baseQtyScaled",
|
|
102
|
-
value: positiveDecimalInputToScaled("qty", qty,
|
|
103
|
-
} : {
|
|
149
|
+
value: positiveDecimalInputToScaled("qty", qty, baseQtyScale)
|
|
150
|
+
} : maxQuoteDebit !== void 0 ? {
|
|
104
151
|
case: "maxQuoteDebitScaled",
|
|
105
152
|
value: positiveDecimalInputToScaled("maxQuoteDebit", maxQuoteDebit, scales.quoteAmount(intent.symbolId))
|
|
153
|
+
} : {
|
|
154
|
+
case: "quoteProceedsScaled",
|
|
155
|
+
value: positiveDecimalInputToScaled("quoteProceeds", quoteProceeds, scales.quoteAmount(intent.symbolId))
|
|
106
156
|
};
|
|
107
157
|
return {
|
|
108
158
|
...intent,
|
|
109
159
|
sizing,
|
|
160
|
+
execution: withDisplayQty(execution, sizing.case === "baseQtyScaled" ? sizing.value : void 0, baseQtyScale),
|
|
110
161
|
feeAsset: intent.feeAsset ?? 1,
|
|
111
162
|
attachedRisk: risk
|
|
112
163
|
};
|
|
113
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Sets an iceberg display on a GTC or GTD limit. The server also requires a multiple of the
|
|
167
|
+
* pair's quantity step and at least its minimum quantity.
|
|
168
|
+
*/
|
|
169
|
+
function withDisplayQty(execution, baseQtyScaled, baseQtyScale) {
|
|
170
|
+
if (execution.case !== "limitGtc" && execution.case !== "limitGtd") return execution;
|
|
171
|
+
const { displayQty, ...limit } = execution;
|
|
172
|
+
if (displayQty === void 0) return limit;
|
|
173
|
+
const display = positiveDecimalInputToScaled("execution.displayQty", displayQty, baseQtyScale);
|
|
174
|
+
if (baseQtyScaled === void 0 || display >= baseQtyScaled || display * 100n < baseQtyScaled) throw new CatalogConversionError("execution.displayQty", "execution.displayQty must be below qty and at least qty divided by 100, rounded up");
|
|
175
|
+
limit.value.displayQtyScaled = display;
|
|
176
|
+
return limit;
|
|
177
|
+
}
|
|
114
178
|
function createOrderIntentInputSchema(scales) {
|
|
115
179
|
return v.pipe(createOrderIntentInputObjectSchema(scales), v.transform((input) => toOrderIntent(input, scales)));
|
|
116
180
|
}
|
|
@@ -131,27 +195,33 @@ function createOrderExecutionInputSchema(scales) {
|
|
|
131
195
|
v.pipe(v.strictObject({
|
|
132
196
|
type: v.literal("limit_gtc"),
|
|
133
197
|
price: DecimalInputStringSchema,
|
|
134
|
-
postOnly: v.optional(v.boolean(), false)
|
|
135
|
-
|
|
198
|
+
postOnly: v.optional(v.boolean(), false),
|
|
199
|
+
/** Iceberg: the most of the order the book shows at once, in base units. */
|
|
200
|
+
displayQty: v.optional(DecimalInputStringSchema)
|
|
201
|
+
}), v.transform(({ price, postOnly, displayQty }) => ({
|
|
136
202
|
case: "limitGtc",
|
|
137
203
|
value: create(LimitGtcSchema, {
|
|
138
204
|
priceTicks: priceToTicks("execution.price", price),
|
|
139
205
|
postOnly
|
|
140
|
-
})
|
|
206
|
+
}),
|
|
207
|
+
displayQty
|
|
141
208
|
}))),
|
|
142
209
|
v.pipe(v.strictObject({
|
|
143
210
|
type: v.literal("limit_gtd"),
|
|
144
211
|
price: DecimalInputStringSchema,
|
|
145
212
|
/** Exact UTC expiry as integer epoch milliseconds. */
|
|
146
213
|
expireAt: GtdExpireAtSchema,
|
|
147
|
-
postOnly: v.optional(v.boolean(), false)
|
|
148
|
-
|
|
214
|
+
postOnly: v.optional(v.boolean(), false),
|
|
215
|
+
/** Iceberg: the most of the order the book shows at once, in base units. */
|
|
216
|
+
displayQty: v.optional(DecimalInputStringSchema)
|
|
217
|
+
}), v.transform(({ price, expireAt, postOnly, displayQty }) => ({
|
|
149
218
|
case: "limitGtd",
|
|
150
219
|
value: create(LimitGtdSchema, {
|
|
151
220
|
priceTicks: priceToTicks("execution.price", price),
|
|
152
221
|
postOnly,
|
|
153
222
|
expireAt: msToTimestamp(expireAt)
|
|
154
|
-
})
|
|
223
|
+
}),
|
|
224
|
+
displayQty
|
|
155
225
|
}))),
|
|
156
226
|
v.pipe(v.strictObject({
|
|
157
227
|
type: v.literal("limit_ioc"),
|
|
@@ -279,15 +349,17 @@ function createCreateOrderResultSchema(scales, symbolId) {
|
|
|
279
349
|
acceptedAtTsNs: v.bigint(),
|
|
280
350
|
resolvedBaseQtyScaled: v.bigint(),
|
|
281
351
|
submittedMaxQuoteDebitScaled: v.optional(v.bigint()),
|
|
352
|
+
submittedQuoteProceedsScaled: v.optional(v.bigint()),
|
|
282
353
|
takeProfitTriggerId: OptionalPublicIdSchema,
|
|
283
354
|
stopLossTriggerId: OptionalPublicIdSchema,
|
|
284
355
|
trailingStopTriggerId: OptionalPublicIdSchema
|
|
285
|
-
}), v.transform(({ acceptedAt, acceptedAtTsNs, resolvedBaseQtyScaled, submittedMaxQuoteDebitScaled, ...result }) => ({
|
|
356
|
+
}), v.transform(({ acceptedAt, acceptedAtTsNs, resolvedBaseQtyScaled, submittedMaxQuoteDebitScaled, submittedQuoteProceedsScaled, ...result }) => ({
|
|
286
357
|
...result,
|
|
287
358
|
acceptedAt: acceptedAt ?? tsNsToMs(acceptedAtTsNs),
|
|
288
359
|
acceptedAtNs: acceptedAtTsNs.toString(),
|
|
289
360
|
resolvedBaseQty: scaledToDecimalOutput(resolvedBaseQtyScaled, scales.baseQty(symbolId)),
|
|
290
|
-
...submittedMaxQuoteDebitScaled === void 0 ? {} : { submittedMaxQuoteDebit: scaledToDecimalOutput(submittedMaxQuoteDebitScaled, scales.quoteAmount(symbolId)) }
|
|
361
|
+
...submittedMaxQuoteDebitScaled === void 0 ? {} : { submittedMaxQuoteDebit: scaledToDecimalOutput(submittedMaxQuoteDebitScaled, scales.quoteAmount(symbolId)) },
|
|
362
|
+
...submittedQuoteProceedsScaled === void 0 ? {} : { submittedQuoteProceeds: scaledToDecimalOutput(submittedQuoteProceedsScaled, scales.quoteAmount(symbolId)) }
|
|
291
363
|
})));
|
|
292
364
|
}
|
|
293
365
|
function createPreviewOrderResultSchema(scales, symbolId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders-input.schemas.js","names":["ProtoWrite.MarketIocSchema","ProtoWrite.LimitGtcSchema","ProtoWrite.LimitGtdSchema","ProtoWrite.LimitIocSchema","ProtoWrite.LimitFokSchema"],"sources":["../../../src/services/orders/orders-input.schemas.ts"],"sourcesContent":["import * as ProtoWrite from \"../../gen/orders/v1/orders_pb.js\";\nimport { create } from \"@bufbuild/protobuf\";\nimport * as v from \"valibot\";\nimport { SideSchema, SymbolIdInputSchema } from \"../shared.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport { msToTimestamp } from \"../../utils/timestamp.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n OptionalPublicIdSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampMsSchema,\n optionalIdInputSchema,\n optionalUint64DecimalFilterSchema,\n} from \"../../shared/schemas.js\";\nimport {\n positiveDecimalInputToScaled,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport {\n FEE_ASSET_VALUES,\n ORDER_STATUS_FILTER_VALUES,\n OrderSideCodec,\n OrderStatusFilterCodec,\n SELF_TRADE_PREVENTION_MODE_VALUES,\n FeeAssetCodec,\n SelfTradePreventionModeCodec,\n CancelAllOrdersStatusCodec,\n CancelAllListingStatusCodec,\n CancelOrderStatusCodec,\n} from \"./orders.codecs.js\";\nimport {\n MarketMaxSlippageSchema,\n ATTACHED_TRAILING_LIMIT_SIDE_MESSAGE,\n attachedTrailingLimitMatchesSide,\n createRiskPolicyInputSchema,\n parseMarketMaxSlippage,\n} from \"./orders-risk.schemas.js\";\nimport {\n ClientOrderIdInputSchema,\n OptionalClientOrderIdInputSchema,\n OrderIdInputSchema,\n OrderRequestIdInputSchema,\n} from \"./orders-identifiers.schemas.js\";\nimport { OrderErrorDetailSchema } from \"./order-errors.schemas.js\";\nimport { MAX_SELLING_SLIPPAGE_BPS } from \"../trailing-oneof-inputs.js\";\n\nconst OrderStatusSchema = v.picklist(ORDER_STATUS_FILTER_VALUES);\nconst FeeAssetSchema = v.picklist(FEE_ASSET_VALUES);\nconst SelfTradePreventionModeSchema = v.picklist(SELF_TRADE_PREVENTION_MODE_VALUES);\n\nconst BaseOrdersFilterInputEntries = {\n ...AccountScopeInputEntries,\n symbolId: v.optional(v.array(SymbolIdInputSchema)),\n triggerId: optionalIdInputSchema(\"triggerId\"),\n side: v.pipe(\n v.optional(SideSchema),\n v.transform((v) => (v ? OrderSideCodec.inputToProto[v] : undefined)),\n ),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(1000))),\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n};\n\nexport const BaseOrdersFilterInputSchema = v.pipe(\n v.strictObject(BaseOrdersFilterInputEntries),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport const OpenOrdersInputSchema = v.pipe(\n v.strictObject({\n ...BaseOrdersFilterInputEntries,\n\n includeAttachedRisk: v.optional(v.boolean(), true),\n includeAttachedRiskState: v.optional(v.boolean(), false),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type OpenOrdersInput = v.InferInput<typeof OpenOrdersInputSchema>;\n\nexport const OrderHistoryInputSchema = v.pipe(\n v.strictObject({\n ...BaseOrdersFilterInputEntries,\n includeAttachedRisk: v.optional(v.boolean(), true),\n includeAttachedRiskState: v.optional(v.boolean(), false),\n status: v.pipe(\n v.optional(OrderStatusSchema),\n v.transform((v) => (v ? OrderStatusFilterCodec.inputToProto[v] : undefined)),\n ),\n startTsNs: optionalUint64DecimalFilterSchema(\"startTsNs\"),\n endTsNs: optionalUint64DecimalFilterSchema(\"endTsNs\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type OrderHistoryInput = v.InferInput<typeof OrderHistoryInputSchema>;\n\nconst DecimalInputStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\n/**\n * The wire contract stores GTD expiries as signed Unix nanoseconds. The public\n * `execution.expireAt` surface is integer epoch milliseconds, so these are the\n * inclusive millisecond values that remain representable by that contract.\n * The 1s..30d lead-time window is enforced server-side; checking it here\n * against the client clock would only add skew-dependent false rejections.\n */\nconst GTD_EXPIRE_AT_MIN_MS = -9_223_372_036_854;\nconst GTD_EXPIRE_AT_MAX_MS = 9_223_372_036_854;\n\nconst GtdExpireAtSchema = v.pipe(\n v.number(),\n v.integer(),\n v.minValue(GTD_EXPIRE_AT_MIN_MS),\n v.maxValue(GTD_EXPIRE_AT_MAX_MS),\n);\n\nfunction createOrderIntentBaseEntries(scales: SdkScales) {\n return {\n symbolId: SymbolIdInputSchema,\n side: v.pipe(\n SideSchema,\n v.transform((v) => OrderSideCodec.inputToProto[v]),\n ),\n execution: createOrderExecutionInputSchema(scales),\n clientOrderId: OptionalClientOrderIdInputSchema,\n feeAsset: v.pipe(\n v.optional(FeeAssetSchema),\n v.transform((v) => (v ? FeeAssetCodec.inputToProto[v] : undefined)),\n ),\n selfTradePreventionMode: v.pipe(\n v.optional(SelfTradePreventionModeSchema),\n v.transform((v) => (v ? SelfTradePreventionModeCodec.inputToProto[v] : undefined)),\n ),\n risk: createRiskPolicyInputSchema(scales),\n };\n}\n\ntype ParsedOrderIntentInput = v.InferOutput<ReturnType<typeof createOrderIntentInputObjectSchema>>;\n\ntype SellingSlippageInput = {\n side: ProtoWrite.Side;\n execution: v.InferOutput<ReturnType<typeof createOrderExecutionInputSchema>>;\n};\n\nconst SELLING_SLIPPAGE_MESSAGE = `maxSlippageBps must be between 1 and ${MAX_SELLING_SLIPPAGE_BPS} for a market order that sells`;\n\n/** Checks the bps cap of a market sell; attached trailing stops are capped when parsed. */\nfunction sellingSlippageWithinCap(input: SellingSlippageInput): boolean {\n const slippage =\n input.side === ProtoWrite.Side.SELL && input.execution.case === \"marketIoc\"\n ? input.execution.value.maxSlippage\n : undefined;\n return slippage?.case !== \"maxSlippageBps\" || slippage.value <= MAX_SELLING_SLIPPAGE_BPS;\n}\n\nfunction createOrderIntentInputObjectSchema(scales: SdkScales) {\n const baseEntries = createOrderIntentBaseEntries(scales);\n return v.pipe(\n v.union([\n v.strictObject({\n ...baseEntries,\n qty: DecimalInputStringSchema,\n maxQuoteDebit: v.optional(v.never()),\n }),\n v.strictObject({\n ...baseEntries,\n qty: v.optional(v.never()),\n maxQuoteDebit: DecimalInputStringSchema,\n }),\n ]),\n v.check(\n (input) =>\n input.maxQuoteDebit === undefined ||\n (input.side === ProtoWrite.Side.BUY &&\n (input.execution.case === \"marketIoc\" || input.execution.case === \"limitIoc\")),\n \"maxQuoteDebit is supported only for BUY market IOC and BUY limit IOC orders\",\n ),\n v.check(\n (input) =>\n input.side !== ProtoWrite.Side.SELL ||\n input.feeAsset === undefined ||\n input.feeAsset === ProtoWrite.FeeAsset.QUOTE,\n \"SELL orders must use the quote fee asset\",\n ),\n v.check((input) => sellingSlippageWithinCap(input), SELLING_SLIPPAGE_MESSAGE),\n v.check(\n (input) => attachedTrailingLimitMatchesSide(input),\n ATTACHED_TRAILING_LIMIT_SIDE_MESSAGE,\n ),\n );\n}\n\nfunction createScopedOrderIntentInputObjectSchema(scales: SdkScales) {\n const baseEntries = {\n ...AccountScopeInputEntries,\n ...createOrderIntentBaseEntries(scales),\n };\n return v.pipe(\n v.union([\n v.strictObject({\n ...baseEntries,\n qty: DecimalInputStringSchema,\n maxQuoteDebit: v.optional(v.never()),\n }),\n v.strictObject({\n ...baseEntries,\n qty: v.optional(v.never()),\n maxQuoteDebit: DecimalInputStringSchema,\n }),\n ]),\n v.check(\n (input) =>\n input.maxQuoteDebit === undefined ||\n (input.side === ProtoWrite.Side.BUY &&\n (input.execution.case === \"marketIoc\" || input.execution.case === \"limitIoc\")),\n \"maxQuoteDebit is supported only for BUY market IOC and BUY limit IOC orders\",\n ),\n v.check(\n (input) =>\n input.side !== ProtoWrite.Side.SELL ||\n input.feeAsset === undefined ||\n input.feeAsset === ProtoWrite.FeeAsset.QUOTE,\n \"SELL orders must use the quote fee asset\",\n ),\n v.check((input) => sellingSlippageWithinCap(input), SELLING_SLIPPAGE_MESSAGE),\n v.check(\n (input) => attachedTrailingLimitMatchesSide(input),\n ATTACHED_TRAILING_LIMIT_SIDE_MESSAGE,\n ),\n );\n}\n\nfunction toOrderIntent(input: ParsedOrderIntentInput, scales: SdkScales) {\n const { risk, qty, maxQuoteDebit, ...intent } = input;\n const sizing =\n qty !== undefined\n ? ({\n case: \"baseQtyScaled\",\n value: positiveDecimalInputToScaled(\"qty\", qty, scales.baseQty(intent.symbolId)),\n } as const)\n : ({\n case: \"maxQuoteDebitScaled\",\n value: positiveDecimalInputToScaled(\n \"maxQuoteDebit\",\n maxQuoteDebit,\n scales.quoteAmount(intent.symbolId),\n ),\n } as const);\n return {\n ...intent,\n sizing,\n feeAsset: intent.feeAsset ?? ProtoWrite.FeeAsset.QUOTE,\n attachedRisk: risk,\n };\n}\n\nexport function createOrderIntentInputSchema(scales: SdkScales) {\n return v.pipe(\n createOrderIntentInputObjectSchema(scales),\n v.transform((input) => toOrderIntent(input, scales)),\n );\n}\n\nexport type OrderIntentInput = v.InferInput<ReturnType<typeof createOrderIntentInputSchema>>;\n\nfunction createOrderExecutionInputSchema(scales: SdkScales) {\n const priceToTicks = (fieldName: string, price: string) =>\n positiveDecimalInputToScaled(fieldName, price, scales.price());\n\n return v.variant(\"type\", [\n v.pipe(\n v.strictObject({\n type: v.literal(\"market_ioc\"),\n maxSlippage: v.optional(MarketMaxSlippageSchema),\n clientRefPrice: v.optional(DecimalInputStringSchema),\n }),\n v.transform(({ maxSlippage, clientRefPrice }) => ({\n case: \"marketIoc\" as const,\n value: create(ProtoWrite.MarketIocSchema, {\n maxSlippage: parseMarketMaxSlippage(scales, maxSlippage),\n clientRefPriceTicks:\n clientRefPrice === undefined\n ? 0n\n : priceToTicks(\"execution.clientRefPrice\", clientRefPrice),\n }),\n })),\n ),\n v.pipe(\n v.strictObject({\n type: v.literal(\"limit_gtc\"),\n price: DecimalInputStringSchema,\n postOnly: v.optional(v.boolean(), false),\n }),\n v.transform(({ price, postOnly }) => ({\n case: \"limitGtc\" as const,\n value: create(ProtoWrite.LimitGtcSchema, {\n priceTicks: priceToTicks(\"execution.price\", price),\n postOnly,\n }),\n })),\n ),\n v.pipe(\n v.strictObject({\n type: v.literal(\"limit_gtd\"),\n price: DecimalInputStringSchema,\n /** Exact UTC expiry as integer epoch milliseconds. */\n expireAt: GtdExpireAtSchema,\n postOnly: v.optional(v.boolean(), false),\n }),\n v.transform(({ price, expireAt, postOnly }) => ({\n case: \"limitGtd\" as const,\n value: create(ProtoWrite.LimitGtdSchema, {\n priceTicks: priceToTicks(\"execution.price\", price),\n postOnly,\n expireAt: msToTimestamp(expireAt),\n }),\n })),\n ),\n v.pipe(\n v.strictObject({\n type: v.literal(\"limit_ioc\"),\n price: DecimalInputStringSchema,\n }),\n v.transform(({ price }) => ({\n case: \"limitIoc\" as const,\n value: create(ProtoWrite.LimitIocSchema, {\n priceTicks: priceToTicks(\"execution.price\", price),\n }),\n })),\n ),\n v.pipe(\n v.strictObject({\n type: v.literal(\"limit_fok\"),\n price: DecimalInputStringSchema,\n }),\n v.transform(({ price }) => ({\n case: \"limitFok\" as const,\n value: create(ProtoWrite.LimitFokSchema, {\n priceTicks: priceToTicks(\"execution.price\", price),\n }),\n })),\n ),\n ]);\n}\n\nexport function createNewOrderInputSchema(scales: SdkScales) {\n return v.pipe(\n createScopedOrderIntentInputObjectSchema(scales),\n v.transform(({ account, ...input }) => {\n return {\n subaccountId: accountScopeToSubaccountId(account),\n order: toOrderIntent(input, scales),\n };\n }),\n );\n}\n\nexport type NewOrderInput = v.InferInput<ReturnType<typeof createNewOrderInputSchema>>;\n\nconst CancelOrderScopeInputEntries = {\n symbolId: v.optional(SymbolIdInputSchema),\n ...AccountScopeInputEntries,\n};\n\nexport const CancelOrderInputSchema = v.pipe(\n v.union([\n v.strictObject({\n ...CancelOrderScopeInputEntries,\n orderId: OrderIdInputSchema,\n clientOrderId: v.optional(v.never()),\n }),\n v.strictObject({\n ...CancelOrderScopeInputEntries,\n orderId: v.optional(v.never()),\n clientOrderId: ClientOrderIdInputSchema,\n }),\n ]),\n v.transform(({ orderId, clientOrderId, account, ...rest }) => {\n const key =\n orderId !== undefined\n ? ({ case: \"orderId\", value: orderId } as const)\n : ({ case: \"clientOrderId\", value: clientOrderId } as const);\n return {\n ...rest,\n subaccountId: accountScopeToSubaccountId(account),\n key,\n };\n }),\n);\n\nexport type CancelOrderInput = v.InferInput<typeof CancelOrderInputSchema>;\n\nexport const CancelOrderResultSchema = v.pipe(\n v.object({\n status: enumLabelSchema(CancelOrderStatusCodec.protoToOutput),\n orderId: PublicIdSchema,\n tsNs: v.bigint(),\n }),\n v.transform(({ tsNs, ...result }) => ({\n ...result,\n ts: tsNsToMs(tsNs),\n tsNs: tsNs.toString(),\n })),\n);\n\nexport type CancelOrderResult = v.InferOutput<typeof CancelOrderResultSchema>;\n\nexport const CancelAllOrdersInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n symbolIds: v.optional(v.pipe(v.array(SymbolIdInputSchema), v.maxLength(100)), []),\n side: v.pipe(\n v.optional(SideSchema),\n v.transform((v) => (v ? OrderSideCodec.inputToProto[v] : undefined)),\n ),\n dryRun: v.optional(v.boolean(), false),\n requestId: v.optional(OrderRequestIdInputSchema),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type CancelAllOrdersInput = v.InferInput<typeof CancelAllOrdersInputSchema>;\n\nexport const CancelAllOrdersResponseSchema = v.pipe(\n v.object({\n status: enumLabelSchema(CancelAllOrdersStatusCodec.protoToOutput),\n matchedOrders: v.number(),\n submittedCancels: v.number(),\n failedCancels: v.number(),\n tsNs: v.bigint(),\n cancelledOrders: v.optional(\n v.array(v.object({ orderId: PublicIdSchema, clientOrderId: v.string() })),\n [],\n ),\n totalCancelled: v.optional(v.number(), 0),\n truncated: v.optional(v.boolean(), false),\n listingStatus: v.optional(enumLabelSchema(CancelAllListingStatusCodec.protoToOutput), 0),\n }),\n v.transform((o) => ({\n status: o.status,\n matchedOrders: o.matchedOrders,\n submittedCancels: o.submittedCancels,\n failedCancels: o.failedCancels,\n ts: tsNsToMs(o.tsNs),\n canceledOrders: o.cancelledOrders,\n totalCanceled: o.totalCancelled,\n truncated: o.truncated,\n listingStatus: o.listingStatus,\n })),\n);\n\nexport type CancelAllOrdersResponse = v.InferOutput<typeof CancelAllOrdersResponseSchema>;\n\nexport const GetOrderDetailsInputSchema = v.pipe(\n v.strictObject({\n orderId: v.optional(OrderIdInputSchema),\n clientOrderId: v.optional(ClientOrderIdInputSchema),\n ...AccountScopeInputEntries,\n includeExecutionHistory: v.optional(v.boolean()),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(1000))),\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n includeAttachedRisk: v.optional(v.boolean(), true),\n includeAttachedRiskState: v.optional(v.boolean(), true),\n }),\n v.check(\n (input) =>\n input.includeExecutionHistory !== false ||\n (input.limit === undefined && input.pageToken === undefined),\n \"limit and pageToken must be omitted when includeExecutionHistory is false\",\n ),\n v.check((input) => {\n const hasOrderId = input.orderId !== undefined;\n const hasClientOrderId = input.clientOrderId !== undefined;\n return hasOrderId !== hasClientOrderId;\n }, \"Provide exactly one of orderId or clientOrderId\"),\n v.transform(({ account, orderId, clientOrderId, ...rest }) => {\n const key =\n orderId !== undefined\n ? ({ case: \"orderId\", value: orderId } as const)\n : ({ case: \"clientOrderId\", value: clientOrderId ?? \"\" } as const);\n return {\n ...rest,\n subaccountId: accountScopeToSubaccountId(account),\n key,\n };\n }),\n);\n\nexport type GetOrderDetailsInput = v.InferInput<typeof GetOrderDetailsInputSchema>;\n\nexport function createCreateOrderResultSchema(scales: SdkScales, symbolId: number) {\n return v.pipe(\n v.object({\n orderId: PublicIdSchema,\n clientOrderId: v.string(),\n acceptedAt: OptionalTimestampMsSchema,\n acceptedAtTsNs: v.bigint(),\n resolvedBaseQtyScaled: v.bigint(),\n submittedMaxQuoteDebitScaled: v.optional(v.bigint()),\n takeProfitTriggerId: OptionalPublicIdSchema,\n stopLossTriggerId: OptionalPublicIdSchema,\n trailingStopTriggerId: OptionalPublicIdSchema,\n }),\n v.transform(\n ({\n acceptedAt,\n acceptedAtTsNs,\n resolvedBaseQtyScaled,\n submittedMaxQuoteDebitScaled,\n ...result\n }) => ({\n ...result,\n acceptedAt: acceptedAt ?? tsNsToMs(acceptedAtTsNs),\n acceptedAtNs: acceptedAtTsNs.toString(),\n resolvedBaseQty: scaledToDecimalOutput(\n resolvedBaseQtyScaled,\n scales.baseQty(symbolId),\n ),\n ...(submittedMaxQuoteDebitScaled === undefined\n ? {}\n : {\n submittedMaxQuoteDebit: scaledToDecimalOutput(\n submittedMaxQuoteDebitScaled,\n scales.quoteAmount(symbolId),\n ),\n }),\n }),\n ),\n );\n}\n\nexport type CreateOrderResult = v.InferOutput<ReturnType<typeof createCreateOrderResultSchema>>;\n\nexport function createPreviewOrderResultSchema(scales: SdkScales, symbolId: number) {\n return v.pipe(\n v.object({\n admissible: v.optional(v.boolean()),\n rejection: v.optional(OrderErrorDetailSchema),\n resolvedBaseQtyScaled: v.optional(v.bigint()),\n protectedPriceBoundTicks: v.optional(v.bigint()),\n evaluatedAt: TimestampMsSchema,\n }),\n v.transform(({ resolvedBaseQtyScaled, protectedPriceBoundTicks, ...result }) => ({\n ...result,\n ...(resolvedBaseQtyScaled === undefined\n ? {}\n : {\n resolvedBaseQty: scaledToDecimalOutput(\n resolvedBaseQtyScaled,\n scales.baseQty(symbolId),\n ),\n }),\n ...(protectedPriceBoundTicks === undefined\n ? {}\n : {\n protectedPriceBound: scaledToDecimalOutput(\n protectedPriceBoundTicks,\n scales.price(),\n ),\n }),\n })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ACL;AAIA,SAAgB,8BAA8B,QAAmB,UAAkB;CAC/E,OAAO,EAAE,KACL,EAAE,OAAO;EACL,SAAS;EACT,eAAe,EAAE,OAAO;EACxB,YAAY;EACZ,gBAAgB,EAAE,OAAO;EACzB,uBAAuB,EAAE,OAAO;EAChC,8BAA8B,EAAE,SAAS,EAAE,OAAO,CAAC;EACnD,qBAAqB;EACrB,mBAAmB;EACnB,uBAAuB;CAC3B,CAAC,GACD,EAAE,WACG,EACG,YACA,gBACA,uBACA,8BACA,GAAG,cACA;EACH,GAAG;EACH,YAAY,cAAc,SAAS,cAAc;EACjD,cAAc,eAAe,SAAS;EACtC,iBAAiB,sBACb,uBACA,OAAO,QAAQ,QAAQ,CAC3B;EACA,GAAI,iCAAiC,KAAA,IAC/B,CAAC,IACD,EACI,wBAAwB,sBACpB,8BACA,OAAO,YAAY,QAAQ,CAC/B,EACJ;CACV,EACJ,CACJ;AACJ;AAIA,SAAgB,+BAA+B,QAAmB,UAAkB;CAChF,OAAO,EAAE,KACL,EAAE,OAAO;EACL,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC;EAClC,WAAW,EAAE,SAAS,sBAAsB;EAC5C,uBAAuB,EAAE,SAAS,EAAE,OAAO,CAAC;EAC5C,0BAA0B,EAAE,SAAS,EAAE,OAAO,CAAC;EAC/C,aAAa;CACjB,CAAC,GACD,EAAE,WAAW,EAAE,uBAAuB,0BAA0B,GAAG,cAAc;EAC7E,GAAG;EACH,GAAI,0BAA0B,KAAA,IACxB,CAAC,IACD,EACI,iBAAiB,sBACb,uBACA,OAAO,QAAQ,QAAQ,CAC3B,EACJ;EACN,GAAI,6BAA6B,KAAA,IAC3B,CAAC,IACD,EACI,qBAAqB,sBACjB,0BACA,OAAO,MAAM,CACjB,EACJ;CACV,EAAE,CACN;AACJ"}
|
|
1
|
+
{"version":3,"file":"orders-input.schemas.js","names":["ProtoWrite.StaticPegSchema","ProtoWrite.MarketIocSchema","ProtoWrite.LimitGtcSchema","ProtoWrite.LimitGtdSchema","ProtoWrite.LimitIocSchema","ProtoWrite.LimitFokSchema"],"sources":["../../../src/services/orders/orders-input.schemas.ts"],"sourcesContent":["import * as ProtoWrite from \"../../gen/orders/v1/orders_pb.js\";\nimport { create } from \"@bufbuild/protobuf\";\nimport * as v from \"valibot\";\nimport { SideSchema, SymbolIdInputSchema } from \"../shared.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport { msToTimestamp } from \"../../utils/timestamp.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n OptionalPublicIdSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampMsSchema,\n optionalIdInputSchema,\n optionalUint64DecimalFilterSchema,\n} from \"../../shared/schemas.js\";\nimport {\n positiveDecimalInputToScaled,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport {\n FEE_ASSET_VALUES,\n ORDER_STATUS_FILTER_VALUES,\n OrderSideCodec,\n OrderStatusFilterCodec,\n SELF_TRADE_PREVENTION_MODE_VALUES,\n FeeAssetCodec,\n SelfTradePreventionModeCodec,\n CancelAllOrdersStatusCodec,\n CancelAllListingStatusCodec,\n CancelOrderStatusCodec,\n} from \"./orders.codecs.js\";\nimport {\n MarketMaxSlippageSchema,\n ATTACHED_TRAILING_LIMIT_SIDE_MESSAGE,\n attachedTrailingLimitMatchesSide,\n createRiskPolicyInputSchema,\n parseMarketMaxSlippage,\n} from \"./orders-risk.schemas.js\";\nimport {\n ClientOrderIdInputSchema,\n OptionalClientOrderIdInputSchema,\n OrderIdInputSchema,\n OrderRequestIdInputSchema,\n} from \"./orders-identifiers.schemas.js\";\nimport { OrderErrorDetailSchema } from \"./order-errors.schemas.js\";\nimport { PEG_REFERENCE_VALUES, PegReferenceCodec } from \"./order-enums.codecs.js\";\nimport { MAX_SELLING_SLIPPAGE_BPS } from \"../trailing-oneof-inputs.js\";\nimport { CatalogConversionError } from \"../../catalogs/types.js\";\nimport { PROTOBUF_INT64_MAX } from \"../../shared/wire-bounds.js\";\n\nconst OrderStatusSchema = v.picklist(ORDER_STATUS_FILTER_VALUES);\nconst FeeAssetSchema = v.picklist(FEE_ASSET_VALUES);\nconst SelfTradePreventionModeSchema = v.picklist(SELF_TRADE_PREVENTION_MODE_VALUES);\n\nconst BaseOrdersFilterInputEntries = {\n ...AccountScopeInputEntries,\n symbolId: v.optional(v.array(SymbolIdInputSchema)),\n triggerId: optionalIdInputSchema(\"triggerId\"),\n side: v.pipe(\n v.optional(SideSchema),\n v.transform((v) => (v ? OrderSideCodec.inputToProto[v] : undefined)),\n ),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(1000))),\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n};\n\nexport const BaseOrdersFilterInputSchema = v.pipe(\n v.strictObject(BaseOrdersFilterInputEntries),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport const OpenOrdersInputSchema = v.pipe(\n v.strictObject({\n ...BaseOrdersFilterInputEntries,\n\n includeAttachedRisk: v.optional(v.boolean(), true),\n includeAttachedRiskState: v.optional(v.boolean(), false),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type OpenOrdersInput = v.InferInput<typeof OpenOrdersInputSchema>;\n\nexport const OrderHistoryInputSchema = v.pipe(\n v.strictObject({\n ...BaseOrdersFilterInputEntries,\n includeAttachedRisk: v.optional(v.boolean(), true),\n includeAttachedRiskState: v.optional(v.boolean(), false),\n status: v.pipe(\n v.optional(OrderStatusSchema),\n v.transform((v) => (v ? OrderStatusFilterCodec.inputToProto[v] : undefined)),\n ),\n startTsNs: optionalUint64DecimalFilterSchema(\"startTsNs\"),\n endTsNs: optionalUint64DecimalFilterSchema(\"endTsNs\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type OrderHistoryInput = v.InferInput<typeof OrderHistoryInputSchema>;\n\nconst DecimalInputStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\n/**\n * The wire contract stores GTD expiries as signed Unix nanoseconds. The public\n * `execution.expireAt` surface is integer epoch milliseconds, so these are the\n * inclusive millisecond values that remain representable by that contract.\n * The 1s..30d lead-time window is enforced server-side; checking it here\n * against the client clock would only add skew-dependent false rejections.\n */\nconst GTD_EXPIRE_AT_MIN_MS = -9_223_372_036_854;\nconst GTD_EXPIRE_AT_MAX_MS = 9_223_372_036_854;\n\nconst GtdExpireAtSchema = v.pipe(\n v.number(),\n v.integer(),\n v.minValue(GTD_EXPIRE_AT_MIN_MS),\n v.maxValue(GTD_EXPIRE_AT_MAX_MS),\n);\n\nconst PROTOBUF_INT64_MIN = -PROTOBUF_INT64_MAX - 1n;\n\n/** Static entry peg: the limit price is taken once, at entry, from the selected book side. */\nconst StaticPegInputSchema = v.pipe(\n v.strictObject({\n reference: v.picklist(PEG_REFERENCE_VALUES),\n /** Signed count of the pair's tick size added to the reference, not a price. Defaults to 0. */\n offsetTicks: v.optional(\n v.pipe(\n v.union([\n v.bigint(),\n v.pipe(\n v.number(),\n v.safeInteger(),\n v.transform((n) => BigInt(n)),\n ),\n ]),\n v.check(\n (offset) => offset >= PROTOBUF_INT64_MIN && offset <= PROTOBUF_INT64_MAX,\n \"peg.offsetTicks must fit a signed 64-bit integer\",\n ),\n ),\n 0n,\n ),\n }),\n v.transform(({ reference, offsetTicks }) =>\n create(ProtoWrite.StaticPegSchema, {\n reference: PegReferenceCodec.inputToProto[reference],\n offsetTicks,\n }),\n ),\n);\n\nfunction createOrderIntentBaseEntries(scales: SdkScales) {\n return {\n symbolId: SymbolIdInputSchema,\n side: v.pipe(\n SideSchema,\n v.transform((v) => OrderSideCodec.inputToProto[v]),\n ),\n execution: createOrderExecutionInputSchema(scales),\n clientOrderId: OptionalClientOrderIdInputSchema,\n feeAsset: v.pipe(\n v.optional(FeeAssetSchema),\n v.transform((v) => (v ? FeeAssetCodec.inputToProto[v] : undefined)),\n ),\n selfTradePreventionMode: v.pipe(\n v.optional(SelfTradePreventionModeSchema),\n v.transform((v) => (v ? SelfTradePreventionModeCodec.inputToProto[v] : undefined)),\n ),\n risk: createRiskPolicyInputSchema(scales),\n /** Takes the limit price from the book at entry; `execution.price` stays the BUY cap or SELL floor. */\n peg: v.optional(StaticPegInputSchema),\n };\n}\n\ntype ParsedOrderIntentInput = v.InferOutput<ReturnType<typeof createOrderIntentInputObjectSchema>>;\n\ntype SellingSlippageInput = {\n side: ProtoWrite.Side;\n execution: v.InferOutput<ReturnType<typeof createOrderExecutionInputSchema>>;\n};\n\nconst SELLING_SLIPPAGE_MESSAGE = `maxSlippageBps must be between 1 and ${MAX_SELLING_SLIPPAGE_BPS} for a market order that sells`;\n\n/** Checks the bps cap of a market sell; attached trailing stops are capped when parsed. */\nfunction sellingSlippageWithinCap(input: SellingSlippageInput): boolean {\n const slippage =\n input.side === ProtoWrite.Side.SELL && input.execution.case === \"marketIoc\"\n ? input.execution.value.maxSlippage\n : undefined;\n return slippage?.case !== \"maxSlippageBps\" || slippage.value <= MAX_SELLING_SLIPPAGE_BPS;\n}\n\ntype OrderIntentRuleInput = {\n side: ProtoWrite.Side;\n execution: { case: string; displayQty?: string | undefined };\n qty?: string;\n quoteProceeds?: string;\n risk?: unknown;\n peg?: unknown;\n};\n\n/** Quote-proceeds sizing, static peg and iceberg combinations the exchange refuses. */\nfunction orderIntentRuleViolation(input: OrderIntentRuleInput): string | undefined {\n const ioc = input.execution.case === \"marketIoc\" || input.execution.case === \"limitIoc\";\n if (input.quoteProceeds !== undefined && (input.side !== ProtoWrite.Side.SELL || !ioc)) {\n return \"quoteProceeds is supported only for SELL market IOC and SELL limit IOC orders\";\n }\n if (input.quoteProceeds !== undefined && input.risk !== undefined) {\n return \"quoteProceeds cannot be combined with attached risk\";\n }\n if (\n input.peg !== undefined &&\n (input.qty === undefined ||\n input.execution.case === \"marketIoc\" ||\n input.risk !== undefined)\n ) {\n return \"peg requires qty sizing, a limit execution and no attached risk\";\n }\n if (input.execution.displayQty !== undefined && input.risk !== undefined) {\n return \"execution.displayQty cannot be combined with attached risk\";\n }\n return undefined;\n}\n\nfunction createOrderIntentInputObjectSchema(scales: SdkScales) {\n const baseEntries = createOrderIntentBaseEntries(scales);\n return v.pipe(\n v.union([\n v.strictObject({\n ...baseEntries,\n qty: DecimalInputStringSchema,\n maxQuoteDebit: v.optional(v.never()),\n quoteProceeds: v.optional(v.never()),\n }),\n v.strictObject({\n ...baseEntries,\n qty: v.optional(v.never()),\n maxQuoteDebit: DecimalInputStringSchema,\n quoteProceeds: v.optional(v.never()),\n }),\n v.strictObject({\n ...baseEntries,\n qty: v.optional(v.never()),\n maxQuoteDebit: v.optional(v.never()),\n /** SELL IOC only: sells until its proceeds before fees reach this quote amount. */\n quoteProceeds: DecimalInputStringSchema,\n }),\n ]),\n v.check(\n (input) =>\n input.maxQuoteDebit === undefined ||\n (input.side === ProtoWrite.Side.BUY &&\n (input.execution.case === \"marketIoc\" || input.execution.case === \"limitIoc\")),\n \"maxQuoteDebit is supported only for BUY market IOC and BUY limit IOC orders\",\n ),\n v.check(\n (input) =>\n input.side !== ProtoWrite.Side.SELL ||\n input.feeAsset === undefined ||\n input.feeAsset === ProtoWrite.FeeAsset.QUOTE,\n \"SELL orders must use the quote fee asset\",\n ),\n v.check((input) => sellingSlippageWithinCap(input), SELLING_SLIPPAGE_MESSAGE),\n v.check(\n (input) => attachedTrailingLimitMatchesSide(input),\n ATTACHED_TRAILING_LIMIT_SIDE_MESSAGE,\n ),\n v.check(\n (input) => orderIntentRuleViolation(input) === undefined,\n (issue) => orderIntentRuleViolation(issue.input) ?? \"\",\n ),\n );\n}\n\nfunction createScopedOrderIntentInputObjectSchema(scales: SdkScales) {\n const baseEntries = {\n ...AccountScopeInputEntries,\n ...createOrderIntentBaseEntries(scales),\n };\n return v.pipe(\n v.union([\n v.strictObject({\n ...baseEntries,\n qty: DecimalInputStringSchema,\n maxQuoteDebit: v.optional(v.never()),\n quoteProceeds: v.optional(v.never()),\n }),\n v.strictObject({\n ...baseEntries,\n qty: v.optional(v.never()),\n maxQuoteDebit: DecimalInputStringSchema,\n quoteProceeds: v.optional(v.never()),\n }),\n v.strictObject({\n ...baseEntries,\n qty: v.optional(v.never()),\n maxQuoteDebit: v.optional(v.never()),\n /** SELL IOC only: sells until its proceeds before fees reach this quote amount. */\n quoteProceeds: DecimalInputStringSchema,\n }),\n ]),\n v.check(\n (input) =>\n input.maxQuoteDebit === undefined ||\n (input.side === ProtoWrite.Side.BUY &&\n (input.execution.case === \"marketIoc\" || input.execution.case === \"limitIoc\")),\n \"maxQuoteDebit is supported only for BUY market IOC and BUY limit IOC orders\",\n ),\n v.check(\n (input) =>\n input.side !== ProtoWrite.Side.SELL ||\n input.feeAsset === undefined ||\n input.feeAsset === ProtoWrite.FeeAsset.QUOTE,\n \"SELL orders must use the quote fee asset\",\n ),\n v.check((input) => sellingSlippageWithinCap(input), SELLING_SLIPPAGE_MESSAGE),\n v.check(\n (input) => attachedTrailingLimitMatchesSide(input),\n ATTACHED_TRAILING_LIMIT_SIDE_MESSAGE,\n ),\n v.check(\n (input) => orderIntentRuleViolation(input) === undefined,\n (issue) => orderIntentRuleViolation(issue.input) ?? \"\",\n ),\n );\n}\n\nfunction toOrderIntent(input: ParsedOrderIntentInput, scales: SdkScales) {\n const { risk, qty, maxQuoteDebit, quoteProceeds, execution, ...intent } = input;\n const baseQtyScale = scales.baseQty(intent.symbolId);\n const sizing =\n qty !== undefined\n ? ({\n case: \"baseQtyScaled\",\n value: positiveDecimalInputToScaled(\"qty\", qty, baseQtyScale),\n } as const)\n : maxQuoteDebit !== undefined\n ? ({\n case: \"maxQuoteDebitScaled\",\n value: positiveDecimalInputToScaled(\n \"maxQuoteDebit\",\n maxQuoteDebit,\n scales.quoteAmount(intent.symbolId),\n ),\n } as const)\n : ({\n case: \"quoteProceedsScaled\",\n value: positiveDecimalInputToScaled(\n \"quoteProceeds\",\n quoteProceeds,\n scales.quoteAmount(intent.symbolId),\n ),\n } as const);\n return {\n ...intent,\n sizing,\n execution: withDisplayQty(\n execution,\n sizing.case === \"baseQtyScaled\" ? sizing.value : undefined,\n baseQtyScale,\n ),\n feeAsset: intent.feeAsset ?? ProtoWrite.FeeAsset.QUOTE,\n attachedRisk: risk,\n };\n}\n\n/**\n * Sets an iceberg display on a GTC or GTD limit. The server also requires a multiple of the\n * pair's quantity step and at least its minimum quantity.\n */\nfunction withDisplayQty(\n execution: ParsedOrderIntentInput[\"execution\"],\n baseQtyScaled: bigint | undefined,\n baseQtyScale: number,\n) {\n if (execution.case !== \"limitGtc\" && execution.case !== \"limitGtd\") return execution;\n const { displayQty, ...limit } = execution;\n if (displayQty === undefined) return limit;\n const display = positiveDecimalInputToScaled(\"execution.displayQty\", displayQty, baseQtyScale);\n // At most 100 parts: below the quantity and at least the quantity divided by 100, rounded up.\n if (baseQtyScaled === undefined || display >= baseQtyScaled || display * 100n < baseQtyScaled) {\n throw new CatalogConversionError(\n \"execution.displayQty\",\n \"execution.displayQty must be below qty and at least qty divided by 100, rounded up\",\n );\n }\n limit.value.displayQtyScaled = display;\n return limit;\n}\n\nexport function createOrderIntentInputSchema(scales: SdkScales) {\n return v.pipe(\n createOrderIntentInputObjectSchema(scales),\n v.transform((input) => toOrderIntent(input, scales)),\n );\n}\n\nexport type OrderIntentInput = v.InferInput<ReturnType<typeof createOrderIntentInputSchema>>;\n\nfunction createOrderExecutionInputSchema(scales: SdkScales) {\n const priceToTicks = (fieldName: string, price: string) =>\n positiveDecimalInputToScaled(fieldName, price, scales.price());\n\n return v.variant(\"type\", [\n v.pipe(\n v.strictObject({\n type: v.literal(\"market_ioc\"),\n maxSlippage: v.optional(MarketMaxSlippageSchema),\n clientRefPrice: v.optional(DecimalInputStringSchema),\n }),\n v.transform(({ maxSlippage, clientRefPrice }) => ({\n case: \"marketIoc\" as const,\n value: create(ProtoWrite.MarketIocSchema, {\n maxSlippage: parseMarketMaxSlippage(scales, maxSlippage),\n clientRefPriceTicks:\n clientRefPrice === undefined\n ? 0n\n : priceToTicks(\"execution.clientRefPrice\", clientRefPrice),\n }),\n })),\n ),\n v.pipe(\n v.strictObject({\n type: v.literal(\"limit_gtc\"),\n price: DecimalInputStringSchema,\n postOnly: v.optional(v.boolean(), false),\n /** Iceberg: the most of the order the book shows at once, in base units. */\n displayQty: v.optional(DecimalInputStringSchema),\n }),\n v.transform(({ price, postOnly, displayQty }) => ({\n case: \"limitGtc\" as const,\n value: create(ProtoWrite.LimitGtcSchema, {\n priceTicks: priceToTicks(\"execution.price\", price),\n postOnly,\n }),\n displayQty,\n })),\n ),\n v.pipe(\n v.strictObject({\n type: v.literal(\"limit_gtd\"),\n price: DecimalInputStringSchema,\n /** Exact UTC expiry as integer epoch milliseconds. */\n expireAt: GtdExpireAtSchema,\n postOnly: v.optional(v.boolean(), false),\n /** Iceberg: the most of the order the book shows at once, in base units. */\n displayQty: v.optional(DecimalInputStringSchema),\n }),\n v.transform(({ price, expireAt, postOnly, displayQty }) => ({\n case: \"limitGtd\" as const,\n value: create(ProtoWrite.LimitGtdSchema, {\n priceTicks: priceToTicks(\"execution.price\", price),\n postOnly,\n expireAt: msToTimestamp(expireAt),\n }),\n displayQty,\n })),\n ),\n v.pipe(\n v.strictObject({\n type: v.literal(\"limit_ioc\"),\n price: DecimalInputStringSchema,\n }),\n v.transform(({ price }) => ({\n case: \"limitIoc\" as const,\n value: create(ProtoWrite.LimitIocSchema, {\n priceTicks: priceToTicks(\"execution.price\", price),\n }),\n })),\n ),\n v.pipe(\n v.strictObject({\n type: v.literal(\"limit_fok\"),\n price: DecimalInputStringSchema,\n }),\n v.transform(({ price }) => ({\n case: \"limitFok\" as const,\n value: create(ProtoWrite.LimitFokSchema, {\n priceTicks: priceToTicks(\"execution.price\", price),\n }),\n })),\n ),\n ]);\n}\n\nexport function createNewOrderInputSchema(scales: SdkScales) {\n return v.pipe(\n createScopedOrderIntentInputObjectSchema(scales),\n v.transform(({ account, ...input }) => {\n return {\n subaccountId: accountScopeToSubaccountId(account),\n order: toOrderIntent(input, scales),\n };\n }),\n );\n}\n\nexport type NewOrderInput = v.InferInput<ReturnType<typeof createNewOrderInputSchema>>;\n\nconst CancelOrderScopeInputEntries = {\n symbolId: v.optional(SymbolIdInputSchema),\n ...AccountScopeInputEntries,\n};\n\nexport const CancelOrderInputSchema = v.pipe(\n v.union([\n v.strictObject({\n ...CancelOrderScopeInputEntries,\n orderId: OrderIdInputSchema,\n clientOrderId: v.optional(v.never()),\n }),\n v.strictObject({\n ...CancelOrderScopeInputEntries,\n orderId: v.optional(v.never()),\n clientOrderId: ClientOrderIdInputSchema,\n }),\n ]),\n v.transform(({ orderId, clientOrderId, account, ...rest }) => {\n const key =\n orderId !== undefined\n ? ({ case: \"orderId\", value: orderId } as const)\n : ({ case: \"clientOrderId\", value: clientOrderId } as const);\n return {\n ...rest,\n subaccountId: accountScopeToSubaccountId(account),\n key,\n };\n }),\n);\n\nexport type CancelOrderInput = v.InferInput<typeof CancelOrderInputSchema>;\n\nexport const CancelOrderResultSchema = v.pipe(\n v.object({\n status: enumLabelSchema(CancelOrderStatusCodec.protoToOutput),\n orderId: PublicIdSchema,\n tsNs: v.bigint(),\n }),\n v.transform(({ tsNs, ...result }) => ({\n ...result,\n ts: tsNsToMs(tsNs),\n tsNs: tsNs.toString(),\n })),\n);\n\nexport type CancelOrderResult = v.InferOutput<typeof CancelOrderResultSchema>;\n\nexport const CancelAllOrdersInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n symbolIds: v.optional(v.pipe(v.array(SymbolIdInputSchema), v.maxLength(100)), []),\n side: v.pipe(\n v.optional(SideSchema),\n v.transform((v) => (v ? OrderSideCodec.inputToProto[v] : undefined)),\n ),\n dryRun: v.optional(v.boolean(), false),\n requestId: v.optional(OrderRequestIdInputSchema),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type CancelAllOrdersInput = v.InferInput<typeof CancelAllOrdersInputSchema>;\n\nexport const CancelAllOrdersResponseSchema = v.pipe(\n v.object({\n status: enumLabelSchema(CancelAllOrdersStatusCodec.protoToOutput),\n matchedOrders: v.number(),\n submittedCancels: v.number(),\n failedCancels: v.number(),\n tsNs: v.bigint(),\n cancelledOrders: v.optional(\n v.array(v.object({ orderId: PublicIdSchema, clientOrderId: v.string() })),\n [],\n ),\n totalCancelled: v.optional(v.number(), 0),\n truncated: v.optional(v.boolean(), false),\n listingStatus: v.optional(enumLabelSchema(CancelAllListingStatusCodec.protoToOutput), 0),\n }),\n v.transform((o) => ({\n status: o.status,\n matchedOrders: o.matchedOrders,\n submittedCancels: o.submittedCancels,\n failedCancels: o.failedCancels,\n ts: tsNsToMs(o.tsNs),\n canceledOrders: o.cancelledOrders,\n totalCanceled: o.totalCancelled,\n truncated: o.truncated,\n listingStatus: o.listingStatus,\n })),\n);\n\nexport type CancelAllOrdersResponse = v.InferOutput<typeof CancelAllOrdersResponseSchema>;\n\nexport const GetOrderDetailsInputSchema = v.pipe(\n v.strictObject({\n orderId: v.optional(OrderIdInputSchema),\n clientOrderId: v.optional(ClientOrderIdInputSchema),\n ...AccountScopeInputEntries,\n includeExecutionHistory: v.optional(v.boolean()),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(1000))),\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n includeAttachedRisk: v.optional(v.boolean(), true),\n includeAttachedRiskState: v.optional(v.boolean(), true),\n }),\n v.check(\n (input) =>\n input.includeExecutionHistory !== false ||\n (input.limit === undefined && input.pageToken === undefined),\n \"limit and pageToken must be omitted when includeExecutionHistory is false\",\n ),\n v.check((input) => {\n const hasOrderId = input.orderId !== undefined;\n const hasClientOrderId = input.clientOrderId !== undefined;\n return hasOrderId !== hasClientOrderId;\n }, \"Provide exactly one of orderId or clientOrderId\"),\n v.transform(({ account, orderId, clientOrderId, ...rest }) => {\n const key =\n orderId !== undefined\n ? ({ case: \"orderId\", value: orderId } as const)\n : ({ case: \"clientOrderId\", value: clientOrderId ?? \"\" } as const);\n return {\n ...rest,\n subaccountId: accountScopeToSubaccountId(account),\n key,\n };\n }),\n);\n\nexport type GetOrderDetailsInput = v.InferInput<typeof GetOrderDetailsInputSchema>;\n\nexport function createCreateOrderResultSchema(scales: SdkScales, symbolId: number) {\n return v.pipe(\n v.object({\n orderId: PublicIdSchema,\n clientOrderId: v.string(),\n acceptedAt: OptionalTimestampMsSchema,\n acceptedAtTsNs: v.bigint(),\n resolvedBaseQtyScaled: v.bigint(),\n submittedMaxQuoteDebitScaled: v.optional(v.bigint()),\n submittedQuoteProceedsScaled: v.optional(v.bigint()),\n takeProfitTriggerId: OptionalPublicIdSchema,\n stopLossTriggerId: OptionalPublicIdSchema,\n trailingStopTriggerId: OptionalPublicIdSchema,\n }),\n v.transform(\n ({\n acceptedAt,\n acceptedAtTsNs,\n resolvedBaseQtyScaled,\n submittedMaxQuoteDebitScaled,\n submittedQuoteProceedsScaled,\n ...result\n }) => ({\n ...result,\n acceptedAt: acceptedAt ?? tsNsToMs(acceptedAtTsNs),\n acceptedAtNs: acceptedAtTsNs.toString(),\n resolvedBaseQty: scaledToDecimalOutput(\n resolvedBaseQtyScaled,\n scales.baseQty(symbolId),\n ),\n ...(submittedMaxQuoteDebitScaled === undefined\n ? {}\n : {\n submittedMaxQuoteDebit: scaledToDecimalOutput(\n submittedMaxQuoteDebitScaled,\n scales.quoteAmount(symbolId),\n ),\n }),\n ...(submittedQuoteProceedsScaled === undefined\n ? {}\n : {\n submittedQuoteProceeds: scaledToDecimalOutput(\n submittedQuoteProceedsScaled,\n scales.quoteAmount(symbolId),\n ),\n }),\n }),\n ),\n );\n}\n\nexport type CreateOrderResult = v.InferOutput<ReturnType<typeof createCreateOrderResultSchema>>;\n\nexport function createPreviewOrderResultSchema(scales: SdkScales, symbolId: number) {\n return v.pipe(\n v.object({\n admissible: v.optional(v.boolean()),\n rejection: v.optional(OrderErrorDetailSchema),\n resolvedBaseQtyScaled: v.optional(v.bigint()),\n protectedPriceBoundTicks: v.optional(v.bigint()),\n evaluatedAt: TimestampMsSchema,\n }),\n v.transform(({ resolvedBaseQtyScaled, protectedPriceBoundTicks, ...result }) => ({\n ...result,\n ...(resolvedBaseQtyScaled === undefined\n ? {}\n : {\n resolvedBaseQty: scaledToDecimalOutput(\n resolvedBaseQtyScaled,\n scales.baseQty(symbolId),\n ),\n }),\n ...(protectedPriceBoundTicks === undefined\n ? {}\n : {\n protectedPriceBound: scaledToDecimalOutput(\n protectedPriceBoundTicks,\n scales.price(),\n ),\n }),\n })),\n );\n}\n\nexport type PreviewOrderResult = v.InferOutput<ReturnType<typeof createPreviewOrderResultSchema>>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuDA,MAAM,oBAAoB,EAAE,SAAS,0BAA0B;AAC/D,MAAM,iBAAiB,EAAE,SAAS,gBAAgB;AAClD,MAAM,gCAAgC,EAAE,SAAS,iCAAiC;AAElF,MAAM,+BAA+B;CACjC,GAAG;CACH,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;CACjD,WAAW,sBAAsB,WAAW;CAC5C,MAAM,EAAE,KACJ,EAAE,SAAS,UAAU,GACrB,EAAE,WAAW,MAAO,IAAI,eAAe,aAAa,KAAK,KAAA,CAAU,CACvE;CACA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,GAAI,CAAC,CAAC;CAClF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC;AACtD;AAE2C,EAAE,KACzC,EAAE,aAAa,4BAA4B,GAC3C,EAAE,WAAW,EAAE,SAAS,GAAG,aAAa;CACpC,GAAG;CACH,cAAc,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