ault-sdk-ts 0.0.2-alpha.26 → 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 +434 -225
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +427 -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.generated.d.ts +39 -11
- 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,
|
|
@@ -242,6 +243,7 @@ __export(index_exports, {
|
|
|
242
243
|
listMyTradesResponsePriceRegExp: () => listMyTradesResponsePriceRegExp,
|
|
243
244
|
listOrdersQueryAddressOneRegExp: () => listOrdersQueryAddressOneRegExp,
|
|
244
245
|
listOrdersQueryAddressTwoRegExp: () => listOrdersQueryAddressTwoRegExp,
|
|
246
|
+
listOrdersQueryCloidRegExp: () => listOrdersQueryCloidRegExp,
|
|
245
247
|
listOrdersQueryLimitDefault: () => listOrdersQueryLimitDefault,
|
|
246
248
|
listOrdersQueryLimitMax: () => listOrdersQueryLimitMax,
|
|
247
249
|
listOrdersQueryMarketIdRegExp: () => listOrdersQueryMarketIdRegExp,
|
|
@@ -2865,6 +2867,192 @@ function createBankApi(context) {
|
|
|
2865
2867
|
};
|
|
2866
2868
|
}
|
|
2867
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
|
+
|
|
2868
3056
|
// src/proto/gen/ault/clob/v1/query.ts
|
|
2869
3057
|
var import_wire16 = require("@bufbuild/protobuf/wire");
|
|
2870
3058
|
|
|
@@ -3330,7 +3518,8 @@ function createBaseOrderResponse() {
|
|
|
3330
3518
|
remainingDeposit: "",
|
|
3331
3519
|
deadline: void 0,
|
|
3332
3520
|
postOnly: false,
|
|
3333
|
-
feeInfo: void 0
|
|
3521
|
+
feeInfo: void 0,
|
|
3522
|
+
cloid: new Uint8Array(0)
|
|
3334
3523
|
};
|
|
3335
3524
|
}
|
|
3336
3525
|
var OrderResponse = {
|
|
@@ -3374,6 +3563,9 @@ var OrderResponse = {
|
|
|
3374
3563
|
if (message.feeInfo !== void 0) {
|
|
3375
3564
|
FeeInfo.encode(message.feeInfo, writer.uint32(98).fork()).join();
|
|
3376
3565
|
}
|
|
3566
|
+
if (message.cloid.length !== 0) {
|
|
3567
|
+
writer.uint32(106).bytes(message.cloid);
|
|
3568
|
+
}
|
|
3377
3569
|
return writer;
|
|
3378
3570
|
},
|
|
3379
3571
|
decode(input, length) {
|
|
@@ -3467,6 +3659,13 @@ var OrderResponse = {
|
|
|
3467
3659
|
message.feeInfo = FeeInfo.decode(reader, reader.uint32());
|
|
3468
3660
|
continue;
|
|
3469
3661
|
}
|
|
3662
|
+
case 13: {
|
|
3663
|
+
if (tag !== 106) {
|
|
3664
|
+
break;
|
|
3665
|
+
}
|
|
3666
|
+
message.cloid = reader.bytes();
|
|
3667
|
+
continue;
|
|
3668
|
+
}
|
|
3470
3669
|
}
|
|
3471
3670
|
if ((tag & 7) === 4 || tag === 0) {
|
|
3472
3671
|
break;
|
|
@@ -3488,7 +3687,8 @@ var OrderResponse = {
|
|
|
3488
3687
|
remainingDeposit: isSet15(object2.remainingDeposit) ? globalThis.String(object2.remainingDeposit) : isSet15(object2.remaining_deposit) ? globalThis.String(object2.remaining_deposit) : "",
|
|
3489
3688
|
deadline: isSet15(object2.deadline) ? fromJsonTimestamp2(object2.deadline) : void 0,
|
|
3490
3689
|
postOnly: isSet15(object2.postOnly) ? globalThis.Boolean(object2.postOnly) : isSet15(object2.post_only) ? globalThis.Boolean(object2.post_only) : false,
|
|
3491
|
-
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)
|
|
3492
3692
|
};
|
|
3493
3693
|
},
|
|
3494
3694
|
toJSON(message) {
|
|
@@ -3529,6 +3729,9 @@ var OrderResponse = {
|
|
|
3529
3729
|
if (message.feeInfo !== void 0) {
|
|
3530
3730
|
obj.feeInfo = FeeInfo.toJSON(message.feeInfo);
|
|
3531
3731
|
}
|
|
3732
|
+
if (message.cloid.length !== 0) {
|
|
3733
|
+
obj.cloid = base64FromBytes4(message.cloid);
|
|
3734
|
+
}
|
|
3532
3735
|
return obj;
|
|
3533
3736
|
},
|
|
3534
3737
|
create(base) {
|
|
@@ -3548,6 +3751,7 @@ var OrderResponse = {
|
|
|
3548
3751
|
message.deadline = object2.deadline ?? void 0;
|
|
3549
3752
|
message.postOnly = object2.postOnly ?? false;
|
|
3550
3753
|
message.feeInfo = object2.feeInfo !== void 0 && object2.feeInfo !== null ? FeeInfo.fromPartial(object2.feeInfo) : void 0;
|
|
3754
|
+
message.cloid = object2.cloid ?? new Uint8Array(0);
|
|
3551
3755
|
return message;
|
|
3552
3756
|
}
|
|
3553
3757
|
};
|
|
@@ -3616,6 +3820,20 @@ function createClobApi(context) {
|
|
|
3616
3820
|
QueryOrderResponse
|
|
3617
3821
|
);
|
|
3618
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
|
+
},
|
|
3619
3837
|
async getOrders(params = {}) {
|
|
3620
3838
|
const query = buildQuery({
|
|
3621
3839
|
market_id: params.marketId ? normalizeMarketId(params.marketId) : void 0,
|
|
@@ -10758,6 +10976,8 @@ __export(dex_generated_exports, {
|
|
|
10758
10976
|
OrderResponseSide: () => OrderResponseSide,
|
|
10759
10977
|
OrderResponseStatus: () => OrderResponseStatus,
|
|
10760
10978
|
OrderResponseType: () => OrderResponseType,
|
|
10979
|
+
RangeQueryDayParameter: () => RangeQueryDayParameter,
|
|
10980
|
+
RangeQueryParameter: () => RangeQueryParameter,
|
|
10761
10981
|
ReadyResponseStatus: () => ReadyResponseStatus,
|
|
10762
10982
|
StatsResponseWindow: () => StatsResponseWindow,
|
|
10763
10983
|
TradeResponseSide: () => TradeResponseSide,
|
|
@@ -10866,7 +11086,8 @@ var TradeResponseSide = {
|
|
|
10866
11086
|
sell: "sell"
|
|
10867
11087
|
};
|
|
10868
11088
|
var TradeResponseTakerOrMaker = {
|
|
10869
|
-
taker: "taker"
|
|
11089
|
+
taker: "taker",
|
|
11090
|
+
maker: "maker"
|
|
10870
11091
|
};
|
|
10871
11092
|
var OrderResponseStatus = {
|
|
10872
11093
|
open: "open",
|
|
@@ -10900,6 +11121,18 @@ var UDFQuoteDataS = {
|
|
|
10900
11121
|
ok: "ok",
|
|
10901
11122
|
error: "error"
|
|
10902
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
|
+
};
|
|
10903
11136
|
var GetStatsWindow = {
|
|
10904
11137
|
"24h": "24h"
|
|
10905
11138
|
};
|
|
@@ -11323,73 +11556,6 @@ function createDexApi(context) {
|
|
|
11323
11556
|
};
|
|
11324
11557
|
}
|
|
11325
11558
|
|
|
11326
|
-
// src/utils/address.ts
|
|
11327
|
-
var import_encoding = require("@cosmjs/encoding");
|
|
11328
|
-
var import_viem2 = require("viem");
|
|
11329
|
-
function evmToAult(evmAddress) {
|
|
11330
|
-
const hex = evmAddress.toLowerCase().replace("0x", "");
|
|
11331
|
-
const bytes = (0, import_encoding.fromHex)(hex);
|
|
11332
|
-
return (0, import_encoding.toBech32)("ault", bytes);
|
|
11333
|
-
}
|
|
11334
|
-
function aultToEvm(aultAddress) {
|
|
11335
|
-
const { data } = (0, import_encoding.fromBech32)(aultAddress);
|
|
11336
|
-
return (0, import_viem2.getAddress)(`0x${(0, import_encoding.toHex)(data)}`);
|
|
11337
|
-
}
|
|
11338
|
-
function isValidAultAddress(address) {
|
|
11339
|
-
try {
|
|
11340
|
-
const { prefix, data } = (0, import_encoding.fromBech32)(address);
|
|
11341
|
-
return prefix === "ault" && data.length === 20;
|
|
11342
|
-
} catch {
|
|
11343
|
-
return false;
|
|
11344
|
-
}
|
|
11345
|
-
}
|
|
11346
|
-
function isValidEvmAddress(address) {
|
|
11347
|
-
if (!/^0[xX][a-fA-F0-9]{40}$/.test(address)) return false;
|
|
11348
|
-
const normalized = `0x${address.slice(2)}`;
|
|
11349
|
-
const body = normalized.slice(2);
|
|
11350
|
-
const allLower = body === body.toLowerCase();
|
|
11351
|
-
const allUpper = body === body.toUpperCase();
|
|
11352
|
-
if (allLower || allUpper) return true;
|
|
11353
|
-
return (0, import_viem2.isAddress)(normalized, { strict: true });
|
|
11354
|
-
}
|
|
11355
|
-
function addressEquals(a, b) {
|
|
11356
|
-
const ab = addressBytes(a);
|
|
11357
|
-
const bb = addressBytes(b);
|
|
11358
|
-
if (!ab || !bb || ab.length !== bb.length) return false;
|
|
11359
|
-
for (let i = 0; i < ab.length; i++) {
|
|
11360
|
-
if (ab[i] !== bb[i]) return false;
|
|
11361
|
-
}
|
|
11362
|
-
return true;
|
|
11363
|
-
}
|
|
11364
|
-
function addressBytes(s) {
|
|
11365
|
-
if (!s) return null;
|
|
11366
|
-
if (s.startsWith("0x") || s.startsWith("0X")) {
|
|
11367
|
-
const body = s.slice(2);
|
|
11368
|
-
if (!/^[a-fA-F0-9]+$/.test(body) || body.length !== 40) return null;
|
|
11369
|
-
return (0, import_encoding.fromHex)(body.toLowerCase());
|
|
11370
|
-
}
|
|
11371
|
-
try {
|
|
11372
|
-
const { data } = (0, import_encoding.fromBech32)(s);
|
|
11373
|
-
return data;
|
|
11374
|
-
} catch {
|
|
11375
|
-
return null;
|
|
11376
|
-
}
|
|
11377
|
-
}
|
|
11378
|
-
function isValidValidatorAddress(address) {
|
|
11379
|
-
try {
|
|
11380
|
-
const { prefix, data } = (0, import_encoding.fromBech32)(address);
|
|
11381
|
-
return prefix === "aultvaloper" && data.length === 20;
|
|
11382
|
-
} catch {
|
|
11383
|
-
return false;
|
|
11384
|
-
}
|
|
11385
|
-
}
|
|
11386
|
-
function assertValidatorAddress(address) {
|
|
11387
|
-
if (isValidValidatorAddress(address)) {
|
|
11388
|
-
return address;
|
|
11389
|
-
}
|
|
11390
|
-
throw new Error(`Invalid validator address format: ${address}`);
|
|
11391
|
-
}
|
|
11392
|
-
|
|
11393
11559
|
// src/ws/client.ts
|
|
11394
11560
|
var import_encoding2 = require("@cosmjs/encoding");
|
|
11395
11561
|
var NORMAL_CLOSURE = 1e3;
|
|
@@ -12424,7 +12590,7 @@ function createTokenRegistryApi(context) {
|
|
|
12424
12590
|
}
|
|
12425
12591
|
|
|
12426
12592
|
// src/eip712/sign-and-broadcast.ts
|
|
12427
|
-
var
|
|
12593
|
+
var import_viem4 = require("viem");
|
|
12428
12594
|
|
|
12429
12595
|
// src/eip712/registry.generated.ts
|
|
12430
12596
|
var EIP712_MSG_TYPES = {
|
|
@@ -12605,14 +12771,16 @@ var EIP712_MSG_TYPES = {
|
|
|
12605
12771
|
{ name: "market_id", type: "string", jsName: "marketId" },
|
|
12606
12772
|
{ name: "is_buy", type: "bool", jsName: "isBuy" },
|
|
12607
12773
|
{ name: "deadline", type: "string" },
|
|
12774
|
+
{ name: "cloid", type: "string" },
|
|
12608
12775
|
{ name: "builder_fee_rate", type: "string", jsName: "builderFeeRate" },
|
|
12609
12776
|
{ name: "builder_address", type: "string", jsName: "builderAddress" }
|
|
12610
12777
|
],
|
|
12611
12778
|
timestampFields: ["deadline"],
|
|
12612
|
-
optionalFields: ["builder_address", "builder_fee_rate"],
|
|
12779
|
+
optionalFields: ["builder_address", "builder_fee_rate", "cloid"],
|
|
12613
12780
|
fieldSemantics: {
|
|
12614
12781
|
builder_address: { isAddress: true },
|
|
12615
12782
|
builder_fee_rate: { isLegacyDec: true },
|
|
12783
|
+
cloid: { isBinary: true },
|
|
12616
12784
|
market_id: { isBinary: true },
|
|
12617
12785
|
price: { isLegacyDec: true },
|
|
12618
12786
|
quantity: { isLegacyDec: true }
|
|
@@ -12628,13 +12796,21 @@ var EIP712_MSG_TYPES = {
|
|
|
12628
12796
|
{ name: "market_id", type: "string", jsName: "marketId" },
|
|
12629
12797
|
{ name: "is_buy", type: "bool", jsName: "isBuy" },
|
|
12630
12798
|
{ name: "deposit", type: "string" },
|
|
12799
|
+
{ name: "cloid", type: "string" },
|
|
12631
12800
|
{ name: "builder_fee_rate", type: "string", jsName: "builderFeeRate" },
|
|
12632
12801
|
{ name: "builder_address", type: "string", jsName: "builderAddress" }
|
|
12633
12802
|
],
|
|
12634
|
-
optionalFields: [
|
|
12803
|
+
optionalFields: [
|
|
12804
|
+
"builder_address",
|
|
12805
|
+
"builder_fee_rate",
|
|
12806
|
+
"cloid",
|
|
12807
|
+
"price_tolerance",
|
|
12808
|
+
"worst_price"
|
|
12809
|
+
],
|
|
12635
12810
|
fieldSemantics: {
|
|
12636
12811
|
builder_address: { isAddress: true },
|
|
12637
12812
|
builder_fee_rate: { isLegacyDec: true },
|
|
12813
|
+
cloid: { isBinary: true },
|
|
12638
12814
|
deposit: { isLegacyDec: true },
|
|
12639
12815
|
market_id: { isBinary: true },
|
|
12640
12816
|
price_tolerance: { isLegacyDec: true },
|
|
@@ -14164,6 +14340,9 @@ function mapValueToAmino(value, fields, nestedTypes, durationFields, timestampFi
|
|
|
14164
14340
|
if (field.type === "string" && raw === "") {
|
|
14165
14341
|
continue;
|
|
14166
14342
|
}
|
|
14343
|
+
if (raw instanceof Uint8Array && raw.length === 0) {
|
|
14344
|
+
continue;
|
|
14345
|
+
}
|
|
14167
14346
|
if (field.type.endsWith("[]") && Array.isArray(raw) && raw.length === 0) {
|
|
14168
14347
|
continue;
|
|
14169
14348
|
}
|
|
@@ -15424,7 +15603,8 @@ function createBaseMsgPlaceLimitOrder() {
|
|
|
15424
15603
|
deadline: void 0,
|
|
15425
15604
|
postOnly: false,
|
|
15426
15605
|
builderAddress: "",
|
|
15427
|
-
builderFeeRate: ""
|
|
15606
|
+
builderFeeRate: "",
|
|
15607
|
+
cloid: new Uint8Array(0)
|
|
15428
15608
|
};
|
|
15429
15609
|
}
|
|
15430
15610
|
var MsgPlaceLimitOrder = {
|
|
@@ -15456,6 +15636,9 @@ var MsgPlaceLimitOrder = {
|
|
|
15456
15636
|
if (message.builderFeeRate !== "") {
|
|
15457
15637
|
writer.uint32(74).string(message.builderFeeRate);
|
|
15458
15638
|
}
|
|
15639
|
+
if (message.cloid.length !== 0) {
|
|
15640
|
+
writer.uint32(82).bytes(message.cloid);
|
|
15641
|
+
}
|
|
15459
15642
|
return writer;
|
|
15460
15643
|
},
|
|
15461
15644
|
decode(input, length) {
|
|
@@ -15528,6 +15711,13 @@ var MsgPlaceLimitOrder = {
|
|
|
15528
15711
|
message.builderFeeRate = reader.string();
|
|
15529
15712
|
continue;
|
|
15530
15713
|
}
|
|
15714
|
+
case 10: {
|
|
15715
|
+
if (tag !== 82) {
|
|
15716
|
+
break;
|
|
15717
|
+
}
|
|
15718
|
+
message.cloid = reader.bytes();
|
|
15719
|
+
continue;
|
|
15720
|
+
}
|
|
15531
15721
|
}
|
|
15532
15722
|
if ((tag & 7) === 4 || tag === 0) {
|
|
15533
15723
|
break;
|
|
@@ -15546,7 +15736,8 @@ var MsgPlaceLimitOrder = {
|
|
|
15546
15736
|
deadline: isSet35(object2.deadline) ? fromJsonTimestamp7(object2.deadline) : void 0,
|
|
15547
15737
|
postOnly: isSet35(object2.postOnly) ? globalThis.Boolean(object2.postOnly) : isSet35(object2.post_only) ? globalThis.Boolean(object2.post_only) : false,
|
|
15548
15738
|
builderAddress: isSet35(object2.builderAddress) ? globalThis.String(object2.builderAddress) : isSet35(object2.builder_address) ? globalThis.String(object2.builder_address) : "",
|
|
15549
|
-
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)
|
|
15550
15741
|
};
|
|
15551
15742
|
},
|
|
15552
15743
|
toJSON(message) {
|
|
@@ -15578,6 +15769,9 @@ var MsgPlaceLimitOrder = {
|
|
|
15578
15769
|
if (message.builderFeeRate !== "") {
|
|
15579
15770
|
obj.builderFeeRate = message.builderFeeRate;
|
|
15580
15771
|
}
|
|
15772
|
+
if (message.cloid.length !== 0) {
|
|
15773
|
+
obj.cloid = base64FromBytes8(message.cloid);
|
|
15774
|
+
}
|
|
15581
15775
|
return obj;
|
|
15582
15776
|
},
|
|
15583
15777
|
create(base) {
|
|
@@ -15594,11 +15788,12 @@ var MsgPlaceLimitOrder = {
|
|
|
15594
15788
|
message.postOnly = object2.postOnly ?? false;
|
|
15595
15789
|
message.builderAddress = object2.builderAddress ?? "";
|
|
15596
15790
|
message.builderFeeRate = object2.builderFeeRate ?? "";
|
|
15791
|
+
message.cloid = object2.cloid ?? new Uint8Array(0);
|
|
15597
15792
|
return message;
|
|
15598
15793
|
}
|
|
15599
15794
|
};
|
|
15600
15795
|
function createBaseMsgPlaceLimitOrderResponse() {
|
|
15601
|
-
return { orderId: new Uint8Array(0), escrowedAmount: void 0 };
|
|
15796
|
+
return { orderId: new Uint8Array(0), escrowedAmount: void 0, cloid: new Uint8Array(0) };
|
|
15602
15797
|
}
|
|
15603
15798
|
var MsgPlaceLimitOrderResponse = {
|
|
15604
15799
|
encode(message, writer = new import_wire37.BinaryWriter()) {
|
|
@@ -15608,6 +15803,9 @@ var MsgPlaceLimitOrderResponse = {
|
|
|
15608
15803
|
if (message.escrowedAmount !== void 0) {
|
|
15609
15804
|
Coin.encode(message.escrowedAmount, writer.uint32(18).fork()).join();
|
|
15610
15805
|
}
|
|
15806
|
+
if (message.cloid.length !== 0) {
|
|
15807
|
+
writer.uint32(26).bytes(message.cloid);
|
|
15808
|
+
}
|
|
15611
15809
|
return writer;
|
|
15612
15810
|
},
|
|
15613
15811
|
decode(input, length) {
|
|
@@ -15631,6 +15829,13 @@ var MsgPlaceLimitOrderResponse = {
|
|
|
15631
15829
|
message.escrowedAmount = Coin.decode(reader, reader.uint32());
|
|
15632
15830
|
continue;
|
|
15633
15831
|
}
|
|
15832
|
+
case 3: {
|
|
15833
|
+
if (tag !== 26) {
|
|
15834
|
+
break;
|
|
15835
|
+
}
|
|
15836
|
+
message.cloid = reader.bytes();
|
|
15837
|
+
continue;
|
|
15838
|
+
}
|
|
15634
15839
|
}
|
|
15635
15840
|
if ((tag & 7) === 4 || tag === 0) {
|
|
15636
15841
|
break;
|
|
@@ -15642,7 +15847,8 @@ var MsgPlaceLimitOrderResponse = {
|
|
|
15642
15847
|
fromJSON(object2) {
|
|
15643
15848
|
return {
|
|
15644
15849
|
orderId: isSet35(object2.orderId) ? bytesFromBase648(object2.orderId) : isSet35(object2.order_id) ? bytesFromBase648(object2.order_id) : new Uint8Array(0),
|
|
15645
|
-
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)
|
|
15646
15852
|
};
|
|
15647
15853
|
},
|
|
15648
15854
|
toJSON(message) {
|
|
@@ -15653,6 +15859,9 @@ var MsgPlaceLimitOrderResponse = {
|
|
|
15653
15859
|
if (message.escrowedAmount !== void 0) {
|
|
15654
15860
|
obj.escrowedAmount = Coin.toJSON(message.escrowedAmount);
|
|
15655
15861
|
}
|
|
15862
|
+
if (message.cloid.length !== 0) {
|
|
15863
|
+
obj.cloid = base64FromBytes8(message.cloid);
|
|
15864
|
+
}
|
|
15656
15865
|
return obj;
|
|
15657
15866
|
},
|
|
15658
15867
|
create(base) {
|
|
@@ -15662,6 +15871,7 @@ var MsgPlaceLimitOrderResponse = {
|
|
|
15662
15871
|
const message = createBaseMsgPlaceLimitOrderResponse();
|
|
15663
15872
|
message.orderId = object2.orderId ?? new Uint8Array(0);
|
|
15664
15873
|
message.escrowedAmount = object2.escrowedAmount !== void 0 && object2.escrowedAmount !== null ? Coin.fromPartial(object2.escrowedAmount) : void 0;
|
|
15874
|
+
message.cloid = object2.cloid ?? new Uint8Array(0);
|
|
15665
15875
|
return message;
|
|
15666
15876
|
}
|
|
15667
15877
|
};
|
|
@@ -15674,7 +15884,8 @@ function createBaseMsgPlaceMarketOrder() {
|
|
|
15674
15884
|
worstPrice: "",
|
|
15675
15885
|
priceTolerance: "",
|
|
15676
15886
|
builderAddress: "",
|
|
15677
|
-
builderFeeRate: ""
|
|
15887
|
+
builderFeeRate: "",
|
|
15888
|
+
cloid: new Uint8Array(0)
|
|
15678
15889
|
};
|
|
15679
15890
|
}
|
|
15680
15891
|
var MsgPlaceMarketOrder = {
|
|
@@ -15703,6 +15914,9 @@ var MsgPlaceMarketOrder = {
|
|
|
15703
15914
|
if (message.builderFeeRate !== "") {
|
|
15704
15915
|
writer.uint32(66).string(message.builderFeeRate);
|
|
15705
15916
|
}
|
|
15917
|
+
if (message.cloid.length !== 0) {
|
|
15918
|
+
writer.uint32(74).bytes(message.cloid);
|
|
15919
|
+
}
|
|
15706
15920
|
return writer;
|
|
15707
15921
|
},
|
|
15708
15922
|
decode(input, length) {
|
|
@@ -15768,6 +15982,13 @@ var MsgPlaceMarketOrder = {
|
|
|
15768
15982
|
message.builderFeeRate = reader.string();
|
|
15769
15983
|
continue;
|
|
15770
15984
|
}
|
|
15985
|
+
case 9: {
|
|
15986
|
+
if (tag !== 74) {
|
|
15987
|
+
break;
|
|
15988
|
+
}
|
|
15989
|
+
message.cloid = reader.bytes();
|
|
15990
|
+
continue;
|
|
15991
|
+
}
|
|
15771
15992
|
}
|
|
15772
15993
|
if ((tag & 7) === 4 || tag === 0) {
|
|
15773
15994
|
break;
|
|
@@ -15785,7 +16006,8 @@ var MsgPlaceMarketOrder = {
|
|
|
15785
16006
|
worstPrice: isSet35(object2.worstPrice) ? globalThis.String(object2.worstPrice) : isSet35(object2.worst_price) ? globalThis.String(object2.worst_price) : "",
|
|
15786
16007
|
priceTolerance: isSet35(object2.priceTolerance) ? globalThis.String(object2.priceTolerance) : isSet35(object2.price_tolerance) ? globalThis.String(object2.price_tolerance) : "",
|
|
15787
16008
|
builderAddress: isSet35(object2.builderAddress) ? globalThis.String(object2.builderAddress) : isSet35(object2.builder_address) ? globalThis.String(object2.builder_address) : "",
|
|
15788
|
-
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)
|
|
15789
16011
|
};
|
|
15790
16012
|
},
|
|
15791
16013
|
toJSON(message) {
|
|
@@ -15814,6 +16036,9 @@ var MsgPlaceMarketOrder = {
|
|
|
15814
16036
|
if (message.builderFeeRate !== "") {
|
|
15815
16037
|
obj.builderFeeRate = message.builderFeeRate;
|
|
15816
16038
|
}
|
|
16039
|
+
if (message.cloid.length !== 0) {
|
|
16040
|
+
obj.cloid = base64FromBytes8(message.cloid);
|
|
16041
|
+
}
|
|
15817
16042
|
return obj;
|
|
15818
16043
|
},
|
|
15819
16044
|
create(base) {
|
|
@@ -15829,11 +16054,12 @@ var MsgPlaceMarketOrder = {
|
|
|
15829
16054
|
message.priceTolerance = object2.priceTolerance ?? "";
|
|
15830
16055
|
message.builderAddress = object2.builderAddress ?? "";
|
|
15831
16056
|
message.builderFeeRate = object2.builderFeeRate ?? "";
|
|
16057
|
+
message.cloid = object2.cloid ?? new Uint8Array(0);
|
|
15832
16058
|
return message;
|
|
15833
16059
|
}
|
|
15834
16060
|
};
|
|
15835
16061
|
function createBaseMsgPlaceMarketOrderResponse() {
|
|
15836
|
-
return { orderId: new Uint8Array(0), escrowedAmount: void 0 };
|
|
16062
|
+
return { orderId: new Uint8Array(0), escrowedAmount: void 0, cloid: new Uint8Array(0) };
|
|
15837
16063
|
}
|
|
15838
16064
|
var MsgPlaceMarketOrderResponse = {
|
|
15839
16065
|
encode(message, writer = new import_wire37.BinaryWriter()) {
|
|
@@ -15843,6 +16069,9 @@ var MsgPlaceMarketOrderResponse = {
|
|
|
15843
16069
|
if (message.escrowedAmount !== void 0) {
|
|
15844
16070
|
Coin.encode(message.escrowedAmount, writer.uint32(18).fork()).join();
|
|
15845
16071
|
}
|
|
16072
|
+
if (message.cloid.length !== 0) {
|
|
16073
|
+
writer.uint32(26).bytes(message.cloid);
|
|
16074
|
+
}
|
|
15846
16075
|
return writer;
|
|
15847
16076
|
},
|
|
15848
16077
|
decode(input, length) {
|
|
@@ -15866,6 +16095,13 @@ var MsgPlaceMarketOrderResponse = {
|
|
|
15866
16095
|
message.escrowedAmount = Coin.decode(reader, reader.uint32());
|
|
15867
16096
|
continue;
|
|
15868
16097
|
}
|
|
16098
|
+
case 3: {
|
|
16099
|
+
if (tag !== 26) {
|
|
16100
|
+
break;
|
|
16101
|
+
}
|
|
16102
|
+
message.cloid = reader.bytes();
|
|
16103
|
+
continue;
|
|
16104
|
+
}
|
|
15869
16105
|
}
|
|
15870
16106
|
if ((tag & 7) === 4 || tag === 0) {
|
|
15871
16107
|
break;
|
|
@@ -15877,7 +16113,8 @@ var MsgPlaceMarketOrderResponse = {
|
|
|
15877
16113
|
fromJSON(object2) {
|
|
15878
16114
|
return {
|
|
15879
16115
|
orderId: isSet35(object2.orderId) ? bytesFromBase648(object2.orderId) : isSet35(object2.order_id) ? bytesFromBase648(object2.order_id) : new Uint8Array(0),
|
|
15880
|
-
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)
|
|
15881
16118
|
};
|
|
15882
16119
|
},
|
|
15883
16120
|
toJSON(message) {
|
|
@@ -15888,6 +16125,9 @@ var MsgPlaceMarketOrderResponse = {
|
|
|
15888
16125
|
if (message.escrowedAmount !== void 0) {
|
|
15889
16126
|
obj.escrowedAmount = Coin.toJSON(message.escrowedAmount);
|
|
15890
16127
|
}
|
|
16128
|
+
if (message.cloid.length !== 0) {
|
|
16129
|
+
obj.cloid = base64FromBytes8(message.cloid);
|
|
16130
|
+
}
|
|
15891
16131
|
return obj;
|
|
15892
16132
|
},
|
|
15893
16133
|
create(base) {
|
|
@@ -15897,6 +16137,7 @@ var MsgPlaceMarketOrderResponse = {
|
|
|
15897
16137
|
const message = createBaseMsgPlaceMarketOrderResponse();
|
|
15898
16138
|
message.orderId = object2.orderId ?? new Uint8Array(0);
|
|
15899
16139
|
message.escrowedAmount = object2.escrowedAmount !== void 0 && object2.escrowedAmount !== null ? Coin.fromPartial(object2.escrowedAmount) : void 0;
|
|
16140
|
+
message.cloid = object2.cloid ?? new Uint8Array(0);
|
|
15900
16141
|
return message;
|
|
15901
16142
|
}
|
|
15902
16143
|
};
|
|
@@ -21241,7 +21482,8 @@ function mapAultClobV1MsgPlaceLimitOrder(input, label = "value") {
|
|
|
21241
21482
|
builderAddress: requireStringOrDefault(record2["builderAddress"], `${prefix}builderAddress`),
|
|
21242
21483
|
builderFeeRate: cosmosDecToProtoInt(
|
|
21243
21484
|
requireStringOrDefault(record2["builderFeeRate"], `${prefix}builderFeeRate`)
|
|
21244
|
-
)
|
|
21485
|
+
),
|
|
21486
|
+
cloid: requireBytesOrDefault(record2["cloid"], `${prefix}cloid`)
|
|
21245
21487
|
};
|
|
21246
21488
|
}
|
|
21247
21489
|
function mapAultClobV1MsgPlaceMarketOrder(input, label = "value") {
|
|
@@ -21261,7 +21503,8 @@ function mapAultClobV1MsgPlaceMarketOrder(input, label = "value") {
|
|
|
21261
21503
|
builderAddress: requireStringOrDefault(record2["builderAddress"], `${prefix}builderAddress`),
|
|
21262
21504
|
builderFeeRate: cosmosDecToProtoInt(
|
|
21263
21505
|
requireStringOrDefault(record2["builderFeeRate"], `${prefix}builderFeeRate`)
|
|
21264
|
-
)
|
|
21506
|
+
),
|
|
21507
|
+
cloid: requireBytesOrDefault(record2["cloid"], `${prefix}cloid`)
|
|
21265
21508
|
};
|
|
21266
21509
|
}
|
|
21267
21510
|
function mapAultClobV1MsgPlaceScaleOrder(input, label = "value") {
|
|
@@ -22243,14 +22486,14 @@ async function resolveDynamicFeeAmount(network, gas, feeMarketCache, fetchFn, fe
|
|
|
22243
22486
|
return dynamicI > staticI ? dynamicI.toString() : staticFloor;
|
|
22244
22487
|
}
|
|
22245
22488
|
async function recoverPubkeyFromTypedDataSignature(typedData, signature) {
|
|
22246
|
-
const hash = (0,
|
|
22489
|
+
const hash = (0, import_viem4.hashTypedData)({
|
|
22247
22490
|
domain: typedData.domain,
|
|
22248
22491
|
types: typedData.types,
|
|
22249
22492
|
primaryType: typedData.primaryType,
|
|
22250
22493
|
message: typedData.message
|
|
22251
22494
|
});
|
|
22252
|
-
const publicKey = await (0,
|
|
22253
|
-
const uncompressedBytes = (0,
|
|
22495
|
+
const publicKey = await (0, import_viem4.recoverPublicKey)({ hash, signature });
|
|
22496
|
+
const uncompressedBytes = (0, import_viem4.hexToBytes)(publicKey);
|
|
22254
22497
|
const x = uncompressedBytes.slice(1, 33);
|
|
22255
22498
|
const y = uncompressedBytes.slice(33, 65);
|
|
22256
22499
|
const prefix = y[31] % 2 === 0 ? 2 : 3;
|
|
@@ -22413,7 +22656,7 @@ async function signAndBroadcastEip712({
|
|
|
22413
22656
|
pubkey = await recoverPubkeyFromTypedDataSignature(typedData, signature);
|
|
22414
22657
|
if (cache) cache.pubkeyBase64 = pubkey;
|
|
22415
22658
|
}
|
|
22416
|
-
const sigBytes = (0,
|
|
22659
|
+
const sigBytes = (0, import_viem4.hexToBytes)(signature);
|
|
22417
22660
|
const sigWithoutRecovery = sigBytes.slice(0, 64);
|
|
22418
22661
|
const encodedMessages = msgs.map((msg2) => {
|
|
22419
22662
|
const encoder = MSG_ENCODERS[msg2.typeUrl];
|
|
@@ -22649,23 +22892,6 @@ function autoDetectSigner(input) {
|
|
|
22649
22892
|
);
|
|
22650
22893
|
}
|
|
22651
22894
|
|
|
22652
|
-
// src/core/address.ts
|
|
22653
|
-
function normalizeAddress(address) {
|
|
22654
|
-
if (isValidAultAddress(address)) {
|
|
22655
|
-
return address;
|
|
22656
|
-
}
|
|
22657
|
-
if (isValidEvmAddress(address)) {
|
|
22658
|
-
return evmToAult(address);
|
|
22659
|
-
}
|
|
22660
|
-
throw new Error(`Invalid address format: ${address}`);
|
|
22661
|
-
}
|
|
22662
|
-
function normalizeAddresses(addresses) {
|
|
22663
|
-
return addresses.map(normalizeAddress);
|
|
22664
|
-
}
|
|
22665
|
-
function toBigInt(value) {
|
|
22666
|
-
return typeof value === "bigint" ? value : BigInt(value);
|
|
22667
|
-
}
|
|
22668
|
-
|
|
22669
22895
|
// src/high-level/query-helpers.ts
|
|
22670
22896
|
var BATCH_SIZE = 50;
|
|
22671
22897
|
async function batchMap(items, fn) {
|
|
@@ -22755,6 +22981,43 @@ function createParallelQueryApi(lowLevel) {
|
|
|
22755
22981
|
};
|
|
22756
22982
|
}
|
|
22757
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
|
+
|
|
22758
23021
|
// src/high-level/tx/accountx.ts
|
|
22759
23022
|
function createAccountxTxApi({
|
|
22760
23023
|
signerAddress,
|
|
@@ -22878,6 +23141,7 @@ function createAuthorityTxApi({ signerAddress, exec }) {
|
|
|
22878
23141
|
|
|
22879
23142
|
// src/core/clob-msgs.ts
|
|
22880
23143
|
function buildLimitOrderMsg(sender, params) {
|
|
23144
|
+
if (params.cloid !== void 0) assertCloid(params.cloid);
|
|
22881
23145
|
return msg.clob.placeLimitOrder({
|
|
22882
23146
|
sender,
|
|
22883
23147
|
marketId: params.marketId,
|
|
@@ -22885,6 +23149,7 @@ function buildLimitOrderMsg(sender, params) {
|
|
|
22885
23149
|
price: params.price,
|
|
22886
23150
|
quantity: params.quantity,
|
|
22887
23151
|
deadline: params.deadline,
|
|
23152
|
+
...params.cloid !== void 0 && { cloid: params.cloid },
|
|
22888
23153
|
...params.postOnly !== void 0 && { postOnly: params.postOnly },
|
|
22889
23154
|
...params.builderAddress !== void 0 && {
|
|
22890
23155
|
builderAddress: normalizeAddress(params.builderAddress)
|
|
@@ -22893,11 +23158,13 @@ function buildLimitOrderMsg(sender, params) {
|
|
|
22893
23158
|
});
|
|
22894
23159
|
}
|
|
22895
23160
|
function buildMarketOrderMsg(sender, params) {
|
|
23161
|
+
if (params.cloid !== void 0) assertCloid(params.cloid);
|
|
22896
23162
|
return msg.clob.placeMarketOrder({
|
|
22897
23163
|
sender,
|
|
22898
23164
|
marketId: params.marketId,
|
|
22899
23165
|
isBuy: params.isBuy,
|
|
22900
23166
|
deposit: params.deposit,
|
|
23167
|
+
...params.cloid !== void 0 && { cloid: params.cloid },
|
|
22901
23168
|
...params.worstPrice !== void 0 && { worstPrice: params.worstPrice },
|
|
22902
23169
|
...params.priceTolerance !== void 0 && { priceTolerance: params.priceTolerance },
|
|
22903
23170
|
...params.builderAddress !== void 0 && {
|
|
@@ -22907,6 +23174,7 @@ function buildMarketOrderMsg(sender, params) {
|
|
|
22907
23174
|
});
|
|
22908
23175
|
}
|
|
22909
23176
|
function buildCancelOrdersMsg(sender, orderIds) {
|
|
23177
|
+
for (const ref of orderIds) assertOrderRef(ref);
|
|
22910
23178
|
return msg.clob.cancelOrders({ sender, orderIds });
|
|
22911
23179
|
}
|
|
22912
23180
|
function buildScaleOrderMsg(sender, params) {
|
|
@@ -22927,93 +23195,8 @@ function buildScaleOrderMsg(sender, params) {
|
|
|
22927
23195
|
});
|
|
22928
23196
|
}
|
|
22929
23197
|
|
|
22930
|
-
// src/utils/opaque-id.ts
|
|
22931
|
-
var import_viem4 = require("viem");
|
|
22932
|
-
function decodeHex(input) {
|
|
22933
|
-
const clean = input.startsWith("0x") || input.startsWith("0X") ? input.slice(2) : input;
|
|
22934
|
-
if (clean.length % 2 !== 0) {
|
|
22935
|
-
throw new Error(`invalid hex length: "${input}"`);
|
|
22936
|
-
}
|
|
22937
|
-
if (clean.length > 0 && !/^[0-9a-fA-F]+$/.test(clean)) {
|
|
22938
|
-
throw new Error(`invalid hex characters: "${input}"`);
|
|
22939
|
-
}
|
|
22940
|
-
return (0, import_viem4.hexToBytes)(`0x${clean}`);
|
|
22941
|
-
}
|
|
22942
|
-
function encodeHex(bytes) {
|
|
22943
|
-
return (0, import_viem4.bytesToHex)(bytes).slice(2);
|
|
22944
|
-
}
|
|
22945
|
-
function bytesEqual(a, b) {
|
|
22946
|
-
if (a.length !== b.length) return false;
|
|
22947
|
-
for (let i = 0; i < a.length; i++) {
|
|
22948
|
-
if (a[i] !== b[i]) return false;
|
|
22949
|
-
}
|
|
22950
|
-
return true;
|
|
22951
|
-
}
|
|
22952
|
-
var OpaqueId = class {
|
|
22953
|
-
constructor(bytes) {
|
|
22954
|
-
this.bytes = bytes;
|
|
22955
|
-
}
|
|
22956
|
-
toBytes() {
|
|
22957
|
-
return new Uint8Array(this.bytes);
|
|
22958
|
-
}
|
|
22959
|
-
toHex() {
|
|
22960
|
-
return encodeHex(this.bytes);
|
|
22961
|
-
}
|
|
22962
|
-
toBase64() {
|
|
22963
|
-
return bytesToBase64(this.bytes);
|
|
22964
|
-
}
|
|
22965
|
-
toString() {
|
|
22966
|
-
return this.toHex();
|
|
22967
|
-
}
|
|
22968
|
-
equalsBytes(other) {
|
|
22969
|
-
return bytesEqual(this.bytes, other.bytes);
|
|
22970
|
-
}
|
|
22971
|
-
};
|
|
22972
|
-
var MarketId = class _MarketId extends OpaqueId {
|
|
22973
|
-
static fromHex(hex) {
|
|
22974
|
-
return new _MarketId(_MarketId.assertNonEmpty(decodeHex(hex), `hex "${hex}"`));
|
|
22975
|
-
}
|
|
22976
|
-
static fromBase64(b64) {
|
|
22977
|
-
return new _MarketId(_MarketId.assertNonEmpty(base64ToBytes(b64), `base64 "${b64}"`));
|
|
22978
|
-
}
|
|
22979
|
-
static fromBytes(bytes) {
|
|
22980
|
-
return new _MarketId(_MarketId.assertNonEmpty(new Uint8Array(bytes), "bytes"));
|
|
22981
|
-
}
|
|
22982
|
-
static assertNonEmpty(bytes, source) {
|
|
22983
|
-
if (bytes.length === 0) {
|
|
22984
|
-
throw new Error(`MarketId: empty bytes from ${source}`);
|
|
22985
|
-
}
|
|
22986
|
-
return bytes;
|
|
22987
|
-
}
|
|
22988
|
-
equals(other) {
|
|
22989
|
-
return this.equalsBytes(other);
|
|
22990
|
-
}
|
|
22991
|
-
};
|
|
22992
|
-
var ORDER_ID_LENGTH = 16;
|
|
22993
|
-
var OrderId = class _OrderId extends OpaqueId {
|
|
22994
|
-
static fromHex(hex) {
|
|
22995
|
-
return new _OrderId(_OrderId.assertLength(decodeHex(hex), `hex "${hex}"`));
|
|
22996
|
-
}
|
|
22997
|
-
static fromBase64(b64) {
|
|
22998
|
-
return new _OrderId(_OrderId.assertLength(base64ToBytes(b64), `base64 "${b64}"`));
|
|
22999
|
-
}
|
|
23000
|
-
static fromBytes(bytes) {
|
|
23001
|
-
return new _OrderId(_OrderId.assertLength(new Uint8Array(bytes), "bytes"));
|
|
23002
|
-
}
|
|
23003
|
-
static assertLength(bytes, source) {
|
|
23004
|
-
if (bytes.length !== ORDER_ID_LENGTH) {
|
|
23005
|
-
throw new Error(
|
|
23006
|
-
`OrderId: expected ${ORDER_ID_LENGTH} bytes (chain layout), got ${bytes.length} from ${source}`
|
|
23007
|
-
);
|
|
23008
|
-
}
|
|
23009
|
-
return bytes;
|
|
23010
|
-
}
|
|
23011
|
-
equals(other) {
|
|
23012
|
-
return this.equalsBytes(other);
|
|
23013
|
-
}
|
|
23014
|
-
};
|
|
23015
|
-
|
|
23016
23198
|
// src/core/clob-responses.ts
|
|
23199
|
+
var import_encoding4 = require("@cosmjs/encoding");
|
|
23017
23200
|
async function withWaitDecode(wait, run, decode) {
|
|
23018
23201
|
const w = wait ?? false;
|
|
23019
23202
|
const res = await run(w);
|
|
@@ -23033,26 +23216,25 @@ function findResponse(msgResponses, typeUrl, txHash) {
|
|
|
23033
23216
|
function coinOrUndefined(coin) {
|
|
23034
23217
|
return coin && coin.denom !== "" ? coin : void 0;
|
|
23035
23218
|
}
|
|
23036
|
-
function
|
|
23037
|
-
|
|
23038
|
-
findResponse(msgResponses,
|
|
23039
|
-
|
|
23040
|
-
|
|
23041
|
-
|
|
23042
|
-
|
|
23043
|
-
|
|
23044
|
-
|
|
23045
|
-
}
|
|
23046
|
-
function decodeMarketOrderResult(msgResponses, base) {
|
|
23047
|
-
const decoded = MsgPlaceMarketOrderResponse.decode(
|
|
23048
|
-
findResponse(msgResponses, MARKET_RESPONSE_TYPE, base.txHash)
|
|
23049
|
-
);
|
|
23050
|
-
return {
|
|
23051
|
-
...base,
|
|
23052
|
-
orderId: OrderId.fromBytes(decoded.orderId).toHex(),
|
|
23053
|
-
...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
|
+
};
|
|
23054
23228
|
};
|
|
23055
23229
|
}
|
|
23230
|
+
var decodeLimitOrderResult = decodePlaceOrder(
|
|
23231
|
+
MsgPlaceLimitOrderResponse,
|
|
23232
|
+
LIMIT_RESPONSE_TYPE
|
|
23233
|
+
);
|
|
23234
|
+
var decodeMarketOrderResult = decodePlaceOrder(
|
|
23235
|
+
MsgPlaceMarketOrderResponse,
|
|
23236
|
+
MARKET_RESPONSE_TYPE
|
|
23237
|
+
);
|
|
23056
23238
|
function decodeScaleOrderResult(msgResponses, base) {
|
|
23057
23239
|
const decoded = MsgPlaceScaleOrderResponse.decode(
|
|
23058
23240
|
findResponse(msgResponses, SCALE_RESPONSE_TYPE, base.txHash)
|
|
@@ -23073,8 +23255,8 @@ function decodeCancelOrdersResult(msgResponses, base) {
|
|
|
23073
23255
|
);
|
|
23074
23256
|
return {
|
|
23075
23257
|
...base,
|
|
23076
|
-
succeeded: decoded.succeeded.map((id) =>
|
|
23077
|
-
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))
|
|
23078
23260
|
};
|
|
23079
23261
|
}
|
|
23080
23262
|
|
|
@@ -24421,7 +24603,7 @@ function createStaticResolver(optsOrNetwork, legacyManifest) {
|
|
|
24421
24603
|
// src/agent/attach.ts
|
|
24422
24604
|
var import_secp256k12 = require("@noble/curves/secp256k1");
|
|
24423
24605
|
var import_viem7 = require("viem");
|
|
24424
|
-
var
|
|
24606
|
+
var import_encoding5 = require("@cosmjs/encoding");
|
|
24425
24607
|
|
|
24426
24608
|
// src/agent/sign-and-broadcast.ts
|
|
24427
24609
|
var import_secp256k1 = require("@noble/curves/secp256k1");
|
|
@@ -24731,7 +24913,7 @@ function deriveAgentAddress(privateKeyHex) {
|
|
|
24731
24913
|
const uncompressedPubkey = import_secp256k12.secp256k1.getPublicKey(privKeyBytes, false);
|
|
24732
24914
|
const pubkeyHash = (0, import_viem7.hexToBytes)((0, import_viem7.keccak256)(uncompressedPubkey.slice(1)));
|
|
24733
24915
|
const evmAddressBytes = pubkeyHash.slice(12);
|
|
24734
|
-
const evmHex = `0x${(0,
|
|
24916
|
+
const evmHex = `0x${(0, import_encoding5.toHex)(evmAddressBytes)}`;
|
|
24735
24917
|
return evmToAult(evmHex);
|
|
24736
24918
|
}
|
|
24737
24919
|
function buildAgentSurface(options, ctx) {
|
|
@@ -24828,6 +25010,7 @@ async function buildClient(options, resolver) {
|
|
|
24828
25010
|
...createStakingTxApi(ctx),
|
|
24829
25011
|
...createTokenRegistryTxApi(ctx),
|
|
24830
25012
|
...createParallelQueryApi(lowLevel),
|
|
25013
|
+
...createCloidLookupApi(lowLevel),
|
|
24831
25014
|
// Agent surface — populated by attachAgent, cleared by detachAgent.
|
|
24832
25015
|
asAgent: null,
|
|
24833
25016
|
attachAgent(opts) {
|
|
@@ -25107,15 +25290,23 @@ var ListTradesResponseItem = zod.object({
|
|
|
25107
25290
|
symbol: zod.string(),
|
|
25108
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."),
|
|
25109
25292
|
side: zod.enum(["buy", "sell"]),
|
|
25110
|
-
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
|
+
),
|
|
25111
25296
|
price: zod.string().regex(listTradesResponsePriceRegExp),
|
|
25112
25297
|
amount: zod.string().regex(listTradesResponseAmountRegExp),
|
|
25113
25298
|
cost: zod.string().regex(listTradesResponseCostRegExp).describe("price * amount"),
|
|
25114
25299
|
fee: zod.object({
|
|
25115
|
-
cost: zod.string().regex(listTradesResponseFeeCostRegExp).optional().describe("Fee cost in
|
|
25116
|
-
currency: zod.string().optional().describe(
|
|
25117
|
-
|
|
25118
|
-
|
|
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
|
+
),
|
|
25119
25310
|
info: zod.object({
|
|
25120
25311
|
address: zod.string().regex(listTradesResponseInfoAddressOneRegExp).describe(
|
|
25121
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"
|
|
@@ -25201,6 +25392,7 @@ var GetStatsResponse = zod.object({
|
|
|
25201
25392
|
var listOrdersQueryAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
|
|
25202
25393
|
var listOrdersQueryAddressTwoRegExp = new RegExp("^0x[a-f0-9]{40}$");
|
|
25203
25394
|
var listOrdersQueryMarketIdRegExp = new RegExp("^[0-9a-fA-F]+$");
|
|
25395
|
+
var listOrdersQueryCloidRegExp = new RegExp("^([0-9a-fA-F]{16})?$");
|
|
25204
25396
|
var listOrdersQueryLimitDefault = 50;
|
|
25205
25397
|
var listOrdersQueryLimitMax = 200;
|
|
25206
25398
|
var ListOrdersQueryParams = zod.object({
|
|
@@ -25217,6 +25409,9 @@ var ListOrdersQueryParams = zod.object({
|
|
|
25217
25409
|
status: zod.enum(["open", "closed", "canceled"]).optional(),
|
|
25218
25410
|
symbol: zod.string().optional().describe("Symbol to filter by (e.g., AULT/USDT). Alternative to market_id."),
|
|
25219
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
|
+
),
|
|
25220
25415
|
since: zod.number().optional().describe("Return orders created after this Unix timestamp (milliseconds)"),
|
|
25221
25416
|
limit: zod.number().min(1).max(listOrdersQueryLimitMax).default(listOrdersQueryLimitDefault)
|
|
25222
25417
|
});
|
|
@@ -25231,7 +25426,9 @@ var listOrdersResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
|
25231
25426
|
var listOrdersResponseInfoRemainingDepositRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25232
25427
|
var ListOrdersResponseItem = zod.object({
|
|
25233
25428
|
id: zod.string(),
|
|
25234
|
-
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
|
+
),
|
|
25235
25432
|
timestamp: zod.number(),
|
|
25236
25433
|
datetime: zod.iso.datetime({}),
|
|
25237
25434
|
lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
|
|
@@ -25295,7 +25492,9 @@ var getOrderResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
|
|
|
25295
25492
|
var getOrderResponseInfoRemainingDepositRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
|
|
25296
25493
|
var GetOrderResponse = zod.object({
|
|
25297
25494
|
id: zod.string(),
|
|
25298
|
-
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
|
+
),
|
|
25299
25498
|
timestamp: zod.number(),
|
|
25300
25499
|
datetime: zod.iso.datetime({}),
|
|
25301
25500
|
lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
|
|
@@ -25367,15 +25566,23 @@ var ListMyTradesResponseItem = zod.object({
|
|
|
25367
25566
|
symbol: zod.string(),
|
|
25368
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."),
|
|
25369
25568
|
side: zod.enum(["buy", "sell"]),
|
|
25370
|
-
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
|
+
),
|
|
25371
25572
|
price: zod.string().regex(listMyTradesResponsePriceRegExp),
|
|
25372
25573
|
amount: zod.string().regex(listMyTradesResponseAmountRegExp),
|
|
25373
25574
|
cost: zod.string().regex(listMyTradesResponseCostRegExp).describe("price * amount"),
|
|
25374
25575
|
fee: zod.object({
|
|
25375
|
-
cost: zod.string().regex(listMyTradesResponseFeeCostRegExp).optional().describe("Fee cost in
|
|
25376
|
-
currency: zod.string().optional().describe(
|
|
25377
|
-
|
|
25378
|
-
|
|
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
|
+
),
|
|
25379
25586
|
info: zod.object({
|
|
25380
25587
|
address: zod.string().regex(listMyTradesResponseInfoAddressOneRegExp).describe(
|
|
25381
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"
|
|
@@ -25574,7 +25781,7 @@ function createDexWs(url, options) {
|
|
|
25574
25781
|
}
|
|
25575
25782
|
|
|
25576
25783
|
// src/index.ts
|
|
25577
|
-
var SDK_VERSION = "0.0.2-alpha.
|
|
25784
|
+
var SDK_VERSION = "0.0.2-alpha.27";
|
|
25578
25785
|
// Annotate the CommonJS export names for ESM import in node:
|
|
25579
25786
|
0 && (module.exports = {
|
|
25580
25787
|
AGENT_DEFAULTS,
|
|
@@ -25648,6 +25855,7 @@ var SDK_VERSION = "0.0.2-alpha.26";
|
|
|
25648
25855
|
MissingMsgResponseError,
|
|
25649
25856
|
NETWORKS,
|
|
25650
25857
|
NetworkError,
|
|
25858
|
+
ORDER_ID_LENGTH,
|
|
25651
25859
|
OrderId,
|
|
25652
25860
|
PageResponseSchema,
|
|
25653
25861
|
REST_CONTEXT_BRAND,
|
|
@@ -25789,6 +25997,7 @@ var SDK_VERSION = "0.0.2-alpha.26";
|
|
|
25789
25997
|
listMyTradesResponsePriceRegExp,
|
|
25790
25998
|
listOrdersQueryAddressOneRegExp,
|
|
25791
25999
|
listOrdersQueryAddressTwoRegExp,
|
|
26000
|
+
listOrdersQueryCloidRegExp,
|
|
25792
26001
|
listOrdersQueryLimitDefault,
|
|
25793
26002
|
listOrdersQueryLimitMax,
|
|
25794
26003
|
listOrdersQueryMarketIdRegExp,
|