@polyester/sdk 0.35.0-devnet-20261110181538 → 0.35.0-devnet-20261110194522
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 +11 -1
- package/README.md +8 -8
- package/dist/realtime/client.js +13 -6
- package/dist/realtime/client.js.map +1 -1
- package/dist/services/address-book/address-book.schemas.d.ts +2 -2
- package/dist/services/balances/balances.schemas.d.ts +3 -3
- 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 +145 -145
- 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/orders-batch.schemas.d.ts +14 -14
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +2 -29
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +2 -2
- 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-modify.schemas.js +1 -1
- package/dist/services/orders/orders-modify.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 +15 -15
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/transfers/transfers.schemas.d.ts +2 -2
- 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 +10 -10
- package/dist/services/vip/vip.schemas.d.ts +3 -3
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
|
|
|
12
12
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
13
13
|
readonly clientOrderId: v.StringSchema<undefined>;
|
|
14
14
|
readonly side: v.NumberSchema<undefined>;
|
|
15
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
15
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "canceled" | "pending" | "rejected" | "pending_cancel" | "working" | "filled">]>;
|
|
16
16
|
readonly orderType: v.NumberSchema<undefined>;
|
|
17
17
|
readonly timeInForce: v.NumberSchema<undefined>;
|
|
18
18
|
readonly selfTradePreventionMode: v.NumberSchema<undefined>;
|
|
@@ -146,7 +146,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
|
|
|
146
146
|
symbolId: number;
|
|
147
147
|
clientOrderId: string;
|
|
148
148
|
side: number;
|
|
149
|
-
status: "unspecified" | "
|
|
149
|
+
status: "unspecified" | "canceled" | "pending" | "rejected" | "pending_cancel" | "working" | "filled";
|
|
150
150
|
orderType: number;
|
|
151
151
|
timeInForce: number;
|
|
152
152
|
selfTradePreventionMode: number;
|
|
@@ -282,7 +282,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
|
|
|
282
282
|
attachedRisk: {
|
|
283
283
|
takeProfit: {
|
|
284
284
|
state: {
|
|
285
|
-
status: "unspecified" | "failed" | "canceled" | "completed" | "
|
|
285
|
+
status: "unspecified" | "failed" | "canceled" | "completed" | "created" | "not_configured" | "armed" | "running" | "paused";
|
|
286
286
|
armedTs: number | undefined;
|
|
287
287
|
armedTsNs: string | undefined;
|
|
288
288
|
terminalTs: number | undefined;
|
|
@@ -302,7 +302,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
|
|
|
302
302
|
} | undefined;
|
|
303
303
|
stopLoss: {
|
|
304
304
|
state: {
|
|
305
|
-
status: "unspecified" | "failed" | "canceled" | "completed" | "
|
|
305
|
+
status: "unspecified" | "failed" | "canceled" | "completed" | "created" | "not_configured" | "armed" | "running" | "paused";
|
|
306
306
|
armedTs: number | undefined;
|
|
307
307
|
armedTsNs: string | undefined;
|
|
308
308
|
terminalTs: number | undefined;
|
|
@@ -322,7 +322,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
|
|
|
322
322
|
} | undefined;
|
|
323
323
|
trailingStop: {
|
|
324
324
|
state: {
|
|
325
|
-
status: "unspecified" | "failed" | "canceled" | "completed" | "
|
|
325
|
+
status: "unspecified" | "failed" | "canceled" | "completed" | "created" | "not_configured" | "armed" | "running" | "paused";
|
|
326
326
|
armedTs: number | undefined;
|
|
327
327
|
armedTsNs: string | undefined;
|
|
328
328
|
terminalTs: number | undefined;
|
|
@@ -364,7 +364,7 @@ declare function createOrderSchema(scales: SdkScales): v.SchemaWithPipe<readonly
|
|
|
364
364
|
} | undefined;
|
|
365
365
|
symbolId: number;
|
|
366
366
|
clientOrderId: string;
|
|
367
|
-
status: "unspecified" | "
|
|
367
|
+
status: "unspecified" | "canceled" | "pending" | "rejected" | "pending_cancel" | "working" | "filled" | "partial";
|
|
368
368
|
side: "unspecified" | "buy" | "sell";
|
|
369
369
|
orderType: "unspecified" | "limit" | "market";
|
|
370
370
|
timeInForce: "unspecified" | "GTC" | "IOC" | "FOK" | "GTD";
|
|
@@ -419,7 +419,7 @@ declare function createOrderTransferSchema(): v.SchemaWithPipe<readonly [v.Objec
|
|
|
419
419
|
timestamp: number;
|
|
420
420
|
amount: string;
|
|
421
421
|
type: "unspecified" | "internal_transfer" | "deposit" | "withdraw" | "maker_fee" | "taker_fee" | "trade_base" | "trade_quote" | "rebate" | "funding_to_trading" | "trading_to_funding" | "trading_withdraw_reserve" | "funding_user_transfer" | "trading_withdraw_request_fee";
|
|
422
|
-
accountCode: "unspecified" | "
|
|
422
|
+
accountCode: "unspecified" | "funding" | "trading";
|
|
423
423
|
}>]>;
|
|
424
424
|
type OrderTransfer = v.InferOutput<ReturnType<typeof createOrderTransferSchema>>;
|
|
425
425
|
declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
|
|
@@ -433,7 +433,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
|
|
|
433
433
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
434
434
|
readonly clientOrderId: v.StringSchema<undefined>;
|
|
435
435
|
readonly side: v.NumberSchema<undefined>;
|
|
436
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
436
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "canceled" | "pending" | "rejected" | "pending_cancel" | "working" | "filled">]>;
|
|
437
437
|
readonly orderType: v.NumberSchema<undefined>;
|
|
438
438
|
readonly timeInForce: v.NumberSchema<undefined>;
|
|
439
439
|
readonly selfTradePreventionMode: v.NumberSchema<undefined>;
|
|
@@ -567,7 +567,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
|
|
|
567
567
|
symbolId: number;
|
|
568
568
|
clientOrderId: string;
|
|
569
569
|
side: number;
|
|
570
|
-
status: "unspecified" | "
|
|
570
|
+
status: "unspecified" | "canceled" | "pending" | "rejected" | "pending_cancel" | "working" | "filled";
|
|
571
571
|
orderType: number;
|
|
572
572
|
timeInForce: number;
|
|
573
573
|
selfTradePreventionMode: number;
|
|
@@ -703,7 +703,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
|
|
|
703
703
|
attachedRisk: {
|
|
704
704
|
takeProfit: {
|
|
705
705
|
state: {
|
|
706
|
-
status: "unspecified" | "failed" | "canceled" | "completed" | "
|
|
706
|
+
status: "unspecified" | "failed" | "canceled" | "completed" | "created" | "not_configured" | "armed" | "running" | "paused";
|
|
707
707
|
armedTs: number | undefined;
|
|
708
708
|
armedTsNs: string | undefined;
|
|
709
709
|
terminalTs: number | undefined;
|
|
@@ -723,7 +723,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
|
|
|
723
723
|
} | undefined;
|
|
724
724
|
stopLoss: {
|
|
725
725
|
state: {
|
|
726
|
-
status: "unspecified" | "failed" | "canceled" | "completed" | "
|
|
726
|
+
status: "unspecified" | "failed" | "canceled" | "completed" | "created" | "not_configured" | "armed" | "running" | "paused";
|
|
727
727
|
armedTs: number | undefined;
|
|
728
728
|
armedTsNs: string | undefined;
|
|
729
729
|
terminalTs: number | undefined;
|
|
@@ -743,7 +743,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
|
|
|
743
743
|
} | undefined;
|
|
744
744
|
trailingStop: {
|
|
745
745
|
state: {
|
|
746
|
-
status: "unspecified" | "failed" | "canceled" | "completed" | "
|
|
746
|
+
status: "unspecified" | "failed" | "canceled" | "completed" | "created" | "not_configured" | "armed" | "running" | "paused";
|
|
747
747
|
armedTs: number | undefined;
|
|
748
748
|
armedTsNs: string | undefined;
|
|
749
749
|
terminalTs: number | undefined;
|
|
@@ -785,7 +785,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
|
|
|
785
785
|
} | undefined;
|
|
786
786
|
symbolId: number;
|
|
787
787
|
clientOrderId: string;
|
|
788
|
-
status: "unspecified" | "
|
|
788
|
+
status: "unspecified" | "canceled" | "pending" | "rejected" | "pending_cancel" | "working" | "filled" | "partial";
|
|
789
789
|
side: "unspecified" | "buy" | "sell";
|
|
790
790
|
orderType: "unspecified" | "limit" | "market";
|
|
791
791
|
timeInForce: "unspecified" | "GTC" | "IOC" | "FOK" | "GTD";
|
|
@@ -905,7 +905,7 @@ declare function createOrderDetailsSchema(scales: SdkScales): v.ObjectSchema<{
|
|
|
905
905
|
timestamp: number;
|
|
906
906
|
amount: string;
|
|
907
907
|
type: "unspecified" | "internal_transfer" | "deposit" | "withdraw" | "maker_fee" | "taker_fee" | "trade_base" | "trade_quote" | "rebate" | "funding_to_trading" | "trading_to_funding" | "trading_withdraw_reserve" | "funding_user_transfer" | "trading_withdraw_request_fee";
|
|
908
|
-
accountCode: "unspecified" | "
|
|
908
|
+
accountCode: "unspecified" | "funding" | "trading";
|
|
909
909
|
}>]>, undefined>, readonly []>;
|
|
910
910
|
readonly executionsComplete: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
911
911
|
}, undefined>;
|
|
@@ -19,7 +19,7 @@ declare const RewardAwardSchema: v.ObjectSchema<{
|
|
|
19
19
|
readonly assetId: v.NumberSchema<undefined>;
|
|
20
20
|
readonly amountBaseUnits: v.StringSchema<undefined>;
|
|
21
21
|
readonly fulfillmentMethod: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "external_testnet" | "internal_trading">]>;
|
|
22
|
-
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
22
|
+
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "awaiting_destination" | "ready_for_payout" | "paid" | "failed" | "canceled">]>;
|
|
23
23
|
readonly publishedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
24
24
|
readonly seconds: v.BigintSchema<undefined>;
|
|
25
25
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -41,7 +41,7 @@ declare const ListRewardAwardsResultSchema: v.ObjectSchema<{
|
|
|
41
41
|
readonly assetId: v.NumberSchema<undefined>;
|
|
42
42
|
readonly amountBaseUnits: v.StringSchema<undefined>;
|
|
43
43
|
readonly fulfillmentMethod: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "external_testnet" | "internal_trading">]>;
|
|
44
|
-
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
44
|
+
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "awaiting_destination" | "ready_for_payout" | "paid" | "failed" | "canceled">]>;
|
|
45
45
|
readonly publishedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
46
46
|
readonly seconds: v.BigintSchema<undefined>;
|
|
47
47
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -72,7 +72,7 @@ declare const SetRewardDestinationResultSchema: v.ObjectSchema<{
|
|
|
72
72
|
readonly assetId: v.NumberSchema<undefined>;
|
|
73
73
|
readonly amountBaseUnits: v.StringSchema<undefined>;
|
|
74
74
|
readonly fulfillmentMethod: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "external_testnet" | "internal_trading">]>;
|
|
75
|
-
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
75
|
+
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "awaiting_destination" | "ready_for_payout" | "paid" | "failed" | "canceled">]>;
|
|
76
76
|
readonly publishedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
77
77
|
readonly seconds: v.BigintSchema<undefined>;
|
|
78
78
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -13,7 +13,7 @@ declare const SubaccountPermissionDefinitionSchema: v.ObjectSchema<{
|
|
|
13
13
|
}, undefined>;
|
|
14
14
|
type SubaccountPermissionDefinition = v.InferOutput<typeof SubaccountPermissionDefinitionSchema>;
|
|
15
15
|
declare const SubaccountRoleDefinitionSchema: v.ObjectSchema<{
|
|
16
|
-
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "
|
|
16
|
+
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified">]>;
|
|
17
17
|
readonly displayName: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
18
18
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
19
19
|
readonly assignable: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
@@ -28,7 +28,7 @@ declare const SubaccountRoleCatalogSchema: v.ObjectSchema<{
|
|
|
28
28
|
readonly policyAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">]>;
|
|
29
29
|
}, undefined>, undefined>, readonly []>;
|
|
30
30
|
readonly roles: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
31
|
-
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "
|
|
31
|
+
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified">]>;
|
|
32
32
|
readonly displayName: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
33
33
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
34
34
|
readonly assignable: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
@@ -37,7 +37,7 @@ declare const SubaccountRoleCatalogSchema: v.ObjectSchema<{
|
|
|
37
37
|
}, undefined>;
|
|
38
38
|
type SubaccountRoleCatalog = v.InferOutput<typeof SubaccountRoleCatalogSchema>;
|
|
39
39
|
declare const EffectiveSubaccountPermissionsSchema: v.ObjectSchema<{
|
|
40
|
-
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "
|
|
40
|
+
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified">]>;
|
|
41
41
|
readonly permissions: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "internal_transfer" | "read_subaccount" | "update_subaccount" | "read_balances" | "read_spot" | "trade_spot" | "read_internal_transfers" | "external_withdraw" | "read_address_book" | "manage_address_book" | "read_members" | "manage_members" | "read_invites" | "manage_invites" | "read_api_keys" | "manage_api_keys" | "read_subaccount_policy" | "manage_subaccount_policy" | "read_activity" | "read_activity_security_details" | "manage_member_mfa_requirement" | "create_deposit_address" | "read_deposit_addresses" | "read_guard_signer_status" | "manage_guard_signer" | "read_auto_withdraw" | "manage_auto_withdraw" | "swap">]>, undefined>, readonly []>;
|
|
42
42
|
readonly subaccountPolicyId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
43
43
|
}, undefined>;
|
|
@@ -163,7 +163,7 @@ declare const ProtoSubaccountStatusSchema: v.SchemaWithPipe<readonly [v.NumberSc
|
|
|
163
163
|
type SubaccountStatus = v.InferOutput<typeof ProtoSubaccountStatusSchema>;
|
|
164
164
|
declare const SubaccountSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
165
165
|
readonly id: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
166
|
-
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "
|
|
166
|
+
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified">]>;
|
|
167
167
|
readonly label: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
168
168
|
readonly icon: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
169
169
|
readonly color: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -189,7 +189,7 @@ declare const SubaccountSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
189
189
|
readonly removed: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
190
190
|
}, undefined>, v.TransformAction<{
|
|
191
191
|
id: string;
|
|
192
|
-
role: "
|
|
192
|
+
role: "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified";
|
|
193
193
|
label: string;
|
|
194
194
|
icon: string;
|
|
195
195
|
color: string;
|
|
@@ -211,7 +211,7 @@ declare const SubaccountSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
211
211
|
updatedAt: number | undefined;
|
|
212
212
|
updatedAtNs: string | undefined;
|
|
213
213
|
id: string;
|
|
214
|
-
role: "
|
|
214
|
+
role: "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified";
|
|
215
215
|
label: string;
|
|
216
216
|
icon: string;
|
|
217
217
|
color: string;
|
|
@@ -229,7 +229,7 @@ declare const SubaccountSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
229
229
|
type Subaccount = v.InferOutput<typeof SubaccountSchema>;
|
|
230
230
|
declare const SubaccountMemberSchema: v.ObjectSchema<{
|
|
231
231
|
readonly accountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
232
|
-
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "
|
|
232
|
+
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified">]>;
|
|
233
233
|
readonly username: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
234
234
|
readonly smartAccountAddress: v.StringSchema<undefined>;
|
|
235
235
|
readonly avatarUrl: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -241,8 +241,8 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
241
241
|
readonly subaccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
242
242
|
readonly granteeAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
243
243
|
readonly inviterAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
244
|
-
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "
|
|
245
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
244
|
+
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified">]>;
|
|
245
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "canceled" | "pending" | "accepted" | "declined">]>;
|
|
246
246
|
readonly createdAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
247
247
|
readonly seconds: v.BigintSchema<undefined>;
|
|
248
248
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -268,8 +268,8 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
268
268
|
subaccountId: string;
|
|
269
269
|
granteeAccountId: string;
|
|
270
270
|
inviterAccountId: string;
|
|
271
|
-
role: "
|
|
272
|
-
status: "unspecified" | "
|
|
271
|
+
role: "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified";
|
|
272
|
+
status: "unspecified" | "canceled" | "pending" | "accepted" | "declined";
|
|
273
273
|
createdAt?: number | undefined;
|
|
274
274
|
respondedAt?: number | undefined;
|
|
275
275
|
granteeUsername: string;
|
|
@@ -286,8 +286,8 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
286
286
|
id: string;
|
|
287
287
|
granteeAccountId: string;
|
|
288
288
|
inviterAccountId: string;
|
|
289
|
-
role: "
|
|
290
|
-
status: "unspecified" | "
|
|
289
|
+
role: "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer" | "unspecified";
|
|
290
|
+
status: "unspecified" | "canceled" | "pending" | "accepted" | "declined";
|
|
291
291
|
createdAt?: number | undefined;
|
|
292
292
|
respondedAt?: number | undefined;
|
|
293
293
|
granteeUsername: string;
|
|
@@ -309,8 +309,8 @@ declare const SubaccountActivityEventSchema: v.ObjectSchema<{
|
|
|
309
309
|
seconds: bigint;
|
|
310
310
|
nanos: number;
|
|
311
311
|
} | undefined, number | undefined>]>;
|
|
312
|
-
readonly entityKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "subaccount" | "api_key" | "account" | "destination" | "session" | "
|
|
313
|
-
readonly eventAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "disabled" | "
|
|
312
|
+
readonly entityKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "subaccount" | "api_key" | "account" | "destination" | "session" | "member" | "policy" | "invite" | "security">]>;
|
|
313
|
+
readonly eventAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "disabled" | "removed" | "revoked" | "failed" | "enabled" | "created" | "updated" | "deleted" | "role_set" | "received" | "replied" | "blocked" | "hold_placed" | "hold_released">]>;
|
|
314
314
|
readonly source: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "api" | "web" | "mobile">]>;
|
|
315
315
|
readonly ip: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
316
316
|
readonly userAgent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -169,7 +169,7 @@ declare const GetUserTradesInputSchema: v.SchemaWithPipe<readonly [v.UnionSchema
|
|
|
169
169
|
readonly orderId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
170
170
|
readonly lineageId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, v.CheckAction<bigint, `${string} must be greater than zero`>]>;
|
|
171
171
|
readonly throughGeneration: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
|
|
172
|
-
}, undefined>], undefined>], ({ input }: v.UnionIssue<v.
|
|
172
|
+
}, undefined>], undefined>], ({ input }: v.UnionIssue<v.NumberIssue | v.StringIssue | v.BooleanIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 1> | v.MaxValueIssue<number, 4294967295> | v.StrictObjectIssue | v.PicklistIssue | v.MinLengthIssue<string, 1> | v.UnionIssue<v.StringIssue | v.StrictObjectIssue | v.PicklistIssue | v.MinLengthIssue<string, 1>> | v.GtValueIssue<number, 0> | v.CheckIssue<bigint> | v.MaxValueIssue<number, 1000> | v.NeverIssue | v.UnionIssue<v.NumberIssue | v.StringIssue | v.BooleanIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 1> | v.MaxValueIssue<number, 4294967295> | v.StrictObjectIssue | v.PicklistIssue | v.MinLengthIssue<string, 1> | v.UnionIssue<v.StringIssue | v.StrictObjectIssue | v.PicklistIssue | v.MinLengthIssue<string, 1>> | v.GtValueIssue<number, 0> | v.CheckIssue<bigint> | v.MaxValueIssue<number, 1000> | v.NeverIssue>>) => "Provide at most one of orderId or lineageId" | "throughGeneration requires lineageId" | "symbolId is required when afterMatchId is set" | "Invalid trade filters">, v.TransformAction<{
|
|
173
173
|
symbolId?: number | undefined;
|
|
174
174
|
afterMatchId?: undefined;
|
|
175
175
|
side?: Side.BUY | Side.SELL | undefined;
|
|
@@ -85,7 +85,7 @@ declare const LedgerTransferSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
85
85
|
amount: string;
|
|
86
86
|
balanceAfter: string | undefined;
|
|
87
87
|
type: "unspecified" | "internal_transfer" | "deposit" | "withdraw" | "maker_fee" | "taker_fee" | "trade_base" | "trade_quote" | "rebate" | "funding_to_trading" | "trading_to_funding" | "trading_withdraw_reserve" | "funding_user_transfer" | "trading_withdraw_request_fee";
|
|
88
|
-
accountCode: "unspecified" | "
|
|
88
|
+
accountCode: "unspecified" | "funding" | "trading";
|
|
89
89
|
timestamp: number;
|
|
90
90
|
isDebit: boolean;
|
|
91
91
|
linkId: string | undefined;
|
|
@@ -94,7 +94,7 @@ declare const LedgerTransferSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
94
94
|
type LedgerTransfer = v.InferOutput<typeof LedgerTransferSchema>;
|
|
95
95
|
declare const ListTransfersInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
96
96
|
readonly ledger: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
97
|
-
readonly limit: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
97
|
+
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
|
|
98
98
|
readonly reversed: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
99
99
|
readonly timestampMin: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>, v.TransformAction<number, bigint>]>, undefined>;
|
|
100
100
|
readonly timestampMax: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>, v.TransformAction<number, bigint>]>, undefined>;
|
|
@@ -55,7 +55,7 @@ const LedgerTransferSchema = v.pipe(v.object({
|
|
|
55
55
|
const ListTransfersInputSchema = v.pipe(v.strictObject({
|
|
56
56
|
...AccountScopeInputEntries,
|
|
57
57
|
ledger: v.optional(v.number(), 0),
|
|
58
|
-
limit: v.optional(v.number()),
|
|
58
|
+
limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(1e3))),
|
|
59
59
|
reversed: v.optional(v.boolean(), false),
|
|
60
60
|
timestampMin: OptionalTimestampMsToUsInputSchema,
|
|
61
61
|
timestampMax: OptionalTimestampMsToUsInputSchema,
|
|
@@ -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,GAAG,EAAE;CAClC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;AAClC,CAAC;;AAKD,MAAa,uBAAuB,EAAE,KAClC,EAAE,OAAO;CACL,SAAS,EAAE,OAAO;CAClB,WAAW,EAAE,SAAS,UAAU;CAChC,iBAAiB,EAAE,SAAS,UAAU;CACtC,SAAS,EAAE,QAAQ;CACnB,cAAc,EAAE,OAAO;CACvB,aAAa,EAAE,OAAO;CACtB,MAAM;CACN,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;CAC7B,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;CAC7B,QAAQ,EAAE,SAAS,wBAAwB;CAC3C,aAAa,EAAE,SAAS,wBAAwB;CAChD,YAAY,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AACzC,CAAC,GACD,EAAE,WAAW,OAAO;CAChB,MAAM,SAAS,SAAS,GAAG,SAAS;CACpC,MAAM,SAAS,GAAG,UAAU,GAAG,SAAS,KAAK,GAAG,OAAO,SAAS,IAAI,KAAA;CAkBpE,OAAO;EAfH,YAAY,GAAG;EACf,SAAS,GAAG;EACZ,QAAQ,sBAAsB,QAAA,EAAiB;EAC/C,cACI,GAAG,oBAAoB,KAAA,IACjB,sBAAsB,SAAS,GAAG,eAAe,GAAA,EAAY,IAC7D,KAAA;EACV,MAAM,UAAU,kBAAkB,eAAe,GAAG,YAAY;EAChE,aAAa,UAAU,iBAAiB,eAAe,GAAG,WAAW;EACrE,WAAW,kBAAkB,GAAG,IAAI;EACpC,SAAS,GAAG;EACZ;EACA,QAAQ,GAAG,QAAQ,KAAK,KAAK;EAK7B,GAAI,GAAG,SAAS,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,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,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,GAAG,EAAE;CAClC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;AAClC,CAAC;;AAKD,MAAa,uBAAuB,EAAE,KAClC,EAAE,OAAO;CACL,SAAS,EAAE,OAAO;CAClB,WAAW,EAAE,SAAS,UAAU;CAChC,iBAAiB,EAAE,SAAS,UAAU;CACtC,SAAS,EAAE,QAAQ;CACnB,cAAc,EAAE,OAAO;CACvB,aAAa,EAAE,OAAO;CACtB,MAAM;CACN,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;CAC7B,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;CAC7B,QAAQ,EAAE,SAAS,wBAAwB;CAC3C,aAAa,EAAE,SAAS,wBAAwB;CAChD,YAAY,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AACzC,CAAC,GACD,EAAE,WAAW,OAAO;CAChB,MAAM,SAAS,SAAS,GAAG,SAAS;CACpC,MAAM,SAAS,GAAG,UAAU,GAAG,SAAS,KAAK,GAAG,OAAO,SAAS,IAAI,KAAA;CAkBpE,OAAO;EAfH,YAAY,GAAG;EACf,SAAS,GAAG;EACZ,QAAQ,sBAAsB,QAAA,EAAiB;EAC/C,cACI,GAAG,oBAAoB,KAAA,IACjB,sBAAsB,SAAS,GAAG,eAAe,GAAA,EAAY,IAC7D,KAAA;EACV,MAAM,UAAU,kBAAkB,eAAe,GAAG,YAAY;EAChE,aAAa,UAAU,iBAAiB,eAAe,GAAG,WAAW;EACrE,WAAW,kBAAkB,GAAG,IAAI;EACpC,SAAS,GAAG;EACZ;EACA,QAAQ,GAAG,QAAQ,KAAK,KAAK;EAK7B,GAAI,GAAG,SAAS,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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({
|