ault-sdk-ts 0.1.0 → 0.4.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.
@@ -23,7 +23,7 @@ contract.
23
23
 
24
24
  All timestamps are in milliseconds unless noted otherwise.
25
25
 
26
- * OpenAPI spec version: 2.4.0
26
+ * OpenAPI spec version: 2.5.0
27
27
  */
28
28
  import * as zod from "zod";
29
29
  /**
@@ -332,6 +332,7 @@ export declare const listTradesResponseFeeCostRegExp: RegExp;
332
332
  export declare const listTradesResponseFeeRateRegExp: RegExp;
333
333
  export declare const listTradesResponseInfoAddressOneRegExp: RegExp;
334
334
  export declare const listTradesResponseInfoBlockHeightRegExp: RegExp;
335
+ export declare const listTradesResponseInfoEventIndexMin = 0;
335
336
  export declare const ListTradesResponseItem: zod.ZodObject<{
336
337
  id: zod.ZodString;
337
338
  order: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
@@ -361,6 +362,7 @@ export declare const ListTradesResponseItem: zod.ZodObject<{
361
362
  paid: zod.ZodString;
362
363
  received: zod.ZodString;
363
364
  block_height: zod.ZodString;
365
+ event_index: zod.ZodNumber;
364
366
  }, zod.z.core.$strip>;
365
367
  }, zod.z.core.$strip>;
366
368
  export declare const ListTradesResponse: zod.ZodArray<zod.ZodObject<{
@@ -392,8 +394,74 @@ export declare const ListTradesResponse: zod.ZodArray<zod.ZodObject<{
392
394
  paid: zod.ZodString;
393
395
  received: zod.ZodString;
394
396
  block_height: zod.ZodString;
397
+ event_index: zod.ZodNumber;
395
398
  }, zod.z.core.$strip>;
396
399
  }, zod.z.core.$strip>>;
400
+ /**
401
+ * Returns a single trade by its synthesized id. The `trades` table has no
402
+ surrogate key, so the id is the reversible composite the REST feeds
403
+ emit, `<block_height>-<hex(order_id)>-<open_quantity>`, taken verbatim
404
+ from a REST trade object's `id` (from `/trades/{symbol}` or `/mytrades`).
405
+ The endpoint parses it back to locate the fill and resolves either leg
406
+ of a match. Note this is not the WebSocket `tid`: the realtime feed emits
407
+ a hashed numeric trade id, which is not a valid input here — only a REST
408
+ `id` is. The id must be canonical (lowercase hex, no leading zeros or
409
+ sign, canonical decimal quantity); a non-canonical or malformed id
410
+ returns 400. The path is singular (`/trade/{id}`), distinct from the
411
+ plural public feed `/trades/{symbol}`. The response mirrors that public
412
+ feed exactly — `order` and `cloid` are null. An id that matches no fill
413
+ returns 404. A well-formed id whose fill exists but whose market is not
414
+ yet in the symbol map also returns 404: this can happen transiently
415
+ within the map's reload window just after a market is created, since
416
+ there is no symbol under which to render the trade.
417
+
418
+ * @summary Get a single trade by ID
419
+ */
420
+ export declare const getTradePathIdMax = 114;
421
+ export declare const getTradePathIdRegExp: RegExp;
422
+ export declare const GetTradeParams: zod.ZodObject<{
423
+ id: zod.ZodString;
424
+ }, zod.z.core.$strip>;
425
+ export declare const getTradeResponsePriceRegExp: RegExp;
426
+ export declare const getTradeResponseAmountRegExp: RegExp;
427
+ export declare const getTradeResponseCostRegExp: RegExp;
428
+ export declare const getTradeResponseFeeCostRegExp: RegExp;
429
+ export declare const getTradeResponseFeeRateRegExp: RegExp;
430
+ export declare const getTradeResponseInfoAddressOneRegExp: RegExp;
431
+ export declare const getTradeResponseInfoBlockHeightRegExp: RegExp;
432
+ export declare const getTradeResponseInfoEventIndexMin = 0;
433
+ export declare const GetTradeResponse: zod.ZodObject<{
434
+ id: zod.ZodString;
435
+ order: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
436
+ timestamp: zod.ZodNumber;
437
+ datetime: zod.z.ZodISODateTime;
438
+ symbol: zod.ZodString;
439
+ type: zod.ZodOptional<zod.ZodNullable<zod.ZodUnion<readonly [zod.ZodLiteral<"limit">, zod.ZodLiteral<"market">, zod.ZodLiteral<"unknown">, zod.ZodLiteral<null>]>>>;
440
+ cloid: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
441
+ side: zod.ZodEnum<{
442
+ buy: "buy";
443
+ sell: "sell";
444
+ }>;
445
+ takerOrMaker: zod.ZodOptional<zod.ZodEnum<{
446
+ taker: "taker";
447
+ maker: "maker";
448
+ }>>;
449
+ price: zod.ZodString;
450
+ amount: zod.ZodString;
451
+ cost: zod.ZodString;
452
+ fee: zod.ZodOptional<zod.ZodObject<{
453
+ cost: zod.ZodOptional<zod.ZodString>;
454
+ currency: zod.ZodOptional<zod.ZodString>;
455
+ rate: zod.ZodOptional<zod.ZodString>;
456
+ }, zod.z.core.$strip>>;
457
+ info: zod.ZodObject<{
458
+ address: zod.ZodString;
459
+ paid: zod.ZodString;
460
+ received: zod.ZodString;
461
+ block_height: zod.ZodString;
462
+ event_index: zod.ZodNumber;
463
+ }, zod.z.core.$strip>;
464
+ }, zod.z.core.$strip>;
397
465
  /**
398
466
  * Returns trading fee schedule for all markets, keyed by symbol.
399
467
  * @summary Get trading fees for all markets
@@ -726,6 +794,7 @@ export declare const listMyTradesResponseFeeCostRegExp: RegExp;
726
794
  export declare const listMyTradesResponseFeeRateRegExp: RegExp;
727
795
  export declare const listMyTradesResponseInfoAddressOneRegExp: RegExp;
728
796
  export declare const listMyTradesResponseInfoBlockHeightRegExp: RegExp;
797
+ export declare const listMyTradesResponseInfoEventIndexMin = 0;
729
798
  export declare const ListMyTradesResponseItem: zod.ZodObject<{
730
799
  id: zod.ZodString;
731
800
  order: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
@@ -755,6 +824,7 @@ export declare const ListMyTradesResponseItem: zod.ZodObject<{
755
824
  paid: zod.ZodString;
756
825
  received: zod.ZodString;
757
826
  block_height: zod.ZodString;
827
+ event_index: zod.ZodNumber;
758
828
  }, zod.z.core.$strip>;
759
829
  }, zod.z.core.$strip>;
760
830
  export declare const ListMyTradesResponse: zod.ZodArray<zod.ZodObject<{
@@ -786,6 +856,7 @@ export declare const ListMyTradesResponse: zod.ZodArray<zod.ZodObject<{
786
856
  paid: zod.ZodString;
787
857
  received: zod.ZodString;
788
858
  block_height: zod.ZodString;
859
+ event_index: zod.ZodNumber;
789
860
  }, zod.z.core.$strip>;
790
861
  }, zod.z.core.$strip>>;
791
862
  /**
@@ -21,6 +21,7 @@ export declare function createDexApi(context: RestContext): {
21
21
  getOHLCV: (symbol: string, params?: import("./dex.generated").GetOHLCVParams, options?: RequestInit) => Promise<import("./dex.generated").getOHLCVResponse>;
22
22
  listOrders: (params: import("./dex.generated").ListOrdersParams, options?: RequestInit) => Promise<import("./dex.generated").listOrdersResponse>;
23
23
  getOrder: (id: string, options?: RequestInit) => Promise<import("./dex.generated").getOrderResponse>;
24
+ getTrade: (id: string, options?: RequestInit) => Promise<import("./dex.generated").getTradeResponse>;
24
25
  listMyTrades: (params: import("./dex.generated").ListMyTradesParams, options?: RequestInit) => Promise<import("./dex.generated").listMyTradesResponse>;
25
26
  getBalance: (params: import("./dex.generated").GetBalanceParams, options?: RequestInit) => Promise<import("./dex.generated").getBalanceResponse>;
26
27
  getStats: (params?: import("./dex.generated").GetStatsParams, options?: RequestInit) => Promise<import("./dex.generated").getStatsResponse>;
@@ -106,6 +106,15 @@ export interface TradeInfo {
106
106
  * @pattern ^\d+$
107
107
  */
108
108
  block_height: string;
109
+ /**
110
+ * The trade's event position within its block. Together with
111
+ `block_height` it is the row's composite pagination cursor for the
112
+ trade feed. `created_at` cannot serve this role because every trade
113
+ in a block shares one timestamp.
114
+
115
+ * @minimum 0
116
+ */
117
+ event_index: number;
109
118
  }
110
119
  /**
111
120
  * Exchange-specific extension on `MarketResponse`. Mirrors the
@@ -1445,6 +1454,55 @@ export type listTradesResponseError = (listTradesResponse400 | listTradesRespons
1445
1454
  export type listTradesResponse = listTradesResponseSuccess | listTradesResponseError;
1446
1455
  export declare const getListTradesUrl: (symbol: string, params?: ListTradesParams) => string;
1447
1456
  export declare const listTrades: (symbol: string, params?: ListTradesParams, options?: RequestInit) => Promise<listTradesResponse>;
1457
+ /**
1458
+ * Returns a single trade by its synthesized id. The `trades` table has no
1459
+ surrogate key, so the id is the reversible composite the REST feeds
1460
+ emit, `<block_height>-<hex(order_id)>-<open_quantity>`, taken verbatim
1461
+ from a REST trade object's `id` (from `/trades/{symbol}` or `/mytrades`).
1462
+ The endpoint parses it back to locate the fill and resolves either leg
1463
+ of a match. Note this is not the WebSocket `tid`: the realtime feed emits
1464
+ a hashed numeric trade id, which is not a valid input here — only a REST
1465
+ `id` is. The id must be canonical (lowercase hex, no leading zeros or
1466
+ sign, canonical decimal quantity); a non-canonical or malformed id
1467
+ returns 400. The path is singular (`/trade/{id}`), distinct from the
1468
+ plural public feed `/trades/{symbol}`. The response mirrors that public
1469
+ feed exactly — `order` and `cloid` are null. An id that matches no fill
1470
+ returns 404. A well-formed id whose fill exists but whose market is not
1471
+ yet in the symbol map also returns 404: this can happen transiently
1472
+ within the map's reload window just after a market is created, since
1473
+ there is no symbol under which to render the trade.
1474
+
1475
+ * @summary Get a single trade by ID
1476
+ */
1477
+ export type getTradeResponse200 = {
1478
+ data: TradeResponse;
1479
+ status: 200;
1480
+ };
1481
+ export type getTradeResponse400 = {
1482
+ data: BadRequestResponse;
1483
+ status: 400;
1484
+ };
1485
+ export type getTradeResponse404 = {
1486
+ data: ErrorResponse;
1487
+ status: 404;
1488
+ };
1489
+ export type getTradeResponse429 = {
1490
+ data: RateLimitedResponse;
1491
+ status: 429;
1492
+ };
1493
+ export type getTradeResponse500 = {
1494
+ data: InternalErrorResponse;
1495
+ status: 500;
1496
+ };
1497
+ export type getTradeResponseSuccess = getTradeResponse200 & {
1498
+ headers: Headers;
1499
+ };
1500
+ export type getTradeResponseError = (getTradeResponse400 | getTradeResponse404 | getTradeResponse429 | getTradeResponse500) & {
1501
+ headers: Headers;
1502
+ };
1503
+ export type getTradeResponse = getTradeResponseSuccess | getTradeResponseError;
1504
+ export declare const getGetTradeUrl: (id: string) => string;
1505
+ export declare const getTrade: (id: string, options?: RequestInit) => Promise<getTradeResponse>;
1448
1506
  /**
1449
1507
  * Returns trading fee schedule for all markets, keyed by symbol.
1450
1508
  * @summary Get trading fees for all markets
@@ -175,10 +175,12 @@ export interface WsOpenOrders {
175
175
  }
176
176
  /**
177
177
  * A single fill, shared by `userFills` and the `userEvents` fills shape.
178
- * `crossed` is `true` for taker fills (all fills are taker-side today). `fee`
179
- * is estimated from the taker rate; `feeToken` is the quote currency. `oid` is
180
- * the JS-safe 50-bit numeric id; `oidHex` is the full hex chain order id,
181
- * matching the orders channels and the REST order/trade surfaces.
178
+ * `crossed` is `true` on taker legs and `false` on maker legs; `fee` is
179
+ * estimated from the taker or maker rate accordingly, in the quote currency
180
+ * (`feeToken`). Fills from nodes without the relay is_taker flag (pre-ault#592)
181
+ * arrive as `crossed: true` with a taker-rate fee. `oid` is the JS-safe 50-bit
182
+ * numeric id; `oidHex` is the full hex chain order id, matching the orders
183
+ * channels and the REST order/trade surfaces.
182
184
  */
183
185
  export interface WsFill {
184
186
  coin: string;
@@ -189,8 +191,8 @@ export interface WsFill {
189
191
  oid: number;
190
192
  oidHex: string;
191
193
  /**
192
- * Client order id (hex, 8 bytes). Present on snapshot fills when the order
193
- * carried one; live fills omit it until the relay event carries the cloid.
194
+ * Client order id (hex, 8 bytes). Present when the order carried one;
195
+ * absent when it didn't, or against pre-#957 nodes (no per-user relay fills).
194
196
  */
195
197
  cloid?: string;
196
198
  tid: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ault-sdk-ts",
3
- "version": "0.1.0",
3
+ "version": "0.4.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",