ault-sdk-ts 0.5.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.cjs CHANGED
@@ -46,6 +46,7 @@ __export(index_exports, {
46
46
  GetAllTickersResponse: () => GetAllTickersResponse,
47
47
  GetBalanceQueryParams: () => GetBalanceQueryParams,
48
48
  GetBalanceResponse: () => GetBalanceResponse,
49
+ GetDBReadyResponse: () => GetDBReadyResponse,
49
50
  GetHealthResponse: () => GetHealthResponse,
50
51
  GetLiveResponse: () => GetLiveResponse,
51
52
  GetOHLCVParams: () => GetOHLCVParams,
@@ -102,6 +103,7 @@ __export(index_exports, {
102
103
  MarketType: () => MarketType,
103
104
  MissingMsgResponseError: () => MissingMsgResponseError,
104
105
  NETWORKS: () => NETWORKS,
106
+ NEXT_CURSOR_HEADER: () => NEXT_CURSOR_HEADER,
105
107
  NetworkError: () => NetworkError,
106
108
  ORDER_ID_LENGTH: () => ORDER_ID_LENGTH,
107
109
  OrderId: () => OrderId,
@@ -137,6 +139,7 @@ __export(index_exports, {
137
139
  buildEip712TypedData: () => buildEip712TypedData,
138
140
  buildFetchOptions: () => buildFetchOptions,
139
141
  bytesToBase64: () => bytesToBase64,
142
+ collectPages: () => collectPages,
140
143
  computeEvmFeesPerGas: () => computeEvmFeesPerGas,
141
144
  computeFeeFreeGas: () => computeFeeFreeGas,
142
145
  computeFeeFreeGasCompound: () => computeFeeFreeGasCompound,
@@ -185,6 +188,7 @@ __export(index_exports, {
185
188
  encodeTxRaw: () => encodeTxRaw,
186
189
  evmToAult: () => evmToAult,
187
190
  fetchAllPaginatedProto: () => fetchAllPaginatedProto,
191
+ fetchFeeFreeGasLimits: () => fetchFeeFreeGasLimits,
188
192
  fetchFeeMarketParams: () => fetchFeeMarketParams,
189
193
  fetchJson: () => fetchJson,
190
194
  fetchManifest: () => fetchManifest,
@@ -231,6 +235,7 @@ __export(index_exports, {
231
235
  getTradeResponseFeeRateRegExp: () => getTradeResponseFeeRateRegExp,
232
236
  getTradeResponseInfoAddressOneRegExp: () => getTradeResponseInfoAddressOneRegExp,
233
237
  getTradeResponseInfoBlockHeightRegExp: () => getTradeResponseInfoBlockHeightRegExp,
238
+ getTradeResponseInfoEventIndexMax: () => getTradeResponseInfoEventIndexMax,
234
239
  getTradeResponseInfoEventIndexMin: () => getTradeResponseInfoEventIndexMin,
235
240
  getTradeResponsePriceRegExp: () => getTradeResponsePriceRegExp,
236
241
  getTradingFeesResponseMakerRegExp: () => getTradingFeesResponseMakerRegExp,
@@ -241,9 +246,13 @@ __export(index_exports, {
241
246
  isValidAultAddress: () => isValidAultAddress,
242
247
  isValidEvmAddress: () => isValidEvmAddress,
243
248
  isValidValidatorAddress: () => isValidValidatorAddress,
249
+ listCurrenciesResponseInfoContractDecimalsMax: () => listCurrenciesResponseInfoContractDecimalsMax,
250
+ listCurrenciesResponseInfoContractDecimalsMin: () => listCurrenciesResponseInfoContractDecimalsMin,
244
251
  listMarketsResponseInfoEscrowAddressOneRegExp: () => listMarketsResponseInfoEscrowAddressOneRegExp,
245
252
  listMarketsResponseMakerRegExp: () => listMarketsResponseMakerRegExp,
246
253
  listMarketsResponseTakerRegExp: () => listMarketsResponseTakerRegExp,
254
+ listMyTradesQueryBeforeIndexMax: () => listMyTradesQueryBeforeIndexMax,
255
+ listMyTradesQueryBeforeIndexMin: () => listMyTradesQueryBeforeIndexMin,
247
256
  listMyTradesQueryLimitDefault: () => listMyTradesQueryLimitDefault,
248
257
  listMyTradesQueryLimitMax: () => listMyTradesQueryLimitMax,
249
258
  listMyTradesResponseAmountRegExp: () => listMyTradesResponseAmountRegExp,
@@ -252,6 +261,7 @@ __export(index_exports, {
252
261
  listMyTradesResponseFeeRateRegExp: () => listMyTradesResponseFeeRateRegExp,
253
262
  listMyTradesResponseInfoAddressOneRegExp: () => listMyTradesResponseInfoAddressOneRegExp,
254
263
  listMyTradesResponseInfoBlockHeightRegExp: () => listMyTradesResponseInfoBlockHeightRegExp,
264
+ listMyTradesResponseInfoEventIndexMax: () => listMyTradesResponseInfoEventIndexMax,
255
265
  listMyTradesResponseInfoEventIndexMin: () => listMyTradesResponseInfoEventIndexMin,
256
266
  listMyTradesResponsePriceRegExp: () => listMyTradesResponsePriceRegExp,
257
267
  listOrdersQueryAddressOneRegExp: () => listOrdersQueryAddressOneRegExp,
@@ -269,6 +279,8 @@ __export(index_exports, {
269
279
  listOrdersResponseInfoRemainingDepositRegExp: () => listOrdersResponseInfoRemainingDepositRegExp,
270
280
  listOrdersResponsePriceRegExp: () => listOrdersResponsePriceRegExp,
271
281
  listOrdersResponseRemainingRegExp: () => listOrdersResponseRemainingRegExp,
282
+ listTradesQueryBeforeIndexMax: () => listTradesQueryBeforeIndexMax,
283
+ listTradesQueryBeforeIndexMin: () => listTradesQueryBeforeIndexMin,
272
284
  listTradesQueryLimitDefault: () => listTradesQueryLimitDefault,
273
285
  listTradesQueryLimitMax: () => listTradesQueryLimitMax,
274
286
  listTradesResponseAmountRegExp: () => listTradesResponseAmountRegExp,
@@ -277,6 +289,7 @@ __export(index_exports, {
277
289
  listTradesResponseFeeRateRegExp: () => listTradesResponseFeeRateRegExp,
278
290
  listTradesResponseInfoAddressOneRegExp: () => listTradesResponseInfoAddressOneRegExp,
279
291
  listTradesResponseInfoBlockHeightRegExp: () => listTradesResponseInfoBlockHeightRegExp,
292
+ listTradesResponseInfoEventIndexMax: () => listTradesResponseInfoEventIndexMax,
280
293
  listTradesResponseInfoEventIndexMin: () => listTradesResponseInfoEventIndexMin,
281
294
  listTradesResponsePriceRegExp: () => listTradesResponsePriceRegExp,
282
295
  mergeManifests: () => mergeManifests,
@@ -284,6 +297,7 @@ __export(index_exports, {
284
297
  normalizeSignature: () => normalizeSignature,
285
298
  normalizeSigner: () => normalizeSigner,
286
299
  normalizeTxHash: () => normalizeTxHash,
300
+ paginate: () => paginate,
287
301
  paginateAll: () => paginateAll,
288
302
  parseEvmChainIdFromCosmosChainId: () => parseEvmChainIdFromCosmosChainId,
289
303
  pollTxInclusion: () => pollTxInclusion,
@@ -11698,9 +11712,10 @@ async function dexFetch(url, init) {
11698
11712
  // src/rest/dex.generated.ts
11699
11713
  var dex_generated_exports = {};
11700
11714
  __export(dex_generated_exports, {
11715
+ DBReadyResponseDatabase: () => DBReadyResponseDatabase,
11716
+ DBReadyResponseStatus: () => DBReadyResponseStatus,
11701
11717
  GetStatsWindow: () => GetStatsWindow,
11702
11718
  GetUDFHistoryResolution: () => GetUDFHistoryResolution,
11703
- HealthResponseDatabase: () => HealthResponseDatabase,
11704
11719
  HealthResponseStatus: () => HealthResponseStatus,
11705
11720
  ListOrdersStatus: () => ListOrdersStatus,
11706
11721
  LiveResponseStatus: () => LiveResponseStatus,
@@ -11709,6 +11724,7 @@ __export(dex_generated_exports, {
11709
11724
  OrderInfoChainType: () => OrderInfoChainType,
11710
11725
  OrderResponseSide: () => OrderResponseSide,
11711
11726
  OrderResponseStatus: () => OrderResponseStatus,
11727
+ OrderResponseTimeInForce: () => OrderResponseTimeInForce,
11712
11728
  OrderResponseType: () => OrderResponseType,
11713
11729
  RangeQueryDayParameter: () => RangeQueryDayParameter,
11714
11730
  RangeQueryParameter: () => RangeQueryParameter,
@@ -11723,8 +11739,10 @@ __export(dex_generated_exports, {
11723
11739
  UDFSymbolInfoDataStatus: () => UDFSymbolInfoDataStatus,
11724
11740
  getAllTickers: () => getAllTickers,
11725
11741
  getBalance: () => getBalance,
11742
+ getDBReady: () => getDBReady,
11726
11743
  getGetAllTickersUrl: () => getGetAllTickersUrl,
11727
11744
  getGetBalanceUrl: () => getGetBalanceUrl,
11745
+ getGetDBReadyUrl: () => getGetDBReadyUrl,
11728
11746
  getGetHealthUrl: () => getGetHealthUrl,
11729
11747
  getGetLiveUrl: () => getGetLiveUrl,
11730
11748
  getGetOHLCVUrl: () => getGetOHLCVUrl,
@@ -11794,16 +11812,18 @@ var OrderInfoChainType = {
11794
11812
  unknown: "unknown"
11795
11813
  };
11796
11814
  var HealthResponseStatus = {
11797
- healthy: "healthy",
11798
- unhealthy: "unhealthy"
11815
+ healthy: "healthy"
11799
11816
  };
11800
- var HealthResponseDatabase = {
11817
+ var ReadyResponseStatus = {
11818
+ ready: "ready"
11819
+ };
11820
+ var DBReadyResponseStatus = {
11801
11821
  ok: "ok",
11802
- unreachable: "unreachable"
11822
+ unavailable: "unavailable"
11803
11823
  };
11804
- var ReadyResponseStatus = {
11805
- ready: "ready",
11806
- not_ready: "not ready"
11824
+ var DBReadyResponseDatabase = {
11825
+ ok: "ok",
11826
+ unreachable: "unreachable"
11807
11827
  };
11808
11828
  var LiveResponseStatus = {
11809
11829
  alive: "alive"
@@ -11812,7 +11832,10 @@ var MarketResponseType = {
11812
11832
  spot: "spot"
11813
11833
  };
11814
11834
  var StatsResponseWindow = {
11815
- "24h": "24h"
11835
+ "24h": "24h",
11836
+ "7d": "7d",
11837
+ "30d": "30d",
11838
+ all: "all"
11816
11839
  };
11817
11840
  var TradeResponseType = {
11818
11841
  limit: "limit",
@@ -11840,6 +11863,9 @@ var OrderResponseType = {
11840
11863
  twap: "twap",
11841
11864
  unknown: "unknown"
11842
11865
  };
11866
+ var OrderResponseTimeInForce = {
11867
+ ioc: "ioc"
11868
+ };
11843
11869
  var OrderResponseSide = {
11844
11870
  buy: "buy",
11845
11871
  sell: "sell"
@@ -11876,7 +11902,10 @@ var RangeQueryDayParameter = {
11876
11902
  allTime: "allTime"
11877
11903
  };
11878
11904
  var GetStatsWindow = {
11879
- "24h": "24h"
11905
+ "24h": "24h",
11906
+ "7d": "7d",
11907
+ "30d": "30d",
11908
+ all: "all"
11880
11909
  };
11881
11910
  var ListOrdersStatus = {
11882
11911
  open: "open",
@@ -11920,6 +11949,15 @@ var getLive = async (options) => {
11920
11949
  method: "GET"
11921
11950
  });
11922
11951
  };
11952
+ var getGetDBReadyUrl = () => {
11953
+ return `/db-ready`;
11954
+ };
11955
+ var getDBReady = async (options) => {
11956
+ return dexFetch(getGetDBReadyUrl(), {
11957
+ ...options,
11958
+ method: "GET"
11959
+ });
11960
+ };
11923
11961
  var getGetStatusUrl = () => {
11924
11962
  return `/api/v1/status`;
11925
11963
  };
@@ -12304,7 +12342,9 @@ function createDexApi(context) {
12304
12342
  getUDFHistory: bind(context, getUDFHistory),
12305
12343
  getUDFQuotes: bind(context, getUDFQuotes),
12306
12344
  getUDFMarks: bind(context, getUDFMarks),
12307
- getUDFTimescaleMarks: bind(context, getUDFTimescaleMarks)
12345
+ getUDFTimescaleMarks: bind(context, getUDFTimescaleMarks),
12346
+ getOpenAPISpec: bind(context, getOpenAPISpec),
12347
+ getDBReady: bind(context, getDBReady)
12308
12348
  };
12309
12349
  }
12310
12350
 
@@ -25366,6 +25406,40 @@ function createParallelQueryApi(lowLevel) {
25366
25406
 
25367
25407
  // src/high-level/cloid-lookup.ts
25368
25408
  var import_encoding3 = require("@cosmjs/encoding");
25409
+
25410
+ // src/rest/pagination.ts
25411
+ var NEXT_CURSOR_HEADER = "X-Next-Cursor";
25412
+ async function* paginate(fetchPage, params = {}) {
25413
+ let cursor = params.cursor;
25414
+ const seen = new Set(cursor ? [cursor] : []);
25415
+ for (; ; ) {
25416
+ const res = await fetchPage(cursor ? { cursor } : {});
25417
+ if (res.status !== 200 || !Array.isArray(res.data)) {
25418
+ throw new ApiError(`paginated endpoint returned unexpected status ${res.status}`, res.status);
25419
+ }
25420
+ const next = res.headers.get(NEXT_CURSOR_HEADER);
25421
+ if (next && seen.has(next)) {
25422
+ throw new ApiError("pagination cursor repeated; aborting to prevent an infinite loop");
25423
+ }
25424
+ yield { rows: res.data, nextCursor: next };
25425
+ if (!next) return;
25426
+ seen.add(next);
25427
+ cursor = next;
25428
+ }
25429
+ }
25430
+ async function collectPages(fetchPage, max, params = {}) {
25431
+ if (!Number.isInteger(max) || max < 1) {
25432
+ throw new ApiError(`collectPages max must be a positive integer, got ${max}`);
25433
+ }
25434
+ const rows = [];
25435
+ for await (const page of paginate(fetchPage, params)) {
25436
+ rows.push(...page.rows);
25437
+ if (rows.length >= max) return rows.slice(0, max);
25438
+ }
25439
+ return rows;
25440
+ }
25441
+
25442
+ // src/high-level/cloid-lookup.ts
25369
25443
  function createCloidLookupApi(lowLevel) {
25370
25444
  async function findOrderByCloid(orderer, cloid) {
25371
25445
  const addr = normalizeAddress(orderer);
@@ -25379,20 +25453,30 @@ function createCloidLookupApi(lowLevel) {
25379
25453
  return { source: "chain-twap", order: chain.twap };
25380
25454
  }
25381
25455
  const wantHex = (0, import_encoding3.toHex)(bytes);
25382
- const LIMIT = 200;
25383
- const res = await lowLevel.rest.dex.listOrders({ address: addr, cloid: wantHex, limit: LIMIT });
25384
- if (res.status !== 200) {
25385
- throw new Error(`dex-api listOrders returned unexpected status ${res.status}`);
25386
- }
25387
- const orders = res.data.filter((o) => o.clientOrderId?.toLowerCase() === wantHex);
25388
- if (orders.length === 0) {
25389
- return { source: "none", order: null };
25456
+ const LIMIT = 500;
25457
+ const MAX_PAGES = 10;
25458
+ const orders = [];
25459
+ let exhausted = false;
25460
+ let pages = 0;
25461
+ for await (const page of paginate(
25462
+ (p) => lowLevel.rest.dex.listOrders({ address: addr, cloid: wantHex, limit: LIMIT, ...p })
25463
+ )) {
25464
+ orders.push(...page.rows.filter((o) => o.clientOrderId?.toLowerCase() === wantHex));
25465
+ pages += 1;
25466
+ if (!page.nextCursor) {
25467
+ exhausted = true;
25468
+ break;
25469
+ }
25470
+ if (pages >= MAX_PAGES) break;
25390
25471
  }
25391
- if (res.data.length >= LIMIT) {
25472
+ if (!exhausted) {
25392
25473
  throw new Error(
25393
- `cloid ${wantHex} has too many historical matches to disambiguate (>= ${LIMIT}); dex-api needs a canonical (orderer, cloid) latest lookup`
25474
+ `cloid ${wantHex} has too many historical matches to disambiguate (> ${MAX_PAGES * LIMIT} rows); dex-api needs a canonical (orderer, cloid) latest lookup`
25394
25475
  );
25395
25476
  }
25477
+ if (orders.length === 0) {
25478
+ return { source: "none", order: null };
25479
+ }
25396
25480
  const order = orders.reduce((latest, next) => {
25397
25481
  if (next.timestamp !== latest.timestamp) {
25398
25482
  return next.timestamp > latest.timestamp ? next : latest;
@@ -27039,6 +27123,80 @@ function stripTrailingSlash(s) {
27039
27123
  return s.replace(/\/+$/, "");
27040
27124
  }
27041
27125
 
27126
+ // src/core/gas-limits-fetcher.ts
27127
+ var import_zod2 = require("zod");
27128
+ var GAS_LIMITS_PATH = "/ault/accountx/v1/fee_free_gas_limits";
27129
+ var MSG_GAS_KEYS = {
27130
+ "/ault.accountx.v1.MsgOpenAccount": { base: "OPEN_ACCOUNT" },
27131
+ "/ault.agent.v1.MsgApproveAgent": { base: "APPROVE_AGENT" },
27132
+ "/ault.agent.v1.MsgRevokeAgent": { base: "REVOKE_AGENT" },
27133
+ "/ault.reward.v1.MsgApproveBuilder": { base: "APPROVE_BUILDER" },
27134
+ "/ault.reward.v1.MsgRevokeBuilder": { base: "REVOKE_BUILDER" },
27135
+ "/ault.reward.v1.MsgSetReferralCode": { base: "SET_REFERRAL_CODE" },
27136
+ "/ault.reward.v1.MsgSetReferral": { base: "SET_REFERRAL" },
27137
+ "/ault.clob.v1.MsgPlaceLimitOrder": { base: "LIMIT_ORDER" },
27138
+ "/ault.clob.v1.MsgPlaceMarketOrder": { base: "MARKET_ORDER" },
27139
+ "/ault.clob.v1.MsgPlaceTwapOrder": { base: "TWAP_ORDER" },
27140
+ "/ault.clob.v1.MsgPlaceScaleOrder": { base: "SCALE_ORDER_BASE", perUnit: "SCALE_ORDER_PER_SUB" },
27141
+ "/ault.clob.v1.MsgCancelOrders": { base: "CANCEL_ORDER_BASE", perUnit: "CANCEL_ORDER_PER_ID" },
27142
+ // MsgModifyOrders is per-order with a 0 base on chain; only the per-unit maps.
27143
+ "/ault.clob.v1.MsgModifyOrders": { perUnit: "MODIFY_ORDER_PER_ID" }
27144
+ };
27145
+ var FeeFreeGasLimitsResponse = import_zod2.z.object({
27146
+ gas_limits: import_zod2.z.array(
27147
+ import_zod2.z.object({
27148
+ msg_type_url: import_zod2.z.string(),
27149
+ base_gas_limit: import_zod2.z.string(),
27150
+ per_unit_gas_limit: import_zod2.z.string()
27151
+ })
27152
+ )
27153
+ });
27154
+ function parsePositiveInt(value) {
27155
+ if (!/^\d+$/.test(value)) return null;
27156
+ const n = Number(value);
27157
+ return Number.isSafeInteger(n) && n > 0 ? n : null;
27158
+ }
27159
+ async function fetchFeeFreeGasLimits(restUrl, fetchFn, fetchOptions) {
27160
+ const url = `${restUrl.replace(/\/+$/, "")}${GAS_LIMITS_PATH}`;
27161
+ let raw;
27162
+ try {
27163
+ raw = await fetchJson(
27164
+ url,
27165
+ {},
27166
+ { timeout: 1e4, retries: 2, retryDelay: 200, exponentialBackoff: true, ...fetchOptions },
27167
+ fetchFn
27168
+ );
27169
+ } catch (err) {
27170
+ const detail = err instanceof Error ? err.message : String(err);
27171
+ console.warn(
27172
+ `[ault-sdk] fee-free gas fetch failed (${url}); keeping embedded/last-good: ${detail}`
27173
+ );
27174
+ return null;
27175
+ }
27176
+ const parsed = FeeFreeGasLimitsResponse.safeParse(raw);
27177
+ if (!parsed.success) {
27178
+ console.warn(
27179
+ `[ault-sdk] fee-free gas schema mismatch (${url}); keeping embedded/last-good`,
27180
+ parsed.error.issues
27181
+ );
27182
+ return null;
27183
+ }
27184
+ const overrides = {};
27185
+ for (const entry of parsed.data.gas_limits) {
27186
+ const keys = MSG_GAS_KEYS[entry.msg_type_url];
27187
+ if (!keys) continue;
27188
+ if (keys.base) {
27189
+ const base = parsePositiveInt(entry.base_gas_limit);
27190
+ if (base != null) overrides[keys.base] = base;
27191
+ }
27192
+ if (keys.perUnit) {
27193
+ const perUnit = parsePositiveInt(entry.per_unit_gas_limit);
27194
+ if (perUnit != null) overrides[keys.perUnit] = perUnit;
27195
+ }
27196
+ }
27197
+ return overrides;
27198
+ }
27199
+
27042
27200
  // src/core/manifest-resolver.ts
27043
27201
  function mergeManifests(base, top) {
27044
27202
  if (!base && !top) return null;
@@ -27068,16 +27226,16 @@ function applyNetworkOverrides(network, manifest) {
27068
27226
  }
27069
27227
  var NON_OVERRIDABLE_GAS_KEYS = ["EIP712_FEE_AMOUNT", "EIP712_GAS_LIMIT", "DENOM"];
27070
27228
  var NON_OVERRIDABLE_GAS_KEY_SET = new Set(NON_OVERRIDABLE_GAS_KEYS);
27071
- function applyGasOverrides(gas) {
27072
- if (!gas) return GAS_CONSTANTS;
27229
+ function applyGasOverrides(gas, chainOverrides) {
27230
+ if (!gas && !chainOverrides) return GAS_CONSTANTS;
27073
27231
  const safeRest = {};
27074
- for (const [k, v] of Object.entries(gas)) {
27232
+ for (const [k, v] of Object.entries(gas ?? {})) {
27075
27233
  if (NON_OVERRIDABLE_GAS_KEY_SET.has(k)) continue;
27076
27234
  if (typeof v === "number" && Number.isInteger(v) && v > 0) {
27077
27235
  safeRest[k] = v;
27078
27236
  }
27079
27237
  }
27080
- return Object.assign({}, GAS_CONSTANTS, safeRest);
27238
+ return Object.assign({}, GAS_CONSTANTS, chainOverrides ?? {}, safeRest);
27081
27239
  }
27082
27240
  function prepareOverride(override) {
27083
27241
  if (override === void 0) return null;
@@ -27113,21 +27271,39 @@ async function createManifestResolver(opts) {
27113
27271
  );
27114
27272
  const frozenOverride = prepareOverride(opts.override);
27115
27273
  let manifest = null;
27274
+ let chainGas = null;
27275
+ let chainGasUrl = null;
27116
27276
  let disposed = false;
27117
27277
  const resolved = () => mergeManifests(manifest, frozenOverride);
27118
27278
  let pullSeq = 0;
27119
27279
  async function pull(isInitial) {
27120
- if (disposed || !network.dexApiUrl) return;
27280
+ if (disposed) return;
27281
+ const preRestUrl = applyNetworkOverrides(network, resolved()).restUrl;
27282
+ if (!network.dexApiUrl && !preRestUrl) return;
27121
27283
  const seq = ++pullSeq;
27122
27284
  const effectiveOptions = isInitial ? { ...fetchOptions, timeout: INITIAL_FETCH_TIMEOUT_MS, retries: 0 } : fetchOptions;
27123
- const next = await fetchManifest(network.dexApiUrl, fetchFn, effectiveOptions);
27285
+ const nextManifest = network.dexApiUrl ? await fetchManifest(network.dexApiUrl, fetchFn, effectiveOptions) : null;
27286
+ if (disposed || seq !== pullSeq) return;
27287
+ const restUrl = applyNetworkOverrides(
27288
+ network,
27289
+ mergeManifests(nextManifest, frozenOverride)
27290
+ ).restUrl;
27291
+ const nextGas = restUrl ? await fetchFeeFreeGasLimits(restUrl, fetchFn, effectiveOptions) : null;
27124
27292
  if (disposed || seq !== pullSeq) return;
27125
- manifest = next;
27293
+ manifest = nextManifest;
27294
+ if (nextGas !== null) {
27295
+ chainGas = nextGas;
27296
+ chainGasUrl = restUrl;
27297
+ } else if (restUrl !== chainGasUrl) {
27298
+ chainGas = null;
27299
+ chainGasUrl = null;
27300
+ }
27126
27301
  }
27127
27302
  await pull(true);
27128
27303
  let timer;
27129
27304
  function scheduleNext() {
27130
- if (disposed || refreshIntervalMs <= 0 || !network.dexApiUrl) return;
27305
+ const restUrl = applyNetworkOverrides(network, resolved()).restUrl;
27306
+ if (disposed || refreshIntervalMs <= 0 || !network.dexApiUrl && !restUrl) return;
27131
27307
  const jittered = Math.min(
27132
27308
  MAX_REFRESH_INTERVAL_MS,
27133
27309
  refreshIntervalMs * (0.9 + Math.random() * 0.2)
@@ -27145,7 +27321,7 @@ async function createManifestResolver(opts) {
27145
27321
  baseNetwork: network,
27146
27322
  currentManifest: resolved,
27147
27323
  currentNetwork: () => applyNetworkOverrides(network, resolved()),
27148
- currentGas: () => applyGasOverrides(resolved()?.gas),
27324
+ currentGas: () => applyGasOverrides(resolved()?.gas, chainGas ?? void 0),
27149
27325
  async refresh() {
27150
27326
  await pull(false);
27151
27327
  },
@@ -27661,24 +27837,27 @@ async function buildClient(options, resolver) {
27661
27837
  }
27662
27838
 
27663
27839
  // src/rest/types.ts
27664
- var import_zod2 = require("zod");
27665
- var PageResponseSchema = import_zod2.z.object({
27666
- next_key: import_zod2.z.preprocess((value) => value ?? void 0, import_zod2.z.string().optional()),
27667
- total: import_zod2.z.preprocess((value) => value ?? void 0, import_zod2.z.string().optional())
27840
+ var import_zod3 = require("zod");
27841
+ var PageResponseSchema = import_zod3.z.object({
27842
+ next_key: import_zod3.z.preprocess((value) => value ?? void 0, import_zod3.z.string().optional()),
27843
+ total: import_zod3.z.preprocess((value) => value ?? void 0, import_zod3.z.string().optional())
27668
27844
  }).loose();
27669
27845
 
27670
27846
  // src/rest/dex-types.generated.ts
27671
27847
  var zod = __toESM(require("zod"), 1);
27672
27848
  var GetHealthResponse = zod.object({
27673
- status: zod.enum(["healthy", "unhealthy"]),
27674
- database: zod.enum(["ok", "unreachable"])
27849
+ status: zod.enum(["healthy"])
27675
27850
  });
27676
27851
  var GetReadyResponse = zod.object({
27677
- status: zod.enum(["ready", "not ready"])
27852
+ status: zod.enum(["ready"])
27678
27853
  });
27679
27854
  var GetLiveResponse = zod.object({
27680
27855
  status: zod.enum(["alive"])
27681
27856
  });
27857
+ var GetDBReadyResponse = zod.object({
27858
+ status: zod.enum(["ok", "unavailable"]),
27859
+ database: zod.enum(["ok", "unreachable"])
27860
+ });
27682
27861
  var GetStatusResponse = zod.object({
27683
27862
  last_indexed_height: zod.number(),
27684
27863
  last_indexed_at: zod.iso.datetime({})
@@ -27770,6 +27949,8 @@ var ListMarketsResponseItem = zod.object({
27770
27949
  )
27771
27950
  });
27772
27951
  var ListMarketsResponse = zod.array(ListMarketsResponseItem);
27952
+ var listCurrenciesResponseInfoContractDecimalsMin = 0;
27953
+ var listCurrenciesResponseInfoContractDecimalsMax = 255;
27773
27954
  var ListCurrenciesResponse = zod.record(
27774
27955
  zod.string(),
27775
27956
  zod.object({
@@ -27780,7 +27961,9 @@ var ListCurrenciesResponse = zod.record(
27780
27961
  deposit: zod.boolean().nullish(),
27781
27962
  withdraw: zod.boolean().nullish(),
27782
27963
  fee: zod.number().nullish(),
27783
- precision: zod.number(),
27964
+ precision: zod.number().describe(
27965
+ "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"
27966
+ ),
27784
27967
  limits: zod.object({
27785
27968
  amount: zod.object({
27786
27969
  min: zod.number().nullish(),
@@ -27792,7 +27975,11 @@ var ListCurrenciesResponse = zod.record(
27792
27975
  }).optional()
27793
27976
  }),
27794
27977
  networks: zod.looseObject({}).optional(),
27795
- info: zod.looseObject({})
27978
+ info: zod.object({
27979
+ contractDecimals: zod.number().min(listCurrenciesResponseInfoContractDecimalsMin).max(listCurrenciesResponseInfoContractDecimalsMax).describe(
27980
+ "The token contract's own decimals (raw ERC20 decimals). Amounts\non the API are NOT in these units \u2014 see `precision`.\n"
27981
+ )
27982
+ })
27796
27983
  })
27797
27984
  );
27798
27985
  var GetTickerParams = zod.object({
@@ -27886,11 +28073,20 @@ var GetOrderbookResponse = zod.object({
27886
28073
  var ListTradesParams = zod.object({
27887
28074
  symbol: zod.string().describe("URL-encoded trading pair (e.g., `AULT%2FUSDT`)")
27888
28075
  });
27889
- var listTradesQueryLimitDefault = 50;
28076
+ var listTradesQueryLimitDefault = 100;
27890
28077
  var listTradesQueryLimitMax = 500;
28078
+ var listTradesQueryBeforeIndexMin = 0;
28079
+ var listTradesQueryBeforeIndexMax = 4294967295;
27891
28080
  var ListTradesQueryParams = zod.object({
27892
28081
  limit: zod.number().min(1).max(listTradesQueryLimitMax).default(listTradesQueryLimitDefault),
27893
- since: zod.number().optional().describe("Unix timestamp in milliseconds")
28082
+ since: zod.number().optional().describe("Unix timestamp in milliseconds"),
28083
+ cursor: zod.string().optional().describe(
28084
+ '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'
28085
+ ),
28086
+ before_height: zod.number().min(1).optional().describe(
28087
+ "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"
28088
+ ),
28089
+ before_index: zod.number().min(listTradesQueryBeforeIndexMin).max(listTradesQueryBeforeIndexMax).optional().describe("Composite pagination cursor, lower half. See `before_height`.")
27894
28090
  });
27895
28091
  var listTradesResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27896
28092
  var listTradesResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -27900,6 +28096,7 @@ var listTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27900
28096
  var listTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
27901
28097
  var listTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
27902
28098
  var listTradesResponseInfoEventIndexMin = 0;
28099
+ var listTradesResponseInfoEventIndexMax = 4294967295;
27903
28100
  var ListTradesResponseItem = zod.object({
27904
28101
  id: zod.string(),
27905
28102
  order: zod.string().nullish(),
@@ -27909,10 +28106,11 @@ var ListTradesResponseItem = zod.object({
27909
28106
  type: zod.union([
27910
28107
  zod.literal("limit"),
27911
28108
  zod.literal("market"),
28109
+ zod.literal("twap"),
27912
28110
  zod.literal("unknown"),
27913
28111
  zod.literal(null)
27914
28112
  ]).nullish().describe(
27915
- "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."
28113
+ "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."
27916
28114
  ),
27917
28115
  cloid: zod.string().nullish().describe(
27918
28116
  "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)."
@@ -27946,8 +28144,8 @@ var ListTradesResponseItem = zod.object({
27946
28144
  "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"
27947
28145
  ),
27948
28146
  block_height: zod.string().regex(listTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
27949
- event_index: zod.number().min(listTradesResponseInfoEventIndexMin).describe(
27950
- "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"
28147
+ event_index: zod.number().min(listTradesResponseInfoEventIndexMin).max(listTradesResponseInfoEventIndexMax).describe(
28148
+ "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"
27951
28149
  )
27952
28150
  }).describe(
27953
28151
  "Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
@@ -27973,6 +28171,7 @@ var getTradeResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27973
28171
  var getTradeResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
27974
28172
  var getTradeResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
27975
28173
  var getTradeResponseInfoEventIndexMin = 0;
28174
+ var getTradeResponseInfoEventIndexMax = 4294967295;
27976
28175
  var GetTradeResponse = zod.object({
27977
28176
  id: zod.string(),
27978
28177
  order: zod.string().nullish(),
@@ -27982,10 +28181,11 @@ var GetTradeResponse = zod.object({
27982
28181
  type: zod.union([
27983
28182
  zod.literal("limit"),
27984
28183
  zod.literal("market"),
28184
+ zod.literal("twap"),
27985
28185
  zod.literal("unknown"),
27986
28186
  zod.literal(null)
27987
28187
  ]).nullish().describe(
27988
- "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."
28188
+ "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."
27989
28189
  ),
27990
28190
  cloid: zod.string().nullish().describe(
27991
28191
  "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)."
@@ -28019,8 +28219,8 @@ var GetTradeResponse = zod.object({
28019
28219
  "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"
28020
28220
  ),
28021
28221
  block_height: zod.string().regex(getTradeResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
28022
- event_index: zod.number().min(getTradeResponseInfoEventIndexMin).describe(
28023
- "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"
28222
+ event_index: zod.number().min(getTradeResponseInfoEventIndexMin).max(getTradeResponseInfoEventIndexMax).describe(
28223
+ "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"
28024
28224
  )
28025
28225
  }).describe(
28026
28226
  "Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
@@ -28042,7 +28242,7 @@ var GetTradingFeesResponse = zod.record(
28042
28242
  })
28043
28243
  );
28044
28244
  var GetStatsQueryParams = zod.object({
28045
- window: zod.enum(["24h"]).optional().describe("Rolling window. Only `24h` is supported; defaults to `24h`.")
28245
+ window: zod.enum(["24h", "7d", "30d", "all"]).optional().describe("Precomputed reporting window. Defaults to `24h`.")
28046
28246
  });
28047
28247
  var getStatsResponseTotalsQuoteVolumeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
28048
28248
  var getStatsResponseTotalsEstimatedFeeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -28054,7 +28254,7 @@ var getStatsResponseMarketsItemBaseVolumeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$
28054
28254
  var getStatsResponseMarketsItemEstimatedFeeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
28055
28255
  var getStatsResponseMarketsItemTakerFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
28056
28256
  var GetStatsResponse = zod.object({
28057
- window: zod.enum(["24h"]),
28257
+ window: zod.enum(["24h", "7d", "30d", "all"]),
28058
28258
  totals: zod.object({
28059
28259
  quoteVolume: zod.string().regex(getStatsResponseTotalsQuoteVolumeRegExp).nullable().describe(
28060
28260
  "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"
@@ -28069,12 +28269,12 @@ var GetStatsResponse = zod.object({
28069
28269
  traderCount: zod.number().describe("Distinct trading addresses in the window."),
28070
28270
  activeMarkets: zod.number().describe("Number of markets with at least one fill in the window."),
28071
28271
  dailyActiveUsers: zod.number().nullable().describe(
28072
- "Distinct trading addresses in the window. Currently an alias of\n`traderCount`; separate so a precise DAU source can diverge later.\n"
28272
+ "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"
28073
28273
  ),
28074
28274
  averageSlippageBps: zod.string().regex(getStatsResponseTotalsAverageSlippageBpsRegExp).nullable().describe(
28075
28275
  "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"
28076
28276
  ),
28077
- depositUsdcVolume24h: zod.string().regex(getStatsResponseTotalsDepositUsdcVolume24hRegExp).nullable().describe("Reserved. Currently always null."),
28277
+ depositUsdcVolume24h: zod.string().regex(getStatsResponseTotalsDepositUsdcVolume24hRegExp).nullable().describe("24h USDC deposit volume when available; null for longer windows."),
28078
28278
  builderCodesFee24h: zod.string().regex(getStatsResponseTotalsBuilderCodesFee24hRegExp).nullable().describe("Reserved. Currently always null.")
28079
28279
  }).describe("Protocol-wide aggregates for the window."),
28080
28280
  markets: zod.array(
@@ -28096,8 +28296,8 @@ var listOrdersQueryAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
28096
28296
  var listOrdersQueryAddressTwoRegExp = new RegExp("^0x[a-f0-9]{40}$");
28097
28297
  var listOrdersQueryMarketIdRegExp = new RegExp("^[0-9a-fA-F]+$");
28098
28298
  var listOrdersQueryCloidRegExp = new RegExp("^([0-9a-fA-F]{16})?$");
28099
- var listOrdersQueryLimitDefault = 50;
28100
- var listOrdersQueryLimitMax = 200;
28299
+ var listOrdersQueryLimitDefault = 100;
28300
+ var listOrdersQueryLimitMax = 500;
28101
28301
  var ListOrdersQueryParams = zod.object({
28102
28302
  address: zod.union([
28103
28303
  zod.string().regex(listOrdersQueryAddressOneRegExp).describe(
@@ -28116,7 +28316,10 @@ var ListOrdersQueryParams = zod.object({
28116
28316
  "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"
28117
28317
  ),
28118
28318
  since: zod.number().optional().describe("Return orders created after this Unix timestamp (milliseconds)"),
28119
- limit: zod.number().min(1).max(listOrdersQueryLimitMax).default(listOrdersQueryLimitDefault)
28319
+ limit: zod.number().min(1).max(listOrdersQueryLimitMax).default(listOrdersQueryLimitDefault),
28320
+ cursor: zod.string().optional().describe(
28321
+ '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'
28322
+ )
28120
28323
  });
28121
28324
  var listOrdersResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
28122
28325
  var listOrdersResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -28137,8 +28340,12 @@ var ListOrdersResponseItem = zod.object({
28137
28340
  lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
28138
28341
  status: zod.enum(["open", "closed", "canceled", "unknown"]).describe("`unknown` is the fallback for a chain status code the API doesn't recognize."),
28139
28342
  symbol: zod.string(),
28140
- type: zod.enum(["limit", "market", "twap", "unknown"]).describe("`unknown` is the fallback for a chain type code the API doesn't recognize."),
28141
- timeInForce: zod.string().nullish(),
28343
+ type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
28344
+ "`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."
28345
+ ),
28346
+ timeInForce: zod.union([zod.literal("ioc"), zod.literal(null)]).nullable().describe(
28347
+ "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"
28348
+ ),
28142
28349
  side: zod.enum(["buy", "sell"]),
28143
28350
  price: zod.string().regex(listOrdersResponsePriceRegExp),
28144
28351
  average: zod.string().nullish().describe("Average execution price as decimal string. Null when filled is 0."),
@@ -28180,10 +28387,10 @@ var ListOrdersResponseItem = zod.object({
28180
28387
  "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"
28181
28388
  ),
28182
28389
  chain_type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
28183
- "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"
28390
+ "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"
28184
28391
  ),
28185
- close_reason: zod.string().nullish().describe(
28186
- "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"
28392
+ close_reason: zod.string().nullable().describe(
28393
+ "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"
28187
28394
  )
28188
28395
  }).describe(
28189
28396
  "Exchange-specific extension on `OrderResponse`. Mirrors the\n`info` map populated in `internal/domain/order/service.go`.\n"
@@ -28214,8 +28421,12 @@ var GetOrderResponse = zod.object({
28214
28421
  lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
28215
28422
  status: zod.enum(["open", "closed", "canceled", "unknown"]).describe("`unknown` is the fallback for a chain status code the API doesn't recognize."),
28216
28423
  symbol: zod.string(),
28217
- type: zod.enum(["limit", "market", "twap", "unknown"]).describe("`unknown` is the fallback for a chain type code the API doesn't recognize."),
28218
- timeInForce: zod.string().nullish(),
28424
+ type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
28425
+ "`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."
28426
+ ),
28427
+ timeInForce: zod.union([zod.literal("ioc"), zod.literal(null)]).nullable().describe(
28428
+ "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"
28429
+ ),
28219
28430
  side: zod.enum(["buy", "sell"]),
28220
28431
  price: zod.string().regex(getOrderResponsePriceRegExp),
28221
28432
  average: zod.string().nullish().describe("Average execution price as decimal string. Null when filled is 0."),
@@ -28257,10 +28468,10 @@ var GetOrderResponse = zod.object({
28257
28468
  "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"
28258
28469
  ),
28259
28470
  chain_type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
28260
- "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"
28471
+ "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"
28261
28472
  ),
28262
- close_reason: zod.string().nullish().describe(
28263
- "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"
28473
+ close_reason: zod.string().nullable().describe(
28474
+ "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"
28264
28475
  )
28265
28476
  }).describe(
28266
28477
  "Exchange-specific extension on `OrderResponse`. Mirrors the\n`info` map populated in `internal/domain/order/service.go`.\n"
@@ -28268,13 +28479,22 @@ var GetOrderResponse = zod.object({
28268
28479
  }).describe(
28269
28480
  "All numeric fields (price, amount, filled, remaining, cost,\nfee.cost, fee.rate, average, triggerPrice, stopPrice) are canonical\ndecimal strings.\n"
28270
28481
  );
28271
- var listMyTradesQueryLimitDefault = 50;
28482
+ var listMyTradesQueryLimitDefault = 100;
28272
28483
  var listMyTradesQueryLimitMax = 500;
28484
+ var listMyTradesQueryBeforeIndexMin = 0;
28485
+ var listMyTradesQueryBeforeIndexMax = 4294967295;
28273
28486
  var ListMyTradesQueryParams = zod.object({
28274
28487
  address: zod.string().describe("Blockchain address of the trader"),
28275
28488
  symbol: zod.string().optional().describe("Symbol to filter by (e.g., AULT/USDT)"),
28276
28489
  since: zod.number().optional().describe("Unix timestamp in milliseconds"),
28277
- limit: zod.number().min(1).max(listMyTradesQueryLimitMax).default(listMyTradesQueryLimitDefault)
28490
+ limit: zod.number().min(1).max(listMyTradesQueryLimitMax).default(listMyTradesQueryLimitDefault),
28491
+ cursor: zod.string().optional().describe(
28492
+ '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'
28493
+ ),
28494
+ before_height: zod.number().min(1).optional().describe(
28495
+ "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"
28496
+ ),
28497
+ before_index: zod.number().min(listMyTradesQueryBeforeIndexMin).max(listMyTradesQueryBeforeIndexMax).optional().describe("Composite pagination cursor, lower half. See `before_height`.")
28278
28498
  });
28279
28499
  var listMyTradesResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
28280
28500
  var listMyTradesResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -28284,6 +28504,7 @@ var listMyTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
28284
28504
  var listMyTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
28285
28505
  var listMyTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
28286
28506
  var listMyTradesResponseInfoEventIndexMin = 0;
28507
+ var listMyTradesResponseInfoEventIndexMax = 4294967295;
28287
28508
  var ListMyTradesResponseItem = zod.object({
28288
28509
  id: zod.string(),
28289
28510
  order: zod.string().nullish(),
@@ -28293,10 +28514,11 @@ var ListMyTradesResponseItem = zod.object({
28293
28514
  type: zod.union([
28294
28515
  zod.literal("limit"),
28295
28516
  zod.literal("market"),
28517
+ zod.literal("twap"),
28296
28518
  zod.literal("unknown"),
28297
28519
  zod.literal(null)
28298
28520
  ]).nullish().describe(
28299
- "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."
28521
+ "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."
28300
28522
  ),
28301
28523
  cloid: zod.string().nullish().describe(
28302
28524
  "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)."
@@ -28330,8 +28552,8 @@ var ListMyTradesResponseItem = zod.object({
28330
28552
  "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"
28331
28553
  ),
28332
28554
  block_height: zod.string().regex(listMyTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
28333
- event_index: zod.number().min(listMyTradesResponseInfoEventIndexMin).describe(
28334
- "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"
28555
+ event_index: zod.number().min(listMyTradesResponseInfoEventIndexMin).max(listMyTradesResponseInfoEventIndexMax).describe(
28556
+ "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"
28335
28557
  )
28336
28558
  }).describe(
28337
28559
  "Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
@@ -28360,12 +28582,17 @@ var GetOHLCVParams = zod.object({
28360
28582
  symbol: zod.string().describe("URL-encoded trading pair (e.g., `AULT%2FUSDT`)")
28361
28583
  });
28362
28584
  var getOHLCVQueryTimeframeDefault = `1m`;
28363
- var getOHLCVQueryLimitDefault = 100;
28585
+ var getOHLCVQueryLimitDefault = 500;
28364
28586
  var getOHLCVQueryLimitMax = 1e3;
28365
28587
  var GetOHLCVQueryParams = zod.object({
28366
28588
  timeframe: zod.string().default(getOHLCVQueryTimeframeDefault).describe("Timeframe: 1m, 5m, 15m, 30m, 1h, 4h, 1d. Also accepts TV format: 1, 5, 15, 60, 1D"),
28367
- limit: zod.number().min(1).max(getOHLCVQueryLimitMax).default(getOHLCVQueryLimitDefault),
28368
- since: zod.number().optional().describe("Unix timestamp in milliseconds")
28589
+ limit: zod.number().min(1).max(getOHLCVQueryLimitMax).default(getOHLCVQueryLimitDefault).describe(
28590
+ "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"
28591
+ ),
28592
+ since: zod.number().optional().describe("Unix timestamp in milliseconds"),
28593
+ cursor: zod.string().optional().describe(
28594
+ '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'
28595
+ )
28369
28596
  });
28370
28597
  var GetOHLCVResponseItem = zod.tuple([
28371
28598
  zod.number().describe("timestamp in milliseconds"),
@@ -28443,7 +28670,7 @@ var GetUDFHistoryQueryParams = zod.object({
28443
28670
  resolution: zod.enum(["1", "5", "15", "30", "60", "1D", "1W", "1M"]),
28444
28671
  from: zod.number().describe("Unix seconds"),
28445
28672
  to: zod.number().describe("Unix seconds"),
28446
- countback: zod.number().min(1).max(getUDFHistoryQueryCountbackMax).optional()
28673
+ countback: zod.number().min(1).max(getUDFHistoryQueryCountbackMax).optional().describe("Values above 1000 are clamped to 1000 server-side.")
28447
28674
  });
28448
28675
  var GetUDFHistoryResponse = zod.object({
28449
28676
  s: zod.enum(["ok", "no_data", "error"]),
@@ -28457,7 +28684,7 @@ var GetUDFHistoryResponse = zod.object({
28457
28684
  nextTime: zod.number().optional().describe('Unix seconds of next available bar (when s = "no_data")')
28458
28685
  });
28459
28686
  var GetUDFQuotesQueryParams = zod.object({
28460
- symbols: zod.string().describe("Comma-separated list of symbols")
28687
+ symbols: zod.string().describe("Comma-separated list of symbols, at most 100 (400 above that)")
28461
28688
  });
28462
28689
  var GetUDFQuotesResponse = zod.object({
28463
28690
  s: zod.enum(["ok", "error"]),
@@ -28520,7 +28747,7 @@ function createDexWs(url, options) {
28520
28747
  }
28521
28748
 
28522
28749
  // src/index.ts
28523
- var SDK_VERSION = "0.5.0";
28750
+ var SDK_VERSION = "0.7.0";
28524
28751
  // Annotate the CommonJS export names for ESM import in node:
28525
28752
  0 && (module.exports = {
28526
28753
  AGENT_DEFAULTS,
@@ -28539,6 +28766,7 @@ var SDK_VERSION = "0.5.0";
28539
28766
  GetAllTickersResponse,
28540
28767
  GetBalanceQueryParams,
28541
28768
  GetBalanceResponse,
28769
+ GetDBReadyResponse,
28542
28770
  GetHealthResponse,
28543
28771
  GetLiveResponse,
28544
28772
  GetOHLCVParams,
@@ -28595,6 +28823,7 @@ var SDK_VERSION = "0.5.0";
28595
28823
  MarketType,
28596
28824
  MissingMsgResponseError,
28597
28825
  NETWORKS,
28826
+ NEXT_CURSOR_HEADER,
28598
28827
  NetworkError,
28599
28828
  ORDER_ID_LENGTH,
28600
28829
  OrderId,
@@ -28630,6 +28859,7 @@ var SDK_VERSION = "0.5.0";
28630
28859
  buildEip712TypedData,
28631
28860
  buildFetchOptions,
28632
28861
  bytesToBase64,
28862
+ collectPages,
28633
28863
  computeEvmFeesPerGas,
28634
28864
  computeFeeFreeGas,
28635
28865
  computeFeeFreeGasCompound,
@@ -28678,6 +28908,7 @@ var SDK_VERSION = "0.5.0";
28678
28908
  encodeTxRaw,
28679
28909
  evmToAult,
28680
28910
  fetchAllPaginatedProto,
28911
+ fetchFeeFreeGasLimits,
28681
28912
  fetchFeeMarketParams,
28682
28913
  fetchJson,
28683
28914
  fetchManifest,
@@ -28724,6 +28955,7 @@ var SDK_VERSION = "0.5.0";
28724
28955
  getTradeResponseFeeRateRegExp,
28725
28956
  getTradeResponseInfoAddressOneRegExp,
28726
28957
  getTradeResponseInfoBlockHeightRegExp,
28958
+ getTradeResponseInfoEventIndexMax,
28727
28959
  getTradeResponseInfoEventIndexMin,
28728
28960
  getTradeResponsePriceRegExp,
28729
28961
  getTradingFeesResponseMakerRegExp,
@@ -28734,9 +28966,13 @@ var SDK_VERSION = "0.5.0";
28734
28966
  isValidAultAddress,
28735
28967
  isValidEvmAddress,
28736
28968
  isValidValidatorAddress,
28969
+ listCurrenciesResponseInfoContractDecimalsMax,
28970
+ listCurrenciesResponseInfoContractDecimalsMin,
28737
28971
  listMarketsResponseInfoEscrowAddressOneRegExp,
28738
28972
  listMarketsResponseMakerRegExp,
28739
28973
  listMarketsResponseTakerRegExp,
28974
+ listMyTradesQueryBeforeIndexMax,
28975
+ listMyTradesQueryBeforeIndexMin,
28740
28976
  listMyTradesQueryLimitDefault,
28741
28977
  listMyTradesQueryLimitMax,
28742
28978
  listMyTradesResponseAmountRegExp,
@@ -28745,6 +28981,7 @@ var SDK_VERSION = "0.5.0";
28745
28981
  listMyTradesResponseFeeRateRegExp,
28746
28982
  listMyTradesResponseInfoAddressOneRegExp,
28747
28983
  listMyTradesResponseInfoBlockHeightRegExp,
28984
+ listMyTradesResponseInfoEventIndexMax,
28748
28985
  listMyTradesResponseInfoEventIndexMin,
28749
28986
  listMyTradesResponsePriceRegExp,
28750
28987
  listOrdersQueryAddressOneRegExp,
@@ -28762,6 +28999,8 @@ var SDK_VERSION = "0.5.0";
28762
28999
  listOrdersResponseInfoRemainingDepositRegExp,
28763
29000
  listOrdersResponsePriceRegExp,
28764
29001
  listOrdersResponseRemainingRegExp,
29002
+ listTradesQueryBeforeIndexMax,
29003
+ listTradesQueryBeforeIndexMin,
28765
29004
  listTradesQueryLimitDefault,
28766
29005
  listTradesQueryLimitMax,
28767
29006
  listTradesResponseAmountRegExp,
@@ -28770,6 +29009,7 @@ var SDK_VERSION = "0.5.0";
28770
29009
  listTradesResponseFeeRateRegExp,
28771
29010
  listTradesResponseInfoAddressOneRegExp,
28772
29011
  listTradesResponseInfoBlockHeightRegExp,
29012
+ listTradesResponseInfoEventIndexMax,
28773
29013
  listTradesResponseInfoEventIndexMin,
28774
29014
  listTradesResponsePriceRegExp,
28775
29015
  mergeManifests,
@@ -28777,6 +29017,7 @@ var SDK_VERSION = "0.5.0";
28777
29017
  normalizeSignature,
28778
29018
  normalizeSigner,
28779
29019
  normalizeTxHash,
29020
+ paginate,
28780
29021
  paginateAll,
28781
29022
  parseEvmChainIdFromCosmosChainId,
28782
29023
  pollTxInclusion,