ault-sdk-ts 0.1.0 → 0.3.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/manifest-resolver.d.ts +18 -8
- package/dist/core/manifest-types.d.ts +2 -0
- package/dist/index.cjs +138 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +124 -12
- 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/dist/index.js
CHANGED
|
@@ -348,6 +348,8 @@ var NETWORKS = {
|
|
|
348
348
|
restUrl: "https://mainnet-rpc-proxy.aultblockchain.xyz/rest",
|
|
349
349
|
evmRpcUrl: "https://mainnet-rpc-proxy.aultblockchain.xyz/evm",
|
|
350
350
|
explorerUrl: "https://ault.explorer.xangle.io",
|
|
351
|
+
// The dex API lives on its own host, not behind the chain proxy above.
|
|
352
|
+
dexApiUrl: "https://am-api.cloud.aultblockchain.xyz",
|
|
351
353
|
isProduction: true
|
|
352
354
|
},
|
|
353
355
|
"ault_10904-1": {
|
|
@@ -3519,8 +3521,10 @@ function isSet15(value) {
|
|
|
3519
3521
|
}
|
|
3520
3522
|
|
|
3521
3523
|
// src/rest/clob.ts
|
|
3524
|
+
var ORDER_ID_HEX_RE = new RegExp(`^(0[xX])?[0-9a-fA-F]{${ORDER_ID_LENGTH * 2}}$`);
|
|
3522
3525
|
function normalizeOrderId(orderId) {
|
|
3523
|
-
|
|
3526
|
+
if (typeof orderId !== "string") return bytesToBase64(orderId);
|
|
3527
|
+
return ORDER_ID_HEX_RE.test(orderId) ? OrderId.fromHex(orderId).toBase64() : orderId;
|
|
3524
3528
|
}
|
|
3525
3529
|
function normalizeMarketId(marketId) {
|
|
3526
3530
|
return typeof marketId === "string" ? marketId : bytesToBase64(marketId);
|
|
@@ -10719,6 +10723,7 @@ __export(dex_generated_exports, {
|
|
|
10719
10723
|
getGetStatsUrl: () => getGetStatsUrl,
|
|
10720
10724
|
getGetStatusUrl: () => getGetStatusUrl,
|
|
10721
10725
|
getGetTickerUrl: () => getGetTickerUrl,
|
|
10726
|
+
getGetTradeUrl: () => getGetTradeUrl,
|
|
10722
10727
|
getGetTradingFeesUrl: () => getGetTradingFeesUrl,
|
|
10723
10728
|
getGetUDFConfigUrl: () => getGetUDFConfigUrl,
|
|
10724
10729
|
getGetUDFHistoryUrl: () => getGetUDFHistoryUrl,
|
|
@@ -10744,6 +10749,7 @@ __export(dex_generated_exports, {
|
|
|
10744
10749
|
getStats: () => getStats,
|
|
10745
10750
|
getStatus: () => getStatus,
|
|
10746
10751
|
getTicker: () => getTicker,
|
|
10752
|
+
getTrade: () => getTrade,
|
|
10747
10753
|
getTradingFees: () => getTradingFees,
|
|
10748
10754
|
getUDFConfig: () => getUDFConfig,
|
|
10749
10755
|
getUDFHistory: () => getUDFHistory,
|
|
@@ -10986,6 +10992,15 @@ var listTrades = async (symbol, params, options) => {
|
|
|
10986
10992
|
method: "GET"
|
|
10987
10993
|
});
|
|
10988
10994
|
};
|
|
10995
|
+
var getGetTradeUrl = (id) => {
|
|
10996
|
+
return `/api/v1/trade/${id}`;
|
|
10997
|
+
};
|
|
10998
|
+
var getTrade = async (id, options) => {
|
|
10999
|
+
return dexFetch(getGetTradeUrl(id), {
|
|
11000
|
+
...options,
|
|
11001
|
+
method: "GET"
|
|
11002
|
+
});
|
|
11003
|
+
};
|
|
10989
11004
|
var getGetTradingFeesUrl = () => {
|
|
10990
11005
|
return `/api/v1/fees`;
|
|
10991
11006
|
};
|
|
@@ -11260,6 +11275,7 @@ function createDexApi(context) {
|
|
|
11260
11275
|
getOHLCV: bind(context, getOHLCV),
|
|
11261
11276
|
listOrders: bind(context, listOrders),
|
|
11262
11277
|
getOrder: bind(context, getOrder),
|
|
11278
|
+
getTrade: bind(context, getTrade),
|
|
11263
11279
|
listMyTrades: bind(context, listMyTrades),
|
|
11264
11280
|
getBalance: bind(context, getBalance),
|
|
11265
11281
|
getStats: bind(context, getStats),
|
|
@@ -24615,6 +24631,7 @@ var ManifestGasSchema = z.object({
|
|
|
24615
24631
|
SCALE_ORDER_PER_SUB: z.number().int().positive(),
|
|
24616
24632
|
CANCEL_ORDER_BASE: z.number().int().positive(),
|
|
24617
24633
|
CANCEL_ORDER_PER_ID: z.number().int().positive(),
|
|
24634
|
+
MODIFY_ORDER_PER_ID: z.number().int().positive(),
|
|
24618
24635
|
OPEN_ACCOUNT: z.number().int().positive(),
|
|
24619
24636
|
DELEGATE: z.number().int().positive(),
|
|
24620
24637
|
UNDELEGATE: z.number().int().positive(),
|
|
@@ -24706,17 +24723,18 @@ function applyNetworkOverrides(network, manifest) {
|
|
|
24706
24723
|
...manifest.eip712?.gasLimit != null ? { eip712GasLimit: manifest.eip712.gasLimit } : {}
|
|
24707
24724
|
};
|
|
24708
24725
|
}
|
|
24726
|
+
var NON_OVERRIDABLE_GAS_KEYS = [
|
|
24727
|
+
"EIP712_FEE_AMOUNT",
|
|
24728
|
+
"EIP712_GAS_LIMIT",
|
|
24729
|
+
"EIP712_ANTE_GAS",
|
|
24730
|
+
"DENOM"
|
|
24731
|
+
];
|
|
24732
|
+
var NON_OVERRIDABLE_GAS_KEY_SET = new Set(NON_OVERRIDABLE_GAS_KEYS);
|
|
24709
24733
|
function applyGasOverrides(gas) {
|
|
24710
24734
|
if (!gas) return GAS_CONSTANTS;
|
|
24711
|
-
const {
|
|
24712
|
-
EIP712_FEE_AMOUNT: _ignoredFee,
|
|
24713
|
-
EIP712_GAS_LIMIT: _ignoredGas,
|
|
24714
|
-
DENOM: _ignoredDenom,
|
|
24715
|
-
EIP712_ANTE_GAS: _ignoredAnte,
|
|
24716
|
-
...rest
|
|
24717
|
-
} = gas;
|
|
24718
24735
|
const safeRest = {};
|
|
24719
|
-
for (const [k, v] of Object.entries(
|
|
24736
|
+
for (const [k, v] of Object.entries(gas)) {
|
|
24737
|
+
if (NON_OVERRIDABLE_GAS_KEY_SET.has(k)) continue;
|
|
24720
24738
|
if (typeof v === "number" && Number.isInteger(v) && v > 0) {
|
|
24721
24739
|
safeRest[k] = v;
|
|
24722
24740
|
}
|
|
@@ -25524,6 +25542,7 @@ var listTradesResponseFeeCostRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
|
25524
25542
|
var listTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25525
25543
|
var listTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
25526
25544
|
var listTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
25545
|
+
var listTradesResponseInfoEventIndexMin = 0;
|
|
25527
25546
|
var ListTradesResponseItem = zod.object({
|
|
25528
25547
|
id: zod.string(),
|
|
25529
25548
|
order: zod.string().nullish(),
|
|
@@ -25569,7 +25588,10 @@ var ListTradesResponseItem = zod.object({
|
|
|
25569
25588
|
received: zod.string().describe(
|
|
25570
25589
|
"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"
|
|
25571
25590
|
),
|
|
25572
|
-
block_height: zod.string().regex(listTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event.")
|
|
25591
|
+
block_height: zod.string().regex(listTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
|
|
25592
|
+
event_index: zod.number().min(listTradesResponseInfoEventIndexMin).describe(
|
|
25593
|
+
"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"
|
|
25594
|
+
)
|
|
25573
25595
|
}).describe(
|
|
25574
25596
|
"Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
|
|
25575
25597
|
)
|
|
@@ -25577,6 +25599,78 @@ var ListTradesResponseItem = zod.object({
|
|
|
25577
25599
|
"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"
|
|
25578
25600
|
);
|
|
25579
25601
|
var ListTradesResponse = zod.array(ListTradesResponseItem);
|
|
25602
|
+
var getTradePathIdMax = 114;
|
|
25603
|
+
var getTradePathIdRegExp = new RegExp(
|
|
25604
|
+
"^(0|[1-9][0-9]*)-[0-9a-f]{32}-(0|[1-9][0-9]*)(\\.[0-9]*[1-9])?$"
|
|
25605
|
+
);
|
|
25606
|
+
var GetTradeParams = zod.object({
|
|
25607
|
+
id: zod.string().max(getTradePathIdMax).regex(getTradePathIdRegExp).describe(
|
|
25608
|
+
"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"
|
|
25609
|
+
)
|
|
25610
|
+
});
|
|
25611
|
+
var getTradeResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25612
|
+
var getTradeResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25613
|
+
var getTradeResponseCostRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25614
|
+
var getTradeResponseFeeCostRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25615
|
+
var getTradeResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25616
|
+
var getTradeResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
25617
|
+
var getTradeResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
25618
|
+
var getTradeResponseInfoEventIndexMin = 0;
|
|
25619
|
+
var GetTradeResponse = zod.object({
|
|
25620
|
+
id: zod.string(),
|
|
25621
|
+
order: zod.string().nullish(),
|
|
25622
|
+
timestamp: zod.number(),
|
|
25623
|
+
datetime: zod.iso.datetime({}),
|
|
25624
|
+
symbol: zod.string(),
|
|
25625
|
+
type: zod.union([
|
|
25626
|
+
zod.literal("limit"),
|
|
25627
|
+
zod.literal("market"),
|
|
25628
|
+
zod.literal("unknown"),
|
|
25629
|
+
zod.literal(null)
|
|
25630
|
+
]).nullish().describe(
|
|
25631
|
+
"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."
|
|
25632
|
+
),
|
|
25633
|
+
cloid: zod.string().nullish().describe(
|
|
25634
|
+
"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)."
|
|
25635
|
+
),
|
|
25636
|
+
side: zod.enum(["buy", "sell"]),
|
|
25637
|
+
takerOrMaker: zod.enum(["taker", "maker"]).optional().describe(
|
|
25638
|
+
"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."
|
|
25639
|
+
),
|
|
25640
|
+
price: zod.string().regex(getTradeResponsePriceRegExp),
|
|
25641
|
+
amount: zod.string().regex(getTradeResponseAmountRegExp),
|
|
25642
|
+
cost: zod.string().regex(getTradeResponseCostRegExp).describe("price * amount"),
|
|
25643
|
+
fee: zod.object({
|
|
25644
|
+
cost: zod.string().regex(getTradeResponseFeeCostRegExp).optional().describe("Fee cost in `currency` units, decimal string."),
|
|
25645
|
+
currency: zod.string().optional().describe(
|
|
25646
|
+
'Ticker of the fee denom (e.g., "USDT", or "AULT" for a base-denom fee). The quote ticker for the rate-estimated fallback.'
|
|
25647
|
+
),
|
|
25648
|
+
rate: zod.string().regex(getTradeResponseFeeRateRegExp).optional().describe(
|
|
25649
|
+
"This leg's fee rate from the market, decimal string: the maker rate for the maker leg, the taker rate otherwise."
|
|
25650
|
+
)
|
|
25651
|
+
}).optional().describe(
|
|
25652
|
+
"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)."
|
|
25653
|
+
),
|
|
25654
|
+
info: zod.object({
|
|
25655
|
+
address: zod.string().regex(getTradeResponseInfoAddressOneRegExp).describe(
|
|
25656
|
+
"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"
|
|
25657
|
+
).describe("Bech32 address of the orderer that owns this leg of the fill."),
|
|
25658
|
+
paid: zod.string().describe(
|
|
25659
|
+
'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'
|
|
25660
|
+
),
|
|
25661
|
+
received: zod.string().describe(
|
|
25662
|
+
"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"
|
|
25663
|
+
),
|
|
25664
|
+
block_height: zod.string().regex(getTradeResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
|
|
25665
|
+
event_index: zod.number().min(getTradeResponseInfoEventIndexMin).describe(
|
|
25666
|
+
"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"
|
|
25667
|
+
)
|
|
25668
|
+
}).describe(
|
|
25669
|
+
"Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
|
|
25670
|
+
)
|
|
25671
|
+
}).describe(
|
|
25672
|
+
"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"
|
|
25673
|
+
);
|
|
25580
25674
|
var getTradingFeesResponseMakerRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25581
25675
|
var getTradingFeesResponseTakerRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25582
25676
|
var GetTradingFeesResponse = zod.record(
|
|
@@ -25826,6 +25920,7 @@ var listMyTradesResponseFeeCostRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
|
25826
25920
|
var listMyTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25827
25921
|
var listMyTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
25828
25922
|
var listMyTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
25923
|
+
var listMyTradesResponseInfoEventIndexMin = 0;
|
|
25829
25924
|
var ListMyTradesResponseItem = zod.object({
|
|
25830
25925
|
id: zod.string(),
|
|
25831
25926
|
order: zod.string().nullish(),
|
|
@@ -25871,7 +25966,10 @@ var ListMyTradesResponseItem = zod.object({
|
|
|
25871
25966
|
received: zod.string().describe(
|
|
25872
25967
|
"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"
|
|
25873
25968
|
),
|
|
25874
|
-
block_height: zod.string().regex(listMyTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event.")
|
|
25969
|
+
block_height: zod.string().regex(listMyTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
|
|
25970
|
+
event_index: zod.number().min(listMyTradesResponseInfoEventIndexMin).describe(
|
|
25971
|
+
"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"
|
|
25972
|
+
)
|
|
25875
25973
|
}).describe(
|
|
25876
25974
|
"Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
|
|
25877
25975
|
)
|
|
@@ -26059,7 +26157,7 @@ function createDexWs(url, options) {
|
|
|
26059
26157
|
}
|
|
26060
26158
|
|
|
26061
26159
|
// src/index.ts
|
|
26062
|
-
var SDK_VERSION = "0.
|
|
26160
|
+
var SDK_VERSION = "0.3.0";
|
|
26063
26161
|
export {
|
|
26064
26162
|
AGENT_DEFAULTS,
|
|
26065
26163
|
AULT_SIGNER_MARKER,
|
|
@@ -26095,6 +26193,8 @@ export {
|
|
|
26095
26193
|
GetStatusResponse,
|
|
26096
26194
|
GetTickerParams,
|
|
26097
26195
|
GetTickerResponse,
|
|
26196
|
+
GetTradeParams,
|
|
26197
|
+
GetTradeResponse,
|
|
26098
26198
|
GetTradingFeesResponse,
|
|
26099
26199
|
GetUDFConfigResponse,
|
|
26100
26200
|
GetUDFHistoryQueryParams,
|
|
@@ -26252,6 +26352,16 @@ export {
|
|
|
26252
26352
|
getStatsResponseTotalsDepositUsdcVolume24hRegExp,
|
|
26253
26353
|
getStatsResponseTotalsEstimatedFeeRegExp,
|
|
26254
26354
|
getStatsResponseTotalsQuoteVolumeRegExp,
|
|
26355
|
+
getTradePathIdMax,
|
|
26356
|
+
getTradePathIdRegExp,
|
|
26357
|
+
getTradeResponseAmountRegExp,
|
|
26358
|
+
getTradeResponseCostRegExp,
|
|
26359
|
+
getTradeResponseFeeCostRegExp,
|
|
26360
|
+
getTradeResponseFeeRateRegExp,
|
|
26361
|
+
getTradeResponseInfoAddressOneRegExp,
|
|
26362
|
+
getTradeResponseInfoBlockHeightRegExp,
|
|
26363
|
+
getTradeResponseInfoEventIndexMin,
|
|
26364
|
+
getTradeResponsePriceRegExp,
|
|
26255
26365
|
getTradingFeesResponseMakerRegExp,
|
|
26256
26366
|
getTradingFeesResponseTakerRegExp,
|
|
26257
26367
|
getUDFHistoryQueryCountbackMax,
|
|
@@ -26271,6 +26381,7 @@ export {
|
|
|
26271
26381
|
listMyTradesResponseFeeRateRegExp,
|
|
26272
26382
|
listMyTradesResponseInfoAddressOneRegExp,
|
|
26273
26383
|
listMyTradesResponseInfoBlockHeightRegExp,
|
|
26384
|
+
listMyTradesResponseInfoEventIndexMin,
|
|
26274
26385
|
listMyTradesResponsePriceRegExp,
|
|
26275
26386
|
listOrdersQueryAddressOneRegExp,
|
|
26276
26387
|
listOrdersQueryAddressTwoRegExp,
|
|
@@ -26295,6 +26406,7 @@ export {
|
|
|
26295
26406
|
listTradesResponseFeeRateRegExp,
|
|
26296
26407
|
listTradesResponseInfoAddressOneRegExp,
|
|
26297
26408
|
listTradesResponseInfoBlockHeightRegExp,
|
|
26409
|
+
listTradesResponseInfoEventIndexMin,
|
|
26298
26410
|
listTradesResponsePriceRegExp,
|
|
26299
26411
|
mergeManifests,
|
|
26300
26412
|
msg,
|