ault-sdk-ts 0.1.0 → 0.4.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/README.md +3 -0
- package/dist/core/clob-gas.d.ts +5 -19
- package/dist/core/manifest-resolver.d.ts +17 -8
- package/dist/core/manifest-types.d.ts +2 -0
- package/dist/core/network.d.ts +0 -9
- package/dist/index.cjs +145 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +131 -41
- package/dist/index.js.map +1 -1
- package/dist/rest/dex-types.generated.d.ts +72 -1
- package/dist/rest/dex.d.ts +1 -0
- package/dist/rest/dex.generated.d.ts +58 -0
- package/dist/ws/types.d.ts +8 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -403,6 +403,9 @@ const orders = await dex.listOrders({
|
|
|
403
403
|
// Single order by ID
|
|
404
404
|
const order = await dex.getOrder("010000000000000000000002");
|
|
405
405
|
|
|
406
|
+
// Single trade by its synthesized ID (block_height-hex(order_id)-open_quantity)
|
|
407
|
+
const trade = await dex.getTrade("12345-00010000000000003039000000000002-999");
|
|
408
|
+
|
|
406
409
|
// User's trade history
|
|
407
410
|
const myTrades = await dex.listMyTrades({
|
|
408
411
|
address: "ault1...",
|
package/dist/core/clob-gas.d.ts
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
import { type GAS_CONSTANTS } from "./network";
|
|
2
2
|
/**
|
|
3
3
|
* Per-op fee-free gas formulas for the CLOB order methods, shared by the
|
|
4
|
-
* high-level (wallet) and agent factories.
|
|
5
|
-
*
|
|
6
|
-
* (see {@link cancelOrdersGas}). Each takes an explicit `gas` snapshot so a
|
|
7
|
-
* manifest hot-swap is honored on the next call.
|
|
4
|
+
* high-level (wallet) and agent factories. Each takes an explicit `gas`
|
|
5
|
+
* snapshot so a manifest hot-swap is honored on the next call.
|
|
8
6
|
*/
|
|
9
7
|
type Gas = typeof GAS_CONSTANTS;
|
|
10
8
|
export declare function limitOrderGas(gas: Gas): string;
|
|
11
9
|
export declare function marketOrderGas(gas: Gas): string;
|
|
12
10
|
export declare function scaleOrderGas(gas: Gas, subOrderCount: number): string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* fee-free multiplier doesn't absorb the ante the way limit/market/scale do.
|
|
17
|
-
* Wallet (EIP-712) cancels pass `true`; agent cancels are gas-capped and pass
|
|
18
|
-
* `false`. If chain `MinGasLimits` change, revisit whether the other ops also
|
|
19
|
-
* need the ante.
|
|
20
|
-
*/
|
|
21
|
-
export declare function cancelOrdersGas(gas: Gas, orderCount: number, includeAnte: boolean): string;
|
|
22
|
-
/**
|
|
23
|
-
* Modify gas: per-order minimum with no base (chain `MinGasPerModifyOrder`).
|
|
24
|
-
* Same ante reasoning as {@link cancelOrdersGas} — wallet modifies pass
|
|
25
|
-
* `includeAnte: true`; agent modifies are gas-capped and pass `false`.
|
|
26
|
-
*/
|
|
27
|
-
export declare function modifyOrdersGas(gas: Gas, orderCount: number, includeAnte: boolean): string;
|
|
11
|
+
export declare function cancelOrdersGas(gas: Gas, orderCount: number): string;
|
|
12
|
+
/** Modify gas: per-order minimum with no base (chain `MinGasPerModifyOrder`). */
|
|
13
|
+
export declare function modifyOrdersGas(gas: Gas, orderCount: number): string;
|
|
28
14
|
export {};
|
|
@@ -28,18 +28,27 @@ export declare function mergeManifests(base: Manifest | null, top: Manifest | nu
|
|
|
28
28
|
* numerics are pre-validated by `ManifestEip712Schema`.
|
|
29
29
|
*/
|
|
30
30
|
export declare function applyNetworkOverrides(network: NetworkConfig, manifest: Manifest | null): NetworkConfig;
|
|
31
|
+
/**
|
|
32
|
+
* GAS_CONSTANTS keys the manifest is never allowed to override.
|
|
33
|
+
*
|
|
34
|
+
* `EIP712_FEE_AMOUNT`, `EIP712_GAS_LIMIT`, and `DENOM` travel via
|
|
35
|
+
* `ManifestEip712Schema` (`feeAmount`, `gasLimit`, `feeDenom`) and apply
|
|
36
|
+
* through `applyNetworkOverrides` — the broadcast layer reads them off
|
|
37
|
+
* `network.eip712*`, so accepting them in the gas blob would be a silent
|
|
38
|
+
* no-op surface.
|
|
39
|
+
*
|
|
40
|
+
* Single source of truth: `applyGasOverrides` strips these keys, and the
|
|
41
|
+
* schema/baseline parity test derives its exclusion set from this list.
|
|
42
|
+
*/
|
|
43
|
+
export declare const NON_OVERRIDABLE_GAS_KEYS: readonly ["EIP712_FEE_AMOUNT", "EIP712_GAS_LIMIT", "DENOM"];
|
|
31
44
|
/**
|
|
32
45
|
* Returns a GAS_CONSTANTS-shaped object with manifest gas overrides applied.
|
|
33
46
|
*
|
|
34
47
|
* The manifest schema (see `ManifestGasSchema`) only exposes per-msg-type
|
|
35
|
-
* gas and the fee-free multiplier
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* `DENOM`, and `EIP712_ANTE_GAS` so the embedded values stay authoritative for
|
|
40
|
-
* the gas-constants object — the broadcast layer reads the fee/gas/denom off
|
|
41
|
-
* `network.eip712*`, and `EIP712_ANTE_GAS` is a fixed chain-ante constant the
|
|
42
|
-
* manifest is not allowed to override.
|
|
48
|
+
* gas and the fee-free multiplier. As defense in depth (in case a caller
|
|
49
|
+
* bypasses zod and passes a hand-rolled blob), this helper actively drops
|
|
50
|
+
* every `NON_OVERRIDABLE_GAS_KEYS` entry so the embedded values stay
|
|
51
|
+
* authoritative for the gas-constants object.
|
|
43
52
|
*
|
|
44
53
|
* The cast widens the zod-partial back to the concrete `GAS_CONSTANTS` type:
|
|
45
54
|
* every field has a baseline value, so any key the manifest omits keeps the
|
|
@@ -26,6 +26,7 @@ export declare const ManifestGasSchema: z.ZodObject<{
|
|
|
26
26
|
SCALE_ORDER_PER_SUB: z.ZodOptional<z.ZodNumber>;
|
|
27
27
|
CANCEL_ORDER_BASE: z.ZodOptional<z.ZodNumber>;
|
|
28
28
|
CANCEL_ORDER_PER_ID: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
MODIFY_ORDER_PER_ID: z.ZodOptional<z.ZodNumber>;
|
|
29
30
|
OPEN_ACCOUNT: z.ZodOptional<z.ZodNumber>;
|
|
30
31
|
DELEGATE: z.ZodOptional<z.ZodNumber>;
|
|
31
32
|
UNDELEGATE: z.ZodOptional<z.ZodNumber>;
|
|
@@ -77,6 +78,7 @@ export declare const ManifestSchema: z.ZodObject<{
|
|
|
77
78
|
SCALE_ORDER_PER_SUB: z.ZodOptional<z.ZodNumber>;
|
|
78
79
|
CANCEL_ORDER_BASE: z.ZodOptional<z.ZodNumber>;
|
|
79
80
|
CANCEL_ORDER_PER_ID: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
MODIFY_ORDER_PER_ID: z.ZodOptional<z.ZodNumber>;
|
|
80
82
|
OPEN_ACCOUNT: z.ZodOptional<z.ZodNumber>;
|
|
81
83
|
DELEGATE: z.ZodOptional<z.ZodNumber>;
|
|
82
84
|
UNDELEGATE: z.ZodOptional<z.ZodNumber>;
|
package/dist/core/network.d.ts
CHANGED
|
@@ -39,15 +39,6 @@ export declare const GAS_CONSTANTS: {
|
|
|
39
39
|
readonly DENOM: "aault";
|
|
40
40
|
/** Chain multiplier applied to min gas to derive max gas (120 = 1.2×). */
|
|
41
41
|
readonly FEE_FREE_GAS_MULTIPLIER: 120;
|
|
42
|
-
/**
|
|
43
|
-
* EIP-712 ante overhead, in gas. The chain's per-message MinGasLimit values
|
|
44
|
-
* (mirrored below) measure the *handler* cost only; a fee-free EIP-712 tx
|
|
45
|
-
* additionally burns ante gas (sig verification + typed-data decode + tx
|
|
46
|
-
* size) that counts against gasWanted. For small-base ops (cancel) the 1.2×
|
|
47
|
-
* buffer doesn't cover it, so the high-level (EIP-712) path adds this on top.
|
|
48
|
-
* The agent path is capped at MinGasLimit×1.2 and must not add it.
|
|
49
|
-
*/
|
|
50
|
-
readonly EIP712_ANTE_GAS: 30000;
|
|
51
42
|
readonly PER_LICENSE: 200000;
|
|
52
43
|
readonly PER_KYC_MEMBER: 200000;
|
|
53
44
|
readonly PER_DELEGATE_MINING: 200000;
|
package/dist/index.cjs
CHANGED
|
@@ -64,6 +64,8 @@ __export(index_exports, {
|
|
|
64
64
|
GetStatusResponse: () => GetStatusResponse,
|
|
65
65
|
GetTickerParams: () => GetTickerParams,
|
|
66
66
|
GetTickerResponse: () => GetTickerResponse,
|
|
67
|
+
GetTradeParams: () => GetTradeParams,
|
|
68
|
+
GetTradeResponse: () => GetTradeResponse,
|
|
67
69
|
GetTradingFeesResponse: () => GetTradingFeesResponse,
|
|
68
70
|
GetUDFConfigResponse: () => GetUDFConfigResponse,
|
|
69
71
|
GetUDFHistoryQueryParams: () => GetUDFHistoryQueryParams,
|
|
@@ -221,6 +223,16 @@ __export(index_exports, {
|
|
|
221
223
|
getStatsResponseTotalsDepositUsdcVolume24hRegExp: () => getStatsResponseTotalsDepositUsdcVolume24hRegExp,
|
|
222
224
|
getStatsResponseTotalsEstimatedFeeRegExp: () => getStatsResponseTotalsEstimatedFeeRegExp,
|
|
223
225
|
getStatsResponseTotalsQuoteVolumeRegExp: () => getStatsResponseTotalsQuoteVolumeRegExp,
|
|
226
|
+
getTradePathIdMax: () => getTradePathIdMax,
|
|
227
|
+
getTradePathIdRegExp: () => getTradePathIdRegExp,
|
|
228
|
+
getTradeResponseAmountRegExp: () => getTradeResponseAmountRegExp,
|
|
229
|
+
getTradeResponseCostRegExp: () => getTradeResponseCostRegExp,
|
|
230
|
+
getTradeResponseFeeCostRegExp: () => getTradeResponseFeeCostRegExp,
|
|
231
|
+
getTradeResponseFeeRateRegExp: () => getTradeResponseFeeRateRegExp,
|
|
232
|
+
getTradeResponseInfoAddressOneRegExp: () => getTradeResponseInfoAddressOneRegExp,
|
|
233
|
+
getTradeResponseInfoBlockHeightRegExp: () => getTradeResponseInfoBlockHeightRegExp,
|
|
234
|
+
getTradeResponseInfoEventIndexMin: () => getTradeResponseInfoEventIndexMin,
|
|
235
|
+
getTradeResponsePriceRegExp: () => getTradeResponsePriceRegExp,
|
|
224
236
|
getTradingFeesResponseMakerRegExp: () => getTradingFeesResponseMakerRegExp,
|
|
225
237
|
getTradingFeesResponseTakerRegExp: () => getTradingFeesResponseTakerRegExp,
|
|
226
238
|
getUDFHistoryQueryCountbackMax: () => getUDFHistoryQueryCountbackMax,
|
|
@@ -240,6 +252,7 @@ __export(index_exports, {
|
|
|
240
252
|
listMyTradesResponseFeeRateRegExp: () => listMyTradesResponseFeeRateRegExp,
|
|
241
253
|
listMyTradesResponseInfoAddressOneRegExp: () => listMyTradesResponseInfoAddressOneRegExp,
|
|
242
254
|
listMyTradesResponseInfoBlockHeightRegExp: () => listMyTradesResponseInfoBlockHeightRegExp,
|
|
255
|
+
listMyTradesResponseInfoEventIndexMin: () => listMyTradesResponseInfoEventIndexMin,
|
|
243
256
|
listMyTradesResponsePriceRegExp: () => listMyTradesResponsePriceRegExp,
|
|
244
257
|
listOrdersQueryAddressOneRegExp: () => listOrdersQueryAddressOneRegExp,
|
|
245
258
|
listOrdersQueryAddressTwoRegExp: () => listOrdersQueryAddressTwoRegExp,
|
|
@@ -264,6 +277,7 @@ __export(index_exports, {
|
|
|
264
277
|
listTradesResponseFeeRateRegExp: () => listTradesResponseFeeRateRegExp,
|
|
265
278
|
listTradesResponseInfoAddressOneRegExp: () => listTradesResponseInfoAddressOneRegExp,
|
|
266
279
|
listTradesResponseInfoBlockHeightRegExp: () => listTradesResponseInfoBlockHeightRegExp,
|
|
280
|
+
listTradesResponseInfoEventIndexMin: () => listTradesResponseInfoEventIndexMin,
|
|
267
281
|
listTradesResponsePriceRegExp: () => listTradesResponsePriceRegExp,
|
|
268
282
|
mergeManifests: () => mergeManifests,
|
|
269
283
|
msg: () => msg,
|
|
@@ -629,7 +643,7 @@ var NETWORKS = {
|
|
|
629
643
|
rpcUrl: "https://mainnet-rpc-proxy.aultblockchain.xyz/cosmos-rpc",
|
|
630
644
|
restUrl: "https://mainnet-rpc-proxy.aultblockchain.xyz/rest",
|
|
631
645
|
evmRpcUrl: "https://mainnet-rpc-proxy.aultblockchain.xyz/evm",
|
|
632
|
-
explorerUrl: "https://ault.explorer.
|
|
646
|
+
explorerUrl: "https://ault.explorer.orynt.tech",
|
|
633
647
|
isProduction: true
|
|
634
648
|
},
|
|
635
649
|
"ault_10904-1": {
|
|
@@ -640,7 +654,7 @@ var NETWORKS = {
|
|
|
640
654
|
rpcUrl: "https://test-rpc.cloud.aultblockchain.xyz",
|
|
641
655
|
restUrl: "https://test-api.cloud.aultblockchain.xyz",
|
|
642
656
|
evmRpcUrl: "https://test-json-rpc.cloud.aultblockchain.xyz",
|
|
643
|
-
explorerUrl: "https://testnet
|
|
657
|
+
explorerUrl: "https://ault-testnet.explorer.orynt.tech",
|
|
644
658
|
dexApiUrl: "https://test-dex-api.cloud.aultblockchain.xyz",
|
|
645
659
|
isProduction: false
|
|
646
660
|
},
|
|
@@ -709,15 +723,6 @@ var GAS_CONSTANTS = {
|
|
|
709
723
|
DENOM: "aault",
|
|
710
724
|
/** Chain multiplier applied to min gas to derive max gas (120 = 1.2×). */
|
|
711
725
|
FEE_FREE_GAS_MULTIPLIER: 120,
|
|
712
|
-
/**
|
|
713
|
-
* EIP-712 ante overhead, in gas. The chain's per-message MinGasLimit values
|
|
714
|
-
* (mirrored below) measure the *handler* cost only; a fee-free EIP-712 tx
|
|
715
|
-
* additionally burns ante gas (sig verification + typed-data decode + tx
|
|
716
|
-
* size) that counts against gasWanted. For small-base ops (cancel) the 1.2×
|
|
717
|
-
* buffer doesn't cover it, so the high-level (EIP-712) path adds this on top.
|
|
718
|
-
* The agent path is capped at MinGasLimit×1.2 and must not add it.
|
|
719
|
-
*/
|
|
720
|
-
EIP712_ANTE_GAS: 3e4,
|
|
721
726
|
// License module
|
|
722
727
|
PER_LICENSE: 2e5,
|
|
723
728
|
PER_KYC_MEMBER: 2e5,
|
|
@@ -3801,8 +3806,10 @@ function isSet15(value) {
|
|
|
3801
3806
|
}
|
|
3802
3807
|
|
|
3803
3808
|
// src/rest/clob.ts
|
|
3809
|
+
var ORDER_ID_HEX_RE = new RegExp(`^(0[xX])?[0-9a-fA-F]{${ORDER_ID_LENGTH * 2}}$`);
|
|
3804
3810
|
function normalizeOrderId(orderId) {
|
|
3805
|
-
|
|
3811
|
+
if (typeof orderId !== "string") return bytesToBase64(orderId);
|
|
3812
|
+
return ORDER_ID_HEX_RE.test(orderId) ? OrderId.fromHex(orderId).toBase64() : orderId;
|
|
3806
3813
|
}
|
|
3807
3814
|
function normalizeMarketId(marketId) {
|
|
3808
3815
|
return typeof marketId === "string" ? marketId : bytesToBase64(marketId);
|
|
@@ -11001,6 +11008,7 @@ __export(dex_generated_exports, {
|
|
|
11001
11008
|
getGetStatsUrl: () => getGetStatsUrl,
|
|
11002
11009
|
getGetStatusUrl: () => getGetStatusUrl,
|
|
11003
11010
|
getGetTickerUrl: () => getGetTickerUrl,
|
|
11011
|
+
getGetTradeUrl: () => getGetTradeUrl,
|
|
11004
11012
|
getGetTradingFeesUrl: () => getGetTradingFeesUrl,
|
|
11005
11013
|
getGetUDFConfigUrl: () => getGetUDFConfigUrl,
|
|
11006
11014
|
getGetUDFHistoryUrl: () => getGetUDFHistoryUrl,
|
|
@@ -11026,6 +11034,7 @@ __export(dex_generated_exports, {
|
|
|
11026
11034
|
getStats: () => getStats,
|
|
11027
11035
|
getStatus: () => getStatus,
|
|
11028
11036
|
getTicker: () => getTicker,
|
|
11037
|
+
getTrade: () => getTrade,
|
|
11029
11038
|
getTradingFees: () => getTradingFees,
|
|
11030
11039
|
getUDFConfig: () => getUDFConfig,
|
|
11031
11040
|
getUDFHistory: () => getUDFHistory,
|
|
@@ -11268,6 +11277,15 @@ var listTrades = async (symbol, params, options) => {
|
|
|
11268
11277
|
method: "GET"
|
|
11269
11278
|
});
|
|
11270
11279
|
};
|
|
11280
|
+
var getGetTradeUrl = (id) => {
|
|
11281
|
+
return `/api/v1/trade/${id}`;
|
|
11282
|
+
};
|
|
11283
|
+
var getTrade = async (id, options) => {
|
|
11284
|
+
return dexFetch(getGetTradeUrl(id), {
|
|
11285
|
+
...options,
|
|
11286
|
+
method: "GET"
|
|
11287
|
+
});
|
|
11288
|
+
};
|
|
11271
11289
|
var getGetTradingFeesUrl = () => {
|
|
11272
11290
|
return `/api/v1/fees`;
|
|
11273
11291
|
};
|
|
@@ -11542,6 +11560,7 @@ function createDexApi(context) {
|
|
|
11542
11560
|
getOHLCV: bind(context, getOHLCV),
|
|
11543
11561
|
listOrders: bind(context, listOrders),
|
|
11544
11562
|
getOrder: bind(context, getOrder),
|
|
11563
|
+
getTrade: bind(context, getTrade),
|
|
11545
11564
|
listMyTrades: bind(context, listMyTrades),
|
|
11546
11565
|
getBalance: bind(context, getBalance),
|
|
11547
11566
|
getStats: bind(context, getStats),
|
|
@@ -23714,24 +23733,16 @@ function scaleOrderGas(gas, subOrderCount) {
|
|
|
23714
23733
|
gas.FEE_FREE_GAS_MULTIPLIER
|
|
23715
23734
|
);
|
|
23716
23735
|
}
|
|
23717
|
-
function cancelOrdersGas(gas, orderCount
|
|
23718
|
-
|
|
23736
|
+
function cancelOrdersGas(gas, orderCount) {
|
|
23737
|
+
return computeFeeFreeGasCompound(
|
|
23719
23738
|
gas.CANCEL_ORDER_BASE,
|
|
23720
23739
|
gas.CANCEL_ORDER_PER_ID,
|
|
23721
23740
|
orderCount,
|
|
23722
23741
|
gas.FEE_FREE_GAS_MULTIPLIER
|
|
23723
23742
|
);
|
|
23724
|
-
if (!includeAnte) return feeFree;
|
|
23725
|
-
return (BigInt(feeFree) + BigInt(gas.EIP712_ANTE_GAS)).toString();
|
|
23726
23743
|
}
|
|
23727
|
-
function modifyOrdersGas(gas, orderCount
|
|
23728
|
-
|
|
23729
|
-
gas.MODIFY_ORDER_PER_ID,
|
|
23730
|
-
orderCount,
|
|
23731
|
-
gas.FEE_FREE_GAS_MULTIPLIER
|
|
23732
|
-
);
|
|
23733
|
-
if (!includeAnte) return feeFree;
|
|
23734
|
-
return (BigInt(feeFree) + BigInt(gas.EIP712_ANTE_GAS)).toString();
|
|
23744
|
+
function modifyOrdersGas(gas, orderCount) {
|
|
23745
|
+
return computeFeeFreeGas(gas.MODIFY_ORDER_PER_ID, orderCount, gas.FEE_FREE_GAS_MULTIPLIER);
|
|
23735
23746
|
}
|
|
23736
23747
|
|
|
23737
23748
|
// src/high-level/tx/clob.ts
|
|
@@ -23783,16 +23794,18 @@ function createClobTxApi({ signerAddress, exec, getGas }) {
|
|
|
23783
23794
|
orderIds,
|
|
23784
23795
|
wait,
|
|
23785
23796
|
gasLimit,
|
|
23797
|
+
feeDenom,
|
|
23786
23798
|
feeAmount,
|
|
23787
23799
|
memo,
|
|
23788
23800
|
confirmationTimeoutMs
|
|
23789
23801
|
}) {
|
|
23790
23802
|
const gas = getGas();
|
|
23791
|
-
const cancelGas = gasLimit ?? cancelOrdersGas(gas, orderIds.length
|
|
23803
|
+
const cancelGas = gasLimit ?? cancelOrdersGas(gas, orderIds.length);
|
|
23792
23804
|
return withWaitDecode(
|
|
23793
23805
|
wait,
|
|
23794
23806
|
(w) => exec([buildCancelOrdersMsg(signerAddress, orderIds)], {
|
|
23795
23807
|
gasLimit: cancelGas,
|
|
23808
|
+
feeDenom,
|
|
23796
23809
|
feeAmount,
|
|
23797
23810
|
memo,
|
|
23798
23811
|
confirmationTimeoutMs,
|
|
@@ -23805,6 +23818,7 @@ function createClobTxApi({ signerAddress, exec, getGas }) {
|
|
|
23805
23818
|
orders,
|
|
23806
23819
|
wait,
|
|
23807
23820
|
gasLimit,
|
|
23821
|
+
feeDenom,
|
|
23808
23822
|
feeAmount,
|
|
23809
23823
|
memo,
|
|
23810
23824
|
confirmationTimeoutMs
|
|
@@ -23812,11 +23826,12 @@ function createClobTxApi({ signerAddress, exec, getGas }) {
|
|
|
23812
23826
|
const modifyMsg = buildModifyOrdersMsg(signerAddress, orders);
|
|
23813
23827
|
assertUniformModifyShape(orders);
|
|
23814
23828
|
const gas = getGas();
|
|
23815
|
-
const modifyGas = gasLimit ?? modifyOrdersGas(gas, orders.length
|
|
23829
|
+
const modifyGas = gasLimit ?? modifyOrdersGas(gas, orders.length);
|
|
23816
23830
|
return withWaitDecode(
|
|
23817
23831
|
wait,
|
|
23818
23832
|
(w) => exec([modifyMsg], {
|
|
23819
23833
|
gasLimit: modifyGas,
|
|
23834
|
+
feeDenom,
|
|
23820
23835
|
feeAmount,
|
|
23821
23836
|
memo,
|
|
23822
23837
|
confirmationTimeoutMs,
|
|
@@ -24897,6 +24912,7 @@ var ManifestGasSchema = import_zod.z.object({
|
|
|
24897
24912
|
SCALE_ORDER_PER_SUB: import_zod.z.number().int().positive(),
|
|
24898
24913
|
CANCEL_ORDER_BASE: import_zod.z.number().int().positive(),
|
|
24899
24914
|
CANCEL_ORDER_PER_ID: import_zod.z.number().int().positive(),
|
|
24915
|
+
MODIFY_ORDER_PER_ID: import_zod.z.number().int().positive(),
|
|
24900
24916
|
OPEN_ACCOUNT: import_zod.z.number().int().positive(),
|
|
24901
24917
|
DELEGATE: import_zod.z.number().int().positive(),
|
|
24902
24918
|
UNDELEGATE: import_zod.z.number().int().positive(),
|
|
@@ -24988,17 +25004,13 @@ function applyNetworkOverrides(network, manifest) {
|
|
|
24988
25004
|
...manifest.eip712?.gasLimit != null ? { eip712GasLimit: manifest.eip712.gasLimit } : {}
|
|
24989
25005
|
};
|
|
24990
25006
|
}
|
|
25007
|
+
var NON_OVERRIDABLE_GAS_KEYS = ["EIP712_FEE_AMOUNT", "EIP712_GAS_LIMIT", "DENOM"];
|
|
25008
|
+
var NON_OVERRIDABLE_GAS_KEY_SET = new Set(NON_OVERRIDABLE_GAS_KEYS);
|
|
24991
25009
|
function applyGasOverrides(gas) {
|
|
24992
25010
|
if (!gas) return GAS_CONSTANTS;
|
|
24993
|
-
const {
|
|
24994
|
-
EIP712_FEE_AMOUNT: _ignoredFee,
|
|
24995
|
-
EIP712_GAS_LIMIT: _ignoredGas,
|
|
24996
|
-
DENOM: _ignoredDenom,
|
|
24997
|
-
EIP712_ANTE_GAS: _ignoredAnte,
|
|
24998
|
-
...rest
|
|
24999
|
-
} = gas;
|
|
25000
25011
|
const safeRest = {};
|
|
25001
|
-
for (const [k, v] of Object.entries(
|
|
25012
|
+
for (const [k, v] of Object.entries(gas)) {
|
|
25013
|
+
if (NON_OVERRIDABLE_GAS_KEY_SET.has(k)) continue;
|
|
25002
25014
|
if (typeof v === "number" && Number.isInteger(v) && v > 0) {
|
|
25003
25015
|
safeRest[k] = v;
|
|
25004
25016
|
}
|
|
@@ -25372,8 +25384,7 @@ function createAgentClobTxApi({
|
|
|
25372
25384
|
return withWaitDecode(
|
|
25373
25385
|
wait,
|
|
25374
25386
|
(w) => exec([buildCancelOrdersMsg(masterAddress, orderIds)], {
|
|
25375
|
-
|
|
25376
|
-
gasLimit: gasLimit ?? cancelOrdersGas(gas, orderIds.length, false),
|
|
25387
|
+
gasLimit: gasLimit ?? cancelOrdersGas(gas, orderIds.length),
|
|
25377
25388
|
memo,
|
|
25378
25389
|
confirmationTimeoutMs,
|
|
25379
25390
|
timeoutSeconds,
|
|
@@ -25394,8 +25405,7 @@ function createAgentClobTxApi({
|
|
|
25394
25405
|
return withWaitDecode(
|
|
25395
25406
|
wait,
|
|
25396
25407
|
(w) => exec([buildModifyOrdersMsg(masterAddress, orders)], {
|
|
25397
|
-
|
|
25398
|
-
gasLimit: gasLimit ?? modifyOrdersGas(gas, orders.length, false),
|
|
25408
|
+
gasLimit: gasLimit ?? modifyOrdersGas(gas, orders.length),
|
|
25399
25409
|
memo,
|
|
25400
25410
|
confirmationTimeoutMs,
|
|
25401
25411
|
timeoutSeconds,
|
|
@@ -25806,6 +25816,7 @@ var listTradesResponseFeeCostRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
|
25806
25816
|
var listTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25807
25817
|
var listTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
25808
25818
|
var listTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
25819
|
+
var listTradesResponseInfoEventIndexMin = 0;
|
|
25809
25820
|
var ListTradesResponseItem = zod.object({
|
|
25810
25821
|
id: zod.string(),
|
|
25811
25822
|
order: zod.string().nullish(),
|
|
@@ -25851,7 +25862,10 @@ var ListTradesResponseItem = zod.object({
|
|
|
25851
25862
|
received: zod.string().describe(
|
|
25852
25863
|
"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"
|
|
25853
25864
|
),
|
|
25854
|
-
block_height: zod.string().regex(listTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event.")
|
|
25865
|
+
block_height: zod.string().regex(listTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
|
|
25866
|
+
event_index: zod.number().min(listTradesResponseInfoEventIndexMin).describe(
|
|
25867
|
+
"The trade's event position within its block. Together with\n`block_height` it is the row's composite pagination cursor for the\ntrade feed. `created_at` cannot serve this role because every trade\nin a block shares one timestamp.\n"
|
|
25868
|
+
)
|
|
25855
25869
|
}).describe(
|
|
25856
25870
|
"Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
|
|
25857
25871
|
)
|
|
@@ -25859,6 +25873,78 @@ var ListTradesResponseItem = zod.object({
|
|
|
25859
25873
|
"All numeric fields are canonical decimal strings \u2014 quantities at any\nmagnitude survive the JSON round-trip without rounding through\nfloat64. Consumers parse with their own bigdecimal.\n"
|
|
25860
25874
|
);
|
|
25861
25875
|
var ListTradesResponse = zod.array(ListTradesResponseItem);
|
|
25876
|
+
var getTradePathIdMax = 114;
|
|
25877
|
+
var getTradePathIdRegExp = new RegExp(
|
|
25878
|
+
"^(0|[1-9][0-9]*)-[0-9a-f]{32}-(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
|
|
25879
|
+
);
|
|
25880
|
+
var GetTradeParams = zod.object({
|
|
25881
|
+
id: zod.string().max(getTradePathIdMax).regex(getTradePathIdRegExp).describe(
|
|
25882
|
+
"Synthesized trade id in the form\n`<block_height>-<hex(order_id)>-<open_quantity>`, taken verbatim from\na REST trade object's `id` field (not the WebSocket `tid`).\n"
|
|
25883
|
+
)
|
|
25884
|
+
});
|
|
25885
|
+
var getTradeResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25886
|
+
var getTradeResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25887
|
+
var getTradeResponseCostRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25888
|
+
var getTradeResponseFeeCostRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25889
|
+
var getTradeResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25890
|
+
var getTradeResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
25891
|
+
var getTradeResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
25892
|
+
var getTradeResponseInfoEventIndexMin = 0;
|
|
25893
|
+
var GetTradeResponse = zod.object({
|
|
25894
|
+
id: zod.string(),
|
|
25895
|
+
order: zod.string().nullish(),
|
|
25896
|
+
timestamp: zod.number(),
|
|
25897
|
+
datetime: zod.iso.datetime({}),
|
|
25898
|
+
symbol: zod.string(),
|
|
25899
|
+
type: zod.union([
|
|
25900
|
+
zod.literal("limit"),
|
|
25901
|
+
zod.literal("market"),
|
|
25902
|
+
zod.literal("unknown"),
|
|
25903
|
+
zod.literal(null)
|
|
25904
|
+
]).nullish().describe(
|
|
25905
|
+
"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."
|
|
25906
|
+
),
|
|
25907
|
+
cloid: zod.string().nullish().describe(
|
|
25908
|
+
"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)."
|
|
25909
|
+
),
|
|
25910
|
+
side: zod.enum(["buy", "sell"]),
|
|
25911
|
+
takerOrMaker: zod.enum(["taker", "maker"]).optional().describe(
|
|
25912
|
+
"Which leg of the match this fill is. Each match writes a maker leg and a taker leg; the public market feed returns only the maker leg so a market's trades aren't double-counted, while the per-orderer feed returns whichever leg belongs to that orderer."
|
|
25913
|
+
),
|
|
25914
|
+
price: zod.string().regex(getTradeResponsePriceRegExp),
|
|
25915
|
+
amount: zod.string().regex(getTradeResponseAmountRegExp),
|
|
25916
|
+
cost: zod.string().regex(getTradeResponseCostRegExp).describe("price * amount"),
|
|
25917
|
+
fee: zod.object({
|
|
25918
|
+
cost: zod.string().regex(getTradeResponseFeeCostRegExp).optional().describe("Fee cost in `currency` units, decimal string."),
|
|
25919
|
+
currency: zod.string().optional().describe(
|
|
25920
|
+
'Ticker of the fee denom (e.g., "USDT", or "AULT" for a base-denom fee). The quote ticker for the rate-estimated fallback.'
|
|
25921
|
+
),
|
|
25922
|
+
rate: zod.string().regex(getTradeResponseFeeRateRegExp).optional().describe(
|
|
25923
|
+
"This leg's fee rate from the market, decimal string: the maker rate for the maker leg, the taker rate otherwise."
|
|
25924
|
+
)
|
|
25925
|
+
}).optional().describe(
|
|
25926
|
+
"Fee charged on the fill. When the indexer recorded a realized fee, cost and currency report it verbatim; the currency follows the denom the filled leg received, which is the base asset on a taker buy, not always the quote. For rows that predate fee indexing, cost falls back to the estimate amount * price * rate in the quote currency, where rate is this leg's rate (maker_fee_rate for the maker leg, otherwise taker_fee_rate)."
|
|
25927
|
+
),
|
|
25928
|
+
info: zod.object({
|
|
25929
|
+
address: zod.string().regex(getTradeResponseInfoAddressOneRegExp).describe(
|
|
25930
|
+
"Cosmos bech32 account address. The HRP is fixed to `ault` for\naccounts (validators use `aultvaloper`, which this schema rejects).\nLowercased and checksum-verified by the API; mixed-case bech32 is\nrejected to avoid silent EIP-55-style ambiguity.\n"
|
|
25931
|
+
).describe("Bech32 address of the orderer that owns this leg of the fill."),
|
|
25932
|
+
paid: zod.string().describe(
|
|
25933
|
+
'Atto-precision amount the orderer paid for this fill, suffixed\nwith the chain denom (e.g. `"1500000000000000000uusdt"`). Empty\nstring when the chain did not record this side.\n'
|
|
25934
|
+
),
|
|
25935
|
+
received: zod.string().describe(
|
|
25936
|
+
"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"
|
|
25937
|
+
),
|
|
25938
|
+
block_height: zod.string().regex(getTradeResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
|
|
25939
|
+
event_index: zod.number().min(getTradeResponseInfoEventIndexMin).describe(
|
|
25940
|
+
"The trade's event position within its block. Together with\n`block_height` it is the row's composite pagination cursor for the\ntrade feed. `created_at` cannot serve this role because every trade\nin a block shares one timestamp.\n"
|
|
25941
|
+
)
|
|
25942
|
+
}).describe(
|
|
25943
|
+
"Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
|
|
25944
|
+
)
|
|
25945
|
+
}).describe(
|
|
25946
|
+
"All numeric fields are canonical decimal strings \u2014 quantities at any\nmagnitude survive the JSON round-trip without rounding through\nfloat64. Consumers parse with their own bigdecimal.\n"
|
|
25947
|
+
);
|
|
25862
25948
|
var getTradingFeesResponseMakerRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25863
25949
|
var getTradingFeesResponseTakerRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25864
25950
|
var GetTradingFeesResponse = zod.record(
|
|
@@ -26108,6 +26194,7 @@ var listMyTradesResponseFeeCostRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
|
26108
26194
|
var listMyTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
26109
26195
|
var listMyTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
26110
26196
|
var listMyTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
26197
|
+
var listMyTradesResponseInfoEventIndexMin = 0;
|
|
26111
26198
|
var ListMyTradesResponseItem = zod.object({
|
|
26112
26199
|
id: zod.string(),
|
|
26113
26200
|
order: zod.string().nullish(),
|
|
@@ -26153,7 +26240,10 @@ var ListMyTradesResponseItem = zod.object({
|
|
|
26153
26240
|
received: zod.string().describe(
|
|
26154
26241
|
"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"
|
|
26155
26242
|
),
|
|
26156
|
-
block_height: zod.string().regex(listMyTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event.")
|
|
26243
|
+
block_height: zod.string().regex(listMyTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
|
|
26244
|
+
event_index: zod.number().min(listMyTradesResponseInfoEventIndexMin).describe(
|
|
26245
|
+
"The trade's event position within its block. Together with\n`block_height` it is the row's composite pagination cursor for the\ntrade feed. `created_at` cannot serve this role because every trade\nin a block shares one timestamp.\n"
|
|
26246
|
+
)
|
|
26157
26247
|
}).describe(
|
|
26158
26248
|
"Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
|
|
26159
26249
|
)
|
|
@@ -26341,7 +26431,7 @@ function createDexWs(url, options) {
|
|
|
26341
26431
|
}
|
|
26342
26432
|
|
|
26343
26433
|
// src/index.ts
|
|
26344
|
-
var SDK_VERSION = "0.
|
|
26434
|
+
var SDK_VERSION = "0.4.0";
|
|
26345
26435
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26346
26436
|
0 && (module.exports = {
|
|
26347
26437
|
AGENT_DEFAULTS,
|
|
@@ -26378,6 +26468,8 @@ var SDK_VERSION = "0.1.0";
|
|
|
26378
26468
|
GetStatusResponse,
|
|
26379
26469
|
GetTickerParams,
|
|
26380
26470
|
GetTickerResponse,
|
|
26471
|
+
GetTradeParams,
|
|
26472
|
+
GetTradeResponse,
|
|
26381
26473
|
GetTradingFeesResponse,
|
|
26382
26474
|
GetUDFConfigResponse,
|
|
26383
26475
|
GetUDFHistoryQueryParams,
|
|
@@ -26535,6 +26627,16 @@ var SDK_VERSION = "0.1.0";
|
|
|
26535
26627
|
getStatsResponseTotalsDepositUsdcVolume24hRegExp,
|
|
26536
26628
|
getStatsResponseTotalsEstimatedFeeRegExp,
|
|
26537
26629
|
getStatsResponseTotalsQuoteVolumeRegExp,
|
|
26630
|
+
getTradePathIdMax,
|
|
26631
|
+
getTradePathIdRegExp,
|
|
26632
|
+
getTradeResponseAmountRegExp,
|
|
26633
|
+
getTradeResponseCostRegExp,
|
|
26634
|
+
getTradeResponseFeeCostRegExp,
|
|
26635
|
+
getTradeResponseFeeRateRegExp,
|
|
26636
|
+
getTradeResponseInfoAddressOneRegExp,
|
|
26637
|
+
getTradeResponseInfoBlockHeightRegExp,
|
|
26638
|
+
getTradeResponseInfoEventIndexMin,
|
|
26639
|
+
getTradeResponsePriceRegExp,
|
|
26538
26640
|
getTradingFeesResponseMakerRegExp,
|
|
26539
26641
|
getTradingFeesResponseTakerRegExp,
|
|
26540
26642
|
getUDFHistoryQueryCountbackMax,
|
|
@@ -26554,6 +26656,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
26554
26656
|
listMyTradesResponseFeeRateRegExp,
|
|
26555
26657
|
listMyTradesResponseInfoAddressOneRegExp,
|
|
26556
26658
|
listMyTradesResponseInfoBlockHeightRegExp,
|
|
26659
|
+
listMyTradesResponseInfoEventIndexMin,
|
|
26557
26660
|
listMyTradesResponsePriceRegExp,
|
|
26558
26661
|
listOrdersQueryAddressOneRegExp,
|
|
26559
26662
|
listOrdersQueryAddressTwoRegExp,
|
|
@@ -26578,6 +26681,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
26578
26681
|
listTradesResponseFeeRateRegExp,
|
|
26579
26682
|
listTradesResponseInfoAddressOneRegExp,
|
|
26580
26683
|
listTradesResponseInfoBlockHeightRegExp,
|
|
26684
|
+
listTradesResponseInfoEventIndexMin,
|
|
26581
26685
|
listTradesResponsePriceRegExp,
|
|
26582
26686
|
mergeManifests,
|
|
26583
26687
|
msg,
|