ault-sdk-ts 0.7.1 → 0.8.0

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.
@@ -25,7 +25,7 @@ All timestamps are in milliseconds unless noted otherwise.
25
25
 
26
26
  * OpenAPI spec version: 2.5.0
27
27
  */
28
- import * as zod from "zod";
28
+ import * as zod from 'zod';
29
29
  /**
30
30
  * Reports that the process is up. Performs no dependency checks — DB reachability is exposed separately via /db-ready.
31
31
 
@@ -574,6 +574,17 @@ deliberately never emits 404 here so SDK generators do not invent
574
574
  a not-found path. Malformed `address`, `symbol`, `market_id`, or
575
575
  `cloid` return 400.
576
576
 
577
+ TWAP orders appear as the parent (`info.twap` set) and as each slice
578
+ execution (`info.twap_id` set), both `type: twap`; `status`, `since`
579
+ (by `start_time`) and the cursor apply to parents too. A parent's
580
+ `amount`/`filled`/`remaining` derive from its escrow and its slices'
581
+ trades; a buy parent's `amount` tracks the executed base size and
582
+ `info.twap.total_deposit` carries the quote budget. Slices are
583
+ attributed to the parent whose (orderer, market, `start_time`..
584
+ `deadline` + 2 min) window contains them; when windows overlap the
585
+ newest parent wins (later `start_time`, then block height, tx index,
586
+ id), so no fill is counted twice.
587
+
577
588
  * @summary List orders for an address
578
589
  */
579
590
  export declare const listOrdersQueryAddressOneRegExp: RegExp;
@@ -605,6 +616,10 @@ export declare const listOrdersResponseFeeCostRegExp: RegExp;
605
616
  export declare const listOrdersResponseFeeRateRegExp: RegExp;
606
617
  export declare const listOrdersResponseInfoBlockHeightRegExp: RegExp;
607
618
  export declare const listOrdersResponseInfoRemainingDepositRegExp: RegExp;
619
+ export declare const listOrdersResponseInfoTwapIdRegExp: RegExp;
620
+ export declare const listOrdersResponseInfoTwapOneTotalDepositRegExp: RegExp;
621
+ export declare const listOrdersResponseInfoTwapOnePriceToleranceRegExp: RegExp;
622
+ export declare const listOrdersResponseInfoTwapOneWorstPriceRegExp: RegExp;
608
623
  export declare const ListOrdersResponseItem: zod.ZodObject<{
609
624
  id: zod.ZodString;
610
625
  clientOrderId: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
@@ -665,6 +680,20 @@ export declare const ListOrdersResponseItem: zod.ZodObject<{
665
680
  market: "market";
666
681
  }>;
667
682
  close_reason: zod.ZodNullable<zod.ZodString>;
683
+ twap_id: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
684
+ twap: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
685
+ total_deposit: zod.ZodString;
686
+ deposit_asset: zod.ZodEnum<{
687
+ base: "base";
688
+ quote: "quote";
689
+ }>;
690
+ start_time: zod.ZodNullable<zod.ZodNumber>;
691
+ deadline: zod.ZodNullable<zod.ZodNumber>;
692
+ num_slices: zod.ZodNumber;
693
+ slice_index: zod.ZodNumber;
694
+ price_tolerance: zod.ZodNullable<zod.ZodString>;
695
+ worst_price: zod.ZodNullable<zod.ZodString>;
696
+ }, zod.z.core.$strip>, zod.ZodNull]>>;
668
697
  }, zod.z.core.$strip>;
669
698
  }, zod.z.core.$strip>;
670
699
  export declare const ListOrdersResponse: zod.ZodArray<zod.ZodObject<{
@@ -727,6 +756,20 @@ export declare const ListOrdersResponse: zod.ZodArray<zod.ZodObject<{
727
756
  market: "market";
728
757
  }>;
729
758
  close_reason: zod.ZodNullable<zod.ZodString>;
759
+ twap_id: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
760
+ twap: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
761
+ total_deposit: zod.ZodString;
762
+ deposit_asset: zod.ZodEnum<{
763
+ base: "base";
764
+ quote: "quote";
765
+ }>;
766
+ start_time: zod.ZodNullable<zod.ZodNumber>;
767
+ deadline: zod.ZodNullable<zod.ZodNumber>;
768
+ num_slices: zod.ZodNumber;
769
+ slice_index: zod.ZodNumber;
770
+ price_tolerance: zod.ZodNullable<zod.ZodString>;
771
+ worst_price: zod.ZodNullable<zod.ZodString>;
772
+ }, zod.z.core.$strip>, zod.ZodNull]>>;
730
773
  }, zod.z.core.$strip>;
731
774
  }, zod.z.core.$strip>>;
732
775
  /**
@@ -745,6 +788,10 @@ export declare const getOrderResponseFeeCostRegExp: RegExp;
745
788
  export declare const getOrderResponseFeeRateRegExp: RegExp;
746
789
  export declare const getOrderResponseInfoBlockHeightRegExp: RegExp;
747
790
  export declare const getOrderResponseInfoRemainingDepositRegExp: RegExp;
791
+ export declare const getOrderResponseInfoTwapIdRegExp: RegExp;
792
+ export declare const getOrderResponseInfoTwapOneTotalDepositRegExp: RegExp;
793
+ export declare const getOrderResponseInfoTwapOnePriceToleranceRegExp: RegExp;
794
+ export declare const getOrderResponseInfoTwapOneWorstPriceRegExp: RegExp;
748
795
  export declare const GetOrderResponse: zod.ZodObject<{
749
796
  id: zod.ZodString;
750
797
  clientOrderId: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
@@ -805,6 +852,20 @@ export declare const GetOrderResponse: zod.ZodObject<{
805
852
  market: "market";
806
853
  }>;
807
854
  close_reason: zod.ZodNullable<zod.ZodString>;
855
+ twap_id: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
856
+ twap: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
857
+ total_deposit: zod.ZodString;
858
+ deposit_asset: zod.ZodEnum<{
859
+ base: "base";
860
+ quote: "quote";
861
+ }>;
862
+ start_time: zod.ZodNullable<zod.ZodNumber>;
863
+ deadline: zod.ZodNullable<zod.ZodNumber>;
864
+ num_slices: zod.ZodNumber;
865
+ slice_index: zod.ZodNumber;
866
+ price_tolerance: zod.ZodNullable<zod.ZodString>;
867
+ worst_price: zod.ZodNullable<zod.ZodString>;
868
+ }, zod.z.core.$strip>, zod.ZodNull]>>;
808
869
  }, zod.z.core.$strip>;
809
870
  }, zod.z.core.$strip>;
810
871
  /**
@@ -35,10 +35,11 @@ export declare const OrderInfoChainStatus: {
35
35
  };
36
36
  /**
37
37
  * Granular chain-level order type. Mirrors the dbindexer
38
- `orders.order_type` column (0=limit, 1=market, 2=twap). TWAP
39
- slice executions are stored as individual order rows and surface
40
- here as `twap`. `unknown` is the fallback for a chain code the
41
- API doesn't recognize.
38
+ `orders.order_type` column (0=limit, 1=market, 2=twap). Both a
39
+ TWAP parent and its slice executions surface as `twap`; tell
40
+ them apart by `twap` (set on the parent) and `twap_id` (set on
41
+ a slice). `unknown` is the fallback for a chain code the API
42
+ doesn't recognize.
42
43
 
43
44
  */
44
45
  export type OrderInfoChainType = (typeof OrderInfoChainType)[keyof typeof OrderInfoChainType];
@@ -48,6 +49,52 @@ export declare const OrderInfoChainType: {
48
49
  readonly twap: "twap";
49
50
  readonly unknown: "unknown";
50
51
  };
52
+ /**
53
+ * Base for a sell, quote for a buy.
54
+ */
55
+ export type OrderTwapInfoDepositAsset = (typeof OrderTwapInfoDepositAsset)[keyof typeof OrderTwapInfoDepositAsset];
56
+ export declare const OrderTwapInfoDepositAsset: {
57
+ readonly base: "base";
58
+ readonly quote: "quote";
59
+ };
60
+ /**
61
+ * Schedule of a TWAP parent. Amounts are human units; times are ms epoch.
62
+ */
63
+ export interface OrderTwapInfo {
64
+ /**
65
+ * Escrowed size in `deposit_asset` units (the `amount` of a sell, the quote budget of a buy).
66
+ * @pattern ^-?\d+(\.\d+)?$
67
+ */
68
+ total_deposit: string;
69
+ /** Base for a sell, quote for a buy. */
70
+ deposit_asset: OrderTwapInfoDepositAsset;
71
+ /**
72
+ * When the schedule started (ms).
73
+ * @nullable
74
+ */
75
+ start_time: number | null;
76
+ /**
77
+ * When the schedule ends (ms).
78
+ * @nullable
79
+ */
80
+ deadline: number | null;
81
+ /** Slices the schedule was cut into. */
82
+ num_slices: number;
83
+ /** Slices dispatched so far. */
84
+ slice_index: number;
85
+ /**
86
+ * Per-slice slippage bound as a ratio (`0.005` = 0.5%); null when `worst_price` is set or the chain default applied.
87
+ * @nullable
88
+ * @pattern ^-?\d+(\.\d+)?$
89
+ */
90
+ price_tolerance: string | null;
91
+ /**
92
+ * Absolute worst price per slice; null when a tolerance was used.
93
+ * @nullable
94
+ * @pattern ^-?\d+(\.\d+)?$
95
+ */
96
+ worst_price: string | null;
97
+ }
51
98
  /**
52
99
  * Exchange-specific extension on `OrderResponse`. Mirrors the
53
100
  `info` map populated in `internal/domain/order/service.go`.
@@ -65,7 +112,8 @@ export interface OrderInfo {
65
112
  tx_index: number;
66
113
  /**
67
114
  * Remaining quote-asset escrow (raw decimal string at the chain's
68
- atto-precision) that has not yet been spent on fills.
115
+ atto-precision) that has not yet been spent on fills. On a TWAP
116
+ parent: the unspent deposit (quote for a buy, base for a sell).
69
117
 
70
118
  * @pattern ^-?\d+(\.\d+)?$
71
119
  */
@@ -77,10 +125,11 @@ export interface OrderInfo {
77
125
  */
78
126
  chain_status: OrderInfoChainStatus;
79
127
  /** Granular chain-level order type. Mirrors the dbindexer
80
- `orders.order_type` column (0=limit, 1=market, 2=twap). TWAP
81
- slice executions are stored as individual order rows and surface
82
- here as `twap`. `unknown` is the fallback for a chain code the
83
- API doesn't recognize.
128
+ `orders.order_type` column (0=limit, 1=market, 2=twap). Both a
129
+ TWAP parent and its slice executions surface as `twap`; tell
130
+ them apart by `twap` (set on the parent) and `twap_id` (set on
131
+ a slice). `unknown` is the fallback for a chain code the API
132
+ doesn't recognize.
84
133
  */
85
134
  chain_type: OrderInfoChainType;
86
135
  /**
@@ -93,6 +142,16 @@ export interface OrderInfo {
93
142
  * @nullable
94
143
  */
95
144
  close_reason: string | null;
145
+ /**
146
+ * Hex id of the TWAP parent a slice execution was attributed to;
147
+ null on parents, non-TWAP rows and unattributed slices.
148
+
149
+ * @nullable
150
+ * @pattern ^[0-9a-f]+$
151
+ */
152
+ twap_id?: string | null;
153
+ /** The schedule of a TWAP parent; null on every other row. */
154
+ twap?: OrderTwapInfo | null;
96
155
  }
97
156
  /**
98
157
  * Exchange-specific extension on `TradeResponse`. Mirrors the
@@ -658,7 +717,7 @@ export declare const OrderResponseStatus: {
658
717
  readonly unknown: "unknown";
659
718
  };
660
719
  /**
661
- * `unknown` is the fallback for a chain type code the API doesn't recognize. A `twap` row (chain order_type=2) is a TWAP slice execution — the TWAP parent lives in `twap_orders` and is not returned by the order endpoints.
720
+ * `unknown` is the fallback for a chain type code the API doesn't recognize. A `twap` row (chain order_type=2) is either the TWAP parent the user placed (`info.twap` set) or one of its slice executions (`info.twap_id` set).
662
721
  */
663
722
  export type OrderResponseType = (typeof OrderResponseType)[keyof typeof OrderResponseType];
664
723
  export declare const OrderResponseType: {
@@ -732,7 +791,7 @@ export interface OrderResponse {
732
791
  /** `unknown` is the fallback for a chain status code the API doesn't recognize. */
733
792
  status: OrderResponseStatus;
734
793
  symbol: string;
735
- /** `unknown` is the fallback for a chain type code the API doesn't recognize. A `twap` row (chain order_type=2) is a TWAP slice execution — the TWAP parent lives in `twap_orders` and is not returned by the order endpoints. */
794
+ /** `unknown` is the fallback for a chain type code the API doesn't recognize. A `twap` row (chain order_type=2) is either the TWAP parent the user placed (`info.twap` set) or one of its slice executions (`info.twap_id` set). */
736
795
  type: OrderResponseType;
737
796
  /**
738
797
  * CCXT-collapsed time-in-force. `ioc` for an immediate-or-cancel
@@ -1807,6 +1866,17 @@ deliberately never emits 404 here so SDK generators do not invent
1807
1866
  a not-found path. Malformed `address`, `symbol`, `market_id`, or
1808
1867
  `cloid` return 400.
1809
1868
 
1869
+ TWAP orders appear as the parent (`info.twap` set) and as each slice
1870
+ execution (`info.twap_id` set), both `type: twap`; `status`, `since`
1871
+ (by `start_time`) and the cursor apply to parents too. A parent's
1872
+ `amount`/`filled`/`remaining` derive from its escrow and its slices'
1873
+ trades; a buy parent's `amount` tracks the executed base size and
1874
+ `info.twap.total_deposit` carries the quote budget. Slices are
1875
+ attributed to the parent whose (orderer, market, `start_time`..
1876
+ `deadline` + 2 min) window contains them; when windows overlap the
1877
+ newest parent wins (later `start_time`, then block height, tx index,
1878
+ id), so no fill is counted twice.
1879
+
1810
1880
  * @summary List orders for an address
1811
1881
  */
1812
1882
  export type listOrdersResponse200 = {
@@ -412,6 +412,13 @@ export interface DexWsOptions {
412
412
  * to inject a mock or polyfilled implementation.
413
413
  */
414
414
  createWebSocket?: WebSocketFactory;
415
+ /**
416
+ * `User-Agent` sent on the handshake (default: `ault-sdk-ts/<version>`).
417
+ * Only applied by the default factory, and only on runtimes whose
418
+ * `WebSocket` accepts `{ headers }` (Node, Bun); browsers send their own.
419
+ * The hosted DEX API sits behind a WAF that rejects handshakes without one.
420
+ */
421
+ userAgent?: string;
415
422
  }
416
423
  export interface DexWsEventMap {
417
424
  open: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ault-sdk-ts",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "TypeScript SDK for the Ault blockchain with high-level transaction methods and REST query clients",
5
5
  "keywords": [
6
6
  "ault",