ault-sdk-ts 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -145,6 +145,14 @@ var TxError = class extends Error {
145
145
  this.confirmed = params.confirmed;
146
146
  }
147
147
  };
148
+ var TxSimulationError = class extends Error {
149
+ constructor(params) {
150
+ super(`Transaction simulation failed: ${params.rawLog}`);
151
+ this.name = "TxSimulationError";
152
+ this.chainCode = params.chainCode;
153
+ this.rawLog = params.rawLog;
154
+ }
155
+ };
148
156
  var TxNotConfirmedError = class extends TxError {
149
157
  constructor(params) {
150
158
  super(
@@ -191,13 +199,14 @@ var WithdrawRewardsPartialError = class extends Error {
191
199
  };
192
200
 
193
201
  // src/core/http.ts
202
+ var DEFAULT_RETRYABLE_STATUSES = [408, 429, 500, 502, 503, 504];
194
203
  var DEFAULT_OPTIONS = {
195
204
  timeout: 3e4,
196
205
  retries: 3,
197
206
  retryDelay: 1e3,
198
207
  exponentialBackoff: true,
199
208
  retryableMethods: ["GET", "HEAD", "OPTIONS"],
200
- retryableStatuses: [408, 429, 500, 502, 503, 504],
209
+ retryableStatuses: [...DEFAULT_RETRYABLE_STATUSES],
201
210
  retryOnTimeout: false
202
211
  };
203
212
  function ensureFetch(fetchFn) {
@@ -436,6 +445,8 @@ var GAS_CONSTANTS = {
436
445
  DENOM: "aault",
437
446
  /** Chain multiplier applied to min gas to derive max gas (120 = 1.2×). */
438
447
  FEE_FREE_GAS_MULTIPLIER: 120,
448
+ /** Headroom over simulated `gas_used` (130 = 1.3×). */
449
+ SIMULATED_GAS_MULTIPLIER: 130,
439
450
  // License module
440
451
  PER_LICENSE: 2e5,
441
452
  PER_KYC_MEMBER: 2e5,
@@ -466,11 +477,19 @@ var GAS_CONSTANTS = {
466
477
  // Accountx module
467
478
  OPEN_ACCOUNT: 96e3,
468
479
  // Staking module (cosmos-sdk standard, NOT fee-free — user pays gas).
480
+ // Staking gas depends on the delegator's state, so the builders simulate;
481
+ // these are the fallback (×FEE_FREE_GAS_MULTIPLIER) when simulate is down.
469
482
  DELEGATE: 22e4,
470
- UNDELEGATE: 22e4,
471
- BEGIN_REDELEGATE: 28e4,
483
+ UNDELEGATE: 26e4,
484
+ BEGIN_REDELEGATE: 4e5,
472
485
  WITHDRAW_DELEGATOR_REWARD: 22e4
473
486
  };
487
+ function computeSimulatedGas(gasUsed, multiplier = GAS_CONSTANTS.SIMULATED_GAS_MULTIPLIER) {
488
+ if (!Number.isInteger(multiplier) || multiplier < 100) {
489
+ throw new Error(`simulated gas multiplier must be an integer >= 100, got ${multiplier}`);
490
+ }
491
+ return (gasUsed * BigInt(multiplier) / 100n).toString();
492
+ }
474
493
  function computeFeeFreeGas(minGasPerOp, count, multiplier = GAS_CONSTANTS.FEE_FREE_GAS_MULTIPLIER) {
475
494
  return (BigInt(minGasPerOp) * BigInt(count) * BigInt(multiplier) / 100n).toString();
476
495
  }
@@ -11402,9 +11421,10 @@ async function dexFetch(url, init) {
11402
11421
  // src/rest/dex.generated.ts
11403
11422
  var dex_generated_exports = {};
11404
11423
  __export(dex_generated_exports, {
11424
+ DBReadyResponseDatabase: () => DBReadyResponseDatabase,
11425
+ DBReadyResponseStatus: () => DBReadyResponseStatus,
11405
11426
  GetStatsWindow: () => GetStatsWindow,
11406
11427
  GetUDFHistoryResolution: () => GetUDFHistoryResolution,
11407
- HealthResponseDatabase: () => HealthResponseDatabase,
11408
11428
  HealthResponseStatus: () => HealthResponseStatus,
11409
11429
  ListOrdersStatus: () => ListOrdersStatus,
11410
11430
  LiveResponseStatus: () => LiveResponseStatus,
@@ -11413,6 +11433,7 @@ __export(dex_generated_exports, {
11413
11433
  OrderInfoChainType: () => OrderInfoChainType,
11414
11434
  OrderResponseSide: () => OrderResponseSide,
11415
11435
  OrderResponseStatus: () => OrderResponseStatus,
11436
+ OrderResponseTimeInForce: () => OrderResponseTimeInForce,
11416
11437
  OrderResponseType: () => OrderResponseType,
11417
11438
  RangeQueryDayParameter: () => RangeQueryDayParameter,
11418
11439
  RangeQueryParameter: () => RangeQueryParameter,
@@ -11427,8 +11448,10 @@ __export(dex_generated_exports, {
11427
11448
  UDFSymbolInfoDataStatus: () => UDFSymbolInfoDataStatus,
11428
11449
  getAllTickers: () => getAllTickers,
11429
11450
  getBalance: () => getBalance,
11451
+ getDBReady: () => getDBReady,
11430
11452
  getGetAllTickersUrl: () => getGetAllTickersUrl,
11431
11453
  getGetBalanceUrl: () => getGetBalanceUrl,
11454
+ getGetDBReadyUrl: () => getGetDBReadyUrl,
11432
11455
  getGetHealthUrl: () => getGetHealthUrl,
11433
11456
  getGetLiveUrl: () => getGetLiveUrl,
11434
11457
  getGetOHLCVUrl: () => getGetOHLCVUrl,
@@ -11498,16 +11521,18 @@ var OrderInfoChainType = {
11498
11521
  unknown: "unknown"
11499
11522
  };
11500
11523
  var HealthResponseStatus = {
11501
- healthy: "healthy",
11502
- unhealthy: "unhealthy"
11524
+ healthy: "healthy"
11525
+ };
11526
+ var ReadyResponseStatus = {
11527
+ ready: "ready"
11503
11528
  };
11504
- var HealthResponseDatabase = {
11529
+ var DBReadyResponseStatus = {
11505
11530
  ok: "ok",
11506
- unreachable: "unreachable"
11531
+ unavailable: "unavailable"
11507
11532
  };
11508
- var ReadyResponseStatus = {
11509
- ready: "ready",
11510
- not_ready: "not ready"
11533
+ var DBReadyResponseDatabase = {
11534
+ ok: "ok",
11535
+ unreachable: "unreachable"
11511
11536
  };
11512
11537
  var LiveResponseStatus = {
11513
11538
  alive: "alive"
@@ -11516,7 +11541,10 @@ var MarketResponseType = {
11516
11541
  spot: "spot"
11517
11542
  };
11518
11543
  var StatsResponseWindow = {
11519
- "24h": "24h"
11544
+ "24h": "24h",
11545
+ "7d": "7d",
11546
+ "30d": "30d",
11547
+ all: "all"
11520
11548
  };
11521
11549
  var TradeResponseType = {
11522
11550
  limit: "limit",
@@ -11544,6 +11572,9 @@ var OrderResponseType = {
11544
11572
  twap: "twap",
11545
11573
  unknown: "unknown"
11546
11574
  };
11575
+ var OrderResponseTimeInForce = {
11576
+ ioc: "ioc"
11577
+ };
11547
11578
  var OrderResponseSide = {
11548
11579
  buy: "buy",
11549
11580
  sell: "sell"
@@ -11580,7 +11611,10 @@ var RangeQueryDayParameter = {
11580
11611
  allTime: "allTime"
11581
11612
  };
11582
11613
  var GetStatsWindow = {
11583
- "24h": "24h"
11614
+ "24h": "24h",
11615
+ "7d": "7d",
11616
+ "30d": "30d",
11617
+ all: "all"
11584
11618
  };
11585
11619
  var ListOrdersStatus = {
11586
11620
  open: "open",
@@ -11624,6 +11658,15 @@ var getLive = async (options) => {
11624
11658
  method: "GET"
11625
11659
  });
11626
11660
  };
11661
+ var getGetDBReadyUrl = () => {
11662
+ return `/db-ready`;
11663
+ };
11664
+ var getDBReady = async (options) => {
11665
+ return dexFetch(getGetDBReadyUrl(), {
11666
+ ...options,
11667
+ method: "GET"
11668
+ });
11669
+ };
11627
11670
  var getGetStatusUrl = () => {
11628
11671
  return `/api/v1/status`;
11629
11672
  };
@@ -12008,7 +12051,9 @@ function createDexApi(context) {
12008
12051
  getUDFHistory: bind(context, getUDFHistory),
12009
12052
  getUDFQuotes: bind(context, getUDFQuotes),
12010
12053
  getUDFMarks: bind(context, getUDFMarks),
12011
- getUDFTimescaleMarks: bind(context, getUDFTimescaleMarks)
12054
+ getUDFTimescaleMarks: bind(context, getUDFTimescaleMarks),
12055
+ getOpenAPISpec: bind(context, getOpenAPISpec),
12056
+ getDBReady: bind(context, getDBReady)
12012
12057
  };
12013
12058
  }
12014
12059
 
@@ -15403,446 +15448,199 @@ function buildEip712TypedData(context, msgs, evmChainId) {
15403
15448
  };
15404
15449
  }
15405
15450
 
15406
- // src/rest/feemarket.ts
15407
- async function fetchFeeMarketParams(network, fetchFn, fetchOptions) {
15408
- const data = await fetchJson(
15409
- `${network.restUrl}/cosmos/evm/feemarket/v1/params`,
15410
- {},
15411
- fetchOptions,
15412
- fetchFn
15413
- );
15414
- const raw = data.params ?? {};
15415
- return {
15416
- noBaseFee: raw.noBaseFee ?? raw.no_base_fee ?? false,
15417
- baseFee: raw.baseFee ?? raw.base_fee ?? "0",
15418
- minGasPrice: raw.minGasPrice ?? raw.min_gas_price ?? "0"
15419
- };
15420
- }
15421
- var ONE_E18 = 1000000000000000000n;
15422
- var DEFAULT_FEE_MARGIN_PERCENT = 20;
15423
- function marginFactorScaled(marginPercent) {
15424
- if (!Number.isFinite(marginPercent) || !Number.isInteger(marginPercent)) {
15425
- throw new Error(`marginPercent must be a non-negative integer, got ${marginPercent}`);
15451
+ // src/proto/tx-encode.ts
15452
+ var WIRE_VARINT = 0;
15453
+ var WIRE_LENGTH_DELIMITED = 2;
15454
+ var BinaryWriter35 = class {
15455
+ constructor() {
15456
+ this.chunks = [];
15426
15457
  }
15427
- if (marginPercent < 0) {
15428
- throw new Error(`marginPercent must be >= 0, got ${marginPercent}`);
15458
+ writeVarint(value) {
15459
+ let v = BigInt(value);
15460
+ const bytes = [];
15461
+ do {
15462
+ let byte = Number(v & 0x7fn);
15463
+ v >>= 7n;
15464
+ if (v > 0n) byte |= 128;
15465
+ bytes.push(byte);
15466
+ } while (v > 0n);
15467
+ this.chunks.push(new Uint8Array(bytes));
15468
+ return this;
15429
15469
  }
15430
- return BigInt(100 + marginPercent);
15431
- }
15432
- function computeRequiredFee(params, gas, options) {
15433
- const margin = marginFactorScaled(options?.marginPercent ?? DEFAULT_FEE_MARGIN_PERCENT);
15434
- const minGasPriceI = BigInt(cosmosDecToProtoInt(params.minGasPrice || "0"));
15435
- const baseFeeI = params.noBaseFee ? 0n : BigInt(cosmosDecToProtoInt(params.baseFee || "0"));
15436
- const effectiveI = baseFeeI > minGasPriceI ? baseFeeI : minGasPriceI;
15437
- if (effectiveI <= 0n) return "0";
15438
- const gasI = BigInt(gas);
15439
- if (gasI <= 0n) return "0";
15440
- const numerator = effectiveI * gasI * margin;
15441
- const denominator = ONE_E18 * 100n;
15442
- return ((numerator + denominator - 1n) / denominator).toString();
15443
- }
15444
- var DEFAULT_FEE_MARKET_TTL_MS = 3e3;
15445
- function createFeeMarketCache(ttlMs = DEFAULT_FEE_MARKET_TTL_MS) {
15446
- return { ttlMs, entries: /* @__PURE__ */ new Map() };
15447
- }
15448
- async function getCachedFeeMarketParams(cache, network, fetchFn, fetchOptions) {
15449
- const key = network.chainId;
15450
- const now = Date.now();
15451
- if (cache) {
15452
- const existing = cache.entries.get(key);
15453
- if (existing && now - existing.fetchedAt < cache.ttlMs) {
15454
- return existing.params;
15470
+ writeTag(fieldNumber, wireType) {
15471
+ return this.writeVarint(fieldNumber << 3 | wireType);
15472
+ }
15473
+ writeString(fieldNumber, value) {
15474
+ if (!value) return this;
15475
+ this.writeTag(fieldNumber, WIRE_LENGTH_DELIMITED);
15476
+ const bytes = new TextEncoder().encode(value);
15477
+ this.writeVarint(bytes.length);
15478
+ this.chunks.push(bytes);
15479
+ return this;
15480
+ }
15481
+ writeBool(fieldNumber, value) {
15482
+ if (!value) return this;
15483
+ this.writeTag(fieldNumber, WIRE_VARINT);
15484
+ this.writeVarint(value ? 1 : 0);
15485
+ return this;
15486
+ }
15487
+ writeUint64(fieldNumber, value) {
15488
+ const v = BigInt(value);
15489
+ if (v === 0n) return this;
15490
+ this.writeTag(fieldNumber, WIRE_VARINT);
15491
+ this.writeVarint(v);
15492
+ return this;
15493
+ }
15494
+ writeInt32(fieldNumber, value) {
15495
+ if (value === 0) return this;
15496
+ this.writeTag(fieldNumber, WIRE_VARINT);
15497
+ this.writeVarint(value);
15498
+ return this;
15499
+ }
15500
+ writeBytes(fieldNumber, value) {
15501
+ if (value.length === 0) return this;
15502
+ this.writeTag(fieldNumber, WIRE_LENGTH_DELIMITED);
15503
+ this.writeVarint(value.length);
15504
+ this.chunks.push(value);
15505
+ return this;
15506
+ }
15507
+ writeRepeatedString(fieldNumber, values) {
15508
+ for (const value of values) {
15509
+ this.writeString(fieldNumber, value);
15455
15510
  }
15511
+ return this;
15456
15512
  }
15457
- let params;
15458
- try {
15459
- params = await fetchFeeMarketParams(network, fetchFn, fetchOptions);
15460
- } catch (error) {
15461
- if (!isGatewayUnsupportedError(error)) throw error;
15462
- params = null;
15513
+ writeRepeatedUint64(fieldNumber, values) {
15514
+ for (const value of values) {
15515
+ this.writeTag(fieldNumber, WIRE_VARINT);
15516
+ this.writeVarint(BigInt(value));
15517
+ }
15518
+ return this;
15463
15519
  }
15464
- if (cache) {
15465
- cache.entries.set(key, { params, fetchedAt: now });
15520
+ writeRepeatedBytes(fieldNumber, values) {
15521
+ for (const value of values) {
15522
+ this.writeBytes(fieldNumber, value);
15523
+ }
15524
+ return this;
15466
15525
  }
15467
- return params;
15526
+ finish() {
15527
+ const total = this.chunks.reduce((sum, chunk) => sum + chunk.length, 0);
15528
+ const result = new Uint8Array(total);
15529
+ let offset = 0;
15530
+ for (const chunk of this.chunks) {
15531
+ result.set(chunk, offset);
15532
+ offset += chunk.length;
15533
+ }
15534
+ return result;
15535
+ }
15536
+ };
15537
+ function encodeAny(typeUrl, value) {
15538
+ const writer = new BinaryWriter35();
15539
+ writer.writeString(1, typeUrl);
15540
+ writer.writeBytes(2, value);
15541
+ return writer.finish();
15468
15542
  }
15469
- function isGatewayUnsupportedError(error) {
15470
- return error instanceof ApiError && (error.status === 404 || error.status === 501);
15543
+ function encodeCoin(denom, amount) {
15544
+ const writer = new BinaryWriter35();
15545
+ writer.writeString(1, denom);
15546
+ writer.writeString(2, amount);
15547
+ return writer.finish();
15471
15548
  }
15472
- function computeEvmFeesPerGas(params, options) {
15473
- const margin = marginFactorScaled(options?.marginPercent ?? DEFAULT_FEE_MARGIN_PERCENT);
15474
- const minGasPriceI = BigInt(cosmosDecToProtoInt(params.minGasPrice || "0"));
15475
- const baseFeeI = params.noBaseFee ? 0n : BigInt(cosmosDecToProtoInt(params.baseFee || "0"));
15476
- const effectiveI = baseFeeI > minGasPriceI ? baseFeeI : minGasPriceI;
15477
- if (effectiveI <= 0n) {
15478
- return { maxFeePerGas: 0n, maxPriorityFeePerGas: 0n };
15549
+ function encodeFee(fee) {
15550
+ const writer = new BinaryWriter35();
15551
+ for (const coin of fee.amount) {
15552
+ const coinBytes = encodeCoin(coin.denom, coin.amount);
15553
+ writer.writeBytes(1, coinBytes);
15479
15554
  }
15480
- const numerator = effectiveI * margin;
15481
- const denominator = ONE_E18 * 100n;
15482
- const gasPriceWei = (numerator + denominator - 1n) / denominator;
15483
- return { maxFeePerGas: gasPriceWei, maxPriorityFeePerGas: gasPriceWei };
15555
+ writer.writeUint64(2, fee.gasLimit);
15556
+ return writer.finish();
15484
15557
  }
15485
- async function resolveEvmFeesPerGas(network, options) {
15486
- const params = await getCachedFeeMarketParams(
15487
- options?.cache,
15488
- network,
15489
- options?.fetchFn,
15490
- options?.fetchOptions
15491
- );
15492
- if (!params) return null;
15493
- let fees;
15494
- try {
15495
- fees = computeEvmFeesPerGas(params, { marginPercent: options?.marginPercent });
15496
- } catch {
15497
- return null;
15498
- }
15499
- if (fees.maxFeePerGas === 0n && fees.maxPriorityFeePerGas === 0n) return null;
15500
- return fees;
15558
+ function encodeModeInfoSingle(mode) {
15559
+ const writer = new BinaryWriter35();
15560
+ writer.writeInt32(1, mode);
15561
+ return writer.finish();
15501
15562
  }
15502
-
15503
- // src/eip712/signers.ts
15504
- import { privateKeyToAccount } from "viem/accounts";
15505
- var AULT_SIGNER_MARKER = /* @__PURE__ */ Symbol.for("ault-sdk:signer");
15506
- function isAultSigner(obj) {
15507
- return typeof obj === "object" && obj !== null && AULT_SIGNER_MARKER in obj && obj[AULT_SIGNER_MARKER] === true;
15563
+ function encodeModeInfo(mode) {
15564
+ const writer = new BinaryWriter35();
15565
+ const singleBytes = encodeModeInfoSingle(mode);
15566
+ writer.writeBytes(1, singleBytes);
15567
+ return writer.finish();
15508
15568
  }
15509
- function normalizeSigner(input) {
15510
- if (!input) return null;
15511
- if (typeof input === "function") {
15512
- return { signTypedData: input };
15513
- }
15514
- if (typeof input === "object" && typeof input.signTypedData === "function") {
15515
- return input;
15569
+ function encodeSignerInfo(info) {
15570
+ const writer = new BinaryWriter35();
15571
+ const pubKeyAny = encodeAny(info.publicKey.typeUrl, info.publicKey.value);
15572
+ writer.writeBytes(1, pubKeyAny);
15573
+ const modeInfoBytes = encodeModeInfo(info.mode);
15574
+ writer.writeBytes(2, modeInfoBytes);
15575
+ writer.writeUint64(3, typeof info.sequence === "string" ? BigInt(info.sequence) : info.sequence);
15576
+ return writer.finish();
15577
+ }
15578
+ function encodeAuthInfo(authInfo) {
15579
+ const writer = new BinaryWriter35();
15580
+ for (const signerInfo of authInfo.signerInfos) {
15581
+ writer.writeBytes(1, encodeSignerInfo(signerInfo));
15516
15582
  }
15517
- throw new Error("Invalid signer: expected a signer object or signTypedData function.");
15583
+ writer.writeBytes(2, encodeFee(authInfo.fee));
15584
+ return writer.finish();
15518
15585
  }
15519
- function normalizeSignature(result) {
15520
- if (typeof result === "string") {
15521
- return result;
15586
+ function encodeTxBody(body) {
15587
+ const writer = new BinaryWriter35();
15588
+ for (const msg2 of body.messages) {
15589
+ writer.writeBytes(1, encodeAny(msg2.typeUrl, msg2.value));
15522
15590
  }
15523
- if (result && typeof result.signature === "string") {
15524
- return result.signature;
15591
+ if (body.memo) {
15592
+ writer.writeString(2, body.memo);
15525
15593
  }
15526
- throw new Error("Invalid signature response: expected hex string or { signature }.");
15527
- }
15528
- async function getSignerAddress(signer) {
15529
- if (typeof signer.address === "string") {
15530
- return signer.address;
15594
+ if (body.timeoutHeight) {
15595
+ writer.writeUint64(3, body.timeoutHeight);
15531
15596
  }
15532
- if (typeof signer.getAddress === "function") {
15533
- const address = await signer.getAddress();
15534
- return typeof address === "string" ? address : null;
15535
- }
15536
- return null;
15537
- }
15538
- async function resolveSignerAddress(signer, signerAddress) {
15539
- const raw = signerAddress ?? (signer ? await getSignerAddress(signer) : null);
15540
- if (!raw) {
15541
- throw new Error("signerAddress is required when the signer has no address.");
15542
- }
15543
- if (isValidAultAddress(raw)) {
15544
- return raw;
15545
- }
15546
- if (isValidEvmAddress(raw)) {
15547
- return evmToAult(raw);
15548
- }
15549
- throw new Error(`Invalid signerAddress: ${raw}`);
15550
- }
15551
- function stripEip712Domain(types) {
15552
- const { EIP712Domain: _removed, ...rest } = types;
15553
- return rest;
15554
- }
15555
- function createEip1193Signer(options) {
15556
- const method = options.method ?? "eth_signTypedData_v4";
15557
- return {
15558
- [AULT_SIGNER_MARKER]: true,
15559
- address: options.address,
15560
- signTypedData: async (typedData) => {
15561
- const payload = method === "eth_signTypedData_v4" ? JSON.stringify(typedData) : typedData;
15562
- const signature = await options.provider.request({
15563
- method,
15564
- params: [options.address, payload]
15565
- });
15566
- if (typeof signature !== "string") {
15567
- throw new Error("Provider did not return a signature string.");
15568
- }
15569
- return { signature };
15570
- }
15571
- };
15572
- }
15573
- function createViemSigner(wallet, options) {
15574
- const preferRpc = options?.preferRpc ?? true;
15575
- const getAddress3 = async () => {
15576
- if (wallet.address) return wallet.address;
15577
- if (wallet.getAddresses) {
15578
- const addresses = await wallet.getAddresses();
15579
- if (addresses?.length) return addresses[0];
15580
- }
15581
- return void 0;
15582
- };
15583
- return {
15584
- [AULT_SIGNER_MARKER]: true,
15585
- getAddress: async () => {
15586
- const addr = await getAddress3();
15587
- if (!addr) throw new Error("Viem wallet has no address");
15588
- return addr;
15589
- },
15590
- signTypedData: async (typedData) => {
15591
- if (preferRpc && wallet.request) {
15592
- const address = await getAddress3();
15593
- if (!address) {
15594
- throw new Error("Viem wallet has no address; pass signerAddress explicitly.");
15595
- }
15596
- const signature2 = await wallet.request({
15597
- method: "eth_signTypedData_v4",
15598
- params: [address, JSON.stringify(typedData)]
15599
- });
15600
- if (typeof signature2 !== "string") {
15601
- throw new Error("RPC signer did not return a signature string.");
15602
- }
15603
- return { signature: signature2 };
15604
- }
15605
- if (!wallet.signTypedData) {
15606
- throw new Error("Viem signer does not support signTypedData.");
15607
- }
15608
- const signature = await wallet.signTypedData({
15609
- domain: typedData.domain,
15610
- types: typedData.types,
15611
- primaryType: typedData.primaryType,
15612
- message: typedData.message
15613
- });
15614
- return { signature };
15615
- }
15616
- };
15617
- }
15618
- function createEthersSigner(signer) {
15619
- const sign = signer.signTypedData ?? signer._signTypedData;
15620
- if (!sign) {
15621
- throw new Error("Ethers signer must implement signTypedData or _signTypedData.");
15622
- }
15623
- return {
15624
- [AULT_SIGNER_MARKER]: true,
15625
- getAddress: () => signer.getAddress(),
15626
- signTypedData: async (typedData) => {
15627
- const types = stripEip712Domain(typedData.types);
15628
- const signature = await sign(typedData.domain, types, typedData.message);
15629
- return { signature };
15630
- }
15631
- };
15632
- }
15633
- function createPrivySigner(options) {
15634
- return {
15635
- [AULT_SIGNER_MARKER]: true,
15636
- address: options.address,
15637
- signTypedData: (typedData) => options.signTypedData(typedData, options.address ? { address: options.address } : void 0)
15638
- };
15639
- }
15640
- function createPrivateKeySigner(privateKey) {
15641
- const normalized = privateKey.startsWith("0x") ? privateKey : `0x${privateKey}`;
15642
- const account = privateKeyToAccount(normalized);
15643
- return createViemSigner(account);
15644
- }
15645
-
15646
- // src/utils/tx-hash.ts
15647
- function normalizeTxHash(raw) {
15648
- if (!raw) return raw;
15649
- const stripped = raw.startsWith("0x") || raw.startsWith("0X") ? raw.slice(2) : raw;
15650
- return stripped.toLowerCase();
15597
+ return writer.finish();
15651
15598
  }
15652
-
15653
- // src/proto/tx-encode.ts
15654
- var WIRE_VARINT = 0;
15655
- var WIRE_LENGTH_DELIMITED = 2;
15656
- var BinaryWriter35 = class {
15657
- constructor() {
15658
- this.chunks = [];
15659
- }
15660
- writeVarint(value) {
15661
- let v = BigInt(value);
15662
- const bytes = [];
15663
- do {
15664
- let byte = Number(v & 0x7fn);
15665
- v >>= 7n;
15666
- if (v > 0n) byte |= 128;
15667
- bytes.push(byte);
15668
- } while (v > 0n);
15669
- this.chunks.push(new Uint8Array(bytes));
15670
- return this;
15671
- }
15672
- writeTag(fieldNumber, wireType) {
15673
- return this.writeVarint(fieldNumber << 3 | wireType);
15674
- }
15675
- writeString(fieldNumber, value) {
15676
- if (!value) return this;
15677
- this.writeTag(fieldNumber, WIRE_LENGTH_DELIMITED);
15678
- const bytes = new TextEncoder().encode(value);
15679
- this.writeVarint(bytes.length);
15680
- this.chunks.push(bytes);
15681
- return this;
15682
- }
15683
- writeBool(fieldNumber, value) {
15684
- if (!value) return this;
15685
- this.writeTag(fieldNumber, WIRE_VARINT);
15686
- this.writeVarint(value ? 1 : 0);
15687
- return this;
15688
- }
15689
- writeUint64(fieldNumber, value) {
15690
- const v = BigInt(value);
15691
- if (v === 0n) return this;
15692
- this.writeTag(fieldNumber, WIRE_VARINT);
15693
- this.writeVarint(v);
15694
- return this;
15695
- }
15696
- writeInt32(fieldNumber, value) {
15697
- if (value === 0) return this;
15698
- this.writeTag(fieldNumber, WIRE_VARINT);
15699
- this.writeVarint(value);
15700
- return this;
15701
- }
15702
- writeBytes(fieldNumber, value) {
15703
- if (value.length === 0) return this;
15704
- this.writeTag(fieldNumber, WIRE_LENGTH_DELIMITED);
15705
- this.writeVarint(value.length);
15706
- this.chunks.push(value);
15707
- return this;
15708
- }
15709
- writeRepeatedString(fieldNumber, values) {
15710
- for (const value of values) {
15711
- this.writeString(fieldNumber, value);
15712
- }
15713
- return this;
15714
- }
15715
- writeRepeatedUint64(fieldNumber, values) {
15716
- for (const value of values) {
15717
- this.writeTag(fieldNumber, WIRE_VARINT);
15718
- this.writeVarint(BigInt(value));
15719
- }
15720
- return this;
15721
- }
15722
- writeRepeatedBytes(fieldNumber, values) {
15723
- for (const value of values) {
15724
- this.writeBytes(fieldNumber, value);
15725
- }
15726
- return this;
15727
- }
15728
- finish() {
15729
- const total = this.chunks.reduce((sum, chunk) => sum + chunk.length, 0);
15730
- const result = new Uint8Array(total);
15731
- let offset = 0;
15732
- for (const chunk of this.chunks) {
15733
- result.set(chunk, offset);
15734
- offset += chunk.length;
15735
- }
15736
- return result;
15737
- }
15738
- };
15739
- function encodeAny(typeUrl, value) {
15599
+ function encodeTxRaw(txRaw) {
15740
15600
  const writer = new BinaryWriter35();
15741
- writer.writeString(1, typeUrl);
15742
- writer.writeBytes(2, value);
15601
+ writer.writeBytes(1, txRaw.bodyBytes);
15602
+ writer.writeBytes(2, txRaw.authInfoBytes);
15603
+ writer.writeRepeatedBytes(3, txRaw.signatures);
15743
15604
  return writer.finish();
15744
15605
  }
15745
- function encodeCoin(denom, amount) {
15606
+ function encodeEthSecp256k1PubKey(key) {
15746
15607
  const writer = new BinaryWriter35();
15747
- writer.writeString(1, denom);
15748
- writer.writeString(2, amount);
15608
+ writer.writeBytes(1, key);
15749
15609
  return writer.finish();
15750
15610
  }
15751
- function encodeFee(fee) {
15611
+ var SIGN_MODE_LEGACY_AMINO_JSON = 127;
15612
+ var SIGN_MODE_DIRECT = 1;
15613
+ function encodeTimestamp(seconds, nanos) {
15752
15614
  const writer = new BinaryWriter35();
15753
- for (const coin of fee.amount) {
15754
- const coinBytes = encodeCoin(coin.denom, coin.amount);
15755
- writer.writeBytes(1, coinBytes);
15756
- }
15757
- writer.writeUint64(2, fee.gasLimit);
15615
+ writer.writeUint64(1, seconds);
15616
+ writer.writeInt32(2, nanos);
15758
15617
  return writer.finish();
15759
15618
  }
15760
- function encodeModeInfoSingle(mode) {
15619
+ function encodeTxBodyAgent(body) {
15761
15620
  const writer = new BinaryWriter35();
15762
- writer.writeInt32(1, mode);
15621
+ for (const msg2 of body.messages) {
15622
+ writer.writeBytes(1, encodeAny(msg2.typeUrl, msg2.value));
15623
+ }
15624
+ if (body.memo) {
15625
+ writer.writeString(2, body.memo);
15626
+ }
15627
+ if (body.timeoutHeight) {
15628
+ writer.writeUint64(3, body.timeoutHeight);
15629
+ }
15630
+ writer.writeBool(4, body.unordered);
15631
+ const tsBytes = encodeTimestamp(body.timeoutTimestamp.seconds, body.timeoutTimestamp.nanos);
15632
+ writer.writeBytes(5, tsBytes);
15633
+ for (const opt of body.extensionOptions) {
15634
+ writer.writeBytes(1023, encodeAny(opt.typeUrl, opt.value));
15635
+ }
15763
15636
  return writer.finish();
15764
15637
  }
15765
- function encodeModeInfo(mode) {
15638
+ function encodeSignDoc(doc) {
15766
15639
  const writer = new BinaryWriter35();
15767
- const singleBytes = encodeModeInfoSingle(mode);
15768
- writer.writeBytes(1, singleBytes);
15769
- return writer.finish();
15770
- }
15771
- function encodeSignerInfo(info) {
15772
- const writer = new BinaryWriter35();
15773
- const pubKeyAny = encodeAny(info.publicKey.typeUrl, info.publicKey.value);
15774
- writer.writeBytes(1, pubKeyAny);
15775
- const modeInfoBytes = encodeModeInfo(info.mode);
15776
- writer.writeBytes(2, modeInfoBytes);
15777
- writer.writeUint64(3, typeof info.sequence === "string" ? BigInt(info.sequence) : info.sequence);
15778
- return writer.finish();
15779
- }
15780
- function encodeAuthInfo(authInfo) {
15781
- const writer = new BinaryWriter35();
15782
- for (const signerInfo of authInfo.signerInfos) {
15783
- writer.writeBytes(1, encodeSignerInfo(signerInfo));
15784
- }
15785
- writer.writeBytes(2, encodeFee(authInfo.fee));
15786
- return writer.finish();
15787
- }
15788
- function encodeTxBody(body) {
15789
- const writer = new BinaryWriter35();
15790
- for (const msg2 of body.messages) {
15791
- writer.writeBytes(1, encodeAny(msg2.typeUrl, msg2.value));
15792
- }
15793
- if (body.memo) {
15794
- writer.writeString(2, body.memo);
15795
- }
15796
- if (body.timeoutHeight) {
15797
- writer.writeUint64(3, body.timeoutHeight);
15798
- }
15799
- return writer.finish();
15800
- }
15801
- function encodeTxRaw(txRaw) {
15802
- const writer = new BinaryWriter35();
15803
- writer.writeBytes(1, txRaw.bodyBytes);
15804
- writer.writeBytes(2, txRaw.authInfoBytes);
15805
- writer.writeRepeatedBytes(3, txRaw.signatures);
15806
- return writer.finish();
15807
- }
15808
- function encodeEthSecp256k1PubKey(key) {
15809
- const writer = new BinaryWriter35();
15810
- writer.writeBytes(1, key);
15811
- return writer.finish();
15812
- }
15813
- var SIGN_MODE_LEGACY_AMINO_JSON = 127;
15814
- var SIGN_MODE_DIRECT = 1;
15815
- function encodeTimestamp(seconds, nanos) {
15816
- const writer = new BinaryWriter35();
15817
- writer.writeUint64(1, seconds);
15818
- writer.writeInt32(2, nanos);
15819
- return writer.finish();
15820
- }
15821
- function encodeTxBodyAgent(body) {
15822
- const writer = new BinaryWriter35();
15823
- for (const msg2 of body.messages) {
15824
- writer.writeBytes(1, encodeAny(msg2.typeUrl, msg2.value));
15825
- }
15826
- if (body.memo) {
15827
- writer.writeString(2, body.memo);
15828
- }
15829
- if (body.timeoutHeight) {
15830
- writer.writeUint64(3, body.timeoutHeight);
15831
- }
15832
- writer.writeBool(4, body.unordered);
15833
- const tsBytes = encodeTimestamp(body.timeoutTimestamp.seconds, body.timeoutTimestamp.nanos);
15834
- writer.writeBytes(5, tsBytes);
15835
- for (const opt of body.extensionOptions) {
15836
- writer.writeBytes(1023, encodeAny(opt.typeUrl, opt.value));
15837
- }
15838
- return writer.finish();
15839
- }
15840
- function encodeSignDoc(doc) {
15841
- const writer = new BinaryWriter35();
15842
- writer.writeBytes(1, doc.bodyBytes);
15843
- writer.writeBytes(2, doc.authInfoBytes);
15844
- writer.writeString(3, doc.chainId);
15845
- writer.writeUint64(4, doc.accountNumber);
15640
+ writer.writeBytes(1, doc.bodyBytes);
15641
+ writer.writeBytes(2, doc.authInfoBytes);
15642
+ writer.writeString(3, doc.chainId);
15643
+ writer.writeUint64(4, doc.accountNumber);
15846
15644
  return writer.finish();
15847
15645
  }
15848
15646
 
@@ -24205,338 +24003,709 @@ function mapAultTokenregistryV1Limiter(input, label = "value") {
24205
24003
  )
24206
24004
  };
24207
24005
  }
24208
- function mapAultTokenregistryV1MsgDisableTokenPair(input, label = "value") {
24209
- const record2 = asRecord(input);
24210
- const prefix = label ? `${label}.` : "";
24211
- return {
24212
- sender: requireString(record2["sender"], `${prefix}sender`),
24213
- erc20Address: requireString(record2["erc20Address"], `${prefix}erc20Address`)
24214
- };
24006
+ function mapAultTokenregistryV1MsgDisableTokenPair(input, label = "value") {
24007
+ const record2 = asRecord(input);
24008
+ const prefix = label ? `${label}.` : "";
24009
+ return {
24010
+ sender: requireString(record2["sender"], `${prefix}sender`),
24011
+ erc20Address: requireString(record2["erc20Address"], `${prefix}erc20Address`)
24012
+ };
24013
+ }
24014
+ function mapAultTokenregistryV1MsgDisableTransfers(input, label = "value") {
24015
+ const record2 = asRecord(input);
24016
+ const prefix = label ? `${label}.` : "";
24017
+ return {
24018
+ sender: requireString(record2["sender"], `${prefix}sender`)
24019
+ };
24020
+ }
24021
+ function mapAultTokenregistryV1MsgEnableTokenPair(input, label = "value") {
24022
+ const record2 = asRecord(input);
24023
+ const prefix = label ? `${label}.` : "";
24024
+ return {
24025
+ sender: requireString(record2["sender"], `${prefix}sender`),
24026
+ erc20Address: requireString(record2["erc20Address"], `${prefix}erc20Address`)
24027
+ };
24028
+ }
24029
+ function mapAultTokenregistryV1MsgEnableTransfers(input, label = "value") {
24030
+ const record2 = asRecord(input);
24031
+ const prefix = label ? `${label}.` : "";
24032
+ return {
24033
+ sender: requireString(record2["sender"], `${prefix}sender`)
24034
+ };
24035
+ }
24036
+ function mapAultTokenregistryV1MsgRegisterTokenPair(input, label = "value") {
24037
+ const record2 = asRecord(input);
24038
+ const prefix = label ? `${label}.` : "";
24039
+ return {
24040
+ sender: requireString(record2["sender"], `${prefix}sender`),
24041
+ erc20Address: requireString(record2["erc20Address"], `${prefix}erc20Address`),
24042
+ enabled: requireBool(record2["enabled"], `${prefix}enabled`),
24043
+ ...record2["transferLimit"] != null && {
24044
+ transferLimit: mapAultTokenregistryV1TransferLimitConfig(
24045
+ asRecord(record2["transferLimit"]),
24046
+ `${prefix}transferLimit`
24047
+ )
24048
+ }
24049
+ };
24050
+ }
24051
+ function mapAultTokenregistryV1MsgRemoveTransferLimit(input, label = "value") {
24052
+ const record2 = asRecord(input);
24053
+ const prefix = label ? `${label}.` : "";
24054
+ return {
24055
+ sender: requireString(record2["sender"], `${prefix}sender`),
24056
+ erc20Address: requireString(record2["erc20Address"], `${prefix}erc20Address`)
24057
+ };
24058
+ }
24059
+ function mapAultTokenregistryV1MsgSetTransferLimit(input, label = "value") {
24060
+ const record2 = asRecord(input);
24061
+ const prefix = label ? `${label}.` : "";
24062
+ return {
24063
+ sender: requireString(record2["sender"], `${prefix}sender`),
24064
+ erc20Address: requireString(record2["erc20Address"], `${prefix}erc20Address`),
24065
+ transferLimit: mapAultTokenregistryV1TransferLimitConfig(
24066
+ asRecord(record2["transferLimit"]),
24067
+ `${prefix}transferLimit`
24068
+ )
24069
+ };
24070
+ }
24071
+ function mapAultTokenregistryV1TransferLimitConfig(input, label = "value") {
24072
+ const record2 = asRecord(input);
24073
+ const prefix = label ? `${label}.` : "";
24074
+ return {
24075
+ hourly: mapAultTokenregistryV1Limiter(asRecord(record2["hourly"]), `${prefix}hourly`),
24076
+ daily: mapAultTokenregistryV1Limiter(asRecord(record2["daily"]), `${prefix}daily`)
24077
+ };
24078
+ }
24079
+ function mapCosmosBaseV1beta1Coin(input, label = "value") {
24080
+ const record2 = asRecord(input);
24081
+ const prefix = label ? `${label}.` : "";
24082
+ return {
24083
+ denom: requireString(record2["denom"], `${prefix}denom`),
24084
+ amount: requireString(record2["amount"], `${prefix}amount`)
24085
+ };
24086
+ }
24087
+ function mapCosmosDistributionV1beta1MsgWithdrawDelegatorReward(input, label = "value") {
24088
+ const record2 = asRecord(input);
24089
+ const prefix = label ? `${label}.` : "";
24090
+ return {
24091
+ delegatorAddress: requireString(record2["delegatorAddress"], `${prefix}delegatorAddress`),
24092
+ validatorAddress: requireString(record2["validatorAddress"], `${prefix}validatorAddress`)
24093
+ };
24094
+ }
24095
+ function mapCosmosStakingV1beta1MsgBeginRedelegate(input, label = "value") {
24096
+ const record2 = asRecord(input);
24097
+ const prefix = label ? `${label}.` : "";
24098
+ return {
24099
+ delegatorAddress: requireString(record2["delegatorAddress"], `${prefix}delegatorAddress`),
24100
+ validatorSrcAddress: requireString(
24101
+ record2["validatorSrcAddress"],
24102
+ `${prefix}validatorSrcAddress`
24103
+ ),
24104
+ validatorDstAddress: requireString(
24105
+ record2["validatorDstAddress"],
24106
+ `${prefix}validatorDstAddress`
24107
+ ),
24108
+ amount: mapCosmosBaseV1beta1Coin(asRecord(record2["amount"]), `${prefix}amount`)
24109
+ };
24110
+ }
24111
+ function mapCosmosStakingV1beta1MsgDelegate(input, label = "value") {
24112
+ const record2 = asRecord(input);
24113
+ const prefix = label ? `${label}.` : "";
24114
+ return {
24115
+ delegatorAddress: requireString(record2["delegatorAddress"], `${prefix}delegatorAddress`),
24116
+ validatorAddress: requireString(record2["validatorAddress"], `${prefix}validatorAddress`),
24117
+ amount: mapCosmosBaseV1beta1Coin(asRecord(record2["amount"]), `${prefix}amount`)
24118
+ };
24119
+ }
24120
+ function mapCosmosStakingV1beta1MsgUndelegate(input, label = "value") {
24121
+ const record2 = asRecord(input);
24122
+ const prefix = label ? `${label}.` : "";
24123
+ return {
24124
+ delegatorAddress: requireString(record2["delegatorAddress"], `${prefix}delegatorAddress`),
24125
+ validatorAddress: requireString(record2["validatorAddress"], `${prefix}validatorAddress`),
24126
+ amount: mapCosmosBaseV1beta1Coin(asRecord(record2["amount"]), `${prefix}amount`)
24127
+ };
24128
+ }
24129
+ function mapGoogleProtobufAny(input, label = "value") {
24130
+ const record2 = asRecord(input);
24131
+ const prefix = label ? `${label}.` : "";
24132
+ return {
24133
+ typeUrl: requireString(record2["typeUrl"], `${prefix}typeUrl`),
24134
+ value: requireBytes(record2["value"], `${prefix}value`)
24135
+ };
24136
+ }
24137
+ var MSG_ENCODERS = {
24138
+ "/ault.accountx.v1.MsgOpenAccount": (value) => MsgOpenAccount.encode(
24139
+ MsgOpenAccount.fromPartial(mapAultAccountxV1MsgOpenAccount(value))
24140
+ ).finish(),
24141
+ "/ault.accountx.v1.MsgUpdateFeeTiers": (value) => MsgUpdateFeeTiers.encode(
24142
+ MsgUpdateFeeTiers.fromPartial(mapAultAccountxV1MsgUpdateFeeTiers(value))
24143
+ ).finish(),
24144
+ "/ault.accountx.v1.MsgUpdateParams": (value) => MsgUpdateParams.encode(
24145
+ MsgUpdateParams.fromPartial(mapAultAccountxV1MsgUpdateParams(value))
24146
+ ).finish(),
24147
+ "/ault.accountx.v1.MsgUpdateTradingTiers": (value) => MsgUpdateTradingTiers.encode(
24148
+ MsgUpdateTradingTiers.fromPartial(mapAultAccountxV1MsgUpdateTradingTiers(value))
24149
+ ).finish(),
24150
+ "/ault.agent.v1.MsgApproveAgent": (value) => MsgApproveAgent.encode(
24151
+ MsgApproveAgent.fromPartial(mapAultAgentV1MsgApproveAgent(value))
24152
+ ).finish(),
24153
+ "/ault.agent.v1.MsgRevokeAgent": (value) => MsgRevokeAgent.encode(MsgRevokeAgent.fromPartial(mapAultAgentV1MsgRevokeAgent(value))).finish(),
24154
+ "/ault.agent.v1.MsgUpdateParams": (value) => MsgUpdateParams2.encode(
24155
+ MsgUpdateParams2.fromPartial(mapAultAgentV1MsgUpdateParams(value))
24156
+ ).finish(),
24157
+ "/ault.authority.v1.MsgGrantRole": (value) => MsgGrantRole.encode(MsgGrantRole.fromPartial(mapAultAuthorityV1MsgGrantRole(value))).finish(),
24158
+ "/ault.authority.v1.MsgRevokeRole": (value) => MsgRevokeRole.encode(
24159
+ MsgRevokeRole.fromPartial(mapAultAuthorityV1MsgRevokeRole(value))
24160
+ ).finish(),
24161
+ "/ault.clob.v1.MsgCancelOrders": (value) => MsgCancelOrders.encode(
24162
+ MsgCancelOrders.fromPartial(mapAultClobV1MsgCancelOrders(value))
24163
+ ).finish(),
24164
+ "/ault.clob.v1.MsgModifyOrders": (value) => MsgModifyOrders.encode(
24165
+ MsgModifyOrders.fromPartial(mapAultClobV1MsgModifyOrders(value))
24166
+ ).finish(),
24167
+ "/ault.clob.v1.MsgPlaceLimitOrder": (value) => MsgPlaceLimitOrder.encode(
24168
+ MsgPlaceLimitOrder.fromPartial(mapAultClobV1MsgPlaceLimitOrder(value))
24169
+ ).finish(),
24170
+ "/ault.clob.v1.MsgPlaceMarketOrder": (value) => MsgPlaceMarketOrder.encode(
24171
+ MsgPlaceMarketOrder.fromPartial(mapAultClobV1MsgPlaceMarketOrder(value))
24172
+ ).finish(),
24173
+ "/ault.clob.v1.MsgPlaceScaleOrder": (value) => MsgPlaceScaleOrder.encode(
24174
+ MsgPlaceScaleOrder.fromPartial(mapAultClobV1MsgPlaceScaleOrder(value))
24175
+ ).finish(),
24176
+ "/ault.clob.v1.MsgPlaceTwapOrder": (value) => MsgPlaceTwapOrder.encode(
24177
+ MsgPlaceTwapOrder.fromPartial(mapAultClobV1MsgPlaceTwapOrder(value))
24178
+ ).finish(),
24179
+ "/ault.clob.v1.MsgUpdateParams": (value) => MsgUpdateParams3.encode(
24180
+ MsgUpdateParams3.fromPartial(mapAultClobV1MsgUpdateParams(value))
24181
+ ).finish(),
24182
+ "/ault.license.v1.MsgApproveMember": (value) => MsgApproveMember.encode(
24183
+ MsgApproveMember.fromPartial(mapAultLicenseV1MsgApproveMember(value))
24184
+ ).finish(),
24185
+ "/ault.license.v1.MsgBatchApproveMember": (value) => MsgBatchApproveMember.encode(
24186
+ MsgBatchApproveMember.fromPartial(mapAultLicenseV1MsgBatchApproveMember(value))
24187
+ ).finish(),
24188
+ "/ault.license.v1.MsgBatchMintLicense": (value) => MsgBatchMintLicense.encode(
24189
+ MsgBatchMintLicense.fromPartial(mapAultLicenseV1MsgBatchMintLicense(value))
24190
+ ).finish(),
24191
+ "/ault.license.v1.MsgBatchRevokeMember": (value) => MsgBatchRevokeMember.encode(
24192
+ MsgBatchRevokeMember.fromPartial(mapAultLicenseV1MsgBatchRevokeMember(value))
24193
+ ).finish(),
24194
+ "/ault.license.v1.MsgBurnLicense": (value) => MsgBurnLicense.encode(
24195
+ MsgBurnLicense.fromPartial(mapAultLicenseV1MsgBurnLicense(value))
24196
+ ).finish(),
24197
+ "/ault.license.v1.MsgMintLicense": (value) => MsgMintLicense.encode(
24198
+ MsgMintLicense.fromPartial(mapAultLicenseV1MsgMintLicense(value))
24199
+ ).finish(),
24200
+ "/ault.license.v1.MsgRevokeLicense": (value) => MsgRevokeLicense.encode(
24201
+ MsgRevokeLicense.fromPartial(mapAultLicenseV1MsgRevokeLicense(value))
24202
+ ).finish(),
24203
+ "/ault.license.v1.MsgRevokeMember": (value) => MsgRevokeMember.encode(
24204
+ MsgRevokeMember.fromPartial(mapAultLicenseV1MsgRevokeMember(value))
24205
+ ).finish(),
24206
+ "/ault.license.v1.MsgSetKYCApprovers": (value) => MsgSetKYCApprovers.encode(
24207
+ MsgSetKYCApprovers.fromPartial(mapAultLicenseV1MsgSetKYCApprovers(value))
24208
+ ).finish(),
24209
+ "/ault.license.v1.MsgSetMinters": (value) => MsgSetMinters.encode(MsgSetMinters.fromPartial(mapAultLicenseV1MsgSetMinters(value))).finish(),
24210
+ "/ault.license.v1.MsgSetTokenURI": (value) => MsgSetTokenURI.encode(
24211
+ MsgSetTokenURI.fromPartial(mapAultLicenseV1MsgSetTokenURI(value))
24212
+ ).finish(),
24213
+ "/ault.license.v1.MsgTransferLicense": (value) => MsgTransferLicense.encode(
24214
+ MsgTransferLicense.fromPartial(mapAultLicenseV1MsgTransferLicense(value))
24215
+ ).finish(),
24216
+ "/ault.license.v1.MsgUpdateParams": (value) => MsgUpdateParams4.encode(
24217
+ MsgUpdateParams4.fromPartial(mapAultLicenseV1MsgUpdateParams(value))
24218
+ ).finish(),
24219
+ "/ault.market.v1.MsgCreateMarket": (value) => MsgCreateMarket.encode(
24220
+ MsgCreateMarket.fromPartial(mapAultMarketV1MsgCreateMarket(value))
24221
+ ).finish(),
24222
+ "/ault.market.v1.MsgHaltAllMarkets": (value) => MsgHaltAllMarkets.encode(
24223
+ MsgHaltAllMarkets.fromPartial(mapAultMarketV1MsgHaltAllMarkets(value))
24224
+ ).finish(),
24225
+ "/ault.market.v1.MsgHaltMarkets": (value) => MsgHaltMarkets.encode(
24226
+ MsgHaltMarkets.fromPartial(mapAultMarketV1MsgHaltMarkets(value))
24227
+ ).finish(),
24228
+ "/ault.market.v1.MsgResumeAllMarkets": (value) => MsgResumeAllMarkets.encode(
24229
+ MsgResumeAllMarkets.fromPartial(mapAultMarketV1MsgResumeAllMarkets(value))
24230
+ ).finish(),
24231
+ "/ault.market.v1.MsgResumeMarkets": (value) => MsgResumeMarkets.encode(
24232
+ MsgResumeMarkets.fromPartial(mapAultMarketV1MsgResumeMarkets(value))
24233
+ ).finish(),
24234
+ "/ault.market.v1.MsgUpdateMarket": (value) => MsgUpdateMarket.encode(
24235
+ MsgUpdateMarket.fromPartial(mapAultMarketV1MsgUpdateMarket(value))
24236
+ ).finish(),
24237
+ "/ault.market.v1.MsgUpdateMarketDeployer": (value) => MsgUpdateMarketDeployer.encode(
24238
+ MsgUpdateMarketDeployer.fromPartial(mapAultMarketV1MsgUpdateMarketDeployer(value))
24239
+ ).finish(),
24240
+ "/ault.market.v1.MsgUpdateParams": (value) => MsgUpdateParams5.encode(
24241
+ MsgUpdateParams5.fromPartial(mapAultMarketV1MsgUpdateParams(value))
24242
+ ).finish(),
24243
+ "/ault.miner.v1.MsgBatchSubmitWork": (value) => MsgBatchSubmitWork.encode(
24244
+ MsgBatchSubmitWork.fromPartial(mapAultMinerV1MsgBatchSubmitWork(value))
24245
+ ).finish(),
24246
+ "/ault.miner.v1.MsgCancelMiningDelegation": (value) => MsgCancelMiningDelegation.encode(
24247
+ MsgCancelMiningDelegation.fromPartial(mapAultMinerV1MsgCancelMiningDelegation(value))
24248
+ ).finish(),
24249
+ "/ault.miner.v1.MsgDelegateMining": (value) => MsgDelegateMining.encode(
24250
+ MsgDelegateMining.fromPartial(mapAultMinerV1MsgDelegateMining(value))
24251
+ ).finish(),
24252
+ "/ault.miner.v1.MsgRedelegateMining": (value) => MsgRedelegateMining.encode(
24253
+ MsgRedelegateMining.fromPartial(mapAultMinerV1MsgRedelegateMining(value))
24254
+ ).finish(),
24255
+ "/ault.miner.v1.MsgRegisterOperator": (value) => MsgRegisterOperator.encode(
24256
+ MsgRegisterOperator.fromPartial(mapAultMinerV1MsgRegisterOperator(value))
24257
+ ).finish(),
24258
+ "/ault.miner.v1.MsgSetOwnerVrfKey": (value) => MsgSetOwnerVrfKey.encode(
24259
+ MsgSetOwnerVrfKey.fromPartial(mapAultMinerV1MsgSetOwnerVrfKey(value))
24260
+ ).finish(),
24261
+ "/ault.miner.v1.MsgSubmitWork": (value) => MsgSubmitWork.encode(MsgSubmitWork.fromPartial(mapAultMinerV1MsgSubmitWork(value))).finish(),
24262
+ "/ault.miner.v1.MsgUnregisterOperator": (value) => MsgUnregisterOperator.encode(
24263
+ MsgUnregisterOperator.fromPartial(mapAultMinerV1MsgUnregisterOperator(value))
24264
+ ).finish(),
24265
+ "/ault.miner.v1.MsgUpdateOperatorInfo": (value) => MsgUpdateOperatorInfo.encode(
24266
+ MsgUpdateOperatorInfo.fromPartial(mapAultMinerV1MsgUpdateOperatorInfo(value))
24267
+ ).finish(),
24268
+ "/ault.miner.v1.MsgUpdateParams": (value) => MsgUpdateParams6.encode(
24269
+ MsgUpdateParams6.fromPartial(mapAultMinerV1MsgUpdateParams(value))
24270
+ ).finish(),
24271
+ "/ault.ratelimit.v1.MsgUpdateParams": (value) => MsgUpdateParams7.encode(
24272
+ MsgUpdateParams7.fromPartial(mapAultRatelimitV1MsgUpdateParams(value))
24273
+ ).finish(),
24274
+ "/ault.reward.v1.MsgApproveBuilder": (value) => MsgApproveBuilder.encode(
24275
+ MsgApproveBuilder.fromPartial(mapAultRewardV1MsgApproveBuilder(value))
24276
+ ).finish(),
24277
+ "/ault.reward.v1.MsgRevokeBuilder": (value) => MsgRevokeBuilder.encode(
24278
+ MsgRevokeBuilder.fromPartial(mapAultRewardV1MsgRevokeBuilder(value))
24279
+ ).finish(),
24280
+ "/ault.reward.v1.MsgSetDeployerShare": (value) => MsgSetDeployerShare.encode(
24281
+ MsgSetDeployerShare.fromPartial(mapAultRewardV1MsgSetDeployerShare(value))
24282
+ ).finish(),
24283
+ "/ault.reward.v1.MsgSetReferral": (value) => MsgSetReferral.encode(
24284
+ MsgSetReferral.fromPartial(mapAultRewardV1MsgSetReferral(value))
24285
+ ).finish(),
24286
+ "/ault.reward.v1.MsgSetReferralCode": (value) => MsgSetReferralCode.encode(
24287
+ MsgSetReferralCode.fromPartial(mapAultRewardV1MsgSetReferralCode(value))
24288
+ ).finish(),
24289
+ "/ault.reward.v1.MsgUpdateEligibleReferrers": (value) => MsgUpdateEligibleReferrers.encode(
24290
+ MsgUpdateEligibleReferrers.fromPartial(mapAultRewardV1MsgUpdateEligibleReferrers(value))
24291
+ ).finish(),
24292
+ "/ault.reward.v1.MsgUpdateFeeTierDiscounts": (value) => MsgUpdateFeeTierDiscounts.encode(
24293
+ MsgUpdateFeeTierDiscounts.fromPartial(mapAultRewardV1MsgUpdateFeeTierDiscounts(value))
24294
+ ).finish(),
24295
+ "/ault.reward.v1.MsgUpdateParams": (value) => MsgUpdateParams8.encode(
24296
+ MsgUpdateParams8.fromPartial(mapAultRewardV1MsgUpdateParams(value))
24297
+ ).finish(),
24298
+ "/ault.reward.v1.MsgUpdateRefereeDiscountRate": (value) => MsgUpdateRefereeDiscountRate.encode(
24299
+ MsgUpdateRefereeDiscountRate.fromPartial(mapAultRewardV1MsgUpdateRefereeDiscountRate(value))
24300
+ ).finish(),
24301
+ "/ault.reward.v1.MsgUpdateTradingTierBenefits": (value) => MsgUpdateTradingTierBenefits.encode(
24302
+ MsgUpdateTradingTierBenefits.fromPartial(mapAultRewardV1MsgUpdateTradingTierBenefits(value))
24303
+ ).finish(),
24304
+ "/ault.tokenregistry.v1.MsgDisableTokenPair": (value) => MsgDisableTokenPair.encode(
24305
+ MsgDisableTokenPair.fromPartial(mapAultTokenregistryV1MsgDisableTokenPair(value))
24306
+ ).finish(),
24307
+ "/ault.tokenregistry.v1.MsgDisableTransfers": (value) => MsgDisableTransfers.encode(
24308
+ MsgDisableTransfers.fromPartial(mapAultTokenregistryV1MsgDisableTransfers(value))
24309
+ ).finish(),
24310
+ "/ault.tokenregistry.v1.MsgEnableTokenPair": (value) => MsgEnableTokenPair.encode(
24311
+ MsgEnableTokenPair.fromPartial(mapAultTokenregistryV1MsgEnableTokenPair(value))
24312
+ ).finish(),
24313
+ "/ault.tokenregistry.v1.MsgEnableTransfers": (value) => MsgEnableTransfers.encode(
24314
+ MsgEnableTransfers.fromPartial(mapAultTokenregistryV1MsgEnableTransfers(value))
24315
+ ).finish(),
24316
+ "/ault.tokenregistry.v1.MsgRegisterTokenPair": (value) => MsgRegisterTokenPair.encode(
24317
+ MsgRegisterTokenPair.fromPartial(mapAultTokenregistryV1MsgRegisterTokenPair(value))
24318
+ ).finish(),
24319
+ "/ault.tokenregistry.v1.MsgRemoveTransferLimit": (value) => MsgRemoveTransferLimit.encode(
24320
+ MsgRemoveTransferLimit.fromPartial(mapAultTokenregistryV1MsgRemoveTransferLimit(value))
24321
+ ).finish(),
24322
+ "/ault.tokenregistry.v1.MsgSetTransferLimit": (value) => MsgSetTransferLimit.encode(
24323
+ MsgSetTransferLimit.fromPartial(mapAultTokenregistryV1MsgSetTransferLimit(value))
24324
+ ).finish(),
24325
+ "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward": (value) => MsgWithdrawDelegatorReward.encode(
24326
+ MsgWithdrawDelegatorReward.fromPartial(
24327
+ mapCosmosDistributionV1beta1MsgWithdrawDelegatorReward(value)
24328
+ )
24329
+ ).finish(),
24330
+ "/cosmos.staking.v1beta1.MsgBeginRedelegate": (value) => MsgBeginRedelegate.encode(
24331
+ MsgBeginRedelegate.fromPartial(mapCosmosStakingV1beta1MsgBeginRedelegate(value))
24332
+ ).finish(),
24333
+ "/cosmos.staking.v1beta1.MsgDelegate": (value) => MsgDelegate.encode(MsgDelegate.fromPartial(mapCosmosStakingV1beta1MsgDelegate(value))).finish(),
24334
+ "/cosmos.staking.v1beta1.MsgUndelegate": (value) => MsgUndelegate.encode(
24335
+ MsgUndelegate.fromPartial(mapCosmosStakingV1beta1MsgUndelegate(value))
24336
+ ).finish()
24337
+ };
24338
+
24339
+ // src/eip712/simulate.ts
24340
+ var SIMULATE_PATH = "/cosmos/tx/v1beta1/simulate";
24341
+ var SIMULATION_PLACEHOLDER_PUBKEY = new Uint8Array([
24342
+ 2,
24343
+ 121,
24344
+ 190,
24345
+ 102,
24346
+ 126,
24347
+ 249,
24348
+ 220,
24349
+ 187,
24350
+ 172,
24351
+ 85,
24352
+ 160,
24353
+ 98,
24354
+ 149,
24355
+ 206,
24356
+ 135,
24357
+ 11,
24358
+ 7,
24359
+ 2,
24360
+ 155,
24361
+ 252,
24362
+ 219,
24363
+ 45,
24364
+ 206,
24365
+ 40,
24366
+ 217,
24367
+ 89,
24368
+ 242,
24369
+ 129,
24370
+ 91,
24371
+ 22,
24372
+ 248,
24373
+ 23,
24374
+ 152
24375
+ ]);
24376
+ var SIMULATION_PLACEHOLDER_SIGNATURE = new Uint8Array(64);
24377
+ var CHAIN_VERDICT_STATUSES = /* @__PURE__ */ new Set([400, 500]);
24378
+ var CHAIN_VERDICT_CODES = /* @__PURE__ */ new Set([2, 3]);
24379
+ async function simulateTx({
24380
+ network,
24381
+ msgs,
24382
+ memo = "",
24383
+ sequence,
24384
+ pubkeyBase64,
24385
+ placeholderGasLimit,
24386
+ placeholderFee,
24387
+ fetchFn,
24388
+ fetchOptions
24389
+ }) {
24390
+ const encodedMessages = msgs.map((msg2) => {
24391
+ const encoder = MSG_ENCODERS[msg2.typeUrl];
24392
+ if (!encoder) {
24393
+ throw new Error(`No encoder found for message type: ${msg2.typeUrl}`);
24394
+ }
24395
+ return { typeUrl: msg2.typeUrl, value: encoder(msg2.value) };
24396
+ });
24397
+ const pubkeyBytes = pubkeyBase64 ? base64ToBytes(pubkeyBase64) : SIMULATION_PLACEHOLDER_PUBKEY;
24398
+ const txRawBytes = encodeTxRaw({
24399
+ bodyBytes: encodeTxBody({ messages: encodedMessages, memo }),
24400
+ authInfoBytes: encodeAuthInfo({
24401
+ signerInfos: [
24402
+ {
24403
+ publicKey: {
24404
+ typeUrl: "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey",
24405
+ value: encodeEthSecp256k1PubKey(pubkeyBytes)
24406
+ },
24407
+ mode: SIGN_MODE_LEGACY_AMINO_JSON,
24408
+ sequence
24409
+ }
24410
+ ],
24411
+ fee: { amount: [placeholderFee], gasLimit: BigInt(placeholderGasLimit) }
24412
+ }),
24413
+ signatures: [SIMULATION_PLACEHOLDER_SIGNATURE]
24414
+ });
24415
+ const url = `${network.restUrl}${SIMULATE_PATH}`;
24416
+ let response;
24417
+ try {
24418
+ response = await postJson(
24419
+ url,
24420
+ { tx_bytes: bytesToBase64(txRawBytes) },
24421
+ {
24422
+ ...fetchOptions,
24423
+ // 500 carries the verdict; never retry it. The rest of the caller's
24424
+ // policy stays.
24425
+ retryableStatuses: (fetchOptions?.retryableStatuses ?? DEFAULT_RETRYABLE_STATUSES).filter(
24426
+ (status) => status !== 500
24427
+ )
24428
+ },
24429
+ fetchFn
24430
+ );
24431
+ } catch (error) {
24432
+ const verdict = chainVerdict(error);
24433
+ if (verdict) {
24434
+ throw new TxSimulationError(verdict);
24435
+ }
24436
+ const detail = error instanceof Error ? error.message : String(error);
24437
+ console.warn(`[ault-sdk] tx simulation unavailable (${url}); using static gas: ${detail}`);
24438
+ return null;
24439
+ }
24440
+ const gasUsed = response.gas_info?.gas_used;
24441
+ if (typeof gasUsed !== "string" || !/^\d+$/.test(gasUsed) || gasUsed === "0") {
24442
+ console.warn(`[ault-sdk] tx simulation returned no usable gas_used (${url}); using static gas`);
24443
+ return null;
24444
+ }
24445
+ return { gasUsed: BigInt(gasUsed) };
24446
+ }
24447
+ function chainVerdict(error) {
24448
+ if (!(error instanceof ApiError) || typeof error.status !== "number") return null;
24449
+ if (!CHAIN_VERDICT_STATUSES.has(error.status) || !error.response) return null;
24450
+ let body;
24451
+ try {
24452
+ body = JSON.parse(error.response);
24453
+ } catch {
24454
+ return null;
24455
+ }
24456
+ if (typeof body !== "object" || body === null) return null;
24457
+ const { code, message } = body;
24458
+ if (typeof code !== "number" || !CHAIN_VERDICT_CODES.has(code)) return null;
24459
+ if (typeof message !== "string" || message.length === 0) return null;
24460
+ return { rawLog: message, chainCode: code };
24461
+ }
24462
+
24463
+ // src/rest/feemarket.ts
24464
+ async function fetchFeeMarketParams(network, fetchFn, fetchOptions) {
24465
+ const data = await fetchJson(
24466
+ `${network.restUrl}/cosmos/evm/feemarket/v1/params`,
24467
+ {},
24468
+ fetchOptions,
24469
+ fetchFn
24470
+ );
24471
+ const raw = data.params ?? {};
24472
+ return {
24473
+ noBaseFee: raw.noBaseFee ?? raw.no_base_fee ?? false,
24474
+ baseFee: raw.baseFee ?? raw.base_fee ?? "0",
24475
+ minGasPrice: raw.minGasPrice ?? raw.min_gas_price ?? "0"
24476
+ };
24477
+ }
24478
+ var ONE_E18 = 1000000000000000000n;
24479
+ var DEFAULT_FEE_MARGIN_PERCENT = 20;
24480
+ function marginFactorScaled(marginPercent) {
24481
+ if (!Number.isFinite(marginPercent) || !Number.isInteger(marginPercent)) {
24482
+ throw new Error(`marginPercent must be a non-negative integer, got ${marginPercent}`);
24483
+ }
24484
+ if (marginPercent < 0) {
24485
+ throw new Error(`marginPercent must be >= 0, got ${marginPercent}`);
24486
+ }
24487
+ return BigInt(100 + marginPercent);
24488
+ }
24489
+ function computeRequiredFee(params, gas, options) {
24490
+ const margin = marginFactorScaled(options?.marginPercent ?? DEFAULT_FEE_MARGIN_PERCENT);
24491
+ const minGasPriceI = BigInt(cosmosDecToProtoInt(params.minGasPrice || "0"));
24492
+ const baseFeeI = params.noBaseFee ? 0n : BigInt(cosmosDecToProtoInt(params.baseFee || "0"));
24493
+ const effectiveI = baseFeeI > minGasPriceI ? baseFeeI : minGasPriceI;
24494
+ if (effectiveI <= 0n) return "0";
24495
+ const gasI = BigInt(gas);
24496
+ if (gasI <= 0n) return "0";
24497
+ const numerator = effectiveI * gasI * margin;
24498
+ const denominator = ONE_E18 * 100n;
24499
+ return ((numerator + denominator - 1n) / denominator).toString();
24500
+ }
24501
+ var DEFAULT_FEE_MARKET_TTL_MS = 3e3;
24502
+ function createFeeMarketCache(ttlMs = DEFAULT_FEE_MARKET_TTL_MS) {
24503
+ return { ttlMs, entries: /* @__PURE__ */ new Map() };
24504
+ }
24505
+ async function getCachedFeeMarketParams(cache, network, fetchFn, fetchOptions) {
24506
+ const key = network.chainId;
24507
+ const now = Date.now();
24508
+ if (cache) {
24509
+ const existing = cache.entries.get(key);
24510
+ if (existing && now - existing.fetchedAt < cache.ttlMs) {
24511
+ return existing.params;
24512
+ }
24513
+ }
24514
+ let params;
24515
+ try {
24516
+ params = await fetchFeeMarketParams(network, fetchFn, fetchOptions);
24517
+ } catch (error) {
24518
+ if (!isGatewayUnsupportedError(error)) throw error;
24519
+ params = null;
24520
+ }
24521
+ if (cache) {
24522
+ cache.entries.set(key, { params, fetchedAt: now });
24523
+ }
24524
+ return params;
24525
+ }
24526
+ function isGatewayUnsupportedError(error) {
24527
+ return error instanceof ApiError && (error.status === 404 || error.status === 501);
24528
+ }
24529
+ function computeEvmFeesPerGas(params, options) {
24530
+ const margin = marginFactorScaled(options?.marginPercent ?? DEFAULT_FEE_MARGIN_PERCENT);
24531
+ const minGasPriceI = BigInt(cosmosDecToProtoInt(params.minGasPrice || "0"));
24532
+ const baseFeeI = params.noBaseFee ? 0n : BigInt(cosmosDecToProtoInt(params.baseFee || "0"));
24533
+ const effectiveI = baseFeeI > minGasPriceI ? baseFeeI : minGasPriceI;
24534
+ if (effectiveI <= 0n) {
24535
+ return { maxFeePerGas: 0n, maxPriorityFeePerGas: 0n };
24536
+ }
24537
+ const numerator = effectiveI * margin;
24538
+ const denominator = ONE_E18 * 100n;
24539
+ const gasPriceWei = (numerator + denominator - 1n) / denominator;
24540
+ return { maxFeePerGas: gasPriceWei, maxPriorityFeePerGas: gasPriceWei };
24541
+ }
24542
+ async function resolveEvmFeesPerGas(network, options) {
24543
+ const params = await getCachedFeeMarketParams(
24544
+ options?.cache,
24545
+ network,
24546
+ options?.fetchFn,
24547
+ options?.fetchOptions
24548
+ );
24549
+ if (!params) return null;
24550
+ let fees;
24551
+ try {
24552
+ fees = computeEvmFeesPerGas(params, { marginPercent: options?.marginPercent });
24553
+ } catch {
24554
+ return null;
24555
+ }
24556
+ if (fees.maxFeePerGas === 0n && fees.maxPriorityFeePerGas === 0n) return null;
24557
+ return fees;
24215
24558
  }
24216
- function mapAultTokenregistryV1MsgDisableTransfers(input, label = "value") {
24217
- const record2 = asRecord(input);
24218
- const prefix = label ? `${label}.` : "";
24219
- return {
24220
- sender: requireString(record2["sender"], `${prefix}sender`)
24221
- };
24559
+
24560
+ // src/eip712/signers.ts
24561
+ import { privateKeyToAccount } from "viem/accounts";
24562
+ var AULT_SIGNER_MARKER = /* @__PURE__ */ Symbol.for("ault-sdk:signer");
24563
+ function isAultSigner(obj) {
24564
+ return typeof obj === "object" && obj !== null && AULT_SIGNER_MARKER in obj && obj[AULT_SIGNER_MARKER] === true;
24222
24565
  }
24223
- function mapAultTokenregistryV1MsgEnableTokenPair(input, label = "value") {
24224
- const record2 = asRecord(input);
24225
- const prefix = label ? `${label}.` : "";
24226
- return {
24227
- sender: requireString(record2["sender"], `${prefix}sender`),
24228
- erc20Address: requireString(record2["erc20Address"], `${prefix}erc20Address`)
24229
- };
24566
+ function normalizeSigner(input) {
24567
+ if (!input) return null;
24568
+ if (typeof input === "function") {
24569
+ return { signTypedData: input };
24570
+ }
24571
+ if (typeof input === "object" && typeof input.signTypedData === "function") {
24572
+ return input;
24573
+ }
24574
+ throw new Error("Invalid signer: expected a signer object or signTypedData function.");
24230
24575
  }
24231
- function mapAultTokenregistryV1MsgEnableTransfers(input, label = "value") {
24232
- const record2 = asRecord(input);
24233
- const prefix = label ? `${label}.` : "";
24234
- return {
24235
- sender: requireString(record2["sender"], `${prefix}sender`)
24236
- };
24576
+ function normalizeSignature(result) {
24577
+ if (typeof result === "string") {
24578
+ return result;
24579
+ }
24580
+ if (result && typeof result.signature === "string") {
24581
+ return result.signature;
24582
+ }
24583
+ throw new Error("Invalid signature response: expected hex string or { signature }.");
24237
24584
  }
24238
- function mapAultTokenregistryV1MsgRegisterTokenPair(input, label = "value") {
24239
- const record2 = asRecord(input);
24240
- const prefix = label ? `${label}.` : "";
24241
- return {
24242
- sender: requireString(record2["sender"], `${prefix}sender`),
24243
- erc20Address: requireString(record2["erc20Address"], `${prefix}erc20Address`),
24244
- enabled: requireBool(record2["enabled"], `${prefix}enabled`),
24245
- ...record2["transferLimit"] != null && {
24246
- transferLimit: mapAultTokenregistryV1TransferLimitConfig(
24247
- asRecord(record2["transferLimit"]),
24248
- `${prefix}transferLimit`
24249
- )
24250
- }
24251
- };
24585
+ async function getSignerAddress(signer) {
24586
+ if (typeof signer.address === "string") {
24587
+ return signer.address;
24588
+ }
24589
+ if (typeof signer.getAddress === "function") {
24590
+ const address = await signer.getAddress();
24591
+ return typeof address === "string" ? address : null;
24592
+ }
24593
+ return null;
24252
24594
  }
24253
- function mapAultTokenregistryV1MsgRemoveTransferLimit(input, label = "value") {
24254
- const record2 = asRecord(input);
24255
- const prefix = label ? `${label}.` : "";
24256
- return {
24257
- sender: requireString(record2["sender"], `${prefix}sender`),
24258
- erc20Address: requireString(record2["erc20Address"], `${prefix}erc20Address`)
24259
- };
24595
+ async function resolveSignerAddress(signer, signerAddress) {
24596
+ const raw = signerAddress ?? (signer ? await getSignerAddress(signer) : null);
24597
+ if (!raw) {
24598
+ throw new Error("signerAddress is required when the signer has no address.");
24599
+ }
24600
+ if (isValidAultAddress(raw)) {
24601
+ return raw;
24602
+ }
24603
+ if (isValidEvmAddress(raw)) {
24604
+ return evmToAult(raw);
24605
+ }
24606
+ throw new Error(`Invalid signerAddress: ${raw}`);
24260
24607
  }
24261
- function mapAultTokenregistryV1MsgSetTransferLimit(input, label = "value") {
24262
- const record2 = asRecord(input);
24263
- const prefix = label ? `${label}.` : "";
24264
- return {
24265
- sender: requireString(record2["sender"], `${prefix}sender`),
24266
- erc20Address: requireString(record2["erc20Address"], `${prefix}erc20Address`),
24267
- transferLimit: mapAultTokenregistryV1TransferLimitConfig(
24268
- asRecord(record2["transferLimit"]),
24269
- `${prefix}transferLimit`
24270
- )
24271
- };
24608
+ function stripEip712Domain(types) {
24609
+ const { EIP712Domain: _removed, ...rest } = types;
24610
+ return rest;
24272
24611
  }
24273
- function mapAultTokenregistryV1TransferLimitConfig(input, label = "value") {
24274
- const record2 = asRecord(input);
24275
- const prefix = label ? `${label}.` : "";
24612
+ function createEip1193Signer(options) {
24613
+ const method = options.method ?? "eth_signTypedData_v4";
24276
24614
  return {
24277
- hourly: mapAultTokenregistryV1Limiter(asRecord(record2["hourly"]), `${prefix}hourly`),
24278
- daily: mapAultTokenregistryV1Limiter(asRecord(record2["daily"]), `${prefix}daily`)
24615
+ [AULT_SIGNER_MARKER]: true,
24616
+ address: options.address,
24617
+ signTypedData: async (typedData) => {
24618
+ const payload = method === "eth_signTypedData_v4" ? JSON.stringify(typedData) : typedData;
24619
+ const signature = await options.provider.request({
24620
+ method,
24621
+ params: [options.address, payload]
24622
+ });
24623
+ if (typeof signature !== "string") {
24624
+ throw new Error("Provider did not return a signature string.");
24625
+ }
24626
+ return { signature };
24627
+ }
24279
24628
  };
24280
24629
  }
24281
- function mapCosmosBaseV1beta1Coin(input, label = "value") {
24282
- const record2 = asRecord(input);
24283
- const prefix = label ? `${label}.` : "";
24284
- return {
24285
- denom: requireString(record2["denom"], `${prefix}denom`),
24286
- amount: requireString(record2["amount"], `${prefix}amount`)
24630
+ function createViemSigner(wallet, options) {
24631
+ const preferRpc = options?.preferRpc ?? true;
24632
+ const getAddress3 = async () => {
24633
+ if (wallet.address) return wallet.address;
24634
+ if (wallet.getAddresses) {
24635
+ const addresses = await wallet.getAddresses();
24636
+ if (addresses?.length) return addresses[0];
24637
+ }
24638
+ return void 0;
24287
24639
  };
24288
- }
24289
- function mapCosmosDistributionV1beta1MsgWithdrawDelegatorReward(input, label = "value") {
24290
- const record2 = asRecord(input);
24291
- const prefix = label ? `${label}.` : "";
24292
24640
  return {
24293
- delegatorAddress: requireString(record2["delegatorAddress"], `${prefix}delegatorAddress`),
24294
- validatorAddress: requireString(record2["validatorAddress"], `${prefix}validatorAddress`)
24641
+ [AULT_SIGNER_MARKER]: true,
24642
+ getAddress: async () => {
24643
+ const addr = await getAddress3();
24644
+ if (!addr) throw new Error("Viem wallet has no address");
24645
+ return addr;
24646
+ },
24647
+ signTypedData: async (typedData) => {
24648
+ if (preferRpc && wallet.request) {
24649
+ const address = await getAddress3();
24650
+ if (!address) {
24651
+ throw new Error("Viem wallet has no address; pass signerAddress explicitly.");
24652
+ }
24653
+ const signature2 = await wallet.request({
24654
+ method: "eth_signTypedData_v4",
24655
+ params: [address, JSON.stringify(typedData)]
24656
+ });
24657
+ if (typeof signature2 !== "string") {
24658
+ throw new Error("RPC signer did not return a signature string.");
24659
+ }
24660
+ return { signature: signature2 };
24661
+ }
24662
+ if (!wallet.signTypedData) {
24663
+ throw new Error("Viem signer does not support signTypedData.");
24664
+ }
24665
+ const signature = await wallet.signTypedData({
24666
+ domain: typedData.domain,
24667
+ types: typedData.types,
24668
+ primaryType: typedData.primaryType,
24669
+ message: typedData.message
24670
+ });
24671
+ return { signature };
24672
+ }
24295
24673
  };
24296
24674
  }
24297
- function mapCosmosStakingV1beta1MsgBeginRedelegate(input, label = "value") {
24298
- const record2 = asRecord(input);
24299
- const prefix = label ? `${label}.` : "";
24675
+ function createEthersSigner(signer) {
24676
+ const sign = signer.signTypedData ?? signer._signTypedData;
24677
+ if (!sign) {
24678
+ throw new Error("Ethers signer must implement signTypedData or _signTypedData.");
24679
+ }
24300
24680
  return {
24301
- delegatorAddress: requireString(record2["delegatorAddress"], `${prefix}delegatorAddress`),
24302
- validatorSrcAddress: requireString(
24303
- record2["validatorSrcAddress"],
24304
- `${prefix}validatorSrcAddress`
24305
- ),
24306
- validatorDstAddress: requireString(
24307
- record2["validatorDstAddress"],
24308
- `${prefix}validatorDstAddress`
24309
- ),
24310
- amount: mapCosmosBaseV1beta1Coin(asRecord(record2["amount"]), `${prefix}amount`)
24681
+ [AULT_SIGNER_MARKER]: true,
24682
+ getAddress: () => signer.getAddress(),
24683
+ signTypedData: async (typedData) => {
24684
+ const types = stripEip712Domain(typedData.types);
24685
+ const signature = await sign(typedData.domain, types, typedData.message);
24686
+ return { signature };
24687
+ }
24311
24688
  };
24312
24689
  }
24313
- function mapCosmosStakingV1beta1MsgDelegate(input, label = "value") {
24314
- const record2 = asRecord(input);
24315
- const prefix = label ? `${label}.` : "";
24690
+ function createPrivySigner(options) {
24316
24691
  return {
24317
- delegatorAddress: requireString(record2["delegatorAddress"], `${prefix}delegatorAddress`),
24318
- validatorAddress: requireString(record2["validatorAddress"], `${prefix}validatorAddress`),
24319
- amount: mapCosmosBaseV1beta1Coin(asRecord(record2["amount"]), `${prefix}amount`)
24692
+ [AULT_SIGNER_MARKER]: true,
24693
+ address: options.address,
24694
+ signTypedData: (typedData) => options.signTypedData(typedData, options.address ? { address: options.address } : void 0)
24320
24695
  };
24321
24696
  }
24322
- function mapCosmosStakingV1beta1MsgUndelegate(input, label = "value") {
24323
- const record2 = asRecord(input);
24324
- const prefix = label ? `${label}.` : "";
24325
- return {
24326
- delegatorAddress: requireString(record2["delegatorAddress"], `${prefix}delegatorAddress`),
24327
- validatorAddress: requireString(record2["validatorAddress"], `${prefix}validatorAddress`),
24328
- amount: mapCosmosBaseV1beta1Coin(asRecord(record2["amount"]), `${prefix}amount`)
24329
- };
24697
+ function createPrivateKeySigner(privateKey) {
24698
+ const normalized = privateKey.startsWith("0x") ? privateKey : `0x${privateKey}`;
24699
+ const account = privateKeyToAccount(normalized);
24700
+ return createViemSigner(account);
24330
24701
  }
24331
- function mapGoogleProtobufAny(input, label = "value") {
24332
- const record2 = asRecord(input);
24333
- const prefix = label ? `${label}.` : "";
24334
- return {
24335
- typeUrl: requireString(record2["typeUrl"], `${prefix}typeUrl`),
24336
- value: requireBytes(record2["value"], `${prefix}value`)
24337
- };
24702
+
24703
+ // src/utils/tx-hash.ts
24704
+ function normalizeTxHash(raw) {
24705
+ if (!raw) return raw;
24706
+ const stripped = raw.startsWith("0x") || raw.startsWith("0X") ? raw.slice(2) : raw;
24707
+ return stripped.toLowerCase();
24338
24708
  }
24339
- var MSG_ENCODERS = {
24340
- "/ault.accountx.v1.MsgOpenAccount": (value) => MsgOpenAccount.encode(
24341
- MsgOpenAccount.fromPartial(mapAultAccountxV1MsgOpenAccount(value))
24342
- ).finish(),
24343
- "/ault.accountx.v1.MsgUpdateFeeTiers": (value) => MsgUpdateFeeTiers.encode(
24344
- MsgUpdateFeeTiers.fromPartial(mapAultAccountxV1MsgUpdateFeeTiers(value))
24345
- ).finish(),
24346
- "/ault.accountx.v1.MsgUpdateParams": (value) => MsgUpdateParams.encode(
24347
- MsgUpdateParams.fromPartial(mapAultAccountxV1MsgUpdateParams(value))
24348
- ).finish(),
24349
- "/ault.accountx.v1.MsgUpdateTradingTiers": (value) => MsgUpdateTradingTiers.encode(
24350
- MsgUpdateTradingTiers.fromPartial(mapAultAccountxV1MsgUpdateTradingTiers(value))
24351
- ).finish(),
24352
- "/ault.agent.v1.MsgApproveAgent": (value) => MsgApproveAgent.encode(
24353
- MsgApproveAgent.fromPartial(mapAultAgentV1MsgApproveAgent(value))
24354
- ).finish(),
24355
- "/ault.agent.v1.MsgRevokeAgent": (value) => MsgRevokeAgent.encode(MsgRevokeAgent.fromPartial(mapAultAgentV1MsgRevokeAgent(value))).finish(),
24356
- "/ault.agent.v1.MsgUpdateParams": (value) => MsgUpdateParams2.encode(
24357
- MsgUpdateParams2.fromPartial(mapAultAgentV1MsgUpdateParams(value))
24358
- ).finish(),
24359
- "/ault.authority.v1.MsgGrantRole": (value) => MsgGrantRole.encode(MsgGrantRole.fromPartial(mapAultAuthorityV1MsgGrantRole(value))).finish(),
24360
- "/ault.authority.v1.MsgRevokeRole": (value) => MsgRevokeRole.encode(
24361
- MsgRevokeRole.fromPartial(mapAultAuthorityV1MsgRevokeRole(value))
24362
- ).finish(),
24363
- "/ault.clob.v1.MsgCancelOrders": (value) => MsgCancelOrders.encode(
24364
- MsgCancelOrders.fromPartial(mapAultClobV1MsgCancelOrders(value))
24365
- ).finish(),
24366
- "/ault.clob.v1.MsgModifyOrders": (value) => MsgModifyOrders.encode(
24367
- MsgModifyOrders.fromPartial(mapAultClobV1MsgModifyOrders(value))
24368
- ).finish(),
24369
- "/ault.clob.v1.MsgPlaceLimitOrder": (value) => MsgPlaceLimitOrder.encode(
24370
- MsgPlaceLimitOrder.fromPartial(mapAultClobV1MsgPlaceLimitOrder(value))
24371
- ).finish(),
24372
- "/ault.clob.v1.MsgPlaceMarketOrder": (value) => MsgPlaceMarketOrder.encode(
24373
- MsgPlaceMarketOrder.fromPartial(mapAultClobV1MsgPlaceMarketOrder(value))
24374
- ).finish(),
24375
- "/ault.clob.v1.MsgPlaceScaleOrder": (value) => MsgPlaceScaleOrder.encode(
24376
- MsgPlaceScaleOrder.fromPartial(mapAultClobV1MsgPlaceScaleOrder(value))
24377
- ).finish(),
24378
- "/ault.clob.v1.MsgPlaceTwapOrder": (value) => MsgPlaceTwapOrder.encode(
24379
- MsgPlaceTwapOrder.fromPartial(mapAultClobV1MsgPlaceTwapOrder(value))
24380
- ).finish(),
24381
- "/ault.clob.v1.MsgUpdateParams": (value) => MsgUpdateParams3.encode(
24382
- MsgUpdateParams3.fromPartial(mapAultClobV1MsgUpdateParams(value))
24383
- ).finish(),
24384
- "/ault.license.v1.MsgApproveMember": (value) => MsgApproveMember.encode(
24385
- MsgApproveMember.fromPartial(mapAultLicenseV1MsgApproveMember(value))
24386
- ).finish(),
24387
- "/ault.license.v1.MsgBatchApproveMember": (value) => MsgBatchApproveMember.encode(
24388
- MsgBatchApproveMember.fromPartial(mapAultLicenseV1MsgBatchApproveMember(value))
24389
- ).finish(),
24390
- "/ault.license.v1.MsgBatchMintLicense": (value) => MsgBatchMintLicense.encode(
24391
- MsgBatchMintLicense.fromPartial(mapAultLicenseV1MsgBatchMintLicense(value))
24392
- ).finish(),
24393
- "/ault.license.v1.MsgBatchRevokeMember": (value) => MsgBatchRevokeMember.encode(
24394
- MsgBatchRevokeMember.fromPartial(mapAultLicenseV1MsgBatchRevokeMember(value))
24395
- ).finish(),
24396
- "/ault.license.v1.MsgBurnLicense": (value) => MsgBurnLicense.encode(
24397
- MsgBurnLicense.fromPartial(mapAultLicenseV1MsgBurnLicense(value))
24398
- ).finish(),
24399
- "/ault.license.v1.MsgMintLicense": (value) => MsgMintLicense.encode(
24400
- MsgMintLicense.fromPartial(mapAultLicenseV1MsgMintLicense(value))
24401
- ).finish(),
24402
- "/ault.license.v1.MsgRevokeLicense": (value) => MsgRevokeLicense.encode(
24403
- MsgRevokeLicense.fromPartial(mapAultLicenseV1MsgRevokeLicense(value))
24404
- ).finish(),
24405
- "/ault.license.v1.MsgRevokeMember": (value) => MsgRevokeMember.encode(
24406
- MsgRevokeMember.fromPartial(mapAultLicenseV1MsgRevokeMember(value))
24407
- ).finish(),
24408
- "/ault.license.v1.MsgSetKYCApprovers": (value) => MsgSetKYCApprovers.encode(
24409
- MsgSetKYCApprovers.fromPartial(mapAultLicenseV1MsgSetKYCApprovers(value))
24410
- ).finish(),
24411
- "/ault.license.v1.MsgSetMinters": (value) => MsgSetMinters.encode(MsgSetMinters.fromPartial(mapAultLicenseV1MsgSetMinters(value))).finish(),
24412
- "/ault.license.v1.MsgSetTokenURI": (value) => MsgSetTokenURI.encode(
24413
- MsgSetTokenURI.fromPartial(mapAultLicenseV1MsgSetTokenURI(value))
24414
- ).finish(),
24415
- "/ault.license.v1.MsgTransferLicense": (value) => MsgTransferLicense.encode(
24416
- MsgTransferLicense.fromPartial(mapAultLicenseV1MsgTransferLicense(value))
24417
- ).finish(),
24418
- "/ault.license.v1.MsgUpdateParams": (value) => MsgUpdateParams4.encode(
24419
- MsgUpdateParams4.fromPartial(mapAultLicenseV1MsgUpdateParams(value))
24420
- ).finish(),
24421
- "/ault.market.v1.MsgCreateMarket": (value) => MsgCreateMarket.encode(
24422
- MsgCreateMarket.fromPartial(mapAultMarketV1MsgCreateMarket(value))
24423
- ).finish(),
24424
- "/ault.market.v1.MsgHaltAllMarkets": (value) => MsgHaltAllMarkets.encode(
24425
- MsgHaltAllMarkets.fromPartial(mapAultMarketV1MsgHaltAllMarkets(value))
24426
- ).finish(),
24427
- "/ault.market.v1.MsgHaltMarkets": (value) => MsgHaltMarkets.encode(
24428
- MsgHaltMarkets.fromPartial(mapAultMarketV1MsgHaltMarkets(value))
24429
- ).finish(),
24430
- "/ault.market.v1.MsgResumeAllMarkets": (value) => MsgResumeAllMarkets.encode(
24431
- MsgResumeAllMarkets.fromPartial(mapAultMarketV1MsgResumeAllMarkets(value))
24432
- ).finish(),
24433
- "/ault.market.v1.MsgResumeMarkets": (value) => MsgResumeMarkets.encode(
24434
- MsgResumeMarkets.fromPartial(mapAultMarketV1MsgResumeMarkets(value))
24435
- ).finish(),
24436
- "/ault.market.v1.MsgUpdateMarket": (value) => MsgUpdateMarket.encode(
24437
- MsgUpdateMarket.fromPartial(mapAultMarketV1MsgUpdateMarket(value))
24438
- ).finish(),
24439
- "/ault.market.v1.MsgUpdateMarketDeployer": (value) => MsgUpdateMarketDeployer.encode(
24440
- MsgUpdateMarketDeployer.fromPartial(mapAultMarketV1MsgUpdateMarketDeployer(value))
24441
- ).finish(),
24442
- "/ault.market.v1.MsgUpdateParams": (value) => MsgUpdateParams5.encode(
24443
- MsgUpdateParams5.fromPartial(mapAultMarketV1MsgUpdateParams(value))
24444
- ).finish(),
24445
- "/ault.miner.v1.MsgBatchSubmitWork": (value) => MsgBatchSubmitWork.encode(
24446
- MsgBatchSubmitWork.fromPartial(mapAultMinerV1MsgBatchSubmitWork(value))
24447
- ).finish(),
24448
- "/ault.miner.v1.MsgCancelMiningDelegation": (value) => MsgCancelMiningDelegation.encode(
24449
- MsgCancelMiningDelegation.fromPartial(mapAultMinerV1MsgCancelMiningDelegation(value))
24450
- ).finish(),
24451
- "/ault.miner.v1.MsgDelegateMining": (value) => MsgDelegateMining.encode(
24452
- MsgDelegateMining.fromPartial(mapAultMinerV1MsgDelegateMining(value))
24453
- ).finish(),
24454
- "/ault.miner.v1.MsgRedelegateMining": (value) => MsgRedelegateMining.encode(
24455
- MsgRedelegateMining.fromPartial(mapAultMinerV1MsgRedelegateMining(value))
24456
- ).finish(),
24457
- "/ault.miner.v1.MsgRegisterOperator": (value) => MsgRegisterOperator.encode(
24458
- MsgRegisterOperator.fromPartial(mapAultMinerV1MsgRegisterOperator(value))
24459
- ).finish(),
24460
- "/ault.miner.v1.MsgSetOwnerVrfKey": (value) => MsgSetOwnerVrfKey.encode(
24461
- MsgSetOwnerVrfKey.fromPartial(mapAultMinerV1MsgSetOwnerVrfKey(value))
24462
- ).finish(),
24463
- "/ault.miner.v1.MsgSubmitWork": (value) => MsgSubmitWork.encode(MsgSubmitWork.fromPartial(mapAultMinerV1MsgSubmitWork(value))).finish(),
24464
- "/ault.miner.v1.MsgUnregisterOperator": (value) => MsgUnregisterOperator.encode(
24465
- MsgUnregisterOperator.fromPartial(mapAultMinerV1MsgUnregisterOperator(value))
24466
- ).finish(),
24467
- "/ault.miner.v1.MsgUpdateOperatorInfo": (value) => MsgUpdateOperatorInfo.encode(
24468
- MsgUpdateOperatorInfo.fromPartial(mapAultMinerV1MsgUpdateOperatorInfo(value))
24469
- ).finish(),
24470
- "/ault.miner.v1.MsgUpdateParams": (value) => MsgUpdateParams6.encode(
24471
- MsgUpdateParams6.fromPartial(mapAultMinerV1MsgUpdateParams(value))
24472
- ).finish(),
24473
- "/ault.ratelimit.v1.MsgUpdateParams": (value) => MsgUpdateParams7.encode(
24474
- MsgUpdateParams7.fromPartial(mapAultRatelimitV1MsgUpdateParams(value))
24475
- ).finish(),
24476
- "/ault.reward.v1.MsgApproveBuilder": (value) => MsgApproveBuilder.encode(
24477
- MsgApproveBuilder.fromPartial(mapAultRewardV1MsgApproveBuilder(value))
24478
- ).finish(),
24479
- "/ault.reward.v1.MsgRevokeBuilder": (value) => MsgRevokeBuilder.encode(
24480
- MsgRevokeBuilder.fromPartial(mapAultRewardV1MsgRevokeBuilder(value))
24481
- ).finish(),
24482
- "/ault.reward.v1.MsgSetDeployerShare": (value) => MsgSetDeployerShare.encode(
24483
- MsgSetDeployerShare.fromPartial(mapAultRewardV1MsgSetDeployerShare(value))
24484
- ).finish(),
24485
- "/ault.reward.v1.MsgSetReferral": (value) => MsgSetReferral.encode(
24486
- MsgSetReferral.fromPartial(mapAultRewardV1MsgSetReferral(value))
24487
- ).finish(),
24488
- "/ault.reward.v1.MsgSetReferralCode": (value) => MsgSetReferralCode.encode(
24489
- MsgSetReferralCode.fromPartial(mapAultRewardV1MsgSetReferralCode(value))
24490
- ).finish(),
24491
- "/ault.reward.v1.MsgUpdateEligibleReferrers": (value) => MsgUpdateEligibleReferrers.encode(
24492
- MsgUpdateEligibleReferrers.fromPartial(mapAultRewardV1MsgUpdateEligibleReferrers(value))
24493
- ).finish(),
24494
- "/ault.reward.v1.MsgUpdateFeeTierDiscounts": (value) => MsgUpdateFeeTierDiscounts.encode(
24495
- MsgUpdateFeeTierDiscounts.fromPartial(mapAultRewardV1MsgUpdateFeeTierDiscounts(value))
24496
- ).finish(),
24497
- "/ault.reward.v1.MsgUpdateParams": (value) => MsgUpdateParams8.encode(
24498
- MsgUpdateParams8.fromPartial(mapAultRewardV1MsgUpdateParams(value))
24499
- ).finish(),
24500
- "/ault.reward.v1.MsgUpdateRefereeDiscountRate": (value) => MsgUpdateRefereeDiscountRate.encode(
24501
- MsgUpdateRefereeDiscountRate.fromPartial(mapAultRewardV1MsgUpdateRefereeDiscountRate(value))
24502
- ).finish(),
24503
- "/ault.reward.v1.MsgUpdateTradingTierBenefits": (value) => MsgUpdateTradingTierBenefits.encode(
24504
- MsgUpdateTradingTierBenefits.fromPartial(mapAultRewardV1MsgUpdateTradingTierBenefits(value))
24505
- ).finish(),
24506
- "/ault.tokenregistry.v1.MsgDisableTokenPair": (value) => MsgDisableTokenPair.encode(
24507
- MsgDisableTokenPair.fromPartial(mapAultTokenregistryV1MsgDisableTokenPair(value))
24508
- ).finish(),
24509
- "/ault.tokenregistry.v1.MsgDisableTransfers": (value) => MsgDisableTransfers.encode(
24510
- MsgDisableTransfers.fromPartial(mapAultTokenregistryV1MsgDisableTransfers(value))
24511
- ).finish(),
24512
- "/ault.tokenregistry.v1.MsgEnableTokenPair": (value) => MsgEnableTokenPair.encode(
24513
- MsgEnableTokenPair.fromPartial(mapAultTokenregistryV1MsgEnableTokenPair(value))
24514
- ).finish(),
24515
- "/ault.tokenregistry.v1.MsgEnableTransfers": (value) => MsgEnableTransfers.encode(
24516
- MsgEnableTransfers.fromPartial(mapAultTokenregistryV1MsgEnableTransfers(value))
24517
- ).finish(),
24518
- "/ault.tokenregistry.v1.MsgRegisterTokenPair": (value) => MsgRegisterTokenPair.encode(
24519
- MsgRegisterTokenPair.fromPartial(mapAultTokenregistryV1MsgRegisterTokenPair(value))
24520
- ).finish(),
24521
- "/ault.tokenregistry.v1.MsgRemoveTransferLimit": (value) => MsgRemoveTransferLimit.encode(
24522
- MsgRemoveTransferLimit.fromPartial(mapAultTokenregistryV1MsgRemoveTransferLimit(value))
24523
- ).finish(),
24524
- "/ault.tokenregistry.v1.MsgSetTransferLimit": (value) => MsgSetTransferLimit.encode(
24525
- MsgSetTransferLimit.fromPartial(mapAultTokenregistryV1MsgSetTransferLimit(value))
24526
- ).finish(),
24527
- "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward": (value) => MsgWithdrawDelegatorReward.encode(
24528
- MsgWithdrawDelegatorReward.fromPartial(
24529
- mapCosmosDistributionV1beta1MsgWithdrawDelegatorReward(value)
24530
- )
24531
- ).finish(),
24532
- "/cosmos.staking.v1beta1.MsgBeginRedelegate": (value) => MsgBeginRedelegate.encode(
24533
- MsgBeginRedelegate.fromPartial(mapCosmosStakingV1beta1MsgBeginRedelegate(value))
24534
- ).finish(),
24535
- "/cosmos.staking.v1beta1.MsgDelegate": (value) => MsgDelegate.encode(MsgDelegate.fromPartial(mapCosmosStakingV1beta1MsgDelegate(value))).finish(),
24536
- "/cosmos.staking.v1beta1.MsgUndelegate": (value) => MsgUndelegate.encode(
24537
- MsgUndelegate.fromPartial(mapCosmosStakingV1beta1MsgUndelegate(value))
24538
- ).finish()
24539
- };
24540
24709
 
24541
24710
  // src/eip712/sign-and-broadcast.ts
24542
24711
  async function queryAccount(network, address, fetchFn, fetchOptions) {
@@ -24595,6 +24764,9 @@ function createAccountCache() {
24595
24764
  function getNextSequence(sequence) {
24596
24765
  return String(BigInt(sequence) + 1n);
24597
24766
  }
24767
+ function isSequenceMismatch(rawLog) {
24768
+ return rawLog.includes("account sequence mismatch") || rawLog.includes("incorrect account sequence");
24769
+ }
24598
24770
  function clearCachedSequence(cache) {
24599
24771
  if (cache) {
24600
24772
  cache.nextSequence = null;
@@ -24697,6 +24869,8 @@ async function signAndBroadcastEip712({
24697
24869
  feeDenom,
24698
24870
  feeAmount,
24699
24871
  confirmationTimeoutMs,
24872
+ simulateGas = false,
24873
+ simulatedGasMultiplier,
24700
24874
  wait = true,
24701
24875
  fetchFn,
24702
24876
  fetchOptions,
@@ -24723,15 +24897,46 @@ async function signAndBroadcastEip712({
24723
24897
  if (!sequence) {
24724
24898
  throw new Error(`Unable to resolve account sequence for signer ${resolvedSignerAddress}.`);
24725
24899
  }
24726
- const resolvedGas = gasLimit ?? network.eip712GasLimit ?? GAS_CONSTANTS.EIP712_GAS_LIMIT;
24727
- const resolvedFeeAmount = feeAmount ?? network.eip712FeeAmount ?? await resolveDynamicFeeAmount(network, resolvedGas, feeMarketCache, fetchFn, fetchOptions);
24900
+ let resolvedGas = gasLimit ?? network.eip712GasLimit ?? GAS_CONSTANTS.EIP712_GAS_LIMIT;
24901
+ const resolvedFeeDenom = feeDenom ?? network.eip712FeeDenom ?? GAS_CONSTANTS.DENOM;
24902
+ const feeOverride = feeAmount ?? network.eip712FeeAmount;
24903
+ const feeFor = async (gas) => feeOverride ?? await resolveDynamicFeeAmount(network, gas, feeMarketCache, fetchFn, fetchOptions);
24904
+ let resolvedFeeAmount;
24905
+ if (simulateGas) {
24906
+ let simulated;
24907
+ try {
24908
+ simulated = await simulateTx({
24909
+ network,
24910
+ msgs,
24911
+ memo,
24912
+ sequence,
24913
+ pubkeyBase64: cache?.pubkeyBase64 ?? accountInfo?.pubkeyBase64 ?? null,
24914
+ placeholderGasLimit: resolvedGas,
24915
+ placeholderFee: { denom: resolvedFeeDenom, amount: await feeFor(resolvedGas) },
24916
+ fetchFn,
24917
+ fetchOptions
24918
+ });
24919
+ } catch (error) {
24920
+ if (error instanceof TxSimulationError && isSequenceMismatch(error.rawLog)) {
24921
+ clearCachedSequence(cache);
24922
+ }
24923
+ throw error;
24924
+ }
24925
+ if (simulated) {
24926
+ resolvedGas = computeSimulatedGas(
24927
+ simulated.gasUsed,
24928
+ simulatedGasMultiplier ?? GAS_CONSTANTS.SIMULATED_GAS_MULTIPLIER
24929
+ );
24930
+ }
24931
+ }
24932
+ resolvedFeeAmount = await feeFor(resolvedGas);
24728
24933
  const context = {
24729
24934
  chainId: network.chainId,
24730
24935
  accountNumber,
24731
24936
  sequence,
24732
24937
  fee: {
24733
24938
  amount: resolvedFeeAmount,
24734
- denom: feeDenom ?? network.eip712FeeDenom ?? GAS_CONSTANTS.DENOM,
24939
+ denom: resolvedFeeDenom,
24735
24940
  gas: resolvedGas
24736
24941
  },
24737
24942
  memo
@@ -25070,6 +25275,40 @@ function createParallelQueryApi(lowLevel) {
25070
25275
 
25071
25276
  // src/high-level/cloid-lookup.ts
25072
25277
  import { fromHex as fromHex2, toHex as toHex3 } from "@cosmjs/encoding";
25278
+
25279
+ // src/rest/pagination.ts
25280
+ var NEXT_CURSOR_HEADER = "X-Next-Cursor";
25281
+ async function* paginate(fetchPage, params = {}) {
25282
+ let cursor = params.cursor;
25283
+ const seen = new Set(cursor ? [cursor] : []);
25284
+ for (; ; ) {
25285
+ const res = await fetchPage(cursor ? { cursor } : {});
25286
+ if (res.status !== 200 || !Array.isArray(res.data)) {
25287
+ throw new ApiError(`paginated endpoint returned unexpected status ${res.status}`, res.status);
25288
+ }
25289
+ const next = res.headers.get(NEXT_CURSOR_HEADER);
25290
+ if (next && seen.has(next)) {
25291
+ throw new ApiError("pagination cursor repeated; aborting to prevent an infinite loop");
25292
+ }
25293
+ yield { rows: res.data, nextCursor: next };
25294
+ if (!next) return;
25295
+ seen.add(next);
25296
+ cursor = next;
25297
+ }
25298
+ }
25299
+ async function collectPages(fetchPage, max, params = {}) {
25300
+ if (!Number.isInteger(max) || max < 1) {
25301
+ throw new ApiError(`collectPages max must be a positive integer, got ${max}`);
25302
+ }
25303
+ const rows = [];
25304
+ for await (const page of paginate(fetchPage, params)) {
25305
+ rows.push(...page.rows);
25306
+ if (rows.length >= max) return rows.slice(0, max);
25307
+ }
25308
+ return rows;
25309
+ }
25310
+
25311
+ // src/high-level/cloid-lookup.ts
25073
25312
  function createCloidLookupApi(lowLevel) {
25074
25313
  async function findOrderByCloid(orderer, cloid) {
25075
25314
  const addr = normalizeAddress(orderer);
@@ -25083,20 +25322,30 @@ function createCloidLookupApi(lowLevel) {
25083
25322
  return { source: "chain-twap", order: chain.twap };
25084
25323
  }
25085
25324
  const wantHex = toHex3(bytes);
25086
- const LIMIT = 200;
25087
- const res = await lowLevel.rest.dex.listOrders({ address: addr, cloid: wantHex, limit: LIMIT });
25088
- if (res.status !== 200) {
25089
- throw new Error(`dex-api listOrders returned unexpected status ${res.status}`);
25090
- }
25091
- const orders = res.data.filter((o) => o.clientOrderId?.toLowerCase() === wantHex);
25092
- if (orders.length === 0) {
25093
- return { source: "none", order: null };
25325
+ const LIMIT = 500;
25326
+ const MAX_PAGES = 10;
25327
+ const orders = [];
25328
+ let exhausted = false;
25329
+ let pages = 0;
25330
+ for await (const page of paginate(
25331
+ (p) => lowLevel.rest.dex.listOrders({ address: addr, cloid: wantHex, limit: LIMIT, ...p })
25332
+ )) {
25333
+ orders.push(...page.rows.filter((o) => o.clientOrderId?.toLowerCase() === wantHex));
25334
+ pages += 1;
25335
+ if (!page.nextCursor) {
25336
+ exhausted = true;
25337
+ break;
25338
+ }
25339
+ if (pages >= MAX_PAGES) break;
25094
25340
  }
25095
- if (res.data.length >= LIMIT) {
25341
+ if (!exhausted) {
25096
25342
  throw new Error(
25097
- `cloid ${wantHex} has too many historical matches to disambiguate (>= ${LIMIT}); dex-api needs a canonical (orderer, cloid) latest lookup`
25343
+ `cloid ${wantHex} has too many historical matches to disambiguate (> ${MAX_PAGES * LIMIT} rows); dex-api needs a canonical (orderer, cloid) latest lookup`
25098
25344
  );
25099
25345
  }
25346
+ if (orders.length === 0) {
25347
+ return { source: "none", order: null };
25348
+ }
25100
25349
  const order = orders.reduce((latest, next) => {
25101
25350
  if (next.timestamp !== latest.timestamp) {
25102
25351
  return next.timestamp > latest.timestamp ? next : latest;
@@ -26352,6 +26601,13 @@ function createRewardTxApi({ signerAddress, exec, getGas }) {
26352
26601
  }
26353
26602
 
26354
26603
  // src/high-level/tx/staking.ts
26604
+ function stakingGasOptions(gas, fallbackMinGas, gasLimit) {
26605
+ return {
26606
+ gasLimit: gasLimit ?? computeFeeFreeGas(fallbackMinGas, 1, gas.FEE_FREE_GAS_MULTIPLIER),
26607
+ simulateGas: gasLimit == null,
26608
+ simulatedGasMultiplier: gas.SIMULATED_GAS_MULTIPLIER
26609
+ };
26610
+ }
26355
26611
  function createStakingTxApi({ signerAddress, exec, getGas }) {
26356
26612
  return {
26357
26613
  async delegate({ validatorAddress, amount, gasLimit, feeAmount, memo, confirmationTimeoutMs }) {
@@ -26365,7 +26621,7 @@ function createStakingTxApi({ signerAddress, exec, getGas }) {
26365
26621
  })
26366
26622
  ],
26367
26623
  {
26368
- gasLimit: gasLimit ?? computeFeeFreeGas(gas.DELEGATE, 1, gas.FEE_FREE_GAS_MULTIPLIER),
26624
+ ...stakingGasOptions(gas, gas.DELEGATE, gasLimit),
26369
26625
  feeAmount,
26370
26626
  memo,
26371
26627
  confirmationTimeoutMs
@@ -26390,7 +26646,7 @@ function createStakingTxApi({ signerAddress, exec, getGas }) {
26390
26646
  })
26391
26647
  ],
26392
26648
  {
26393
- gasLimit: gasLimit ?? computeFeeFreeGas(gas.UNDELEGATE, 1, gas.FEE_FREE_GAS_MULTIPLIER),
26649
+ ...stakingGasOptions(gas, gas.UNDELEGATE, gasLimit),
26394
26650
  feeAmount,
26395
26651
  memo,
26396
26652
  confirmationTimeoutMs
@@ -26417,7 +26673,7 @@ function createStakingTxApi({ signerAddress, exec, getGas }) {
26417
26673
  })
26418
26674
  ],
26419
26675
  {
26420
- gasLimit: gasLimit ?? computeFeeFreeGas(gas.BEGIN_REDELEGATE, 1, gas.FEE_FREE_GAS_MULTIPLIER),
26676
+ ...stakingGasOptions(gas, gas.BEGIN_REDELEGATE, gasLimit),
26421
26677
  feeAmount,
26422
26678
  memo,
26423
26679
  confirmationTimeoutMs
@@ -26436,7 +26692,7 @@ function createStakingTxApi({ signerAddress, exec, getGas }) {
26436
26692
  }
26437
26693
  const normalized = validatorAddresses.map(assertValidatorAddress);
26438
26694
  const gas = getGas();
26439
- const resolvedGasLimit = gasLimit ?? computeFeeFreeGas(gas.WITHDRAW_DELEGATOR_REWARD, 1, gas.FEE_FREE_GAS_MULTIPLIER);
26695
+ const gasOptions = stakingGasOptions(gas, gas.WITHDRAW_DELEGATOR_REWARD, gasLimit);
26440
26696
  const results = [];
26441
26697
  const partial = [];
26442
26698
  for (let i = 0; i < normalized.length; i++) {
@@ -26449,7 +26705,7 @@ function createStakingTxApi({ signerAddress, exec, getGas }) {
26449
26705
  validatorAddress
26450
26706
  })
26451
26707
  ],
26452
- { gasLimit: resolvedGasLimit, feeAmount, memo, confirmationTimeoutMs }
26708
+ { ...gasOptions, feeAmount, memo, confirmationTimeoutMs }
26453
26709
  );
26454
26710
  results.push(result);
26455
26711
  partial.push({ txHash: result.txHash, validatorAddress });
@@ -26638,6 +26894,8 @@ function createTxExecutor(options) {
26638
26894
  feeAmount: txOptions?.feeAmount,
26639
26895
  memo: txOptions?.memo ?? defaultMemo,
26640
26896
  confirmationTimeoutMs: txOptions?.confirmationTimeoutMs ?? defaultConfirmationTimeoutMs,
26897
+ simulateGas: txOptions?.simulateGas ?? false,
26898
+ simulatedGasMultiplier: txOptions?.simulatedGasMultiplier,
26641
26899
  wait: txOptions?.wait ?? true,
26642
26900
  fetchFn: options.fetchFn,
26643
26901
  fetchOptions,
@@ -26660,6 +26918,8 @@ function createTxExecutor(options) {
26660
26918
  import { z } from "zod";
26661
26919
  var ManifestGasSchema = z.object({
26662
26920
  FEE_FREE_GAS_MULTIPLIER: z.number().int().positive(),
26921
+ // Under 100% signs less gas than the simulation already burned.
26922
+ SIMULATED_GAS_MULTIPLIER: z.number().int().min(100),
26663
26923
  PER_LICENSE: z.number().int().positive(),
26664
26924
  PER_KYC_MEMBER: z.number().int().positive(),
26665
26925
  PER_DELEGATE_MINING: z.number().int().positive(),
@@ -27466,15 +27726,18 @@ var PageResponseSchema = z3.object({
27466
27726
  // src/rest/dex-types.generated.ts
27467
27727
  import * as zod from "zod";
27468
27728
  var GetHealthResponse = zod.object({
27469
- status: zod.enum(["healthy", "unhealthy"]),
27470
- database: zod.enum(["ok", "unreachable"])
27729
+ status: zod.enum(["healthy"])
27471
27730
  });
27472
27731
  var GetReadyResponse = zod.object({
27473
- status: zod.enum(["ready", "not ready"])
27732
+ status: zod.enum(["ready"])
27474
27733
  });
27475
27734
  var GetLiveResponse = zod.object({
27476
27735
  status: zod.enum(["alive"])
27477
27736
  });
27737
+ var GetDBReadyResponse = zod.object({
27738
+ status: zod.enum(["ok", "unavailable"]),
27739
+ database: zod.enum(["ok", "unreachable"])
27740
+ });
27478
27741
  var GetStatusResponse = zod.object({
27479
27742
  last_indexed_height: zod.number(),
27480
27743
  last_indexed_at: zod.iso.datetime({})
@@ -27566,6 +27829,8 @@ var ListMarketsResponseItem = zod.object({
27566
27829
  )
27567
27830
  });
27568
27831
  var ListMarketsResponse = zod.array(ListMarketsResponseItem);
27832
+ var listCurrenciesResponseInfoContractDecimalsMin = 0;
27833
+ var listCurrenciesResponseInfoContractDecimalsMax = 255;
27569
27834
  var ListCurrenciesResponse = zod.record(
27570
27835
  zod.string(),
27571
27836
  zod.object({
@@ -27576,7 +27841,9 @@ var ListCurrenciesResponse = zod.record(
27576
27841
  deposit: zod.boolean().nullish(),
27577
27842
  withdraw: zod.boolean().nullish(),
27578
27843
  fee: zod.number().nullish(),
27579
- precision: zod.number(),
27844
+ precision: zod.number().describe(
27845
+ "The DEX trading precision \u2014 always 18: every amount on every\nendpoint (balances, orders, trades, portfolio) is normalized to\n18-decimal units regardless of the token contract's own\ndecimals. The raw contract decimals are available in\n`info.contractDecimals`.\n"
27846
+ ),
27580
27847
  limits: zod.object({
27581
27848
  amount: zod.object({
27582
27849
  min: zod.number().nullish(),
@@ -27588,7 +27855,11 @@ var ListCurrenciesResponse = zod.record(
27588
27855
  }).optional()
27589
27856
  }),
27590
27857
  networks: zod.looseObject({}).optional(),
27591
- info: zod.looseObject({})
27858
+ info: zod.object({
27859
+ contractDecimals: zod.number().min(listCurrenciesResponseInfoContractDecimalsMin).max(listCurrenciesResponseInfoContractDecimalsMax).describe(
27860
+ "The token contract's own decimals (raw ERC20 decimals). Amounts\non the API are NOT in these units \u2014 see `precision`.\n"
27861
+ )
27862
+ })
27592
27863
  })
27593
27864
  );
27594
27865
  var GetTickerParams = zod.object({
@@ -27682,11 +27953,20 @@ var GetOrderbookResponse = zod.object({
27682
27953
  var ListTradesParams = zod.object({
27683
27954
  symbol: zod.string().describe("URL-encoded trading pair (e.g., `AULT%2FUSDT`)")
27684
27955
  });
27685
- var listTradesQueryLimitDefault = 50;
27956
+ var listTradesQueryLimitDefault = 100;
27686
27957
  var listTradesQueryLimitMax = 500;
27958
+ var listTradesQueryBeforeIndexMin = 0;
27959
+ var listTradesQueryBeforeIndexMax = 4294967295;
27687
27960
  var ListTradesQueryParams = zod.object({
27688
27961
  limit: zod.number().min(1).max(listTradesQueryLimitMax).default(listTradesQueryLimitDefault),
27689
- since: zod.number().optional().describe("Unix timestamp in milliseconds")
27962
+ since: zod.number().optional().describe("Unix timestamp in milliseconds"),
27963
+ cursor: zod.string().optional().describe(
27964
+ 'Opaque pagination cursor. Take it verbatim from the previous page\'s\n`X-Next-Cursor` header (or follow the `Link: rel="next"` URL) and\nrepeat every other query parameter; the cursor is bound to that\nfilter set and a different one is rejected with 400. `limit` may\nchange between pages. No `X-Next-Cursor` on a response means the\nfeed is exhausted. Clients must not build or parse cursors.\n'
27965
+ ),
27966
+ before_height: zod.number().min(1).optional().describe(
27967
+ "Deprecated in favour of `cursor`; still honoured, and ignored when\n`cursor` is also present.\n\nComposite pagination cursor, upper half. Returns only trades\nstrictly older (in feed order) than the row identified by\n(`before_height`, `before_index`) \u2014 take both values from the\nlast row's `info.block_height` / `info.event_index`. Must be\npassed together with `before_index`. Unlike `since`, the cursor\ncannot skip or repeat trades when many share one timestamp.\n"
27968
+ ),
27969
+ before_index: zod.number().min(listTradesQueryBeforeIndexMin).max(listTradesQueryBeforeIndexMax).optional().describe("Composite pagination cursor, lower half. See `before_height`.")
27690
27970
  });
27691
27971
  var listTradesResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27692
27972
  var listTradesResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -27696,6 +27976,7 @@ var listTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27696
27976
  var listTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
27697
27977
  var listTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
27698
27978
  var listTradesResponseInfoEventIndexMin = 0;
27979
+ var listTradesResponseInfoEventIndexMax = 4294967295;
27699
27980
  var ListTradesResponseItem = zod.object({
27700
27981
  id: zod.string(),
27701
27982
  order: zod.string().nullish(),
@@ -27705,10 +27986,11 @@ var ListTradesResponseItem = zod.object({
27705
27986
  type: zod.union([
27706
27987
  zod.literal("limit"),
27707
27988
  zod.literal("market"),
27989
+ zod.literal("twap"),
27708
27990
  zod.literal("unknown"),
27709
27991
  zod.literal(null)
27710
27992
  ]).nullish().describe(
27711
- "Order type resolved via JOIN to orders table. Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
27993
+ "Order type resolved via JOIN to orders table. `twap` marks a TWAP slice execution (chain code 2). Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
27712
27994
  ),
27713
27995
  cloid: zod.string().nullish().describe(
27714
27996
  "Client order id (hex, 8 bytes) resolved via JOIN to orders table. Null when the order carried none, the row predates cloid indexing, or on the public trades feed (cloids are private to the orderer)."
@@ -27742,8 +28024,8 @@ var ListTradesResponseItem = zod.object({
27742
28024
  "Atto-precision amount the orderer received for this fill,\nsuffixed with the chain denom. Empty string when the chain did\nnot record this side.\n"
27743
28025
  ),
27744
28026
  block_height: zod.string().regex(listTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
27745
- event_index: zod.number().min(listTradesResponseInfoEventIndexMin).describe(
27746
- "The trade's event position within its block. Together with\n`block_height` it is the row's composite pagination cursor for the\ntrade feed. `created_at` cannot serve this role because every trade\nin a block shares one timestamp.\n"
28027
+ event_index: zod.number().min(listTradesResponseInfoEventIndexMin).max(listTradesResponseInfoEventIndexMax).describe(
28028
+ "The trade's event position within its block. With `block_height`\nit forms the row's composite pagination cursor: pass the last\nrow's pair as `before_height`/`before_index` to fetch the next\n(older) page.\n"
27747
28029
  )
27748
28030
  }).describe(
27749
28031
  "Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
@@ -27769,6 +28051,7 @@ var getTradeResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27769
28051
  var getTradeResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
27770
28052
  var getTradeResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
27771
28053
  var getTradeResponseInfoEventIndexMin = 0;
28054
+ var getTradeResponseInfoEventIndexMax = 4294967295;
27772
28055
  var GetTradeResponse = zod.object({
27773
28056
  id: zod.string(),
27774
28057
  order: zod.string().nullish(),
@@ -27778,10 +28061,11 @@ var GetTradeResponse = zod.object({
27778
28061
  type: zod.union([
27779
28062
  zod.literal("limit"),
27780
28063
  zod.literal("market"),
28064
+ zod.literal("twap"),
27781
28065
  zod.literal("unknown"),
27782
28066
  zod.literal(null)
27783
28067
  ]).nullish().describe(
27784
- "Order type resolved via JOIN to orders table. Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
28068
+ "Order type resolved via JOIN to orders table. `twap` marks a TWAP slice execution (chain code 2). Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
27785
28069
  ),
27786
28070
  cloid: zod.string().nullish().describe(
27787
28071
  "Client order id (hex, 8 bytes) resolved via JOIN to orders table. Null when the order carried none, the row predates cloid indexing, or on the public trades feed (cloids are private to the orderer)."
@@ -27815,8 +28099,8 @@ var GetTradeResponse = zod.object({
27815
28099
  "Atto-precision amount the orderer received for this fill,\nsuffixed with the chain denom. Empty string when the chain did\nnot record this side.\n"
27816
28100
  ),
27817
28101
  block_height: zod.string().regex(getTradeResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
27818
- event_index: zod.number().min(getTradeResponseInfoEventIndexMin).describe(
27819
- "The trade's event position within its block. Together with\n`block_height` it is the row's composite pagination cursor for the\ntrade feed. `created_at` cannot serve this role because every trade\nin a block shares one timestamp.\n"
28102
+ event_index: zod.number().min(getTradeResponseInfoEventIndexMin).max(getTradeResponseInfoEventIndexMax).describe(
28103
+ "The trade's event position within its block. With `block_height`\nit forms the row's composite pagination cursor: pass the last\nrow's pair as `before_height`/`before_index` to fetch the next\n(older) page.\n"
27820
28104
  )
27821
28105
  }).describe(
27822
28106
  "Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
@@ -27838,7 +28122,7 @@ var GetTradingFeesResponse = zod.record(
27838
28122
  })
27839
28123
  );
27840
28124
  var GetStatsQueryParams = zod.object({
27841
- window: zod.enum(["24h"]).optional().describe("Rolling window. Only `24h` is supported; defaults to `24h`.")
28125
+ window: zod.enum(["24h", "7d", "30d", "all"]).optional().describe("Precomputed reporting window. Defaults to `24h`.")
27842
28126
  });
27843
28127
  var getStatsResponseTotalsQuoteVolumeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27844
28128
  var getStatsResponseTotalsEstimatedFeeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -27850,7 +28134,7 @@ var getStatsResponseMarketsItemBaseVolumeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$
27850
28134
  var getStatsResponseMarketsItemEstimatedFeeRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27851
28135
  var getStatsResponseMarketsItemTakerFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27852
28136
  var GetStatsResponse = zod.object({
27853
- window: zod.enum(["24h"]),
28137
+ window: zod.enum(["24h", "7d", "30d", "all"]),
27854
28138
  totals: zod.object({
27855
28139
  quoteVolume: zod.string().regex(getStatsResponseTotalsQuoteVolumeRegExp).nullable().describe(
27856
28140
  "Total quote volume over the window as a canonical decimal string.\nNull when contributing markets span more than one quote (then\n`estimatedFee` and `quoteAsset` are null too).\n"
@@ -27865,12 +28149,12 @@ var GetStatsResponse = zod.object({
27865
28149
  traderCount: zod.number().describe("Distinct trading addresses in the window."),
27866
28150
  activeMarkets: zod.number().describe("Number of markets with at least one fill in the window."),
27867
28151
  dailyActiveUsers: zod.number().nullable().describe(
27868
- "Distinct trading addresses in the window. Currently an alias of\n`traderCount`; separate so a precise DAU source can diverge later.\n"
28152
+ "Distinct trading addresses over 24 hours. An alias of\n`traderCount` for the `24h` response and null for longer windows;\nseparate so a precise DAU source can diverge later.\n"
27869
28153
  ),
27870
28154
  averageSlippageBps: zod.string().regex(getStatsResponseTotalsAverageSlippageBpsRegExp).nullable().describe(
27871
28155
  "Volume-weighted taker slippage (fill vs book-mid) in bps as a\ndecimal string. Null with no benchmarkable taker fill or when\nfills span more than one quote.\n"
27872
28156
  ),
27873
- depositUsdcVolume24h: zod.string().regex(getStatsResponseTotalsDepositUsdcVolume24hRegExp).nullable().describe("Reserved. Currently always null."),
28157
+ depositUsdcVolume24h: zod.string().regex(getStatsResponseTotalsDepositUsdcVolume24hRegExp).nullable().describe("24h USDC deposit volume when available; null for longer windows."),
27874
28158
  builderCodesFee24h: zod.string().regex(getStatsResponseTotalsBuilderCodesFee24hRegExp).nullable().describe("Reserved. Currently always null.")
27875
28159
  }).describe("Protocol-wide aggregates for the window."),
27876
28160
  markets: zod.array(
@@ -27892,8 +28176,8 @@ var listOrdersQueryAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
27892
28176
  var listOrdersQueryAddressTwoRegExp = new RegExp("^0x[a-f0-9]{40}$");
27893
28177
  var listOrdersQueryMarketIdRegExp = new RegExp("^[0-9a-fA-F]+$");
27894
28178
  var listOrdersQueryCloidRegExp = new RegExp("^([0-9a-fA-F]{16})?$");
27895
- var listOrdersQueryLimitDefault = 50;
27896
- var listOrdersQueryLimitMax = 200;
28179
+ var listOrdersQueryLimitDefault = 100;
28180
+ var listOrdersQueryLimitMax = 500;
27897
28181
  var ListOrdersQueryParams = zod.object({
27898
28182
  address: zod.union([
27899
28183
  zod.string().regex(listOrdersQueryAddressOneRegExp).describe(
@@ -27912,7 +28196,10 @@ var ListOrdersQueryParams = zod.object({
27912
28196
  "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"
27913
28197
  ),
27914
28198
  since: zod.number().optional().describe("Return orders created after this Unix timestamp (milliseconds)"),
27915
- limit: zod.number().min(1).max(listOrdersQueryLimitMax).default(listOrdersQueryLimitDefault)
28199
+ limit: zod.number().min(1).max(listOrdersQueryLimitMax).default(listOrdersQueryLimitDefault),
28200
+ cursor: zod.string().optional().describe(
28201
+ 'Opaque pagination cursor. Take it verbatim from the previous page\'s\n`X-Next-Cursor` header (or follow the `Link: rel="next"` URL) and\nrepeat every other query parameter; the cursor is bound to that\nfilter set and a different one is rejected with 400. `limit` may\nchange between pages. No `X-Next-Cursor` on a response means the\nfeed is exhausted. Clients must not build or parse cursors.\n'
28202
+ )
27916
28203
  });
27917
28204
  var listOrdersResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
27918
28205
  var listOrdersResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -27933,8 +28220,12 @@ var ListOrdersResponseItem = zod.object({
27933
28220
  lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
27934
28221
  status: zod.enum(["open", "closed", "canceled", "unknown"]).describe("`unknown` is the fallback for a chain status code the API doesn't recognize."),
27935
28222
  symbol: zod.string(),
27936
- type: zod.enum(["limit", "market", "twap", "unknown"]).describe("`unknown` is the fallback for a chain type code the API doesn't recognize."),
27937
- timeInForce: zod.string().nullish(),
28223
+ type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
28224
+ "`unknown` is the fallback for a chain type code the API doesn't recognize. A `twap` row (chain order_type=2) is a TWAP slice execution \u2014 the TWAP parent lives in `twap_orders` and is not returned by the order endpoints."
28225
+ ),
28226
+ timeInForce: zod.union([zod.literal("ioc"), zod.literal(null)]).nullable().describe(
28227
+ "CCXT-collapsed time-in-force. `ioc` for an immediate-or-cancel\norder (chain TIF code 1); null for the default (GTT/GTC) or an\nunrecognized code. Always present (never omitted). The WS\n`orderUpdates` payload exposes the same `ioc`-or-absent value.\n"
28228
+ ),
27938
28229
  side: zod.enum(["buy", "sell"]),
27939
28230
  price: zod.string().regex(listOrdersResponsePriceRegExp),
27940
28231
  average: zod.string().nullish().describe("Average execution price as decimal string. Null when filled is 0."),
@@ -27976,10 +28267,10 @@ var ListOrdersResponseItem = zod.object({
27976
28267
  "Granular chain-level status \u2014 the WS view exposes the same\nstring. The CCXT view at `OrderResponse.status` collapses these\ninto open | closed | canceled. `unknown` is the fallback for a\nchain code the API doesn't recognize.\n"
27977
28268
  ),
27978
28269
  chain_type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
27979
- "Granular chain-level order type. The CCXT view at\n`OrderResponse.type` collapses these into limit | market.\n`unknown` is the fallback for a chain code the API doesn't\nrecognize.\n"
28270
+ "Granular chain-level order type. Mirrors the dbindexer\n`orders.order_type` column (0=limit, 1=market, 2=twap). TWAP\nslice executions are stored as individual order rows and surface\nhere as `twap`. `unknown` is the fallback for a chain code the\nAPI doesn't recognize.\n"
27980
28271
  ),
27981
- close_reason: zod.string().nullish().describe(
27982
- "Free-form chain close reason for a terminal order \u2014 e.g.\n`completed`, `canceled`, `expired`, `ioc_canceled`, `self_trade`,\n`post_only_rejected`, `replaced`. Null while the order is still live.\n"
28272
+ close_reason: zod.string().nullable().describe(
28273
+ "Free-form chain close reason for a terminal order \u2014 e.g.\n`completed`, `canceled`, `expired`, `ioc_canceled`,\n`self_trade`, `post_only_rejected`, `replaced`. Null while the\norder is still live. Lets consumers tell an IOC-cancelled or\nself-trade-prevented close apart from the generic `canceled` close.\n"
27983
28274
  )
27984
28275
  }).describe(
27985
28276
  "Exchange-specific extension on `OrderResponse`. Mirrors the\n`info` map populated in `internal/domain/order/service.go`.\n"
@@ -28010,8 +28301,12 @@ var GetOrderResponse = zod.object({
28010
28301
  lastTradeTimestamp: zod.number().nullish().describe("Timestamp (ms) of the last trade executed against this order. Null if no trades."),
28011
28302
  status: zod.enum(["open", "closed", "canceled", "unknown"]).describe("`unknown` is the fallback for a chain status code the API doesn't recognize."),
28012
28303
  symbol: zod.string(),
28013
- type: zod.enum(["limit", "market", "twap", "unknown"]).describe("`unknown` is the fallback for a chain type code the API doesn't recognize."),
28014
- timeInForce: zod.string().nullish(),
28304
+ type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
28305
+ "`unknown` is the fallback for a chain type code the API doesn't recognize. A `twap` row (chain order_type=2) is a TWAP slice execution \u2014 the TWAP parent lives in `twap_orders` and is not returned by the order endpoints."
28306
+ ),
28307
+ timeInForce: zod.union([zod.literal("ioc"), zod.literal(null)]).nullable().describe(
28308
+ "CCXT-collapsed time-in-force. `ioc` for an immediate-or-cancel\norder (chain TIF code 1); null for the default (GTT/GTC) or an\nunrecognized code. Always present (never omitted). The WS\n`orderUpdates` payload exposes the same `ioc`-or-absent value.\n"
28309
+ ),
28015
28310
  side: zod.enum(["buy", "sell"]),
28016
28311
  price: zod.string().regex(getOrderResponsePriceRegExp),
28017
28312
  average: zod.string().nullish().describe("Average execution price as decimal string. Null when filled is 0."),
@@ -28053,10 +28348,10 @@ var GetOrderResponse = zod.object({
28053
28348
  "Granular chain-level status \u2014 the WS view exposes the same\nstring. The CCXT view at `OrderResponse.status` collapses these\ninto open | closed | canceled. `unknown` is the fallback for a\nchain code the API doesn't recognize.\n"
28054
28349
  ),
28055
28350
  chain_type: zod.enum(["limit", "market", "twap", "unknown"]).describe(
28056
- "Granular chain-level order type. The CCXT view at\n`OrderResponse.type` collapses these into limit | market.\n`unknown` is the fallback for a chain code the API doesn't\nrecognize.\n"
28351
+ "Granular chain-level order type. Mirrors the dbindexer\n`orders.order_type` column (0=limit, 1=market, 2=twap). TWAP\nslice executions are stored as individual order rows and surface\nhere as `twap`. `unknown` is the fallback for a chain code the\nAPI doesn't recognize.\n"
28057
28352
  ),
28058
- close_reason: zod.string().nullish().describe(
28059
- "Free-form chain close reason for a terminal order \u2014 e.g.\n`completed`, `canceled`, `expired`, `ioc_canceled`, `self_trade`,\n`post_only_rejected`, `replaced`. Null while the order is still live.\n"
28353
+ close_reason: zod.string().nullable().describe(
28354
+ "Free-form chain close reason for a terminal order \u2014 e.g.\n`completed`, `canceled`, `expired`, `ioc_canceled`,\n`self_trade`, `post_only_rejected`, `replaced`. Null while the\norder is still live. Lets consumers tell an IOC-cancelled or\nself-trade-prevented close apart from the generic `canceled` close.\n"
28060
28355
  )
28061
28356
  }).describe(
28062
28357
  "Exchange-specific extension on `OrderResponse`. Mirrors the\n`info` map populated in `internal/domain/order/service.go`.\n"
@@ -28064,13 +28359,22 @@ var GetOrderResponse = zod.object({
28064
28359
  }).describe(
28065
28360
  "All numeric fields (price, amount, filled, remaining, cost,\nfee.cost, fee.rate, average, triggerPrice, stopPrice) are canonical\ndecimal strings.\n"
28066
28361
  );
28067
- var listMyTradesQueryLimitDefault = 50;
28362
+ var listMyTradesQueryLimitDefault = 100;
28068
28363
  var listMyTradesQueryLimitMax = 500;
28364
+ var listMyTradesQueryBeforeIndexMin = 0;
28365
+ var listMyTradesQueryBeforeIndexMax = 4294967295;
28069
28366
  var ListMyTradesQueryParams = zod.object({
28070
28367
  address: zod.string().describe("Blockchain address of the trader"),
28071
28368
  symbol: zod.string().optional().describe("Symbol to filter by (e.g., AULT/USDT)"),
28072
28369
  since: zod.number().optional().describe("Unix timestamp in milliseconds"),
28073
- limit: zod.number().min(1).max(listMyTradesQueryLimitMax).default(listMyTradesQueryLimitDefault)
28370
+ limit: zod.number().min(1).max(listMyTradesQueryLimitMax).default(listMyTradesQueryLimitDefault),
28371
+ cursor: zod.string().optional().describe(
28372
+ 'Opaque pagination cursor. Take it verbatim from the previous page\'s\n`X-Next-Cursor` header (or follow the `Link: rel="next"` URL) and\nrepeat every other query parameter; the cursor is bound to that\nfilter set and a different one is rejected with 400. `limit` may\nchange between pages. No `X-Next-Cursor` on a response means the\nfeed is exhausted. Clients must not build or parse cursors.\n'
28373
+ ),
28374
+ before_height: zod.number().min(1).optional().describe(
28375
+ "Deprecated in favour of `cursor`; still honoured, and ignored when\n`cursor` is also present.\n\nComposite pagination cursor, upper half. Returns only trades\nstrictly older (in feed order) than the row identified by\n(`before_height`, `before_index`) \u2014 take both values from the\nlast row's `info.block_height` / `info.event_index`. Must be\npassed together with `before_index`. Unlike `since`, the cursor\ncannot skip or repeat trades when many share one timestamp.\n"
28376
+ ),
28377
+ before_index: zod.number().min(listMyTradesQueryBeforeIndexMin).max(listMyTradesQueryBeforeIndexMax).optional().describe("Composite pagination cursor, lower half. See `before_height`.")
28074
28378
  });
28075
28379
  var listMyTradesResponsePriceRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
28076
28380
  var listMyTradesResponseAmountRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
@@ -28080,6 +28384,7 @@ var listMyTradesResponseFeeRateRegExp = new RegExp("^-?\\d+(\\.\\d+)?$");
28080
28384
  var listMyTradesResponseInfoAddressOneRegExp = new RegExp("^ault1[a-z0-9]{38,}$");
28081
28385
  var listMyTradesResponseInfoBlockHeightRegExp = new RegExp("^\\d+$");
28082
28386
  var listMyTradesResponseInfoEventIndexMin = 0;
28387
+ var listMyTradesResponseInfoEventIndexMax = 4294967295;
28083
28388
  var ListMyTradesResponseItem = zod.object({
28084
28389
  id: zod.string(),
28085
28390
  order: zod.string().nullish(),
@@ -28089,10 +28394,11 @@ var ListMyTradesResponseItem = zod.object({
28089
28394
  type: zod.union([
28090
28395
  zod.literal("limit"),
28091
28396
  zod.literal("market"),
28397
+ zod.literal("twap"),
28092
28398
  zod.literal("unknown"),
28093
28399
  zod.literal(null)
28094
28400
  ]).nullish().describe(
28095
- "Order type resolved via JOIN to orders table. Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
28401
+ "Order type resolved via JOIN to orders table. `twap` marks a TWAP slice execution (chain code 2). Null if order not found. `unknown` is the fallback for a chain code the API doesn't recognize."
28096
28402
  ),
28097
28403
  cloid: zod.string().nullish().describe(
28098
28404
  "Client order id (hex, 8 bytes) resolved via JOIN to orders table. Null when the order carried none, the row predates cloid indexing, or on the public trades feed (cloids are private to the orderer)."
@@ -28126,8 +28432,8 @@ var ListMyTradesResponseItem = zod.object({
28126
28432
  "Atto-precision amount the orderer received for this fill,\nsuffixed with the chain denom. Empty string when the chain did\nnot record this side.\n"
28127
28433
  ),
28128
28434
  block_height: zod.string().regex(listMyTradesResponseInfoBlockHeightRegExp).describe("Decimal-string block height for parity with the WS trade event."),
28129
- event_index: zod.number().min(listMyTradesResponseInfoEventIndexMin).describe(
28130
- "The trade's event position within its block. Together with\n`block_height` it is the row's composite pagination cursor for the\ntrade feed. `created_at` cannot serve this role because every trade\nin a block shares one timestamp.\n"
28435
+ event_index: zod.number().min(listMyTradesResponseInfoEventIndexMin).max(listMyTradesResponseInfoEventIndexMax).describe(
28436
+ "The trade's event position within its block. With `block_height`\nit forms the row's composite pagination cursor: pass the last\nrow's pair as `before_height`/`before_index` to fetch the next\n(older) page.\n"
28131
28437
  )
28132
28438
  }).describe(
28133
28439
  "Exchange-specific extension on `TradeResponse`. Mirrors the\n`Info` struct populated in `internal/domain/trade/service.go`.\n"
@@ -28156,12 +28462,17 @@ var GetOHLCVParams = zod.object({
28156
28462
  symbol: zod.string().describe("URL-encoded trading pair (e.g., `AULT%2FUSDT`)")
28157
28463
  });
28158
28464
  var getOHLCVQueryTimeframeDefault = `1m`;
28159
- var getOHLCVQueryLimitDefault = 100;
28465
+ var getOHLCVQueryLimitDefault = 500;
28160
28466
  var getOHLCVQueryLimitMax = 1e3;
28161
28467
  var GetOHLCVQueryParams = zod.object({
28162
28468
  timeframe: zod.string().default(getOHLCVQueryTimeframeDefault).describe("Timeframe: 1m, 5m, 15m, 30m, 1h, 4h, 1d. Also accepts TV format: 1, 5, 15, 60, 1D"),
28163
- limit: zod.number().min(1).max(getOHLCVQueryLimitMax).default(getOHLCVQueryLimitDefault),
28164
- since: zod.number().optional().describe("Unix timestamp in milliseconds")
28469
+ limit: zod.number().min(1).max(getOHLCVQueryLimitMax).default(getOHLCVQueryLimitDefault).describe(
28470
+ "Bars per page, oldest first within the page. Without `since` the\npage holds the newest `limit` bars and the cursor walks back in\ntime; with `since` it holds the first `limit` bars from `since`\nand the cursor walks forward.\n"
28471
+ ),
28472
+ since: zod.number().optional().describe("Unix timestamp in milliseconds"),
28473
+ cursor: zod.string().optional().describe(
28474
+ 'Opaque pagination cursor. Take it verbatim from the previous page\'s\n`X-Next-Cursor` header (or follow the `Link: rel="next"` URL) and\nrepeat every other query parameter; the cursor is bound to that\nfilter set and a different one is rejected with 400. `limit` may\nchange between pages. No `X-Next-Cursor` on a response means the\nfeed is exhausted. Clients must not build or parse cursors.\n'
28475
+ )
28165
28476
  });
28166
28477
  var GetOHLCVResponseItem = zod.tuple([
28167
28478
  zod.number().describe("timestamp in milliseconds"),
@@ -28239,7 +28550,7 @@ var GetUDFHistoryQueryParams = zod.object({
28239
28550
  resolution: zod.enum(["1", "5", "15", "30", "60", "1D", "1W", "1M"]),
28240
28551
  from: zod.number().describe("Unix seconds"),
28241
28552
  to: zod.number().describe("Unix seconds"),
28242
- countback: zod.number().min(1).max(getUDFHistoryQueryCountbackMax).optional()
28553
+ countback: zod.number().min(1).max(getUDFHistoryQueryCountbackMax).optional().describe("Values above 1000 are clamped to 1000 server-side.")
28243
28554
  });
28244
28555
  var GetUDFHistoryResponse = zod.object({
28245
28556
  s: zod.enum(["ok", "no_data", "error"]),
@@ -28253,7 +28564,7 @@ var GetUDFHistoryResponse = zod.object({
28253
28564
  nextTime: zod.number().optional().describe('Unix seconds of next available bar (when s = "no_data")')
28254
28565
  });
28255
28566
  var GetUDFQuotesQueryParams = zod.object({
28256
- symbols: zod.string().describe("Comma-separated list of symbols")
28567
+ symbols: zod.string().describe("Comma-separated list of symbols, at most 100 (400 above that)")
28257
28568
  });
28258
28569
  var GetUDFQuotesResponse = zod.object({
28259
28570
  s: zod.enum(["ok", "error"]),
@@ -28316,7 +28627,7 @@ function createDexWs(url, options) {
28316
28627
  }
28317
28628
 
28318
28629
  // src/index.ts
28319
- var SDK_VERSION = "0.6.0";
28630
+ var SDK_VERSION = "0.7.1";
28320
28631
  export {
28321
28632
  AGENT_DEFAULTS,
28322
28633
  AULT_SIGNER_MARKER,
@@ -28326,6 +28637,7 @@ export {
28326
28637
  BondStatus,
28327
28638
  COIN_TYPE,
28328
28639
  DEFAULT_CHAIN_ID,
28640
+ DEFAULT_RETRYABLE_STATUSES,
28329
28641
  DexWsClient,
28330
28642
  EIP712_DOMAIN_TYPE,
28331
28643
  EIP712_MSG_TYPES,
@@ -28334,6 +28646,7 @@ export {
28334
28646
  GetAllTickersResponse,
28335
28647
  GetBalanceQueryParams,
28336
28648
  GetBalanceResponse,
28649
+ GetDBReadyResponse,
28337
28650
  GetHealthResponse,
28338
28651
  GetLiveResponse,
28339
28652
  GetOHLCVParams,
@@ -28390,6 +28703,7 @@ export {
28390
28703
  MarketType,
28391
28704
  MissingMsgResponseError,
28392
28705
  NETWORKS,
28706
+ NEXT_CURSOR_HEADER,
28393
28707
  NetworkError,
28394
28708
  ORDER_ID_LENGTH,
28395
28709
  OrderId,
@@ -28399,6 +28713,7 @@ export {
28399
28713
  SDK_VERSION,
28400
28714
  SIGN_MODE_DIRECT,
28401
28715
  SIGN_MODE_LEGACY_AMINO_JSON,
28716
+ SIMULATION_PLACEHOLDER_PUBKEY,
28402
28717
  SearchUDFSymbolsQueryParams,
28403
28718
  SearchUDFSymbolsResponse,
28404
28719
  SearchUDFSymbolsResponseItem,
@@ -28408,6 +28723,7 @@ export {
28408
28723
  TxConfirmationUnavailableError,
28409
28724
  TxError,
28410
28725
  TxNotConfirmedError,
28726
+ TxSimulationError,
28411
28727
  BondStatus as ValidatorStatus,
28412
28728
  WebSocketError,
28413
28729
  WithdrawRewardsPartialError,
@@ -28425,10 +28741,12 @@ export {
28425
28741
  buildEip712TypedData,
28426
28742
  buildFetchOptions,
28427
28743
  bytesToBase64,
28744
+ collectPages,
28428
28745
  computeEvmFeesPerGas,
28429
28746
  computeFeeFreeGas,
28430
28747
  computeFeeFreeGasCompound,
28431
28748
  computeRequiredFee,
28749
+ computeSimulatedGas,
28432
28750
  cosmosDecToDecimalString,
28433
28751
  cosmosDecToProtoInt,
28434
28752
  createAccountCache,
@@ -28520,6 +28838,7 @@ export {
28520
28838
  getTradeResponseFeeRateRegExp,
28521
28839
  getTradeResponseInfoAddressOneRegExp,
28522
28840
  getTradeResponseInfoBlockHeightRegExp,
28841
+ getTradeResponseInfoEventIndexMax,
28523
28842
  getTradeResponseInfoEventIndexMin,
28524
28843
  getTradeResponsePriceRegExp,
28525
28844
  getTradingFeesResponseMakerRegExp,
@@ -28530,9 +28849,13 @@ export {
28530
28849
  isValidAultAddress,
28531
28850
  isValidEvmAddress,
28532
28851
  isValidValidatorAddress,
28852
+ listCurrenciesResponseInfoContractDecimalsMax,
28853
+ listCurrenciesResponseInfoContractDecimalsMin,
28533
28854
  listMarketsResponseInfoEscrowAddressOneRegExp,
28534
28855
  listMarketsResponseMakerRegExp,
28535
28856
  listMarketsResponseTakerRegExp,
28857
+ listMyTradesQueryBeforeIndexMax,
28858
+ listMyTradesQueryBeforeIndexMin,
28536
28859
  listMyTradesQueryLimitDefault,
28537
28860
  listMyTradesQueryLimitMax,
28538
28861
  listMyTradesResponseAmountRegExp,
@@ -28541,6 +28864,7 @@ export {
28541
28864
  listMyTradesResponseFeeRateRegExp,
28542
28865
  listMyTradesResponseInfoAddressOneRegExp,
28543
28866
  listMyTradesResponseInfoBlockHeightRegExp,
28867
+ listMyTradesResponseInfoEventIndexMax,
28544
28868
  listMyTradesResponseInfoEventIndexMin,
28545
28869
  listMyTradesResponsePriceRegExp,
28546
28870
  listOrdersQueryAddressOneRegExp,
@@ -28558,6 +28882,8 @@ export {
28558
28882
  listOrdersResponseInfoRemainingDepositRegExp,
28559
28883
  listOrdersResponsePriceRegExp,
28560
28884
  listOrdersResponseRemainingRegExp,
28885
+ listTradesQueryBeforeIndexMax,
28886
+ listTradesQueryBeforeIndexMin,
28561
28887
  listTradesQueryLimitDefault,
28562
28888
  listTradesQueryLimitMax,
28563
28889
  listTradesResponseAmountRegExp,
@@ -28566,6 +28892,7 @@ export {
28566
28892
  listTradesResponseFeeRateRegExp,
28567
28893
  listTradesResponseInfoAddressOneRegExp,
28568
28894
  listTradesResponseInfoBlockHeightRegExp,
28895
+ listTradesResponseInfoEventIndexMax,
28569
28896
  listTradesResponseInfoEventIndexMin,
28570
28897
  listTradesResponsePriceRegExp,
28571
28898
  mergeManifests,
@@ -28573,6 +28900,7 @@ export {
28573
28900
  normalizeSignature,
28574
28901
  normalizeSigner,
28575
28902
  normalizeTxHash,
28903
+ paginate,
28576
28904
  paginateAll,
28577
28905
  parseEvmChainIdFromCosmosChainId,
28578
28906
  pollTxInclusion,
@@ -28582,6 +28910,7 @@ export {
28582
28910
  resolveSignerAddress,
28583
28911
  signAndBroadcastAgentTx,
28584
28912
  signAndBroadcastEip712,
28913
+ simulateTx,
28585
28914
  stripEip712Domain,
28586
28915
  toViemChain,
28587
28916
  validateEip712FieldOrder,