@polyester/sdk 0.9.0 → 0.9.1
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 +14 -0
- package/dist/catalogs/decimal.js +6 -4
- package/dist/catalogs/decimal.js.map +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +187 -13
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +4 -1
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +25 -25
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +2 -2
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-modify.schemas.d.ts +18 -18
- package/dist/services/orders/orders-risk.schemas.d.ts +12 -12
- package/dist/services/orders/orders-risk.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-risk.schemas.js +7 -6
- package/dist/services/orders/orders-risk.schemas.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +5 -5
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +14 -14
- package/dist/shared/decimal-surface.d.ts.map +1 -1
- package/dist/shared/decimal-surface.js +1 -1
- package/dist/shared/decimal-surface.js.map +1 -1
- package/package.json +1 -1
|
@@ -277,7 +277,7 @@ declare function createRiskPolicyInputSchema(scales: SdkScales): v.SchemaWithPip
|
|
|
277
277
|
}>]>;
|
|
278
278
|
readonly stopLoss: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
279
279
|
readonly trailingStop: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
280
|
-
readonly oco: v.OptionalSchema<v.
|
|
280
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
281
281
|
}, undefined>, v.StrictObjectSchema<{
|
|
282
282
|
readonly takeProfit: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
283
283
|
readonly stopLoss: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
@@ -309,7 +309,7 @@ declare function createRiskPolicyInputSchema(scales: SdkScales): v.SchemaWithPip
|
|
|
309
309
|
};
|
|
310
310
|
}>]>;
|
|
311
311
|
readonly trailingStop: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
312
|
-
readonly oco: v.OptionalSchema<v.
|
|
312
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
313
313
|
}, undefined>, v.StrictObjectSchema<{
|
|
314
314
|
readonly takeProfit: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
315
315
|
readonly stopLoss: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
@@ -376,7 +376,7 @@ declare function createRiskPolicyInputSchema(scales: SdkScales): v.SchemaWithPip
|
|
|
376
376
|
};
|
|
377
377
|
activationPriceTicks: bigint;
|
|
378
378
|
}>]>;
|
|
379
|
-
readonly oco: v.OptionalSchema<v.
|
|
379
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
380
380
|
}, undefined>], undefined>, undefined>, v.TransformAction<{
|
|
381
381
|
takeProfit: {
|
|
382
382
|
triggerPriceTicks: bigint;
|
|
@@ -457,7 +457,7 @@ declare function createRiskPolicyInputSchema(scales: SdkScales): v.SchemaWithPip
|
|
|
457
457
|
};
|
|
458
458
|
stopLoss?: undefined;
|
|
459
459
|
trailingStop?: undefined;
|
|
460
|
-
oco?:
|
|
460
|
+
oco?: false | undefined;
|
|
461
461
|
} | {
|
|
462
462
|
takeProfit?: undefined;
|
|
463
463
|
stopLoss: {
|
|
@@ -473,7 +473,7 @@ declare function createRiskPolicyInputSchema(scales: SdkScales): v.SchemaWithPip
|
|
|
473
473
|
};
|
|
474
474
|
};
|
|
475
475
|
trailingStop?: undefined;
|
|
476
|
-
oco?:
|
|
476
|
+
oco?: false | undefined;
|
|
477
477
|
} | {
|
|
478
478
|
takeProfit?: undefined;
|
|
479
479
|
stopLoss?: undefined;
|
|
@@ -500,7 +500,7 @@ declare function createRiskPolicyInputSchema(scales: SdkScales): v.SchemaWithPip
|
|
|
500
500
|
};
|
|
501
501
|
activationPriceTicks: bigint;
|
|
502
502
|
};
|
|
503
|
-
oco?:
|
|
503
|
+
oco?: false | undefined;
|
|
504
504
|
} | undefined, {
|
|
505
505
|
takeProfit: {
|
|
506
506
|
triggerPriceTicks: bigint;
|
|
@@ -743,7 +743,7 @@ declare function createRequiredRiskPolicyInputSchema(scales: SdkScales): v.Schem
|
|
|
743
743
|
}>]>;
|
|
744
744
|
readonly stopLoss: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
745
745
|
readonly trailingStop: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
746
|
-
readonly oco: v.OptionalSchema<v.
|
|
746
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
747
747
|
}, undefined>, v.StrictObjectSchema<{
|
|
748
748
|
readonly takeProfit: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
749
749
|
readonly stopLoss: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
@@ -775,7 +775,7 @@ declare function createRequiredRiskPolicyInputSchema(scales: SdkScales): v.Schem
|
|
|
775
775
|
};
|
|
776
776
|
}>]>;
|
|
777
777
|
readonly trailingStop: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
778
|
-
readonly oco: v.OptionalSchema<v.
|
|
778
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
779
779
|
}, undefined>, v.StrictObjectSchema<{
|
|
780
780
|
readonly takeProfit: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
781
781
|
readonly stopLoss: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
@@ -842,7 +842,7 @@ declare function createRequiredRiskPolicyInputSchema(scales: SdkScales): v.Schem
|
|
|
842
842
|
};
|
|
843
843
|
activationPriceTicks: bigint;
|
|
844
844
|
}>]>;
|
|
845
|
-
readonly oco: v.OptionalSchema<v.
|
|
845
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
846
846
|
}, undefined>], undefined>, v.TransformAction<{
|
|
847
847
|
takeProfit: {
|
|
848
848
|
triggerPriceTicks: bigint;
|
|
@@ -923,7 +923,7 @@ declare function createRequiredRiskPolicyInputSchema(scales: SdkScales): v.Schem
|
|
|
923
923
|
};
|
|
924
924
|
stopLoss?: undefined;
|
|
925
925
|
trailingStop?: undefined;
|
|
926
|
-
oco?:
|
|
926
|
+
oco?: false | undefined;
|
|
927
927
|
} | {
|
|
928
928
|
takeProfit?: undefined;
|
|
929
929
|
stopLoss: {
|
|
@@ -939,7 +939,7 @@ declare function createRequiredRiskPolicyInputSchema(scales: SdkScales): v.Schem
|
|
|
939
939
|
};
|
|
940
940
|
};
|
|
941
941
|
trailingStop?: undefined;
|
|
942
|
-
oco?:
|
|
942
|
+
oco?: false | undefined;
|
|
943
943
|
} | {
|
|
944
944
|
takeProfit?: undefined;
|
|
945
945
|
stopLoss?: undefined;
|
|
@@ -966,7 +966,7 @@ declare function createRequiredRiskPolicyInputSchema(scales: SdkScales): v.Schem
|
|
|
966
966
|
};
|
|
967
967
|
activationPriceTicks: bigint;
|
|
968
968
|
};
|
|
969
|
-
oco?:
|
|
969
|
+
oco?: false | undefined;
|
|
970
970
|
}, {
|
|
971
971
|
takeProfit: {
|
|
972
972
|
triggerPriceTicks: bigint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders-risk.schemas.d.ts","names":[],"sources":["../../../src/services/orders/orders-risk.schemas.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOzD,kBAAkB,EAAE,WAAW,kBAAkB;KACjD,gBAAgB,EAAE,WAAW,kBAAkB;KAC/C,oBAAoB,EAAE,WAAW,kBAAkB;KACnD,kBAAkB,EAAE,WAAW,kBAAkB;KAOjD;EACJ;EAAkB;;EAClB;EAAa"}
|
|
@@ -54,7 +54,8 @@ function parseMaxSlippage(scales, slippage) {
|
|
|
54
54
|
return parseSlippageInput(scales, slippage, {
|
|
55
55
|
fieldName: "trailingStop.maxSlippage",
|
|
56
56
|
ticksCase: "maxSlippageTicks",
|
|
57
|
-
bpsCase: "maxSlippageBps"
|
|
57
|
+
bpsCase: "maxSlippageBps",
|
|
58
|
+
maxBps: MAX_BPS
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
function parseMarketMaxSlippage(scales, slippage) {
|
|
@@ -80,6 +81,7 @@ function createRiskPolicyObjectInputSchema(scales) {
|
|
|
80
81
|
const TakeProfitInputSchema = attachedTriggerInputSchema(scales, "takeProfit");
|
|
81
82
|
const StopLossInputSchema = attachedTriggerInputSchema(scales, "stopLoss");
|
|
82
83
|
const TrailingStopInputSchema = createTrailingStopInputSchema(scales);
|
|
84
|
+
const InactiveOcoInputSchema = v.optional(v.literal(false, "oco requires takeProfit and exactly one stop leg"));
|
|
83
85
|
return v.union([
|
|
84
86
|
v.strictObject({
|
|
85
87
|
takeProfit: TakeProfitInputSchema,
|
|
@@ -97,19 +99,19 @@ function createRiskPolicyObjectInputSchema(scales) {
|
|
|
97
99
|
takeProfit: TakeProfitInputSchema,
|
|
98
100
|
stopLoss: v.optional(v.never()),
|
|
99
101
|
trailingStop: v.optional(v.never()),
|
|
100
|
-
oco:
|
|
102
|
+
oco: InactiveOcoInputSchema
|
|
101
103
|
}),
|
|
102
104
|
v.strictObject({
|
|
103
105
|
takeProfit: v.optional(v.never()),
|
|
104
106
|
stopLoss: StopLossInputSchema,
|
|
105
107
|
trailingStop: v.optional(v.never()),
|
|
106
|
-
oco:
|
|
108
|
+
oco: InactiveOcoInputSchema
|
|
107
109
|
}),
|
|
108
110
|
v.strictObject({
|
|
109
111
|
takeProfit: v.optional(v.never()),
|
|
110
112
|
stopLoss: v.optional(v.never()),
|
|
111
113
|
trailingStop: TrailingStopInputSchema,
|
|
112
|
-
oco:
|
|
114
|
+
oco: InactiveOcoInputSchema
|
|
113
115
|
})
|
|
114
116
|
]);
|
|
115
117
|
}
|
|
@@ -124,11 +126,10 @@ function transformRiskPolicyInput(input) {
|
|
|
124
126
|
case: void 0,
|
|
125
127
|
value: void 0
|
|
126
128
|
};
|
|
127
|
-
const oco = input.oco === true && !!input.takeProfit && stopLeg.case !== void 0;
|
|
128
129
|
return {
|
|
129
130
|
takeProfit: input.takeProfit,
|
|
130
131
|
stopLeg,
|
|
131
|
-
oco
|
|
132
|
+
oco: input.oco ?? false
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
135
|
function createRiskPolicyInputSchema(scales) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders-risk.schemas.js","names":["ProtoWrite.RiskMarketIocSchema","ProtoWrite.RiskLimitGtcSchema"],"sources":["../../../src/services/orders/orders-risk.schemas.ts"],"sourcesContent":["import * as ProtoWrite from \"../../gen/orders/v1/orders_pb.js\";\nimport { create } from \"@bufbuild/protobuf\";\nimport * as v from \"valibot\";\nimport {\n BpsStringOrNumberInputSchema,\n NoneInputSchema,\n PriceDistanceInputSchema,\n PriceSlippageInputSchema,\n} from \"../shared.js\";\nimport {\n positiveDecimalInputToScaled,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport { parseSlippageInput, parseTrailingDistanceInput } from \"../trailing-oneof-inputs.js\";\n\nconst DecimalInputStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nfunction attachedTriggerInputSchema(scales: SdkScales, fieldPrefix: \"takeProfit\" | \"stopLoss\") {\n return v.pipe(\n v.strictObject({\n triggerPrice: DecimalInputStringSchema,\n execution: v.variant(\"type\", [\n v.strictObject({\n type: v.literal(\"market_ioc\"),\n }),\n v.strictObject({\n type: v.literal(\"limit_gtc\"),\n price: DecimalInputStringSchema,\n }),\n ]),\n }),\n v.transform((input) => {\n const execution: ProtoWrite.RiskExecution[\"execution\"] =\n input.execution.type === \"market_ioc\"\n ? {\n case: \"marketIoc\",\n value: create(ProtoWrite.RiskMarketIocSchema),\n }\n : {\n case: \"limitGtc\",\n value: create(ProtoWrite.RiskLimitGtcSchema, {\n priceTicks: positiveDecimalInputToScaled(\n `${fieldPrefix}.execution.price`,\n input.execution.price,\n scales.price(),\n ),\n }),\n };\n return {\n triggerPriceTicks: positiveDecimalInputToScaled(\n `${fieldPrefix}.triggerPrice`,\n input.triggerPrice,\n scales.price(),\n ),\n child: { execution },\n };\n }),\n );\n}\n\nconst TrailingDistanceSchema = v.union([\n PriceDistanceInputSchema,\n BpsStringOrNumberInputSchema,\n NoneInputSchema,\n]);\n\nconst MaxSlippageSchema = v.union([\n PriceSlippageInputSchema,\n BpsStringOrNumberInputSchema,\n NoneInputSchema,\n]);\n\nexport const MarketMaxSlippageSchema = v.union([\n PriceSlippageInputSchema,\n BpsStringOrNumberInputSchema,\n NoneInputSchema,\n]);\n\nconst MAX_BPS = 10_000;\nconst UNSET_TRAILING_STOP_MAX_SLIPPAGE: ProtoWrite.TrailingStopPolicy[\"maxSlippage\"] = {\n case: undefined,\n value: undefined,\n};\n\nfunction parseTrailingDistance(\n scales: SdkScales,\n distance: v.InferOutput<typeof TrailingDistanceSchema>,\n): ProtoWrite.TrailingStopPolicy[\"trailingDistance\"] {\n return parseTrailingDistanceInput(scales, distance, \"trailingStop.trailingDistance\");\n}\n\nfunction parseMaxSlippage(\n scales: SdkScales,\n slippage: v.InferOutput<typeof MaxSlippageSchema>,\n): ProtoWrite.TrailingStopPolicy[\"maxSlippage\"] {\n return parseSlippageInput(scales, slippage, {\n fieldName: \"trailingStop.maxSlippage\",\n ticksCase: \"maxSlippageTicks\",\n bpsCase: \"maxSlippageBps\",\n });\n}\n\nexport function parseMarketMaxSlippage(\n scales: SdkScales,\n slippage: v.InferOutput<typeof MarketMaxSlippageSchema> | undefined,\n): ProtoWrite.MarketIoc[\"maxSlippage\"] {\n return parseSlippageInput(scales, slippage, {\n fieldName: \"execution.maxSlippage\",\n ticksCase: \"maxSlippageTicks\",\n bpsCase: \"maxSlippageBps\",\n maxBps: MAX_BPS,\n });\n}\n\nfunction createTrailingStopInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n trailingDistance: TrailingDistanceSchema,\n maxSlippage: v.optional(MaxSlippageSchema),\n activationPrice: v.optional(DecimalInputStringSchema),\n }),\n v.transform((input) => ({\n trailingDistance: parseTrailingDistance(scales, input.trailingDistance),\n maxSlippage: input.maxSlippage\n ? parseMaxSlippage(scales, input.maxSlippage)\n : UNSET_TRAILING_STOP_MAX_SLIPPAGE,\n activationPriceTicks:\n input.activationPrice === undefined\n ? 0n\n : positiveDecimalInputToScaled(\n \"trailingStop.activationPrice\",\n input.activationPrice,\n scales.price(),\n ),\n })),\n );\n}\n\nfunction createRiskPolicyObjectInputSchema(scales: SdkScales) {\n const TakeProfitInputSchema = attachedTriggerInputSchema(scales, \"takeProfit\");\n const StopLossInputSchema = attachedTriggerInputSchema(scales, \"stopLoss\");\n const TrailingStopInputSchema = createTrailingStopInputSchema(scales);\n return v.union([\n v.strictObject({\n takeProfit: TakeProfitInputSchema,\n stopLoss: StopLossInputSchema,\n trailingStop: v.optional(v.never()),\n oco: v.optional(v.boolean()),\n }),\n v.strictObject({\n takeProfit: TakeProfitInputSchema,\n stopLoss: v.optional(v.never()),\n trailingStop: TrailingStopInputSchema,\n oco: v.optional(v.boolean()),\n }),\n v.strictObject({\n takeProfit: TakeProfitInputSchema,\n stopLoss: v.optional(v.never()),\n trailingStop: v.optional(v.never()),\n oco: v.optional(v.boolean()),\n }),\n v.strictObject({\n takeProfit: v.optional(v.never()),\n stopLoss: StopLossInputSchema,\n trailingStop: v.optional(v.never()),\n oco: v.optional(v.boolean()),\n }),\n v.strictObject({\n takeProfit: v.optional(v.never()),\n stopLoss: v.optional(v.never()),\n trailingStop: TrailingStopInputSchema,\n oco: v.optional(v.boolean()),\n }),\n ]);\n}\n\ntype RiskPolicyObjectInput = v.InferOutput<ReturnType<typeof createRiskPolicyObjectInputSchema>>;\n\nfunction transformRiskPolicyInput(input: RiskPolicyObjectInput) {\n const stopLeg = input.stopLoss\n ? ({ case: \"stopLoss\", value: input.stopLoss } as const)\n : input.trailingStop\n ? ({ case: \"trailingStop\", value: input.trailingStop } as const)\n : ({ case: undefined, value: undefined } as const);\n const oco = input.oco === true && !!input.takeProfit && stopLeg.case !== undefined;\n return {\n takeProfit: input.takeProfit,\n stopLeg,\n oco,\n };\n}\n\nexport function createRiskPolicyInputSchema(scales: SdkScales) {\n return v.pipe(\n v.optional(createRiskPolicyObjectInputSchema(scales)),\n v.transform((input) => (input ? transformRiskPolicyInput(input) : undefined)),\n );\n}\n\nexport function createRequiredRiskPolicyInputSchema(scales: SdkScales) {\n return v.pipe(\n createRiskPolicyObjectInputSchema(scales),\n v.transform((input) => transformRiskPolicyInput(input)),\n );\n}\n\nexport type TakeProfitInput = v.InferInput<ReturnType<typeof attachedTriggerInputSchema>>;\nexport type StopLossInput = v.InferInput<ReturnType<typeof attachedTriggerInputSchema>>;\nexport type TrailingStopInput = v.InferInput<ReturnType<typeof createTrailingStopInputSchema>>;\nexport type RiskPolicyInput = v.InferInput<ReturnType<typeof createRiskPolicyInputSchema>>;\n\ntype TrailingDistance =\n | { kind: \"distance\"; distance: string }\n | { kind: \"bps\"; bps: number }\n | { kind: \"none\" };\ntype TrailingMaxSlippage = { kind: \"slippage\"; slippage: string } | { kind: \"bps\"; bps: number };\nexport type MarketMaxSlippage =\n | { kind: \"slippage\"; slippage: string }\n | { kind: \"bps\"; bps: number };\n\nconst ReadRiskExecutionSchema = v.object({\n execution: v.variant(\"case\", [\n v.object({\n case: v.literal(\"marketIoc\"),\n value: v.object({}),\n }),\n v.object({\n case: v.literal(\"limitGtc\"),\n value: v.object({\n priceTicks: v.bigint(),\n }),\n }),\n ]),\n});\n\nconst ReadTakeProfitPolicySchema = v.object({\n triggerPriceTicks: v.bigint(),\n child: ReadRiskExecutionSchema,\n});\n\nconst ReadStopLossPolicySchema = v.object({\n triggerPriceTicks: v.bigint(),\n child: ReadRiskExecutionSchema,\n});\n\nconst ReadTrailingStopPolicySchema = v.object({\n trailingDistance: v.object({\n case: v.optional(\n v.union([\n v.literal(\"trailingDistanceTicks\"),\n v.literal(\"trailingDistanceBps\"),\n v.undefined(),\n ]),\n ),\n value: v.optional(v.union([v.bigint(), v.number(), v.undefined()])),\n }),\n maxSlippage: v.object({\n case: v.union([v.literal(\"maxSlippageTicks\"), v.literal(\"maxSlippageBps\"), v.undefined()]),\n value: v.optional(v.union([v.number(), v.undefined()])),\n }),\n activationPriceTicks: v.bigint(),\n});\n\nconst ReadAttachedRiskTakeProfitSchema = v.object({\n policy: v.optional(ReadTakeProfitPolicySchema),\n});\n\nconst ReadAttachedRiskStopLossSchema = v.object({\n policy: v.optional(ReadStopLossPolicySchema),\n});\n\nconst ReadAttachedRiskTrailingStopSchema = v.object({\n policy: v.optional(ReadTrailingStopPolicySchema),\n});\n\nexport const ReadAttachedRiskSchema = v.object({\n takeProfit: v.optional(ReadAttachedRiskTakeProfitSchema),\n stopLoss: v.optional(ReadAttachedRiskStopLossSchema),\n trailingStop: v.optional(ReadAttachedRiskTrailingStopSchema),\n oco: v.optional(v.boolean(), false),\n});\n\nfunction formatRiskExecution(\n scales: SdkScales,\n child: v.InferOutput<typeof ReadRiskExecutionSchema>,\n) {\n if (child.execution.case === \"marketIoc\") {\n return { type: \"market_ioc\" } as const;\n }\n return {\n type: \"limit_gtc\",\n price: scaledToDecimalOutput(child.execution.value.priceTicks, scales.price()),\n } as const;\n}\n\nfunction formatRiskLeg(\n scales: SdkScales,\n leg:\n | v.InferOutput<typeof ReadTakeProfitPolicySchema>\n | v.InferOutput<typeof ReadStopLossPolicySchema>,\n) {\n return {\n triggerPrice: scaledToDecimalOutput(leg.triggerPriceTicks, scales.price()),\n execution: formatRiskExecution(scales, leg.child),\n };\n}\n\nfunction formatTrailingDistance(\n scales: SdkScales,\n distance: v.InferOutput<typeof ReadTrailingStopPolicySchema>[\"trailingDistance\"],\n): TrailingDistance {\n if (distance.case === \"trailingDistanceTicks\" && typeof distance.value === \"bigint\") {\n return {\n kind: \"distance\",\n distance: scaledToDecimalOutput(distance.value, scales.price()),\n };\n }\n if (distance.case === \"trailingDistanceBps\" && typeof distance.value === \"number\") {\n return { kind: \"bps\", bps: distance.value };\n }\n return { kind: \"none\" };\n}\n\nfunction formatTrailingMaxSlippage(\n scales: SdkScales,\n slippage: v.InferOutput<typeof ReadTrailingStopPolicySchema>[\"maxSlippage\"],\n): TrailingMaxSlippage | undefined {\n if (slippage.case === \"maxSlippageTicks\" && typeof slippage.value === \"number\") {\n return {\n kind: \"slippage\",\n slippage: scaledToDecimalOutput(BigInt(slippage.value), scales.price()),\n };\n }\n if (slippage.case === \"maxSlippageBps\" && typeof slippage.value === \"number\") {\n return { kind: \"bps\", bps: slippage.value };\n }\n return undefined;\n}\n\nexport function formatMarketMaxSlippage(\n scales: SdkScales,\n ticks: number,\n bps: number,\n): MarketMaxSlippage | undefined {\n if (ticks > 0) {\n return { kind: \"slippage\", slippage: scaledToDecimalOutput(BigInt(ticks), scales.price()) };\n }\n if (bps > 0) {\n return { kind: \"bps\", bps };\n }\n return undefined;\n}\n\nexport function formatAttachedRisk(\n scales: SdkScales,\n risk: v.InferOutput<typeof ReadAttachedRiskSchema> | undefined,\n) {\n if (!risk) return undefined;\n\n const takeProfit = risk.takeProfit?.policy\n ? formatRiskLeg(scales, risk.takeProfit.policy)\n : undefined;\n const stopLoss = risk.stopLoss?.policy\n ? formatRiskLeg(scales, risk.stopLoss.policy)\n : undefined;\n const trailingStop = risk.trailingStop?.policy\n ? {\n trailingDistance: formatTrailingDistance(\n scales,\n risk.trailingStop.policy.trailingDistance,\n ),\n maxSlippage: formatTrailingMaxSlippage(scales, risk.trailingStop.policy.maxSlippage),\n activationPrice:\n risk.trailingStop.policy.activationPriceTicks > 0n\n ? scaledToDecimalOutput(\n risk.trailingStop.policy.activationPriceTicks,\n scales.price(),\n )\n : undefined,\n }\n : undefined;\n\n if (!takeProfit && !stopLoss && !trailingStop) return undefined;\n\n const effectiveStopLoss = trailingStop ? undefined : stopLoss;\n\n return {\n takeProfit,\n stopLoss: effectiveStopLoss,\n trailingStop,\n oco: risk.oco,\n };\n}\n"],"mappings":";;;;;;;AAgBA,MAAM,2BAA2B,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;AAE5E,SAAS,2BAA2B,QAAmB,aAAwC;CAC3F,OAAO,EAAE,KACL,EAAE,aAAa;EACX,cAAc;EACd,WAAW,EAAE,QAAQ,QAAQ,CACzB,EAAE,aAAa,EACX,MAAM,EAAE,QAAQ,YAAY,EAChC,CAAC,GACD,EAAE,aAAa;GACX,MAAM,EAAE,QAAQ,WAAW;GAC3B,OAAO;EACX,CAAC,CACL,CAAC;CACL,CAAC,GACD,EAAE,WAAW,UAAU;EACnB,MAAM,YACF,MAAM,UAAU,SAAS,eACnB;GACI,MAAM;GACN,OAAO,OAAOA,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S,0BACL,QACA,UAC+B;CAC/B,IAAI,SAAS,SAAS,sBAAsB,OAAO,SAAS,UAAU,UAClE,OAAO;EACH,MAAM;EACN,UAAU,sBAAsB,OAAO,SAAS,KAAK,GAAG,OAAO,MAAM,CAAC;CAC1E;CAEJ,IAAI,SAAS,SAAS,oBAAoB,OAAO,SAAS,UAAU,UAChE,OAAO;EAAE,MAAM;EAAO,KAAK,SAAS;CAAM;AAGlD;AAEA,SAAgB,wBACZ,QACA,OACA,KAC6B;CAC7B,IAAI,QAAQ,GACR,OAAO;EAAE,MAAM;EAAY,UAAU,sBAAsB,OAAO,KAAK,GAAG,OAAO,MAAM,CAAC;CAAE;CAE9F,IAAI,MAAM,GACN,OAAO;EAAE,MAAM;EAAO;CAAI;AAGlC;AAEA,SAAgB,mBACZ,QACA,MACF;CACE,IAAI,CAAC,MAAM,OAAO,KAAA;CAElB,MAAM,aAAa,KAAK,YAAY,SAC9B,cAAc,QAAQ,KAAK,WAAW,MAAM,IAC5C,KAAA;CACN,MAAM,WAAW,KAAK,UAAU,SAC1B,cAAc,QAAQ,KAAK,SAAS,MAAM,IAC1C,KAAA;CACN,MAAM,eAAe,KAAK,cAAc,SAClC;EACI,kBAAkB,uBACd,QACA,KAAK,aAAa,OAAO,gBAC7B;EACA,aAAa,0BAA0B,QAAQ,KAAK,aAAa,OAAO,WAAW;EACnF,iBACI,KAAK,aAAa,OAAO,uBAAuB,KAC1C,sBACI,KAAK,aAAa,OAAO,sBACzB,OAAO,MAAM,CACjB,IACA,KAAA;CACd,IACA,KAAA;CAEN,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,cAAc,OAAO,KAAA;CAItD,OAAO;EACH;EACA,UAJsB,eAAe,KAAA,IAAY;EAKjD;EACA,KAAK,KAAK;CACd;AACJ"}
|
|
1
|
+
{"version":3,"file":"orders-risk.schemas.js","names":["ProtoWrite.RiskMarketIocSchema","ProtoWrite.RiskLimitGtcSchema"],"sources":["../../../src/services/orders/orders-risk.schemas.ts"],"sourcesContent":["import * as ProtoWrite from \"../../gen/orders/v1/orders_pb.js\";\nimport { create } from \"@bufbuild/protobuf\";\nimport * as v from \"valibot\";\nimport {\n BpsStringOrNumberInputSchema,\n NoneInputSchema,\n PriceDistanceInputSchema,\n PriceSlippageInputSchema,\n} from \"../shared.js\";\nimport {\n positiveDecimalInputToScaled,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport { parseSlippageInput, parseTrailingDistanceInput } from \"../trailing-oneof-inputs.js\";\n\nconst DecimalInputStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nfunction attachedTriggerInputSchema(scales: SdkScales, fieldPrefix: \"takeProfit\" | \"stopLoss\") {\n return v.pipe(\n v.strictObject({\n triggerPrice: DecimalInputStringSchema,\n execution: v.variant(\"type\", [\n v.strictObject({\n type: v.literal(\"market_ioc\"),\n }),\n v.strictObject({\n type: v.literal(\"limit_gtc\"),\n price: DecimalInputStringSchema,\n }),\n ]),\n }),\n v.transform((input) => {\n const execution: ProtoWrite.RiskExecution[\"execution\"] =\n input.execution.type === \"market_ioc\"\n ? {\n case: \"marketIoc\",\n value: create(ProtoWrite.RiskMarketIocSchema),\n }\n : {\n case: \"limitGtc\",\n value: create(ProtoWrite.RiskLimitGtcSchema, {\n priceTicks: positiveDecimalInputToScaled(\n `${fieldPrefix}.execution.price`,\n input.execution.price,\n scales.price(),\n ),\n }),\n };\n return {\n triggerPriceTicks: positiveDecimalInputToScaled(\n `${fieldPrefix}.triggerPrice`,\n input.triggerPrice,\n scales.price(),\n ),\n child: { execution },\n };\n }),\n );\n}\n\nconst TrailingDistanceSchema = v.union([\n PriceDistanceInputSchema,\n BpsStringOrNumberInputSchema,\n NoneInputSchema,\n]);\n\nconst MaxSlippageSchema = v.union([\n PriceSlippageInputSchema,\n BpsStringOrNumberInputSchema,\n NoneInputSchema,\n]);\n\nexport const MarketMaxSlippageSchema = v.union([\n PriceSlippageInputSchema,\n BpsStringOrNumberInputSchema,\n NoneInputSchema,\n]);\n\nconst MAX_BPS = 10_000;\nconst UNSET_TRAILING_STOP_MAX_SLIPPAGE: ProtoWrite.TrailingStopPolicy[\"maxSlippage\"] = {\n case: undefined,\n value: undefined,\n};\n\nfunction parseTrailingDistance(\n scales: SdkScales,\n distance: v.InferOutput<typeof TrailingDistanceSchema>,\n): ProtoWrite.TrailingStopPolicy[\"trailingDistance\"] {\n return parseTrailingDistanceInput(scales, distance, \"trailingStop.trailingDistance\");\n}\n\nfunction parseMaxSlippage(\n scales: SdkScales,\n slippage: v.InferOutput<typeof MaxSlippageSchema>,\n): ProtoWrite.TrailingStopPolicy[\"maxSlippage\"] {\n return parseSlippageInput(scales, slippage, {\n fieldName: \"trailingStop.maxSlippage\",\n ticksCase: \"maxSlippageTicks\",\n bpsCase: \"maxSlippageBps\",\n maxBps: MAX_BPS,\n });\n}\n\nexport function parseMarketMaxSlippage(\n scales: SdkScales,\n slippage: v.InferOutput<typeof MarketMaxSlippageSchema> | undefined,\n): ProtoWrite.MarketIoc[\"maxSlippage\"] {\n return parseSlippageInput(scales, slippage, {\n fieldName: \"execution.maxSlippage\",\n ticksCase: \"maxSlippageTicks\",\n bpsCase: \"maxSlippageBps\",\n maxBps: MAX_BPS,\n });\n}\n\nfunction createTrailingStopInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n trailingDistance: TrailingDistanceSchema,\n maxSlippage: v.optional(MaxSlippageSchema),\n activationPrice: v.optional(DecimalInputStringSchema),\n }),\n v.transform((input) => ({\n trailingDistance: parseTrailingDistance(scales, input.trailingDistance),\n maxSlippage: input.maxSlippage\n ? parseMaxSlippage(scales, input.maxSlippage)\n : UNSET_TRAILING_STOP_MAX_SLIPPAGE,\n activationPriceTicks:\n input.activationPrice === undefined\n ? 0n\n : positiveDecimalInputToScaled(\n \"trailingStop.activationPrice\",\n input.activationPrice,\n scales.price(),\n ),\n })),\n );\n}\n\nfunction createRiskPolicyObjectInputSchema(scales: SdkScales) {\n const TakeProfitInputSchema = attachedTriggerInputSchema(scales, \"takeProfit\");\n const StopLossInputSchema = attachedTriggerInputSchema(scales, \"stopLoss\");\n const TrailingStopInputSchema = createTrailingStopInputSchema(scales);\n const InactiveOcoInputSchema = v.optional(\n v.literal(false, \"oco requires takeProfit and exactly one stop leg\"),\n );\n return v.union([\n v.strictObject({\n takeProfit: TakeProfitInputSchema,\n stopLoss: StopLossInputSchema,\n trailingStop: v.optional(v.never()),\n oco: v.optional(v.boolean()),\n }),\n v.strictObject({\n takeProfit: TakeProfitInputSchema,\n stopLoss: v.optional(v.never()),\n trailingStop: TrailingStopInputSchema,\n oco: v.optional(v.boolean()),\n }),\n v.strictObject({\n takeProfit: TakeProfitInputSchema,\n stopLoss: v.optional(v.never()),\n trailingStop: v.optional(v.never()),\n oco: InactiveOcoInputSchema,\n }),\n v.strictObject({\n takeProfit: v.optional(v.never()),\n stopLoss: StopLossInputSchema,\n trailingStop: v.optional(v.never()),\n oco: InactiveOcoInputSchema,\n }),\n v.strictObject({\n takeProfit: v.optional(v.never()),\n stopLoss: v.optional(v.never()),\n trailingStop: TrailingStopInputSchema,\n oco: InactiveOcoInputSchema,\n }),\n ]);\n}\n\ntype RiskPolicyObjectInput = v.InferOutput<ReturnType<typeof createRiskPolicyObjectInputSchema>>;\n\nfunction transformRiskPolicyInput(input: RiskPolicyObjectInput) {\n const stopLeg = input.stopLoss\n ? ({ case: \"stopLoss\", value: input.stopLoss } as const)\n : input.trailingStop\n ? ({ case: \"trailingStop\", value: input.trailingStop } as const)\n : ({ case: undefined, value: undefined } as const);\n return {\n takeProfit: input.takeProfit,\n stopLeg,\n oco: input.oco ?? false,\n };\n}\n\nexport function createRiskPolicyInputSchema(scales: SdkScales) {\n return v.pipe(\n v.optional(createRiskPolicyObjectInputSchema(scales)),\n v.transform((input) => (input ? transformRiskPolicyInput(input) : undefined)),\n );\n}\n\nexport function createRequiredRiskPolicyInputSchema(scales: SdkScales) {\n return v.pipe(\n createRiskPolicyObjectInputSchema(scales),\n v.transform((input) => transformRiskPolicyInput(input)),\n );\n}\n\nexport type TakeProfitInput = v.InferInput<ReturnType<typeof attachedTriggerInputSchema>>;\nexport type StopLossInput = v.InferInput<ReturnType<typeof attachedTriggerInputSchema>>;\nexport type TrailingStopInput = v.InferInput<ReturnType<typeof createTrailingStopInputSchema>>;\nexport type RiskPolicyInput = v.InferInput<ReturnType<typeof createRiskPolicyInputSchema>>;\n\ntype TrailingDistance =\n | { kind: \"distance\"; distance: string }\n | { kind: \"bps\"; bps: number }\n | { kind: \"none\" };\ntype TrailingMaxSlippage = { kind: \"slippage\"; slippage: string } | { kind: \"bps\"; bps: number };\nexport type MarketMaxSlippage =\n | { kind: \"slippage\"; slippage: string }\n | { kind: \"bps\"; bps: number };\n\nconst ReadRiskExecutionSchema = v.object({\n execution: v.variant(\"case\", [\n v.object({\n case: v.literal(\"marketIoc\"),\n value: v.object({}),\n }),\n v.object({\n case: v.literal(\"limitGtc\"),\n value: v.object({\n priceTicks: v.bigint(),\n }),\n }),\n ]),\n});\n\nconst ReadTakeProfitPolicySchema = v.object({\n triggerPriceTicks: v.bigint(),\n child: ReadRiskExecutionSchema,\n});\n\nconst ReadStopLossPolicySchema = v.object({\n triggerPriceTicks: v.bigint(),\n child: ReadRiskExecutionSchema,\n});\n\nconst ReadTrailingStopPolicySchema = v.object({\n trailingDistance: v.object({\n case: v.optional(\n v.union([\n v.literal(\"trailingDistanceTicks\"),\n v.literal(\"trailingDistanceBps\"),\n v.undefined(),\n ]),\n ),\n value: v.optional(v.union([v.bigint(), v.number(), v.undefined()])),\n }),\n maxSlippage: v.object({\n case: v.union([v.literal(\"maxSlippageTicks\"), v.literal(\"maxSlippageBps\"), v.undefined()]),\n value: v.optional(v.union([v.number(), v.undefined()])),\n }),\n activationPriceTicks: v.bigint(),\n});\n\nconst ReadAttachedRiskTakeProfitSchema = v.object({\n policy: v.optional(ReadTakeProfitPolicySchema),\n});\n\nconst ReadAttachedRiskStopLossSchema = v.object({\n policy: v.optional(ReadStopLossPolicySchema),\n});\n\nconst ReadAttachedRiskTrailingStopSchema = v.object({\n policy: v.optional(ReadTrailingStopPolicySchema),\n});\n\nexport const ReadAttachedRiskSchema = v.object({\n takeProfit: v.optional(ReadAttachedRiskTakeProfitSchema),\n stopLoss: v.optional(ReadAttachedRiskStopLossSchema),\n trailingStop: v.optional(ReadAttachedRiskTrailingStopSchema),\n oco: v.optional(v.boolean(), false),\n});\n\nfunction formatRiskExecution(\n scales: SdkScales,\n child: v.InferOutput<typeof ReadRiskExecutionSchema>,\n) {\n if (child.execution.case === \"marketIoc\") {\n return { type: \"market_ioc\" } as const;\n }\n return {\n type: \"limit_gtc\",\n price: scaledToDecimalOutput(child.execution.value.priceTicks, scales.price()),\n } as const;\n}\n\nfunction formatRiskLeg(\n scales: SdkScales,\n leg:\n | v.InferOutput<typeof ReadTakeProfitPolicySchema>\n | v.InferOutput<typeof ReadStopLossPolicySchema>,\n) {\n return {\n triggerPrice: scaledToDecimalOutput(leg.triggerPriceTicks, scales.price()),\n execution: formatRiskExecution(scales, leg.child),\n };\n}\n\nfunction formatTrailingDistance(\n scales: SdkScales,\n distance: v.InferOutput<typeof ReadTrailingStopPolicySchema>[\"trailingDistance\"],\n): TrailingDistance {\n if (distance.case === \"trailingDistanceTicks\" && typeof distance.value === \"bigint\") {\n return {\n kind: \"distance\",\n distance: scaledToDecimalOutput(distance.value, scales.price()),\n };\n }\n if (distance.case === \"trailingDistanceBps\" && typeof distance.value === \"number\") {\n return { kind: \"bps\", bps: distance.value };\n }\n return { kind: \"none\" };\n}\n\nfunction formatTrailingMaxSlippage(\n scales: SdkScales,\n slippage: v.InferOutput<typeof ReadTrailingStopPolicySchema>[\"maxSlippage\"],\n): TrailingMaxSlippage | undefined {\n if (slippage.case === \"maxSlippageTicks\" && typeof slippage.value === \"number\") {\n return {\n kind: \"slippage\",\n slippage: scaledToDecimalOutput(BigInt(slippage.value), scales.price()),\n };\n }\n if (slippage.case === \"maxSlippageBps\" && typeof slippage.value === \"number\") {\n return { kind: \"bps\", bps: slippage.value };\n }\n return undefined;\n}\n\nexport function formatMarketMaxSlippage(\n scales: SdkScales,\n ticks: number,\n bps: number,\n): MarketMaxSlippage | undefined {\n if (ticks > 0) {\n return { kind: \"slippage\", slippage: scaledToDecimalOutput(BigInt(ticks), scales.price()) };\n }\n if (bps > 0) {\n return { kind: \"bps\", bps };\n }\n return undefined;\n}\n\nexport function formatAttachedRisk(\n scales: SdkScales,\n risk: v.InferOutput<typeof ReadAttachedRiskSchema> | undefined,\n) {\n if (!risk) return undefined;\n\n const takeProfit = risk.takeProfit?.policy\n ? formatRiskLeg(scales, risk.takeProfit.policy)\n : undefined;\n const stopLoss = risk.stopLoss?.policy\n ? formatRiskLeg(scales, risk.stopLoss.policy)\n : undefined;\n const trailingStop = risk.trailingStop?.policy\n ? {\n trailingDistance: formatTrailingDistance(\n scales,\n risk.trailingStop.policy.trailingDistance,\n ),\n maxSlippage: formatTrailingMaxSlippage(scales, risk.trailingStop.policy.maxSlippage),\n activationPrice:\n risk.trailingStop.policy.activationPriceTicks > 0n\n ? scaledToDecimalOutput(\n risk.trailingStop.policy.activationPriceTicks,\n scales.price(),\n )\n : undefined,\n }\n : undefined;\n\n if (!takeProfit && !stopLoss && !trailingStop) return undefined;\n\n const effectiveStopLoss = trailingStop ? undefined : stopLoss;\n\n return {\n takeProfit,\n stopLoss: effectiveStopLoss,\n trailingStop,\n oco: risk.oco,\n };\n}\n"],"mappings":";;;;;;;AAgBA,MAAM,2BAA2B,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;AAE5E,SAAS,2BAA2B,QAAmB,aAAwC;CAC3F,OAAO,EAAE,KACL,EAAE,aAAa;EACX,cAAc;EACd,WAAW,EAAE,QAAQ,QAAQ,CACzB,EAAE,aAAa,EACX,MAAM,EAAE,QAAQ,YAAY,EAChC,CAAC,GACD,EAAE,aAAa;GACX,MAAM,EAAE,QAAQ,WAAW;G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
|
|
176
176
|
readonly granteeAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
177
177
|
readonly inviterAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
178
178
|
readonly role: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountRole$1, undefined>, v.TransformAction<SubaccountRole$1, "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer">]>;
|
|
179
|
-
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountInviteStatus$1, undefined>, v.TransformAction<SubaccountInviteStatus$1, "unspecified" | "pending" | "
|
|
179
|
+
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SubaccountInviteStatus$1, undefined>, v.TransformAction<SubaccountInviteStatus$1, "unspecified" | "pending" | "cancelled" | "accepted" | "declined">]>;
|
|
180
180
|
readonly createdAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
181
181
|
readonly seconds: v.BigintSchema<undefined>;
|
|
182
182
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -203,7 +203,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
203
203
|
granteeAccountId: string;
|
|
204
204
|
inviterAccountId: string;
|
|
205
205
|
role: "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer";
|
|
206
|
-
status: "unspecified" | "pending" | "
|
|
206
|
+
status: "unspecified" | "pending" | "cancelled" | "accepted" | "declined";
|
|
207
207
|
createdAt?: number | undefined;
|
|
208
208
|
respondedAt?: number | undefined;
|
|
209
209
|
granteeUsername: string;
|
|
@@ -221,7 +221,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
221
221
|
granteeAccountId: string;
|
|
222
222
|
inviterAccountId: string;
|
|
223
223
|
role: "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer";
|
|
224
|
-
status: "unspecified" | "pending" | "
|
|
224
|
+
status: "unspecified" | "pending" | "cancelled" | "accepted" | "declined";
|
|
225
225
|
createdAt?: number | undefined;
|
|
226
226
|
respondedAt?: number | undefined;
|
|
227
227
|
granteeUsername: string;
|
|
@@ -243,8 +243,8 @@ declare const SubaccountActivityEventSchema: v.ObjectSchema<{
|
|
|
243
243
|
seconds: bigint;
|
|
244
244
|
nanos: number;
|
|
245
245
|
} | undefined, number | undefined>]>;
|
|
246
|
-
readonly entityKind: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEntityKind, undefined>, v.TransformAction<ActivityEntityKind, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "
|
|
247
|
-
readonly eventAction: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventAction, undefined>, v.TransformAction<ActivityEventAction, "unspecified" | "enabled" | "disabled" | "
|
|
246
|
+
readonly entityKind: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEntityKind, undefined>, v.TransformAction<ActivityEntityKind, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "policy" | "member" | "invite" | "security">]>;
|
|
247
|
+
readonly eventAction: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventAction, undefined>, v.TransformAction<ActivityEventAction, "unspecified" | "enabled" | "disabled" | "failed" | "deleted" | "created" | "updated" | "removed" | "role_set" | "received" | "replied" | "revoked" | "blocked" | "hold_placed" | "hold_released">]>;
|
|
248
248
|
readonly source: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ActivityEventSource, undefined>, v.TransformAction<ActivityEventSource, "unspecified" | "web" | "mobile" | "api">]>;
|
|
249
249
|
readonly ip: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
250
250
|
readonly userAgent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -790,7 +790,7 @@ type CreateTriggerInput = v.InferInput<ReturnType<typeof createCreateTriggerInpu
|
|
|
790
790
|
declare const ListTriggersInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
791
791
|
readonly parentOrderId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
792
792
|
readonly symbolId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
|
|
793
|
-
readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("
|
|
793
|
+
readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused")[] | undefined, (TriggerStatus.STATUS_CREATED | TriggerStatus.STATUS_ARMED | TriggerStatus.STATUS_RUNNING | TriggerStatus.STATUS_COMPLETED | TriggerStatus.STATUS_CANCELED | TriggerStatus.STATUS_FAILED | TriggerStatus.STATUS_PAUSED)[]>]>;
|
|
794
794
|
readonly triggerType: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["stop_loss", "take_profit", "trailing_stop", "twap", "ladder"], undefined>, undefined>, v.TransformAction<"twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop" | undefined, TriggerType>]>;
|
|
795
795
|
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, 50>;
|
|
796
796
|
readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
|
|
@@ -1001,7 +1001,7 @@ declare const ListTriggerEventsInputSchema: v.SchemaWithPipe<readonly [v.StrictO
|
|
|
1001
1001
|
readonly triggerId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
1002
1002
|
}, undefined>, v.TransformAction<{
|
|
1003
1003
|
limit?: number | undefined;
|
|
1004
|
-
eventType?: "
|
|
1004
|
+
eventType?: "failed" | "updated" | "fired" | "canceled" | undefined;
|
|
1005
1005
|
pageToken: string;
|
|
1006
1006
|
account?: "active" | "main" | {
|
|
1007
1007
|
subaccountId: string;
|
|
@@ -31,62 +31,62 @@ declare const CreateTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSche
|
|
|
31
31
|
type CreateTriggerResult = v.InferOutput<typeof CreateTriggerResultSchema>;
|
|
32
32
|
declare const CancelTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
33
33
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
34
|
-
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "
|
|
34
|
+
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
|
|
35
35
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
36
36
|
}, undefined>, v.TransformAction<{
|
|
37
37
|
triggerId: string;
|
|
38
|
-
status: "unspecified" | "
|
|
38
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
39
39
|
tsNs: bigint;
|
|
40
40
|
}, {
|
|
41
41
|
ts: number;
|
|
42
42
|
tsNs: string;
|
|
43
43
|
triggerId: string;
|
|
44
|
-
status: "unspecified" | "
|
|
44
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
45
45
|
}>]>;
|
|
46
46
|
type CancelTriggerResult = v.InferOutput<typeof CancelTriggerResultSchema>;
|
|
47
47
|
declare const ModifyTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
48
48
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
49
|
-
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "
|
|
49
|
+
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
|
|
50
50
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
51
51
|
}, undefined>, v.TransformAction<{
|
|
52
52
|
triggerId: string;
|
|
53
|
-
status: "unspecified" | "
|
|
53
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
54
54
|
tsNs: bigint;
|
|
55
55
|
}, {
|
|
56
56
|
ts: number;
|
|
57
57
|
tsNs: string;
|
|
58
58
|
triggerId: string;
|
|
59
|
-
status: "unspecified" | "
|
|
59
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
60
60
|
}>]>;
|
|
61
61
|
type ModifyTriggerResult = v.InferOutput<typeof ModifyTriggerResultSchema>;
|
|
62
62
|
declare const PauseTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
63
63
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
64
|
-
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "
|
|
64
|
+
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
|
|
65
65
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
66
66
|
}, undefined>, v.TransformAction<{
|
|
67
67
|
triggerId: string;
|
|
68
|
-
status: "unspecified" | "
|
|
68
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
69
69
|
tsNs: bigint;
|
|
70
70
|
}, {
|
|
71
71
|
ts: number;
|
|
72
72
|
tsNs: string;
|
|
73
73
|
triggerId: string;
|
|
74
|
-
status: "unspecified" | "
|
|
74
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
75
75
|
}>]>;
|
|
76
76
|
type PauseTriggerResult = v.InferOutput<typeof PauseTriggerResultSchema>;
|
|
77
77
|
declare const ResumeTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
78
78
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
79
|
-
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "
|
|
79
|
+
readonly status: v.SchemaWithPipe<readonly [v.EnumSchema<typeof TriggerStatus, undefined>, v.TransformAction<TriggerStatus, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
|
|
80
80
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
81
81
|
}, undefined>, v.TransformAction<{
|
|
82
82
|
triggerId: string;
|
|
83
|
-
status: "unspecified" | "
|
|
83
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
84
84
|
tsNs: bigint;
|
|
85
85
|
}, {
|
|
86
86
|
ts: number;
|
|
87
87
|
tsNs: string;
|
|
88
88
|
triggerId: string;
|
|
89
|
-
status: "unspecified" | "
|
|
89
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
90
90
|
}>]>;
|
|
91
91
|
type ResumeTriggerResult = v.InferOutput<typeof ResumeTriggerResultSchema>;
|
|
92
92
|
type StopDetailsOutput = {
|
|
@@ -505,7 +505,7 @@ declare function createTriggerSchema(scales: SdkScales): v.SchemaWithPipe<readon
|
|
|
505
505
|
triggerId: string;
|
|
506
506
|
subaccountId: string;
|
|
507
507
|
symbolId: number;
|
|
508
|
-
status: "unspecified" | "
|
|
508
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
509
509
|
parentOrderId: string | undefined;
|
|
510
510
|
qty: string;
|
|
511
511
|
feeAsset: "unspecified" | "quote" | "base";
|
|
@@ -670,7 +670,7 @@ declare function createTriggerEventSchema(scales: SdkScales): v.SchemaWithPipe<r
|
|
|
670
670
|
subaccountId: string;
|
|
671
671
|
symbolId: number;
|
|
672
672
|
triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
|
|
673
|
-
eventType: "unspecified" | "
|
|
673
|
+
eventType: "unspecified" | "failed" | "updated" | "fired" | "canceled";
|
|
674
674
|
ts: number;
|
|
675
675
|
childSeq: number;
|
|
676
676
|
childOrderId: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimal-surface.d.ts","names":[],"sources":["../../src/shared/decimal-surface.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"decimal-surface.d.ts","names":[],"sources":["../../src/shared/decimal-surface.ts"],"mappings":";;;;;;;UA+BiB;EACb,SAAS;EACT;EACA,QAAQ,MAAM;EACd,YAAY,MAAM;EAClB,aAAa;EACb,kBAAkB"}
|
|
@@ -29,7 +29,7 @@ function conversionFailureMessage(field, value, failure) {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Input direction: strict decimal→scaled conversion. Throws
|
|
32
|
-
* CatalogConversionError for non-decimal input or excess precision.
|
|
32
|
+
* CatalogConversionError for non-decimal input or inexact excess precision.
|
|
33
33
|
*/
|
|
34
34
|
function decimalInputToScaled(field, value, scale) {
|
|
35
35
|
const result = tryDecimalToScaled(value.trim(), scale);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimal-surface.js","names":[],"sources":["../../src/shared/decimal-surface.ts"],"sourcesContent":["/**\n * Internal scaled⇄decimal bridge for the SDK's public decimal-string surface.\n *\n * The wire protocol carries scaled integers (price ticks, per-asset scaled\n * quantities); the public SDK surface carries plain decimal strings. Output\n * schemas convert exactly (no rounding, trailing zeros trimmed); input schemas\n *
|
|
1
|
+
{"version":3,"file":"decimal-surface.js","names":[],"sources":["../../src/shared/decimal-surface.ts"],"sourcesContent":["/**\n * Internal scaled⇄decimal bridge for the SDK's public decimal-string surface.\n *\n * The wire protocol carries scaled integers (price ticks, per-asset scaled\n * quantities); the public SDK surface carries plain decimal strings. Output\n * schemas convert exactly (no rounding, trailing zeros trimmed); input schemas\n * accept zero padding but reject fractional precision that remains above the\n * scale after trailing zeros are removed. Scaled integers must not escape\n * through any service input or output.\n */\nimport {\n scaledToDecimal,\n tryDecimalToScaled,\n type DecimalToScaledFailure,\n} from \"../catalogs/decimal.js\";\nimport {\n CatalogConversionError,\n type ClientCatalog,\n type PairCatalogKey,\n} from \"../catalogs/types.js\";\nimport { PRICE_SCALE } from \"../catalogs/readers.js\";\nimport { PROTOBUF_INT64_MAX } from \"./wire-bounds.js\";\n\n/** On-chain unified-asset amounts (`amountE18`) are always 18-decimal scaled. */\nexport const E18_SCALE = 18;\n\n/**\n * Resolves wire scales for the SDK's internal decimal conversion. Backed by\n * the client catalog; `ready()` must be awaited before the synchronous lookups\n * are used so the catalog can answer them.\n */\nexport interface SdkScales {\n ready(): Promise<void>;\n price(): number;\n baseQty(pair: PairCatalogKey): number;\n quoteAmount(pair: PairCatalogKey): number;\n ledgerAmount(ledgerAssetId: number): number;\n zippedAssetAmount(zippedAssetId: number): number;\n}\n\n/**\n * Catalog-backed scale resolver. Takes a getter so it can be constructed\n * before the owning client has assigned its catalog.\n */\nexport function createCatalogSdkScales(getCatalog: () => ClientCatalog): SdkScales {\n return {\n ready: async () => {\n await getCatalog().ensureReady();\n },\n price: () => PRICE_SCALE,\n baseQty: (pair) => requirePair(getCatalog(), pair).baseAsset.quantityScale,\n quoteAmount: (pair) => requirePair(getCatalog(), pair).quoteAsset.quantityScale,\n ledgerAmount: (ledgerAssetId) =>\n getCatalog().ledger.requireAssetByLedgerId(ledgerAssetId).quantityScale,\n zippedAssetAmount: (zippedAssetId) =>\n getCatalog().zipper.requireAssetChainByZippedAssetId(zippedAssetId).asset.quantityScale,\n };\n}\n\nfunction requirePair(catalog: ClientCatalog, pair: PairCatalogKey) {\n return typeof pair === \"string\" || (typeof pair === \"object\" && \"symbol\" in pair)\n ? catalog.market.requirePairBySymbol(typeof pair === \"string\" ? pair : pair.symbol)\n : catalog.market.requirePairBySymbolId(typeof pair === \"number\" ? pair : pair.symbolId);\n}\n\n/** Output direction: exact scaled→decimal conversion (`1500000n`@6 → `\"1.5\"`). */\nexport function scaledToDecimalOutput(value: bigint, scale: number): string {\n return scaledToDecimal(value, scale);\n}\n\nfunction conversionFailureMessage(\n field: string,\n value: string,\n failure: DecimalToScaledFailure,\n): string {\n return failure.reason === \"precision\"\n ? `${field} supports at most ${failure.maxDecimals} decimal places: ${value}`\n : `${field} must be a non-negative decimal number: ${value}`;\n}\n\n/**\n * Input direction: strict decimal→scaled conversion. Throws\n * CatalogConversionError for non-decimal input or inexact excess precision.\n */\nexport function decimalInputToScaled(field: string, value: string, scale: number): bigint {\n const result = tryDecimalToScaled(value.trim(), scale);\n if (!result.ok) {\n throw new CatalogConversionError(\n field,\n conversionFailureMessage(field, value, result.failure),\n );\n }\n return result.scaled;\n}\n\nfunction unboundedPositiveDecimalInputToScaled(\n field: string,\n value: string,\n scale: number,\n): bigint {\n const scaled = decimalInputToScaled(field, value, scale);\n if (scaled <= 0n) {\n throw new CatalogConversionError(field, `${field} must be greater than 0: ${value}`);\n }\n return scaled;\n}\n\n/**\n * Converts a positive decimal input to a scaled protobuf `int64` value.\n * Rejects values above the wire-format ceiling before serialization.\n */\nexport function positiveDecimalInputToScaled(field: string, value: string, scale: number): bigint {\n const scaled = unboundedPositiveDecimalInputToScaled(field, value, scale);\n if (scaled > PROTOBUF_INT64_MAX) {\n throw new CatalogConversionError(\n field,\n `${field} exceeds the maximum supported value: ${value}`,\n );\n }\n return scaled;\n}\n\n/**\n * Decimal quantity → PolyesterChain E18 ledger units.\n * Input precision is capped at the asset's quantityScale; the wire value is\n * always upscaled to E18 (trading balances / amount_e18 convention).\n */\nexport function quantityInputToE18(params: {\n scales: SdkScales;\n assetId: number;\n quantity: string;\n field?: string;\n}): bigint {\n const field = params.field ?? \"quantity\";\n const assetScale = params.scales.ledgerAmount(params.assetId);\n if (assetScale > E18_SCALE) {\n throw new CatalogConversionError(\n field,\n `${field} asset quantityScale ${assetScale} exceeds E18 ledger scale`,\n );\n }\n return (\n unboundedPositiveDecimalInputToScaled(field, params.quantity, assetScale) *\n 10n ** BigInt(E18_SCALE - assetScale)\n );\n}\n\nexport interface ReadyGate {\n run(deliver: () => void): void;\n}\n\n/**\n * Orders event delivery behind catalog readiness. Events arriving before the\n * catalog can resolve scales are queued and flushed in arrival order once it\n * is ready; delivery errors (including post-flush ones) route to `onError`\n * instead of escaping into the transport, mirroring the realtime client's\n * consumer-handler isolation. If readiness itself fails, queued events are\n * dropped after `onError` fires — the stream cannot be decoded without scales.\n */\nexport function createReadyGate(\n ready: () => Promise<void>,\n onError?: (error: unknown) => void,\n): ReadyGate {\n let state: \"pending\" | \"open\" | \"failed\" = \"pending\";\n const queue: Array<() => void> = [];\n\n const deliverIsolated = (deliver: () => void) => {\n try {\n deliver();\n } catch (error) {\n onError?.(error);\n }\n };\n\n ready().then(\n () => {\n state = \"open\";\n for (const deliver of queue.splice(0)) deliverIsolated(deliver);\n },\n (error) => {\n state = \"failed\";\n queue.length = 0;\n onError?.(error);\n },\n );\n\n return {\n run(deliver) {\n if (state === \"open\") deliverIsolated(deliver);\n else if (state === \"pending\") queue.push(deliver);\n },\n };\n}\n"],"mappings":";;;;;;;AA4CA,SAAgB,uBAAuB,YAA4C;CAC/E,OAAO;EACH,OAAO,YAAY;GACf,MAAM,WAAW,CAAC,CAAC,YAAY;EACnC;EACA,aAAA;EACA,UAAU,SAAS,YAAY,WAAW,GAAG,IAAI,CAAC,CAAC,UAAU;EAC7D,cAAc,SAAS,YAAY,WAAW,GAAG,IAAI,CAAC,CAAC,WAAW;EAClE,eAAe,kBACX,WAAW,CAAC,CAAC,OAAO,uBAAuB,aAAa,CAAC,CAAC;EAC9D,oBAAoB,kBAChB,WAAW,CAAC,CAAC,OAAO,iCAAiC,aAAa,CAAC,CAAC,MAAM;CAClF;AACJ;AAEA,SAAS,YAAY,SAAwB,MAAsB;CAC/D,OAAO,OAAO,SAAS,YAAa,OAAO,SAAS,YAAY,YAAY,OACtE,QAAQ,OAAO,oBAAoB,OAAO,SAAS,WAAW,OAAO,KAAK,MAAM,IAChF,QAAQ,OAAO,sBAAsB,OAAO,SAAS,WAAW,OAAO,KAAK,QAAQ;AAC9F;;AAGA,SAAgB,sBAAsB,OAAe,OAAuB;CACxE,OAAO,gBAAgB,OAAO,KAAK;AACvC;AAEA,SAAS,yBACL,OACA,OACA,SACM;CACN,OAAO,QAAQ,WAAW,cACpB,GAAG,MAAM,oBAAoB,QAAQ,YAAY,mBAAmB,UACpE,GAAG,MAAM,0CAA0C;AAC7D;;;;;AAMA,SAAgB,qBAAqB,OAAe,OAAe,OAAuB;CACtF,MAAM,SAAS,mBAAmB,MAAM,KAAK,GAAG,KAAK;CACrD,IAAI,CAAC,OAAO,IACR,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