ault-sdk-ts 0.0.2-alpha.13 → 0.0.2-alpha.15
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/agent/sign-and-broadcast.d.ts +2 -2
- package/dist/core/errors.d.ts +66 -0
- package/dist/eip712/sign-and-broadcast.d.ts +2 -2
- package/dist/high-level/types.d.ts +12 -1
- package/dist/index.cjs +1072 -773
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1057 -773
- package/dist/index.js.map +1 -1
- package/dist/proto/gen/ault/clob/v1/query.d.ts +8 -0
- package/dist/rest/clob.d.ts +2 -1
- package/dist/rest/dex-types.generated.d.ts +127 -13
- package/dist/rest/dex.generated.d.ts +181 -26
- package/dist/ws/types.d.ts +12 -5
- package/package.json +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
2
|
import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination";
|
|
3
3
|
import { FeeInfo } from "./fee";
|
|
4
|
+
import { Params } from "./params";
|
|
4
5
|
export declare const protobufPackage = "ault.clob.v1";
|
|
5
6
|
export interface QueryOrderRequest {
|
|
6
7
|
orderId: Uint8Array;
|
|
@@ -16,6 +17,11 @@ export interface QueryOrdersResponse {
|
|
|
16
17
|
orders: OrderResponse[];
|
|
17
18
|
pagination: PageResponse | undefined;
|
|
18
19
|
}
|
|
20
|
+
export interface QueryParamsRequest {
|
|
21
|
+
}
|
|
22
|
+
export interface QueryParamsResponse {
|
|
23
|
+
params: Params | undefined;
|
|
24
|
+
}
|
|
19
25
|
export interface OrderResponse {
|
|
20
26
|
id: Uint8Array;
|
|
21
27
|
orderer: string;
|
|
@@ -34,6 +40,8 @@ export declare const QueryOrderRequest: MessageFns<QueryOrderRequest>;
|
|
|
34
40
|
export declare const QueryOrderResponse: MessageFns<QueryOrderResponse>;
|
|
35
41
|
export declare const QueryOrdersRequest: MessageFns<QueryOrdersRequest>;
|
|
36
42
|
export declare const QueryOrdersResponse: MessageFns<QueryOrdersResponse>;
|
|
43
|
+
export declare const QueryParamsRequest: MessageFns<QueryParamsRequest>;
|
|
44
|
+
export declare const QueryParamsResponse: MessageFns<QueryParamsResponse>;
|
|
37
45
|
export declare const OrderResponse: MessageFns<OrderResponse>;
|
|
38
46
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
|
|
39
47
|
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
package/dist/rest/clob.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type RestContext } from "./context";
|
|
2
2
|
import type { PaginationParams } from "./types";
|
|
3
|
-
import { QueryOrderResponse, QueryOrdersResponse } from "../proto/gen/ault/clob/v1/query";
|
|
3
|
+
import { QueryOrderResponse, QueryOrdersResponse, QueryParamsResponse } from "../proto/gen/ault/clob/v1/query";
|
|
4
4
|
export interface ClobApi {
|
|
5
|
+
getParams: () => Promise<QueryParamsResponse>;
|
|
5
6
|
getOrder: (orderId: Uint8Array | string) => Promise<QueryOrderResponse>;
|
|
6
7
|
getOrders: (params?: {
|
|
7
8
|
marketId?: Uint8Array | string;
|
|
@@ -7,7 +7,20 @@ Provides market data, order book snapshots, trade history, OHLCV candles,
|
|
|
7
7
|
account balances, and TradingView UDF charting endpoints.
|
|
8
8
|
|
|
9
9
|
All endpoints are public — no authentication required.
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
Numeric monetary fields (price, amount, quantity, fees, balances, OHLCV
|
|
12
|
+
bars, ticker stats) are emitted as canonical decimal strings to preserve
|
|
13
|
+
precision past the JS Number safe range. Each schema property documents
|
|
14
|
+
its exact form; consumers should parse these with a decimal library
|
|
15
|
+
(e.g. `decimal.js`, `bignumber.js`) instead of `parseFloat`.
|
|
16
|
+
|
|
17
|
+
Pure counters and timestamps stay as JSON numbers: `timestamp` and
|
|
18
|
+
`lastTradeTimestamp` are unix milliseconds, `nonce` is the chain block
|
|
19
|
+
height (uint64 — the JS Number ceiling of ~285k years at one-second
|
|
20
|
+
blocks is a non-issue today), and a few REST-side block-height fields
|
|
21
|
+
inside `info` blocks are now strings for symmetry with the WebSocket
|
|
22
|
+
contract.
|
|
23
|
+
|
|
11
24
|
All timestamps are in milliseconds unless noted otherwise.
|
|
12
25
|
|
|
13
26
|
* OpenAPI spec version: 2.2.0
|
|
@@ -56,6 +69,7 @@ export declare const GetStatusResponse: zod.ZodObject<{
|
|
|
56
69
|
*/
|
|
57
70
|
export declare const listMarketsResponseTakerRegExp: RegExp;
|
|
58
71
|
export declare const listMarketsResponseMakerRegExp: RegExp;
|
|
72
|
+
export declare const listMarketsResponseInfoEscrowAddressOneRegExp: RegExp;
|
|
59
73
|
export declare const ListMarketsResponseItem: zod.ZodObject<{
|
|
60
74
|
id: zod.ZodString;
|
|
61
75
|
symbol: zod.ZodString;
|
|
@@ -111,7 +125,11 @@ export declare const ListMarketsResponseItem: zod.ZodObject<{
|
|
|
111
125
|
}, zod.z.core.$strip>>;
|
|
112
126
|
}, zod.z.core.$strip>;
|
|
113
127
|
created: zod.ZodOptional<zod.ZodNullable<zod.ZodNumber>>;
|
|
114
|
-
info: zod.ZodObject<{
|
|
128
|
+
info: zod.ZodObject<{
|
|
129
|
+
escrow_address: zod.ZodOptional<zod.ZodString>;
|
|
130
|
+
block_height: zod.ZodOptional<zod.ZodNumber>;
|
|
131
|
+
market_type: zod.ZodOptional<zod.ZodNumber>;
|
|
132
|
+
}, zod.z.core.$strip>;
|
|
115
133
|
}, zod.z.core.$strip>;
|
|
116
134
|
export declare const ListMarketsResponse: zod.ZodArray<zod.ZodObject<{
|
|
117
135
|
id: zod.ZodString;
|
|
@@ -168,7 +186,11 @@ export declare const ListMarketsResponse: zod.ZodArray<zod.ZodObject<{
|
|
|
168
186
|
}, zod.z.core.$strip>>;
|
|
169
187
|
}, zod.z.core.$strip>;
|
|
170
188
|
created: zod.ZodOptional<zod.ZodNullable<zod.ZodNumber>>;
|
|
171
|
-
info: zod.ZodObject<{
|
|
189
|
+
info: zod.ZodObject<{
|
|
190
|
+
escrow_address: zod.ZodOptional<zod.ZodString>;
|
|
191
|
+
block_height: zod.ZodOptional<zod.ZodNumber>;
|
|
192
|
+
market_type: zod.ZodOptional<zod.ZodNumber>;
|
|
193
|
+
}, zod.z.core.$strip>;
|
|
172
194
|
}, zod.z.core.$strip>>;
|
|
173
195
|
/**
|
|
174
196
|
* Returns a dictionary of currencies keyed by code (e.g., "AULT", "BTC").
|
|
@@ -287,6 +309,8 @@ export declare const listTradesResponseAmountRegExp: RegExp;
|
|
|
287
309
|
export declare const listTradesResponseCostRegExp: RegExp;
|
|
288
310
|
export declare const listTradesResponseFeeCostRegExp: RegExp;
|
|
289
311
|
export declare const listTradesResponseFeeRateRegExp: RegExp;
|
|
312
|
+
export declare const listTradesResponseInfoAddressOneRegExp: RegExp;
|
|
313
|
+
export declare const listTradesResponseInfoBlockHeightRegExp: RegExp;
|
|
290
314
|
export declare const ListTradesResponseItem: zod.ZodObject<{
|
|
291
315
|
id: zod.ZodString;
|
|
292
316
|
order: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
@@ -309,7 +333,12 @@ export declare const ListTradesResponseItem: zod.ZodObject<{
|
|
|
309
333
|
currency: zod.ZodOptional<zod.ZodString>;
|
|
310
334
|
rate: zod.ZodOptional<zod.ZodString>;
|
|
311
335
|
}, zod.z.core.$strip>>;
|
|
312
|
-
info: zod.ZodObject<{
|
|
336
|
+
info: zod.ZodObject<{
|
|
337
|
+
address: zod.ZodString;
|
|
338
|
+
paid: zod.ZodString;
|
|
339
|
+
received: zod.ZodString;
|
|
340
|
+
block_height: zod.ZodString;
|
|
341
|
+
}, zod.z.core.$strip>;
|
|
313
342
|
}, zod.z.core.$strip>;
|
|
314
343
|
export declare const ListTradesResponse: zod.ZodArray<zod.ZodObject<{
|
|
315
344
|
id: zod.ZodString;
|
|
@@ -333,7 +362,12 @@ export declare const ListTradesResponse: zod.ZodArray<zod.ZodObject<{
|
|
|
333
362
|
currency: zod.ZodOptional<zod.ZodString>;
|
|
334
363
|
rate: zod.ZodOptional<zod.ZodString>;
|
|
335
364
|
}, zod.z.core.$strip>>;
|
|
336
|
-
info: zod.ZodObject<{
|
|
365
|
+
info: zod.ZodObject<{
|
|
366
|
+
address: zod.ZodString;
|
|
367
|
+
paid: zod.ZodString;
|
|
368
|
+
received: zod.ZodString;
|
|
369
|
+
block_height: zod.ZodString;
|
|
370
|
+
}, zod.z.core.$strip>;
|
|
337
371
|
}, zod.z.core.$strip>>;
|
|
338
372
|
/**
|
|
339
373
|
* Returns trading fee schedule for all markets, keyed by symbol.
|
|
@@ -350,13 +384,23 @@ export declare const GetTradingFeesResponse: zod.ZodRecord<zod.ZodString, zod.Zo
|
|
|
350
384
|
info: zod.ZodObject<{}, zod.z.core.$loose>;
|
|
351
385
|
}, zod.z.core.$strip>>;
|
|
352
386
|
/**
|
|
387
|
+
* Returns the orders that belong to `address`, optionally filtered
|
|
388
|
+
by status, symbol, market id, and creation time. The endpoint
|
|
389
|
+
always returns an array — the empty array is the correct response
|
|
390
|
+
for an address with no orders matching the filter, and the API
|
|
391
|
+
deliberately never emits 404 here so SDK generators do not invent
|
|
392
|
+
a not-found path. Malformed `address`, `symbol`, or `market_id`
|
|
393
|
+
return 400.
|
|
394
|
+
|
|
353
395
|
* @summary List orders for an address
|
|
354
396
|
*/
|
|
397
|
+
export declare const listOrdersQueryAddressOneRegExp: RegExp;
|
|
398
|
+
export declare const listOrdersQueryAddressTwoRegExp: RegExp;
|
|
355
399
|
export declare const listOrdersQueryMarketIdRegExp: RegExp;
|
|
356
400
|
export declare const listOrdersQueryLimitDefault = 50;
|
|
357
401
|
export declare const listOrdersQueryLimitMax = 200;
|
|
358
402
|
export declare const ListOrdersQueryParams: zod.ZodObject<{
|
|
359
|
-
address: zod.ZodString
|
|
403
|
+
address: zod.ZodUnion<readonly [zod.ZodString, zod.ZodString]>;
|
|
360
404
|
status: zod.ZodOptional<zod.ZodEnum<{
|
|
361
405
|
open: "open";
|
|
362
406
|
closed: "closed";
|
|
@@ -374,6 +418,8 @@ export declare const listOrdersResponseRemainingRegExp: RegExp;
|
|
|
374
418
|
export declare const listOrdersResponseCostRegExp: RegExp;
|
|
375
419
|
export declare const listOrdersResponseFeeCostRegExp: RegExp;
|
|
376
420
|
export declare const listOrdersResponseFeeRateRegExp: RegExp;
|
|
421
|
+
export declare const listOrdersResponseInfoBlockHeightRegExp: RegExp;
|
|
422
|
+
export declare const listOrdersResponseInfoRemainingDepositRegExp: RegExp;
|
|
377
423
|
export declare const ListOrdersResponseItem: zod.ZodObject<{
|
|
378
424
|
id: zod.ZodString;
|
|
379
425
|
clientOrderId: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
@@ -411,7 +457,25 @@ export declare const ListOrdersResponseItem: zod.ZodObject<{
|
|
|
411
457
|
postOnly: zod.ZodOptional<zod.ZodBoolean>;
|
|
412
458
|
stopPrice: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
413
459
|
triggerPrice: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
414
|
-
info: zod.ZodObject<{
|
|
460
|
+
info: zod.ZodObject<{
|
|
461
|
+
block_height: zod.ZodString;
|
|
462
|
+
tx_index: zod.ZodNumber;
|
|
463
|
+
remaining_deposit: zod.ZodString;
|
|
464
|
+
chain_status: zod.ZodEnum<{
|
|
465
|
+
open: "open";
|
|
466
|
+
partially_filled: "partially_filled";
|
|
467
|
+
filled: "filled";
|
|
468
|
+
cancelled: "cancelled";
|
|
469
|
+
expired: "expired";
|
|
470
|
+
triggered_pending: "triggered_pending";
|
|
471
|
+
}>;
|
|
472
|
+
chain_type: zod.ZodEnum<{
|
|
473
|
+
limit: "limit";
|
|
474
|
+
market: "market";
|
|
475
|
+
scale: "scale";
|
|
476
|
+
stop: "stop";
|
|
477
|
+
}>;
|
|
478
|
+
}, zod.z.core.$strip>;
|
|
415
479
|
}, zod.z.core.$strip>;
|
|
416
480
|
export declare const ListOrdersResponse: zod.ZodArray<zod.ZodObject<{
|
|
417
481
|
id: zod.ZodString;
|
|
@@ -450,7 +514,25 @@ export declare const ListOrdersResponse: zod.ZodArray<zod.ZodObject<{
|
|
|
450
514
|
postOnly: zod.ZodOptional<zod.ZodBoolean>;
|
|
451
515
|
stopPrice: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
452
516
|
triggerPrice: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
453
|
-
info: zod.ZodObject<{
|
|
517
|
+
info: zod.ZodObject<{
|
|
518
|
+
block_height: zod.ZodString;
|
|
519
|
+
tx_index: zod.ZodNumber;
|
|
520
|
+
remaining_deposit: zod.ZodString;
|
|
521
|
+
chain_status: zod.ZodEnum<{
|
|
522
|
+
open: "open";
|
|
523
|
+
partially_filled: "partially_filled";
|
|
524
|
+
filled: "filled";
|
|
525
|
+
cancelled: "cancelled";
|
|
526
|
+
expired: "expired";
|
|
527
|
+
triggered_pending: "triggered_pending";
|
|
528
|
+
}>;
|
|
529
|
+
chain_type: zod.ZodEnum<{
|
|
530
|
+
limit: "limit";
|
|
531
|
+
market: "market";
|
|
532
|
+
scale: "scale";
|
|
533
|
+
stop: "stop";
|
|
534
|
+
}>;
|
|
535
|
+
}, zod.z.core.$strip>;
|
|
454
536
|
}, zod.z.core.$strip>>;
|
|
455
537
|
/**
|
|
456
538
|
* Returns a single order by its hex-encoded ID.
|
|
@@ -466,6 +548,8 @@ export declare const getOrderResponseRemainingRegExp: RegExp;
|
|
|
466
548
|
export declare const getOrderResponseCostRegExp: RegExp;
|
|
467
549
|
export declare const getOrderResponseFeeCostRegExp: RegExp;
|
|
468
550
|
export declare const getOrderResponseFeeRateRegExp: RegExp;
|
|
551
|
+
export declare const getOrderResponseInfoBlockHeightRegExp: RegExp;
|
|
552
|
+
export declare const getOrderResponseInfoRemainingDepositRegExp: RegExp;
|
|
469
553
|
export declare const GetOrderResponse: zod.ZodObject<{
|
|
470
554
|
id: zod.ZodString;
|
|
471
555
|
clientOrderId: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
@@ -503,7 +587,25 @@ export declare const GetOrderResponse: zod.ZodObject<{
|
|
|
503
587
|
postOnly: zod.ZodOptional<zod.ZodBoolean>;
|
|
504
588
|
stopPrice: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
505
589
|
triggerPrice: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
506
|
-
info: zod.ZodObject<{
|
|
590
|
+
info: zod.ZodObject<{
|
|
591
|
+
block_height: zod.ZodString;
|
|
592
|
+
tx_index: zod.ZodNumber;
|
|
593
|
+
remaining_deposit: zod.ZodString;
|
|
594
|
+
chain_status: zod.ZodEnum<{
|
|
595
|
+
open: "open";
|
|
596
|
+
partially_filled: "partially_filled";
|
|
597
|
+
filled: "filled";
|
|
598
|
+
cancelled: "cancelled";
|
|
599
|
+
expired: "expired";
|
|
600
|
+
triggered_pending: "triggered_pending";
|
|
601
|
+
}>;
|
|
602
|
+
chain_type: zod.ZodEnum<{
|
|
603
|
+
limit: "limit";
|
|
604
|
+
market: "market";
|
|
605
|
+
scale: "scale";
|
|
606
|
+
stop: "stop";
|
|
607
|
+
}>;
|
|
608
|
+
}, zod.z.core.$strip>;
|
|
507
609
|
}, zod.z.core.$strip>;
|
|
508
610
|
/**
|
|
509
611
|
* Returns trade history for a specific user (orderer).
|
|
@@ -525,6 +627,8 @@ export declare const listMyTradesResponseAmountRegExp: RegExp;
|
|
|
525
627
|
export declare const listMyTradesResponseCostRegExp: RegExp;
|
|
526
628
|
export declare const listMyTradesResponseFeeCostRegExp: RegExp;
|
|
527
629
|
export declare const listMyTradesResponseFeeRateRegExp: RegExp;
|
|
630
|
+
export declare const listMyTradesResponseInfoAddressOneRegExp: RegExp;
|
|
631
|
+
export declare const listMyTradesResponseInfoBlockHeightRegExp: RegExp;
|
|
528
632
|
export declare const ListMyTradesResponseItem: zod.ZodObject<{
|
|
529
633
|
id: zod.ZodString;
|
|
530
634
|
order: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
@@ -547,7 +651,12 @@ export declare const ListMyTradesResponseItem: zod.ZodObject<{
|
|
|
547
651
|
currency: zod.ZodOptional<zod.ZodString>;
|
|
548
652
|
rate: zod.ZodOptional<zod.ZodString>;
|
|
549
653
|
}, zod.z.core.$strip>>;
|
|
550
|
-
info: zod.ZodObject<{
|
|
654
|
+
info: zod.ZodObject<{
|
|
655
|
+
address: zod.ZodString;
|
|
656
|
+
paid: zod.ZodString;
|
|
657
|
+
received: zod.ZodString;
|
|
658
|
+
block_height: zod.ZodString;
|
|
659
|
+
}, zod.z.core.$strip>;
|
|
551
660
|
}, zod.z.core.$strip>;
|
|
552
661
|
export declare const ListMyTradesResponse: zod.ZodArray<zod.ZodObject<{
|
|
553
662
|
id: zod.ZodString;
|
|
@@ -571,7 +680,12 @@ export declare const ListMyTradesResponse: zod.ZodArray<zod.ZodObject<{
|
|
|
571
680
|
currency: zod.ZodOptional<zod.ZodString>;
|
|
572
681
|
rate: zod.ZodOptional<zod.ZodString>;
|
|
573
682
|
}, zod.z.core.$strip>>;
|
|
574
|
-
info: zod.ZodObject<{
|
|
683
|
+
info: zod.ZodObject<{
|
|
684
|
+
address: zod.ZodString;
|
|
685
|
+
paid: zod.ZodString;
|
|
686
|
+
received: zod.ZodString;
|
|
687
|
+
block_height: zod.ZodString;
|
|
688
|
+
}, zod.z.core.$strip>;
|
|
575
689
|
}, zod.z.core.$strip>>;
|
|
576
690
|
/**
|
|
577
691
|
* Returns the balance object with `free`, `used`, `total`
|
|
@@ -607,8 +721,8 @@ export declare const GetOHLCVQueryParams: zod.ZodObject<{
|
|
|
607
721
|
limit: zod.ZodDefault<zod.ZodNumber>;
|
|
608
722
|
since: zod.ZodOptional<zod.ZodNumber>;
|
|
609
723
|
}, zod.z.core.$strip>;
|
|
610
|
-
export declare const GetOHLCVResponseItem: zod.ZodTuple<[zod.ZodNumber, zod.ZodString, zod.ZodString, zod.ZodString, zod.ZodString, zod.ZodString], null>;
|
|
611
|
-
export declare const GetOHLCVResponse: zod.ZodArray<zod.ZodTuple<[zod.ZodNumber, zod.ZodString, zod.ZodString, zod.ZodString, zod.ZodString, zod.ZodString], null>>;
|
|
724
|
+
export declare const GetOHLCVResponseItem: zod.ZodTuple<[zod.ZodNumber, zod.ZodString, zod.ZodString, zod.ZodString, zod.ZodString, zod.ZodString, zod.ZodString], null>;
|
|
725
|
+
export declare const GetOHLCVResponse: zod.ZodArray<zod.ZodTuple<[zod.ZodNumber, zod.ZodString, zod.ZodString, zod.ZodString, zod.ZodString, zod.ZodString, zod.ZodString], null>>;
|
|
612
726
|
/**
|
|
613
727
|
* @summary UDF configuration
|
|
614
728
|
*/
|
|
@@ -1,3 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cosmos bech32 account address. The HRP is fixed to `ault` for
|
|
3
|
+
accounts (validators use `aultvaloper`, which this schema rejects).
|
|
4
|
+
Lowercased and checksum-verified by the API; mixed-case bech32 is
|
|
5
|
+
rejected to avoid silent EIP-55-style ambiguity.
|
|
6
|
+
|
|
7
|
+
* @pattern ^ault1[a-z0-9]{38,}$
|
|
8
|
+
*/
|
|
9
|
+
export type AddressBech32 = string;
|
|
10
|
+
/**
|
|
11
|
+
* EVM hex form of the same 20-byte account address. Always
|
|
12
|
+
`0x`-prefixed and lowercased; mixed-case bodies are rejected so a
|
|
13
|
+
non-checksummed and a checksummed copy of the same address never
|
|
14
|
+
compare unequal at the API boundary.
|
|
15
|
+
|
|
16
|
+
* @pattern ^0x[a-f0-9]{40}$
|
|
17
|
+
*/
|
|
18
|
+
export type AddressHex = string;
|
|
19
|
+
/**
|
|
20
|
+
* Granular chain-level status — the WS view exposes the same
|
|
21
|
+
string. The CCXT view at `OrderResponse.status` collapses these
|
|
22
|
+
into open | closed | canceled.
|
|
23
|
+
|
|
24
|
+
*/
|
|
25
|
+
export type OrderInfoChainStatus = (typeof OrderInfoChainStatus)[keyof typeof OrderInfoChainStatus];
|
|
26
|
+
export declare const OrderInfoChainStatus: {
|
|
27
|
+
readonly open: "open";
|
|
28
|
+
readonly partially_filled: "partially_filled";
|
|
29
|
+
readonly filled: "filled";
|
|
30
|
+
readonly cancelled: "cancelled";
|
|
31
|
+
readonly expired: "expired";
|
|
32
|
+
readonly triggered_pending: "triggered_pending";
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Granular chain-level order type. The CCXT view at
|
|
36
|
+
`OrderResponse.type` collapses these into limit | market.
|
|
37
|
+
|
|
38
|
+
*/
|
|
39
|
+
export type OrderInfoChainType = (typeof OrderInfoChainType)[keyof typeof OrderInfoChainType];
|
|
40
|
+
export declare const OrderInfoChainType: {
|
|
41
|
+
readonly limit: "limit";
|
|
42
|
+
readonly market: "market";
|
|
43
|
+
readonly scale: "scale";
|
|
44
|
+
readonly stop: "stop";
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Exchange-specific extension on `OrderResponse`. Mirrors the
|
|
48
|
+
`info` map populated in `internal/domain/order/service.go`.
|
|
49
|
+
|
|
50
|
+
*/
|
|
51
|
+
export interface OrderInfo {
|
|
52
|
+
/**
|
|
53
|
+
* Height of the block that wrote the order. Decimal string for
|
|
54
|
+
parity with the WS order `info.block_height`.
|
|
55
|
+
|
|
56
|
+
* @pattern ^\d+$
|
|
57
|
+
*/
|
|
58
|
+
block_height: string;
|
|
59
|
+
/** Index of the order tx within its block. */
|
|
60
|
+
tx_index: number;
|
|
61
|
+
/**
|
|
62
|
+
* Remaining quote-asset escrow (raw decimal string at the chain's
|
|
63
|
+
atto-precision) that has not yet been spent on fills.
|
|
64
|
+
|
|
65
|
+
* @pattern ^-?\d+(\.\d+)?$
|
|
66
|
+
*/
|
|
67
|
+
remaining_deposit: string;
|
|
68
|
+
/** Granular chain-level status — the WS view exposes the same
|
|
69
|
+
string. The CCXT view at `OrderResponse.status` collapses these
|
|
70
|
+
into open | closed | canceled.
|
|
71
|
+
*/
|
|
72
|
+
chain_status: OrderInfoChainStatus;
|
|
73
|
+
/** Granular chain-level order type. The CCXT view at
|
|
74
|
+
`OrderResponse.type` collapses these into limit | market.
|
|
75
|
+
*/
|
|
76
|
+
chain_type: OrderInfoChainType;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Exchange-specific extension on `TradeResponse`. Mirrors the
|
|
80
|
+
`Info` struct populated in `internal/domain/trade/service.go`.
|
|
81
|
+
|
|
82
|
+
*/
|
|
83
|
+
export interface TradeInfo {
|
|
84
|
+
/** Bech32 address of the orderer that owns this leg of the fill. */
|
|
85
|
+
address: AddressBech32;
|
|
86
|
+
/** Atto-precision amount the orderer paid for this fill, suffixed
|
|
87
|
+
with the chain denom (e.g. `"1500000000000000000uusdt"`). Empty
|
|
88
|
+
string when the chain did not record this side.
|
|
89
|
+
*/
|
|
90
|
+
paid: string;
|
|
91
|
+
/** Atto-precision amount the orderer received for this fill,
|
|
92
|
+
suffixed with the chain denom. Empty string when the chain did
|
|
93
|
+
not record this side.
|
|
94
|
+
*/
|
|
95
|
+
received: string;
|
|
96
|
+
/**
|
|
97
|
+
* Decimal-string block height for parity with the WS trade event.
|
|
98
|
+
* @pattern ^\d+$
|
|
99
|
+
*/
|
|
100
|
+
block_height: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Exchange-specific extension on `MarketResponse`. Mirrors the
|
|
104
|
+
`Info` map populated in `internal/domain/market/service.go`.
|
|
105
|
+
|
|
106
|
+
*/
|
|
107
|
+
export interface MarketInfo {
|
|
108
|
+
/** Bech32 address of the per-market escrow account that holds
|
|
109
|
+
user deposits while orders are resting.
|
|
110
|
+
*/
|
|
111
|
+
escrow_address?: AddressBech32;
|
|
112
|
+
/** Height of the block at which the market was registered. */
|
|
113
|
+
block_height?: number;
|
|
114
|
+
/** On-chain market type code (e.g. spot). Stable across the
|
|
115
|
+
lifecycle of the market; `MarketResponse.type` carries the
|
|
116
|
+
CCXT label.
|
|
117
|
+
*/
|
|
118
|
+
market_type?: number;
|
|
119
|
+
}
|
|
1
120
|
export type HealthResponseStatus = (typeof HealthResponseStatus)[keyof typeof HealthResponseStatus];
|
|
2
121
|
export declare const HealthResponseStatus: {
|
|
3
122
|
readonly healthy: "healthy";
|
|
@@ -35,9 +154,6 @@ export type MarketResponseType = (typeof MarketResponseType)[keyof typeof Market
|
|
|
35
154
|
export declare const MarketResponseType: {
|
|
36
155
|
readonly spot: "spot";
|
|
37
156
|
};
|
|
38
|
-
export type MarketResponseInfo = {
|
|
39
|
-
[key: string]: unknown;
|
|
40
|
-
};
|
|
41
157
|
export interface MarketPrecision {
|
|
42
158
|
amount?: number;
|
|
43
159
|
price?: number;
|
|
@@ -108,7 +224,7 @@ export interface MarketResponse {
|
|
|
108
224
|
limits: MarketLimits;
|
|
109
225
|
/** @nullable */
|
|
110
226
|
created?: number | null;
|
|
111
|
-
info:
|
|
227
|
+
info: MarketInfo;
|
|
112
228
|
}
|
|
113
229
|
export type CurrencyResponseLimits = {
|
|
114
230
|
amount?: MinMax;
|
|
@@ -235,7 +351,17 @@ export interface OrderbookResponse {
|
|
|
235
351
|
* @pattern ^[0-9a-f]{2,510}$
|
|
236
352
|
*/
|
|
237
353
|
market_id: string;
|
|
354
|
+
/** Bid levels as `[price, qty]` decimal-string tuples. Ordered by
|
|
355
|
+
price descending — index 0 is the best bid. Matches the WS
|
|
356
|
+
`book` topic (`docs/websocket-api.md`), so consumers that switch
|
|
357
|
+
between REST snapshots and WS deltas don't need to re-sort.
|
|
358
|
+
*/
|
|
238
359
|
bids: [string, string][];
|
|
360
|
+
/** Ask levels as `[price, qty]` decimal-string tuples. Ordered by
|
|
361
|
+
price ascending — index 0 is the best ask. Matches the WS
|
|
362
|
+
`book` topic, so consumers that switch between REST snapshots
|
|
363
|
+
and WS deltas don't need to re-sort.
|
|
364
|
+
*/
|
|
239
365
|
asks: [string, string][];
|
|
240
366
|
timestamp: number;
|
|
241
367
|
datetime: string;
|
|
@@ -279,9 +405,6 @@ export type TradeResponseFee = {
|
|
|
279
405
|
*/
|
|
280
406
|
rate?: string;
|
|
281
407
|
};
|
|
282
|
-
export type TradeResponseInfo = {
|
|
283
|
-
[key: string]: unknown;
|
|
284
|
-
};
|
|
285
408
|
/**
|
|
286
409
|
* All numeric fields are canonical decimal strings — quantities at any
|
|
287
410
|
magnitude survive the JSON round-trip without rounding through
|
|
@@ -314,7 +437,7 @@ export interface TradeResponse {
|
|
|
314
437
|
cost: string;
|
|
315
438
|
/** Estimated fee for the trade: cost = amount * price * taker_fee_rate */
|
|
316
439
|
fee?: TradeResponseFee;
|
|
317
|
-
info:
|
|
440
|
+
info: TradeInfo;
|
|
318
441
|
}
|
|
319
442
|
export type OrderResponseStatus = (typeof OrderResponseStatus)[keyof typeof OrderResponseStatus];
|
|
320
443
|
export declare const OrderResponseStatus: {
|
|
@@ -336,7 +459,12 @@ export type OrderResponseTradesItem = {
|
|
|
336
459
|
[key: string]: unknown;
|
|
337
460
|
};
|
|
338
461
|
/**
|
|
339
|
-
*
|
|
462
|
+
* Fee for the order. `cost` is `cost * taker_fee_rate` — applied to
|
|
463
|
+
the realized cost above, so it is more accurate than the previous
|
|
464
|
+
`filled * price * taker_fee_rate` approximation. The rate is the
|
|
465
|
+
market's taker rate; per-trade maker/taker resolution depends on
|
|
466
|
+
the dbindexer `is_taker` column landing first.
|
|
467
|
+
|
|
340
468
|
*/
|
|
341
469
|
export type OrderResponseFee = {
|
|
342
470
|
/**
|
|
@@ -352,9 +480,6 @@ export type OrderResponseFee = {
|
|
|
352
480
|
*/
|
|
353
481
|
rate?: string;
|
|
354
482
|
};
|
|
355
|
-
export type OrderResponseInfo = {
|
|
356
|
-
[key: string]: unknown;
|
|
357
|
-
};
|
|
358
483
|
/**
|
|
359
484
|
* All numeric fields (price, amount, filled, remaining, cost,
|
|
360
485
|
fee.cost, fee.rate, average, triggerPrice, stopPrice) are canonical
|
|
@@ -395,12 +520,26 @@ export interface OrderResponse {
|
|
|
395
520
|
/** @pattern ^-?\d+(\.\d+)?$ */
|
|
396
521
|
remaining: string;
|
|
397
522
|
/**
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
523
|
+
* Quote-asset notional accumulated across all fills for this order.
|
|
524
|
+
|
|
525
|
+
When the order has at least one indexed fill, the value is summed
|
|
526
|
+
from the trades table (`SUM(filled_quantity * price)`) — it
|
|
527
|
+
reflects the realized average across every level the order
|
|
528
|
+
walked, not `filled * price`. Until the indexer has caught up
|
|
529
|
+
with a freshly-matched fill, the value falls back to
|
|
530
|
+
`filled * price` so consumers never see a misleading "0" while
|
|
531
|
+
the trade row is still in flight.
|
|
532
|
+
|
|
533
|
+
* @pattern ^-?\d+(\.\d+)?$
|
|
534
|
+
*/
|
|
401
535
|
cost: string;
|
|
402
536
|
trades?: OrderResponseTradesItem[];
|
|
403
|
-
/**
|
|
537
|
+
/** Fee for the order. `cost` is `cost * taker_fee_rate` — applied to
|
|
538
|
+
the realized cost above, so it is more accurate than the previous
|
|
539
|
+
`filled * price * taker_fee_rate` approximation. The rate is the
|
|
540
|
+
market's taker rate; per-trade maker/taker resolution depends on
|
|
541
|
+
the dbindexer `is_taker` column landing first.
|
|
542
|
+
*/
|
|
404
543
|
fee?: OrderResponseFee;
|
|
405
544
|
reduceOnly?: boolean;
|
|
406
545
|
postOnly?: boolean;
|
|
@@ -408,7 +547,7 @@ export interface OrderResponse {
|
|
|
408
547
|
stopPrice?: string | null;
|
|
409
548
|
/** @nullable */
|
|
410
549
|
triggerPrice?: string | null;
|
|
411
|
-
info:
|
|
550
|
+
info: OrderInfo;
|
|
412
551
|
}
|
|
413
552
|
export type BalancesResponseFree = {
|
|
414
553
|
[key: string]: string;
|
|
@@ -440,17 +579,22 @@ export interface BalancesResponse {
|
|
|
440
579
|
info: BalancesResponseInfo;
|
|
441
580
|
}
|
|
442
581
|
/**
|
|
443
|
-
* [timestamp_ms, open, high, low, close,
|
|
444
|
-
numeric ms epoch; the o/h/l/c/
|
|
445
|
-
strings so quantities at any magnitude
|
|
582
|
+
* `[timestamp_ms, open, high, low, close, baseVolume, quoteVolume]`.
|
|
583
|
+
Timestamp is a numeric ms epoch; the o/h/l/c/baseVolume/quoteVolume
|
|
584
|
+
fields are canonical decimal strings so quantities at any magnitude
|
|
585
|
+
survive the JSON round-trip. The trailing `quoteVolume` slot is
|
|
586
|
+
derived as `baseVolume * close_price` until the chain indexer
|
|
587
|
+
emits a realized `volume_quote` column. Both SDK clients
|
|
588
|
+
(`ault-sdk-ts`, `ault-sdk-py`) consume the 7-tuple as the
|
|
589
|
+
canonical shape.
|
|
446
590
|
(Patterns omitted on tuple items because orval generates broken
|
|
447
591
|
regex references when `prefixItems` carry `pattern`; the format is
|
|
448
592
|
documented in the descriptions.)
|
|
449
593
|
|
|
450
|
-
* @minItems
|
|
451
|
-
* @maxItems
|
|
594
|
+
* @minItems 7
|
|
595
|
+
* @maxItems 7
|
|
452
596
|
*/
|
|
453
|
-
export type OHLCVEntry = [number, string, string, string, string, string];
|
|
597
|
+
export type OHLCVEntry = [number, string, string, string, string, string, string];
|
|
454
598
|
export interface UDFExchange {
|
|
455
599
|
value: string;
|
|
456
600
|
name: string;
|
|
@@ -654,9 +798,12 @@ export type GetTradingFees200 = {
|
|
|
654
798
|
};
|
|
655
799
|
export type ListOrdersParams = {
|
|
656
800
|
/**
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
801
|
+
* Account address. Accepts either bech32 (`ault1...`) or 0x-hex
|
|
802
|
+
(`0x...`) form; the API normalizes to the canonical bech32
|
|
803
|
+
stored in the indexer before querying.
|
|
804
|
+
|
|
805
|
+
*/
|
|
806
|
+
address: AddressBech32 | AddressHex;
|
|
660
807
|
status?: ListOrdersStatus;
|
|
661
808
|
/**
|
|
662
809
|
* Symbol to filter by (e.g., AULT/USDT). Alternative to market_id.
|
|
@@ -1082,6 +1229,14 @@ export type getTradingFeesResponse = getTradingFeesResponseSuccess | getTradingF
|
|
|
1082
1229
|
export declare const getGetTradingFeesUrl: () => string;
|
|
1083
1230
|
export declare const getTradingFees: (options?: RequestInit) => Promise<getTradingFeesResponse>;
|
|
1084
1231
|
/**
|
|
1232
|
+
* Returns the orders that belong to `address`, optionally filtered
|
|
1233
|
+
by status, symbol, market id, and creation time. The endpoint
|
|
1234
|
+
always returns an array — the empty array is the correct response
|
|
1235
|
+
for an address with no orders matching the filter, and the API
|
|
1236
|
+
deliberately never emits 404 here so SDK generators do not invent
|
|
1237
|
+
a not-found path. Malformed `address`, `symbol`, or `market_id`
|
|
1238
|
+
return 400.
|
|
1239
|
+
|
|
1085
1240
|
* @summary List orders for an address
|
|
1086
1241
|
*/
|
|
1087
1242
|
export type listOrdersResponse200 = {
|
package/dist/ws/types.d.ts
CHANGED
|
@@ -54,23 +54,30 @@ export interface WsCommandResponse {
|
|
|
54
54
|
* Payload for the `chain:block` topic. Emitted once per new block regardless
|
|
55
55
|
* of market activity so subscribers can drive liveness indicators.
|
|
56
56
|
*
|
|
57
|
-
* The block header fields (hash, proposer,
|
|
58
|
-
*
|
|
57
|
+
* The block header fields (hash, proposer, txCount, gasUsed, gasWanted) are
|
|
58
|
+
* optional because older chain versions may not supply them.
|
|
59
59
|
*
|
|
60
60
|
* `height` is a decimal string for symmetry with the WS trade/order
|
|
61
61
|
* `info.block_height`. At one-second blocks the JS-Number boundary
|
|
62
62
|
* (~285k years) is a practical non-issue today; the string form keeps
|
|
63
63
|
* the numeric WS contract uniform so consumers don't have to special-case
|
|
64
64
|
* `chain:block` in their parsing layer.
|
|
65
|
+
*
|
|
66
|
+
* Field casing: `txCount`, `gasUsed`, `gasWanted` mirror the wire format
|
|
67
|
+
* the dex-api WS layer currently emits. Earlier dex-api builds (≤ alpha.13
|
|
68
|
+
* era) shipped these as `tx_count` / `gas_used` / `gas_wanted`; consumers
|
|
69
|
+
* running against an older API can fall back to the snake-case names by
|
|
70
|
+
* widening the type at the boundary, but the SDK has no compatibility
|
|
71
|
+
* shim because the wire format is the contract.
|
|
65
72
|
*/
|
|
66
73
|
export interface BlockUpdate {
|
|
67
74
|
height: string;
|
|
68
75
|
timestamp: number;
|
|
69
76
|
hash?: string;
|
|
70
77
|
proposer?: string;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
txCount?: number;
|
|
79
|
+
gasUsed?: number;
|
|
80
|
+
gasWanted?: number;
|
|
74
81
|
}
|
|
75
82
|
export type PayloadFor<T extends string> = T extends `orderbook:${string}` ? OrderbookResponse : T extends `trades:${string}` ? WsTradeUpdate[] : T extends `ticker:${string}` ? TickerResponse : T extends `chart:${string}` ? OHLCVEntry : T extends `orders:${string}` ? WsOrderUpdate[] : T extends `balances:${string}` ? WsBalancesUpdate : T extends `mytrades:${string}` ? WsTradeUpdate[] : T extends "chain:block" ? BlockUpdate : unknown;
|
|
76
83
|
export interface SubscriptionHandlers<T> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ault-sdk-ts",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.15",
|
|
4
4
|
"description": "TypeScript SDK for the Ault blockchain with high-level transaction methods and REST query clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ault",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"gen:openapi": "orval",
|
|
49
49
|
"gen:proto": "node scripts/generate-protos.mjs",
|
|
50
50
|
"gen:eip712": "node scripts/generate-eip712-registry.mjs",
|
|
51
|
+
"gen:all": "npm run gen:openapi && npm run gen:proto && npm run gen:eip712 && pnpm lint:fix && pnpm format",
|
|
51
52
|
"prepare": "node scripts/prepare.mjs",
|
|
52
53
|
"build": "tsup && tsc -p tsconfig.build.json && npx tsc-alias -p tsconfig.build.json",
|
|
53
54
|
"dev": "tsup --watch",
|