ault-sdk-ts 0.0.2-alpha.25 → 0.0.2-alpha.27
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 +23 -0
- package/dist/core/clob-msgs.d.ts +5 -2
- package/dist/core/clob-responses.d.ts +2 -2
- package/dist/core/cloid.d.ts +4 -0
- package/dist/eip712/msg.generated.d.ts +2 -2
- package/dist/high-level/cloid-lookup.d.ts +9 -0
- package/dist/high-level/types.d.ts +41 -3
- package/dist/high-level-client.d.ts +1 -1
- package/dist/index.cjs +475 -225
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +464 -220
- package/dist/index.js.map +1 -1
- package/dist/proto/gen/ault/clob/v1/genesis.d.ts +8 -0
- package/dist/proto/gen/ault/clob/v1/query.d.ts +6 -0
- package/dist/proto/gen/ault/clob/v1/tx.d.ts +5 -0
- package/dist/rest/clob.d.ts +7 -0
- package/dist/rest/dex-types.generated.d.ts +10 -4
- package/dist/rest/dex.d.ts +5 -0
- package/dist/rest/dex.generated.d.ts +39 -11
- package/dist/rest/portfolio.d.ts +103 -0
- package/dist/utils/opaque-id.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -101,6 +101,7 @@ __export(index_exports, {
|
|
|
101
101
|
MissingMsgResponseError: () => MissingMsgResponseError,
|
|
102
102
|
NETWORKS: () => NETWORKS,
|
|
103
103
|
NetworkError: () => NetworkError,
|
|
104
|
+
ORDER_ID_LENGTH: () => ORDER_ID_LENGTH,
|
|
104
105
|
OrderId: () => OrderId,
|
|
105
106
|
PageResponseSchema: () => PageResponseSchema,
|
|
106
107
|
REST_CONTEXT_BRAND: () => REST_CONTEXT_BRAND,
|
|
@@ -207,6 +208,10 @@ __export(index_exports, {
|
|
|
207
208
|
getOrderbookQueryLimitDefault: () => getOrderbookQueryLimitDefault,
|
|
208
209
|
getOrderbookQueryLimitMax: () => getOrderbookQueryLimitMax,
|
|
209
210
|
getOrderbookResponseMarketIdRegExp: () => getOrderbookResponseMarketIdRegExp,
|
|
211
|
+
getPortfolioFlows: () => getPortfolioFlows,
|
|
212
|
+
getPortfolioHoldings: () => getPortfolioHoldings,
|
|
213
|
+
getPortfolioPnl: () => getPortfolioPnl,
|
|
214
|
+
getPortfolioTimeSeries: () => getPortfolioTimeSeries,
|
|
210
215
|
getStatsResponseMarketsItemBaseVolumeRegExp: () => getStatsResponseMarketsItemBaseVolumeRegExp,
|
|
211
216
|
getStatsResponseMarketsItemEstimatedFeeRegExp: () => getStatsResponseMarketsItemEstimatedFeeRegExp,
|
|
212
217
|
getStatsResponseMarketsItemQuoteVolumeRegExp: () => getStatsResponseMarketsItemQuoteVolumeRegExp,
|
|
@@ -238,6 +243,7 @@ __export(index_exports, {
|
|
|
238
243
|
listMyTradesResponsePriceRegExp: () => listMyTradesResponsePriceRegExp,
|
|
239
244
|
listOrdersQueryAddressOneRegExp: () => listOrdersQueryAddressOneRegExp,
|
|
240
245
|
listOrdersQueryAddressTwoRegExp: () => listOrdersQueryAddressTwoRegExp,
|
|
246
|
+
listOrdersQueryCloidRegExp: () => listOrdersQueryCloidRegExp,
|
|
241
247
|
listOrdersQueryLimitDefault: () => listOrdersQueryLimitDefault,
|
|
242
248
|
listOrdersQueryLimitMax: () => listOrdersQueryLimitMax,
|
|
243
249
|
listOrdersQueryMarketIdRegExp: () => listOrdersQueryMarketIdRegExp,
|
|
@@ -2861,6 +2867,192 @@ function createBankApi(context) {
|
|
|
2861
2867
|
};
|
|
2862
2868
|
}
|
|
2863
2869
|
|
|
2870
|
+
// src/utils/opaque-id.ts
|
|
2871
|
+
var import_viem2 = require("viem");
|
|
2872
|
+
function decodeHex(input) {
|
|
2873
|
+
const clean = input.startsWith("0x") || input.startsWith("0X") ? input.slice(2) : input;
|
|
2874
|
+
if (clean.length % 2 !== 0) {
|
|
2875
|
+
throw new Error(`invalid hex length: "${input}"`);
|
|
2876
|
+
}
|
|
2877
|
+
if (clean.length > 0 && !/^[0-9a-fA-F]+$/.test(clean)) {
|
|
2878
|
+
throw new Error(`invalid hex characters: "${input}"`);
|
|
2879
|
+
}
|
|
2880
|
+
return (0, import_viem2.hexToBytes)(`0x${clean}`);
|
|
2881
|
+
}
|
|
2882
|
+
function encodeHex(bytes) {
|
|
2883
|
+
return (0, import_viem2.bytesToHex)(bytes).slice(2);
|
|
2884
|
+
}
|
|
2885
|
+
function bytesEqual(a, b) {
|
|
2886
|
+
if (a.length !== b.length) return false;
|
|
2887
|
+
for (let i = 0; i < a.length; i++) {
|
|
2888
|
+
if (a[i] !== b[i]) return false;
|
|
2889
|
+
}
|
|
2890
|
+
return true;
|
|
2891
|
+
}
|
|
2892
|
+
var OpaqueId = class {
|
|
2893
|
+
constructor(bytes) {
|
|
2894
|
+
this.bytes = bytes;
|
|
2895
|
+
}
|
|
2896
|
+
toBytes() {
|
|
2897
|
+
return new Uint8Array(this.bytes);
|
|
2898
|
+
}
|
|
2899
|
+
toHex() {
|
|
2900
|
+
return encodeHex(this.bytes);
|
|
2901
|
+
}
|
|
2902
|
+
toBase64() {
|
|
2903
|
+
return bytesToBase64(this.bytes);
|
|
2904
|
+
}
|
|
2905
|
+
toString() {
|
|
2906
|
+
return this.toHex();
|
|
2907
|
+
}
|
|
2908
|
+
equalsBytes(other) {
|
|
2909
|
+
return bytesEqual(this.bytes, other.bytes);
|
|
2910
|
+
}
|
|
2911
|
+
};
|
|
2912
|
+
var MarketId = class _MarketId extends OpaqueId {
|
|
2913
|
+
static fromHex(hex) {
|
|
2914
|
+
return new _MarketId(_MarketId.assertNonEmpty(decodeHex(hex), `hex "${hex}"`));
|
|
2915
|
+
}
|
|
2916
|
+
static fromBase64(b64) {
|
|
2917
|
+
return new _MarketId(_MarketId.assertNonEmpty(base64ToBytes(b64), `base64 "${b64}"`));
|
|
2918
|
+
}
|
|
2919
|
+
static fromBytes(bytes) {
|
|
2920
|
+
return new _MarketId(_MarketId.assertNonEmpty(new Uint8Array(bytes), "bytes"));
|
|
2921
|
+
}
|
|
2922
|
+
static assertNonEmpty(bytes, source) {
|
|
2923
|
+
if (bytes.length === 0) {
|
|
2924
|
+
throw new Error(`MarketId: empty bytes from ${source}`);
|
|
2925
|
+
}
|
|
2926
|
+
return bytes;
|
|
2927
|
+
}
|
|
2928
|
+
equals(other) {
|
|
2929
|
+
return this.equalsBytes(other);
|
|
2930
|
+
}
|
|
2931
|
+
};
|
|
2932
|
+
var ORDER_ID_LENGTH = 16;
|
|
2933
|
+
var OrderId = class _OrderId extends OpaqueId {
|
|
2934
|
+
static fromHex(hex) {
|
|
2935
|
+
return new _OrderId(_OrderId.assertLength(decodeHex(hex), `hex "${hex}"`));
|
|
2936
|
+
}
|
|
2937
|
+
static fromBase64(b64) {
|
|
2938
|
+
return new _OrderId(_OrderId.assertLength(base64ToBytes(b64), `base64 "${b64}"`));
|
|
2939
|
+
}
|
|
2940
|
+
static fromBytes(bytes) {
|
|
2941
|
+
return new _OrderId(_OrderId.assertLength(new Uint8Array(bytes), "bytes"));
|
|
2942
|
+
}
|
|
2943
|
+
static assertLength(bytes, source) {
|
|
2944
|
+
if (bytes.length !== ORDER_ID_LENGTH) {
|
|
2945
|
+
throw new Error(
|
|
2946
|
+
`OrderId: expected ${ORDER_ID_LENGTH} bytes (chain layout), got ${bytes.length} from ${source}`
|
|
2947
|
+
);
|
|
2948
|
+
}
|
|
2949
|
+
return bytes;
|
|
2950
|
+
}
|
|
2951
|
+
equals(other) {
|
|
2952
|
+
return this.equalsBytes(other);
|
|
2953
|
+
}
|
|
2954
|
+
};
|
|
2955
|
+
|
|
2956
|
+
// src/core/cloid.ts
|
|
2957
|
+
var CLOID_BYTE_LENGTH = 8;
|
|
2958
|
+
var ORDER_ID_BYTE_LENGTH = ORDER_ID_LENGTH;
|
|
2959
|
+
function assertCloid(cloid) {
|
|
2960
|
+
if (cloid.length !== CLOID_BYTE_LENGTH) {
|
|
2961
|
+
throw new Error(`cloid must be exactly ${CLOID_BYTE_LENGTH} bytes, got ${cloid.length}`);
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
function assertOrderRef(ref) {
|
|
2965
|
+
if (ref.length !== CLOID_BYTE_LENGTH && ref.length !== ORDER_ID_BYTE_LENGTH) {
|
|
2966
|
+
throw new Error(
|
|
2967
|
+
`cancel ref must be ${CLOID_BYTE_LENGTH} bytes (cloid) or ${ORDER_ID_BYTE_LENGTH} bytes (order_id), got ${ref.length}`
|
|
2968
|
+
);
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
// src/utils/address.ts
|
|
2973
|
+
var import_encoding = require("@cosmjs/encoding");
|
|
2974
|
+
var import_viem3 = require("viem");
|
|
2975
|
+
function evmToAult(evmAddress) {
|
|
2976
|
+
const hex = evmAddress.toLowerCase().replace("0x", "");
|
|
2977
|
+
const bytes = (0, import_encoding.fromHex)(hex);
|
|
2978
|
+
return (0, import_encoding.toBech32)("ault", bytes);
|
|
2979
|
+
}
|
|
2980
|
+
function aultToEvm(aultAddress) {
|
|
2981
|
+
const { data } = (0, import_encoding.fromBech32)(aultAddress);
|
|
2982
|
+
return (0, import_viem3.getAddress)(`0x${(0, import_encoding.toHex)(data)}`);
|
|
2983
|
+
}
|
|
2984
|
+
function isValidAultAddress(address) {
|
|
2985
|
+
try {
|
|
2986
|
+
const { prefix, data } = (0, import_encoding.fromBech32)(address);
|
|
2987
|
+
return prefix === "ault" && data.length === 20;
|
|
2988
|
+
} catch {
|
|
2989
|
+
return false;
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
function isValidEvmAddress(address) {
|
|
2993
|
+
if (!/^0[xX][a-fA-F0-9]{40}$/.test(address)) return false;
|
|
2994
|
+
const normalized = `0x${address.slice(2)}`;
|
|
2995
|
+
const body = normalized.slice(2);
|
|
2996
|
+
const allLower = body === body.toLowerCase();
|
|
2997
|
+
const allUpper = body === body.toUpperCase();
|
|
2998
|
+
if (allLower || allUpper) return true;
|
|
2999
|
+
return (0, import_viem3.isAddress)(normalized, { strict: true });
|
|
3000
|
+
}
|
|
3001
|
+
function addressEquals(a, b) {
|
|
3002
|
+
const ab = addressBytes(a);
|
|
3003
|
+
const bb = addressBytes(b);
|
|
3004
|
+
if (!ab || !bb || ab.length !== bb.length) return false;
|
|
3005
|
+
for (let i = 0; i < ab.length; i++) {
|
|
3006
|
+
if (ab[i] !== bb[i]) return false;
|
|
3007
|
+
}
|
|
3008
|
+
return true;
|
|
3009
|
+
}
|
|
3010
|
+
function addressBytes(s) {
|
|
3011
|
+
if (!s) return null;
|
|
3012
|
+
if (s.startsWith("0x") || s.startsWith("0X")) {
|
|
3013
|
+
const body = s.slice(2);
|
|
3014
|
+
if (!/^[a-fA-F0-9]+$/.test(body) || body.length !== 40) return null;
|
|
3015
|
+
return (0, import_encoding.fromHex)(body.toLowerCase());
|
|
3016
|
+
}
|
|
3017
|
+
try {
|
|
3018
|
+
const { data } = (0, import_encoding.fromBech32)(s);
|
|
3019
|
+
return data;
|
|
3020
|
+
} catch {
|
|
3021
|
+
return null;
|
|
3022
|
+
}
|
|
3023
|
+
}
|
|
3024
|
+
function isValidValidatorAddress(address) {
|
|
3025
|
+
try {
|
|
3026
|
+
const { prefix, data } = (0, import_encoding.fromBech32)(address);
|
|
3027
|
+
return prefix === "aultvaloper" && data.length === 20;
|
|
3028
|
+
} catch {
|
|
3029
|
+
return false;
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
function assertValidatorAddress(address) {
|
|
3033
|
+
if (isValidValidatorAddress(address)) {
|
|
3034
|
+
return address;
|
|
3035
|
+
}
|
|
3036
|
+
throw new Error(`Invalid validator address format: ${address}`);
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
// src/core/address.ts
|
|
3040
|
+
function normalizeAddress(address) {
|
|
3041
|
+
if (isValidAultAddress(address)) {
|
|
3042
|
+
return address;
|
|
3043
|
+
}
|
|
3044
|
+
if (isValidEvmAddress(address)) {
|
|
3045
|
+
return evmToAult(address);
|
|
3046
|
+
}
|
|
3047
|
+
throw new Error(`Invalid address format: ${address}`);
|
|
3048
|
+
}
|
|
3049
|
+
function normalizeAddresses(addresses) {
|
|
3050
|
+
return addresses.map(normalizeAddress);
|
|
3051
|
+
}
|
|
3052
|
+
function toBigInt(value) {
|
|
3053
|
+
return typeof value === "bigint" ? value : BigInt(value);
|
|
3054
|
+
}
|
|
3055
|
+
|
|
2864
3056
|
// src/proto/gen/ault/clob/v1/query.ts
|
|
2865
3057
|
var import_wire16 = require("@bufbuild/protobuf/wire");
|
|
2866
3058
|
|
|
@@ -3326,7 +3518,8 @@ function createBaseOrderResponse() {
|
|
|
3326
3518
|
remainingDeposit: "",
|
|
3327
3519
|
deadline: void 0,
|
|
3328
3520
|
postOnly: false,
|
|
3329
|
-
feeInfo: void 0
|
|
3521
|
+
feeInfo: void 0,
|
|
3522
|
+
cloid: new Uint8Array(0)
|
|
3330
3523
|
};
|
|
3331
3524
|
}
|
|
3332
3525
|
var OrderResponse = {
|
|
@@ -3370,6 +3563,9 @@ var OrderResponse = {
|
|
|
3370
3563
|
if (message.feeInfo !== void 0) {
|
|
3371
3564
|
FeeInfo.encode(message.feeInfo, writer.uint32(98).fork()).join();
|
|
3372
3565
|
}
|
|
3566
|
+
if (message.cloid.length !== 0) {
|
|
3567
|
+
writer.uint32(106).bytes(message.cloid);
|
|
3568
|
+
}
|
|
3373
3569
|
return writer;
|
|
3374
3570
|
},
|
|
3375
3571
|
decode(input, length) {
|
|
@@ -3463,6 +3659,13 @@ var OrderResponse = {
|
|
|
3463
3659
|
message.feeInfo = FeeInfo.decode(reader, reader.uint32());
|
|
3464
3660
|
continue;
|
|
3465
3661
|
}
|
|
3662
|
+
case 13: {
|
|
3663
|
+
if (tag !== 106) {
|
|
3664
|
+
break;
|
|
3665
|
+
}
|
|
3666
|
+
message.cloid = reader.bytes();
|
|
3667
|
+
continue;
|
|
3668
|
+
}
|
|
3466
3669
|
}
|
|
3467
3670
|
if ((tag & 7) === 4 || tag === 0) {
|
|
3468
3671
|
break;
|
|
@@ -3484,7 +3687,8 @@ var OrderResponse = {
|
|
|
3484
3687
|
remainingDeposit: isSet15(object2.remainingDeposit) ? globalThis.String(object2.remainingDeposit) : isSet15(object2.remaining_deposit) ? globalThis.String(object2.remaining_deposit) : "",
|
|
3485
3688
|
deadline: isSet15(object2.deadline) ? fromJsonTimestamp2(object2.deadline) : void 0,
|
|
3486
3689
|
postOnly: isSet15(object2.postOnly) ? globalThis.Boolean(object2.postOnly) : isSet15(object2.post_only) ? globalThis.Boolean(object2.post_only) : false,
|
|
3487
|
-
feeInfo: isSet15(object2.feeInfo) ? FeeInfo.fromJSON(object2.feeInfo) : isSet15(object2.fee_info) ? FeeInfo.fromJSON(object2.fee_info) : void 0
|
|
3690
|
+
feeInfo: isSet15(object2.feeInfo) ? FeeInfo.fromJSON(object2.feeInfo) : isSet15(object2.fee_info) ? FeeInfo.fromJSON(object2.fee_info) : void 0,
|
|
3691
|
+
cloid: isSet15(object2.cloid) ? bytesFromBase644(object2.cloid) : new Uint8Array(0)
|
|
3488
3692
|
};
|
|
3489
3693
|
},
|
|
3490
3694
|
toJSON(message) {
|
|
@@ -3525,6 +3729,9 @@ var OrderResponse = {
|
|
|
3525
3729
|
if (message.feeInfo !== void 0) {
|
|
3526
3730
|
obj.feeInfo = FeeInfo.toJSON(message.feeInfo);
|
|
3527
3731
|
}
|
|
3732
|
+
if (message.cloid.length !== 0) {
|
|
3733
|
+
obj.cloid = base64FromBytes4(message.cloid);
|
|
3734
|
+
}
|
|
3528
3735
|
return obj;
|
|
3529
3736
|
},
|
|
3530
3737
|
create(base) {
|
|
@@ -3544,6 +3751,7 @@ var OrderResponse = {
|
|
|
3544
3751
|
message.deadline = object2.deadline ?? void 0;
|
|
3545
3752
|
message.postOnly = object2.postOnly ?? false;
|
|
3546
3753
|
message.feeInfo = object2.feeInfo !== void 0 && object2.feeInfo !== null ? FeeInfo.fromPartial(object2.feeInfo) : void 0;
|
|
3754
|
+
message.cloid = object2.cloid ?? new Uint8Array(0);
|
|
3547
3755
|
return message;
|
|
3548
3756
|
}
|
|
3549
3757
|
};
|
|
@@ -3612,6 +3820,20 @@ function createClobApi(context) {
|
|
|
3612
3820
|
QueryOrderResponse
|
|
3613
3821
|
);
|
|
3614
3822
|
},
|
|
3823
|
+
async getOrderByCloid(orderer, cloid) {
|
|
3824
|
+
assertCloid(cloid);
|
|
3825
|
+
const path = `/ault/clob/v1/orders/by-cloid/${encodeURIComponent(
|
|
3826
|
+
normalizeAddress(orderer)
|
|
3827
|
+
)}/${encodeURIComponent(bytesToBase64(cloid))}`;
|
|
3828
|
+
try {
|
|
3829
|
+
return await fetchProtoJson(context, path, QueryOrderResponse);
|
|
3830
|
+
} catch (err) {
|
|
3831
|
+
if (err instanceof ApiError && err.status === 404) {
|
|
3832
|
+
return { order: void 0 };
|
|
3833
|
+
}
|
|
3834
|
+
throw err;
|
|
3835
|
+
}
|
|
3836
|
+
},
|
|
3615
3837
|
async getOrders(params = {}) {
|
|
3616
3838
|
const query = buildQuery({
|
|
3617
3839
|
market_id: params.marketId ? normalizeMarketId(params.marketId) : void 0,
|
|
@@ -10754,6 +10976,8 @@ __export(dex_generated_exports, {
|
|
|
10754
10976
|
OrderResponseSide: () => OrderResponseSide,
|
|
10755
10977
|
OrderResponseStatus: () => OrderResponseStatus,
|
|
10756
10978
|
OrderResponseType: () => OrderResponseType,
|
|
10979
|
+
RangeQueryDayParameter: () => RangeQueryDayParameter,
|
|
10980
|
+
RangeQueryParameter: () => RangeQueryParameter,
|
|
10757
10981
|
ReadyResponseStatus: () => ReadyResponseStatus,
|
|
10758
10982
|
StatsResponseWindow: () => StatsResponseWindow,
|
|
10759
10983
|
TradeResponseSide: () => TradeResponseSide,
|
|
@@ -10862,7 +11086,8 @@ var TradeResponseSide = {
|
|
|
10862
11086
|
sell: "sell"
|
|
10863
11087
|
};
|
|
10864
11088
|
var TradeResponseTakerOrMaker = {
|
|
10865
|
-
taker: "taker"
|
|
11089
|
+
taker: "taker",
|
|
11090
|
+
maker: "maker"
|
|
10866
11091
|
};
|
|
10867
11092
|
var OrderResponseStatus = {
|
|
10868
11093
|
open: "open",
|
|
@@ -10896,6 +11121,18 @@ var UDFQuoteDataS = {
|
|
|
10896
11121
|
ok: "ok",
|
|
10897
11122
|
error: "error"
|
|
10898
11123
|
};
|
|
11124
|
+
var RangeQueryParameter = {
|
|
11125
|
+
day: "day",
|
|
11126
|
+
week: "week",
|
|
11127
|
+
month: "month",
|
|
11128
|
+
allTime: "allTime"
|
|
11129
|
+
};
|
|
11130
|
+
var RangeQueryDayParameter = {
|
|
11131
|
+
day: "day",
|
|
11132
|
+
week: "week",
|
|
11133
|
+
month: "month",
|
|
11134
|
+
allTime: "allTime"
|
|
11135
|
+
};
|
|
10899
11136
|
var GetStatsWindow = {
|
|
10900
11137
|
"24h": "24h"
|
|
10901
11138
|
};
|
|
@@ -11249,6 +11486,35 @@ var getOpenAPISpec = async (options) => {
|
|
|
11249
11486
|
});
|
|
11250
11487
|
};
|
|
11251
11488
|
|
|
11489
|
+
// src/rest/portfolio.ts
|
|
11490
|
+
var enc = (s) => encodeURIComponent(s);
|
|
11491
|
+
function getPortfolioHoldings(address, options) {
|
|
11492
|
+
return dexFetch(`/api/v1/portfolio/${enc(address)}/holdings`, {
|
|
11493
|
+
...options,
|
|
11494
|
+
method: "GET"
|
|
11495
|
+
});
|
|
11496
|
+
}
|
|
11497
|
+
function getPortfolioFlows(address, range, options) {
|
|
11498
|
+
const query = range ? `?range=${range}` : "";
|
|
11499
|
+
return dexFetch(`/api/v1/portfolio/${enc(address)}/flows${query}`, {
|
|
11500
|
+
...options,
|
|
11501
|
+
method: "GET"
|
|
11502
|
+
});
|
|
11503
|
+
}
|
|
11504
|
+
function getPortfolioPnl(address, range, options) {
|
|
11505
|
+
const query = range ? `?range=${range}` : "";
|
|
11506
|
+
return dexFetch(`/api/v1/portfolio/${enc(address)}/pnl${query}`, {
|
|
11507
|
+
...options,
|
|
11508
|
+
method: "GET"
|
|
11509
|
+
});
|
|
11510
|
+
}
|
|
11511
|
+
function getPortfolioTimeSeries(address, range = "day", options) {
|
|
11512
|
+
return dexFetch(
|
|
11513
|
+
`/api/v1/portfolio/${enc(address)}/time?range=${range}`,
|
|
11514
|
+
{ ...options, method: "GET" }
|
|
11515
|
+
);
|
|
11516
|
+
}
|
|
11517
|
+
|
|
11252
11518
|
// src/rest/dex.ts
|
|
11253
11519
|
function bind(context, fn) {
|
|
11254
11520
|
return ((...args) => {
|
|
@@ -11275,6 +11541,10 @@ function createDexApi(context) {
|
|
|
11275
11541
|
listMyTrades: bind(context, listMyTrades),
|
|
11276
11542
|
getBalance: bind(context, getBalance),
|
|
11277
11543
|
getStats: bind(context, getStats),
|
|
11544
|
+
getPortfolioHoldings: bind(context, getPortfolioHoldings),
|
|
11545
|
+
getPortfolioFlows: bind(context, getPortfolioFlows),
|
|
11546
|
+
getPortfolioPnl: bind(context, getPortfolioPnl),
|
|
11547
|
+
getPortfolioTimeSeries: bind(context, getPortfolioTimeSeries),
|
|
11278
11548
|
getUDFConfig: bind(context, getUDFConfig),
|
|
11279
11549
|
getUDFTime: bind(context, getUDFTime),
|
|
11280
11550
|
getUDFSymbol: bind(context, getUDFSymbol),
|
|
@@ -11286,73 +11556,6 @@ function createDexApi(context) {
|
|
|
11286
11556
|
};
|
|
11287
11557
|
}
|
|
11288
11558
|
|
|
11289
|
-
// src/utils/address.ts
|
|
11290
|
-
var import_encoding = require("@cosmjs/encoding");
|
|
11291
|
-
var import_viem2 = require("viem");
|
|
11292
|
-
function evmToAult(evmAddress) {
|
|
11293
|
-
const hex = evmAddress.toLowerCase().replace("0x", "");
|
|
11294
|
-
const bytes = (0, import_encoding.fromHex)(hex);
|
|
11295
|
-
return (0, import_encoding.toBech32)("ault", bytes);
|
|
11296
|
-
}
|
|
11297
|
-
function aultToEvm(aultAddress) {
|
|
11298
|
-
const { data } = (0, import_encoding.fromBech32)(aultAddress);
|
|
11299
|
-
return (0, import_viem2.getAddress)(`0x${(0, import_encoding.toHex)(data)}`);
|
|
11300
|
-
}
|
|
11301
|
-
function isValidAultAddress(address) {
|
|
11302
|
-
try {
|
|
11303
|
-
const { prefix, data } = (0, import_encoding.fromBech32)(address);
|
|
11304
|
-
return prefix === "ault" && data.length === 20;
|
|
11305
|
-
} catch {
|
|
11306
|
-
return false;
|
|
11307
|
-
}
|
|
11308
|
-
}
|
|
11309
|
-
function isValidEvmAddress(address) {
|
|
11310
|
-
if (!/^0[xX][a-fA-F0-9]{40}$/.test(address)) return false;
|
|
11311
|
-
const normalized = `0x${address.slice(2)}`;
|
|
11312
|
-
const body = normalized.slice(2);
|
|
11313
|
-
const allLower = body === body.toLowerCase();
|
|
11314
|
-
const allUpper = body === body.toUpperCase();
|
|
11315
|
-
if (allLower || allUpper) return true;
|
|
11316
|
-
return (0, import_viem2.isAddress)(normalized, { strict: true });
|
|
11317
|
-
}
|
|
11318
|
-
function addressEquals(a, b) {
|
|
11319
|
-
const ab = addressBytes(a);
|
|
11320
|
-
const bb = addressBytes(b);
|
|
11321
|
-
if (!ab || !bb || ab.length !== bb.length) return false;
|
|
11322
|
-
for (let i = 0; i < ab.length; i++) {
|
|
11323
|
-
if (ab[i] !== bb[i]) return false;
|
|
11324
|
-
}
|
|
11325
|
-
return true;
|
|
11326
|
-
}
|
|
11327
|
-
function addressBytes(s) {
|
|
11328
|
-
if (!s) return null;
|
|
11329
|
-
if (s.startsWith("0x") || s.startsWith("0X")) {
|
|
11330
|
-
const body = s.slice(2);
|
|
11331
|
-
if (!/^[a-fA-F0-9]+$/.test(body) || body.length !== 40) return null;
|
|
11332
|
-
return (0, import_encoding.fromHex)(body.toLowerCase());
|
|
11333
|
-
}
|
|
11334
|
-
try {
|
|
11335
|
-
const { data } = (0, import_encoding.fromBech32)(s);
|
|
11336
|
-
return data;
|
|
11337
|
-
} catch {
|
|
11338
|
-
return null;
|
|
11339
|
-
}
|
|
11340
|
-
}
|
|
11341
|
-
function isValidValidatorAddress(address) {
|
|
11342
|
-
try {
|
|
11343
|
-
const { prefix, data } = (0, import_encoding.fromBech32)(address);
|
|
11344
|
-
return prefix === "aultvaloper" && data.length === 20;
|
|
11345
|
-
} catch {
|
|
11346
|
-
return false;
|
|
11347
|
-
}
|
|
11348
|
-
}
|
|
11349
|
-
function assertValidatorAddress(address) {
|
|
11350
|
-
if (isValidValidatorAddress(address)) {
|
|
11351
|
-
return address;
|
|
11352
|
-
}
|
|
11353
|
-
throw new Error(`Invalid validator address format: ${address}`);
|
|
11354
|
-
}
|
|
11355
|
-
|
|
11356
11559
|
// src/ws/client.ts
|
|
11357
11560
|
var import_encoding2 = require("@cosmjs/encoding");
|
|
11358
11561
|
var NORMAL_CLOSURE = 1e3;
|
|
@@ -12387,7 +12590,7 @@ function createTokenRegistryApi(context) {
|
|
|
12387
12590
|
}
|
|
12388
12591
|
|
|
12389
12592
|
// src/eip712/sign-and-broadcast.ts
|
|
12390
|
-
var
|
|
12593
|
+
var import_viem4 = require("viem");
|
|
12391
12594
|
|
|
12392
12595
|
// src/eip712/registry.generated.ts
|
|
12393
12596
|
var EIP712_MSG_TYPES = {
|
|
@@ -12568,14 +12771,16 @@ var EIP712_MSG_TYPES = {
|
|
|
12568
12771
|
{ name: "market_id", type: "string", jsName: "marketId" },
|
|
12569
12772
|
{ name: "is_buy", type: "bool", jsName: "isBuy" },
|
|
12570
12773
|
{ name: "deadline", type: "string" },
|
|
12774
|
+
{ name: "cloid", type: "string" },
|
|
12571
12775
|
{ name: "builder_fee_rate", type: "string", jsName: "builderFeeRate" },
|
|
12572
12776
|
{ name: "builder_address", type: "string", jsName: "builderAddress" }
|
|
12573
12777
|
],
|
|
12574
12778
|
timestampFields: ["deadline"],
|
|
12575
|
-
optionalFields: ["builder_address", "builder_fee_rate"],
|
|
12779
|
+
optionalFields: ["builder_address", "builder_fee_rate", "cloid"],
|
|
12576
12780
|
fieldSemantics: {
|
|
12577
12781
|
builder_address: { isAddress: true },
|
|
12578
12782
|
builder_fee_rate: { isLegacyDec: true },
|
|
12783
|
+
cloid: { isBinary: true },
|
|
12579
12784
|
market_id: { isBinary: true },
|
|
12580
12785
|
price: { isLegacyDec: true },
|
|
12581
12786
|
quantity: { isLegacyDec: true }
|
|
@@ -12591,13 +12796,21 @@ var EIP712_MSG_TYPES = {
|
|
|
12591
12796
|
{ name: "market_id", type: "string", jsName: "marketId" },
|
|
12592
12797
|
{ name: "is_buy", type: "bool", jsName: "isBuy" },
|
|
12593
12798
|
{ name: "deposit", type: "string" },
|
|
12799
|
+
{ name: "cloid", type: "string" },
|
|
12594
12800
|
{ name: "builder_fee_rate", type: "string", jsName: "builderFeeRate" },
|
|
12595
12801
|
{ name: "builder_address", type: "string", jsName: "builderAddress" }
|
|
12596
12802
|
],
|
|
12597
|
-
optionalFields: [
|
|
12803
|
+
optionalFields: [
|
|
12804
|
+
"builder_address",
|
|
12805
|
+
"builder_fee_rate",
|
|
12806
|
+
"cloid",
|
|
12807
|
+
"price_tolerance",
|
|
12808
|
+
"worst_price"
|
|
12809
|
+
],
|
|
12598
12810
|
fieldSemantics: {
|
|
12599
12811
|
builder_address: { isAddress: true },
|
|
12600
12812
|
builder_fee_rate: { isLegacyDec: true },
|
|
12813
|
+
cloid: { isBinary: true },
|
|
12601
12814
|
deposit: { isLegacyDec: true },
|
|
12602
12815
|
market_id: { isBinary: true },
|
|
12603
12816
|
price_tolerance: { isLegacyDec: true },
|
|
@@ -14127,6 +14340,9 @@ function mapValueToAmino(value, fields, nestedTypes, durationFields, timestampFi
|
|
|
14127
14340
|
if (field.type === "string" && raw === "") {
|
|
14128
14341
|
continue;
|
|
14129
14342
|
}
|
|
14343
|
+
if (raw instanceof Uint8Array && raw.length === 0) {
|
|
14344
|
+
continue;
|
|
14345
|
+
}
|
|
14130
14346
|
if (field.type.endsWith("[]") && Array.isArray(raw) && raw.length === 0) {
|
|
14131
14347
|
continue;
|
|
14132
14348
|
}
|
|
@@ -15387,7 +15603,8 @@ function createBaseMsgPlaceLimitOrder() {
|
|
|
15387
15603
|
deadline: void 0,
|
|
15388
15604
|
postOnly: false,
|
|
15389
15605
|
builderAddress: "",
|
|
15390
|
-
builderFeeRate: ""
|
|
15606
|
+
builderFeeRate: "",
|
|
15607
|
+
cloid: new Uint8Array(0)
|
|
15391
15608
|
};
|
|
15392
15609
|
}
|
|
15393
15610
|
var MsgPlaceLimitOrder = {
|
|
@@ -15419,6 +15636,9 @@ var MsgPlaceLimitOrder = {
|
|
|
15419
15636
|
if (message.builderFeeRate !== "") {
|
|
15420
15637
|
writer.uint32(74).string(message.builderFeeRate);
|
|
15421
15638
|
}
|
|
15639
|
+
if (message.cloid.length !== 0) {
|
|
15640
|
+
writer.uint32(82).bytes(message.cloid);
|
|
15641
|
+
}
|
|
15422
15642
|
return writer;
|
|
15423
15643
|
},
|
|
15424
15644
|
decode(input, length) {
|
|
@@ -15491,6 +15711,13 @@ var MsgPlaceLimitOrder = {
|
|
|
15491
15711
|
message.builderFeeRate = reader.string();
|
|
15492
15712
|
continue;
|
|
15493
15713
|
}
|
|
15714
|
+
case 10: {
|
|
15715
|
+
if (tag !== 82) {
|
|
15716
|
+
break;
|
|
15717
|
+
}
|
|
15718
|
+
message.cloid = reader.bytes();
|
|
15719
|
+
continue;
|
|
15720
|
+
}
|
|
15494
15721
|
}
|
|
15495
15722
|
if ((tag & 7) === 4 || tag === 0) {
|
|
15496
15723
|
break;
|
|
@@ -15509,7 +15736,8 @@ var MsgPlaceLimitOrder = {
|
|
|
15509
15736
|
deadline: isSet35(object2.deadline) ? fromJsonTimestamp7(object2.deadline) : void 0,
|
|
15510
15737
|
postOnly: isSet35(object2.postOnly) ? globalThis.Boolean(object2.postOnly) : isSet35(object2.post_only) ? globalThis.Boolean(object2.post_only) : false,
|
|
15511
15738
|
builderAddress: isSet35(object2.builderAddress) ? globalThis.String(object2.builderAddress) : isSet35(object2.builder_address) ? globalThis.String(object2.builder_address) : "",
|
|
15512
|
-
builderFeeRate: isSet35(object2.builderFeeRate) ? globalThis.String(object2.builderFeeRate) : isSet35(object2.builder_fee_rate) ? globalThis.String(object2.builder_fee_rate) : ""
|
|
15739
|
+
builderFeeRate: isSet35(object2.builderFeeRate) ? globalThis.String(object2.builderFeeRate) : isSet35(object2.builder_fee_rate) ? globalThis.String(object2.builder_fee_rate) : "",
|
|
15740
|
+
cloid: isSet35(object2.cloid) ? bytesFromBase648(object2.cloid) : new Uint8Array(0)
|
|
15513
15741
|
};
|
|
15514
15742
|
},
|
|
15515
15743
|
toJSON(message) {
|
|
@@ -15541,6 +15769,9 @@ var MsgPlaceLimitOrder = {
|
|
|
15541
15769
|
if (message.builderFeeRate !== "") {
|
|
15542
15770
|
obj.builderFeeRate = message.builderFeeRate;
|
|
15543
15771
|
}
|
|
15772
|
+
if (message.cloid.length !== 0) {
|
|
15773
|
+
obj.cloid = base64FromBytes8(message.cloid);
|
|
15774
|
+
}
|
|
15544
15775
|
return obj;
|
|
15545
15776
|
},
|
|
15546
15777
|
create(base) {
|
|
@@ -15557,11 +15788,12 @@ var MsgPlaceLimitOrder = {
|
|
|
15557
15788
|
message.postOnly = object2.postOnly ?? false;
|
|
15558
15789
|
message.builderAddress = object2.builderAddress ?? "";
|
|
15559
15790
|
message.builderFeeRate = object2.builderFeeRate ?? "";
|
|
15791
|
+
message.cloid = object2.cloid ?? new Uint8Array(0);
|
|
15560
15792
|
return message;
|
|
15561
15793
|
}
|
|
15562
15794
|
};
|
|
15563
15795
|
function createBaseMsgPlaceLimitOrderResponse() {
|
|
15564
|
-
return { orderId: new Uint8Array(0), escrowedAmount: void 0 };
|
|
15796
|
+
return { orderId: new Uint8Array(0), escrowedAmount: void 0, cloid: new Uint8Array(0) };
|
|
15565
15797
|
}
|
|
15566
15798
|
var MsgPlaceLimitOrderResponse = {
|
|
15567
15799
|
encode(message, writer = new import_wire37.BinaryWriter()) {
|
|
@@ -15571,6 +15803,9 @@ var MsgPlaceLimitOrderResponse = {
|
|
|
15571
15803
|
if (message.escrowedAmount !== void 0) {
|
|
15572
15804
|
Coin.encode(message.escrowedAmount, writer.uint32(18).fork()).join();
|
|
15573
15805
|
}
|
|
15806
|
+
if (message.cloid.length !== 0) {
|
|
15807
|
+
writer.uint32(26).bytes(message.cloid);
|
|
15808
|
+
}
|
|
15574
15809
|
return writer;
|
|
15575
15810
|
},
|
|
15576
15811
|
decode(input, length) {
|
|
@@ -15594,6 +15829,13 @@ var MsgPlaceLimitOrderResponse = {
|
|
|
15594
15829
|
message.escrowedAmount = Coin.decode(reader, reader.uint32());
|
|
15595
15830
|
continue;
|
|
15596
15831
|
}
|
|
15832
|
+
case 3: {
|
|
15833
|
+
if (tag !== 26) {
|
|
15834
|
+
break;
|
|
15835
|
+
}
|
|
15836
|
+
message.cloid = reader.bytes();
|
|
15837
|
+
continue;
|
|
15838
|
+
}
|
|
15597
15839
|
}
|
|
15598
15840
|
if ((tag & 7) === 4 || tag === 0) {
|
|
15599
15841
|
break;
|
|
@@ -15605,7 +15847,8 @@ var MsgPlaceLimitOrderResponse = {
|
|
|
15605
15847
|
fromJSON(object2) {
|
|
15606
15848
|
return {
|
|
15607
15849
|
orderId: isSet35(object2.orderId) ? bytesFromBase648(object2.orderId) : isSet35(object2.order_id) ? bytesFromBase648(object2.order_id) : new Uint8Array(0),
|
|
15608
|
-
escrowedAmount: isSet35(object2.escrowedAmount) ? Coin.fromJSON(object2.escrowedAmount) : isSet35(object2.escrowed_amount) ? Coin.fromJSON(object2.escrowed_amount) : void 0
|
|
15850
|
+
escrowedAmount: isSet35(object2.escrowedAmount) ? Coin.fromJSON(object2.escrowedAmount) : isSet35(object2.escrowed_amount) ? Coin.fromJSON(object2.escrowed_amount) : void 0,
|
|
15851
|
+
cloid: isSet35(object2.cloid) ? bytesFromBase648(object2.cloid) : new Uint8Array(0)
|
|
15609
15852
|
};
|
|
15610
15853
|
},
|
|
15611
15854
|
toJSON(message) {
|
|
@@ -15616,6 +15859,9 @@ var MsgPlaceLimitOrderResponse = {
|
|
|
15616
15859
|
if (message.escrowedAmount !== void 0) {
|
|
15617
15860
|
obj.escrowedAmount = Coin.toJSON(message.escrowedAmount);
|
|
15618
15861
|
}
|
|
15862
|
+
if (message.cloid.length !== 0) {
|
|
15863
|
+
obj.cloid = base64FromBytes8(message.cloid);
|
|
15864
|
+
}
|
|
15619
15865
|
return obj;
|
|
15620
15866
|
},
|
|
15621
15867
|
create(base) {
|
|
@@ -15625,6 +15871,7 @@ var MsgPlaceLimitOrderResponse = {
|
|
|
15625
15871
|
const message = createBaseMsgPlaceLimitOrderResponse();
|
|
15626
15872
|
message.orderId = object2.orderId ?? new Uint8Array(0);
|
|
15627
15873
|
message.escrowedAmount = object2.escrowedAmount !== void 0 && object2.escrowedAmount !== null ? Coin.fromPartial(object2.escrowedAmount) : void 0;
|
|
15874
|
+
message.cloid = object2.cloid ?? new Uint8Array(0);
|
|
15628
15875
|
return message;
|
|
15629
15876
|
}
|
|
15630
15877
|
};
|
|
@@ -15637,7 +15884,8 @@ function createBaseMsgPlaceMarketOrder() {
|
|
|
15637
15884
|
worstPrice: "",
|
|
15638
15885
|
priceTolerance: "",
|
|
15639
15886
|
builderAddress: "",
|
|
15640
|
-
builderFeeRate: ""
|
|
15887
|
+
builderFeeRate: "",
|
|
15888
|
+
cloid: new Uint8Array(0)
|
|
15641
15889
|
};
|
|
15642
15890
|
}
|
|
15643
15891
|
var MsgPlaceMarketOrder = {
|
|
@@ -15666,6 +15914,9 @@ var MsgPlaceMarketOrder = {
|
|
|
15666
15914
|
if (message.builderFeeRate !== "") {
|
|
15667
15915
|
writer.uint32(66).string(message.builderFeeRate);
|
|
15668
15916
|
}
|
|
15917
|
+
if (message.cloid.length !== 0) {
|
|
15918
|
+
writer.uint32(74).bytes(message.cloid);
|
|
15919
|
+
}
|
|
15669
15920
|
return writer;
|
|
15670
15921
|
},
|
|
15671
15922
|
decode(input, length) {
|
|
@@ -15731,6 +15982,13 @@ var MsgPlaceMarketOrder = {
|
|
|
15731
15982
|
message.builderFeeRate = reader.string();
|
|
15732
15983
|
continue;
|
|
15733
15984
|
}
|
|
15985
|
+
case 9: {
|
|
15986
|
+
if (tag !== 74) {
|
|
15987
|
+
break;
|
|
15988
|
+
}
|
|
15989
|
+
message.cloid = reader.bytes();
|
|
15990
|
+
continue;
|
|
15991
|
+
}
|
|
15734
15992
|
}
|
|
15735
15993
|
if ((tag & 7) === 4 || tag === 0) {
|
|
15736
15994
|
break;
|
|
@@ -15748,7 +16006,8 @@ var MsgPlaceMarketOrder = {
|
|
|
15748
16006
|
worstPrice: isSet35(object2.worstPrice) ? globalThis.String(object2.worstPrice) : isSet35(object2.worst_price) ? globalThis.String(object2.worst_price) : "",
|
|
15749
16007
|
priceTolerance: isSet35(object2.priceTolerance) ? globalThis.String(object2.priceTolerance) : isSet35(object2.price_tolerance) ? globalThis.String(object2.price_tolerance) : "",
|
|
15750
16008
|
builderAddress: isSet35(object2.builderAddress) ? globalThis.String(object2.builderAddress) : isSet35(object2.builder_address) ? globalThis.String(object2.builder_address) : "",
|
|
15751
|
-
builderFeeRate: isSet35(object2.builderFeeRate) ? globalThis.String(object2.builderFeeRate) : isSet35(object2.builder_fee_rate) ? globalThis.String(object2.builder_fee_rate) : ""
|
|
16009
|
+
builderFeeRate: isSet35(object2.builderFeeRate) ? globalThis.String(object2.builderFeeRate) : isSet35(object2.builder_fee_rate) ? globalThis.String(object2.builder_fee_rate) : "",
|
|
16010
|
+
cloid: isSet35(object2.cloid) ? bytesFromBase648(object2.cloid) : new Uint8Array(0)
|
|
15752
16011
|
};
|
|
15753
16012
|
},
|
|
15754
16013
|
toJSON(message) {
|
|
@@ -15777,6 +16036,9 @@ var MsgPlaceMarketOrder = {
|
|
|
15777
16036
|
if (message.builderFeeRate !== "") {
|
|
15778
16037
|
obj.builderFeeRate = message.builderFeeRate;
|
|
15779
16038
|
}
|
|
16039
|
+
if (message.cloid.length !== 0) {
|
|
16040
|
+
obj.cloid = base64FromBytes8(message.cloid);
|
|
16041
|
+
}
|
|
15780
16042
|
return obj;
|
|
15781
16043
|
},
|
|
15782
16044
|
create(base) {
|
|
@@ -15792,11 +16054,12 @@ var MsgPlaceMarketOrder = {
|
|
|
15792
16054
|
message.priceTolerance = object2.priceTolerance ?? "";
|
|
15793
16055
|
message.builderAddress = object2.builderAddress ?? "";
|
|
15794
16056
|
message.builderFeeRate = object2.builderFeeRate ?? "";
|
|
16057
|
+
message.cloid = object2.cloid ?? new Uint8Array(0);
|
|
15795
16058
|
return message;
|
|
15796
16059
|
}
|
|
15797
16060
|
};
|
|
15798
16061
|
function createBaseMsgPlaceMarketOrderResponse() {
|
|
15799
|
-
return { orderId: new Uint8Array(0), escrowedAmount: void 0 };
|
|
16062
|
+
return { orderId: new Uint8Array(0), escrowedAmount: void 0, cloid: new Uint8Array(0) };
|
|
15800
16063
|
}
|
|
15801
16064
|
var MsgPlaceMarketOrderResponse = {
|
|
15802
16065
|
encode(message, writer = new import_wire37.BinaryWriter()) {
|
|
@@ -15806,6 +16069,9 @@ var MsgPlaceMarketOrderResponse = {
|
|
|
15806
16069
|
if (message.escrowedAmount !== void 0) {
|
|
15807
16070
|
Coin.encode(message.escrowedAmount, writer.uint32(18).fork()).join();
|
|
15808
16071
|
}
|
|
16072
|
+
if (message.cloid.length !== 0) {
|
|
16073
|
+
writer.uint32(26).bytes(message.cloid);
|
|
16074
|
+
}
|
|
15809
16075
|
return writer;
|
|
15810
16076
|
},
|
|
15811
16077
|
decode(input, length) {
|
|
@@ -15829,6 +16095,13 @@ var MsgPlaceMarketOrderResponse = {
|
|
|
15829
16095
|
message.escrowedAmount = Coin.decode(reader, reader.uint32());
|
|
15830
16096
|
continue;
|
|
15831
16097
|
}
|
|
16098
|
+
case 3: {
|
|
16099
|
+
if (tag !== 26) {
|
|
16100
|
+
break;
|
|
16101
|
+
}
|
|
16102
|
+
message.cloid = reader.bytes();
|
|
16103
|
+
continue;
|
|
16104
|
+
}
|
|
15832
16105
|
}
|
|
15833
16106
|
if ((tag & 7) === 4 || tag === 0) {
|
|
15834
16107
|
break;
|
|
@@ -15840,7 +16113,8 @@ var MsgPlaceMarketOrderResponse = {
|
|
|
15840
16113
|
fromJSON(object2) {
|
|
15841
16114
|
return {
|
|
15842
16115
|
orderId: isSet35(object2.orderId) ? bytesFromBase648(object2.orderId) : isSet35(object2.order_id) ? bytesFromBase648(object2.order_id) : new Uint8Array(0),
|
|
15843
|
-
escrowedAmount: isSet35(object2.escrowedAmount) ? Coin.fromJSON(object2.escrowedAmount) : isSet35(object2.escrowed_amount) ? Coin.fromJSON(object2.escrowed_amount) : void 0
|
|
16116
|
+
escrowedAmount: isSet35(object2.escrowedAmount) ? Coin.fromJSON(object2.escrowedAmount) : isSet35(object2.escrowed_amount) ? Coin.fromJSON(object2.escrowed_amount) : void 0,
|
|
16117
|
+
cloid: isSet35(object2.cloid) ? bytesFromBase648(object2.cloid) : new Uint8Array(0)
|
|
15844
16118
|
};
|
|
15845
16119
|
},
|
|
15846
16120
|
toJSON(message) {
|
|
@@ -15851,6 +16125,9 @@ var MsgPlaceMarketOrderResponse = {
|
|
|
15851
16125
|
if (message.escrowedAmount !== void 0) {
|
|
15852
16126
|
obj.escrowedAmount = Coin.toJSON(message.escrowedAmount);
|
|
15853
16127
|
}
|
|
16128
|
+
if (message.cloid.length !== 0) {
|
|
16129
|
+
obj.cloid = base64FromBytes8(message.cloid);
|
|
16130
|
+
}
|
|
15854
16131
|
return obj;
|
|
15855
16132
|
},
|
|
15856
16133
|
create(base) {
|
|
@@ -15860,6 +16137,7 @@ var MsgPlaceMarketOrderResponse = {
|
|
|
15860
16137
|
const message = createBaseMsgPlaceMarketOrderResponse();
|
|
15861
16138
|
message.orderId = object2.orderId ?? new Uint8Array(0);
|
|
15862
16139
|
message.escrowedAmount = object2.escrowedAmount !== void 0 && object2.escrowedAmount !== null ? Coin.fromPartial(object2.escrowedAmount) : void 0;
|
|
16140
|
+
message.cloid = object2.cloid ?? new Uint8Array(0);
|
|
15863
16141
|
return message;
|
|
15864
16142
|
}
|
|
15865
16143
|
};
|
|
@@ -21204,7 +21482,8 @@ function mapAultClobV1MsgPlaceLimitOrder(input, label = "value") {
|
|
|
21204
21482
|
builderAddress: requireStringOrDefault(record2["builderAddress"], `${prefix}builderAddress`),
|
|
21205
21483
|
builderFeeRate: cosmosDecToProtoInt(
|
|
21206
21484
|
requireStringOrDefault(record2["builderFeeRate"], `${prefix}builderFeeRate`)
|
|
21207
|
-
)
|
|
21485
|
+
),
|
|
21486
|
+
cloid: requireBytesOrDefault(record2["cloid"], `${prefix}cloid`)
|
|
21208
21487
|
};
|
|
21209
21488
|
}
|
|
21210
21489
|
function mapAultClobV1MsgPlaceMarketOrder(input, label = "value") {
|
|
@@ -21224,7 +21503,8 @@ function mapAultClobV1MsgPlaceMarketOrder(input, label = "value") {
|
|
|
21224
21503
|
builderAddress: requireStringOrDefault(record2["builderAddress"], `${prefix}builderAddress`),
|
|
21225
21504
|
builderFeeRate: cosmosDecToProtoInt(
|
|
21226
21505
|
requireStringOrDefault(record2["builderFeeRate"], `${prefix}builderFeeRate`)
|
|
21227
|
-
)
|
|
21506
|
+
),
|
|
21507
|
+
cloid: requireBytesOrDefault(record2["cloid"], `${prefix}cloid`)
|
|
21228
21508
|
};
|
|
21229
21509
|
}
|
|
21230
21510
|
function mapAultClobV1MsgPlaceScaleOrder(input, label = "value") {
|
|
@@ -22206,14 +22486,14 @@ async function resolveDynamicFeeAmount(network, gas, feeMarketCache, fetchFn, fe
|
|
|
22206
22486
|
return dynamicI > staticI ? dynamicI.toString() : staticFloor;
|
|
22207
22487
|
}
|
|
22208
22488
|
async function recoverPubkeyFromTypedDataSignature(typedData, signature) {
|
|
22209
|
-
const hash = (0,
|
|
22489
|
+
const hash = (0, import_viem4.hashTypedData)({
|
|
22210
22490
|
domain: typedData.domain,
|
|
22211
22491
|
types: typedData.types,
|
|
22212
22492
|
primaryType: typedData.primaryType,
|
|
22213
22493
|
message: typedData.message
|
|
22214
22494
|
});
|
|
22215
|
-
const publicKey = await (0,
|
|
22216
|
-
const uncompressedBytes = (0,
|
|
22495
|
+
const publicKey = await (0, import_viem4.recoverPublicKey)({ hash, signature });
|
|
22496
|
+
const uncompressedBytes = (0, import_viem4.hexToBytes)(publicKey);
|
|
22217
22497
|
const x = uncompressedBytes.slice(1, 33);
|
|
22218
22498
|
const y = uncompressedBytes.slice(33, 65);
|
|
22219
22499
|
const prefix = y[31] % 2 === 0 ? 2 : 3;
|
|
@@ -22376,7 +22656,7 @@ async function signAndBroadcastEip712({
|
|
|
22376
22656
|
pubkey = await recoverPubkeyFromTypedDataSignature(typedData, signature);
|
|
22377
22657
|
if (cache) cache.pubkeyBase64 = pubkey;
|
|
22378
22658
|
}
|
|
22379
|
-
const sigBytes = (0,
|
|
22659
|
+
const sigBytes = (0, import_viem4.hexToBytes)(signature);
|
|
22380
22660
|
const sigWithoutRecovery = sigBytes.slice(0, 64);
|
|
22381
22661
|
const encodedMessages = msgs.map((msg2) => {
|
|
22382
22662
|
const encoder = MSG_ENCODERS[msg2.typeUrl];
|
|
@@ -22612,23 +22892,6 @@ function autoDetectSigner(input) {
|
|
|
22612
22892
|
);
|
|
22613
22893
|
}
|
|
22614
22894
|
|
|
22615
|
-
// src/core/address.ts
|
|
22616
|
-
function normalizeAddress(address) {
|
|
22617
|
-
if (isValidAultAddress(address)) {
|
|
22618
|
-
return address;
|
|
22619
|
-
}
|
|
22620
|
-
if (isValidEvmAddress(address)) {
|
|
22621
|
-
return evmToAult(address);
|
|
22622
|
-
}
|
|
22623
|
-
throw new Error(`Invalid address format: ${address}`);
|
|
22624
|
-
}
|
|
22625
|
-
function normalizeAddresses(addresses) {
|
|
22626
|
-
return addresses.map(normalizeAddress);
|
|
22627
|
-
}
|
|
22628
|
-
function toBigInt(value) {
|
|
22629
|
-
return typeof value === "bigint" ? value : BigInt(value);
|
|
22630
|
-
}
|
|
22631
|
-
|
|
22632
22895
|
// src/high-level/query-helpers.ts
|
|
22633
22896
|
var BATCH_SIZE = 50;
|
|
22634
22897
|
async function batchMap(items, fn) {
|
|
@@ -22718,6 +22981,43 @@ function createParallelQueryApi(lowLevel) {
|
|
|
22718
22981
|
};
|
|
22719
22982
|
}
|
|
22720
22983
|
|
|
22984
|
+
// src/high-level/cloid-lookup.ts
|
|
22985
|
+
var import_encoding3 = require("@cosmjs/encoding");
|
|
22986
|
+
function createCloidLookupApi(lowLevel) {
|
|
22987
|
+
async function findOrderByCloid(orderer, cloid) {
|
|
22988
|
+
const addr = normalizeAddress(orderer);
|
|
22989
|
+
const bytes = typeof cloid === "string" ? (0, import_encoding3.fromHex)(cloid) : cloid;
|
|
22990
|
+
assertCloid(bytes);
|
|
22991
|
+
const chain = await lowLevel.rest.clob.getOrderByCloid(addr, bytes);
|
|
22992
|
+
if (chain.order) {
|
|
22993
|
+
return { source: "chain", order: chain.order };
|
|
22994
|
+
}
|
|
22995
|
+
const wantHex = (0, import_encoding3.toHex)(bytes);
|
|
22996
|
+
const LIMIT = 200;
|
|
22997
|
+
const res = await lowLevel.rest.dex.listOrders({ address: addr, cloid: wantHex, limit: LIMIT });
|
|
22998
|
+
if (res.status !== 200) {
|
|
22999
|
+
throw new Error(`dex-api listOrders returned unexpected status ${res.status}`);
|
|
23000
|
+
}
|
|
23001
|
+
const orders = res.data.filter((o) => o.clientOrderId?.toLowerCase() === wantHex);
|
|
23002
|
+
if (orders.length === 0) {
|
|
23003
|
+
return { source: "none", order: null };
|
|
23004
|
+
}
|
|
23005
|
+
if (res.data.length >= LIMIT) {
|
|
23006
|
+
throw new Error(
|
|
23007
|
+
`cloid ${wantHex} has too many historical matches to disambiguate (>= ${LIMIT}); dex-api needs a canonical (orderer, cloid) latest lookup`
|
|
23008
|
+
);
|
|
23009
|
+
}
|
|
23010
|
+
const order = orders.reduce((latest, next) => {
|
|
23011
|
+
if (next.timestamp !== latest.timestamp) {
|
|
23012
|
+
return next.timestamp > latest.timestamp ? next : latest;
|
|
23013
|
+
}
|
|
23014
|
+
return next.id > latest.id ? next : latest;
|
|
23015
|
+
});
|
|
23016
|
+
return { source: "dex", order };
|
|
23017
|
+
}
|
|
23018
|
+
return { findOrderByCloid };
|
|
23019
|
+
}
|
|
23020
|
+
|
|
22721
23021
|
// src/high-level/tx/accountx.ts
|
|
22722
23022
|
function createAccountxTxApi({
|
|
22723
23023
|
signerAddress,
|
|
@@ -22841,6 +23141,7 @@ function createAuthorityTxApi({ signerAddress, exec }) {
|
|
|
22841
23141
|
|
|
22842
23142
|
// src/core/clob-msgs.ts
|
|
22843
23143
|
function buildLimitOrderMsg(sender, params) {
|
|
23144
|
+
if (params.cloid !== void 0) assertCloid(params.cloid);
|
|
22844
23145
|
return msg.clob.placeLimitOrder({
|
|
22845
23146
|
sender,
|
|
22846
23147
|
marketId: params.marketId,
|
|
@@ -22848,6 +23149,7 @@ function buildLimitOrderMsg(sender, params) {
|
|
|
22848
23149
|
price: params.price,
|
|
22849
23150
|
quantity: params.quantity,
|
|
22850
23151
|
deadline: params.deadline,
|
|
23152
|
+
...params.cloid !== void 0 && { cloid: params.cloid },
|
|
22851
23153
|
...params.postOnly !== void 0 && { postOnly: params.postOnly },
|
|
22852
23154
|
...params.builderAddress !== void 0 && {
|
|
22853
23155
|
builderAddress: normalizeAddress(params.builderAddress)
|
|
@@ -22856,11 +23158,13 @@ function buildLimitOrderMsg(sender, params) {
|
|
|
22856
23158
|
});
|
|
22857
23159
|
}
|
|
22858
23160
|
function buildMarketOrderMsg(sender, params) {
|
|
23161
|
+
if (params.cloid !== void 0) assertCloid(params.cloid);
|
|
22859
23162
|
return msg.clob.placeMarketOrder({
|
|
22860
23163
|
sender,
|
|
22861
23164
|
marketId: params.marketId,
|
|
22862
23165
|
isBuy: params.isBuy,
|
|
22863
23166
|
deposit: params.deposit,
|
|
23167
|
+
...params.cloid !== void 0 && { cloid: params.cloid },
|
|
22864
23168
|
...params.worstPrice !== void 0 && { worstPrice: params.worstPrice },
|
|
22865
23169
|
...params.priceTolerance !== void 0 && { priceTolerance: params.priceTolerance },
|
|
22866
23170
|
...params.builderAddress !== void 0 && {
|
|
@@ -22870,6 +23174,7 @@ function buildMarketOrderMsg(sender, params) {
|
|
|
22870
23174
|
});
|
|
22871
23175
|
}
|
|
22872
23176
|
function buildCancelOrdersMsg(sender, orderIds) {
|
|
23177
|
+
for (const ref of orderIds) assertOrderRef(ref);
|
|
22873
23178
|
return msg.clob.cancelOrders({ sender, orderIds });
|
|
22874
23179
|
}
|
|
22875
23180
|
function buildScaleOrderMsg(sender, params) {
|
|
@@ -22890,93 +23195,8 @@ function buildScaleOrderMsg(sender, params) {
|
|
|
22890
23195
|
});
|
|
22891
23196
|
}
|
|
22892
23197
|
|
|
22893
|
-
// src/utils/opaque-id.ts
|
|
22894
|
-
var import_viem4 = require("viem");
|
|
22895
|
-
function decodeHex(input) {
|
|
22896
|
-
const clean = input.startsWith("0x") || input.startsWith("0X") ? input.slice(2) : input;
|
|
22897
|
-
if (clean.length % 2 !== 0) {
|
|
22898
|
-
throw new Error(`invalid hex length: "${input}"`);
|
|
22899
|
-
}
|
|
22900
|
-
if (clean.length > 0 && !/^[0-9a-fA-F]+$/.test(clean)) {
|
|
22901
|
-
throw new Error(`invalid hex characters: "${input}"`);
|
|
22902
|
-
}
|
|
22903
|
-
return (0, import_viem4.hexToBytes)(`0x${clean}`);
|
|
22904
|
-
}
|
|
22905
|
-
function encodeHex(bytes) {
|
|
22906
|
-
return (0, import_viem4.bytesToHex)(bytes).slice(2);
|
|
22907
|
-
}
|
|
22908
|
-
function bytesEqual(a, b) {
|
|
22909
|
-
if (a.length !== b.length) return false;
|
|
22910
|
-
for (let i = 0; i < a.length; i++) {
|
|
22911
|
-
if (a[i] !== b[i]) return false;
|
|
22912
|
-
}
|
|
22913
|
-
return true;
|
|
22914
|
-
}
|
|
22915
|
-
var OpaqueId = class {
|
|
22916
|
-
constructor(bytes) {
|
|
22917
|
-
this.bytes = bytes;
|
|
22918
|
-
}
|
|
22919
|
-
toBytes() {
|
|
22920
|
-
return new Uint8Array(this.bytes);
|
|
22921
|
-
}
|
|
22922
|
-
toHex() {
|
|
22923
|
-
return encodeHex(this.bytes);
|
|
22924
|
-
}
|
|
22925
|
-
toBase64() {
|
|
22926
|
-
return bytesToBase64(this.bytes);
|
|
22927
|
-
}
|
|
22928
|
-
toString() {
|
|
22929
|
-
return this.toHex();
|
|
22930
|
-
}
|
|
22931
|
-
equalsBytes(other) {
|
|
22932
|
-
return bytesEqual(this.bytes, other.bytes);
|
|
22933
|
-
}
|
|
22934
|
-
};
|
|
22935
|
-
var MarketId = class _MarketId extends OpaqueId {
|
|
22936
|
-
static fromHex(hex) {
|
|
22937
|
-
return new _MarketId(_MarketId.assertNonEmpty(decodeHex(hex), `hex "${hex}"`));
|
|
22938
|
-
}
|
|
22939
|
-
static fromBase64(b64) {
|
|
22940
|
-
return new _MarketId(_MarketId.assertNonEmpty(base64ToBytes(b64), `base64 "${b64}"`));
|
|
22941
|
-
}
|
|
22942
|
-
static fromBytes(bytes) {
|
|
22943
|
-
return new _MarketId(_MarketId.assertNonEmpty(new Uint8Array(bytes), "bytes"));
|
|
22944
|
-
}
|
|
22945
|
-
static assertNonEmpty(bytes, source) {
|
|
22946
|
-
if (bytes.length === 0) {
|
|
22947
|
-
throw new Error(`MarketId: empty bytes from ${source}`);
|
|
22948
|
-
}
|
|
22949
|
-
return bytes;
|
|
22950
|
-
}
|
|
22951
|
-
equals(other) {
|
|
22952
|
-
return this.equalsBytes(other);
|
|
22953
|
-
}
|
|
22954
|
-
};
|
|
22955
|
-
var ORDER_ID_LENGTH = 16;
|
|
22956
|
-
var OrderId = class _OrderId extends OpaqueId {
|
|
22957
|
-
static fromHex(hex) {
|
|
22958
|
-
return new _OrderId(_OrderId.assertLength(decodeHex(hex), `hex "${hex}"`));
|
|
22959
|
-
}
|
|
22960
|
-
static fromBase64(b64) {
|
|
22961
|
-
return new _OrderId(_OrderId.assertLength(base64ToBytes(b64), `base64 "${b64}"`));
|
|
22962
|
-
}
|
|
22963
|
-
static fromBytes(bytes) {
|
|
22964
|
-
return new _OrderId(_OrderId.assertLength(new Uint8Array(bytes), "bytes"));
|
|
22965
|
-
}
|
|
22966
|
-
static assertLength(bytes, source) {
|
|
22967
|
-
if (bytes.length !== ORDER_ID_LENGTH) {
|
|
22968
|
-
throw new Error(
|
|
22969
|
-
`OrderId: expected ${ORDER_ID_LENGTH} bytes (chain layout), got ${bytes.length} from ${source}`
|
|
22970
|
-
);
|
|
22971
|
-
}
|
|
22972
|
-
return bytes;
|
|
22973
|
-
}
|
|
22974
|
-
equals(other) {
|
|
22975
|
-
return this.equalsBytes(other);
|
|
22976
|
-
}
|
|
22977
|
-
};
|
|
22978
|
-
|
|
22979
23198
|
// src/core/clob-responses.ts
|
|
23199
|
+
var import_encoding4 = require("@cosmjs/encoding");
|
|
22980
23200
|
async function withWaitDecode(wait, run, decode) {
|
|
22981
23201
|
const w = wait ?? false;
|
|
22982
23202
|
const res = await run(w);
|
|
@@ -22996,26 +23216,25 @@ function findResponse(msgResponses, typeUrl, txHash) {
|
|
|
22996
23216
|
function coinOrUndefined(coin) {
|
|
22997
23217
|
return coin && coin.denom !== "" ? coin : void 0;
|
|
22998
23218
|
}
|
|
22999
|
-
function
|
|
23000
|
-
|
|
23001
|
-
findResponse(msgResponses,
|
|
23002
|
-
|
|
23003
|
-
|
|
23004
|
-
|
|
23005
|
-
|
|
23006
|
-
|
|
23007
|
-
|
|
23008
|
-
}
|
|
23009
|
-
function decodeMarketOrderResult(msgResponses, base) {
|
|
23010
|
-
const decoded = MsgPlaceMarketOrderResponse.decode(
|
|
23011
|
-
findResponse(msgResponses, MARKET_RESPONSE_TYPE, base.txHash)
|
|
23012
|
-
);
|
|
23013
|
-
return {
|
|
23014
|
-
...base,
|
|
23015
|
-
orderId: OrderId.fromBytes(decoded.orderId).toHex(),
|
|
23016
|
-
...coinOrUndefined(decoded.escrowedAmount) && { escrowedAmount: decoded.escrowedAmount }
|
|
23219
|
+
function decodePlaceOrder(codec, typeUrl) {
|
|
23220
|
+
return (msgResponses, base) => {
|
|
23221
|
+
const decoded = codec.decode(findResponse(msgResponses, typeUrl, base.txHash));
|
|
23222
|
+
return {
|
|
23223
|
+
...base,
|
|
23224
|
+
orderId: OrderId.fromBytes(decoded.orderId).toHex(),
|
|
23225
|
+
...decoded.cloid?.length ? { cloid: (0, import_encoding4.toHex)(decoded.cloid) } : {},
|
|
23226
|
+
...coinOrUndefined(decoded.escrowedAmount) && { escrowedAmount: decoded.escrowedAmount }
|
|
23227
|
+
};
|
|
23017
23228
|
};
|
|
23018
23229
|
}
|
|
23230
|
+
var decodeLimitOrderResult = decodePlaceOrder(
|
|
23231
|
+
MsgPlaceLimitOrderResponse,
|
|
23232
|
+
LIMIT_RESPONSE_TYPE
|
|
23233
|
+
);
|
|
23234
|
+
var decodeMarketOrderResult = decodePlaceOrder(
|
|
23235
|
+
MsgPlaceMarketOrderResponse,
|
|
23236
|
+
MARKET_RESPONSE_TYPE
|
|
23237
|
+
);
|
|
23019
23238
|
function decodeScaleOrderResult(msgResponses, base) {
|
|
23020
23239
|
const decoded = MsgPlaceScaleOrderResponse.decode(
|
|
23021
23240
|
findResponse(msgResponses, SCALE_RESPONSE_TYPE, base.txHash)
|
|
@@ -23036,8 +23255,8 @@ function decodeCancelOrdersResult(msgResponses, base) {
|
|
|
23036
23255
|
);
|
|
23037
23256
|
return {
|
|
23038
23257
|
...base,
|
|
23039
|
-
succeeded: decoded.succeeded.map((id) =>
|
|
23040
|
-
failed: decoded.failed.map((id) =>
|
|
23258
|
+
succeeded: decoded.succeeded.map((id) => (0, import_encoding4.toHex)(id)),
|
|
23259
|
+
failed: decoded.failed.map((id) => (0, import_encoding4.toHex)(id))
|
|
23041
23260
|
};
|
|
23042
23261
|
}
|
|
23043
23262
|
|
|
@@ -24384,7 +24603,7 @@ function createStaticResolver(optsOrNetwork, legacyManifest) {
|
|
|
24384
24603
|
// src/agent/attach.ts
|
|
24385
24604
|
var import_secp256k12 = require("@noble/curves/secp256k1");
|
|
24386
24605
|
var import_viem7 = require("viem");
|
|
24387
|
-
var
|
|
24606
|
+
var import_encoding5 = require("@cosmjs/encoding");
|
|
24388
24607
|
|
|
24389
24608
|
// src/agent/sign-and-broadcast.ts
|
|
24390
24609
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
|
@@ -24694,7 +24913,7 @@ function deriveAgentAddress(privateKeyHex) {
|
|
|
24694
24913
|
const uncompressedPubkey = import_secp256k12.secp256k1.getPublicKey(privKeyBytes, false);
|
|
24695
24914
|
const pubkeyHash = (0, import_viem7.hexToBytes)((0, import_viem7.keccak256)(uncompressedPubkey.slice(1)));
|
|
24696
24915
|
const evmAddressBytes = pubkeyHash.slice(12);
|
|
24697
|
-
const evmHex = `0x${(0,
|
|
24916
|
+
const evmHex = `0x${(0, import_encoding5.toHex)(evmAddressBytes)}`;
|
|
24698
24917
|
return evmToAult(evmHex);
|
|
24699
24918
|
}
|
|
24700
24919
|
function buildAgentSurface(options, ctx) {
|
|
@@ -24791,6 +25010,7 @@ async function buildClient(options, resolver) {
|
|
|
24791
25010
|
...createStakingTxApi(ctx),
|
|
24792
25011
|
...createTokenRegistryTxApi(ctx),
|
|
24793
25012
|
...createParallelQueryApi(lowLevel),
|
|
25013
|
+
...createCloidLookupApi(lowLevel),
|
|
24794
25014
|
// Agent surface — populated by attachAgent, cleared by detachAgent.
|
|
24795
25015
|
asAgent: null,
|
|
24796
25016
|
attachAgent(opts) {
|
|
@@ -25070,15 +25290,23 @@ var ListTradesResponseItem = zod.object({
|
|
|
25070
25290
|
symbol: zod.string(),
|
|
25071
25291
|
type: zod.union([zod.literal("limit"), zod.literal("market"), zod.literal(null)]).nullish().describe("Order type resolved via JOIN to orders table. Null if order not found."),
|
|
25072
25292
|
side: zod.enum(["buy", "sell"]),
|
|
25073
|
-
takerOrMaker: zod.enum(["taker"]).optional().describe(
|
|
25293
|
+
takerOrMaker: zod.enum(["taker", "maker"]).optional().describe(
|
|
25294
|
+
"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."
|
|
25295
|
+
),
|
|
25074
25296
|
price: zod.string().regex(listTradesResponsePriceRegExp),
|
|
25075
25297
|
amount: zod.string().regex(listTradesResponseAmountRegExp),
|
|
25076
25298
|
cost: zod.string().regex(listTradesResponseCostRegExp).describe("price * amount"),
|
|
25077
25299
|
fee: zod.object({
|
|
25078
|
-
cost: zod.string().regex(listTradesResponseFeeCostRegExp).optional().describe("Fee cost in
|
|
25079
|
-
currency: zod.string().optional().describe(
|
|
25080
|
-
|
|
25081
|
-
|
|
25300
|
+
cost: zod.string().regex(listTradesResponseFeeCostRegExp).optional().describe("Fee cost in `currency` units, decimal string."),
|
|
25301
|
+
currency: zod.string().optional().describe(
|
|
25302
|
+
'Ticker of the fee denom (e.g., "USDT", or "AULT" for a base-denom fee). The quote ticker for the rate-estimated fallback.'
|
|
25303
|
+
),
|
|
25304
|
+
rate: zod.string().regex(listTradesResponseFeeRateRegExp).optional().describe(
|
|
25305
|
+
"This leg's fee rate from the market, decimal string: the maker rate for the maker leg, the taker rate otherwise."
|
|
25306
|
+
)
|
|
25307
|
+
}).optional().describe(
|
|
25308
|
+
"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)."
|
|
25309
|
+
),
|
|
25082
25310
|
info: zod.object({
|
|
25083
25311
|
address: zod.string().regex(listTradesResponseInfoAddressOneRegExp).describe(
|
|
25084
25312
|
"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"
|
|
@@ -25164,6 +25392,7 @@ var GetStatsResponse = zod.object({
|
|
|
25164
25392
|
var listOrdersQueryAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
25165
25393
|
var listOrdersQueryAddressTwoRegExp = new RegExp("^0x[a-f0-9]{40}$");
|
|
25166
25394
|
var listOrdersQueryMarketIdRegExp = new RegExp("^[0-9a-fA-F]+$");
|
|
25395
|
+
var listOrdersQueryCloidRegExp = new RegExp("^([0-9a-fA-F]{16})?$");
|
|
25167
25396
|
var listOrdersQueryLimitDefault = 50;
|
|
25168
25397
|
var listOrdersQueryLimitMax = 200;
|
|
25169
25398
|
var ListOrdersQueryParams = zod.object({
|
|
@@ -25180,6 +25409,9 @@ var ListOrdersQueryParams = zod.object({
|
|
|
25180
25409
|
status: zod.enum(["open", "closed", "canceled"]).optional(),
|
|
25181
25410
|
symbol: zod.string().optional().describe("Symbol to filter by (e.g., AULT/USDT). Alternative to market_id."),
|
|
25182
25411
|
market_id: zod.string().regex(listOrdersQueryMarketIdRegExp).optional().describe("Hex-encoded binary market ID to filter by. Takes precedence over symbol."),
|
|
25412
|
+
cloid: zod.string().regex(listOrdersQueryCloidRegExp).optional().describe(
|
|
25413
|
+
"Client order id (cloid) to filter by, as a hex string. A\nnon-empty value must decode to exactly 8 bytes (16 hex chars);\nanything else returns 400. An absent or empty (`cloid=`) value\napplies no cloid filter, matching how `market_id` behaves.\nCombined with `address`, a set cloid returns the orders carrying\nit. cloid uniqueness is only enforced for currently-resting\norders, so closed orders that reused the cloid may also match and\nmore than one order can be returned.\n"
|
|
25414
|
+
),
|
|
25183
25415
|
since: zod.number().optional().describe("Return orders created after this Unix timestamp (milliseconds)"),
|
|
25184
25416
|
limit: zod.number().min(1).max(listOrdersQueryLimitMax).default(listOrdersQueryLimitDefault)
|
|
25185
25417
|
});
|
|
@@ -25194,7 +25426,9 @@ var listOrdersResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
|
25194
25426
|
var listOrdersResponseInfoRemainingDepositRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25195
25427
|
var ListOrdersResponseItem = zod.object({
|
|
25196
25428
|
id: zod.string(),
|
|
25197
|
-
clientOrderId: zod.string().nullish().describe(
|
|
25429
|
+
clientOrderId: zod.string().nullish().describe(
|
|
25430
|
+
"The order's cloid (client order id) as a hex string, or null when the order was placed without one."
|
|
25431
|
+
),
|
|
25198
25432
|
timestamp: zod.number(),
|
|
25199
25433
|
datetime: zod.iso.datetime({}),
|
|
25200
25434
|
lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
|
|
@@ -25258,7 +25492,9 @@ var getOrderResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
|
25258
25492
|
var getOrderResponseInfoRemainingDepositRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25259
25493
|
var GetOrderResponse = zod.object({
|
|
25260
25494
|
id: zod.string(),
|
|
25261
|
-
clientOrderId: zod.string().nullish().describe(
|
|
25495
|
+
clientOrderId: zod.string().nullish().describe(
|
|
25496
|
+
"The order's cloid (client order id) as a hex string, or null when the order was placed without one."
|
|
25497
|
+
),
|
|
25262
25498
|
timestamp: zod.number(),
|
|
25263
25499
|
datetime: zod.iso.datetime({}),
|
|
25264
25500
|
lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
|
|
@@ -25330,15 +25566,23 @@ var ListMyTradesResponseItem = zod.object({
|
|
|
25330
25566
|
symbol: zod.string(),
|
|
25331
25567
|
type: zod.union([zod.literal("limit"), zod.literal("market"), zod.literal(null)]).nullish().describe("Order type resolved via JOIN to orders table. Null if order not found."),
|
|
25332
25568
|
side: zod.enum(["buy", "sell"]),
|
|
25333
|
-
takerOrMaker: zod.enum(["taker"]).optional().describe(
|
|
25569
|
+
takerOrMaker: zod.enum(["taker", "maker"]).optional().describe(
|
|
25570
|
+
"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."
|
|
25571
|
+
),
|
|
25334
25572
|
price: zod.string().regex(listMyTradesResponsePriceRegExp),
|
|
25335
25573
|
amount: zod.string().regex(listMyTradesResponseAmountRegExp),
|
|
25336
25574
|
cost: zod.string().regex(listMyTradesResponseCostRegExp).describe("price * amount"),
|
|
25337
25575
|
fee: zod.object({
|
|
25338
|
-
cost: zod.string().regex(listMyTradesResponseFeeCostRegExp).optional().describe("Fee cost in
|
|
25339
|
-
currency: zod.string().optional().describe(
|
|
25340
|
-
|
|
25341
|
-
|
|
25576
|
+
cost: zod.string().regex(listMyTradesResponseFeeCostRegExp).optional().describe("Fee cost in `currency` units, decimal string."),
|
|
25577
|
+
currency: zod.string().optional().describe(
|
|
25578
|
+
'Ticker of the fee denom (e.g., "USDT", or "AULT" for a base-denom fee). The quote ticker for the rate-estimated fallback.'
|
|
25579
|
+
),
|
|
25580
|
+
rate: zod.string().regex(listMyTradesResponseFeeRateRegExp).optional().describe(
|
|
25581
|
+
"This leg's fee rate from the market, decimal string: the maker rate for the maker leg, the taker rate otherwise."
|
|
25582
|
+
)
|
|
25583
|
+
}).optional().describe(
|
|
25584
|
+
"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)."
|
|
25585
|
+
),
|
|
25342
25586
|
info: zod.object({
|
|
25343
25587
|
address: zod.string().regex(listMyTradesResponseInfoAddressOneRegExp).describe(
|
|
25344
25588
|
"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"
|
|
@@ -25537,7 +25781,7 @@ function createDexWs(url, options) {
|
|
|
25537
25781
|
}
|
|
25538
25782
|
|
|
25539
25783
|
// src/index.ts
|
|
25540
|
-
var SDK_VERSION = "0.0.2-alpha.
|
|
25784
|
+
var SDK_VERSION = "0.0.2-alpha.27";
|
|
25541
25785
|
// Annotate the CommonJS export names for ESM import in node:
|
|
25542
25786
|
0 && (module.exports = {
|
|
25543
25787
|
AGENT_DEFAULTS,
|
|
@@ -25611,6 +25855,7 @@ var SDK_VERSION = "0.0.2-alpha.25";
|
|
|
25611
25855
|
MissingMsgResponseError,
|
|
25612
25856
|
NETWORKS,
|
|
25613
25857
|
NetworkError,
|
|
25858
|
+
ORDER_ID_LENGTH,
|
|
25614
25859
|
OrderId,
|
|
25615
25860
|
PageResponseSchema,
|
|
25616
25861
|
REST_CONTEXT_BRAND,
|
|
@@ -25717,6 +25962,10 @@ var SDK_VERSION = "0.0.2-alpha.25";
|
|
|
25717
25962
|
getOrderbookQueryLimitDefault,
|
|
25718
25963
|
getOrderbookQueryLimitMax,
|
|
25719
25964
|
getOrderbookResponseMarketIdRegExp,
|
|
25965
|
+
getPortfolioFlows,
|
|
25966
|
+
getPortfolioHoldings,
|
|
25967
|
+
getPortfolioPnl,
|
|
25968
|
+
getPortfolioTimeSeries,
|
|
25720
25969
|
getStatsResponseMarketsItemBaseVolumeRegExp,
|
|
25721
25970
|
getStatsResponseMarketsItemEstimatedFeeRegExp,
|
|
25722
25971
|
getStatsResponseMarketsItemQuoteVolumeRegExp,
|
|
@@ -25748,6 +25997,7 @@ var SDK_VERSION = "0.0.2-alpha.25";
|
|
|
25748
25997
|
listMyTradesResponsePriceRegExp,
|
|
25749
25998
|
listOrdersQueryAddressOneRegExp,
|
|
25750
25999
|
listOrdersQueryAddressTwoRegExp,
|
|
26000
|
+
listOrdersQueryCloidRegExp,
|
|
25751
26001
|
listOrdersQueryLimitDefault,
|
|
25752
26002
|
listOrdersQueryLimitMax,
|
|
25753
26003
|
listOrdersQueryMarketIdRegExp,
|