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/core/gas-limits-fetcher.d.ts +14 -0
- package/dist/core/manifest-resolver.d.ts +2 -1
- package/dist/index.cjs +316 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +302 -75
- package/dist/index.js.map +1 -1
- package/dist/rest/dex-types.generated.d.ts +73 -34
- package/dist/rest/dex.d.ts +2 -0
- package/dist/rest/dex.generated.d.ts +295 -69
- package/dist/rest/pagination.d.ts +45 -0
- package/package.json +1 -1
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
|
|
11507
|
+
var ReadyResponseStatus = {
|
|
11508
|
+
ready: "ready"
|
|
11509
|
+
};
|
|
11510
|
+
var DBReadyResponseStatus = {
|
|
11505
11511
|
ok: "ok",
|
|
11506
|
-
|
|
11512
|
+
unavailable: "unavailable"
|
|
11507
11513
|
};
|
|
11508
|
-
var
|
|
11509
|
-
|
|
11510
|
-
|
|
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 =
|
|
25087
|
-
const
|
|
25088
|
-
|
|
25089
|
-
|
|
25090
|
-
|
|
25091
|
-
|
|
25092
|
-
|
|
25093
|
-
|
|
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 (
|
|
25162
|
+
if (!exhausted) {
|
|
25096
25163
|
throw new Error(
|
|
25097
|
-
`cloid ${wantHex} has too many historical matches to disambiguate (
|
|
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;
|
|
@@ -26743,6 +26813,80 @@ function stripTrailingSlash(s) {
|
|
|
26743
26813
|
return s.replace(/\/+$/, "");
|
|
26744
26814
|
}
|
|
26745
26815
|
|
|
26816
|
+
// src/core/gas-limits-fetcher.ts
|
|
26817
|
+
import { z as z2 } from "zod";
|
|
26818
|
+
var GAS_LIMITS_PATH = "/ault/accountx/v1/fee_free_gas_limits";
|
|
26819
|
+
var MSG_GAS_KEYS = {
|
|
26820
|
+
"/ault.accountx.v1.MsgOpenAccount": { base: "OPEN_ACCOUNT" },
|
|
26821
|
+
"/ault.agent.v1.MsgApproveAgent": { base: "APPROVE_AGENT" },
|
|
26822
|
+
"/ault.agent.v1.MsgRevokeAgent": { base: "REVOKE_AGENT" },
|
|
26823
|
+
"/ault.reward.v1.MsgApproveBuilder": { base: "APPROVE_BUILDER" },
|
|
26824
|
+
"/ault.reward.v1.MsgRevokeBuilder": { base: "REVOKE_BUILDER" },
|
|
26825
|
+
"/ault.reward.v1.MsgSetReferralCode": { base: "SET_REFERRAL_CODE" },
|
|
26826
|
+
"/ault.reward.v1.MsgSetReferral": { base: "SET_REFERRAL" },
|
|
26827
|
+
"/ault.clob.v1.MsgPlaceLimitOrder": { base: "LIMIT_ORDER" },
|
|
26828
|
+
"/ault.clob.v1.MsgPlaceMarketOrder": { base: "MARKET_ORDER" },
|
|
26829
|
+
"/ault.clob.v1.MsgPlaceTwapOrder": { base: "TWAP_ORDER" },
|
|
26830
|
+
"/ault.clob.v1.MsgPlaceScaleOrder": { base: "SCALE_ORDER_BASE", perUnit: "SCALE_ORDER_PER_SUB" },
|
|
26831
|
+
"/ault.clob.v1.MsgCancelOrders": { base: "CANCEL_ORDER_BASE", perUnit: "CANCEL_ORDER_PER_ID" },
|
|
26832
|
+
// MsgModifyOrders is per-order with a 0 base on chain; only the per-unit maps.
|
|
26833
|
+
"/ault.clob.v1.MsgModifyOrders": { perUnit: "MODIFY_ORDER_PER_ID" }
|
|
26834
|
+
};
|
|
26835
|
+
var FeeFreeGasLimitsResponse = z2.object({
|
|
26836
|
+
gas_limits: z2.array(
|
|
26837
|
+
z2.object({
|
|
26838
|
+
msg_type_url: z2.string(),
|
|
26839
|
+
base_gas_limit: z2.string(),
|
|
26840
|
+
per_unit_gas_limit: z2.string()
|
|
26841
|
+
})
|
|
26842
|
+
)
|
|
26843
|
+
});
|
|
26844
|
+
function parsePositiveInt(value) {
|
|
26845
|
+
if (!/^\d+$/.test(value)) return null;
|
|
26846
|
+
const n = Number(value);
|
|
26847
|
+
return Number.isSafeInteger(n) && n > 0 ? n : null;
|
|
26848
|
+
}
|
|
26849
|
+
async function fetchFeeFreeGasLimits(restUrl, fetchFn, fetchOptions) {
|
|
26850
|
+
const url = `${restUrl.replace(/\/+$/, "")}${GAS_LIMITS_PATH}`;
|
|
26851
|
+
let raw;
|
|
26852
|
+
try {
|
|
26853
|
+
raw = await fetchJson(
|
|
26854
|
+
url,
|
|
26855
|
+
{},
|
|
26856
|
+
{ timeout: 1e4, retries: 2, retryDelay: 200, exponentialBackoff: true, ...fetchOptions },
|
|
26857
|
+
fetchFn
|
|
26858
|
+
);
|
|
26859
|
+
} catch (err) {
|
|
26860
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
26861
|
+
console.warn(
|
|
26862
|
+
`[ault-sdk] fee-free gas fetch failed (${url}); keeping embedded/last-good: ${detail}`
|
|
26863
|
+
);
|
|
26864
|
+
return null;
|
|
26865
|
+
}
|
|
26866
|
+
const parsed = FeeFreeGasLimitsResponse.safeParse(raw);
|
|
26867
|
+
if (!parsed.success) {
|
|
26868
|
+
console.warn(
|
|
26869
|
+
`[ault-sdk] fee-free gas schema mismatch (${url}); keeping embedded/last-good`,
|
|
26870
|
+
parsed.error.issues
|
|
26871
|
+
);
|
|
26872
|
+
return null;
|
|
26873
|
+
}
|
|
26874
|
+
const overrides = {};
|
|
26875
|
+
for (const entry of parsed.data.gas_limits) {
|
|
26876
|
+
const keys = MSG_GAS_KEYS[entry.msg_type_url];
|
|
26877
|
+
if (!keys) continue;
|
|
26878
|
+
if (keys.base) {
|
|
26879
|
+
const base = parsePositiveInt(entry.base_gas_limit);
|
|
26880
|
+
if (base != null) overrides[keys.base] = base;
|
|
26881
|
+
}
|
|
26882
|
+
if (keys.perUnit) {
|
|
26883
|
+
const perUnit = parsePositiveInt(entry.per_unit_gas_limit);
|
|
26884
|
+
if (perUnit != null) overrides[keys.perUnit] = perUnit;
|
|
26885
|
+
}
|
|
26886
|
+
}
|
|
26887
|
+
return overrides;
|
|
26888
|
+
}
|
|
26889
|
+
|
|
26746
26890
|
// src/core/manifest-resolver.ts
|
|
26747
26891
|
function mergeManifests(base, top) {
|
|
26748
26892
|
if (!base && !top) return null;
|
|
@@ -26772,16 +26916,16 @@ function applyNetworkOverrides(network, manifest) {
|
|
|
26772
26916
|
}
|
|
26773
26917
|
var NON_OVERRIDABLE_GAS_KEYS = ["EIP712_FEE_AMOUNT", "EIP712_GAS_LIMIT", "DENOM"];
|
|
26774
26918
|
var NON_OVERRIDABLE_GAS_KEY_SET = new Set(NON_OVERRIDABLE_GAS_KEYS);
|
|
26775
|
-
function applyGasOverrides(gas) {
|
|
26776
|
-
if (!gas) return GAS_CONSTANTS;
|
|
26919
|
+
function applyGasOverrides(gas, chainOverrides) {
|
|
26920
|
+
if (!gas && !chainOverrides) return GAS_CONSTANTS;
|
|
26777
26921
|
const safeRest = {};
|
|
26778
|
-
for (const [k, v] of Object.entries(gas)) {
|
|
26922
|
+
for (const [k, v] of Object.entries(gas ?? {})) {
|
|
26779
26923
|
if (NON_OVERRIDABLE_GAS_KEY_SET.has(k)) continue;
|
|
26780
26924
|
if (typeof v === "number" && Number.isInteger(v) && v > 0) {
|
|
26781
26925
|
safeRest[k] = v;
|
|
26782
26926
|
}
|
|
26783
26927
|
}
|
|
26784
|
-
return Object.assign({}, GAS_CONSTANTS, safeRest);
|
|
26928
|
+
return Object.assign({}, GAS_CONSTANTS, chainOverrides ?? {}, safeRest);
|
|
26785
26929
|
}
|
|
26786
26930
|
function prepareOverride(override) {
|
|
26787
26931
|
if (override === void 0) return null;
|
|
@@ -26817,21 +26961,39 @@ async function createManifestResolver(opts) {
|
|
|
26817
26961
|
);
|
|
26818
26962
|
const frozenOverride = prepareOverride(opts.override);
|
|
26819
26963
|
let manifest = null;
|
|
26964
|
+
let chainGas = null;
|
|
26965
|
+
let chainGasUrl = null;
|
|
26820
26966
|
let disposed = false;
|
|
26821
26967
|
const resolved = () => mergeManifests(manifest, frozenOverride);
|
|
26822
26968
|
let pullSeq = 0;
|
|
26823
26969
|
async function pull(isInitial) {
|
|
26824
|
-
if (disposed
|
|
26970
|
+
if (disposed) return;
|
|
26971
|
+
const preRestUrl = applyNetworkOverrides(network, resolved()).restUrl;
|
|
26972
|
+
if (!network.dexApiUrl && !preRestUrl) return;
|
|
26825
26973
|
const seq = ++pullSeq;
|
|
26826
26974
|
const effectiveOptions = isInitial ? { ...fetchOptions, timeout: INITIAL_FETCH_TIMEOUT_MS, retries: 0 } : fetchOptions;
|
|
26827
|
-
const
|
|
26975
|
+
const nextManifest = network.dexApiUrl ? await fetchManifest(network.dexApiUrl, fetchFn, effectiveOptions) : null;
|
|
26976
|
+
if (disposed || seq !== pullSeq) return;
|
|
26977
|
+
const restUrl = applyNetworkOverrides(
|
|
26978
|
+
network,
|
|
26979
|
+
mergeManifests(nextManifest, frozenOverride)
|
|
26980
|
+
).restUrl;
|
|
26981
|
+
const nextGas = restUrl ? await fetchFeeFreeGasLimits(restUrl, fetchFn, effectiveOptions) : null;
|
|
26828
26982
|
if (disposed || seq !== pullSeq) return;
|
|
26829
|
-
manifest =
|
|
26983
|
+
manifest = nextManifest;
|
|
26984
|
+
if (nextGas !== null) {
|
|
26985
|
+
chainGas = nextGas;
|
|
26986
|
+
chainGasUrl = restUrl;
|
|
26987
|
+
} else if (restUrl !== chainGasUrl) {
|
|
26988
|
+
chainGas = null;
|
|
26989
|
+
chainGasUrl = null;
|
|
26990
|
+
}
|
|
26830
26991
|
}
|
|
26831
26992
|
await pull(true);
|
|
26832
26993
|
let timer;
|
|
26833
26994
|
function scheduleNext() {
|
|
26834
|
-
|
|
26995
|
+
const restUrl = applyNetworkOverrides(network, resolved()).restUrl;
|
|
26996
|
+
if (disposed || refreshIntervalMs <= 0 || !network.dexApiUrl && !restUrl) return;
|
|
26835
26997
|
const jittered = Math.min(
|
|
26836
26998
|
MAX_REFRESH_INTERVAL_MS,
|
|
26837
26999
|
refreshIntervalMs * (0.9 + Math.random() * 0.2)
|
|
@@ -26849,7 +27011,7 @@ async function createManifestResolver(opts) {
|
|
|
26849
27011
|
baseNetwork: network,
|
|
26850
27012
|
currentManifest: resolved,
|
|
26851
27013
|
currentNetwork: () => applyNetworkOverrides(network, resolved()),
|
|
26852
|
-
currentGas: () => applyGasOverrides(resolved()?.gas),
|
|
27014
|
+
currentGas: () => applyGasOverrides(resolved()?.gas, chainGas ?? void 0),
|
|
26853
27015
|
async refresh() {
|
|
26854
27016
|
await pull(false);
|
|
26855
27017
|
},
|
|
@@ -27365,24 +27527,27 @@ async function buildClient(options, resolver) {
|
|
|
27365
27527
|
}
|
|
27366
27528
|
|
|
27367
27529
|
// src/rest/types.ts
|
|
27368
|
-
import { z as
|
|
27369
|
-
var PageResponseSchema =
|
|
27370
|
-
next_key:
|
|
27371
|
-
total:
|
|
27530
|
+
import { z as z3 } from "zod";
|
|
27531
|
+
var PageResponseSchema = z3.object({
|
|
27532
|
+
next_key: z3.preprocess((value) => value ?? void 0, z3.string().optional()),
|
|
27533
|
+
total: z3.preprocess((value) => value ?? void 0, z3.string().optional())
|
|
27372
27534
|
}).loose();
|
|
27373
27535
|
|
|
27374
27536
|
// src/rest/dex-types.generated.ts
|
|
27375
27537
|
import * as zod from "zod";
|
|
27376
27538
|
var GetHealthResponse = zod.object({
|
|
27377
|
-
status: zod.enum(["healthy"
|
|
27378
|
-
database: zod.enum(["ok", "unreachable"])
|
|
27539
|
+
status: zod.enum(["healthy"])
|
|
27379
27540
|
});
|
|
27380
27541
|
var GetReadyResponse = zod.object({
|
|
27381
|
-
status: zod.enum(["ready"
|
|
27542
|
+
status: zod.enum(["ready"])
|
|
27382
27543
|
});
|
|
27383
27544
|
var GetLiveResponse = zod.object({
|
|
27384
27545
|
status: zod.enum(["alive"])
|
|
27385
27546
|
});
|
|
27547
|
+
var GetDBReadyResponse = zod.object({
|
|
27548
|
+
status: zod.enum(["ok", "unavailable"]),
|
|
27549
|
+
database: zod.enum(["ok", "unreachable"])
|
|
27550
|
+
});
|
|
27386
27551
|
var GetStatusResponse = zod.object({
|
|
27387
27552
|
last_indexed_height: zod.number(),
|
|
27388
27553
|
last_indexed_at: zod.iso.datetime({})
|
|
@@ -27474,6 +27639,8 @@ var ListMarketsResponseItem = zod.object({
|
|
|
27474
27639
|
)
|
|
27475
27640
|
});
|
|
27476
27641
|
var ListMarketsResponse = zod.array(ListMarketsResponseItem);
|
|
27642
|
+
var listCurrenciesResponseInfoContractDecimalsMin = 0;
|
|
27643
|
+
var listCurrenciesResponseInfoContractDecimalsMax = 255;
|
|
27477
27644
|
var ListCurrenciesResponse = zod.record(
|
|
27478
27645
|
zod.string(),
|
|
27479
27646
|
zod.object({
|
|
@@ -27484,7 +27651,9 @@ var ListCurrenciesResponse = zod.record(
|
|
|
27484
27651
|
deposit: zod.boolean().nullish(),
|
|
27485
27652
|
withdraw: zod.boolean().nullish(),
|
|
27486
27653
|
fee: zod.number().nullish(),
|
|
27487
|
-
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
|
+
),
|
|
27488
27657
|
limits: zod.object({
|
|
27489
27658
|
amount: zod.object({
|
|
27490
27659
|
min: zod.number().nullish(),
|
|
@@ -27496,7 +27665,11 @@ var ListCurrenciesResponse = zod.record(
|
|
|
27496
27665
|
}).optional()
|
|
27497
27666
|
}),
|
|
27498
27667
|
networks: zod.looseObject({}).optional(),
|
|
27499
|
-
info: zod.
|
|
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
|
+
})
|
|
27500
27673
|
})
|
|
27501
27674
|
);
|
|
27502
27675
|
var GetTickerParams = zod.object({
|
|
@@ -27590,11 +27763,20 @@ var GetOrderbookResponse = zod.object({
|
|
|
27590
27763
|
var ListTradesParams = zod.object({
|
|
27591
27764
|
symbol: zod.string().describe("URL-encoded trading pair (e.g., `AULT%2FUSDT`)")
|
|
27592
27765
|
});
|
|
27593
|
-
var listTradesQueryLimitDefault =
|
|
27766
|
+
var listTradesQueryLimitDefault = 100;
|
|
27594
27767
|
var listTradesQueryLimitMax = 500;
|
|
27768
|
+
var listTradesQueryBeforeIndexMin = 0;
|
|
27769
|
+
var listTradesQueryBeforeIndexMax = 4294967295;
|
|
27595
27770
|
var ListTradesQueryParams = zod.object({
|
|
27596
27771
|
limit: zod.number().min(1).max(listTradesQueryLimitMax).default(listTradesQueryLimitDefault),
|
|
27597
|
-
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`.")
|
|
27598
27780
|
});
|
|
27599
27781
|
var listTradesResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
27600
27782
|
var listTradesResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
@@ -27604,6 +27786,7 @@ var listTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
|
27604
27786
|
var listTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
27605
27787
|
var listTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
27606
27788
|
var listTradesResponseInfoEventIndexMin = 0;
|
|
27789
|
+
var listTradesResponseInfoEventIndexMax = 4294967295;
|
|
27607
27790
|
var ListTradesResponseItem = zod.object({
|
|
27608
27791
|
id: zod.string(),
|
|
27609
27792
|
order: zod.string().nullish(),
|
|
@@ -27613,10 +27796,11 @@ var ListTradesResponseItem = zod.object({
|
|
|
27613
27796
|
type: zod.union([
|
|
27614
27797
|
zod.literal("limit"),
|
|
27615
27798
|
zod.literal("market"),
|
|
27799
|
+
zod.literal("twap"),
|
|
27616
27800
|
zod.literal("unknown"),
|
|
27617
27801
|
zod.literal(null)
|
|
27618
27802
|
]).nullish().describe(
|
|
27619
|
-
"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."
|
|
27620
27804
|
),
|
|
27621
27805
|
cloid: zod.string().nullish().describe(
|
|
27622
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)."
|
|
@@ -27650,8 +27834,8 @@ var ListTradesResponseItem = zod.object({
|
|
|
27650
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"
|
|
27651
27835
|
),
|
|
27652
27836
|
block_height: zod.string().regex(listTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
|
|
27653
|
-
event_index: zod.number().min(listTradesResponseInfoEventIndexMin).describe(
|
|
27654
|
-
"The trade's event position within its block.
|
|
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"
|
|
27655
27839
|
)
|
|
27656
27840
|
}).describe(
|
|
27657
27841
|
"Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
|
|
@@ -27677,6 +27861,7 @@ var getTradeResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
|
27677
27861
|
var getTradeResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
27678
27862
|
var getTradeResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
27679
27863
|
var getTradeResponseInfoEventIndexMin = 0;
|
|
27864
|
+
var getTradeResponseInfoEventIndexMax = 4294967295;
|
|
27680
27865
|
var GetTradeResponse = zod.object({
|
|
27681
27866
|
id: zod.string(),
|
|
27682
27867
|
order: zod.string().nullish(),
|
|
@@ -27686,10 +27871,11 @@ var GetTradeResponse = zod.object({
|
|
|
27686
27871
|
type: zod.union([
|
|
27687
27872
|
zod.literal("limit"),
|
|
27688
27873
|
zod.literal("market"),
|
|
27874
|
+
zod.literal("twap"),
|
|
27689
27875
|
zod.literal("unknown"),
|
|
27690
27876
|
zod.literal(null)
|
|
27691
27877
|
]).nullish().describe(
|
|
27692
|
-
"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."
|
|
27693
27879
|
),
|
|
27694
27880
|
cloid: zod.string().nullish().describe(
|
|
27695
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)."
|
|
@@ -27723,8 +27909,8 @@ var GetTradeResponse = zod.object({
|
|
|
27723
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"
|
|
27724
27910
|
),
|
|
27725
27911
|
block_height: zod.string().regex(getTradeResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
|
|
27726
|
-
event_index: zod.number().min(getTradeResponseInfoEventIndexMin).describe(
|
|
27727
|
-
"The trade's event position within its block.
|
|
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"
|
|
27728
27914
|
)
|
|
27729
27915
|
}).describe(
|
|
27730
27916
|
"Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
|
|
@@ -27746,7 +27932,7 @@ var GetTradingFeesResponse = zod.record(
|
|
|
27746
27932
|
})
|
|
27747
27933
|
);
|
|
27748
27934
|
var GetStatsQueryParams = zod.object({
|
|
27749
|
-
window: zod.enum(["24h"]).optional().describe("
|
|
27935
|
+
window: zod.enum(["24h", "7d", "30d", "all"]).optional().describe("Precomputed reporting window. Defaults to `24h`.")
|
|
27750
27936
|
});
|
|
27751
27937
|
var getStatsResponseTotalsQuoteVolumeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
27752
27938
|
var getStatsResponseTotalsEstimatedFeeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
@@ -27758,7 +27944,7 @@ var getStatsResponseMarketsItemBaseVolumeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$
|
|
|
27758
27944
|
var getStatsResponseMarketsItemEstimatedFeeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
27759
27945
|
var getStatsResponseMarketsItemTakerFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
27760
27946
|
var GetStatsResponse = zod.object({
|
|
27761
|
-
window: zod.enum(["24h"]),
|
|
27947
|
+
window: zod.enum(["24h", "7d", "30d", "all"]),
|
|
27762
27948
|
totals: zod.object({
|
|
27763
27949
|
quoteVolume: zod.string().regex(getStatsResponseTotalsQuoteVolumeRegExp).nullable().describe(
|
|
27764
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"
|
|
@@ -27773,12 +27959,12 @@ var GetStatsResponse = zod.object({
|
|
|
27773
27959
|
traderCount: zod.number().describe("Distinct trading addresses in the window."),
|
|
27774
27960
|
activeMarkets: zod.number().describe("Number of markets with at least one fill in the window."),
|
|
27775
27961
|
dailyActiveUsers: zod.number().nullable().describe(
|
|
27776
|
-
"Distinct trading addresses
|
|
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"
|
|
27777
27963
|
),
|
|
27778
27964
|
averageSlippageBps: zod.string().regex(getStatsResponseTotalsAverageSlippageBpsRegExp).nullable().describe(
|
|
27779
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"
|
|
27780
27966
|
),
|
|
27781
|
-
depositUsdcVolume24h: zod.string().regex(getStatsResponseTotalsDepositUsdcVolume24hRegExp).nullable().describe("
|
|
27967
|
+
depositUsdcVolume24h: zod.string().regex(getStatsResponseTotalsDepositUsdcVolume24hRegExp).nullable().describe("24h USDC deposit volume when available; null for longer windows."),
|
|
27782
27968
|
builderCodesFee24h: zod.string().regex(getStatsResponseTotalsBuilderCodesFee24hRegExp).nullable().describe("Reserved. Currently always null.")
|
|
27783
27969
|
}).describe("Protocol-wide aggregates for the window."),
|
|
27784
27970
|
markets: zod.array(
|
|
@@ -27800,8 +27986,8 @@ var listOrdersQueryAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
|
27800
27986
|
var listOrdersQueryAddressTwoRegExp = new RegExp("^0x[a-f0-9]{40}$");
|
|
27801
27987
|
var listOrdersQueryMarketIdRegExp = new RegExp("^[0-9a-fA-F]+$");
|
|
27802
27988
|
var listOrdersQueryCloidRegExp = new RegExp("^([0-9a-fA-F]{16})?$");
|
|
27803
|
-
var listOrdersQueryLimitDefault =
|
|
27804
|
-
var listOrdersQueryLimitMax =
|
|
27989
|
+
var listOrdersQueryLimitDefault = 100;
|
|
27990
|
+
var listOrdersQueryLimitMax = 500;
|
|
27805
27991
|
var ListOrdersQueryParams = zod.object({
|
|
27806
27992
|
address: zod.union([
|
|
27807
27993
|
zod.string().regex(listOrdersQueryAddressOneRegExp).describe(
|
|
@@ -27820,7 +28006,10 @@ var ListOrdersQueryParams = zod.object({
|
|
|
27820
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"
|
|
27821
28007
|
),
|
|
27822
28008
|
since: zod.number().optional().describe("Return orders created after this Unix timestamp (milliseconds)"),
|
|
27823
|
-
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
|
+
)
|
|
27824
28013
|
});
|
|
27825
28014
|
var listOrdersResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
27826
28015
|
var listOrdersResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
@@ -27841,8 +28030,12 @@ var ListOrdersResponseItem = zod.object({
|
|
|
27841
28030
|
lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
|
|
27842
28031
|
status: zod.enum(["open", "closed", "canceled", "unknown"]).describe("`unknown` is the fallback for a chain status code the API doesn't recognize."),
|
|
27843
28032
|
symbol: zod.string(),
|
|
27844
|
-
type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
|
|
27845
|
-
|
|
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
|
+
),
|
|
27846
28039
|
side: zod.enum(["buy", "sell"]),
|
|
27847
28040
|
price: zod.string().regex(listOrdersResponsePriceRegExp),
|
|
27848
28041
|
average: zod.string().nullish().describe("Average execution price as decimal string. Null when filled is 0."),
|
|
@@ -27884,10 +28077,10 @@ var ListOrdersResponseItem = zod.object({
|
|
|
27884
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"
|
|
27885
28078
|
),
|
|
27886
28079
|
chain_type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
|
|
27887
|
-
"Granular chain-level order type.
|
|
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"
|
|
27888
28081
|
),
|
|
27889
|
-
close_reason: zod.string().
|
|
27890
|
-
"Free-form chain close reason for a terminal order \u2014 e.g.\n`completed`, `canceled`, `expired`, `ioc_canceled`, `
|
|
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"
|
|
27891
28084
|
)
|
|
27892
28085
|
}).describe(
|
|
27893
28086
|
"Exchange-specific extension on `OrderResponse`. Mirrors the\n`info` map populated in `internal/domain/order/service.go`.\n"
|
|
@@ -27918,8 +28111,12 @@ var GetOrderResponse = zod.object({
|
|
|
27918
28111
|
lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
|
|
27919
28112
|
status: zod.enum(["open", "closed", "canceled", "unknown"]).describe("`unknown` is the fallback for a chain status code the API doesn't recognize."),
|
|
27920
28113
|
symbol: zod.string(),
|
|
27921
|
-
type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
|
|
27922
|
-
|
|
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
|
+
),
|
|
27923
28120
|
side: zod.enum(["buy", "sell"]),
|
|
27924
28121
|
price: zod.string().regex(getOrderResponsePriceRegExp),
|
|
27925
28122
|
average: zod.string().nullish().describe("Average execution price as decimal string. Null when filled is 0."),
|
|
@@ -27961,10 +28158,10 @@ var GetOrderResponse = zod.object({
|
|
|
27961
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"
|
|
27962
28159
|
),
|
|
27963
28160
|
chain_type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
|
|
27964
|
-
"Granular chain-level order type.
|
|
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"
|
|
27965
28162
|
),
|
|
27966
|
-
close_reason: zod.string().
|
|
27967
|
-
"Free-form chain close reason for a terminal order \u2014 e.g.\n`completed`, `canceled`, `expired`, `ioc_canceled`, `
|
|
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"
|
|
27968
28165
|
)
|
|
27969
28166
|
}).describe(
|
|
27970
28167
|
"Exchange-specific extension on `OrderResponse`. Mirrors the\n`info` map populated in `internal/domain/order/service.go`.\n"
|
|
@@ -27972,13 +28169,22 @@ var GetOrderResponse = zod.object({
|
|
|
27972
28169
|
}).describe(
|
|
27973
28170
|
"All numeric fields (price, amount, filled, remaining, cost,\nfee.cost, fee.rate, average, triggerPrice, stopPrice) are canonical\ndecimal strings.\n"
|
|
27974
28171
|
);
|
|
27975
|
-
var listMyTradesQueryLimitDefault =
|
|
28172
|
+
var listMyTradesQueryLimitDefault = 100;
|
|
27976
28173
|
var listMyTradesQueryLimitMax = 500;
|
|
28174
|
+
var listMyTradesQueryBeforeIndexMin = 0;
|
|
28175
|
+
var listMyTradesQueryBeforeIndexMax = 4294967295;
|
|
27977
28176
|
var ListMyTradesQueryParams = zod.object({
|
|
27978
28177
|
address: zod.string().describe("Blockchain address of the trader"),
|
|
27979
28178
|
symbol: zod.string().optional().describe("Symbol to filter by (e.g., AULT/USDT)"),
|
|
27980
28179
|
since: zod.number().optional().describe("Unix timestamp in milliseconds"),
|
|
27981
|
-
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`.")
|
|
27982
28188
|
});
|
|
27983
28189
|
var listMyTradesResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
27984
28190
|
var listMyTradesResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
@@ -27988,6 +28194,7 @@ var listMyTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
|
27988
28194
|
var listMyTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
27989
28195
|
var listMyTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
27990
28196
|
var listMyTradesResponseInfoEventIndexMin = 0;
|
|
28197
|
+
var listMyTradesResponseInfoEventIndexMax = 4294967295;
|
|
27991
28198
|
var ListMyTradesResponseItem = zod.object({
|
|
27992
28199
|
id: zod.string(),
|
|
27993
28200
|
order: zod.string().nullish(),
|
|
@@ -27997,10 +28204,11 @@ var ListMyTradesResponseItem = zod.object({
|
|
|
27997
28204
|
type: zod.union([
|
|
27998
28205
|
zod.literal("limit"),
|
|
27999
28206
|
zod.literal("market"),
|
|
28207
|
+
zod.literal("twap"),
|
|
28000
28208
|
zod.literal("unknown"),
|
|
28001
28209
|
zod.literal(null)
|
|
28002
28210
|
]).nullish().describe(
|
|
28003
|
-
"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."
|
|
28004
28212
|
),
|
|
28005
28213
|
cloid: zod.string().nullish().describe(
|
|
28006
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)."
|
|
@@ -28034,8 +28242,8 @@ var ListMyTradesResponseItem = zod.object({
|
|
|
28034
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"
|
|
28035
28243
|
),
|
|
28036
28244
|
block_height: zod.string().regex(listMyTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
|
|
28037
|
-
event_index: zod.number().min(listMyTradesResponseInfoEventIndexMin).describe(
|
|
28038
|
-
"The trade's event position within its block.
|
|
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"
|
|
28039
28247
|
)
|
|
28040
28248
|
}).describe(
|
|
28041
28249
|
"Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
|
|
@@ -28064,12 +28272,17 @@ var GetOHLCVParams = zod.object({
|
|
|
28064
28272
|
symbol: zod.string().describe("URL-encoded trading pair (e.g., `AULT%2FUSDT`)")
|
|
28065
28273
|
});
|
|
28066
28274
|
var getOHLCVQueryTimeframeDefault = `1m`;
|
|
28067
|
-
var getOHLCVQueryLimitDefault =
|
|
28275
|
+
var getOHLCVQueryLimitDefault = 500;
|
|
28068
28276
|
var getOHLCVQueryLimitMax = 1e3;
|
|
28069
28277
|
var GetOHLCVQueryParams = zod.object({
|
|
28070
28278
|
timeframe: zod.string().default(getOHLCVQueryTimeframeDefault).describe("Timeframe: 1m, 5m, 15m, 30m, 1h, 4h, 1d. Also accepts TV format: 1, 5, 15, 60, 1D"),
|
|
28071
|
-
limit: zod.number().min(1).max(getOHLCVQueryLimitMax).default(getOHLCVQueryLimitDefault)
|
|
28072
|
-
|
|
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
|
+
)
|
|
28073
28286
|
});
|
|
28074
28287
|
var GetOHLCVResponseItem = zod.tuple([
|
|
28075
28288
|
zod.number().describe("timestamp in milliseconds"),
|
|
@@ -28147,7 +28360,7 @@ var GetUDFHistoryQueryParams = zod.object({
|
|
|
28147
28360
|
resolution: zod.enum(["1", "5", "15", "30", "60", "1D", "1W", "1M"]),
|
|
28148
28361
|
from: zod.number().describe("Unix seconds"),
|
|
28149
28362
|
to: zod.number().describe("Unix seconds"),
|
|
28150
|
-
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.")
|
|
28151
28364
|
});
|
|
28152
28365
|
var GetUDFHistoryResponse = zod.object({
|
|
28153
28366
|
s: zod.enum(["ok", "no_data", "error"]),
|
|
@@ -28161,7 +28374,7 @@ var GetUDFHistoryResponse = zod.object({
|
|
|
28161
28374
|
nextTime: zod.number().optional().describe('Unix seconds of next available bar (when s = "no_data")')
|
|
28162
28375
|
});
|
|
28163
28376
|
var GetUDFQuotesQueryParams = zod.object({
|
|
28164
|
-
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)")
|
|
28165
28378
|
});
|
|
28166
28379
|
var GetUDFQuotesResponse = zod.object({
|
|
28167
28380
|
s: zod.enum(["ok", "error"]),
|
|
@@ -28224,7 +28437,7 @@ function createDexWs(url, options) {
|
|
|
28224
28437
|
}
|
|
28225
28438
|
|
|
28226
28439
|
// src/index.ts
|
|
28227
|
-
var SDK_VERSION = "0.
|
|
28440
|
+
var SDK_VERSION = "0.7.0";
|
|
28228
28441
|
export {
|
|
28229
28442
|
AGENT_DEFAULTS,
|
|
28230
28443
|
AULT_SIGNER_MARKER,
|
|
@@ -28242,6 +28455,7 @@ export {
|
|
|
28242
28455
|
GetAllTickersResponse,
|
|
28243
28456
|
GetBalanceQueryParams,
|
|
28244
28457
|
GetBalanceResponse,
|
|
28458
|
+
GetDBReadyResponse,
|
|
28245
28459
|
GetHealthResponse,
|
|
28246
28460
|
GetLiveResponse,
|
|
28247
28461
|
GetOHLCVParams,
|
|
@@ -28298,6 +28512,7 @@ export {
|
|
|
28298
28512
|
MarketType,
|
|
28299
28513
|
MissingMsgResponseError,
|
|
28300
28514
|
NETWORKS,
|
|
28515
|
+
NEXT_CURSOR_HEADER,
|
|
28301
28516
|
NetworkError,
|
|
28302
28517
|
ORDER_ID_LENGTH,
|
|
28303
28518
|
OrderId,
|
|
@@ -28333,6 +28548,7 @@ export {
|
|
|
28333
28548
|
buildEip712TypedData,
|
|
28334
28549
|
buildFetchOptions,
|
|
28335
28550
|
bytesToBase64,
|
|
28551
|
+
collectPages,
|
|
28336
28552
|
computeEvmFeesPerGas,
|
|
28337
28553
|
computeFeeFreeGas,
|
|
28338
28554
|
computeFeeFreeGasCompound,
|
|
@@ -28381,6 +28597,7 @@ export {
|
|
|
28381
28597
|
encodeTxRaw,
|
|
28382
28598
|
evmToAult,
|
|
28383
28599
|
fetchAllPaginatedProto,
|
|
28600
|
+
fetchFeeFreeGasLimits,
|
|
28384
28601
|
fetchFeeMarketParams,
|
|
28385
28602
|
fetchJson,
|
|
28386
28603
|
fetchManifest,
|
|
@@ -28427,6 +28644,7 @@ export {
|
|
|
28427
28644
|
getTradeResponseFeeRateRegExp,
|
|
28428
28645
|
getTradeResponseInfoAddressOneRegExp,
|
|
28429
28646
|
getTradeResponseInfoBlockHeightRegExp,
|
|
28647
|
+
getTradeResponseInfoEventIndexMax,
|
|
28430
28648
|
getTradeResponseInfoEventIndexMin,
|
|
28431
28649
|
getTradeResponsePriceRegExp,
|
|
28432
28650
|
getTradingFeesResponseMakerRegExp,
|
|
@@ -28437,9 +28655,13 @@ export {
|
|
|
28437
28655
|
isValidAultAddress,
|
|
28438
28656
|
isValidEvmAddress,
|
|
28439
28657
|
isValidValidatorAddress,
|
|
28658
|
+
listCurrenciesResponseInfoContractDecimalsMax,
|
|
28659
|
+
listCurrenciesResponseInfoContractDecimalsMin,
|
|
28440
28660
|
listMarketsResponseInfoEscrowAddressOneRegExp,
|
|
28441
28661
|
listMarketsResponseMakerRegExp,
|
|
28442
28662
|
listMarketsResponseTakerRegExp,
|
|
28663
|
+
listMyTradesQueryBeforeIndexMax,
|
|
28664
|
+
listMyTradesQueryBeforeIndexMin,
|
|
28443
28665
|
listMyTradesQueryLimitDefault,
|
|
28444
28666
|
listMyTradesQueryLimitMax,
|
|
28445
28667
|
listMyTradesResponseAmountRegExp,
|
|
@@ -28448,6 +28670,7 @@ export {
|
|
|
28448
28670
|
listMyTradesResponseFeeRateRegExp,
|
|
28449
28671
|
listMyTradesResponseInfoAddressOneRegExp,
|
|
28450
28672
|
listMyTradesResponseInfoBlockHeightRegExp,
|
|
28673
|
+
listMyTradesResponseInfoEventIndexMax,
|
|
28451
28674
|
listMyTradesResponseInfoEventIndexMin,
|
|
28452
28675
|
listMyTradesResponsePriceRegExp,
|
|
28453
28676
|
listOrdersQueryAddressOneRegExp,
|
|
@@ -28465,6 +28688,8 @@ export {
|
|
|
28465
28688
|
listOrdersResponseInfoRemainingDepositRegExp,
|
|
28466
28689
|
listOrdersResponsePriceRegExp,
|
|
28467
28690
|
listOrdersResponseRemainingRegExp,
|
|
28691
|
+
listTradesQueryBeforeIndexMax,
|
|
28692
|
+
listTradesQueryBeforeIndexMin,
|
|
28468
28693
|
listTradesQueryLimitDefault,
|
|
28469
28694
|
listTradesQueryLimitMax,
|
|
28470
28695
|
listTradesResponseAmountRegExp,
|
|
@@ -28473,6 +28698,7 @@ export {
|
|
|
28473
28698
|
listTradesResponseFeeRateRegExp,
|
|
28474
28699
|
listTradesResponseInfoAddressOneRegExp,
|
|
28475
28700
|
listTradesResponseInfoBlockHeightRegExp,
|
|
28701
|
+
listTradesResponseInfoEventIndexMax,
|
|
28476
28702
|
listTradesResponseInfoEventIndexMin,
|
|
28477
28703
|
listTradesResponsePriceRegExp,
|
|
28478
28704
|
mergeManifests,
|
|
@@ -28480,6 +28706,7 @@ export {
|
|
|
28480
28706
|
normalizeSignature,
|
|
28481
28707
|
normalizeSigner,
|
|
28482
28708
|
normalizeTxHash,
|
|
28709
|
+
paginate,
|
|
28483
28710
|
paginateAll,
|
|
28484
28711
|
parseEvmChainIdFromCosmosChainId,
|
|
28485
28712
|
pollTxInclusion,
|