ault-sdk-ts 0.0.2-alpha.21 → 0.0.2-alpha.22
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/README.md +10 -0
- package/dist/index.cjs +103 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +92 -3
- package/dist/index.js.map +1 -1
- package/dist/rest/dex-types.generated.d.ts +74 -1
- package/dist/rest/dex.d.ts +1 -0
- package/dist/rest/dex.generated.d.ts +179 -4
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ contract.
|
|
|
23
23
|
|
|
24
24
|
All timestamps are in milliseconds unless noted otherwise.
|
|
25
25
|
|
|
26
|
-
* OpenAPI spec version: 2.
|
|
26
|
+
* OpenAPI spec version: 2.3.0
|
|
27
27
|
*/
|
|
28
28
|
import * as zod from "zod";
|
|
29
29
|
/**
|
|
@@ -404,6 +404,79 @@ export declare const GetTradingFeesResponse: zod.ZodRecord<zod.ZodString, zod.Zo
|
|
|
404
404
|
tierBased: zod.ZodBoolean;
|
|
405
405
|
info: zod.ZodObject<{}, zod.z.core.$loose>;
|
|
406
406
|
}, zod.z.core.$strip>>;
|
|
407
|
+
/**
|
|
408
|
+
* Returns the protocol-wide stats overview for a rolling window:
|
|
409
|
+
total quote volume, an estimated-fee figure, trade and trader counts,
|
|
410
|
+
active-market count, an approximate daily-active-users figure, an
|
|
411
|
+
average taker slippage, and a per-market breakdown.
|
|
412
|
+
|
|
413
|
+
Volume comes from the same `price_history` source and 24h-window cutoff
|
|
414
|
+
the ticker bar aggregates from (both bound DB-side via
|
|
415
|
+
`NOW() - INTERVAL`), so the stats total uses the same formula as the
|
|
416
|
+
ticker. `estimatedFee` is `quoteVolume × takerFeeRate`, an estimate from
|
|
417
|
+
the fee schedule rather than booked revenue. `dailyActiveUsers` is the
|
|
418
|
+
count of distinct trading addresses in the window (active traders);
|
|
419
|
+
currently an exact alias of `traderCount`, carried as a separate field
|
|
420
|
+
so a future precise DAU source can diverge without an API change.
|
|
421
|
+
`averageSlippageBps` is the volume-weighted taker fill vs book-mid in
|
|
422
|
+
basis points, scoped to symbol-mapped markets (a benchmarked fill on a
|
|
423
|
+
market absent from the symbol map does not contribute). It is null when
|
|
424
|
+
the window has no benchmarkable taker fill on a mapped market or when the
|
|
425
|
+
contributing fills span more than one quote asset (it never mixes
|
|
426
|
+
notionals across quotes). `depositUsdcVolume24h` and `builderCodesFee24h`
|
|
427
|
+
are reserved and currently always null.
|
|
428
|
+
|
|
429
|
+
Reconciliation note: `tradeCount` and `traderCount` are computed book-wide
|
|
430
|
+
over the window, while `quoteVolume`, `estimatedFee`, `averageSlippageBps`,
|
|
431
|
+
`markets[]`, and `activeMarkets` cover only markets present in the symbol
|
|
432
|
+
map. During symbol-map lag or right after a market is listed, the two need
|
|
433
|
+
not reconcile (the sum of per-market trade counts can trail
|
|
434
|
+
`totals.tradeCount`, and a benchmarked fill on an unmapped market is
|
|
435
|
+
excluded from the book-wide slippage figure).
|
|
436
|
+
|
|
437
|
+
* @summary Protocol stats overview
|
|
438
|
+
*/
|
|
439
|
+
export declare const GetStatsQueryParams: zod.ZodObject<{
|
|
440
|
+
window: zod.ZodOptional<zod.ZodEnum<{
|
|
441
|
+
"24h": "24h";
|
|
442
|
+
}>>;
|
|
443
|
+
}, zod.z.core.$strip>;
|
|
444
|
+
export declare const getStatsResponseTotalsQuoteVolumeRegExp: RegExp;
|
|
445
|
+
export declare const getStatsResponseTotalsEstimatedFeeRegExp: RegExp;
|
|
446
|
+
export declare const getStatsResponseTotalsAverageSlippageBpsRegExp: RegExp;
|
|
447
|
+
export declare const getStatsResponseTotalsDepositUsdcVolume24hRegExp: RegExp;
|
|
448
|
+
export declare const getStatsResponseTotalsBuilderCodesFee24hRegExp: RegExp;
|
|
449
|
+
export declare const getStatsResponseMarketsItemQuoteVolumeRegExp: RegExp;
|
|
450
|
+
export declare const getStatsResponseMarketsItemBaseVolumeRegExp: RegExp;
|
|
451
|
+
export declare const getStatsResponseMarketsItemEstimatedFeeRegExp: RegExp;
|
|
452
|
+
export declare const getStatsResponseMarketsItemTakerFeeRateRegExp: RegExp;
|
|
453
|
+
export declare const GetStatsResponse: zod.ZodObject<{
|
|
454
|
+
window: zod.ZodEnum<{
|
|
455
|
+
"24h": "24h";
|
|
456
|
+
}>;
|
|
457
|
+
totals: zod.ZodObject<{
|
|
458
|
+
quoteVolume: zod.ZodNullable<zod.ZodString>;
|
|
459
|
+
quoteAsset: zod.ZodNullable<zod.ZodString>;
|
|
460
|
+
estimatedFee: zod.ZodNullable<zod.ZodString>;
|
|
461
|
+
tradeCount: zod.ZodNumber;
|
|
462
|
+
traderCount: zod.ZodNumber;
|
|
463
|
+
activeMarkets: zod.ZodNumber;
|
|
464
|
+
dailyActiveUsers: zod.ZodNullable<zod.ZodNumber>;
|
|
465
|
+
averageSlippageBps: zod.ZodNullable<zod.ZodString>;
|
|
466
|
+
depositUsdcVolume24h: zod.ZodNullable<zod.ZodString>;
|
|
467
|
+
builderCodesFee24h: zod.ZodNullable<zod.ZodString>;
|
|
468
|
+
}, zod.z.core.$strip>;
|
|
469
|
+
markets: zod.ZodArray<zod.ZodObject<{
|
|
470
|
+
symbol: zod.ZodString;
|
|
471
|
+
base: zod.ZodString;
|
|
472
|
+
quote: zod.ZodString;
|
|
473
|
+
quoteVolume: zod.ZodString;
|
|
474
|
+
baseVolume: zod.ZodString;
|
|
475
|
+
estimatedFee: zod.ZodString;
|
|
476
|
+
tradeCount: zod.ZodNumber;
|
|
477
|
+
takerFeeRate: zod.ZodString;
|
|
478
|
+
}, zod.z.core.$strip>>;
|
|
479
|
+
}, zod.z.core.$strip>;
|
|
407
480
|
/**
|
|
408
481
|
* Returns the orders that belong to `address`, optionally filtered
|
|
409
482
|
by status, symbol, market id, and creation time. The endpoint
|
package/dist/rest/dex.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare function createDexApi(context: RestContext): {
|
|
|
22
22
|
getOrder: (id: string, options?: RequestInit) => Promise<import("./dex.generated").getOrderResponse>;
|
|
23
23
|
listMyTrades: (params: import("./dex.generated").ListMyTradesParams, options?: RequestInit) => Promise<import("./dex.generated").listMyTradesResponse>;
|
|
24
24
|
getBalance: (params: import("./dex.generated").GetBalanceParams, options?: RequestInit) => Promise<import("./dex.generated").getBalanceResponse>;
|
|
25
|
+
getStats: (params?: import("./dex.generated").GetStatsParams, options?: RequestInit) => Promise<import("./dex.generated").getStatsResponse>;
|
|
25
26
|
getUDFConfig: (options?: RequestInit) => Promise<import("./dex.generated").getUDFConfigResponse>;
|
|
26
27
|
getUDFTime: (options?: RequestInit) => Promise<import("./dex.generated").getUDFTimeResponse>;
|
|
27
28
|
getUDFSymbol: (params: import("./dex.generated").GetUDFSymbolParams, options?: RequestInit) => Promise<import("./dex.generated").getUDFSymbolResponse>;
|
|
@@ -327,6 +327,114 @@ export interface TradingFeeResponse {
|
|
|
327
327
|
tierBased: boolean;
|
|
328
328
|
info: TradingFeeResponseInfo;
|
|
329
329
|
}
|
|
330
|
+
export type StatsResponseWindow = (typeof StatsResponseWindow)[keyof typeof StatsResponseWindow];
|
|
331
|
+
export declare const StatsResponseWindow: {
|
|
332
|
+
readonly "24h": "24h";
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Protocol-wide aggregates for the window.
|
|
336
|
+
*/
|
|
337
|
+
export interface StatsTotals {
|
|
338
|
+
/**
|
|
339
|
+
* Total quote volume over the window as a canonical decimal string.
|
|
340
|
+
Null when the markets that had volume span more than one quote
|
|
341
|
+
asset, since summing notionals in different quotes is meaningless —
|
|
342
|
+
`quoteVolume`, `estimatedFee`, and `quoteAsset` are null together in
|
|
343
|
+
that case.
|
|
344
|
+
|
|
345
|
+
* @nullable
|
|
346
|
+
* @pattern ^-?\d+(\.\d+)?$
|
|
347
|
+
*/
|
|
348
|
+
quoteVolume: string | null;
|
|
349
|
+
/**
|
|
350
|
+
* The shared quote asset ticker of the markets that had volume in the
|
|
351
|
+
window. Null in two cases: when those markets span more than one
|
|
352
|
+
quote (then `quoteVolume` and `estimatedFee` are also null), or when
|
|
353
|
+
no market had volume in the window (an idle window — then
|
|
354
|
+
`quoteVolume` and `estimatedFee` are "0" rather than null, since a
|
|
355
|
+
zero total is well-defined regardless of quote). To distinguish the
|
|
356
|
+
two null causes, read `quoteVolume`: null means multi-quote, "0"
|
|
357
|
+
means idle.
|
|
358
|
+
|
|
359
|
+
* @nullable
|
|
360
|
+
*/
|
|
361
|
+
quoteAsset: string | null;
|
|
362
|
+
/**
|
|
363
|
+
* Estimated total fees (`Σ quoteVolume × takerFeeRate`) as a canonical
|
|
364
|
+
decimal string. An estimate from the fee schedule, not booked
|
|
365
|
+
revenue. Null when the markets that had volume span more than one
|
|
366
|
+
quote (see `quoteVolume`).
|
|
367
|
+
|
|
368
|
+
* @nullable
|
|
369
|
+
* @pattern ^-?\d+(\.\d+)?$
|
|
370
|
+
*/
|
|
371
|
+
estimatedFee: string | null;
|
|
372
|
+
/** Number of fills (maker legs) in the window. */
|
|
373
|
+
tradeCount: number;
|
|
374
|
+
/** Distinct trading addresses in the window. */
|
|
375
|
+
traderCount: number;
|
|
376
|
+
/** Number of markets with at least one fill in the window. */
|
|
377
|
+
activeMarkets: number;
|
|
378
|
+
/**
|
|
379
|
+
* Distinct trading addresses in the window (active-traders
|
|
380
|
+
approximation). Currently an exact alias of `traderCount`; carried
|
|
381
|
+
as a separate nullable field so a future precise DAU source can
|
|
382
|
+
diverge without an API change. Never null today.
|
|
383
|
+
|
|
384
|
+
* @nullable
|
|
385
|
+
*/
|
|
386
|
+
dailyActiveUsers: number | null;
|
|
387
|
+
/**
|
|
388
|
+
* Volume-weighted taker slippage (fill vs book-mid) in basis points as
|
|
389
|
+
a canonical decimal string. Null when the window has no taker fill
|
|
390
|
+
with a snapshot to benchmark against, or when benchmarked fills span
|
|
391
|
+
more than one quote asset (the weights are quote-denominated, so a
|
|
392
|
+
single figure across quotes would mix notionals).
|
|
393
|
+
|
|
394
|
+
* @nullable
|
|
395
|
+
* @pattern ^-?\d+(\.\d+)?$
|
|
396
|
+
*/
|
|
397
|
+
averageSlippageBps: string | null;
|
|
398
|
+
/**
|
|
399
|
+
* Reserved. Currently always null.
|
|
400
|
+
* @nullable
|
|
401
|
+
* @pattern ^-?\d+(\.\d+)?$
|
|
402
|
+
*/
|
|
403
|
+
depositUsdcVolume24h: string | null;
|
|
404
|
+
/**
|
|
405
|
+
* Reserved. Currently always null.
|
|
406
|
+
* @nullable
|
|
407
|
+
* @pattern ^-?\d+(\.\d+)?$
|
|
408
|
+
*/
|
|
409
|
+
builderCodesFee24h: string | null;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Per-market aggregates for the window.
|
|
413
|
+
*/
|
|
414
|
+
export interface MarketStats {
|
|
415
|
+
symbol: string;
|
|
416
|
+
base: string;
|
|
417
|
+
quote: string;
|
|
418
|
+
/** @pattern ^-?\d+(\.\d+)?$ */
|
|
419
|
+
quoteVolume: string;
|
|
420
|
+
/** @pattern ^-?\d+(\.\d+)?$ */
|
|
421
|
+
baseVolume: string;
|
|
422
|
+
/** @pattern ^-?\d+(\.\d+)?$ */
|
|
423
|
+
estimatedFee: string;
|
|
424
|
+
tradeCount: number;
|
|
425
|
+
/** @pattern ^-?\d+(\.\d+)?$ */
|
|
426
|
+
takerFeeRate: string;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Protocol stats overview for a rolling window. Monetary fields are
|
|
430
|
+
canonical decimal strings; counts are integers.
|
|
431
|
+
|
|
432
|
+
*/
|
|
433
|
+
export interface StatsResponse {
|
|
434
|
+
window: StatsResponseWindow;
|
|
435
|
+
totals: StatsTotals;
|
|
436
|
+
markets: MarketStats[];
|
|
437
|
+
}
|
|
330
438
|
export type TickerResponseInfo = {
|
|
331
439
|
[key: string]: unknown;
|
|
332
440
|
};
|
|
@@ -515,8 +623,8 @@ export type OrderResponseTradesItem = {
|
|
|
515
623
|
* Fee for the order. `cost` is `cost * taker_fee_rate` — applied to
|
|
516
624
|
the realized cost above, so it is more accurate than the previous
|
|
517
625
|
`filled * price * taker_fee_rate` approximation. The rate is the
|
|
518
|
-
market's taker rate;
|
|
519
|
-
|
|
626
|
+
market's taker rate; this stays an estimate because the indexer
|
|
627
|
+
records no realized per-trade fee amount to sum.
|
|
520
628
|
|
|
521
629
|
*/
|
|
522
630
|
export type OrderResponseFee = {
|
|
@@ -590,8 +698,8 @@ export interface OrderResponse {
|
|
|
590
698
|
/** Fee for the order. `cost` is `cost * taker_fee_rate` — applied to
|
|
591
699
|
the realized cost above, so it is more accurate than the previous
|
|
592
700
|
`filled * price * taker_fee_rate` approximation. The rate is the
|
|
593
|
-
market's taker rate;
|
|
594
|
-
|
|
701
|
+
market's taker rate; this stays an estimate because the indexer
|
|
702
|
+
records no realized per-trade fee amount to sum.
|
|
595
703
|
*/
|
|
596
704
|
fee?: OrderResponseFee;
|
|
597
705
|
reduceOnly?: boolean;
|
|
@@ -849,6 +957,16 @@ export type ListTradesParams = {
|
|
|
849
957
|
export type GetTradingFees200 = {
|
|
850
958
|
[key: string]: TradingFeeResponse;
|
|
851
959
|
};
|
|
960
|
+
export type GetStatsParams = {
|
|
961
|
+
/**
|
|
962
|
+
* Rolling window. Only `24h` is supported; defaults to `24h`.
|
|
963
|
+
*/
|
|
964
|
+
window?: GetStatsWindow;
|
|
965
|
+
};
|
|
966
|
+
export type GetStatsWindow = (typeof GetStatsWindow)[keyof typeof GetStatsWindow];
|
|
967
|
+
export declare const GetStatsWindow: {
|
|
968
|
+
readonly "24h": "24h";
|
|
969
|
+
};
|
|
852
970
|
export type ListOrdersParams = {
|
|
853
971
|
/**
|
|
854
972
|
* Account address. Accepts either bech32 (`ault1...`) or 0x-hex
|
|
@@ -1313,6 +1431,63 @@ export type getTradingFeesResponseError = (getTradingFeesResponse429 | getTradin
|
|
|
1313
1431
|
export type getTradingFeesResponse = getTradingFeesResponseSuccess | getTradingFeesResponseError;
|
|
1314
1432
|
export declare const getGetTradingFeesUrl: () => string;
|
|
1315
1433
|
export declare const getTradingFees: (options?: RequestInit) => Promise<getTradingFeesResponse>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Returns the protocol-wide stats overview for a rolling window:
|
|
1436
|
+
total quote volume, an estimated-fee figure, trade and trader counts,
|
|
1437
|
+
active-market count, an approximate daily-active-users figure, an
|
|
1438
|
+
average taker slippage, and a per-market breakdown.
|
|
1439
|
+
|
|
1440
|
+
Volume comes from the same `price_history` source and 24h-window cutoff
|
|
1441
|
+
the ticker bar aggregates from (both bound DB-side via
|
|
1442
|
+
`NOW() - INTERVAL`), so the stats total uses the same formula as the
|
|
1443
|
+
ticker. `estimatedFee` is `quoteVolume × takerFeeRate`, an estimate from
|
|
1444
|
+
the fee schedule rather than booked revenue. `dailyActiveUsers` is the
|
|
1445
|
+
count of distinct trading addresses in the window (active traders);
|
|
1446
|
+
currently an exact alias of `traderCount`, carried as a separate field
|
|
1447
|
+
so a future precise DAU source can diverge without an API change.
|
|
1448
|
+
`averageSlippageBps` is the volume-weighted taker fill vs book-mid in
|
|
1449
|
+
basis points, scoped to symbol-mapped markets (a benchmarked fill on a
|
|
1450
|
+
market absent from the symbol map does not contribute). It is null when
|
|
1451
|
+
the window has no benchmarkable taker fill on a mapped market or when the
|
|
1452
|
+
contributing fills span more than one quote asset (it never mixes
|
|
1453
|
+
notionals across quotes). `depositUsdcVolume24h` and `builderCodesFee24h`
|
|
1454
|
+
are reserved and currently always null.
|
|
1455
|
+
|
|
1456
|
+
Reconciliation note: `tradeCount` and `traderCount` are computed book-wide
|
|
1457
|
+
over the window, while `quoteVolume`, `estimatedFee`, `averageSlippageBps`,
|
|
1458
|
+
`markets[]`, and `activeMarkets` cover only markets present in the symbol
|
|
1459
|
+
map. During symbol-map lag or right after a market is listed, the two need
|
|
1460
|
+
not reconcile (the sum of per-market trade counts can trail
|
|
1461
|
+
`totals.tradeCount`, and a benchmarked fill on an unmapped market is
|
|
1462
|
+
excluded from the book-wide slippage figure).
|
|
1463
|
+
|
|
1464
|
+
* @summary Protocol stats overview
|
|
1465
|
+
*/
|
|
1466
|
+
export type getStatsResponse200 = {
|
|
1467
|
+
data: StatsResponse;
|
|
1468
|
+
status: 200;
|
|
1469
|
+
};
|
|
1470
|
+
export type getStatsResponse400 = {
|
|
1471
|
+
data: BadRequestResponse;
|
|
1472
|
+
status: 400;
|
|
1473
|
+
};
|
|
1474
|
+
export type getStatsResponse429 = {
|
|
1475
|
+
data: RateLimitedResponse;
|
|
1476
|
+
status: 429;
|
|
1477
|
+
};
|
|
1478
|
+
export type getStatsResponse500 = {
|
|
1479
|
+
data: InternalErrorResponse;
|
|
1480
|
+
status: 500;
|
|
1481
|
+
};
|
|
1482
|
+
export type getStatsResponseSuccess = getStatsResponse200 & {
|
|
1483
|
+
headers: Headers;
|
|
1484
|
+
};
|
|
1485
|
+
export type getStatsResponseError = (getStatsResponse400 | getStatsResponse429 | getStatsResponse500) & {
|
|
1486
|
+
headers: Headers;
|
|
1487
|
+
};
|
|
1488
|
+
export type getStatsResponse = getStatsResponseSuccess | getStatsResponseError;
|
|
1489
|
+
export declare const getGetStatsUrl: (params?: GetStatsParams) => string;
|
|
1490
|
+
export declare const getStats: (params?: GetStatsParams, options?: RequestInit) => Promise<getStatsResponse>;
|
|
1316
1491
|
/**
|
|
1317
1492
|
* Returns the orders that belong to `address`, optionally filtered
|
|
1318
1493
|
by status, symbol, market id, and creation time. The endpoint
|