@polyester/sdk 0.34.1-devnet-20261106033258 → 0.35.0-devnet-20261108030630
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 +21 -1
- package/README.md +12 -0
- package/dist/gen/auth/v1/auth_pb.d.ts +9 -1
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +9 -1
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.d.ts +28 -9
- package/dist/gen/changelog/v1/changelog_pb.d.ts.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.js +1 -1
- package/dist/gen/changelog/v1/changelog_pb.js.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +2 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +2 -0
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +23 -7
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/realtime/client.d.ts.map +1 -1
- package/dist/realtime/client.js +178 -29
- package/dist/realtime/client.js.map +1 -1
- package/dist/realtime/index.d.ts +2 -2
- package/dist/realtime/types.d.ts +21 -2
- package/dist/realtime/types.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +19 -19
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/changelog/changelog.d.ts +6 -3
- package/dist/services/changelog/changelog.d.ts.map +1 -1
- package/dist/services/changelog/changelog.js +6 -3
- package/dist/services/changelog/changelog.js.map +1 -1
- package/dist/services/changelog/changelog.schemas.d.ts +37 -3
- package/dist/services/changelog/changelog.schemas.d.ts.map +1 -1
- package/dist/services/changelog/changelog.schemas.js +10 -2
- package/dist/services/changelog/changelog.schemas.js.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +42 -42
- package/dist/services/orderbook/orderbook.d.ts +1 -1
- package/dist/services/orderbook/orderbook.js +1 -1
- package/dist/services/orderbook/orderbook.js.map +1 -1
- 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 +39 -39
- package/dist/services/orders/orders-input.schemas.d.ts +3 -3
- package/dist/services/orders/orders-output.schemas.d.ts +14 -14
- package/dist/services/orders/orders.d.ts +9 -1
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +9 -1
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +3 -3
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +5 -5
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +18 -18
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +7 -3
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +7 -0
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +2 -1
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/rate-limit.js +18 -0
- package/dist/shared/error-details/rate-limit.js.map +1 -0
- package/dist/shared/errors.d.ts +12 -3
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +13 -1
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/subscription-errors.d.ts +2 -0
- package/dist/shared/subscription-errors.d.ts.map +1 -1
- package/dist/shared/subscription-errors.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ declare const LifecycleAssetIdsSchema: v.ObjectSchema<{
|
|
|
7
7
|
readonly zippedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
8
8
|
readonly unifiedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
9
9
|
}, undefined>;
|
|
10
|
-
declare const LifecycleFlowStateEnumSchema: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
10
|
+
declare const LifecycleFlowStateEnumSchema: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "pending_source" | "pending_polyester_chain" | "pending_ledger" | "dropped" | "refunded">]>;
|
|
11
11
|
declare const LifecycleZipperReasonSchema: v.ObjectSchema<{
|
|
12
12
|
readonly code: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
13
13
|
readonly reasonId: v.StringSchema<undefined>;
|
|
@@ -17,7 +17,7 @@ declare const ListLifecycleFlowsInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
17
17
|
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 500, undefined>]>, 100>;
|
|
18
18
|
readonly sort: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["newest", "oldest"], undefined>, "newest">, v.TransformAction<"newest" | "oldest", Sort.NEWEST | Sort.OLDEST>]>;
|
|
19
19
|
readonly flowKind: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["deposit", "withdraw", "transfer"], undefined>, undefined>, v.TransformAction<"deposit" | "withdraw" | "transfer" | undefined, FlowKind>]>;
|
|
20
|
-
readonly flowState: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["pending_source", "pending_polyester_chain", "pending_ledger", "completed", "failed", "dropped", "refunded"], undefined>, undefined>, v.TransformAction<"
|
|
20
|
+
readonly flowState: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["pending_source", "pending_polyester_chain", "pending_ledger", "completed", "failed", "dropped", "refunded"], undefined>, undefined>, v.TransformAction<"failed" | "completed" | "pending_source" | "pending_polyester_chain" | "pending_ledger" | "dropped" | "refunded" | undefined, FlowState>]>;
|
|
21
21
|
readonly txRef: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "txHash is required.">, v.CheckAction<string, "txHash must be a valid EVM hash or chain-native transaction id.">, v.TransformAction<string, string>]>, undefined>;
|
|
22
22
|
readonly scope: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["all", "open", "terminal"], undefined>, "all">, v.TransformAction<"open" | "all" | "terminal", ListScope.LIST_ALL | ListScope.LIST_OPEN_ONLY | ListScope.LIST_TERMINAL_ONLY>]>;
|
|
23
23
|
readonly accountSelector: v.OptionalSchema<v.SchemaWithPipe<readonly [v.VariantSchema<"kind", [v.StrictObjectSchema<{
|
|
@@ -213,7 +213,7 @@ declare const LifecycleFlowStepActivitySchema: v.SchemaWithPipe<readonly [v.Obje
|
|
|
213
213
|
}>]>;
|
|
214
214
|
declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
215
215
|
readonly sequence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
216
|
-
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
216
|
+
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
217
217
|
readonly assetIds: v.OptionalSchema<v.ObjectSchema<{
|
|
218
218
|
readonly zippedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
219
219
|
readonly unifiedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -356,7 +356,7 @@ declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
|
|
|
356
356
|
}>]>, undefined>, readonly []>;
|
|
357
357
|
}, undefined>, v.TransformAction<{
|
|
358
358
|
sequence: number;
|
|
359
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
359
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
360
360
|
assetIds?: {
|
|
361
361
|
zippedAssetId: number;
|
|
362
362
|
unifiedAssetId: number;
|
|
@@ -419,7 +419,7 @@ declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
|
|
|
419
419
|
})[];
|
|
420
420
|
}, Omit<{
|
|
421
421
|
sequence: number;
|
|
422
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
422
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
423
423
|
assetIds?: {
|
|
424
424
|
zippedAssetId: number;
|
|
425
425
|
unifiedAssetId: number;
|
|
@@ -485,7 +485,7 @@ declare const LifecycleFlowStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
|
|
|
485
485
|
}>]>;
|
|
486
486
|
declare const LifecycleFlowTimelineItemSchema: v.ObjectSchema<{
|
|
487
487
|
readonly sequence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
488
|
-
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
488
|
+
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
489
489
|
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "planned" | "completed" | "current">]>;
|
|
490
490
|
readonly expectedDurationMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
491
491
|
}, undefined>;
|
|
@@ -505,7 +505,7 @@ declare const LifecycleFlowSummarySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
505
505
|
readonly smartAccountAddress: v.StringSchema<undefined>;
|
|
506
506
|
readonly flowId: v.StringSchema<undefined>;
|
|
507
507
|
readonly flowKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "deposit" | "withdraw" | "transfer">]>;
|
|
508
|
-
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
508
|
+
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
509
509
|
readonly assetIds: v.OptionalSchema<v.ObjectSchema<{
|
|
510
510
|
readonly zippedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
511
511
|
readonly unifiedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -585,7 +585,7 @@ declare const LifecycleFlowSummarySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
585
585
|
}, undefined>, undefined>;
|
|
586
586
|
readonly progressTimeline: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
587
587
|
readonly sequence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
588
|
-
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
588
|
+
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
589
589
|
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "planned" | "completed" | "current">]>;
|
|
590
590
|
readonly expectedDurationMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
591
591
|
}, undefined>, undefined>, readonly []>;
|
|
@@ -597,7 +597,7 @@ declare const LifecycleFlowSummarySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
597
597
|
smartAccountAddress: string;
|
|
598
598
|
flowId: string;
|
|
599
599
|
flowKind: "unspecified" | "deposit" | "withdraw" | "transfer";
|
|
600
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
600
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
601
601
|
assetIds?: {
|
|
602
602
|
zippedAssetId: number;
|
|
603
603
|
unifiedAssetId: number;
|
|
@@ -649,7 +649,7 @@ declare const LifecycleFlowSummarySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
649
649
|
} | undefined;
|
|
650
650
|
progressTimeline: {
|
|
651
651
|
sequence: number;
|
|
652
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
652
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
653
653
|
status: "unspecified" | "planned" | "completed" | "current";
|
|
654
654
|
expectedDurationMs: number;
|
|
655
655
|
}[];
|
|
@@ -660,7 +660,7 @@ declare const LifecycleFlowSummarySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
660
660
|
smartAccountAddress: string;
|
|
661
661
|
flowId: string;
|
|
662
662
|
flowKind: "unspecified" | "deposit" | "withdraw" | "transfer";
|
|
663
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
663
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
664
664
|
assetIds?: {
|
|
665
665
|
zippedAssetId: number;
|
|
666
666
|
unifiedAssetId: number;
|
|
@@ -712,7 +712,7 @@ declare const LifecycleFlowSummarySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
712
712
|
} | undefined;
|
|
713
713
|
progressTimeline: {
|
|
714
714
|
sequence: number;
|
|
715
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
715
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
716
716
|
status: "unspecified" | "planned" | "completed" | "current";
|
|
717
717
|
expectedDurationMs: number;
|
|
718
718
|
}[];
|
|
@@ -727,7 +727,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
|
|
|
727
727
|
readonly smartAccountAddress: v.StringSchema<undefined>;
|
|
728
728
|
readonly flowId: v.StringSchema<undefined>;
|
|
729
729
|
readonly flowKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "deposit" | "withdraw" | "transfer">]>;
|
|
730
|
-
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
730
|
+
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
731
731
|
readonly assetIds: v.OptionalSchema<v.ObjectSchema<{
|
|
732
732
|
readonly zippedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
733
733
|
readonly unifiedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -807,7 +807,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
|
|
|
807
807
|
}, undefined>, undefined>;
|
|
808
808
|
readonly progressTimeline: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
809
809
|
readonly sequence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
810
|
-
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
810
|
+
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
811
811
|
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "planned" | "completed" | "current">]>;
|
|
812
812
|
readonly expectedDurationMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
813
813
|
}, undefined>, undefined>, readonly []>;
|
|
@@ -819,7 +819,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
|
|
|
819
819
|
smartAccountAddress: string;
|
|
820
820
|
flowId: string;
|
|
821
821
|
flowKind: "unspecified" | "deposit" | "withdraw" | "transfer";
|
|
822
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
822
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
823
823
|
assetIds?: {
|
|
824
824
|
zippedAssetId: number;
|
|
825
825
|
unifiedAssetId: number;
|
|
@@ -871,7 +871,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
|
|
|
871
871
|
} | undefined;
|
|
872
872
|
progressTimeline: {
|
|
873
873
|
sequence: number;
|
|
874
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
874
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
875
875
|
status: "unspecified" | "planned" | "completed" | "current";
|
|
876
876
|
expectedDurationMs: number;
|
|
877
877
|
}[];
|
|
@@ -882,7 +882,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
|
|
|
882
882
|
smartAccountAddress: string;
|
|
883
883
|
flowId: string;
|
|
884
884
|
flowKind: "unspecified" | "deposit" | "withdraw" | "transfer";
|
|
885
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
885
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
886
886
|
assetIds?: {
|
|
887
887
|
zippedAssetId: number;
|
|
888
888
|
unifiedAssetId: number;
|
|
@@ -934,7 +934,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
|
|
|
934
934
|
} | undefined;
|
|
935
935
|
progressTimeline: {
|
|
936
936
|
sequence: number;
|
|
937
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
937
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
938
938
|
status: "unspecified" | "planned" | "completed" | "current";
|
|
939
939
|
expectedDurationMs: number;
|
|
940
940
|
}[];
|
|
@@ -945,7 +945,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
|
|
|
945
945
|
}>]>, undefined>;
|
|
946
946
|
readonly observedSteps: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
947
947
|
readonly sequence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
948
|
-
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
948
|
+
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
949
949
|
readonly assetIds: v.OptionalSchema<v.ObjectSchema<{
|
|
950
950
|
readonly zippedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
951
951
|
readonly unifiedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -1088,7 +1088,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
|
|
|
1088
1088
|
}>]>, undefined>, readonly []>;
|
|
1089
1089
|
}, undefined>, v.TransformAction<{
|
|
1090
1090
|
sequence: number;
|
|
1091
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1091
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1092
1092
|
assetIds?: {
|
|
1093
1093
|
zippedAssetId: number;
|
|
1094
1094
|
unifiedAssetId: number;
|
|
@@ -1151,7 +1151,7 @@ declare const LifecycleFlowDetailSchema: v.ObjectSchema<{
|
|
|
1151
1151
|
})[];
|
|
1152
1152
|
}, Omit<{
|
|
1153
1153
|
sequence: number;
|
|
1154
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1154
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1155
1155
|
assetIds?: {
|
|
1156
1156
|
zippedAssetId: number;
|
|
1157
1157
|
unifiedAssetId: number;
|
|
@@ -1223,7 +1223,7 @@ declare const ListLifecycleFlowsOutputSchema: v.ObjectSchema<{
|
|
|
1223
1223
|
readonly smartAccountAddress: v.StringSchema<undefined>;
|
|
1224
1224
|
readonly flowId: v.StringSchema<undefined>;
|
|
1225
1225
|
readonly flowKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "deposit" | "withdraw" | "transfer">]>;
|
|
1226
|
-
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1226
|
+
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
1227
1227
|
readonly assetIds: v.OptionalSchema<v.ObjectSchema<{
|
|
1228
1228
|
readonly zippedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
1229
1229
|
readonly unifiedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -1303,7 +1303,7 @@ declare const ListLifecycleFlowsOutputSchema: v.ObjectSchema<{
|
|
|
1303
1303
|
}, undefined>, undefined>;
|
|
1304
1304
|
readonly progressTimeline: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
1305
1305
|
readonly sequence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
1306
|
-
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1306
|
+
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
1307
1307
|
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "planned" | "completed" | "current">]>;
|
|
1308
1308
|
readonly expectedDurationMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
1309
1309
|
}, undefined>, undefined>, readonly []>;
|
|
@@ -1315,7 +1315,7 @@ declare const ListLifecycleFlowsOutputSchema: v.ObjectSchema<{
|
|
|
1315
1315
|
smartAccountAddress: string;
|
|
1316
1316
|
flowId: string;
|
|
1317
1317
|
flowKind: "unspecified" | "deposit" | "withdraw" | "transfer";
|
|
1318
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1318
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1319
1319
|
assetIds?: {
|
|
1320
1320
|
zippedAssetId: number;
|
|
1321
1321
|
unifiedAssetId: number;
|
|
@@ -1367,7 +1367,7 @@ declare const ListLifecycleFlowsOutputSchema: v.ObjectSchema<{
|
|
|
1367
1367
|
} | undefined;
|
|
1368
1368
|
progressTimeline: {
|
|
1369
1369
|
sequence: number;
|
|
1370
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1370
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1371
1371
|
status: "unspecified" | "planned" | "completed" | "current";
|
|
1372
1372
|
expectedDurationMs: number;
|
|
1373
1373
|
}[];
|
|
@@ -1378,7 +1378,7 @@ declare const ListLifecycleFlowsOutputSchema: v.ObjectSchema<{
|
|
|
1378
1378
|
smartAccountAddress: string;
|
|
1379
1379
|
flowId: string;
|
|
1380
1380
|
flowKind: "unspecified" | "deposit" | "withdraw" | "transfer";
|
|
1381
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1381
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1382
1382
|
assetIds?: {
|
|
1383
1383
|
zippedAssetId: number;
|
|
1384
1384
|
unifiedAssetId: number;
|
|
@@ -1430,7 +1430,7 @@ declare const ListLifecycleFlowsOutputSchema: v.ObjectSchema<{
|
|
|
1430
1430
|
} | undefined;
|
|
1431
1431
|
progressTimeline: {
|
|
1432
1432
|
sequence: number;
|
|
1433
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1433
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1434
1434
|
status: "unspecified" | "planned" | "completed" | "current";
|
|
1435
1435
|
expectedDurationMs: number;
|
|
1436
1436
|
}[];
|
|
@@ -1448,7 +1448,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
|
|
|
1448
1448
|
readonly smartAccountAddress: v.StringSchema<undefined>;
|
|
1449
1449
|
readonly flowId: v.StringSchema<undefined>;
|
|
1450
1450
|
readonly flowKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "deposit" | "withdraw" | "transfer">]>;
|
|
1451
|
-
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1451
|
+
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
1452
1452
|
readonly assetIds: v.OptionalSchema<v.ObjectSchema<{
|
|
1453
1453
|
readonly zippedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
1454
1454
|
readonly unifiedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -1528,7 +1528,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
|
|
|
1528
1528
|
}, undefined>, undefined>;
|
|
1529
1529
|
readonly progressTimeline: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
1530
1530
|
readonly sequence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
1531
|
-
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1531
|
+
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
1532
1532
|
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "planned" | "completed" | "current">]>;
|
|
1533
1533
|
readonly expectedDurationMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
1534
1534
|
}, undefined>, undefined>, readonly []>;
|
|
@@ -1540,7 +1540,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
|
|
|
1540
1540
|
smartAccountAddress: string;
|
|
1541
1541
|
flowId: string;
|
|
1542
1542
|
flowKind: "unspecified" | "deposit" | "withdraw" | "transfer";
|
|
1543
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1543
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1544
1544
|
assetIds?: {
|
|
1545
1545
|
zippedAssetId: number;
|
|
1546
1546
|
unifiedAssetId: number;
|
|
@@ -1592,7 +1592,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
|
|
|
1592
1592
|
} | undefined;
|
|
1593
1593
|
progressTimeline: {
|
|
1594
1594
|
sequence: number;
|
|
1595
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1595
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1596
1596
|
status: "unspecified" | "planned" | "completed" | "current";
|
|
1597
1597
|
expectedDurationMs: number;
|
|
1598
1598
|
}[];
|
|
@@ -1603,7 +1603,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
|
|
|
1603
1603
|
smartAccountAddress: string;
|
|
1604
1604
|
flowId: string;
|
|
1605
1605
|
flowKind: "unspecified" | "deposit" | "withdraw" | "transfer";
|
|
1606
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1606
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1607
1607
|
assetIds?: {
|
|
1608
1608
|
zippedAssetId: number;
|
|
1609
1609
|
unifiedAssetId: number;
|
|
@@ -1655,7 +1655,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
|
|
|
1655
1655
|
} | undefined;
|
|
1656
1656
|
progressTimeline: {
|
|
1657
1657
|
sequence: number;
|
|
1658
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1658
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1659
1659
|
status: "unspecified" | "planned" | "completed" | "current";
|
|
1660
1660
|
expectedDurationMs: number;
|
|
1661
1661
|
}[];
|
|
@@ -1666,7 +1666,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
|
|
|
1666
1666
|
}>]>, undefined>;
|
|
1667
1667
|
readonly observedSteps: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
1668
1668
|
readonly sequence: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
1669
|
-
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1669
|
+
readonly step: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
1670
1670
|
readonly assetIds: v.OptionalSchema<v.ObjectSchema<{
|
|
1671
1671
|
readonly zippedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
1672
1672
|
readonly unifiedAssetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -1809,7 +1809,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
|
|
|
1809
1809
|
}>]>, undefined>, readonly []>;
|
|
1810
1810
|
}, undefined>, v.TransformAction<{
|
|
1811
1811
|
sequence: number;
|
|
1812
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1812
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1813
1813
|
assetIds?: {
|
|
1814
1814
|
zippedAssetId: number;
|
|
1815
1815
|
unifiedAssetId: number;
|
|
@@ -1872,7 +1872,7 @@ declare const GetLifecycleFlowOutputSchema: v.ObjectSchema<{
|
|
|
1872
1872
|
})[];
|
|
1873
1873
|
}, Omit<{
|
|
1874
1874
|
sequence: number;
|
|
1875
|
-
step: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1875
|
+
step: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1876
1876
|
assetIds?: {
|
|
1877
1877
|
zippedAssetId: number;
|
|
1878
1878
|
unifiedAssetId: number;
|
|
@@ -1949,7 +1949,7 @@ declare const LifecycleFlowTxMatchSchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
1949
1949
|
readonly txOccurrenceIndex: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, number>]>;
|
|
1950
1950
|
readonly sourceDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
|
|
1951
1951
|
readonly destinationDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
|
|
1952
|
-
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1952
|
+
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
1953
1953
|
readonly isOpen: v.BooleanSchema<undefined>;
|
|
1954
1954
|
readonly isTerminal: v.BooleanSchema<undefined>;
|
|
1955
1955
|
readonly assetIds: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -1983,7 +1983,7 @@ declare const LifecycleFlowTxMatchSchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
1983
1983
|
txOccurrenceIndex?: number | undefined;
|
|
1984
1984
|
sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
|
|
1985
1985
|
destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
|
|
1986
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
1986
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
1987
1987
|
isOpen: boolean;
|
|
1988
1988
|
isTerminal: boolean;
|
|
1989
1989
|
assetIds?: {
|
|
@@ -2011,7 +2011,7 @@ declare const LifecycleFlowTxMatchSchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
2011
2011
|
txOccurrenceIndex?: number | undefined;
|
|
2012
2012
|
sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
|
|
2013
2013
|
destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
|
|
2014
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
2014
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
2015
2015
|
isOpen: boolean;
|
|
2016
2016
|
isTerminal: boolean;
|
|
2017
2017
|
assetIds?: {
|
|
@@ -2044,7 +2044,7 @@ declare const ListLifecycleFlowsByTxOutputSchema: v.ObjectSchema<{
|
|
|
2044
2044
|
readonly txOccurrenceIndex: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, number>]>;
|
|
2045
2045
|
readonly sourceDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
|
|
2046
2046
|
readonly destinationDomain: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending">]>;
|
|
2047
|
-
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
2047
|
+
readonly currentStep: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement">]>;
|
|
2048
2048
|
readonly isOpen: v.BooleanSchema<undefined>;
|
|
2049
2049
|
readonly isTerminal: v.BooleanSchema<undefined>;
|
|
2050
2050
|
readonly assetIds: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -2078,7 +2078,7 @@ declare const ListLifecycleFlowsByTxOutputSchema: v.ObjectSchema<{
|
|
|
2078
2078
|
txOccurrenceIndex?: number | undefined;
|
|
2079
2079
|
sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
|
|
2080
2080
|
destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
|
|
2081
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
2081
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
2082
2082
|
isOpen: boolean;
|
|
2083
2083
|
isTerminal: boolean;
|
|
2084
2084
|
assetIds?: {
|
|
@@ -2106,7 +2106,7 @@ declare const ListLifecycleFlowsByTxOutputSchema: v.ObjectSchema<{
|
|
|
2106
2106
|
txOccurrenceIndex?: number | undefined;
|
|
2107
2107
|
sourceDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
|
|
2108
2108
|
destinationDomain: "unspecified" | "trading" | "funding" | "external_chain" | "zipper" | "lending";
|
|
2109
|
-
currentStep: "validation" | "unspecified" | "failed" | "source" | "transfer" | "dropped" | "refunded" | "request" | "
|
|
2109
|
+
currentStep: "validation" | "unspecified" | "failed" | "execution" | "source" | "transfer" | "dropped" | "refunded" | "request" | "bridge_fulfillment" | "fulfilling" | "settlement";
|
|
2110
2110
|
isOpen: boolean;
|
|
2111
2111
|
isTerminal: boolean;
|
|
2112
2112
|
assetIds?: {
|
|
@@ -33,7 +33,7 @@ declare class OrderbookService {
|
|
|
33
33
|
*/
|
|
34
34
|
subscribe(input: SubscribeOrderbookInput): () => void;
|
|
35
35
|
/**
|
|
36
|
-
* Creates a stateful order book subscription that first fetches a snapshot, buffers proto deltas from public:spot:orderbook:deltas:depth:{depth}:{symbolId}:proto, applies sequence-checked updates, and refetches on observed sequence gaps or reconnects. A snapshot whose book is not available fails with ServiceUnavailableError through onError and is retried; no event is emitted until a snapshot is available. The returned handle can unsubscribe or change local price bucket aggregation without reconnecting.
|
|
36
|
+
* Creates a stateful order book subscription that first fetches a snapshot, buffers proto deltas from public:spot:orderbook:deltas:depth:{depth}:{symbolId}:proto, applies sequence-checked updates, and refetches on observed sequence gaps or reconnects. A snapshot whose book is not available fails with ServiceUnavailableError through onError and is retried; no event is emitted until a snapshot is available. The snapshot is fetched once the channel opens, so a socket that cannot connect reports a retryable RealtimeError with type "transport" through onError instead, once per outage; onOpen follows when it recovers. The returned handle can unsubscribe or change local price bucket aggregation without reconnecting.
|
|
37
37
|
*
|
|
38
38
|
* `depth` is clamped to [1, 500] and rides the smallest published channel depth that covers it (see ORDERBOOK_WS_DEPTHS); levels are sliced back to the requested depth locally.
|
|
39
39
|
*
|
|
@@ -50,7 +50,7 @@ var OrderbookService = class {
|
|
|
50
50
|
return this.createSubscription(input).unsubscribe;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* Creates a stateful order book subscription that first fetches a snapshot, buffers proto deltas from public:spot:orderbook:deltas:depth:{depth}:{symbolId}:proto, applies sequence-checked updates, and refetches on observed sequence gaps or reconnects. A snapshot whose book is not available fails with ServiceUnavailableError through onError and is retried; no event is emitted until a snapshot is available. The returned handle can unsubscribe or change local price bucket aggregation without reconnecting.
|
|
53
|
+
* Creates a stateful order book subscription that first fetches a snapshot, buffers proto deltas from public:spot:orderbook:deltas:depth:{depth}:{symbolId}:proto, applies sequence-checked updates, and refetches on observed sequence gaps or reconnects. A snapshot whose book is not available fails with ServiceUnavailableError through onError and is retried; no event is emitted until a snapshot is available. The snapshot is fetched once the channel opens, so a socket that cannot connect reports a retryable RealtimeError with type "transport" through onError instead, once per outage; onOpen follows when it recovers. The returned handle can unsubscribe or change local price bucket aggregation without reconnecting.
|
|
54
54
|
*
|
|
55
55
|
* `depth` is clamped to [1, 500] and rides the smallest published channel depth that covers it (see ORDERBOOK_WS_DEPTHS); levels are sliced back to the requested depth locally.
|
|
56
56
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orderbook.js","names":["#client","Proto.OrderbookService","#realtime","#scales","Proto.GetOrderBookResponseSchema","Proto.OrderBookDeltaSchema"],"sources":["../../../src/services/orderbook/orderbook.ts"],"sourcesContent":["import { create } from \"@bufbuild/protobuf\";\nimport * as Proto from \"../../gen/orderbook/v1/orderbook_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport { publicationHandlerErrorContext } from \"../../shared/subscription-errors.js\";\nimport type { PolyesterRealtime } from \"../../realtime/types.js\";\nimport {\n snapshotThenStream,\n type SnapshotThenStreamSubscription,\n} from \"../../realtime/snapshot-then-stream.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { decimalInputToScaled, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport {\n formatOrderbookLevel,\n GetOrderbookInputSchema,\n createOrderbookDataSchema,\n type OrderbookLevel,\n type OrderbookData,\n} from \"./orderbook.schemas.js\";\nimport { orderbookWsChannelDepth } from \"./orderbook.codecs.js\";\nimport { isResourceNotFoundError } from \"../../utils/errors.js\";\nimport { ServiceUnavailableError } from \"../../shared/errors.js\";\nimport type * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { PublicApiTransports } from \"../../shared/transports.js\";\n\ninterface SubscribeOrderbookInput extends BaseSubscribeInput<OrderbookData> {\n symbolId: number;\n depth?: number;\n bucket?: string | null;\n}\n\nexport interface OrderbookStreamHandlers extends BaseSubscribeInput<OrderbookData> {}\n\nexport interface OrderbookSubscription {\n unsubscribe: () => void;\n setBucket: (bucket: string | null | undefined) => void;\n}\n\nexport interface CreateOrderbookSubscriptionInput\n extends\n OrderbookStreamHandlers,\n Pick<SubscribeOrderbookInput, \"symbolId\" | \"depth\" | \"bucket\"> {}\n\ntype BookSide = Map<bigint, bigint>;\n\n/**\n * Reads spot order book snapshots and maintains realtime local order book state from public delta channels.\n */\nexport class OrderbookService {\n #client: Client<typeof Proto.OrderbookService>;\n #realtime: PolyesterRealtime;\n #scales: SdkScales;\n\n constructor(transports: PublicApiTransports, realtime: PolyesterRealtime, scales: SdkScales) {\n this.#client = createClient(Proto.OrderbookService, transports.publicApi);\n this.#realtime = realtime;\n this.#scales = scales;\n }\n\n /**\n * Fetches a spot order book depth snapshot for a symbol ID and requested depth, returning best bids and asks with the backend book sequence.\n * When `available` is false the book is being built or was invalidated: its levels are unknown, not empty, so read it again later instead of treating empty sides as no liquidity.\n */\n async get(\n input: v.InferInput<typeof GetOrderbookInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<OrderbookData> {\n const validated = parse(GetOrderbookInputSchema, input);\n await this.#scales.ready();\n const res = await this.#client.getOrderBook(\n { symbolId: validated.symbolId, depth: validated.protoDepth },\n toConnectCallOptions(options),\n );\n return parse(createOrderbookDataSchema(this.#scales, validated.symbolId), {\n symbolId: res.symbolId,\n depth: validated.depth,\n bookSeq: res.bookSeq,\n available: isBookAvailable(res),\n bids: res.bids,\n asks: res.asks,\n });\n }\n\n /**\n * Subscribes to the managed order book stream for a symbol ID and forwards reconstructed snapshots to onEvent. This is a convenience wrapper around createSubscription().unsubscribe.\n */\n subscribe(input: SubscribeOrderbookInput): () => void {\n return this.createSubscription(input).unsubscribe;\n }\n\n /**\n * Creates a stateful order book subscription that first fetches a snapshot, buffers proto deltas from public:spot:orderbook:deltas:depth:{depth}:{symbolId}:proto, applies sequence-checked updates, and refetches on observed sequence gaps or reconnects. A snapshot whose book is not available fails with ServiceUnavailableError through onError and is retried; no event is emitted until a snapshot is available. The returned handle can unsubscribe or change local price bucket aggregation without reconnecting.\n *\n * `depth` is clamped to [1, 500] and rides the smallest published channel depth that covers it (see ORDERBOOK_WS_DEPTHS); levels are sliced back to the requested depth locally.\n *\n * Refetching is driven by observed sequence gaps and reconnect events only. A feed that stays subscribed but stops publishing is indistinguishable from a quiet market, so it does not trigger onError or a refetch. Callers that must detect a stalled book need their own idle watchdog plus a REST refetch.\n */\n createSubscription(input: CreateOrderbookSubscriptionInput): OrderbookSubscription {\n const { symbolId } = parse(GetOrderbookInputSchema, {\n symbolId: input.symbolId,\n depth: input.depth,\n });\n const requestedDepth = Math.min(500, Math.max(1, Math.trunc(input.depth ?? 50)));\n const channelDepth = orderbookWsChannelDepth(requestedDepth);\n const channel = `public:spot:orderbook:deltas:depth:${channelDepth}:${symbolId}:proto`;\n\n const client = this.#client;\n const scales = this.#scales;\n let bidsMap: BookSide = new Map();\n let asksMap: BookSide = new Map();\n let currentBookSeq = 0n;\n let bucketTicks: bigint | null = null;\n let stream: SnapshotThenStreamSubscription | undefined;\n\n function levelsToMap(levels: Proto.PriceLevel[] | undefined): BookSide {\n const map: BookSide = new Map();\n for (const l of levels ?? []) {\n if (l.qtyScaled === 0n) continue;\n map.set(l.priceTicks, l.qtyScaled);\n }\n return map;\n }\n\n function applySideDelta(map: BookSide, levels: Proto.PriceLevel[] | undefined): void {\n for (const l of levels ?? []) {\n if (l.qtyScaled === 0n) map.delete(l.priceTicks);\n else map.set(l.priceTicks, l.qtyScaled);\n }\n }\n\n function sideToUI(map: BookSide, side: \"bids\" | \"asks\", limit: number): OrderbookLevel[] {\n const entries = Array.from(map.entries());\n entries.sort(([pa], [pb]) => {\n if (pa === pb) return 0;\n return side === \"bids\" ? (pa > pb ? -1 : 1) : pa < pb ? -1 : 1;\n });\n return entries\n .slice(0, limit)\n .map(([priceTicks, qtyScaled]) =>\n formatOrderbookLevel({ priceTicks, qtyScaled }, scales, symbolId),\n );\n }\n\n function sideToUIBucketed(\n map: BookSide,\n side: \"bids\" | \"asks\",\n limit: number,\n bucket: bigint | null,\n ): OrderbookLevel[] {\n if (!bucket || bucket <= 0n) return sideToUI(map, side, limit);\n\n const agg: BookSide = new Map();\n for (const [priceTicks, qtyScaled] of map.entries()) {\n if (qtyScaled <= 0n) continue;\n const bucketFloor = (priceTicks / bucket) * bucket;\n const bucketPrice =\n side === \"asks\" && bucketFloor !== priceTicks\n ? bucketFloor + bucket\n : bucketFloor;\n agg.set(bucketPrice, (agg.get(bucketPrice) ?? 0n) + qtyScaled);\n }\n return sideToUI(agg, side, limit);\n }\n\n function emit(): void {\n try {\n input.onEvent({\n symbolId,\n depth: requestedDepth,\n bookSeq: currentBookSeq.toString(),\n available: true,\n bids: sideToUIBucketed(bidsMap, \"bids\", requestedDepth, bucketTicks),\n asks: sideToUIBucketed(asksMap, \"asks\", requestedDepth, bucketTicks),\n });\n } catch (error) {\n input.onError?.(publicationHandlerErrorContext(channel, error));\n }\n }\n\n function setBucket(bucket: string | null | undefined): void {\n if (!bucket) {\n bucketTicks = null;\n } else {\n try {\n bucketTicks = decimalInputToScaled(\"bucket\", bucket, scales.price());\n } catch {\n bucketTicks = null;\n }\n }\n if (stream?.isReady()) emit();\n }\n\n async function inputServiceFetch(): Promise<Proto.GetOrderBookResponse> {\n await scales.ready();\n const validated = parse(GetOrderbookInputSchema, {\n symbolId,\n depth: channelDepth,\n });\n let res: Proto.GetOrderBookResponse;\n try {\n res = await client.getOrderBook({\n symbolId: validated.symbolId,\n depth: validated.protoDepth,\n });\n } catch (error: unknown) {\n if (!isResourceNotFoundError(error)) throw error;\n\n return create(Proto.GetOrderBookResponseSchema, {\n symbolId,\n bookSeq: 0n,\n available: true,\n bids: [],\n asks: [],\n });\n }\n // An unavailable book's levels are unknown, not empty: fail the snapshot so it is retried.\n if (!isBookAvailable(res)) {\n throw new ServiceUnavailableError(\n `Order book for symbol ${symbolId} is not available yet`,\n );\n }\n return res;\n }\n\n function handleDelta(delta: Proto.OrderBookDelta): boolean {\n if (delta.bookSeqEnd <= currentBookSeq) return true;\n\n if (delta.reset) {\n bidsMap.clear();\n asksMap.clear();\n currentBookSeq = 0n;\n }\n\n if (currentBookSeq !== 0n && delta.bookSeqStart > currentBookSeq + 1n) {\n stream?.refreshSnapshot();\n return false;\n }\n\n applySideDelta(bidsMap, delta.bids);\n applySideDelta(asksMap, delta.asks);\n\n currentBookSeq = delta.bookSeqEnd > currentBookSeq ? delta.bookSeqEnd : currentBookSeq;\n emit();\n return true;\n }\n\n setBucket(input.bucket);\n stream = snapshotThenStream({\n realtime: this.#realtime,\n channel,\n schema: Proto.OrderBookDeltaSchema,\n maxBufferedPublications: 200,\n snapshotErrorLog: \"Failed to fetch orderbook\",\n snapshotRetry: { maxAttempts: 3, delayMs: 1_000 },\n fetchSnapshot: inputServiceFetch,\n readPublication: (delta) => [delta],\n applySnapshot: (snapshot, bufferedDeltas) => {\n bidsMap = levelsToMap(snapshot.bids);\n asksMap = levelsToMap(snapshot.asks);\n currentBookSeq = snapshot.bookSeq;\n emit();\n for (const delta of bufferedDeltas) {\n if (stream?.isDisposed()) return;\n if (!handleDelta(delta)) return;\n }\n },\n applyLivePublications: (deltas) => {\n for (const delta of deltas) {\n if (stream?.isDisposed()) return;\n if (!handleDelta(delta)) return;\n }\n },\n onOpen: input.onOpen,\n onClose: input.onClose,\n onError: input.onError,\n });\n\n function dispose(): void {\n stream?.unsubscribe();\n }\n\n return { unsubscribe: dispose, setBucket };\n }\n}\n\n/**\n * Whether a snapshot's levels are the book. A snapshot carrying levels is current even with\n * `available` false, which is how servers that predate the field encode every snapshot.\n */\nfunction isBookAvailable(res: Proto.GetOrderBookResponse): boolean {\n return res.available || res.bids.length > 0 || res.asks.length > 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoDA,IAAa,mBAAb,MAA8B;CAC1B;CACA;CACA;CAEA,YAAY,YAAiC,UAA6B,QAAmB;EACzF,KAAKA,UAAU,aAAaC,oBAAwB,WAAW,SAAS;EACxE,KAAKC,YAAY;EACjB,KAAKC,UAAU;CACnB;;;;;CAMA,MAAM,IACF,OACA,SACsB;EACtB,MAAM,YAAY,MAAM,yBAAyB,KAAK;EACtD,MAAM,KAAKA,QAAQ,MAAM;EACzB,MAAM,MAAM,MAAM,KAAKH,QAAQ,aAC3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AAwB,WAAW;IAC/B,KAAK,MAAM,SAAS,QAAQ;KACxB,IAAI,QAAQ,WAAW,GAAG;KAC1B,IAAI,CAAC,YAAY,KAAK,GAAG;IAC7B;GACJ;GACA,QAAQ,MAAM;GACd,SAAS,MAAM;GACf,SAAS,MAAM;EACnB,CAAC;EAED,SAAS,UAAgB;GACrB,QAAQ,YAAY;EACxB;EAEA,OAAO;GAAE,aAAa;GAAS;EAAU;CAC7C;AACJ;;;;;AAMA,SAAS,gBAAgB,KAA0C;CAC/D,OAAO,IAAI,aAAa,IAAI,KAAK,SAAS,KAAK,IAAI,KAAK,SAAS;AACrE"}
|
|
1
|
+
{"version":3,"file":"orderbook.js","names":["#client","Proto.OrderbookService","#realtime","#scales","Proto.GetOrderBookResponseSchema","Proto.OrderBookDeltaSchema"],"sources":["../../../src/services/orderbook/orderbook.ts"],"sourcesContent":["import { create } from \"@bufbuild/protobuf\";\nimport * as Proto from \"../../gen/orderbook/v1/orderbook_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport { publicationHandlerErrorContext } from \"../../shared/subscription-errors.js\";\nimport type { PolyesterRealtime } from \"../../realtime/types.js\";\nimport {\n snapshotThenStream,\n type SnapshotThenStreamSubscription,\n} from \"../../realtime/snapshot-then-stream.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { decimalInputToScaled, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport {\n formatOrderbookLevel,\n GetOrderbookInputSchema,\n createOrderbookDataSchema,\n type OrderbookLevel,\n type OrderbookData,\n} from \"./orderbook.schemas.js\";\nimport { orderbookWsChannelDepth } from \"./orderbook.codecs.js\";\nimport { isResourceNotFoundError } from \"../../utils/errors.js\";\nimport { ServiceUnavailableError } from \"../../shared/errors.js\";\nimport type * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { PublicApiTransports } from \"../../shared/transports.js\";\n\ninterface SubscribeOrderbookInput extends BaseSubscribeInput<OrderbookData> {\n symbolId: number;\n depth?: number;\n bucket?: string | null;\n}\n\nexport interface OrderbookStreamHandlers extends BaseSubscribeInput<OrderbookData> {}\n\nexport interface OrderbookSubscription {\n unsubscribe: () => void;\n setBucket: (bucket: string | null | undefined) => void;\n}\n\nexport interface CreateOrderbookSubscriptionInput\n extends\n OrderbookStreamHandlers,\n Pick<SubscribeOrderbookInput, \"symbolId\" | \"depth\" | \"bucket\"> {}\n\ntype BookSide = Map<bigint, bigint>;\n\n/**\n * Reads spot order book snapshots and maintains realtime local order book state from public delta channels.\n */\nexport class OrderbookService {\n #client: Client<typeof Proto.OrderbookService>;\n #realtime: PolyesterRealtime;\n #scales: SdkScales;\n\n constructor(transports: PublicApiTransports, realtime: PolyesterRealtime, scales: SdkScales) {\n this.#client = createClient(Proto.OrderbookService, transports.publicApi);\n this.#realtime = realtime;\n this.#scales = scales;\n }\n\n /**\n * Fetches a spot order book depth snapshot for a symbol ID and requested depth, returning best bids and asks with the backend book sequence.\n * When `available` is false the book is being built or was invalidated: its levels are unknown, not empty, so read it again later instead of treating empty sides as no liquidity.\n */\n async get(\n input: v.InferInput<typeof GetOrderbookInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<OrderbookData> {\n const validated = parse(GetOrderbookInputSchema, input);\n await this.#scales.ready();\n const res = await this.#client.getOrderBook(\n { symbolId: validated.symbolId, depth: validated.protoDepth },\n toConnectCallOptions(options),\n );\n return parse(createOrderbookDataSchema(this.#scales, validated.symbolId), {\n symbolId: res.symbolId,\n depth: validated.depth,\n bookSeq: res.bookSeq,\n available: isBookAvailable(res),\n bids: res.bids,\n asks: res.asks,\n });\n }\n\n /**\n * Subscribes to the managed order book stream for a symbol ID and forwards reconstructed snapshots to onEvent. This is a convenience wrapper around createSubscription().unsubscribe.\n */\n subscribe(input: SubscribeOrderbookInput): () => void {\n return this.createSubscription(input).unsubscribe;\n }\n\n /**\n * Creates a stateful order book subscription that first fetches a snapshot, buffers proto deltas from public:spot:orderbook:deltas:depth:{depth}:{symbolId}:proto, applies sequence-checked updates, and refetches on observed sequence gaps or reconnects. A snapshot whose book is not available fails with ServiceUnavailableError through onError and is retried; no event is emitted until a snapshot is available. The snapshot is fetched once the channel opens, so a socket that cannot connect reports a retryable RealtimeError with type \"transport\" through onError instead, once per outage; onOpen follows when it recovers. The returned handle can unsubscribe or change local price bucket aggregation without reconnecting.\n *\n * `depth` is clamped to [1, 500] and rides the smallest published channel depth that covers it (see ORDERBOOK_WS_DEPTHS); levels are sliced back to the requested depth locally.\n *\n * Refetching is driven by observed sequence gaps and reconnect events only. A feed that stays subscribed but stops publishing is indistinguishable from a quiet market, so it does not trigger onError or a refetch. Callers that must detect a stalled book need their own idle watchdog plus a REST refetch.\n */\n createSubscription(input: CreateOrderbookSubscriptionInput): OrderbookSubscription {\n const { symbolId } = parse(GetOrderbookInputSchema, {\n symbolId: input.symbolId,\n depth: input.depth,\n });\n const requestedDepth = Math.min(500, Math.max(1, Math.trunc(input.depth ?? 50)));\n const channelDepth = orderbookWsChannelDepth(requestedDepth);\n const channel = `public:spot:orderbook:deltas:depth:${channelDepth}:${symbolId}:proto`;\n\n const client = this.#client;\n const scales = this.#scales;\n let bidsMap: BookSide = new Map();\n let asksMap: BookSide = new Map();\n let currentBookSeq = 0n;\n let bucketTicks: bigint | null = null;\n let stream: SnapshotThenStreamSubscription | undefined;\n\n function levelsToMap(levels: Proto.PriceLevel[] | undefined): BookSide {\n const map: BookSide = new Map();\n for (const l of levels ?? []) {\n if (l.qtyScaled === 0n) continue;\n map.set(l.priceTicks, l.qtyScaled);\n }\n return map;\n }\n\n function applySideDelta(map: BookSide, levels: Proto.PriceLevel[] | undefined): void {\n for (const l of levels ?? []) {\n if (l.qtyScaled === 0n) map.delete(l.priceTicks);\n else map.set(l.priceTicks, l.qtyScaled);\n }\n }\n\n function sideToUI(map: BookSide, side: \"bids\" | \"asks\", limit: number): OrderbookLevel[] {\n const entries = Array.from(map.entries());\n entries.sort(([pa], [pb]) => {\n if (pa === pb) return 0;\n return side === \"bids\" ? (pa > pb ? -1 : 1) : pa < pb ? -1 : 1;\n });\n return entries\n .slice(0, limit)\n .map(([priceTicks, qtyScaled]) =>\n formatOrderbookLevel({ priceTicks, qtyScaled }, scales, symbolId),\n );\n }\n\n function sideToUIBucketed(\n map: BookSide,\n side: \"bids\" | \"asks\",\n limit: number,\n bucket: bigint | null,\n ): OrderbookLevel[] {\n if (!bucket || bucket <= 0n) return sideToUI(map, side, limit);\n\n const agg: BookSide = new Map();\n for (const [priceTicks, qtyScaled] of map.entries()) {\n if (qtyScaled <= 0n) continue;\n const bucketFloor = (priceTicks / bucket) * bucket;\n const bucketPrice =\n side === \"asks\" && bucketFloor !== priceTicks\n ? bucketFloor + bucket\n : bucketFloor;\n agg.set(bucketPrice, (agg.get(bucketPrice) ?? 0n) + qtyScaled);\n }\n return sideToUI(agg, side, limit);\n }\n\n function emit(): void {\n try {\n input.onEvent({\n symbolId,\n depth: requestedDepth,\n bookSeq: currentBookSeq.toString(),\n available: true,\n bids: sideToUIBucketed(bidsMap, \"bids\", requestedDepth, bucketTicks),\n asks: sideToUIBucketed(asksMap, \"asks\", requestedDepth, bucketTicks),\n });\n } catch (error) {\n input.onError?.(publicationHandlerErrorContext(channel, error));\n }\n }\n\n function setBucket(bucket: string | null | undefined): void {\n if (!bucket) {\n bucketTicks = null;\n } else {\n try {\n bucketTicks = decimalInputToScaled(\"bucket\", bucket, scales.price());\n } catch {\n bucketTicks = null;\n }\n }\n if (stream?.isReady()) emit();\n }\n\n async function inputServiceFetch(): Promise<Proto.GetOrderBookResponse> {\n await scales.ready();\n const validated = parse(GetOrderbookInputSchema, {\n symbolId,\n depth: channelDepth,\n });\n let res: Proto.GetOrderBookResponse;\n try {\n res = await client.getOrderBook({\n symbolId: validated.symbolId,\n depth: validated.protoDepth,\n });\n } catch (error: unknown) {\n if (!isResourceNotFoundError(error)) throw error;\n\n return create(Proto.GetOrderBookResponseSchema, {\n symbolId,\n bookSeq: 0n,\n available: true,\n bids: [],\n asks: [],\n });\n }\n // An unavailable book's levels are unknown, not empty: fail the snapshot so it is retried.\n if (!isBookAvailable(res)) {\n throw new ServiceUnavailableError(\n `Order book for symbol ${symbolId} is not available yet`,\n );\n }\n return res;\n }\n\n function handleDelta(delta: Proto.OrderBookDelta): boolean {\n if (delta.bookSeqEnd <= currentBookSeq) return true;\n\n if (delta.reset) {\n bidsMap.clear();\n asksMap.clear();\n currentBookSeq = 0n;\n }\n\n if (currentBookSeq !== 0n && delta.bookSeqStart > currentBookSeq + 1n) {\n stream?.refreshSnapshot();\n return false;\n }\n\n applySideDelta(bidsMap, delta.bids);\n applySideDelta(asksMap, delta.asks);\n\n currentBookSeq = delta.bookSeqEnd > currentBookSeq ? delta.bookSeqEnd : currentBookSeq;\n emit();\n return true;\n }\n\n setBucket(input.bucket);\n stream = snapshotThenStream({\n realtime: this.#realtime,\n channel,\n schema: Proto.OrderBookDeltaSchema,\n maxBufferedPublications: 200,\n snapshotErrorLog: \"Failed to fetch orderbook\",\n snapshotRetry: { maxAttempts: 3, delayMs: 1_000 },\n fetchSnapshot: inputServiceFetch,\n readPublication: (delta) => [delta],\n applySnapshot: (snapshot, bufferedDeltas) => {\n bidsMap = levelsToMap(snapshot.bids);\n asksMap = levelsToMap(snapshot.asks);\n currentBookSeq = snapshot.bookSeq;\n emit();\n for (const delta of bufferedDeltas) {\n if (stream?.isDisposed()) return;\n if (!handleDelta(delta)) return;\n }\n },\n applyLivePublications: (deltas) => {\n for (const delta of deltas) {\n if (stream?.isDisposed()) return;\n if (!handleDelta(delta)) return;\n }\n },\n onOpen: input.onOpen,\n onClose: input.onClose,\n onError: input.onError,\n });\n\n function dispose(): void {\n stream?.unsubscribe();\n }\n\n return { unsubscribe: dispose, setBucket };\n }\n}\n\n/**\n * Whether a snapshot's levels are the book. A snapshot carrying levels is current even with\n * `available` false, which is how servers that predate the field encode every snapshot.\n */\nfunction isBookAvailable(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B,SAAS,mBAAmB;GACxB,UAAU,KAAKF;GACf;GACA,QAAQG;GACR,yBAAyB;GACzB,kBAAkB;GAClB,eAAe;IAAE,aAAa;IAAG,SAAS;GAAM;GAChD,eAAe;GACf,kBAAkB,UAAU,CAAC,KAAK;GAClC,gBAAgB,UAAU,mBAAmB;IACzC,UAAU,YAAY,SAAS,IAAI;IACnC,UAAU,YAAY,SAAS,IAAI;IACnC,iBAAiB,SAAS;IAC1B,KAAK;IACL,KAAK,MAAM,SAAS,gBAAgB;KAChC,IAAI,QAAQ,WAAW,GAAG;KAC1B,IAAI,CAAC,YAAY,KAAK,GAAG;IAC7B;GACJ;GACA,wBAAwB,WAAW;IAC/B,KAAK,MAAM,SAAS,QAAQ;KACxB,IAAI,QAAQ,WAAW,GAAG;KAC1B,IAAI,CAAC,YAAY,KAAK,GAAG;IAC7B;GACJ;GACA,QAAQ,MAAM;GACd,SAAS,MAAM;GACf,SAAS,MAAM;EACnB,CAAC;EAED,SAAS,UAAgB;GACrB,QAAQ,YAAY;EACxB;EAEA,OAAO;GAAE,aAAa;GAAS;EAAU;CAC7C;AACJ;;;;;AAMA,SAAS,gBAAgB,KAA0C;CAC/D,OAAO,IAAI,aAAa,IAAI,KAAK,SAAS,KAAK,IAAI,KAAK,SAAS;AACrE"}
|
|
@@ -10,7 +10,7 @@ declare const GetOrderbookInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema
|
|
|
10
10
|
depth: number;
|
|
11
11
|
}, {
|
|
12
12
|
symbolId: number;
|
|
13
|
-
depth: 1 | 5 | 10 | 20 | 100 | 500 | 1000 |
|
|
13
|
+
depth: 1 | 5 | 10 | 20 | 100 | 500 | 1000 | 200 | 50;
|
|
14
14
|
protoDepth: Depth;
|
|
15
15
|
}>]>;
|
|
16
16
|
type GetOrderbookInput = v.InferInput<typeof GetOrderbookInputSchema>;
|
|
@@ -3,7 +3,7 @@ import * as v from "valibot";
|
|
|
3
3
|
//#region src/services/orders/order-errors.schemas.d.ts
|
|
4
4
|
type OrderErrorCode = keyof typeof ErrorCode;
|
|
5
5
|
declare const OrderErrorDetailSchema: v.ObjectSchema<{
|
|
6
|
-
readonly code: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ErrorCode, undefined>, v.TransformAction<ErrorCode, "STALE_QUOTE" | "UNSPECIFIED" | "
|
|
6
|
+
readonly code: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ErrorCode, undefined>, v.TransformAction<ErrorCode, "STALE_QUOTE" | "UNSPECIFIED" | "BAD_REQUEST" | "INVALID_ARGUMENT" | "INSUFFICIENT_FUNDS" | "UNKNOWN_SYMBOL" | "BAD_PRICE" | "BAD_QTY" | "MIN_NOTIONAL" | "QTY_STEP_SIZE" | "CONFLICT_DUPLICATE_CLIENT_ORDER_ID" | "UNAVAILABLE" | "UNAUTHENTICATED" | "PERMISSION_DENIED" | "NOT_FOUND" | "UPSTREAM_ERROR" | "FEE_ASSET_NOT_ALLOWED" | "PAIR_DISABLED" | "ORDER_UNKNOWN" | "INTERNAL_ERROR" | "SUBACCOUNT_INACTIVE" | "POLICY_MARKET_DENY" | "POLICY_MAX_NOTIONAL" | "POLICY_TRADING_HALTED" | "POLICY_SPOT_TRADE_DENY" | "API_KEY_ROOT_SCOPE_ONLY" | "API_KEY_SUB_SCOPE_ONLY" | "API_KEY_SUBACCOUNT_MISMATCH" | "API_KEY_POLICY_REQUIRED" | "API_KEY_UNKNOWN" | "API_KEY_MARKET_DENY" | "PRICE_TICK_SIZE" | "MIN_QTY" | "POST_ONLY_LIMIT_ONLY" | "BATCH_TOO_LARGE" | "POLICY_MAX_OPEN_ORDERS" | "MODIFICATION_REQUIRES_REPLACE" | "CONFLICT_IDEMPOTENCY_KEY_REUSE" | "MARKET_PRICE_UNAVAILABLE" | "PAIR_NOT_LISTED_YET" | "PAIR_DELISTED" | "PAIR_CANCEL_ONLY" | "PAIR_POST_ONLY" | "PAIR_REDUCE_ONLY" | "RISK_LIMIT" | "MARKET_HALTED" | "ACCOUNT_UNKNOWN" | "POST_ONLY_CROSS" | "REDUCE_ONLY_BLOCKED" | "PRICE_BAND_VIOLATION" | "MARKET_CAP_VIOLATION" | "EMPTY_BOOK" | "FOK_INSUFFICIENT_LIQUIDITY" | "ORDER_ALREADY_TERMINAL" | "TRIGGER_PRICE_INVALID" | "TRIGGER_PRICE_SOURCE_UNSUPPORTED" | "TRAILING_DISTANCE_INVALID" | "TRIGGER_NOT_FOUND" | "TRIGGER_STATUS_INVALID" | "TRIGGER_NOT_MODIFIABLE" | "CONFLICT_DUPLICATE_CLIENT_TRIGGER_ID" | "MAX_SLIPPAGE_INVALID" | "VALIDATION_ERROR" | "OVERLOADED" | "MAX_QUOTE_DEBIT_TOO_SMALL" | "RATE_LIMIT_EXCEEDED" | "SUBACCOUNT_READ_FORBIDDEN" | "POLICY_SPOT_READ_DENY" | "API_KEY_SPOT_READ_DENY" | "CANCEL_REQUEST_EXPIRED" | "MAX_QTY" | "MAX_NOTIONAL" | "QTY_AT_OR_BELOW_FILLED" | "GATEWAY_MISCONFIGURED" | "INVALID_ORDER_ID" | "CHILD_QTY_RAISE_NOT_ALLOWED" | "ATTACHED_RISK_NOT_SUPPORTED" | "SETTLEMENT_BACKLOGGED" | "PRICE_LEVEL_QUANTITY_LIMIT" | "MARKET_QUOTE_STALE" | "MARKET_QUOTE_UNHEALTHY" | "INVALID_TIME_IN_FORCE" | "QUICKSWAP_NOT_PERMITTED" | "DUPLICATE_ORDER_ID" | "MAX_OPEN_ORDERS_TOTAL" | "STP_MODE_NOT_ALLOWED" | "PAIR_BACKLOGGED" | "PRICE_LEVELS_EXHAUSTED" | "CLIENT_ORDER_IDS_EXHAUSTED" | "ORDER_ID_CONFLICT" | "INVALID_SIDE" | "INVALID_ORDER_TYPE" | "INVALID_STP_MODE" | "INVALID_ORDER_FLAGS" | "BATCH_OTHER_ITEM_INVALID" | "REPLACE_ONTO_OWN_ID" | "INVALID_CLIENT_ORDER_ID" | "ORDER_SEQUENCE_EXHAUSTED" | "INVALID_HANDLING_MODE" | "FEE_SCHEDULE_UNAVAILABLE" | "POLICY_UNAVAILABLE" | "CANCEL_ALL_AFTER_TIMEOUT_INVALID" | "CANCEL_SCOPE_TOO_LARGE" | "RATE_LIMIT_POLICY_UNAVAILABLE" | "SYSTEM_RATE_LIMITED" | "ORDER_MODIFY_IN_PROGRESS" | "ORDER_PLACEMENT_PENDING" | "INVALID_MODIFY_BEHAVIOR" | "BATCH_REPLACE_ONLY_REQUIRED" | "BATCH_SINGLE_SYMBOL_REQUIRED" | "REQUEST_RECEIPTS_EXHAUSTED" | "INTENT_ID_INVALID" | "DRY_RUN_INVALID" | "CANCEL_ALL_AFTER_SCOPE_CONFLICT" | "NEW_ACCOUNT_CAPACITY_REACHED" | "TRIGGER_CHILD_PRICE_NOT_MODIFIABLE" | "TRIGGER_GENERATIONS_EXHAUSTED" | "TRIGGER_CONTROL_SHARE_EXHAUSTED" | "TRIGGER_CONTROLS_BUSY" | "TRIGGER_TYPE_NOT_SUPPORTED" | "INVALID_TRIGGER_TYPE" | "TRIGGER_DIRECTION_INVALID" | "TRIGGER_QTY_INVALID" | "TRIGGER_BUY_REQUIRES_LIMIT" | "ACCOUNT_ROUTING_INVALID" | "TRIGGER_LIMIT_EXCEEDED" | "TRIGGER_CONTROL_IN_PROGRESS" | "TRIGGER_PATCH_EMPTY" | "CLIENT_TRIGGER_ID_INVALID" | "TRIGGER_ACTIVATION_PRICE_INVALID" | "SLIPPAGE_TICKS_INVALID" | "SLIPPAGE_BPS_INVALID" | "TRIGGER_CONTROL_OUTCOME_UNKNOWN" | "TRIGGER_CAPACITY_REACHED" | "RESERVATION_CAPACITY_REACHED" | "CLIENT_ORDER_ID_CAPACITY_REACHED" | "ACCOUNT_RESERVATION_LIMIT_REACHED" | "INVALID_TRIGGER_CONTROL" | "TRIGGER_PATCH_NOT_ALLOWED" | "TRIGGER_PATCH_FIELD_UNKNOWN" | "TRIGGER_PATCH_VALUE_UNMASKED" | "TRIGGER_PATCH_PRICE_MODE_INVALID" | "ACCOUNT_ORDERS_SUSPENDED" | "TRAILING_SIDE_NOT_SUPPORTED" | "TRAILING_CHILD_NOT_MARKET" | "TWAP_DURATION_INVALID" | "LIMIT_CHILD_SLIPPAGE_SET" | "SLIPPAGE_BOUNDS_CONFLICT" | "TWAP_INTERVAL_INVALID" | "LADDER_LEVEL_REJECTED" | "LADDER_RANGE_TOO_NARROW" | "LADDER_LEVELS_INVALID" | "ORDER_LIMITS_UNAVAILABLE" | "ORDER_TYPE_NOT_ALLOWED_IN_AUCTION" | "POST_ONLY_NOT_ALLOWED_IN_AUCTION" | "QUICKSWAP_FEE_DETAILS_INCOMPLETE" | "QUICKSWAP_MARKET_NOT_PRICED" | "QUICKSWAP_BROKER_FEE_TERMS_MISMATCH" | "QUICKSWAP_FEE_RECIPIENT_IS_PAYER" | "QUICKSWAP_BROKER_FEE_TERMS_UNAVAILABLE" | "QUICKSWAP_BROKER_ACCOUNT_UNAVAILABLE" | "QUICKSWAP_ACCOUNT_OWNER_UNKNOWN" | "QUICKSWAP_DISABLED" | "QUICKSWAP_ATTACHED_RISK_NOT_ALLOWED" | "QUICKSWAP_ORDER_NOT_MODIFIABLE" | "QUICKSWAP_FEE_TOTAL_TOO_HIGH" | "QUICKSWAP_BROKER_FEE_TERMS_INVALID" | "QUICKSWAP_BROKER_INVALID" | "QUICKSWAP_FEE_SCHEDULE_INVALID" | "QUICKSWAP_MARKET_FEE_INVALID" | "QUICKSWAP_SETUP_INVALID" | "QUICKSWAP_CAPACITY_REACHED" | "ATTACHED_EXIT_WORKING" | "MARKET_TRIGGER_LIMIT_EXCEEDED" | "MARKET_TWAP_LIMIT_EXCEEDED" | "MARKET_LADDER_LIMIT_EXCEEDED" | "CHILD_QTY_EXCEEDS_REMAINING" | "ORDER_CANCEL_OUTCOME_UNKNOWN" | "ORDER_MODIFY_OUTCOME_UNKNOWN" | "ORDER_REPAIRING" | "ACCOUNT_REPAIRING" | "TRIGGER_WOULD_TRIGGER_IMMEDIATELY" | "ORDER_CREATE_OUTCOME_UNKNOWN" | "TRIGGER_CREATE_OUTCOME_UNKNOWN" | "TRIGGER_SYMBOL_MISMATCH" | "MAX_OPEN_ORDERS_PER_PAIR" | "SELF_TRADE_PREVENTED" | "ATTACHED_LEGS_EXCEEDED" | "FEE_ASSET_INVALID" | "FEE_CEILING_INVALID" | "UNSUPPORTED_FIELD_SET" | "TRIGGER_FIRE_LIMIT_REACHED" | "CONDITION_FLAGS_INVALID" | "CONDITION_PARAMETER_SET" | "TWAP_CAPACITY_REACHED" | "CHILD_ORDER_INCONSISTENT">]>;
|
|
7
7
|
readonly violations: v.ArraySchema<v.ObjectSchema<{
|
|
8
8
|
readonly fieldPath: v.StringSchema<undefined>;
|
|
9
9
|
readonly ruleId: v.StringSchema<undefined>;
|