ault-sdk-ts 0.6.0 → 0.7.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.
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export * from "./core/errors";
16
16
  export * from "./core/http";
17
17
  export * from "./core/network";
18
18
  export * from "./core/pagination";
19
+ export * from "./rest/pagination";
19
20
  export * from "./core/base64";
20
21
  export * from "./core/manifest-types";
21
22
  export { fetchManifest } from "./core/manifest-fetcher";
package/dist/index.js CHANGED
@@ -11402,9 +11402,10 @@ async function dexFetch(url, init) {
11402
11402
  // src/rest/dex.generated.ts
11403
11403
  var dex_generated_exports = {};
11404
11404
  __export(dex_generated_exports, {
11405
+ DBReadyResponseDatabase: () => DBReadyResponseDatabase,
11406
+ DBReadyResponseStatus: () => DBReadyResponseStatus,
11405
11407
  GetStatsWindow: () => GetStatsWindow,
11406
11408
  GetUDFHistoryResolution: () => GetUDFHistoryResolution,
11407
- HealthResponseDatabase: () => HealthResponseDatabase,
11408
11409
  HealthResponseStatus: () => HealthResponseStatus,
11409
11410
  ListOrdersStatus: () => ListOrdersStatus,
11410
11411
  LiveResponseStatus: () => LiveResponseStatus,
@@ -11413,6 +11414,7 @@ __export(dex_generated_exports, {
11413
11414
  OrderInfoChainType: () => OrderInfoChainType,
11414
11415
  OrderResponseSide: () => OrderResponseSide,
11415
11416
  OrderResponseStatus: () => OrderResponseStatus,
11417
+ OrderResponseTimeInForce: () => OrderResponseTimeInForce,
11416
11418
  OrderResponseType: () => OrderResponseType,
11417
11419
  RangeQueryDayParameter: () => RangeQueryDayParameter,
11418
11420
  RangeQueryParameter: () => RangeQueryParameter,
@@ -11427,8 +11429,10 @@ __export(dex_generated_exports, {
11427
11429
  UDFSymbolInfoDataStatus: () => UDFSymbolInfoDataStatus,
11428
11430
  getAllTickers: () => getAllTickers,
11429
11431
  getBalance: () => getBalance,
11432
+ getDBReady: () => getDBReady,
11430
11433
  getGetAllTickersUrl: () => getGetAllTickersUrl,
11431
11434
  getGetBalanceUrl: () => getGetBalanceUrl,
11435
+ getGetDBReadyUrl: () => getGetDBReadyUrl,
11432
11436
  getGetHealthUrl: () => getGetHealthUrl,
11433
11437
  getGetLiveUrl: () => getGetLiveUrl,
11434
11438
  getGetOHLCVUrl: () => getGetOHLCVUrl,
@@ -11498,16 +11502,18 @@ var OrderInfoChainType = {
11498
11502
  unknown: "unknown"
11499
11503
  };
11500
11504
  var HealthResponseStatus = {
11501
- healthy: "healthy",
11502
- unhealthy: "unhealthy"
11505
+ healthy: "healthy"
11503
11506
  };
11504
- var HealthResponseDatabase = {
11507
+ var ReadyResponseStatus = {
11508
+ ready: "ready"
11509
+ };
11510
+ var DBReadyResponseStatus = {
11505
11511
  ok: "ok",
11506
- unreachable: "unreachable"
11512
+ unavailable: "unavailable"
11507
11513
  };
11508
- var ReadyResponseStatus = {
11509
- ready: "ready",
11510
- not_ready: "not ready"
11514
+ var DBReadyResponseDatabase = {
11515
+ ok: "ok",
11516
+ unreachable: "unreachable"
11511
11517
  };
11512
11518
  var LiveResponseStatus = {
11513
11519
  alive: "alive"
@@ -11516,7 +11522,10 @@ var MarketResponseType = {
11516
11522
  spot: "spot"
11517
11523
  };
11518
11524
  var StatsResponseWindow = {
11519
- "24h": "24h"
11525
+ "24h": "24h",
11526
+ "7d": "7d",
11527
+ "30d": "30d",
11528
+ all: "all"
11520
11529
  };
11521
11530
  var TradeResponseType = {
11522
11531
  limit: "limit",
@@ -11544,6 +11553,9 @@ var OrderResponseType = {
11544
11553
  twap: "twap",
11545
11554
  unknown: "unknown"
11546
11555
  };
11556
+ var OrderResponseTimeInForce = {
11557
+ ioc: "ioc"
11558
+ };
11547
11559
  var OrderResponseSide = {
11548
11560
  buy: "buy",
11549
11561
  sell: "sell"
@@ -11580,7 +11592,10 @@ var RangeQueryDayParameter = {
11580
11592
  allTime: "allTime"
11581
11593
  };
11582
11594
  var GetStatsWindow = {
11583
- "24h": "24h"
11595
+ "24h": "24h",
11596
+ "7d": "7d",
11597
+ "30d": "30d",
11598
+ all: "all"
11584
11599
  };
11585
11600
  var ListOrdersStatus = {
11586
11601
  open: "open",
@@ -11624,6 +11639,15 @@ var getLive = async (options) => {
11624
11639
  method: "GET"
11625
11640
  });
11626
11641
  };
11642
+ var getGetDBReadyUrl = () => {
11643
+ return `/db-ready`;
11644
+ };
11645
+ var getDBReady = async (options) => {
11646
+ return dexFetch(getGetDBReadyUrl(), {
11647
+ ...options,
11648
+ method: "GET"
11649
+ });
11650
+ };
11627
11651
  var getGetStatusUrl = () => {
11628
11652
  return `/api/v1/status`;
11629
11653
  };
@@ -12008,7 +12032,9 @@ function createDexApi(context) {
12008
12032
  getUDFHistory: bind(context, getUDFHistory),
12009
12033
  getUDFQuotes: bind(context, getUDFQuotes),
12010
12034
  getUDFMarks: bind(context, getUDFMarks),
12011
- getUDFTimescaleMarks: bind(context, getUDFTimescaleMarks)
12035
+ getUDFTimescaleMarks: bind(context, getUDFTimescaleMarks),
12036
+ getOpenAPISpec: bind(context, getOpenAPISpec),
12037
+ getDBReady: bind(context, getDBReady)
12012
12038
  };
12013
12039
  }
12014
12040
 
@@ -25070,6 +25096,40 @@ function createParallelQueryApi(lowLevel) {
25070
25096
 
25071
25097
  // src/high-level/cloid-lookup.ts
25072
25098
  import { fromHex as fromHex2, toHex as toHex3 } from "@cosmjs/encoding";
25099
+
25100
+ // src/rest/pagination.ts
25101
+ var NEXT_CURSOR_HEADER = "X-Next-Cursor";
25102
+ async function* paginate(fetchPage, params = {}) {
25103
+ let cursor = params.cursor;
25104
+ const seen = new Set(cursor ? [cursor] : []);
25105
+ for (; ; ) {
25106
+ const res = await fetchPage(cursor ? { cursor } : {});
25107
+ if (res.status !== 200 || !Array.isArray(res.data)) {
25108
+ throw new ApiError(`paginated endpoint returned unexpected status ${res.status}`, res.status);
25109
+ }
25110
+ const next = res.headers.get(NEXT_CURSOR_HEADER);
25111
+ if (next && seen.has(next)) {
25112
+ throw new ApiError("pagination cursor repeated; aborting to prevent an infinite loop");
25113
+ }
25114
+ yield { rows: res.data, nextCursor: next };
25115
+ if (!next) return;
25116
+ seen.add(next);
25117
+ cursor = next;
25118
+ }
25119
+ }
25120
+ async function collectPages(fetchPage, max, params = {}) {
25121
+ if (!Number.isInteger(max) || max < 1) {
25122
+ throw new ApiError(`collectPages max must be a positive integer, got ${max}`);
25123
+ }
25124
+ const rows = [];
25125
+ for await (const page of paginate(fetchPage, params)) {
25126
+ rows.push(...page.rows);
25127
+ if (rows.length >= max) return rows.slice(0, max);
25128
+ }
25129
+ return rows;
25130
+ }
25131
+
25132
+ // src/high-level/cloid-lookup.ts
25073
25133
  function createCloidLookupApi(lowLevel) {
25074
25134
  async function findOrderByCloid(orderer, cloid) {
25075
25135
  const addr = normalizeAddress(orderer);
@@ -25083,20 +25143,30 @@ function createCloidLookupApi(lowLevel) {
25083
25143
  return { source: "chain-twap", order: chain.twap };
25084
25144
  }
25085
25145
  const wantHex = toHex3(bytes);
25086
- const LIMIT = 200;
25087
- const res = await lowLevel.rest.dex.listOrders({ address: addr, cloid: wantHex, limit: LIMIT });
25088
- if (res.status !== 200) {
25089
- throw new Error(`dex-api listOrders returned unexpected status ${res.status}`);
25090
- }
25091
- const orders = res.data.filter((o) => o.clientOrderId?.toLowerCase() === wantHex);
25092
- if (orders.length === 0) {
25093
- return { source: "none", order: null };
25146
+ const LIMIT = 500;
25147
+ const MAX_PAGES = 10;
25148
+ const orders = [];
25149
+ let exhausted = false;
25150
+ let pages = 0;
25151
+ for await (const page of paginate(
25152
+ (p) => lowLevel.rest.dex.listOrders({ address: addr, cloid: wantHex, limit: LIMIT, ...p })
25153
+ )) {
25154
+ orders.push(...page.rows.filter((o) => o.clientOrderId?.toLowerCase() === wantHex));
25155
+ pages += 1;
25156
+ if (!page.nextCursor) {
25157
+ exhausted = true;
25158
+ break;
25159
+ }
25160
+ if (pages >= MAX_PAGES) break;
25094
25161
  }
25095
- if (res.data.length >= LIMIT) {
25162
+ if (!exhausted) {
25096
25163
  throw new Error(
25097
- `cloid ${wantHex} has too many historical matches to disambiguate (>= ${LIMIT}); dex-api needs a canonical (orderer, cloid) latest lookup`
25164
+ `cloid ${wantHex} has too many historical matches to disambiguate (> ${MAX_PAGES * LIMIT} rows); dex-api needs a canonical (orderer, cloid) latest lookup`
25098
25165
  );
25099
25166
  }
25167
+ if (orders.length === 0) {
25168
+ return { source: "none", order: null };
25169
+ }
25100
25170
  const order = orders.reduce((latest, next) => {
25101
25171
  if (next.timestamp !== latest.timestamp) {
25102
25172
  return next.timestamp > latest.timestamp ? next : latest;
@@ -27466,15 +27536,18 @@ var PageResponseSchema = z3.object({
27466
27536
  // src/rest/dex-types.generated.ts
27467
27537
  import * as zod from "zod";
27468
27538
  var GetHealthResponse = zod.object({
27469
- status: zod.enum(["healthy", "unhealthy"]),
27470
- database: zod.enum(["ok", "unreachable"])
27539
+ status: zod.enum(["healthy"])
27471
27540
  });
27472
27541
  var GetReadyResponse = zod.object({
27473
- status: zod.enum(["ready", "not ready"])
27542
+ status: zod.enum(["ready"])
27474
27543
  });
27475
27544
  var GetLiveResponse = zod.object({
27476
27545
  status: zod.enum(["alive"])
27477
27546
  });
27547
+ var GetDBReadyResponse = zod.object({
27548
+ status: zod.enum(["ok", "unavailable"]),
27549
+ database: zod.enum(["ok", "unreachable"])
27550
+ });
27478
27551
  var GetStatusResponse = zod.object({
27479
27552
  last_indexed_height: zod.number(),
27480
27553
  last_indexed_at: zod.iso.datetime({})
@@ -27566,6 +27639,8 @@ var ListMarketsResponseItem = zod.object({
27566
27639
  )
27567
27640
  });
27568
27641
  var ListMarketsResponse = zod.array(ListMarketsResponseItem);
27642
+ var listCurrenciesResponseInfoContractDecimalsMin = 0;
27643
+ var listCurrenciesResponseInfoContractDecimalsMax = 255;
27569
27644
  var ListCurrenciesResponse = zod.record(
27570
27645
  zod.string(),
27571
27646
  zod.object({
@@ -27576,7 +27651,9 @@ var ListCurrenciesResponse = zod.record(
27576
27651
  deposit: zod.boolean().nullish(),
27577
27652
  withdraw: zod.boolean().nullish(),
27578
27653
  fee: zod.number().nullish(),
27579
- precision: zod.number(),
27654
+ precision: zod.number().describe(
27655
+ "The DEX trading precision \u2014 always 18: every amount on every\nendpoint (balances, orders, trades, portfolio) is normalized to\n18-decimal units regardless of the token contract's own\ndecimals. The raw contract decimals are available in\n`info.contractDecimals`.\n"
27656
+ ),
27580
27657
  limits: zod.object({
27581
27658
  amount: zod.object({
27582
27659
  min: zod.number().nullish(),
@@ -27588,7 +27665,11 @@ var ListCurrenciesResponse = zod.record(
27588
27665
  }).optional()
27589
27666
  }),
27590
27667
  networks: zod.looseObject({}).optional(),
27591
- info: zod.looseObject({})
27668
+ info: zod.object({
27669
+ contractDecimals: zod.number().min(listCurrenciesResponseInfoContractDecimalsMin).max(listCurrenciesResponseInfoContractDecimalsMax).describe(
27670
+ "The token contract's own decimals (raw ERC20 decimals). Amounts\non the API are NOT in these units \u2014 see `precision`.\n"
27671
+ )
27672
+ })
27592
27673
  })
27593
27674
  );
27594
27675
  var GetTickerParams = zod.object({
@@ -27682,11 +27763,20 @@ var GetOrderbookResponse = zod.object({
27682
27763
  var ListTradesParams = zod.object({
27683
27764
  symbol: zod.string().describe("URL-encoded trading pair (e.g., `AULT%2FUSDT`)")
27684
27765
  });
27685
- var listTradesQueryLimitDefault = 50;
27766
+ var listTradesQueryLimitDefault = 100;
27686
27767
  var listTradesQueryLimitMax = 500;
27768
+ var listTradesQueryBeforeIndexMin = 0;
27769
+ var listTradesQueryBeforeIndexMax = 4294967295;
27687
27770
  var ListTradesQueryParams = zod.object({
27688
27771
  limit: zod.number().min(1).max(listTradesQueryLimitMax).default(listTradesQueryLimitDefault),
27689
- since: zod.number().optional().describe("Unix timestamp in milliseconds")
27772
+ since: zod.number().optional().describe("Unix timestamp in milliseconds"),
27773
+ cursor: zod.string().optional().describe(
27774
+ 'Opaque pagination cursor. Take it verbatim from the previous page\'s\n`X-Next-Cursor` header (or follow the `Link: rel="next"` URL) and\nrepeat every other query parameter; the cursor is bound to that\nfilter set and a different one is rejected with 400. `limit` may\nchange between pages. No `X-Next-Cursor` on a response means the\nfeed is exhausted. Clients must not build or parse cursors.\n'
27775
+ ),
27776
+ before_height: zod.number().min(1).optional().describe(
27777
+ "Deprecated in favour of `cursor`; still honoured, and ignored when\n`cursor` is also present.\n\nComposite pagination cursor, upper half. Returns only trades\nstrictly older (in feed order) than the row identified by\n(`before_height`, `before_index`) \u2014 take both values from the\nlast row's `info.block_height` / `info.event_index`. Must be\npassed together with `before_index`. Unlike `since`, the cursor\ncannot skip or repeat trades when many share one timestamp.\n"
27778
+ ),
27779
+ before_index: zod.number().min(listTradesQueryBeforeIndexMin).max(listTradesQueryBeforeIndexMax).optional().describe("Composite pagination cursor, lower half. See `before_height`.")
27690
27780
  });
27691
27781
  var listTradesResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27692
27782
  var listTradesResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -27696,6 +27786,7 @@ var listTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27696
27786
  var listTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
27697
27787
  var listTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
27698
27788
  var listTradesResponseInfoEventIndexMin = 0;
27789
+ var listTradesResponseInfoEventIndexMax = 4294967295;
27699
27790
  var ListTradesResponseItem = zod.object({
27700
27791
  id: zod.string(),
27701
27792
  order: zod.string().nullish(),
@@ -27705,10 +27796,11 @@ var ListTradesResponseItem = zod.object({
27705
27796
  type: zod.union([
27706
27797
  zod.literal("limit"),
27707
27798
  zod.literal("market"),
27799
+ zod.literal("twap"),
27708
27800
  zod.literal("unknown"),
27709
27801
  zod.literal(null)
27710
27802
  ]).nullish().describe(
27711
- "Order type resolved via JOIN to orders table. Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
27803
+ "Order type resolved via JOIN to orders table. `twap` marks a TWAP slice execution (chain code 2). Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
27712
27804
  ),
27713
27805
  cloid: zod.string().nullish().describe(
27714
27806
  "Client order id (hex, 8 bytes) resolved via JOIN to orders table. Null when the order carried none, the row predates cloid indexing, or on the public trades feed (cloids are private to the orderer)."
@@ -27742,8 +27834,8 @@ var ListTradesResponseItem = zod.object({
27742
27834
  "Atto-precision amount the orderer received for this fill,\nsuffixed with the chain denom. Empty string when the chain did\nnot record this side.\n"
27743
27835
  ),
27744
27836
  block_height: zod.string().regex(listTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
27745
- event_index: zod.number().min(listTradesResponseInfoEventIndexMin).describe(
27746
- "The trade's event position within its block. Together with\n`block_height` it is the row's composite pagination cursor for the\ntrade feed. `created_at` cannot serve this role because every trade\nin a block shares one timestamp.\n"
27837
+ event_index: zod.number().min(listTradesResponseInfoEventIndexMin).max(listTradesResponseInfoEventIndexMax).describe(
27838
+ "The trade's event position within its block. With `block_height`\nit forms the row's composite pagination cursor: pass the last\nrow's pair as `before_height`/`before_index` to fetch the next\n(older) page.\n"
27747
27839
  )
27748
27840
  }).describe(
27749
27841
  "Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
@@ -27769,6 +27861,7 @@ var getTradeResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27769
27861
  var getTradeResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
27770
27862
  var getTradeResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
27771
27863
  var getTradeResponseInfoEventIndexMin = 0;
27864
+ var getTradeResponseInfoEventIndexMax = 4294967295;
27772
27865
  var GetTradeResponse = zod.object({
27773
27866
  id: zod.string(),
27774
27867
  order: zod.string().nullish(),
@@ -27778,10 +27871,11 @@ var GetTradeResponse = zod.object({
27778
27871
  type: zod.union([
27779
27872
  zod.literal("limit"),
27780
27873
  zod.literal("market"),
27874
+ zod.literal("twap"),
27781
27875
  zod.literal("unknown"),
27782
27876
  zod.literal(null)
27783
27877
  ]).nullish().describe(
27784
- "Order type resolved via JOIN to orders table. Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
27878
+ "Order type resolved via JOIN to orders table. `twap` marks a TWAP slice execution (chain code 2). Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
27785
27879
  ),
27786
27880
  cloid: zod.string().nullish().describe(
27787
27881
  "Client order id (hex, 8 bytes) resolved via JOIN to orders table. Null when the order carried none, the row predates cloid indexing, or on the public trades feed (cloids are private to the orderer)."
@@ -27815,8 +27909,8 @@ var GetTradeResponse = zod.object({
27815
27909
  "Atto-precision amount the orderer received for this fill,\nsuffixed with the chain denom. Empty string when the chain did\nnot record this side.\n"
27816
27910
  ),
27817
27911
  block_height: zod.string().regex(getTradeResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
27818
- event_index: zod.number().min(getTradeResponseInfoEventIndexMin).describe(
27819
- "The trade's event position within its block. Together with\n`block_height` it is the row's composite pagination cursor for the\ntrade feed. `created_at` cannot serve this role because every trade\nin a block shares one timestamp.\n"
27912
+ event_index: zod.number().min(getTradeResponseInfoEventIndexMin).max(getTradeResponseInfoEventIndexMax).describe(
27913
+ "The trade's event position within its block. With `block_height`\nit forms the row's composite pagination cursor: pass the last\nrow's pair as `before_height`/`before_index` to fetch the next\n(older) page.\n"
27820
27914
  )
27821
27915
  }).describe(
27822
27916
  "Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
@@ -27838,7 +27932,7 @@ var GetTradingFeesResponse = zod.record(
27838
27932
  })
27839
27933
  );
27840
27934
  var GetStatsQueryParams = zod.object({
27841
- window: zod.enum(["24h"]).optional().describe("Rolling window. Only `24h` is supported; defaults to `24h`.")
27935
+ window: zod.enum(["24h", "7d", "30d", "all"]).optional().describe("Precomputed reporting window. Defaults to `24h`.")
27842
27936
  });
27843
27937
  var getStatsResponseTotalsQuoteVolumeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27844
27938
  var getStatsResponseTotalsEstimatedFeeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -27850,7 +27944,7 @@ var getStatsResponseMarketsItemBaseVolumeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$
27850
27944
  var getStatsResponseMarketsItemEstimatedFeeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27851
27945
  var getStatsResponseMarketsItemTakerFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27852
27946
  var GetStatsResponse = zod.object({
27853
- window: zod.enum(["24h"]),
27947
+ window: zod.enum(["24h", "7d", "30d", "all"]),
27854
27948
  totals: zod.object({
27855
27949
  quoteVolume: zod.string().regex(getStatsResponseTotalsQuoteVolumeRegExp).nullable().describe(
27856
27950
  "Total quote volume over the window as a canonical decimal string.\nNull when contributing markets span more than one quote (then\n`estimatedFee` and `quoteAsset` are null too).\n"
@@ -27865,12 +27959,12 @@ var GetStatsResponse = zod.object({
27865
27959
  traderCount: zod.number().describe("Distinct trading addresses in the window."),
27866
27960
  activeMarkets: zod.number().describe("Number of markets with at least one fill in the window."),
27867
27961
  dailyActiveUsers: zod.number().nullable().describe(
27868
- "Distinct trading addresses in the window. Currently an alias of\n`traderCount`; separate so a precise DAU source can diverge later.\n"
27962
+ "Distinct trading addresses over 24 hours. An alias of\n`traderCount` for the `24h` response and null for longer windows;\nseparate so a precise DAU source can diverge later.\n"
27869
27963
  ),
27870
27964
  averageSlippageBps: zod.string().regex(getStatsResponseTotalsAverageSlippageBpsRegExp).nullable().describe(
27871
27965
  "Volume-weighted taker slippage (fill vs book-mid) in bps as a\ndecimal string. Null with no benchmarkable taker fill or when\nfills span more than one quote.\n"
27872
27966
  ),
27873
- depositUsdcVolume24h: zod.string().regex(getStatsResponseTotalsDepositUsdcVolume24hRegExp).nullable().describe("Reserved. Currently always null."),
27967
+ depositUsdcVolume24h: zod.string().regex(getStatsResponseTotalsDepositUsdcVolume24hRegExp).nullable().describe("24h USDC deposit volume when available; null for longer windows."),
27874
27968
  builderCodesFee24h: zod.string().regex(getStatsResponseTotalsBuilderCodesFee24hRegExp).nullable().describe("Reserved. Currently always null.")
27875
27969
  }).describe("Protocol-wide aggregates for the window."),
27876
27970
  markets: zod.array(
@@ -27892,8 +27986,8 @@ var listOrdersQueryAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
27892
27986
  var listOrdersQueryAddressTwoRegExp = new RegExp("^0x[a-f0-9]{40}$");
27893
27987
  var listOrdersQueryMarketIdRegExp = new RegExp("^[0-9a-fA-F]+$");
27894
27988
  var listOrdersQueryCloidRegExp = new RegExp("^([0-9a-fA-F]{16})?$");
27895
- var listOrdersQueryLimitDefault = 50;
27896
- var listOrdersQueryLimitMax = 200;
27989
+ var listOrdersQueryLimitDefault = 100;
27990
+ var listOrdersQueryLimitMax = 500;
27897
27991
  var ListOrdersQueryParams = zod.object({
27898
27992
  address: zod.union([
27899
27993
  zod.string().regex(listOrdersQueryAddressOneRegExp).describe(
@@ -27912,7 +28006,10 @@ var ListOrdersQueryParams = zod.object({
27912
28006
  "Client order id (cloid) to filter by, as a hex string. A\nnon-empty value must decode to exactly 8 bytes (16 hex chars);\nanything else returns 400. An absent or empty (`cloid=`) value\napplies no cloid filter, matching how `market_id` behaves.\nCombined with `address`, a set cloid returns the orders carrying\nit. cloid uniqueness is only enforced for currently-resting\norders, so closed orders that reused the cloid may also match and\nmore than one order can be returned.\n"
27913
28007
  ),
27914
28008
  since: zod.number().optional().describe("Return orders created after this Unix timestamp (milliseconds)"),
27915
- limit: zod.number().min(1).max(listOrdersQueryLimitMax).default(listOrdersQueryLimitDefault)
28009
+ limit: zod.number().min(1).max(listOrdersQueryLimitMax).default(listOrdersQueryLimitDefault),
28010
+ cursor: zod.string().optional().describe(
28011
+ 'Opaque pagination cursor. Take it verbatim from the previous page\'s\n`X-Next-Cursor` header (or follow the `Link: rel="next"` URL) and\nrepeat every other query parameter; the cursor is bound to that\nfilter set and a different one is rejected with 400. `limit` may\nchange between pages. No `X-Next-Cursor` on a response means the\nfeed is exhausted. Clients must not build or parse cursors.\n'
28012
+ )
27916
28013
  });
27917
28014
  var listOrdersResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27918
28015
  var listOrdersResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -27933,8 +28030,12 @@ var ListOrdersResponseItem = zod.object({
27933
28030
  lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
27934
28031
  status: zod.enum(["open", "closed", "canceled", "unknown"]).describe("`unknown` is the fallback for a chain status code the API doesn't recognize."),
27935
28032
  symbol: zod.string(),
27936
- type: zod.enum(["limit", "market", "twap", "unknown"]).describe("`unknown` is the fallback for a chain type code the API doesn't recognize."),
27937
- timeInForce: zod.string().nullish(),
28033
+ type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
28034
+ "`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 \u2014 the TWAP parent lives in `twap_orders` and is not returned by the order endpoints."
28035
+ ),
28036
+ timeInForce: zod.union([zod.literal("ioc"), zod.literal(null)]).nullable().describe(
28037
+ "CCXT-collapsed time-in-force. `ioc` for an immediate-or-cancel\norder (chain TIF code 1); null for the default (GTT/GTC) or an\nunrecognized code. Always present (never omitted). The WS\n`orderUpdates` payload exposes the same `ioc`-or-absent value.\n"
28038
+ ),
27938
28039
  side: zod.enum(["buy", "sell"]),
27939
28040
  price: zod.string().regex(listOrdersResponsePriceRegExp),
27940
28041
  average: zod.string().nullish().describe("Average execution price as decimal string. Null when filled is 0."),
@@ -27976,10 +28077,10 @@ var ListOrdersResponseItem = zod.object({
27976
28077
  "Granular chain-level status \u2014 the WS view exposes the same\nstring. The CCXT view at `OrderResponse.status` collapses these\ninto open | closed | canceled. `unknown` is the fallback for a\nchain code the API doesn't recognize.\n"
27977
28078
  ),
27978
28079
  chain_type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
27979
- "Granular chain-level order type. The CCXT view at\n`OrderResponse.type` collapses these into limit | market.\n`unknown` is the fallback for a chain code the API doesn't\nrecognize.\n"
28080
+ "Granular chain-level order type. Mirrors the dbindexer\n`orders.order_type` column (0=limit, 1=market, 2=twap). TWAP\nslice executions are stored as individual order rows and surface\nhere as `twap`. `unknown` is the fallback for a chain code the\nAPI doesn't recognize.\n"
27980
28081
  ),
27981
- close_reason: zod.string().nullish().describe(
27982
- "Free-form chain close reason for a terminal order \u2014 e.g.\n`completed`, `canceled`, `expired`, `ioc_canceled`, `self_trade`,\n`post_only_rejected`, `replaced`. Null while the order is still live.\n"
28082
+ close_reason: zod.string().nullable().describe(
28083
+ "Free-form chain close reason for a terminal order \u2014 e.g.\n`completed`, `canceled`, `expired`, `ioc_canceled`,\n`self_trade`, `post_only_rejected`, `replaced`. Null while the\norder is still live. Lets consumers tell an IOC-cancelled or\nself-trade-prevented close apart from the generic `canceled` close.\n"
27983
28084
  )
27984
28085
  }).describe(
27985
28086
  "Exchange-specific extension on `OrderResponse`. Mirrors the\n`info` map populated in `internal/domain/order/service.go`.\n"
@@ -28010,8 +28111,12 @@ var GetOrderResponse = zod.object({
28010
28111
  lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
28011
28112
  status: zod.enum(["open", "closed", "canceled", "unknown"]).describe("`unknown` is the fallback for a chain status code the API doesn't recognize."),
28012
28113
  symbol: zod.string(),
28013
- type: zod.enum(["limit", "market", "twap", "unknown"]).describe("`unknown` is the fallback for a chain type code the API doesn't recognize."),
28014
- timeInForce: zod.string().nullish(),
28114
+ type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
28115
+ "`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 \u2014 the TWAP parent lives in `twap_orders` and is not returned by the order endpoints."
28116
+ ),
28117
+ timeInForce: zod.union([zod.literal("ioc"), zod.literal(null)]).nullable().describe(
28118
+ "CCXT-collapsed time-in-force. `ioc` for an immediate-or-cancel\norder (chain TIF code 1); null for the default (GTT/GTC) or an\nunrecognized code. Always present (never omitted). The WS\n`orderUpdates` payload exposes the same `ioc`-or-absent value.\n"
28119
+ ),
28015
28120
  side: zod.enum(["buy", "sell"]),
28016
28121
  price: zod.string().regex(getOrderResponsePriceRegExp),
28017
28122
  average: zod.string().nullish().describe("Average execution price as decimal string. Null when filled is 0."),
@@ -28053,10 +28158,10 @@ var GetOrderResponse = zod.object({
28053
28158
  "Granular chain-level status \u2014 the WS view exposes the same\nstring. The CCXT view at `OrderResponse.status` collapses these\ninto open | closed | canceled. `unknown` is the fallback for a\nchain code the API doesn't recognize.\n"
28054
28159
  ),
28055
28160
  chain_type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
28056
- "Granular chain-level order type. The CCXT view at\n`OrderResponse.type` collapses these into limit | market.\n`unknown` is the fallback for a chain code the API doesn't\nrecognize.\n"
28161
+ "Granular chain-level order type. Mirrors the dbindexer\n`orders.order_type` column (0=limit, 1=market, 2=twap). TWAP\nslice executions are stored as individual order rows and surface\nhere as `twap`. `unknown` is the fallback for a chain code the\nAPI doesn't recognize.\n"
28057
28162
  ),
28058
- close_reason: zod.string().nullish().describe(
28059
- "Free-form chain close reason for a terminal order \u2014 e.g.\n`completed`, `canceled`, `expired`, `ioc_canceled`, `self_trade`,\n`post_only_rejected`, `replaced`. Null while the order is still live.\n"
28163
+ close_reason: zod.string().nullable().describe(
28164
+ "Free-form chain close reason for a terminal order \u2014 e.g.\n`completed`, `canceled`, `expired`, `ioc_canceled`,\n`self_trade`, `post_only_rejected`, `replaced`. Null while the\norder is still live. Lets consumers tell an IOC-cancelled or\nself-trade-prevented close apart from the generic `canceled` close.\n"
28060
28165
  )
28061
28166
  }).describe(
28062
28167
  "Exchange-specific extension on `OrderResponse`. Mirrors the\n`info` map populated in `internal/domain/order/service.go`.\n"
@@ -28064,13 +28169,22 @@ var GetOrderResponse = zod.object({
28064
28169
  }).describe(
28065
28170
  "All numeric fields (price, amount, filled, remaining, cost,\nfee.cost, fee.rate, average, triggerPrice, stopPrice) are canonical\ndecimal strings.\n"
28066
28171
  );
28067
- var listMyTradesQueryLimitDefault = 50;
28172
+ var listMyTradesQueryLimitDefault = 100;
28068
28173
  var listMyTradesQueryLimitMax = 500;
28174
+ var listMyTradesQueryBeforeIndexMin = 0;
28175
+ var listMyTradesQueryBeforeIndexMax = 4294967295;
28069
28176
  var ListMyTradesQueryParams = zod.object({
28070
28177
  address: zod.string().describe("Blockchain address of the trader"),
28071
28178
  symbol: zod.string().optional().describe("Symbol to filter by (e.g., AULT/USDT)"),
28072
28179
  since: zod.number().optional().describe("Unix timestamp in milliseconds"),
28073
- limit: zod.number().min(1).max(listMyTradesQueryLimitMax).default(listMyTradesQueryLimitDefault)
28180
+ limit: zod.number().min(1).max(listMyTradesQueryLimitMax).default(listMyTradesQueryLimitDefault),
28181
+ cursor: zod.string().optional().describe(
28182
+ 'Opaque pagination cursor. Take it verbatim from the previous page\'s\n`X-Next-Cursor` header (or follow the `Link: rel="next"` URL) and\nrepeat every other query parameter; the cursor is bound to that\nfilter set and a different one is rejected with 400. `limit` may\nchange between pages. No `X-Next-Cursor` on a response means the\nfeed is exhausted. Clients must not build or parse cursors.\n'
28183
+ ),
28184
+ before_height: zod.number().min(1).optional().describe(
28185
+ "Deprecated in favour of `cursor`; still honoured, and ignored when\n`cursor` is also present.\n\nComposite pagination cursor, upper half. Returns only trades\nstrictly older (in feed order) than the row identified by\n(`before_height`, `before_index`) \u2014 take both values from the\nlast row's `info.block_height` / `info.event_index`. Must be\npassed together with `before_index`. Unlike `since`, the cursor\ncannot skip or repeat trades when many share one timestamp.\n"
28186
+ ),
28187
+ before_index: zod.number().min(listMyTradesQueryBeforeIndexMin).max(listMyTradesQueryBeforeIndexMax).optional().describe("Composite pagination cursor, lower half. See `before_height`.")
28074
28188
  });
28075
28189
  var listMyTradesResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
28076
28190
  var listMyTradesResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -28080,6 +28194,7 @@ var listMyTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
28080
28194
  var listMyTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
28081
28195
  var listMyTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
28082
28196
  var listMyTradesResponseInfoEventIndexMin = 0;
28197
+ var listMyTradesResponseInfoEventIndexMax = 4294967295;
28083
28198
  var ListMyTradesResponseItem = zod.object({
28084
28199
  id: zod.string(),
28085
28200
  order: zod.string().nullish(),
@@ -28089,10 +28204,11 @@ var ListMyTradesResponseItem = zod.object({
28089
28204
  type: zod.union([
28090
28205
  zod.literal("limit"),
28091
28206
  zod.literal("market"),
28207
+ zod.literal("twap"),
28092
28208
  zod.literal("unknown"),
28093
28209
  zod.literal(null)
28094
28210
  ]).nullish().describe(
28095
- "Order type resolved via JOIN to orders table. Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
28211
+ "Order type resolved via JOIN to orders table. `twap` marks a TWAP slice execution (chain code 2). Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
28096
28212
  ),
28097
28213
  cloid: zod.string().nullish().describe(
28098
28214
  "Client order id (hex, 8 bytes) resolved via JOIN to orders table. Null when the order carried none, the row predates cloid indexing, or on the public trades feed (cloids are private to the orderer)."
@@ -28126,8 +28242,8 @@ var ListMyTradesResponseItem = zod.object({
28126
28242
  "Atto-precision amount the orderer received for this fill,\nsuffixed with the chain denom. Empty string when the chain did\nnot record this side.\n"
28127
28243
  ),
28128
28244
  block_height: zod.string().regex(listMyTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
28129
- event_index: zod.number().min(listMyTradesResponseInfoEventIndexMin).describe(
28130
- "The trade's event position within its block. Together with\n`block_height` it is the row's composite pagination cursor for the\ntrade feed. `created_at` cannot serve this role because every trade\nin a block shares one timestamp.\n"
28245
+ event_index: zod.number().min(listMyTradesResponseInfoEventIndexMin).max(listMyTradesResponseInfoEventIndexMax).describe(
28246
+ "The trade's event position within its block. With `block_height`\nit forms the row's composite pagination cursor: pass the last\nrow's pair as `before_height`/`before_index` to fetch the next\n(older) page.\n"
28131
28247
  )
28132
28248
  }).describe(
28133
28249
  "Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
@@ -28156,12 +28272,17 @@ var GetOHLCVParams = zod.object({
28156
28272
  symbol: zod.string().describe("URL-encoded trading pair (e.g., `AULT%2FUSDT`)")
28157
28273
  });
28158
28274
  var getOHLCVQueryTimeframeDefault = `1m`;
28159
- var getOHLCVQueryLimitDefault = 100;
28275
+ var getOHLCVQueryLimitDefault = 500;
28160
28276
  var getOHLCVQueryLimitMax = 1e3;
28161
28277
  var GetOHLCVQueryParams = zod.object({
28162
28278
  timeframe: zod.string().default(getOHLCVQueryTimeframeDefault).describe("Timeframe: 1m, 5m, 15m, 30m, 1h, 4h, 1d. Also accepts TV format: 1, 5, 15, 60, 1D"),
28163
- limit: zod.number().min(1).max(getOHLCVQueryLimitMax).default(getOHLCVQueryLimitDefault),
28164
- since: zod.number().optional().describe("Unix timestamp in milliseconds")
28279
+ limit: zod.number().min(1).max(getOHLCVQueryLimitMax).default(getOHLCVQueryLimitDefault).describe(
28280
+ "Bars per page, oldest first within the page. Without `since` the\npage holds the newest `limit` bars and the cursor walks back in\ntime; with `since` it holds the first `limit` bars from `since`\nand the cursor walks forward.\n"
28281
+ ),
28282
+ since: zod.number().optional().describe("Unix timestamp in milliseconds"),
28283
+ cursor: zod.string().optional().describe(
28284
+ 'Opaque pagination cursor. Take it verbatim from the previous page\'s\n`X-Next-Cursor` header (or follow the `Link: rel="next"` URL) and\nrepeat every other query parameter; the cursor is bound to that\nfilter set and a different one is rejected with 400. `limit` may\nchange between pages. No `X-Next-Cursor` on a response means the\nfeed is exhausted. Clients must not build or parse cursors.\n'
28285
+ )
28165
28286
  });
28166
28287
  var GetOHLCVResponseItem = zod.tuple([
28167
28288
  zod.number().describe("timestamp in milliseconds"),
@@ -28239,7 +28360,7 @@ var GetUDFHistoryQueryParams = zod.object({
28239
28360
  resolution: zod.enum(["1", "5", "15", "30", "60", "1D", "1W", "1M"]),
28240
28361
  from: zod.number().describe("Unix seconds"),
28241
28362
  to: zod.number().describe("Unix seconds"),
28242
- countback: zod.number().min(1).max(getUDFHistoryQueryCountbackMax).optional()
28363
+ countback: zod.number().min(1).max(getUDFHistoryQueryCountbackMax).optional().describe("Values above 1000 are clamped to 1000 server-side.")
28243
28364
  });
28244
28365
  var GetUDFHistoryResponse = zod.object({
28245
28366
  s: zod.enum(["ok", "no_data", "error"]),
@@ -28253,7 +28374,7 @@ var GetUDFHistoryResponse = zod.object({
28253
28374
  nextTime: zod.number().optional().describe('Unix seconds of next available bar (when s = "no_data")')
28254
28375
  });
28255
28376
  var GetUDFQuotesQueryParams = zod.object({
28256
- symbols: zod.string().describe("Comma-separated list of symbols")
28377
+ symbols: zod.string().describe("Comma-separated list of symbols, at most 100 (400 above that)")
28257
28378
  });
28258
28379
  var GetUDFQuotesResponse = zod.object({
28259
28380
  s: zod.enum(["ok", "error"]),
@@ -28316,7 +28437,7 @@ function createDexWs(url, options) {
28316
28437
  }
28317
28438
 
28318
28439
  // src/index.ts
28319
- var SDK_VERSION = "0.6.0";
28440
+ var SDK_VERSION = "0.7.0";
28320
28441
  export {
28321
28442
  AGENT_DEFAULTS,
28322
28443
  AULT_SIGNER_MARKER,
@@ -28334,6 +28455,7 @@ export {
28334
28455
  GetAllTickersResponse,
28335
28456
  GetBalanceQueryParams,
28336
28457
  GetBalanceResponse,
28458
+ GetDBReadyResponse,
28337
28459
  GetHealthResponse,
28338
28460
  GetLiveResponse,
28339
28461
  GetOHLCVParams,
@@ -28390,6 +28512,7 @@ export {
28390
28512
  MarketType,
28391
28513
  MissingMsgResponseError,
28392
28514
  NETWORKS,
28515
+ NEXT_CURSOR_HEADER,
28393
28516
  NetworkError,
28394
28517
  ORDER_ID_LENGTH,
28395
28518
  OrderId,
@@ -28425,6 +28548,7 @@ export {
28425
28548
  buildEip712TypedData,
28426
28549
  buildFetchOptions,
28427
28550
  bytesToBase64,
28551
+ collectPages,
28428
28552
  computeEvmFeesPerGas,
28429
28553
  computeFeeFreeGas,
28430
28554
  computeFeeFreeGasCompound,
@@ -28520,6 +28644,7 @@ export {
28520
28644
  getTradeResponseFeeRateRegExp,
28521
28645
  getTradeResponseInfoAddressOneRegExp,
28522
28646
  getTradeResponseInfoBlockHeightRegExp,
28647
+ getTradeResponseInfoEventIndexMax,
28523
28648
  getTradeResponseInfoEventIndexMin,
28524
28649
  getTradeResponsePriceRegExp,
28525
28650
  getTradingFeesResponseMakerRegExp,
@@ -28530,9 +28655,13 @@ export {
28530
28655
  isValidAultAddress,
28531
28656
  isValidEvmAddress,
28532
28657
  isValidValidatorAddress,
28658
+ listCurrenciesResponseInfoContractDecimalsMax,
28659
+ listCurrenciesResponseInfoContractDecimalsMin,
28533
28660
  listMarketsResponseInfoEscrowAddressOneRegExp,
28534
28661
  listMarketsResponseMakerRegExp,
28535
28662
  listMarketsResponseTakerRegExp,
28663
+ listMyTradesQueryBeforeIndexMax,
28664
+ listMyTradesQueryBeforeIndexMin,
28536
28665
  listMyTradesQueryLimitDefault,
28537
28666
  listMyTradesQueryLimitMax,
28538
28667
  listMyTradesResponseAmountRegExp,
@@ -28541,6 +28670,7 @@ export {
28541
28670
  listMyTradesResponseFeeRateRegExp,
28542
28671
  listMyTradesResponseInfoAddressOneRegExp,
28543
28672
  listMyTradesResponseInfoBlockHeightRegExp,
28673
+ listMyTradesResponseInfoEventIndexMax,
28544
28674
  listMyTradesResponseInfoEventIndexMin,
28545
28675
  listMyTradesResponsePriceRegExp,
28546
28676
  listOrdersQueryAddressOneRegExp,
@@ -28558,6 +28688,8 @@ export {
28558
28688
  listOrdersResponseInfoRemainingDepositRegExp,
28559
28689
  listOrdersResponsePriceRegExp,
28560
28690
  listOrdersResponseRemainingRegExp,
28691
+ listTradesQueryBeforeIndexMax,
28692
+ listTradesQueryBeforeIndexMin,
28561
28693
  listTradesQueryLimitDefault,
28562
28694
  listTradesQueryLimitMax,
28563
28695
  listTradesResponseAmountRegExp,
@@ -28566,6 +28698,7 @@ export {
28566
28698
  listTradesResponseFeeRateRegExp,
28567
28699
  listTradesResponseInfoAddressOneRegExp,
28568
28700
  listTradesResponseInfoBlockHeightRegExp,
28701
+ listTradesResponseInfoEventIndexMax,
28569
28702
  listTradesResponseInfoEventIndexMin,
28570
28703
  listTradesResponsePriceRegExp,
28571
28704
  mergeManifests,
@@ -28573,6 +28706,7 @@ export {
28573
28706
  normalizeSignature,
28574
28707
  normalizeSigner,
28575
28708
  normalizeTxHash,
28709
+ paginate,
28576
28710
  paginateAll,
28577
28711
  parseEvmChainIdFromCosmosChainId,
28578
28712
  pollTxInclusion,