@polyester/sdk 0.35.0-devnet-20261110181538 → 0.35.0-devnet-20261110193018
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 +9 -1
- package/README.md +8 -8
- package/dist/realtime/client.js +13 -6
- package/dist/realtime/client.js.map +1 -1
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/changelog/changelog.schemas.d.ts +17 -17
- package/dist/services/heatmap/heatmap.schemas.d.ts +13 -13
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +3 -3
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +40 -40
- package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +34 -34
- package/dist/services/orders/orders-input.schemas.d.ts +5 -5
- package/dist/services/orders/orders-input.schemas.js +1 -1
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +14 -14
- package/dist/services/rewards/rewards.schemas.d.ts +3 -3
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +4 -4
- package/dist/services/transfers/transfers.schemas.d.ts +1 -1
- package/dist/services/transfers/transfers.schemas.js +1 -1
- package/dist/services/transfers/transfers.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +16 -11
- package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.js +26 -9
- package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfers.schemas.js","names":[],"sources":["../../../src/services/transfers/transfers.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { fromU128 } from \"../../utils/u128.js\";\nimport {\n AccountCodeCodec,\n TRANSFER_CODE_VALUES,\n TransferCodeCodec,\n} from \"../../shared/ledger-codes.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport { wireTimestampToMs } from \"../../utils/time.js\";\nimport {\n OptionalPublicIdSchema,\n OptionalTimestampMsToUsInputSchema,\n U128Schema,\n} from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { E18_SCALE, scaledToDecimalOutput } from \"../../shared/decimal-surface.js\";\nimport { TransferSideKindCodec } from \"./transfers.codecs.js\";\n\nconst WireTimestampInputSchema = v.union([\n v.bigint(),\n v.number(),\n v.pipe(\n v.string(),\n v.regex(/^\\d+$/),\n v.transform((value) => BigInt(value)),\n ),\n]);\n\nconst TransferSideKindSchema = enumLabelSchema(TransferSideKindCodec.protoToOutput);\n\nexport const LedgerTransferSideSchema = v.object({\n kind: TransferSideKindSchema,\n accountId: OptionalPublicIdSchema,\n address: v.optional(v.string(), \"\"),\n chainId: v.optional(v.number()),\n});\n\nexport type LedgerTransferSide = v.InferOutput<typeof LedgerTransferSideSchema>;\n\n/** Parses ledger transfer rows whose monetary fields use the protocol's fixed E18 scale. */\nexport const LedgerTransferSchema = v.pipe(\n v.object({\n assetId: v.number(),\n amountE18: v.optional(U128Schema),\n balanceAfterE18: v.optional(U128Schema),\n isDebit: v.boolean(),\n transferCode: v.number(),\n accountCode: v.number(),\n tsUs: WireTimestampInputSchema,\n linkId: v.optional(v.bigint()),\n flowId: v.optional(v.string()),\n source: v.optional(LedgerTransferSideSchema),\n destination: v.optional(LedgerTransferSideSchema),\n transferId: v.optional(v.string(), \"\"),\n }),\n v.transform((tr) => {\n const amount = fromU128(tr.amountE18);\n const linkId = tr.linkId && tr.linkId > 0n ? tr.linkId.toString() : undefined;\n\n const output = {\n transferId: tr.transferId,\n assetId: tr.assetId,\n amount: scaledToDecimalOutput(amount, E18_SCALE),\n balanceAfter:\n tr.balanceAfterE18 !== undefined\n ? scaledToDecimalOutput(fromU128(tr.balanceAfterE18), E18_SCALE)\n : undefined,\n type: enumLabel(TransferCodeCodec.protoToOutput, tr.transferCode),\n accountCode: enumLabel(AccountCodeCodec.protoToOutput, tr.accountCode),\n timestamp: wireTimestampToMs(tr.tsUs),\n isDebit: tr.isDebit,\n linkId,\n flowId: tr.flowId?.trim() ?? \"\",\n };\n\n return {\n ...output,\n ...(tr.source ? { source: tr.source } : {}),\n ...(tr.destination ? { destination: tr.destination } : {}),\n };\n }),\n);\n\nexport type LedgerTransfer = v.InferOutput<typeof LedgerTransferSchema>;\n\nexport const ListTransfersInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n ledger: v.optional(v.number(), 0),\n limit: v.optional(v.number()),\n reversed: v.optional(v.boolean(), false),\n timestampMin: OptionalTimestampMsToUsInputSchema,\n timestampMax: OptionalTimestampMsToUsInputSchema,\n transferCode: v.optional(\n v.pipe(\n v.picklist(TRANSFER_CODE_VALUES),\n v.transform((value) => TransferCodeCodec.inputToProto[value]),\n ),\n ),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, timestampMin, timestampMax, ...input }) => ({\n ...input,\n tsMinUs: timestampMin,\n tsMaxUs: timestampMax,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ListTransfersInput = v.InferInput<typeof ListTransfersInputSchema>;\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,2BAA2B,EAAE,MAAM;CACrC,EAAE,OAAO;CACT,EAAE,OAAO;CACT,EAAE,KACE,EAAE,OAAO,GACT,EAAE,MAAM,OAAO,GACf,EAAE,WAAW,UAAU,OAAO,KAAK,CAAC,CACxC;AACJ,CAAC;AAED,MAAM,yBAAyB,gBAAgB,sBAAsB,aAAa;AAElF,MAAa,2BAA2B,EAAE,OAAO;CAC7C,MAAM;CACN,WAAW;CACX,SAAS,EAAE,SAAS,EAAE,OAAO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AAG,CAAC;CAChC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"transfers.schemas.js","names":[],"sources":["../../../src/services/transfers/transfers.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { fromU128 } from \"../../utils/u128.js\";\nimport {\n AccountCodeCodec,\n TRANSFER_CODE_VALUES,\n TransferCodeCodec,\n} from \"../../shared/ledger-codes.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport { wireTimestampToMs } from \"../../utils/time.js\";\nimport {\n OptionalPublicIdSchema,\n OptionalTimestampMsToUsInputSchema,\n U128Schema,\n} from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { E18_SCALE, scaledToDecimalOutput } from \"../../shared/decimal-surface.js\";\nimport { TransferSideKindCodec } from \"./transfers.codecs.js\";\n\nconst WireTimestampInputSchema = v.union([\n v.bigint(),\n v.number(),\n v.pipe(\n v.string(),\n v.regex(/^\\d+$/),\n v.transform((value) => BigInt(value)),\n ),\n]);\n\nconst TransferSideKindSchema = enumLabelSchema(TransferSideKindCodec.protoToOutput);\n\nexport const LedgerTransferSideSchema = v.object({\n kind: TransferSideKindSchema,\n accountId: OptionalPublicIdSchema,\n address: v.optional(v.string(), \"\"),\n chainId: v.optional(v.number()),\n});\n\nexport type LedgerTransferSide = v.InferOutput<typeof LedgerTransferSideSchema>;\n\n/** Parses ledger transfer rows whose monetary fields use the protocol's fixed E18 scale. */\nexport const LedgerTransferSchema = v.pipe(\n v.object({\n assetId: v.number(),\n amountE18: v.optional(U128Schema),\n balanceAfterE18: v.optional(U128Schema),\n isDebit: v.boolean(),\n transferCode: v.number(),\n accountCode: v.number(),\n tsUs: WireTimestampInputSchema,\n linkId: v.optional(v.bigint()),\n flowId: v.optional(v.string()),\n source: v.optional(LedgerTransferSideSchema),\n destination: v.optional(LedgerTransferSideSchema),\n transferId: v.optional(v.string(), \"\"),\n }),\n v.transform((tr) => {\n const amount = fromU128(tr.amountE18);\n const linkId = tr.linkId && tr.linkId > 0n ? tr.linkId.toString() : undefined;\n\n const output = {\n transferId: tr.transferId,\n assetId: tr.assetId,\n amount: scaledToDecimalOutput(amount, E18_SCALE),\n balanceAfter:\n tr.balanceAfterE18 !== undefined\n ? scaledToDecimalOutput(fromU128(tr.balanceAfterE18), E18_SCALE)\n : undefined,\n type: enumLabel(TransferCodeCodec.protoToOutput, tr.transferCode),\n accountCode: enumLabel(AccountCodeCodec.protoToOutput, tr.accountCode),\n timestamp: wireTimestampToMs(tr.tsUs),\n isDebit: tr.isDebit,\n linkId,\n flowId: tr.flowId?.trim() ?? \"\",\n };\n\n return {\n ...output,\n ...(tr.source ? { source: tr.source } : {}),\n ...(tr.destination ? { destination: tr.destination } : {}),\n };\n }),\n);\n\nexport type LedgerTransfer = v.InferOutput<typeof LedgerTransferSchema>;\n\nexport const ListTransfersInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n ledger: v.optional(v.number(), 0),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(1000))),\n reversed: v.optional(v.boolean(), false),\n timestampMin: OptionalTimestampMsToUsInputSchema,\n timestampMax: OptionalTimestampMsToUsInputSchema,\n transferCode: v.optional(\n v.pipe(\n v.picklist(TRANSFER_CODE_VALUES),\n v.transform((value) => TransferCodeCodec.inputToProto[value]),\n ),\n ),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, timestampMin, timestampMax, ...input }) => ({\n ...input,\n tsMinUs: timestampMin,\n tsMaxUs: timestampMax,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ListTransfersInput = v.InferInput<typeof ListTransfersInputSchema>;\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,2BAA2B,EAAE,MAAM;CACrC,EAAE,OAAO;CACT,EAAE,OAAO;CACT,EAAE,KACE,EAAE,OA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AS,EAAE,QAAQ,GAAG,OAAO,IAAI,CAAC;EACzC,GAAI,GAAG,cAAc,EAAE,aAAa,GAAG,YAAY,IAAI,CAAC;CAC5D;AACJ,CAAC,CACL;AAIA,MAAa,2BAA2B,EAAE,KACtC,EAAE,aAAa;CACX,GAAG;CACH,QAAQ,EAAE,SAAS,EAAE,OAAO,GAAG,CAAC;CAChC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,GAAI,CAAC,CAAC;CAClF,UAAU,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CACvC,cAAc;CACd,cAAc;CACd,cAAc,EAAE,SACZ,EAAE,KACE,EAAE,SAAS,oBAAoB,GAC/B,EAAE,WAAW,UAAU,kBAAkB,aAAa,MAAM,CAChE,CACJ;CACA,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC1D,CAAC,GACD,EAAE,WAAW,EAAE,SAAS,cAAc,cAAc,GAAG,aAAa;CAChE,GAAG;CACH,SAAS;CACT,SAAS;CACT,cAAc,2BAA2B,OAAO;AACpD,EAAE,CACN"}
|
|
@@ -3,8 +3,13 @@ import { TriggerEventType, TriggerLimitFok, TriggerLimitGtc, TriggerLimitIoc, Tr
|
|
|
3
3
|
import { SdkScales } from "../../shared/decimal-surface.js";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
//#region src/services/triggers/trigger-input.schemas.d.ts
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Builds the create-trigger boundary schema using catalog scales keyed by symbol ID.
|
|
8
|
+
* The variant is picked by `triggerType` before validating, because a plain union
|
|
9
|
+
* reports the first branch's mismatch (e.g. "Expected stop_loss") instead of the
|
|
10
|
+
* chosen variant's missing or invalid field.
|
|
11
|
+
*/
|
|
12
|
+
declare function createCreateTriggerInputSchema(scales: SdkScales): v.LazySchema<v.LazySchema<v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
8
13
|
readonly side: v.LiteralSchema<"sell", undefined>;
|
|
9
14
|
readonly execution: v.VariantSchema<"type", [v.StrictObjectSchema<{
|
|
10
15
|
readonly type: v.LiteralSchema<"market_ioc", undefined>;
|
|
@@ -175,7 +180,7 @@ declare function createCreateTriggerInputSchema(scales: SdkScales): v.UnionSchem
|
|
|
175
180
|
selfTradePreventionMode: SelfTradePreventionMode.EXPIRE_MAKER | SelfTradePreventionMode.EXPIRE_TAKER | SelfTradePreventionMode.EXPIRE_BOTH;
|
|
176
181
|
clientTriggerId: string;
|
|
177
182
|
};
|
|
178
|
-
}>]
|
|
183
|
+
}>]> | v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
179
184
|
readonly side: v.LiteralSchema<"buy", undefined>;
|
|
180
185
|
readonly execution: v.VariantSchema<"type", [v.StrictObjectSchema<{
|
|
181
186
|
readonly type: v.LiteralSchema<"market_ioc", undefined>;
|
|
@@ -311,7 +316,7 @@ declare function createCreateTriggerInputSchema(scales: SdkScales): v.UnionSchem
|
|
|
311
316
|
selfTradePreventionMode: SelfTradePreventionMode.EXPIRE_MAKER | SelfTradePreventionMode.EXPIRE_TAKER | SelfTradePreventionMode.EXPIRE_BOTH;
|
|
312
317
|
clientTriggerId: string;
|
|
313
318
|
};
|
|
314
|
-
}>]
|
|
319
|
+
}>]>> | v.LazySchema<v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
315
320
|
readonly side: v.LiteralSchema<"sell", undefined>;
|
|
316
321
|
readonly execution: v.VariantSchema<"type", [v.StrictObjectSchema<{
|
|
317
322
|
readonly type: v.LiteralSchema<"market_ioc", undefined>;
|
|
@@ -482,7 +487,7 @@ declare function createCreateTriggerInputSchema(scales: SdkScales): v.UnionSchem
|
|
|
482
487
|
selfTradePreventionMode: SelfTradePreventionMode.EXPIRE_MAKER | SelfTradePreventionMode.EXPIRE_TAKER | SelfTradePreventionMode.EXPIRE_BOTH;
|
|
483
488
|
clientTriggerId: string;
|
|
484
489
|
};
|
|
485
|
-
}>]
|
|
490
|
+
}>]> | v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
486
491
|
readonly side: v.LiteralSchema<"buy", undefined>;
|
|
487
492
|
readonly execution: v.VariantSchema<"type", [v.StrictObjectSchema<{
|
|
488
493
|
readonly type: v.LiteralSchema<"market_ioc", undefined>;
|
|
@@ -618,7 +623,7 @@ declare function createCreateTriggerInputSchema(scales: SdkScales): v.UnionSchem
|
|
|
618
623
|
selfTradePreventionMode: SelfTradePreventionMode.EXPIRE_MAKER | SelfTradePreventionMode.EXPIRE_TAKER | SelfTradePreventionMode.EXPIRE_BOTH;
|
|
619
624
|
clientTriggerId: string;
|
|
620
625
|
};
|
|
621
|
-
}>]
|
|
626
|
+
}>]>> | v.LazySchema<v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
622
627
|
readonly side: v.OptionalSchema<v.LiteralSchema<"sell", undefined>, "sell">;
|
|
623
628
|
readonly limitPrice: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
624
629
|
readonly triggerType: v.LiteralSchema<"trailing_stop", undefined>;
|
|
@@ -746,7 +751,7 @@ declare function createCreateTriggerInputSchema(scales: SdkScales): v.UnionSchem
|
|
|
746
751
|
selfTradePreventionMode: SelfTradePreventionMode.EXPIRE_MAKER | SelfTradePreventionMode.EXPIRE_TAKER | SelfTradePreventionMode.EXPIRE_BOTH;
|
|
747
752
|
clientTriggerId: string;
|
|
748
753
|
};
|
|
749
|
-
}>]
|
|
754
|
+
}>]> | v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
750
755
|
readonly side: v.LiteralSchema<"buy", undefined>;
|
|
751
756
|
readonly limitPrice: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
752
757
|
readonly triggerType: v.LiteralSchema<"trailing_stop", undefined>;
|
|
@@ -882,7 +887,7 @@ declare function createCreateTriggerInputSchema(scales: SdkScales): v.UnionSchem
|
|
|
882
887
|
selfTradePreventionMode: SelfTradePreventionMode.EXPIRE_MAKER | SelfTradePreventionMode.EXPIRE_TAKER | SelfTradePreventionMode.EXPIRE_BOTH;
|
|
883
888
|
clientTriggerId: string;
|
|
884
889
|
};
|
|
885
|
-
}, "limitPrice must be at least activationPrice">]
|
|
890
|
+
}, "limitPrice must be at least activationPrice">]>> | v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
886
891
|
readonly triggerType: v.LiteralSchema<"twap", undefined>;
|
|
887
892
|
readonly side: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["buy", "sell"], undefined>, v.TransformAction<"buy" | "sell", Side.BUY | Side.SELL>]>;
|
|
888
893
|
readonly durationMs: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, v.NumberSchema<undefined>], undefined>, v.TransformAction<string | number, bigint>]>;
|
|
@@ -1018,7 +1023,7 @@ declare function createCreateTriggerInputSchema(scales: SdkScales): v.UnionSchem
|
|
|
1018
1023
|
selfTradePreventionMode: SelfTradePreventionMode.EXPIRE_MAKER | SelfTradePreventionMode.EXPIRE_TAKER | SelfTradePreventionMode.EXPIRE_BOTH;
|
|
1019
1024
|
clientTriggerId: string;
|
|
1020
1025
|
};
|
|
1021
|
-
}>]
|
|
1026
|
+
}>]> | v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
1022
1027
|
readonly triggerType: v.LiteralSchema<"ladder", undefined>;
|
|
1023
1028
|
readonly side: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["buy", "sell"], undefined>, v.TransformAction<"buy" | "sell", Side.BUY | Side.SELL>]>;
|
|
1024
1029
|
readonly priceMin: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -1101,7 +1106,7 @@ declare function createCreateTriggerInputSchema(scales: SdkScales): v.UnionSchem
|
|
|
1101
1106
|
selfTradePreventionMode: SelfTradePreventionMode.EXPIRE_MAKER | SelfTradePreventionMode.EXPIRE_TAKER | SelfTradePreventionMode.EXPIRE_BOTH;
|
|
1102
1107
|
clientTriggerId: string;
|
|
1103
1108
|
};
|
|
1104
|
-
}, "priceMin must be less than priceMax">]>
|
|
1109
|
+
}, "priceMin must be less than priceMax">]> | v.NeverSchema<`triggerType must be one of ${string}`>>;
|
|
1105
1110
|
/** Public input for creating a standalone trigger. */
|
|
1106
1111
|
type CreateTriggerInput = v.InferInput<ReturnType<typeof createCreateTriggerInputSchema>>;
|
|
1107
1112
|
/** Public filters for listing triggers in an account scope. */
|
|
@@ -1329,7 +1334,7 @@ declare const ListTriggerEventsInputSchema: v.SchemaWithPipe<readonly [v.StrictO
|
|
|
1329
1334
|
readonly triggerId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
1330
1335
|
}, undefined>, v.TransformAction<{
|
|
1331
1336
|
limit?: number | undefined;
|
|
1332
|
-
eventType?: "failed" | "canceled" | "
|
|
1337
|
+
eventType?: "failed" | "canceled" | "updated" | "armed" | "fired" | "activated" | "fire_refused" | undefined;
|
|
1333
1338
|
pageToken: string;
|
|
1334
1339
|
account?: "active" | "main" | {
|
|
1335
1340
|
subaccountId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-input.schemas.d.ts","names":[],"sources":["../../../src/services/triggers/trigger-input.schemas.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"trigger-input.schemas.d.ts","names":[],"sources":["../../../src/services/triggers/trigger-input.schemas.ts"],"mappings":";;;;;;;;;;;iBAkYgB,+BAA+B,QAAQ,YAAS,EAAA,WAAA,EAAA,WAAA,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;8CAe/D,EAAA;;KAGW,qBAAqB,EAAE,WAAW,kBAAkB;;cAGnD,yBAAuB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCxB,oBAAoB,EAAE,kBAAkB;cAEvC,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;KACzB,qBAAqB,EAAE,kBAAkB;cAExC,uBAAqB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;KACtB,kBAAkB,EAAE,kBAAkB;cAErC,yBAAuB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;KACxB,oBAAoB,EAAE,kBAAkB;cAEvC,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;KAWzB,qBAAqB,EAAE,kBAAkB;iBAErC,+BAA+B,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4DpD,qBAAqB,EAAE,WAAW,kBAAkB;cAEnD,8BAA4B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;KAiB7B,yBAAyB,EAAE,kBAAkB"}
|
|
@@ -44,7 +44,7 @@ function parseMaxSlippagePatch(scales, slippage) {
|
|
|
44
44
|
case: "maxSlippageTicks",
|
|
45
45
|
value: 0n
|
|
46
46
|
};
|
|
47
|
-
return parseMaxSlippage(scales, slippage
|
|
47
|
+
return parseMaxSlippage(scales, slippage);
|
|
48
48
|
}
|
|
49
49
|
function createConditionalTriggerInputSchema(scales, triggerType) {
|
|
50
50
|
const sharedEntries = {
|
|
@@ -189,15 +189,32 @@ function createLadderTriggerInputSchema(scales) {
|
|
|
189
189
|
};
|
|
190
190
|
}), v.check((output) => output.trigger.strategy.value.priceMinTicks < output.trigger.strategy.value.priceMaxTicks, "priceMin must be less than priceMax"));
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
function fieldOf(input, key) {
|
|
193
|
+
return typeof input === "object" && input !== null ? input[key] : void 0;
|
|
194
|
+
}
|
|
195
|
+
/** Validates against the side the caller chose, so errors name that side's fields. */
|
|
196
|
+
function bySide([sell, buy]) {
|
|
197
|
+
return v.lazy((input) => fieldOf(input, "side") === "buy" ? buy : sell);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Builds the create-trigger boundary schema using catalog scales keyed by symbol ID.
|
|
201
|
+
* The variant is picked by `triggerType` before validating, because a plain union
|
|
202
|
+
* reports the first branch's mismatch (e.g. "Expected stop_loss") instead of the
|
|
203
|
+
* chosen variant's missing or invalid field.
|
|
204
|
+
*/
|
|
193
205
|
function createCreateTriggerInputSchema(scales) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
createTwapTriggerInputSchema(scales),
|
|
199
|
-
createLadderTriggerInputSchema(scales)
|
|
200
|
-
|
|
206
|
+
const variants = {
|
|
207
|
+
stop_loss: bySide(createConditionalTriggerInputSchema(scales, "stop_loss")),
|
|
208
|
+
take_profit: bySide(createConditionalTriggerInputSchema(scales, "take_profit")),
|
|
209
|
+
trailing_stop: bySide(createTrailingStopTriggerInputSchema(scales)),
|
|
210
|
+
twap: createTwapTriggerInputSchema(scales),
|
|
211
|
+
ladder: createLadderTriggerInputSchema(scales)
|
|
212
|
+
};
|
|
213
|
+
const unknownVariant = v.never(`triggerType must be one of ${TRIGGER_TYPE_VALUES.join(", ")}`);
|
|
214
|
+
return v.lazy((input) => {
|
|
215
|
+
const triggerType = fieldOf(input, "triggerType");
|
|
216
|
+
return typeof triggerType === "string" && Object.hasOwn(variants, triggerType) ? variants[triggerType] : unknownVariant;
|
|
217
|
+
});
|
|
201
218
|
}
|
|
202
219
|
/** Public filters for listing triggers in an account scope. */
|
|
203
220
|
const ListTriggersInputSchema = v.pipe(v.strictObject({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-input.schemas.js","names":["TriggerSideCodec"],"sources":["../../../src/services/triggers/trigger-input.schemas.ts"],"sourcesContent":["import * as Proto from \"../../gen/triggers/v1/triggers_pb.js\";\nimport * as ProtoOrders from \"../../gen/orders/v1/orders_pb.js\";\nimport * as v from \"valibot\";\nimport { idInputSchema } from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { positiveDecimalInputToScaled, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { PROTOBUF_INT64_MAX } from \"../../shared/wire-bounds.js\";\nimport {\n parseOptionalPositiveBigIntLike,\n parseOptionalPositiveIntLike,\n} from \"../../utils/numbers.js\";\nimport { idToBigInt } from \"../../utils/base58-id.js\";\nimport {\n TRIGGER_EVENT_TYPE_VALUES,\n TRIGGER_STATUS_FILTER_VALUES,\n TRIGGER_TYPE_VALUES,\n TriggerEventTypeCodec,\n TriggerSideCodec,\n TriggerTypeCodec,\n TriggerStatusCodec,\n} from \"./triggers.codecs.js\";\nimport { BpsStringOrNumberInputSchema, NoneInputSchema, SymbolIdInputSchema } from \"../shared.js\";\nimport { TriggerPriceSourceInputSchema } from \"../orders/order-enums.codecs.js\";\nimport {\n BaseTriggerFieldsSchema,\n ConditionalExecutionInputSchema,\n DecimalInputStringSchema,\n TriggerSideInputSchema,\n TwapExecutionInputSchema,\n buildConditionalExecution,\n buildTriggerIntentBase,\n buildTwapExecution,\n MaxSlippageInputSchema,\n parseMaxSlippage,\n type MaxSlippageOneof,\n type TrailingDistanceOneof,\n} from \"./trigger-child-order.schemas.js\";\nimport { MAX_SELLING_SLIPPAGE_BPS, parseTrailingDistanceInput } from \"../trailing-oneof-inputs.js\";\n\nconst TriggerTypeSchema = v.picklist(TRIGGER_TYPE_VALUES);\nconst TriggerStatusFilterSchema = v.picklist(TRIGGER_STATUS_FILTER_VALUES);\nconst TriggerEventTypeSchema = v.picklist(TRIGGER_EVENT_TYPE_VALUES);\nconst TriggerIdInputSchema = idInputSchema(\"triggerId\");\n\nconst TriggerScopedInputEntries = {\n triggerId: TriggerIdInputSchema,\n ...AccountScopeInputEntries,\n};\n\nconst TriggerScopedInputSchema = v.pipe(\n v.strictObject(TriggerScopedInputEntries),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\n/** Absolute price distance, as a decimal price string (e.g. \"0.50\"). */\nconst PriceDistanceInputSchema = v.strictObject({\n kind: v.literal(\"distance\"),\n distance: DecimalInputStringSchema,\n});\n\nconst TrailingDistanceInputSchema = v.union([\n PriceDistanceInputSchema,\n BpsStringOrNumberInputSchema,\n]);\n\nconst ActivationPricePatchInputSchema = v.union([DecimalInputStringSchema, NoneInputSchema]);\n\nfunction parseTrailingDistance(\n scales: SdkScales,\n distance: v.InferOutput<typeof TrailingDistanceInputSchema>,\n): TrailingDistanceOneof {\n return parseTrailingDistanceInput(scales, distance, \"trailingDistance\");\n}\n\nfunction parseTwapMilliseconds(\n value: string | number,\n fieldName: \"durationMs\" | \"sliceIntervalMs\",\n minimum: bigint,\n): bigint {\n const parsed = parseOptionalPositiveBigIntLike(value);\n if (parsed === undefined || parsed < minimum || parsed > PROTOBUF_INT64_MAX) {\n throw new Error(\n `${fieldName} must be between ${minimum} and ${PROTOBUF_INT64_MAX} milliseconds`,\n );\n }\n return parsed;\n}\n\nfunction parseMaxSlippagePatch(\n scales: SdkScales,\n slippage: v.InferOutput<typeof MaxSlippageInputSchema>,\n): MaxSlippageOneof {\n if (slippage.kind === \"none\") {\n return { case: \"maxSlippageTicks\", value: 0n };\n }\n // The patch does not say what it modifies, so it takes the cap shared by\n // trailing stops and sells; a buy market child's 10000 bps needs creation.\n return parseMaxSlippage(scales, slippage, MAX_SELLING_SLIPPAGE_BPS);\n}\n\nfunction createConditionalTriggerInputSchema<const TriggerType extends \"stop_loss\" | \"take_profit\">(\n scales: SdkScales,\n triggerType: TriggerType,\n) {\n const sharedEntries = {\n ...BaseTriggerFieldsSchema.entries,\n triggerType: v.literal(triggerType),\n triggerPrice: DecimalInputStringSchema,\n triggerPriceSource: TriggerPriceSourceInputSchema,\n };\n\n const sellInputSchema = v.strictObject({\n ...sharedEntries,\n side: v.literal(\"sell\"),\n execution: ConditionalExecutionInputSchema,\n });\n const buyInputSchema = v.strictObject({\n ...sharedEntries,\n side: v.literal(\"buy\"),\n execution: ConditionalExecutionInputSchema,\n });\n\n function transformInput(\n input: v.InferOutput<typeof sellInputSchema> | v.InferOutput<typeof buyInputSchema>,\n ) {\n const { subaccountId, intent } = buildTriggerIntentBase(input, scales);\n const side = TriggerSideCodec.inputToProto[input.side];\n const strategy = {\n triggerPriceTicks: positiveDecimalInputToScaled(\n \"triggerPrice\",\n input.triggerPrice,\n scales.price(),\n ),\n side,\n child: buildConditionalExecution(input.execution, scales, side),\n triggerPriceSource: input.triggerPriceSource,\n };\n return {\n subaccountId,\n trigger: {\n ...intent,\n strategy:\n triggerType === \"stop_loss\"\n ? ({ case: \"stopLoss\", value: strategy } as const)\n : ({ case: \"takeProfit\", value: strategy } as const),\n },\n };\n }\n\n return [\n v.pipe(\n sellInputSchema,\n v.check(\n (input) => input.feeAsset === ProtoOrders.FeeAsset.QUOTE,\n \"SELL triggers must use the quote fee asset\",\n ),\n v.transform((input: v.InferOutput<typeof sellInputSchema>) => transformInput(input)),\n ),\n v.pipe(\n buyInputSchema,\n v.transform((input: v.InferOutput<typeof buyInputSchema>) => transformInput(input)),\n ),\n ] as const;\n}\n\nfunction createTrailingStopTriggerInputSchema(scales: SdkScales) {\n const sharedEntries = {\n ...BaseTriggerFieldsSchema.entries,\n triggerType: v.literal(\"trailing_stop\"),\n trailingDistance: TrailingDistanceInputSchema,\n activationPrice: v.optional(DecimalInputStringSchema),\n maxSlippage: v.optional(MaxSlippageInputSchema),\n triggerPriceSource: TriggerPriceSourceInputSchema,\n };\n const sellInputSchema = v.strictObject({\n ...sharedEntries,\n side: v.optional(v.literal(\"sell\"), \"sell\"),\n limitPrice: v.optional(v.never()),\n });\n // A buy's child never pays more than `limitPrice`, which also sizes its reserved funds.\n const buyInputSchema = v.strictObject({\n ...sharedEntries,\n side: v.literal(\"buy\"),\n limitPrice: DecimalInputStringSchema,\n });\n\n function transformInput(\n input: v.InferOutput<typeof sellInputSchema> | v.InferOutput<typeof buyInputSchema>,\n ) {\n const { subaccountId, intent } = buildTriggerIntentBase(input, scales);\n return {\n subaccountId,\n trigger: {\n ...intent,\n strategy: {\n case: \"trailingStop\",\n value: {\n trailingDistance: parseTrailingDistance(scales, input.trailingDistance),\n activationPriceTicks:\n input.activationPrice === undefined\n ? 0n\n : positiveDecimalInputToScaled(\n \"activationPrice\",\n input.activationPrice,\n scales.price(),\n ),\n maxSlippage: parseMaxSlippage(\n scales,\n input.maxSlippage,\n MAX_SELLING_SLIPPAGE_BPS,\n ),\n side: TriggerSideCodec.inputToProto[input.side],\n limitPriceTicks:\n input.limitPrice === undefined\n ? 0n\n : positiveDecimalInputToScaled(\n \"limitPrice\",\n input.limitPrice,\n scales.price(),\n ),\n triggerPriceSource: input.triggerPriceSource,\n },\n } as const,\n },\n };\n }\n\n return [\n v.pipe(\n sellInputSchema,\n v.check(\n (input) => input.feeAsset === ProtoOrders.FeeAsset.QUOTE,\n \"SELL triggers must use the quote fee asset\",\n ),\n v.transform((input: v.InferOutput<typeof sellInputSchema>) => transformInput(input)),\n ),\n v.pipe(\n buyInputSchema,\n v.transform((input: v.InferOutput<typeof buyInputSchema>) => transformInput(input)),\n v.check(\n ({ trigger: { strategy } }) =>\n strategy.value.activationPriceTicks <= strategy.value.limitPriceTicks,\n \"limitPrice must be at least activationPrice\",\n ),\n ),\n ] as const;\n}\n\nfunction createTwapTriggerInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...BaseTriggerFieldsSchema.entries,\n triggerType: v.literal(\"twap\"),\n side: TriggerSideInputSchema,\n durationMs: v.pipe(\n v.union([v.pipe(v.string(), v.trim()), v.number()]),\n v.transform((value) => parseTwapMilliseconds(value, \"durationMs\", 1_000n)),\n ),\n sliceIntervalMs: v.pipe(\n v.union([v.pipe(v.string(), v.trim()), v.number()]),\n v.transform((value) => parseTwapMilliseconds(value, \"sliceIntervalMs\", 100n)),\n ),\n execution: TwapExecutionInputSchema,\n }),\n v.check(\n (input) =>\n input.side !== ProtoOrders.Side.SELL ||\n input.feeAsset === ProtoOrders.FeeAsset.QUOTE,\n \"SELL triggers must use the quote fee asset\",\n ),\n v.check(\n (input) => input.sliceIntervalMs <= input.durationMs,\n \"sliceIntervalMs cannot exceed durationMs\",\n ),\n v.transform((input) => {\n const { subaccountId, intent } = buildTriggerIntentBase(input, scales);\n return {\n subaccountId,\n trigger: {\n ...intent,\n strategy: {\n case: \"twap\",\n value: {\n side: input.side,\n durationMs: input.durationMs,\n sliceIntervalMs: input.sliceIntervalMs,\n execution: buildTwapExecution(input.execution, scales),\n },\n } as const,\n },\n };\n }),\n );\n}\n\nfunction createLadderTriggerInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...BaseTriggerFieldsSchema.entries,\n triggerType: v.literal(\"ladder\"),\n side: TriggerSideInputSchema,\n priceMin: DecimalInputStringSchema,\n priceMax: DecimalInputStringSchema,\n levels: v.pipe(\n v.union([v.pipe(v.string(), v.trim()), v.pipe(v.number(), v.integer())]),\n v.transform((value) => {\n const levels = parseOptionalPositiveIntLike(value);\n if (!levels || levels < 2 || levels > 100) {\n throw new Error(\"levels must be between 2 and 100\");\n }\n return levels;\n }),\n ),\n postOnly: v.optional(v.boolean(), false),\n }),\n v.check(\n (input) =>\n input.side !== ProtoOrders.Side.SELL ||\n input.feeAsset === ProtoOrders.FeeAsset.QUOTE,\n \"SELL triggers must use the quote fee asset\",\n ),\n v.transform((input) => {\n const { subaccountId, intent } = buildTriggerIntentBase(input, scales);\n return {\n subaccountId,\n trigger: {\n ...intent,\n strategy: {\n case: \"ladder\",\n value: {\n side: input.side,\n priceMinTicks: positiveDecimalInputToScaled(\n \"priceMin\",\n input.priceMin,\n scales.price(),\n ),\n priceMaxTicks: positiveDecimalInputToScaled(\n \"priceMax\",\n input.priceMax,\n scales.price(),\n ),\n levels: input.levels,\n postOnly: input.postOnly,\n },\n } as const,\n },\n };\n }),\n v.check(\n (output) =>\n output.trigger.strategy.value.priceMinTicks <\n output.trigger.strategy.value.priceMaxTicks,\n \"priceMin must be less than priceMax\",\n ),\n );\n}\n\n/** Builds the create-trigger boundary schema using catalog scales keyed by symbol ID. */\nexport function createCreateTriggerInputSchema(scales: SdkScales) {\n return v.union([\n ...createConditionalTriggerInputSchema(scales, \"stop_loss\"),\n ...createConditionalTriggerInputSchema(scales, \"take_profit\"),\n ...createTrailingStopTriggerInputSchema(scales),\n createTwapTriggerInputSchema(scales),\n createLadderTriggerInputSchema(scales),\n ]);\n}\n\n/** Public input for creating a standalone trigger. */\nexport type CreateTriggerInput = v.InferInput<ReturnType<typeof createCreateTriggerInputSchema>>;\n\n/** Public filters for listing triggers in an account scope. */\nexport const ListTriggersInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n parentOrderId: v.pipe(\n v.optional(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? idToBigInt(value, \"parentOrderId\") : undefined)),\n ),\n symbolId: v.optional(SymbolIdInputSchema),\n status: v.pipe(\n v.optional(v.array(TriggerStatusFilterSchema)),\n v.transform(\n (values) => values?.map((value) => TriggerStatusCodec.inputToProto[value]) ?? [],\n ),\n ),\n triggerType: v.pipe(\n v.optional(TriggerTypeSchema),\n v.transform((value) =>\n value\n ? TriggerTypeCodec.inputToProto[value]\n : Proto.TriggerType.TRIGGER_TYPE_UNSPECIFIED,\n ),\n ),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(1000)), 50),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\n/** Public filters for listing triggers. */\nexport type ListTriggersInput = v.InferInput<typeof ListTriggersInputSchema>;\n\nexport const CancelTriggerInputSchema = TriggerScopedInputSchema;\nexport type CancelTriggerInput = v.InferInput<typeof CancelTriggerInputSchema>;\n\nexport const GetTriggerInputSchema = CancelTriggerInputSchema;\nexport type GetTriggerInput = v.InferInput<typeof GetTriggerInputSchema>;\n\nexport const PauseTriggerInputSchema = TriggerScopedInputSchema;\nexport type PauseTriggerInput = v.InferInput<typeof PauseTriggerInputSchema>;\n\nexport const ResumeTriggerInputSchema = v.pipe(\n v.strictObject({\n ...TriggerScopedInputEntries,\n symbolId: v.optional(SymbolIdInputSchema),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n/** Omitting `symbolId` uses the trigger's own market; when set, it must be that market. */\nexport type ResumeTriggerInput = v.InferInput<typeof ResumeTriggerInputSchema>;\n\nexport function createModifyTriggerInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...TriggerScopedInputEntries,\n symbolId: v.optional(SymbolIdInputSchema),\n triggerPrice: v.optional(DecimalInputStringSchema),\n trailingDistance: v.optional(TrailingDistanceInputSchema),\n activationPrice: v.optional(ActivationPricePatchInputSchema),\n maxSlippage: v.optional(MaxSlippageInputSchema),\n }),\n v.check(\n (input) =>\n input.triggerPrice !== undefined ||\n input.trailingDistance !== undefined ||\n input.activationPrice !== undefined ||\n input.maxSlippage !== undefined,\n \"At least one patch field is required\",\n ),\n v.transform(({ account, ...input }) => ({\n triggerId: input.triggerId,\n subaccountId: accountScopeToSubaccountId(account),\n // Zero targets the trigger's own market.\n symbolId: input.symbolId ?? 0,\n triggerPriceTicks:\n input.triggerPrice === undefined\n ? undefined\n : positiveDecimalInputToScaled(\n \"triggerPrice\",\n input.triggerPrice,\n scales.price(),\n ),\n trailingDistance:\n input.trailingDistance === undefined\n ? ({ case: undefined, value: undefined } as const)\n : parseTrailingDistance(scales, input.trailingDistance),\n activationPriceTicks:\n input.activationPrice === undefined\n ? undefined\n : typeof input.activationPrice !== \"string\"\n ? 0n\n : positiveDecimalInputToScaled(\n \"activationPrice\",\n input.activationPrice,\n scales.price(),\n ),\n maxSlippage:\n input.maxSlippage === undefined\n ? ({ case: undefined, value: undefined } as const)\n : parseMaxSlippagePatch(scales, input.maxSlippage),\n })),\n );\n}\n\n/**\n * A trigger patch. Omitted fields remain unchanged; `{ kind: \"none\" }` clears\n * `activationPrice` or `maxSlippage`. A cleared `maxSlippage` on a market child\n * falls back to the pair's default market slippage. Omitting `symbolId` uses\n * the trigger's own market; when set, it must be that market. A child's limit price is\n * fixed at creation: cancel the trigger and create a new one to change it.\n */\nexport type ModifyTriggerInput = v.InferInput<ReturnType<typeof createModifyTriggerInputSchema>>;\n\nexport const ListTriggerEventsInputSchema = v.pipe(\n v.strictObject({\n ...TriggerScopedInputEntries,\n limit: v.optional(v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(1000))),\n eventType: v.optional(TriggerEventTypeSchema),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n eventType:\n input.eventType === undefined\n ? undefined\n : TriggerEventTypeCodec.inputToProto[input.eventType],\n })),\n);\n\nexport type ListTriggerEventsInput = v.InferInput<typeof ListTriggerEventsInputSchema>;\n"],"mappings":";;;;;;;;;;;;;;;AA0CA,MAAM,oBAAoB,EAAE,SAAS,mBAAmB;AACxD,MAAM,4BAA4B,EAAE,SAAS,4BAA4B;AACzE,MAAM,yBAAyB,EAAE,SAAS,yBAAyB;AAGnE,MAAM,4BAA4B;CAC9B,WAHyB,cAAc,WAGT;CAC9B,GAAG;AACP;AAEA,MAAM,2BAA2B,EAAE,KAC/B,EAAE,aAAa,yBAAyB,GACxC,EAAE,WAAW,EAAE,SAAS,GAAG,aAAa;CACpC,GAAG;CACH,cAAc,2BAA2B,OAAO;AACpD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2B,OAAO;CAChD,WACI,MAAM,cAAc,KAAA,IACd,KAAA,IACA,sBAAsB,aAAa,MAAM;AACvD,EAAE,CACN"}
|
|
1
|
+
{"version":3,"file":"trigger-input.schemas.js","names":["TriggerSideCodec"],"sources":["../../../src/services/triggers/trigger-input.schemas.ts"],"sourcesContent":["import * as Proto from \"../../gen/triggers/v1/triggers_pb.js\";\nimport * as ProtoOrders from \"../../gen/orders/v1/orders_pb.js\";\nimport * as v from \"valibot\";\nimport { idInputSchema } from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { positiveDecimalInputToScaled, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { PROTOBUF_INT64_MAX } from \"../../shared/wire-bounds.js\";\nimport {\n parseOptionalPositiveBigIntLike,\n parseOptionalPositiveIntLike,\n} from \"../../utils/numbers.js\";\nimport { idToBigInt } from \"../../utils/base58-id.js\";\nimport {\n TRIGGER_EVENT_TYPE_VALUES,\n TRIGGER_STATUS_FILTER_VALUES,\n TRIGGER_TYPE_VALUES,\n TriggerEventTypeCodec,\n TriggerSideCodec,\n TriggerTypeCodec,\n TriggerStatusCodec,\n} from \"./triggers.codecs.js\";\nimport { BpsStringOrNumberInputSchema, NoneInputSchema, SymbolIdInputSchema } from \"../shared.js\";\nimport { TriggerPriceSourceInputSchema } from \"../orders/order-enums.codecs.js\";\nimport {\n BaseTriggerFieldsSchema,\n ConditionalExecutionInputSchema,\n DecimalInputStringSchema,\n TriggerSideInputSchema,\n TwapExecutionInputSchema,\n buildConditionalExecution,\n buildTriggerIntentBase,\n buildTwapExecution,\n MaxSlippageInputSchema,\n parseMaxSlippage,\n type MaxSlippageOneof,\n type TrailingDistanceOneof,\n} from \"./trigger-child-order.schemas.js\";\nimport { MAX_SELLING_SLIPPAGE_BPS, parseTrailingDistanceInput } from \"../trailing-oneof-inputs.js\";\n\nconst TriggerTypeSchema = v.picklist(TRIGGER_TYPE_VALUES);\nconst TriggerStatusFilterSchema = v.picklist(TRIGGER_STATUS_FILTER_VALUES);\nconst TriggerEventTypeSchema = v.picklist(TRIGGER_EVENT_TYPE_VALUES);\nconst TriggerIdInputSchema = idInputSchema(\"triggerId\");\n\nconst TriggerScopedInputEntries = {\n triggerId: TriggerIdInputSchema,\n ...AccountScopeInputEntries,\n};\n\nconst TriggerScopedInputSchema = v.pipe(\n v.strictObject(TriggerScopedInputEntries),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\n/** Absolute price distance, as a decimal price string (e.g. \"0.50\"). */\nconst PriceDistanceInputSchema = v.strictObject({\n kind: v.literal(\"distance\"),\n distance: DecimalInputStringSchema,\n});\n\nconst TrailingDistanceInputSchema = v.union([\n PriceDistanceInputSchema,\n BpsStringOrNumberInputSchema,\n]);\n\nconst ActivationPricePatchInputSchema = v.union([DecimalInputStringSchema, NoneInputSchema]);\n\nfunction parseTrailingDistance(\n scales: SdkScales,\n distance: v.InferOutput<typeof TrailingDistanceInputSchema>,\n): TrailingDistanceOneof {\n return parseTrailingDistanceInput(scales, distance, \"trailingDistance\");\n}\n\nfunction parseTwapMilliseconds(\n value: string | number,\n fieldName: \"durationMs\" | \"sliceIntervalMs\",\n minimum: bigint,\n): bigint {\n const parsed = parseOptionalPositiveBigIntLike(value);\n if (parsed === undefined || parsed < minimum || parsed > PROTOBUF_INT64_MAX) {\n throw new Error(\n `${fieldName} must be between ${minimum} and ${PROTOBUF_INT64_MAX} milliseconds`,\n );\n }\n return parsed;\n}\n\nfunction parseMaxSlippagePatch(\n scales: SdkScales,\n slippage: v.InferOutput<typeof MaxSlippageInputSchema>,\n): MaxSlippageOneof {\n if (slippage.kind === \"none\") {\n return { case: \"maxSlippageTicks\", value: 0n };\n }\n // The patch does not say which trigger it modifies, so it takes the widest\n // cap (a buy market child's 10000 bps); the server rejects 10000 for sells\n // and trailing stops with ERROR_CODE_MAX_SLIPPAGE_INVALID.\n return parseMaxSlippage(scales, slippage);\n}\n\nfunction createConditionalTriggerInputSchema<const TriggerType extends \"stop_loss\" | \"take_profit\">(\n scales: SdkScales,\n triggerType: TriggerType,\n) {\n const sharedEntries = {\n ...BaseTriggerFieldsSchema.entries,\n triggerType: v.literal(triggerType),\n triggerPrice: DecimalInputStringSchema,\n triggerPriceSource: TriggerPriceSourceInputSchema,\n };\n\n const sellInputSchema = v.strictObject({\n ...sharedEntries,\n side: v.literal(\"sell\"),\n execution: ConditionalExecutionInputSchema,\n });\n const buyInputSchema = v.strictObject({\n ...sharedEntries,\n side: v.literal(\"buy\"),\n execution: ConditionalExecutionInputSchema,\n });\n\n function transformInput(\n input: v.InferOutput<typeof sellInputSchema> | v.InferOutput<typeof buyInputSchema>,\n ) {\n const { subaccountId, intent } = buildTriggerIntentBase(input, scales);\n const side = TriggerSideCodec.inputToProto[input.side];\n const strategy = {\n triggerPriceTicks: positiveDecimalInputToScaled(\n \"triggerPrice\",\n input.triggerPrice,\n scales.price(),\n ),\n side,\n child: buildConditionalExecution(input.execution, scales, side),\n triggerPriceSource: input.triggerPriceSource,\n };\n return {\n subaccountId,\n trigger: {\n ...intent,\n strategy:\n triggerType === \"stop_loss\"\n ? ({ case: \"stopLoss\", value: strategy } as const)\n : ({ case: \"takeProfit\", value: strategy } as const),\n },\n };\n }\n\n return [\n v.pipe(\n sellInputSchema,\n v.check(\n (input) => input.feeAsset === ProtoOrders.FeeAsset.QUOTE,\n \"SELL triggers must use the quote fee asset\",\n ),\n v.transform((input: v.InferOutput<typeof sellInputSchema>) => transformInput(input)),\n ),\n v.pipe(\n buyInputSchema,\n v.transform((input: v.InferOutput<typeof buyInputSchema>) => transformInput(input)),\n ),\n ] as const;\n}\n\nfunction createTrailingStopTriggerInputSchema(scales: SdkScales) {\n const sharedEntries = {\n ...BaseTriggerFieldsSchema.entries,\n triggerType: v.literal(\"trailing_stop\"),\n trailingDistance: TrailingDistanceInputSchema,\n activationPrice: v.optional(DecimalInputStringSchema),\n maxSlippage: v.optional(MaxSlippageInputSchema),\n triggerPriceSource: TriggerPriceSourceInputSchema,\n };\n const sellInputSchema = v.strictObject({\n ...sharedEntries,\n side: v.optional(v.literal(\"sell\"), \"sell\"),\n limitPrice: v.optional(v.never()),\n });\n // A buy's child never pays more than `limitPrice`, which also sizes its reserved funds.\n const buyInputSchema = v.strictObject({\n ...sharedEntries,\n side: v.literal(\"buy\"),\n limitPrice: DecimalInputStringSchema,\n });\n\n function transformInput(\n input: v.InferOutput<typeof sellInputSchema> | v.InferOutput<typeof buyInputSchema>,\n ) {\n const { subaccountId, intent } = buildTriggerIntentBase(input, scales);\n return {\n subaccountId,\n trigger: {\n ...intent,\n strategy: {\n case: \"trailingStop\",\n value: {\n trailingDistance: parseTrailingDistance(scales, input.trailingDistance),\n activationPriceTicks:\n input.activationPrice === undefined\n ? 0n\n : positiveDecimalInputToScaled(\n \"activationPrice\",\n input.activationPrice,\n scales.price(),\n ),\n maxSlippage: parseMaxSlippage(\n scales,\n input.maxSlippage,\n MAX_SELLING_SLIPPAGE_BPS,\n ),\n side: TriggerSideCodec.inputToProto[input.side],\n limitPriceTicks:\n input.limitPrice === undefined\n ? 0n\n : positiveDecimalInputToScaled(\n \"limitPrice\",\n input.limitPrice,\n scales.price(),\n ),\n triggerPriceSource: input.triggerPriceSource,\n },\n } as const,\n },\n };\n }\n\n return [\n v.pipe(\n sellInputSchema,\n v.check(\n (input) => input.feeAsset === ProtoOrders.FeeAsset.QUOTE,\n \"SELL triggers must use the quote fee asset\",\n ),\n v.transform((input: v.InferOutput<typeof sellInputSchema>) => transformInput(input)),\n ),\n v.pipe(\n buyInputSchema,\n v.transform((input: v.InferOutput<typeof buyInputSchema>) => transformInput(input)),\n v.check(\n ({ trigger: { strategy } }) =>\n strategy.value.activationPriceTicks <= strategy.value.limitPriceTicks,\n \"limitPrice must be at least activationPrice\",\n ),\n ),\n ] as const;\n}\n\nfunction createTwapTriggerInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...BaseTriggerFieldsSchema.entries,\n triggerType: v.literal(\"twap\"),\n side: TriggerSideInputSchema,\n durationMs: v.pipe(\n v.union([v.pipe(v.string(), v.trim()), v.number()]),\n v.transform((value) => parseTwapMilliseconds(value, \"durationMs\", 1_000n)),\n ),\n sliceIntervalMs: v.pipe(\n v.union([v.pipe(v.string(), v.trim()), v.number()]),\n v.transform((value) => parseTwapMilliseconds(value, \"sliceIntervalMs\", 100n)),\n ),\n execution: TwapExecutionInputSchema,\n }),\n v.check(\n (input) =>\n input.side !== ProtoOrders.Side.SELL ||\n input.feeAsset === ProtoOrders.FeeAsset.QUOTE,\n \"SELL triggers must use the quote fee asset\",\n ),\n v.check(\n (input) => input.sliceIntervalMs <= input.durationMs,\n \"sliceIntervalMs cannot exceed durationMs\",\n ),\n v.transform((input) => {\n const { subaccountId, intent } = buildTriggerIntentBase(input, scales);\n return {\n subaccountId,\n trigger: {\n ...intent,\n strategy: {\n case: \"twap\",\n value: {\n side: input.side,\n durationMs: input.durationMs,\n sliceIntervalMs: input.sliceIntervalMs,\n execution: buildTwapExecution(input.execution, scales),\n },\n } as const,\n },\n };\n }),\n );\n}\n\nfunction createLadderTriggerInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...BaseTriggerFieldsSchema.entries,\n triggerType: v.literal(\"ladder\"),\n side: TriggerSideInputSchema,\n priceMin: DecimalInputStringSchema,\n priceMax: DecimalInputStringSchema,\n levels: v.pipe(\n v.union([v.pipe(v.string(), v.trim()), v.pipe(v.number(), v.integer())]),\n v.transform((value) => {\n const levels = parseOptionalPositiveIntLike(value);\n if (!levels || levels < 2 || levels > 100) {\n throw new Error(\"levels must be between 2 and 100\");\n }\n return levels;\n }),\n ),\n postOnly: v.optional(v.boolean(), false),\n }),\n v.check(\n (input) =>\n input.side !== ProtoOrders.Side.SELL ||\n input.feeAsset === ProtoOrders.FeeAsset.QUOTE,\n \"SELL triggers must use the quote fee asset\",\n ),\n v.transform((input) => {\n const { subaccountId, intent } = buildTriggerIntentBase(input, scales);\n return {\n subaccountId,\n trigger: {\n ...intent,\n strategy: {\n case: \"ladder\",\n value: {\n side: input.side,\n priceMinTicks: positiveDecimalInputToScaled(\n \"priceMin\",\n input.priceMin,\n scales.price(),\n ),\n priceMaxTicks: positiveDecimalInputToScaled(\n \"priceMax\",\n input.priceMax,\n scales.price(),\n ),\n levels: input.levels,\n postOnly: input.postOnly,\n },\n } as const,\n },\n };\n }),\n v.check(\n (output) =>\n output.trigger.strategy.value.priceMinTicks <\n output.trigger.strategy.value.priceMaxTicks,\n \"priceMin must be less than priceMax\",\n ),\n );\n}\n\ntype AnySchema = v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>;\n\nfunction fieldOf(input: unknown, key: string): unknown {\n return typeof input === \"object\" && input !== null\n ? (input as Record<string, unknown>)[key]\n : undefined;\n}\n\n/** Validates against the side the caller chose, so errors name that side's fields. */\nfunction bySide<const Sell extends AnySchema, const Buy extends AnySchema>([sell, buy]: readonly [\n Sell,\n Buy,\n]) {\n return v.lazy((input) => (fieldOf(input, \"side\") === \"buy\" ? buy : sell));\n}\n\n/**\n * Builds the create-trigger boundary schema using catalog scales keyed by symbol ID.\n * The variant is picked by `triggerType` before validating, because a plain union\n * reports the first branch's mismatch (e.g. \"Expected stop_loss\") instead of the\n * chosen variant's missing or invalid field.\n */\nexport function createCreateTriggerInputSchema(scales: SdkScales) {\n const variants = {\n stop_loss: bySide(createConditionalTriggerInputSchema(scales, \"stop_loss\")),\n take_profit: bySide(createConditionalTriggerInputSchema(scales, \"take_profit\")),\n trailing_stop: bySide(createTrailingStopTriggerInputSchema(scales)),\n twap: createTwapTriggerInputSchema(scales),\n ladder: createLadderTriggerInputSchema(scales),\n } satisfies Record<(typeof TRIGGER_TYPE_VALUES)[number], AnySchema>;\n const unknownVariant = v.never(`triggerType must be one of ${TRIGGER_TYPE_VALUES.join(\", \")}`);\n return v.lazy((input) => {\n const triggerType = fieldOf(input, \"triggerType\");\n return typeof triggerType === \"string\" && Object.hasOwn(variants, triggerType)\n ? variants[triggerType as keyof typeof variants]\n : unknownVariant;\n });\n}\n\n/** Public input for creating a standalone trigger. */\nexport type CreateTriggerInput = v.InferInput<ReturnType<typeof createCreateTriggerInputSchema>>;\n\n/** Public filters for listing triggers in an account scope. */\nexport const ListTriggersInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n parentOrderId: v.pipe(\n v.optional(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? idToBigInt(value, \"parentOrderId\") : undefined)),\n ),\n symbolId: v.optional(SymbolIdInputSchema),\n status: v.pipe(\n v.optional(v.array(TriggerStatusFilterSchema)),\n v.transform(\n (values) => values?.map((value) => TriggerStatusCodec.inputToProto[value]) ?? [],\n ),\n ),\n triggerType: v.pipe(\n v.optional(TriggerTypeSchema),\n v.transform((value) =>\n value\n ? TriggerTypeCodec.inputToProto[value]\n : Proto.TriggerType.TRIGGER_TYPE_UNSPECIFIED,\n ),\n ),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(1000)), 50),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\n/** Public filters for listing triggers. */\nexport type ListTriggersInput = v.InferInput<typeof ListTriggersInputSchema>;\n\nexport const CancelTriggerInputSchema = TriggerScopedInputSchema;\nexport type CancelTriggerInput = v.InferInput<typeof CancelTriggerInputSchema>;\n\nexport const GetTriggerInputSchema = CancelTriggerInputSchema;\nexport type GetTriggerInput = v.InferInput<typeof GetTriggerInputSchema>;\n\nexport const PauseTriggerInputSchema = TriggerScopedInputSchema;\nexport type PauseTriggerInput = v.InferInput<typeof PauseTriggerInputSchema>;\n\nexport const ResumeTriggerInputSchema = v.pipe(\n v.strictObject({\n ...TriggerScopedInputEntries,\n symbolId: v.optional(SymbolIdInputSchema),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n/** Omitting `symbolId` uses the trigger's own market; when set, it must be that market. */\nexport type ResumeTriggerInput = v.InferInput<typeof ResumeTriggerInputSchema>;\n\nexport function createModifyTriggerInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...TriggerScopedInputEntries,\n symbolId: v.optional(SymbolIdInputSchema),\n triggerPrice: v.optional(DecimalInputStringSchema),\n trailingDistance: v.optional(TrailingDistanceInputSchema),\n activationPrice: v.optional(ActivationPricePatchInputSchema),\n maxSlippage: v.optional(MaxSlippageInputSchema),\n }),\n v.check(\n (input) =>\n input.triggerPrice !== undefined ||\n input.trailingDistance !== undefined ||\n input.activationPrice !== undefined ||\n input.maxSlippage !== undefined,\n \"At least one patch field is required\",\n ),\n v.transform(({ account, ...input }) => ({\n triggerId: input.triggerId,\n subaccountId: accountScopeToSubaccountId(account),\n // Zero targets the trigger's own market.\n symbolId: input.symbolId ?? 0,\n triggerPriceTicks:\n input.triggerPrice === undefined\n ? undefined\n : positiveDecimalInputToScaled(\n \"triggerPrice\",\n input.triggerPrice,\n scales.price(),\n ),\n trailingDistance:\n input.trailingDistance === undefined\n ? ({ case: undefined, value: undefined } as const)\n : parseTrailingDistance(scales, input.trailingDistance),\n activationPriceTicks:\n input.activationPrice === undefined\n ? undefined\n : typeof input.activationPrice !== \"string\"\n ? 0n\n : positiveDecimalInputToScaled(\n \"activationPrice\",\n input.activationPrice,\n scales.price(),\n ),\n maxSlippage:\n input.maxSlippage === undefined\n ? ({ case: undefined, value: undefined } as const)\n : parseMaxSlippagePatch(scales, input.maxSlippage),\n })),\n );\n}\n\n/**\n * A trigger patch. Omitted fields remain unchanged; `{ kind: \"none\" }` clears\n * `activationPrice` or `maxSlippage`. A cleared `maxSlippage` on a market child\n * falls back to the pair's default market slippage. Omitting `symbolId` uses\n * the trigger's own market; when set, it must be that market. A child's limit price is\n * fixed at creation: cancel the trigger and create a new one to change it.\n */\nexport type ModifyTriggerInput = v.InferInput<ReturnType<typeof createModifyTriggerInputSchema>>;\n\nexport const ListTriggerEventsInputSchema = v.pipe(\n v.strictObject({\n ...TriggerScopedInputEntries,\n limit: v.optional(v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(1000))),\n eventType: v.optional(TriggerEventTypeSchema),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n eventType:\n input.eventType === undefined\n ? undefined\n : TriggerEventTypeCodec.inputToProto[input.eventType],\n })),\n);\n\nexport type ListTriggerEventsInput = v.InferInput<typeof ListTriggerEventsInputSchema>;\n"],"mappings":";;;;;;;;;;;;;;;AA0CA,MAAM,oBAAoB,EAAE,SAAS,mBAAmB;AACxD,MAAM,4BAA4B,EAAE,SAAS,4BAA4B;AACzE,MAAM,yBAAyB,EAAE,SAAS,yBAAyB;AAGnE,MAAM,4BAA4B;CAC9B,WAHyB,cAAc,WAGT;CAC9B,GAAG;AACP;AAEA,MAAM,2BAA2B,EAAE,KAC/B,EAAE,aAAa,yBAAyB,GACxC,EAAE,WAAW,EAAE,SAAS,GAAG,aAAa;CACpC,GAAG;CACH,cAAc,2BAA2B,OAAO;AACpD,EAAE,CACN;;AAGA,MAAM,2BAA2B,EAAE,aAAa;CAC5C,MAAM,EAAE,QAAQ,UAAU;CAC1B,UAAU;AACd,CAAC;AAED,MAAM,8BAA8B,EAAE,MAAM,CACxC,0BACA,4BACJ,CAAC;AAED,MAAM,kCAAkC,EAAE,MAAM,CAAC,0BAA0B,eAAe,CAAC;AAE3F,SAAS,sBACL,QACA,UACqB;CACrB,OAAO,2BAA2B,QAAQ,UAAU,kBAAkB;AAC1E;AAEA,SAAS,sBACL,OACA,WACA,SACM;CACN,MAAM,SAAS,gCAAgC,KAAK;CACpD,IAAI,WAAW,KAAA,KAAa,SAAS,WAAW,SAAA,sBAC5C,MAAM,IAAI,MACN,GAAG,UAAU,mBAAmB,QAA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G;CACH,cAAc,2BAA2B,OAAO;CAChD,WACI,MAAM,cAAc,KAAA,IACd,KAAA,IACA,sBAAsB,aAAa,MAAM;AACvD,EAAE,CACN"}
|
|
@@ -1196,7 +1196,7 @@ declare function createTriggerEventSchema(scales: SdkScales): v.SchemaWithPipe<r
|
|
|
1196
1196
|
subaccountId: string;
|
|
1197
1197
|
symbolId: number;
|
|
1198
1198
|
triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
|
|
1199
|
-
eventType: "unspecified" | "failed" | "canceled" | "
|
|
1199
|
+
eventType: "unspecified" | "failed" | "canceled" | "updated" | "armed" | "fired" | "activated" | "fire_refused";
|
|
1200
1200
|
ts: number;
|
|
1201
1201
|
tsNs: string;
|
|
1202
1202
|
childSeq: number;
|
|
@@ -1211,7 +1211,7 @@ declare function createTriggerEventSchema(scales: SdkScales): v.SchemaWithPipe<r
|
|
|
1211
1211
|
subaccountId: string;
|
|
1212
1212
|
symbolId: number;
|
|
1213
1213
|
triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
|
|
1214
|
-
eventType: "unspecified" | "failed" | "canceled" | "
|
|
1214
|
+
eventType: "unspecified" | "failed" | "canceled" | "updated" | "armed" | "fired" | "activated" | "fire_refused";
|
|
1215
1215
|
ts: number;
|
|
1216
1216
|
tsNs: string;
|
|
1217
1217
|
childSeq: number;
|
|
@@ -1226,7 +1226,7 @@ declare function createTriggerEventSchema(scales: SdkScales): v.SchemaWithPipe<r
|
|
|
1226
1226
|
subaccountId: string;
|
|
1227
1227
|
symbolId: number;
|
|
1228
1228
|
triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
|
|
1229
|
-
eventType: "unspecified" | "failed" | "canceled" | "
|
|
1229
|
+
eventType: "unspecified" | "failed" | "canceled" | "updated" | "armed" | "fired" | "activated" | "fire_refused";
|
|
1230
1230
|
ts: number;
|
|
1231
1231
|
tsNs: string;
|
|
1232
1232
|
childSeq: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polyester/sdk",
|
|
3
|
-
"version": "0.35.0-devnet-
|
|
3
|
+
"version": "0.35.0-devnet-20261110193018",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "TypeScript SDK providing access to APIs on Polyester Exchange.",
|
|
6
6
|
"homepage": "https://github.com/Fabric-Labs/polyester-sdk-typescript#readme",
|