ault-sdk-ts 0.7.0 → 0.7.2

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
@@ -4,6 +4,16 @@ var __export = (target, all) => {
4
4
  __defProp(target, name, { get: all[name], enumerable: true });
5
5
  };
6
6
 
7
+ // src/core/user-agent.ts
8
+ var SDK_VERSION = "0.7.2";
9
+ var USER_AGENT = `ault-sdk-ts/${SDK_VERSION}`;
10
+ function isServerRuntime() {
11
+ if (typeof document !== "undefined") return false;
12
+ if (typeof globalThis.Deno !== "undefined") return false;
13
+ const versions = globalThis.process?.versions;
14
+ return Boolean(versions?.node || versions?.bun);
15
+ }
16
+
7
17
  // src/proto/gen/google/protobuf/duration.ts
8
18
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
19
  function createBaseDuration() {
@@ -145,6 +155,14 @@ var TxError = class extends Error {
145
155
  this.confirmed = params.confirmed;
146
156
  }
147
157
  };
158
+ var TxSimulationError = class extends Error {
159
+ constructor(params) {
160
+ super(`Transaction simulation failed: ${params.rawLog}`);
161
+ this.name = "TxSimulationError";
162
+ this.chainCode = params.chainCode;
163
+ this.rawLog = params.rawLog;
164
+ }
165
+ };
148
166
  var TxNotConfirmedError = class extends TxError {
149
167
  constructor(params) {
150
168
  super(
@@ -191,14 +209,16 @@ var WithdrawRewardsPartialError = class extends Error {
191
209
  };
192
210
 
193
211
  // src/core/http.ts
212
+ var DEFAULT_RETRYABLE_STATUSES = [408, 429, 500, 502, 503, 504];
194
213
  var DEFAULT_OPTIONS = {
195
214
  timeout: 3e4,
196
215
  retries: 3,
197
216
  retryDelay: 1e3,
198
217
  exponentialBackoff: true,
199
218
  retryableMethods: ["GET", "HEAD", "OPTIONS"],
200
- retryableStatuses: [408, 429, 500, 502, 503, 504],
201
- retryOnTimeout: false
219
+ retryableStatuses: [...DEFAULT_RETRYABLE_STATUSES],
220
+ retryOnTimeout: false,
221
+ userAgent: USER_AGENT
202
222
  };
203
223
  function ensureFetch(fetchFn) {
204
224
  const resolved = fetchFn ?? globalThis.fetch;
@@ -243,6 +263,21 @@ async function fetchWithTimeout(fetchFn, url, options, timeout) {
243
263
  removeAbortListener?.();
244
264
  }
245
265
  }
266
+ function withUserAgent(options, userAgent) {
267
+ if (!isServerRuntime()) return options;
268
+ const entries = [];
269
+ const raw = options.headers;
270
+ if (Array.isArray(raw)) {
271
+ entries.push(...raw.map(([k, v]) => [k, v]));
272
+ } else if (raw && typeof raw.forEach === "function") {
273
+ raw.forEach((value, key) => entries.push([key, value]));
274
+ } else if (raw) {
275
+ entries.push(...Object.entries(raw));
276
+ }
277
+ if (entries.some(([k]) => k.toLowerCase() === "user-agent")) return options;
278
+ entries.push(["user-agent", userAgent]);
279
+ return { ...options, headers: entries };
280
+ }
246
281
  function calculateDelay(attempt, baseDelay, exponential) {
247
282
  if (exponential) {
248
283
  const exponentialDelay = baseDelay * Math.pow(2, attempt);
@@ -259,11 +294,12 @@ async function fetchWithRetry(url, options = {}, fetchOptions = {}, fetchFn) {
259
294
  const method = (options.method || "GET").toUpperCase();
260
295
  const canRetry = opts.retryableMethods.includes(method);
261
296
  const resolvedFetch = ensureFetch(fetchFn);
297
+ const init = withUserAgent(options, opts.userAgent);
262
298
  const isAbortError = (error) => error instanceof Error && error.name === "AbortError";
263
299
  let lastError = null;
264
300
  for (let attempt = 0; attempt <= opts.retries; attempt++) {
265
301
  try {
266
- const response = await fetchWithTimeout(resolvedFetch, url, options, opts.timeout);
302
+ const response = await fetchWithTimeout(resolvedFetch, url, init, opts.timeout);
267
303
  if (!response.ok && canRetry && opts.retryableStatuses.includes(response.status) && attempt < opts.retries) {
268
304
  const delay = calculateDelay(attempt, opts.retryDelay, opts.exponentialBackoff);
269
305
  await sleep(delay);
@@ -436,6 +472,8 @@ var GAS_CONSTANTS = {
436
472
  DENOM: "aault",
437
473
  /** Chain multiplier applied to min gas to derive max gas (120 = 1.2×). */
438
474
  FEE_FREE_GAS_MULTIPLIER: 120,
475
+ /** Headroom over simulated `gas_used` (130 = 1.3×). */
476
+ SIMULATED_GAS_MULTIPLIER: 130,
439
477
  // License module
440
478
  PER_LICENSE: 2e5,
441
479
  PER_KYC_MEMBER: 2e5,
@@ -466,11 +504,19 @@ var GAS_CONSTANTS = {
466
504
  // Accountx module
467
505
  OPEN_ACCOUNT: 96e3,
468
506
  // Staking module (cosmos-sdk standard, NOT fee-free — user pays gas).
507
+ // Staking gas depends on the delegator's state, so the builders simulate;
508
+ // these are the fallback (×FEE_FREE_GAS_MULTIPLIER) when simulate is down.
469
509
  DELEGATE: 22e4,
470
- UNDELEGATE: 22e4,
471
- BEGIN_REDELEGATE: 28e4,
510
+ UNDELEGATE: 26e4,
511
+ BEGIN_REDELEGATE: 4e5,
472
512
  WITHDRAW_DELEGATOR_REWARD: 22e4
473
513
  };
514
+ function computeSimulatedGas(gasUsed, multiplier = GAS_CONSTANTS.SIMULATED_GAS_MULTIPLIER) {
515
+ if (!Number.isInteger(multiplier) || multiplier < 100) {
516
+ throw new Error(`simulated gas multiplier must be an integer >= 100, got ${multiplier}`);
517
+ }
518
+ return (gasUsed * BigInt(multiplier) / 100n).toString();
519
+ }
474
520
  function computeFeeFreeGas(minGasPerOp, count, multiplier = GAS_CONSTANTS.FEE_FREE_GAS_MULTIPLIER) {
475
521
  return (BigInt(minGasPerOp) * BigInt(count) * BigInt(multiplier) / 100n).toString();
476
522
  }
@@ -12114,22 +12160,31 @@ function frameMatches(sub, data) {
12114
12160
  }
12115
12161
  }
12116
12162
  var isowsModulePromise = null;
12117
- function wrapCtor(Ctor) {
12118
- return (url, protocols) => protocols === void 0 ? new Ctor(url) : new Ctor(url, protocols);
12163
+ function wrapCtor(Ctor, userAgent) {
12164
+ return (url, protocols) => {
12165
+ if (protocols !== void 0) return new Ctor(url, protocols);
12166
+ if (isServerRuntime()) {
12167
+ try {
12168
+ return new Ctor(url, { headers: { "User-Agent": userAgent } });
12169
+ } catch {
12170
+ }
12171
+ }
12172
+ return new Ctor(url);
12173
+ };
12119
12174
  }
12120
12175
  function currentGlobalCtor() {
12121
12176
  return typeof globalThis !== "undefined" && typeof globalThis.WebSocket === "function" ? globalThis.WebSocket : null;
12122
12177
  }
12123
- function getDefaultWebSocketFactory() {
12178
+ function getDefaultWebSocketFactory(userAgent) {
12124
12179
  const G = currentGlobalCtor();
12125
- if (G) return wrapCtor(G);
12180
+ if (G) return wrapCtor(G, userAgent);
12126
12181
  if (!isowsModulePromise) {
12127
12182
  isowsModulePromise = import("isows");
12128
12183
  }
12129
12184
  return isowsModulePromise.then((mod) => {
12130
12185
  const G2 = currentGlobalCtor();
12131
- if (G2) return wrapCtor(G2);
12132
- return wrapCtor(mod.WebSocket);
12186
+ if (G2) return wrapCtor(G2, userAgent);
12187
+ return wrapCtor(mod.WebSocket, userAgent);
12133
12188
  });
12134
12189
  }
12135
12190
  var DexWsClient = class {
@@ -12157,7 +12212,8 @@ var DexWsClient = class {
12157
12212
  reconnect: opts?.reconnect ?? true,
12158
12213
  maxReconnectAttempts: opts?.maxReconnectAttempts ?? Infinity,
12159
12214
  reconnectDelay: opts?.reconnectDelay ?? 1e3,
12160
- maxReconnectDelay: opts?.maxReconnectDelay ?? 3e4
12215
+ maxReconnectDelay: opts?.maxReconnectDelay ?? 3e4,
12216
+ userAgent: opts?.userAgent ?? USER_AGENT
12161
12217
  };
12162
12218
  this.userFactory = opts?.createWebSocket;
12163
12219
  }
@@ -12375,7 +12431,7 @@ var DexWsClient = class {
12375
12431
  }
12376
12432
  resolveFactory() {
12377
12433
  if (this.userFactory) return this.userFactory;
12378
- return getDefaultWebSocketFactory();
12434
+ return getDefaultWebSocketFactory(this.options.userAgent);
12379
12435
  }
12380
12436
  handleMessage(raw) {
12381
12437
  let msg2;
@@ -15429,422 +15485,175 @@ function buildEip712TypedData(context, msgs, evmChainId) {
15429
15485
  };
15430
15486
  }
15431
15487
 
15432
- // src/rest/feemarket.ts
15433
- async function fetchFeeMarketParams(network, fetchFn, fetchOptions) {
15434
- const data = await fetchJson(
15435
- `${network.restUrl}/cosmos/evm/feemarket/v1/params`,
15436
- {},
15437
- fetchOptions,
15438
- fetchFn
15439
- );
15440
- const raw = data.params ?? {};
15441
- return {
15442
- noBaseFee: raw.noBaseFee ?? raw.no_base_fee ?? false,
15443
- baseFee: raw.baseFee ?? raw.base_fee ?? "0",
15444
- minGasPrice: raw.minGasPrice ?? raw.min_gas_price ?? "0"
15445
- };
15446
- }
15447
- var ONE_E18 = 1000000000000000000n;
15448
- var DEFAULT_FEE_MARGIN_PERCENT = 20;
15449
- function marginFactorScaled(marginPercent) {
15450
- if (!Number.isFinite(marginPercent) || !Number.isInteger(marginPercent)) {
15451
- throw new Error(`marginPercent must be a non-negative integer, got ${marginPercent}`);
15488
+ // src/proto/tx-encode.ts
15489
+ var WIRE_VARINT = 0;
15490
+ var WIRE_LENGTH_DELIMITED = 2;
15491
+ var BinaryWriter35 = class {
15492
+ constructor() {
15493
+ this.chunks = [];
15452
15494
  }
15453
- if (marginPercent < 0) {
15454
- throw new Error(`marginPercent must be >= 0, got ${marginPercent}`);
15495
+ writeVarint(value) {
15496
+ let v = BigInt(value);
15497
+ const bytes = [];
15498
+ do {
15499
+ let byte = Number(v & 0x7fn);
15500
+ v >>= 7n;
15501
+ if (v > 0n) byte |= 128;
15502
+ bytes.push(byte);
15503
+ } while (v > 0n);
15504
+ this.chunks.push(new Uint8Array(bytes));
15505
+ return this;
15455
15506
  }
15456
- return BigInt(100 + marginPercent);
15457
- }
15458
- function computeRequiredFee(params, gas, options) {
15459
- const margin = marginFactorScaled(options?.marginPercent ?? DEFAULT_FEE_MARGIN_PERCENT);
15460
- const minGasPriceI = BigInt(cosmosDecToProtoInt(params.minGasPrice || "0"));
15461
- const baseFeeI = params.noBaseFee ? 0n : BigInt(cosmosDecToProtoInt(params.baseFee || "0"));
15462
- const effectiveI = baseFeeI > minGasPriceI ? baseFeeI : minGasPriceI;
15463
- if (effectiveI <= 0n) return "0";
15464
- const gasI = BigInt(gas);
15465
- if (gasI <= 0n) return "0";
15466
- const numerator = effectiveI * gasI * margin;
15467
- const denominator = ONE_E18 * 100n;
15468
- return ((numerator + denominator - 1n) / denominator).toString();
15469
- }
15470
- var DEFAULT_FEE_MARKET_TTL_MS = 3e3;
15471
- function createFeeMarketCache(ttlMs = DEFAULT_FEE_MARKET_TTL_MS) {
15472
- return { ttlMs, entries: /* @__PURE__ */ new Map() };
15473
- }
15474
- async function getCachedFeeMarketParams(cache, network, fetchFn, fetchOptions) {
15475
- const key = network.chainId;
15476
- const now = Date.now();
15477
- if (cache) {
15478
- const existing = cache.entries.get(key);
15479
- if (existing && now - existing.fetchedAt < cache.ttlMs) {
15480
- return existing.params;
15507
+ writeTag(fieldNumber, wireType) {
15508
+ return this.writeVarint(fieldNumber << 3 | wireType);
15509
+ }
15510
+ writeString(fieldNumber, value) {
15511
+ if (!value) return this;
15512
+ this.writeTag(fieldNumber, WIRE_LENGTH_DELIMITED);
15513
+ const bytes = new TextEncoder().encode(value);
15514
+ this.writeVarint(bytes.length);
15515
+ this.chunks.push(bytes);
15516
+ return this;
15517
+ }
15518
+ writeBool(fieldNumber, value) {
15519
+ if (!value) return this;
15520
+ this.writeTag(fieldNumber, WIRE_VARINT);
15521
+ this.writeVarint(value ? 1 : 0);
15522
+ return this;
15523
+ }
15524
+ writeUint64(fieldNumber, value) {
15525
+ const v = BigInt(value);
15526
+ if (v === 0n) return this;
15527
+ this.writeTag(fieldNumber, WIRE_VARINT);
15528
+ this.writeVarint(v);
15529
+ return this;
15530
+ }
15531
+ writeInt32(fieldNumber, value) {
15532
+ if (value === 0) return this;
15533
+ this.writeTag(fieldNumber, WIRE_VARINT);
15534
+ this.writeVarint(value);
15535
+ return this;
15536
+ }
15537
+ writeBytes(fieldNumber, value) {
15538
+ if (value.length === 0) return this;
15539
+ this.writeTag(fieldNumber, WIRE_LENGTH_DELIMITED);
15540
+ this.writeVarint(value.length);
15541
+ this.chunks.push(value);
15542
+ return this;
15543
+ }
15544
+ writeRepeatedString(fieldNumber, values) {
15545
+ for (const value of values) {
15546
+ this.writeString(fieldNumber, value);
15481
15547
  }
15548
+ return this;
15482
15549
  }
15483
- let params;
15484
- try {
15485
- params = await fetchFeeMarketParams(network, fetchFn, fetchOptions);
15486
- } catch (error) {
15487
- if (!isGatewayUnsupportedError(error)) throw error;
15488
- params = null;
15550
+ writeRepeatedUint64(fieldNumber, values) {
15551
+ for (const value of values) {
15552
+ this.writeTag(fieldNumber, WIRE_VARINT);
15553
+ this.writeVarint(BigInt(value));
15554
+ }
15555
+ return this;
15489
15556
  }
15490
- if (cache) {
15491
- cache.entries.set(key, { params, fetchedAt: now });
15557
+ writeRepeatedBytes(fieldNumber, values) {
15558
+ for (const value of values) {
15559
+ this.writeBytes(fieldNumber, value);
15560
+ }
15561
+ return this;
15492
15562
  }
15493
- return params;
15563
+ finish() {
15564
+ const total = this.chunks.reduce((sum, chunk) => sum + chunk.length, 0);
15565
+ const result = new Uint8Array(total);
15566
+ let offset = 0;
15567
+ for (const chunk of this.chunks) {
15568
+ result.set(chunk, offset);
15569
+ offset += chunk.length;
15570
+ }
15571
+ return result;
15572
+ }
15573
+ };
15574
+ function encodeAny(typeUrl, value) {
15575
+ const writer = new BinaryWriter35();
15576
+ writer.writeString(1, typeUrl);
15577
+ writer.writeBytes(2, value);
15578
+ return writer.finish();
15494
15579
  }
15495
- function isGatewayUnsupportedError(error) {
15496
- return error instanceof ApiError && (error.status === 404 || error.status === 501);
15580
+ function encodeCoin(denom, amount) {
15581
+ const writer = new BinaryWriter35();
15582
+ writer.writeString(1, denom);
15583
+ writer.writeString(2, amount);
15584
+ return writer.finish();
15497
15585
  }
15498
- function computeEvmFeesPerGas(params, options) {
15499
- const margin = marginFactorScaled(options?.marginPercent ?? DEFAULT_FEE_MARGIN_PERCENT);
15500
- const minGasPriceI = BigInt(cosmosDecToProtoInt(params.minGasPrice || "0"));
15501
- const baseFeeI = params.noBaseFee ? 0n : BigInt(cosmosDecToProtoInt(params.baseFee || "0"));
15502
- const effectiveI = baseFeeI > minGasPriceI ? baseFeeI : minGasPriceI;
15503
- if (effectiveI <= 0n) {
15504
- return { maxFeePerGas: 0n, maxPriorityFeePerGas: 0n };
15586
+ function encodeFee(fee) {
15587
+ const writer = new BinaryWriter35();
15588
+ for (const coin of fee.amount) {
15589
+ const coinBytes = encodeCoin(coin.denom, coin.amount);
15590
+ writer.writeBytes(1, coinBytes);
15505
15591
  }
15506
- const numerator = effectiveI * margin;
15507
- const denominator = ONE_E18 * 100n;
15508
- const gasPriceWei = (numerator + denominator - 1n) / denominator;
15509
- return { maxFeePerGas: gasPriceWei, maxPriorityFeePerGas: gasPriceWei };
15592
+ writer.writeUint64(2, fee.gasLimit);
15593
+ return writer.finish();
15510
15594
  }
15511
- async function resolveEvmFeesPerGas(network, options) {
15512
- const params = await getCachedFeeMarketParams(
15513
- options?.cache,
15514
- network,
15515
- options?.fetchFn,
15516
- options?.fetchOptions
15517
- );
15518
- if (!params) return null;
15519
- let fees;
15520
- try {
15521
- fees = computeEvmFeesPerGas(params, { marginPercent: options?.marginPercent });
15522
- } catch {
15523
- return null;
15524
- }
15525
- if (fees.maxFeePerGas === 0n && fees.maxPriorityFeePerGas === 0n) return null;
15526
- return fees;
15595
+ function encodeModeInfoSingle(mode) {
15596
+ const writer = new BinaryWriter35();
15597
+ writer.writeInt32(1, mode);
15598
+ return writer.finish();
15527
15599
  }
15528
-
15529
- // src/eip712/signers.ts
15530
- import { privateKeyToAccount } from "viem/accounts";
15531
- var AULT_SIGNER_MARKER = /* @__PURE__ */ Symbol.for("ault-sdk:signer");
15532
- function isAultSigner(obj) {
15533
- return typeof obj === "object" && obj !== null && AULT_SIGNER_MARKER in obj && obj[AULT_SIGNER_MARKER] === true;
15600
+ function encodeModeInfo(mode) {
15601
+ const writer = new BinaryWriter35();
15602
+ const singleBytes = encodeModeInfoSingle(mode);
15603
+ writer.writeBytes(1, singleBytes);
15604
+ return writer.finish();
15534
15605
  }
15535
- function normalizeSigner(input) {
15536
- if (!input) return null;
15537
- if (typeof input === "function") {
15538
- return { signTypedData: input };
15539
- }
15540
- if (typeof input === "object" && typeof input.signTypedData === "function") {
15541
- return input;
15542
- }
15543
- throw new Error("Invalid signer: expected a signer object or signTypedData function.");
15606
+ function encodeSignerInfo(info) {
15607
+ const writer = new BinaryWriter35();
15608
+ const pubKeyAny = encodeAny(info.publicKey.typeUrl, info.publicKey.value);
15609
+ writer.writeBytes(1, pubKeyAny);
15610
+ const modeInfoBytes = encodeModeInfo(info.mode);
15611
+ writer.writeBytes(2, modeInfoBytes);
15612
+ writer.writeUint64(3, typeof info.sequence === "string" ? BigInt(info.sequence) : info.sequence);
15613
+ return writer.finish();
15544
15614
  }
15545
- function normalizeSignature(result) {
15546
- if (typeof result === "string") {
15547
- return result;
15548
- }
15549
- if (result && typeof result.signature === "string") {
15550
- return result.signature;
15615
+ function encodeAuthInfo(authInfo) {
15616
+ const writer = new BinaryWriter35();
15617
+ for (const signerInfo of authInfo.signerInfos) {
15618
+ writer.writeBytes(1, encodeSignerInfo(signerInfo));
15551
15619
  }
15552
- throw new Error("Invalid signature response: expected hex string or { signature }.");
15620
+ writer.writeBytes(2, encodeFee(authInfo.fee));
15621
+ return writer.finish();
15553
15622
  }
15554
- async function getSignerAddress(signer) {
15555
- if (typeof signer.address === "string") {
15556
- return signer.address;
15623
+ function encodeTxBody(body) {
15624
+ const writer = new BinaryWriter35();
15625
+ for (const msg2 of body.messages) {
15626
+ writer.writeBytes(1, encodeAny(msg2.typeUrl, msg2.value));
15557
15627
  }
15558
- if (typeof signer.getAddress === "function") {
15559
- const address = await signer.getAddress();
15560
- return typeof address === "string" ? address : null;
15628
+ if (body.memo) {
15629
+ writer.writeString(2, body.memo);
15561
15630
  }
15562
- return null;
15563
- }
15564
- async function resolveSignerAddress(signer, signerAddress) {
15565
- const raw = signerAddress ?? (signer ? await getSignerAddress(signer) : null);
15566
- if (!raw) {
15567
- throw new Error("signerAddress is required when the signer has no address.");
15568
- }
15569
- if (isValidAultAddress(raw)) {
15570
- return raw;
15571
- }
15572
- if (isValidEvmAddress(raw)) {
15573
- return evmToAult(raw);
15574
- }
15575
- throw new Error(`Invalid signerAddress: ${raw}`);
15576
- }
15577
- function stripEip712Domain(types) {
15578
- const { EIP712Domain: _removed, ...rest } = types;
15579
- return rest;
15580
- }
15581
- function createEip1193Signer(options) {
15582
- const method = options.method ?? "eth_signTypedData_v4";
15583
- return {
15584
- [AULT_SIGNER_MARKER]: true,
15585
- address: options.address,
15586
- signTypedData: async (typedData) => {
15587
- const payload = method === "eth_signTypedData_v4" ? JSON.stringify(typedData) : typedData;
15588
- const signature = await options.provider.request({
15589
- method,
15590
- params: [options.address, payload]
15591
- });
15592
- if (typeof signature !== "string") {
15593
- throw new Error("Provider did not return a signature string.");
15594
- }
15595
- return { signature };
15596
- }
15597
- };
15598
- }
15599
- function createViemSigner(wallet, options) {
15600
- const preferRpc = options?.preferRpc ?? true;
15601
- const getAddress3 = async () => {
15602
- if (wallet.address) return wallet.address;
15603
- if (wallet.getAddresses) {
15604
- const addresses = await wallet.getAddresses();
15605
- if (addresses?.length) return addresses[0];
15606
- }
15607
- return void 0;
15608
- };
15609
- return {
15610
- [AULT_SIGNER_MARKER]: true,
15611
- getAddress: async () => {
15612
- const addr = await getAddress3();
15613
- if (!addr) throw new Error("Viem wallet has no address");
15614
- return addr;
15615
- },
15616
- signTypedData: async (typedData) => {
15617
- if (preferRpc && wallet.request) {
15618
- const address = await getAddress3();
15619
- if (!address) {
15620
- throw new Error("Viem wallet has no address; pass signerAddress explicitly.");
15621
- }
15622
- const signature2 = await wallet.request({
15623
- method: "eth_signTypedData_v4",
15624
- params: [address, JSON.stringify(typedData)]
15625
- });
15626
- if (typeof signature2 !== "string") {
15627
- throw new Error("RPC signer did not return a signature string.");
15628
- }
15629
- return { signature: signature2 };
15630
- }
15631
- if (!wallet.signTypedData) {
15632
- throw new Error("Viem signer does not support signTypedData.");
15633
- }
15634
- const signature = await wallet.signTypedData({
15635
- domain: typedData.domain,
15636
- types: typedData.types,
15637
- primaryType: typedData.primaryType,
15638
- message: typedData.message
15639
- });
15640
- return { signature };
15641
- }
15642
- };
15643
- }
15644
- function createEthersSigner(signer) {
15645
- const sign = signer.signTypedData ?? signer._signTypedData;
15646
- if (!sign) {
15647
- throw new Error("Ethers signer must implement signTypedData or _signTypedData.");
15648
- }
15649
- return {
15650
- [AULT_SIGNER_MARKER]: true,
15651
- getAddress: () => signer.getAddress(),
15652
- signTypedData: async (typedData) => {
15653
- const types = stripEip712Domain(typedData.types);
15654
- const signature = await sign(typedData.domain, types, typedData.message);
15655
- return { signature };
15656
- }
15657
- };
15658
- }
15659
- function createPrivySigner(options) {
15660
- return {
15661
- [AULT_SIGNER_MARKER]: true,
15662
- address: options.address,
15663
- signTypedData: (typedData) => options.signTypedData(typedData, options.address ? { address: options.address } : void 0)
15664
- };
15665
- }
15666
- function createPrivateKeySigner(privateKey) {
15667
- const normalized = privateKey.startsWith("0x") ? privateKey : `0x${privateKey}`;
15668
- const account = privateKeyToAccount(normalized);
15669
- return createViemSigner(account);
15670
- }
15671
-
15672
- // src/utils/tx-hash.ts
15673
- function normalizeTxHash(raw) {
15674
- if (!raw) return raw;
15675
- const stripped = raw.startsWith("0x") || raw.startsWith("0X") ? raw.slice(2) : raw;
15676
- return stripped.toLowerCase();
15677
- }
15678
-
15679
- // src/proto/tx-encode.ts
15680
- var WIRE_VARINT = 0;
15681
- var WIRE_LENGTH_DELIMITED = 2;
15682
- var BinaryWriter35 = class {
15683
- constructor() {
15684
- this.chunks = [];
15685
- }
15686
- writeVarint(value) {
15687
- let v = BigInt(value);
15688
- const bytes = [];
15689
- do {
15690
- let byte = Number(v & 0x7fn);
15691
- v >>= 7n;
15692
- if (v > 0n) byte |= 128;
15693
- bytes.push(byte);
15694
- } while (v > 0n);
15695
- this.chunks.push(new Uint8Array(bytes));
15696
- return this;
15697
- }
15698
- writeTag(fieldNumber, wireType) {
15699
- return this.writeVarint(fieldNumber << 3 | wireType);
15700
- }
15701
- writeString(fieldNumber, value) {
15702
- if (!value) return this;
15703
- this.writeTag(fieldNumber, WIRE_LENGTH_DELIMITED);
15704
- const bytes = new TextEncoder().encode(value);
15705
- this.writeVarint(bytes.length);
15706
- this.chunks.push(bytes);
15707
- return this;
15708
- }
15709
- writeBool(fieldNumber, value) {
15710
- if (!value) return this;
15711
- this.writeTag(fieldNumber, WIRE_VARINT);
15712
- this.writeVarint(value ? 1 : 0);
15713
- return this;
15714
- }
15715
- writeUint64(fieldNumber, value) {
15716
- const v = BigInt(value);
15717
- if (v === 0n) return this;
15718
- this.writeTag(fieldNumber, WIRE_VARINT);
15719
- this.writeVarint(v);
15720
- return this;
15721
- }
15722
- writeInt32(fieldNumber, value) {
15723
- if (value === 0) return this;
15724
- this.writeTag(fieldNumber, WIRE_VARINT);
15725
- this.writeVarint(value);
15726
- return this;
15727
- }
15728
- writeBytes(fieldNumber, value) {
15729
- if (value.length === 0) return this;
15730
- this.writeTag(fieldNumber, WIRE_LENGTH_DELIMITED);
15731
- this.writeVarint(value.length);
15732
- this.chunks.push(value);
15733
- return this;
15734
- }
15735
- writeRepeatedString(fieldNumber, values) {
15736
- for (const value of values) {
15737
- this.writeString(fieldNumber, value);
15738
- }
15739
- return this;
15740
- }
15741
- writeRepeatedUint64(fieldNumber, values) {
15742
- for (const value of values) {
15743
- this.writeTag(fieldNumber, WIRE_VARINT);
15744
- this.writeVarint(BigInt(value));
15745
- }
15746
- return this;
15747
- }
15748
- writeRepeatedBytes(fieldNumber, values) {
15749
- for (const value of values) {
15750
- this.writeBytes(fieldNumber, value);
15751
- }
15752
- return this;
15753
- }
15754
- finish() {
15755
- const total = this.chunks.reduce((sum, chunk) => sum + chunk.length, 0);
15756
- const result = new Uint8Array(total);
15757
- let offset = 0;
15758
- for (const chunk of this.chunks) {
15759
- result.set(chunk, offset);
15760
- offset += chunk.length;
15761
- }
15762
- return result;
15763
- }
15764
- };
15765
- function encodeAny(typeUrl, value) {
15766
- const writer = new BinaryWriter35();
15767
- writer.writeString(1, typeUrl);
15768
- writer.writeBytes(2, value);
15769
- return writer.finish();
15770
- }
15771
- function encodeCoin(denom, amount) {
15772
- const writer = new BinaryWriter35();
15773
- writer.writeString(1, denom);
15774
- writer.writeString(2, amount);
15775
- return writer.finish();
15776
- }
15777
- function encodeFee(fee) {
15778
- const writer = new BinaryWriter35();
15779
- for (const coin of fee.amount) {
15780
- const coinBytes = encodeCoin(coin.denom, coin.amount);
15781
- writer.writeBytes(1, coinBytes);
15631
+ if (body.timeoutHeight) {
15632
+ writer.writeUint64(3, body.timeoutHeight);
15782
15633
  }
15783
- writer.writeUint64(2, fee.gasLimit);
15784
- return writer.finish();
15785
- }
15786
- function encodeModeInfoSingle(mode) {
15787
- const writer = new BinaryWriter35();
15788
- writer.writeInt32(1, mode);
15789
15634
  return writer.finish();
15790
15635
  }
15791
- function encodeModeInfo(mode) {
15636
+ function encodeTxRaw(txRaw) {
15792
15637
  const writer = new BinaryWriter35();
15793
- const singleBytes = encodeModeInfoSingle(mode);
15794
- writer.writeBytes(1, singleBytes);
15638
+ writer.writeBytes(1, txRaw.bodyBytes);
15639
+ writer.writeBytes(2, txRaw.authInfoBytes);
15640
+ writer.writeRepeatedBytes(3, txRaw.signatures);
15795
15641
  return writer.finish();
15796
15642
  }
15797
- function encodeSignerInfo(info) {
15643
+ function encodeEthSecp256k1PubKey(key) {
15798
15644
  const writer = new BinaryWriter35();
15799
- const pubKeyAny = encodeAny(info.publicKey.typeUrl, info.publicKey.value);
15800
- writer.writeBytes(1, pubKeyAny);
15801
- const modeInfoBytes = encodeModeInfo(info.mode);
15802
- writer.writeBytes(2, modeInfoBytes);
15803
- writer.writeUint64(3, typeof info.sequence === "string" ? BigInt(info.sequence) : info.sequence);
15645
+ writer.writeBytes(1, key);
15804
15646
  return writer.finish();
15805
15647
  }
15806
- function encodeAuthInfo(authInfo) {
15648
+ var SIGN_MODE_LEGACY_AMINO_JSON = 127;
15649
+ var SIGN_MODE_DIRECT = 1;
15650
+ function encodeTimestamp(seconds, nanos) {
15807
15651
  const writer = new BinaryWriter35();
15808
- for (const signerInfo of authInfo.signerInfos) {
15809
- writer.writeBytes(1, encodeSignerInfo(signerInfo));
15810
- }
15811
- writer.writeBytes(2, encodeFee(authInfo.fee));
15652
+ writer.writeUint64(1, seconds);
15653
+ writer.writeInt32(2, nanos);
15812
15654
  return writer.finish();
15813
15655
  }
15814
- function encodeTxBody(body) {
15815
- const writer = new BinaryWriter35();
15816
- for (const msg2 of body.messages) {
15817
- writer.writeBytes(1, encodeAny(msg2.typeUrl, msg2.value));
15818
- }
15819
- if (body.memo) {
15820
- writer.writeString(2, body.memo);
15821
- }
15822
- if (body.timeoutHeight) {
15823
- writer.writeUint64(3, body.timeoutHeight);
15824
- }
15825
- return writer.finish();
15826
- }
15827
- function encodeTxRaw(txRaw) {
15828
- const writer = new BinaryWriter35();
15829
- writer.writeBytes(1, txRaw.bodyBytes);
15830
- writer.writeBytes(2, txRaw.authInfoBytes);
15831
- writer.writeRepeatedBytes(3, txRaw.signatures);
15832
- return writer.finish();
15833
- }
15834
- function encodeEthSecp256k1PubKey(key) {
15835
- const writer = new BinaryWriter35();
15836
- writer.writeBytes(1, key);
15837
- return writer.finish();
15838
- }
15839
- var SIGN_MODE_LEGACY_AMINO_JSON = 127;
15840
- var SIGN_MODE_DIRECT = 1;
15841
- function encodeTimestamp(seconds, nanos) {
15842
- const writer = new BinaryWriter35();
15843
- writer.writeUint64(1, seconds);
15844
- writer.writeInt32(2, nanos);
15845
- return writer.finish();
15846
- }
15847
- function encodeTxBodyAgent(body) {
15656
+ function encodeTxBodyAgent(body) {
15848
15657
  const writer = new BinaryWriter35();
15849
15658
  for (const msg2 of body.messages) {
15850
15659
  writer.writeBytes(1, encodeAny(msg2.typeUrl, msg2.value));
@@ -24345,224 +24154,595 @@ function mapCosmosStakingV1beta1MsgDelegate(input, label = "value") {
24345
24154
  amount: mapCosmosBaseV1beta1Coin(asRecord(record2["amount"]), `${prefix}amount`)
24346
24155
  };
24347
24156
  }
24348
- function mapCosmosStakingV1beta1MsgUndelegate(input, label = "value") {
24349
- const record2 = asRecord(input);
24350
- const prefix = label ? `${label}.` : "";
24157
+ function mapCosmosStakingV1beta1MsgUndelegate(input, label = "value") {
24158
+ const record2 = asRecord(input);
24159
+ const prefix = label ? `${label}.` : "";
24160
+ return {
24161
+ delegatorAddress: requireString(record2["delegatorAddress"], `${prefix}delegatorAddress`),
24162
+ validatorAddress: requireString(record2["validatorAddress"], `${prefix}validatorAddress`),
24163
+ amount: mapCosmosBaseV1beta1Coin(asRecord(record2["amount"]), `${prefix}amount`)
24164
+ };
24165
+ }
24166
+ function mapGoogleProtobufAny(input, label = "value") {
24167
+ const record2 = asRecord(input);
24168
+ const prefix = label ? `${label}.` : "";
24169
+ return {
24170
+ typeUrl: requireString(record2["typeUrl"], `${prefix}typeUrl`),
24171
+ value: requireBytes(record2["value"], `${prefix}value`)
24172
+ };
24173
+ }
24174
+ var MSG_ENCODERS = {
24175
+ "/ault.accountx.v1.MsgOpenAccount": (value) => MsgOpenAccount.encode(
24176
+ MsgOpenAccount.fromPartial(mapAultAccountxV1MsgOpenAccount(value))
24177
+ ).finish(),
24178
+ "/ault.accountx.v1.MsgUpdateFeeTiers": (value) => MsgUpdateFeeTiers.encode(
24179
+ MsgUpdateFeeTiers.fromPartial(mapAultAccountxV1MsgUpdateFeeTiers(value))
24180
+ ).finish(),
24181
+ "/ault.accountx.v1.MsgUpdateParams": (value) => MsgUpdateParams.encode(
24182
+ MsgUpdateParams.fromPartial(mapAultAccountxV1MsgUpdateParams(value))
24183
+ ).finish(),
24184
+ "/ault.accountx.v1.MsgUpdateTradingTiers": (value) => MsgUpdateTradingTiers.encode(
24185
+ MsgUpdateTradingTiers.fromPartial(mapAultAccountxV1MsgUpdateTradingTiers(value))
24186
+ ).finish(),
24187
+ "/ault.agent.v1.MsgApproveAgent": (value) => MsgApproveAgent.encode(
24188
+ MsgApproveAgent.fromPartial(mapAultAgentV1MsgApproveAgent(value))
24189
+ ).finish(),
24190
+ "/ault.agent.v1.MsgRevokeAgent": (value) => MsgRevokeAgent.encode(MsgRevokeAgent.fromPartial(mapAultAgentV1MsgRevokeAgent(value))).finish(),
24191
+ "/ault.agent.v1.MsgUpdateParams": (value) => MsgUpdateParams2.encode(
24192
+ MsgUpdateParams2.fromPartial(mapAultAgentV1MsgUpdateParams(value))
24193
+ ).finish(),
24194
+ "/ault.authority.v1.MsgGrantRole": (value) => MsgGrantRole.encode(MsgGrantRole.fromPartial(mapAultAuthorityV1MsgGrantRole(value))).finish(),
24195
+ "/ault.authority.v1.MsgRevokeRole": (value) => MsgRevokeRole.encode(
24196
+ MsgRevokeRole.fromPartial(mapAultAuthorityV1MsgRevokeRole(value))
24197
+ ).finish(),
24198
+ "/ault.clob.v1.MsgCancelOrders": (value) => MsgCancelOrders.encode(
24199
+ MsgCancelOrders.fromPartial(mapAultClobV1MsgCancelOrders(value))
24200
+ ).finish(),
24201
+ "/ault.clob.v1.MsgModifyOrders": (value) => MsgModifyOrders.encode(
24202
+ MsgModifyOrders.fromPartial(mapAultClobV1MsgModifyOrders(value))
24203
+ ).finish(),
24204
+ "/ault.clob.v1.MsgPlaceLimitOrder": (value) => MsgPlaceLimitOrder.encode(
24205
+ MsgPlaceLimitOrder.fromPartial(mapAultClobV1MsgPlaceLimitOrder(value))
24206
+ ).finish(),
24207
+ "/ault.clob.v1.MsgPlaceMarketOrder": (value) => MsgPlaceMarketOrder.encode(
24208
+ MsgPlaceMarketOrder.fromPartial(mapAultClobV1MsgPlaceMarketOrder(value))
24209
+ ).finish(),
24210
+ "/ault.clob.v1.MsgPlaceScaleOrder": (value) => MsgPlaceScaleOrder.encode(
24211
+ MsgPlaceScaleOrder.fromPartial(mapAultClobV1MsgPlaceScaleOrder(value))
24212
+ ).finish(),
24213
+ "/ault.clob.v1.MsgPlaceTwapOrder": (value) => MsgPlaceTwapOrder.encode(
24214
+ MsgPlaceTwapOrder.fromPartial(mapAultClobV1MsgPlaceTwapOrder(value))
24215
+ ).finish(),
24216
+ "/ault.clob.v1.MsgUpdateParams": (value) => MsgUpdateParams3.encode(
24217
+ MsgUpdateParams3.fromPartial(mapAultClobV1MsgUpdateParams(value))
24218
+ ).finish(),
24219
+ "/ault.license.v1.MsgApproveMember": (value) => MsgApproveMember.encode(
24220
+ MsgApproveMember.fromPartial(mapAultLicenseV1MsgApproveMember(value))
24221
+ ).finish(),
24222
+ "/ault.license.v1.MsgBatchApproveMember": (value) => MsgBatchApproveMember.encode(
24223
+ MsgBatchApproveMember.fromPartial(mapAultLicenseV1MsgBatchApproveMember(value))
24224
+ ).finish(),
24225
+ "/ault.license.v1.MsgBatchMintLicense": (value) => MsgBatchMintLicense.encode(
24226
+ MsgBatchMintLicense.fromPartial(mapAultLicenseV1MsgBatchMintLicense(value))
24227
+ ).finish(),
24228
+ "/ault.license.v1.MsgBatchRevokeMember": (value) => MsgBatchRevokeMember.encode(
24229
+ MsgBatchRevokeMember.fromPartial(mapAultLicenseV1MsgBatchRevokeMember(value))
24230
+ ).finish(),
24231
+ "/ault.license.v1.MsgBurnLicense": (value) => MsgBurnLicense.encode(
24232
+ MsgBurnLicense.fromPartial(mapAultLicenseV1MsgBurnLicense(value))
24233
+ ).finish(),
24234
+ "/ault.license.v1.MsgMintLicense": (value) => MsgMintLicense.encode(
24235
+ MsgMintLicense.fromPartial(mapAultLicenseV1MsgMintLicense(value))
24236
+ ).finish(),
24237
+ "/ault.license.v1.MsgRevokeLicense": (value) => MsgRevokeLicense.encode(
24238
+ MsgRevokeLicense.fromPartial(mapAultLicenseV1MsgRevokeLicense(value))
24239
+ ).finish(),
24240
+ "/ault.license.v1.MsgRevokeMember": (value) => MsgRevokeMember.encode(
24241
+ MsgRevokeMember.fromPartial(mapAultLicenseV1MsgRevokeMember(value))
24242
+ ).finish(),
24243
+ "/ault.license.v1.MsgSetKYCApprovers": (value) => MsgSetKYCApprovers.encode(
24244
+ MsgSetKYCApprovers.fromPartial(mapAultLicenseV1MsgSetKYCApprovers(value))
24245
+ ).finish(),
24246
+ "/ault.license.v1.MsgSetMinters": (value) => MsgSetMinters.encode(MsgSetMinters.fromPartial(mapAultLicenseV1MsgSetMinters(value))).finish(),
24247
+ "/ault.license.v1.MsgSetTokenURI": (value) => MsgSetTokenURI.encode(
24248
+ MsgSetTokenURI.fromPartial(mapAultLicenseV1MsgSetTokenURI(value))
24249
+ ).finish(),
24250
+ "/ault.license.v1.MsgTransferLicense": (value) => MsgTransferLicense.encode(
24251
+ MsgTransferLicense.fromPartial(mapAultLicenseV1MsgTransferLicense(value))
24252
+ ).finish(),
24253
+ "/ault.license.v1.MsgUpdateParams": (value) => MsgUpdateParams4.encode(
24254
+ MsgUpdateParams4.fromPartial(mapAultLicenseV1MsgUpdateParams(value))
24255
+ ).finish(),
24256
+ "/ault.market.v1.MsgCreateMarket": (value) => MsgCreateMarket.encode(
24257
+ MsgCreateMarket.fromPartial(mapAultMarketV1MsgCreateMarket(value))
24258
+ ).finish(),
24259
+ "/ault.market.v1.MsgHaltAllMarkets": (value) => MsgHaltAllMarkets.encode(
24260
+ MsgHaltAllMarkets.fromPartial(mapAultMarketV1MsgHaltAllMarkets(value))
24261
+ ).finish(),
24262
+ "/ault.market.v1.MsgHaltMarkets": (value) => MsgHaltMarkets.encode(
24263
+ MsgHaltMarkets.fromPartial(mapAultMarketV1MsgHaltMarkets(value))
24264
+ ).finish(),
24265
+ "/ault.market.v1.MsgResumeAllMarkets": (value) => MsgResumeAllMarkets.encode(
24266
+ MsgResumeAllMarkets.fromPartial(mapAultMarketV1MsgResumeAllMarkets(value))
24267
+ ).finish(),
24268
+ "/ault.market.v1.MsgResumeMarkets": (value) => MsgResumeMarkets.encode(
24269
+ MsgResumeMarkets.fromPartial(mapAultMarketV1MsgResumeMarkets(value))
24270
+ ).finish(),
24271
+ "/ault.market.v1.MsgUpdateMarket": (value) => MsgUpdateMarket.encode(
24272
+ MsgUpdateMarket.fromPartial(mapAultMarketV1MsgUpdateMarket(value))
24273
+ ).finish(),
24274
+ "/ault.market.v1.MsgUpdateMarketDeployer": (value) => MsgUpdateMarketDeployer.encode(
24275
+ MsgUpdateMarketDeployer.fromPartial(mapAultMarketV1MsgUpdateMarketDeployer(value))
24276
+ ).finish(),
24277
+ "/ault.market.v1.MsgUpdateParams": (value) => MsgUpdateParams5.encode(
24278
+ MsgUpdateParams5.fromPartial(mapAultMarketV1MsgUpdateParams(value))
24279
+ ).finish(),
24280
+ "/ault.miner.v1.MsgBatchSubmitWork": (value) => MsgBatchSubmitWork.encode(
24281
+ MsgBatchSubmitWork.fromPartial(mapAultMinerV1MsgBatchSubmitWork(value))
24282
+ ).finish(),
24283
+ "/ault.miner.v1.MsgCancelMiningDelegation": (value) => MsgCancelMiningDelegation.encode(
24284
+ MsgCancelMiningDelegation.fromPartial(mapAultMinerV1MsgCancelMiningDelegation(value))
24285
+ ).finish(),
24286
+ "/ault.miner.v1.MsgDelegateMining": (value) => MsgDelegateMining.encode(
24287
+ MsgDelegateMining.fromPartial(mapAultMinerV1MsgDelegateMining(value))
24288
+ ).finish(),
24289
+ "/ault.miner.v1.MsgRedelegateMining": (value) => MsgRedelegateMining.encode(
24290
+ MsgRedelegateMining.fromPartial(mapAultMinerV1MsgRedelegateMining(value))
24291
+ ).finish(),
24292
+ "/ault.miner.v1.MsgRegisterOperator": (value) => MsgRegisterOperator.encode(
24293
+ MsgRegisterOperator.fromPartial(mapAultMinerV1MsgRegisterOperator(value))
24294
+ ).finish(),
24295
+ "/ault.miner.v1.MsgSetOwnerVrfKey": (value) => MsgSetOwnerVrfKey.encode(
24296
+ MsgSetOwnerVrfKey.fromPartial(mapAultMinerV1MsgSetOwnerVrfKey(value))
24297
+ ).finish(),
24298
+ "/ault.miner.v1.MsgSubmitWork": (value) => MsgSubmitWork.encode(MsgSubmitWork.fromPartial(mapAultMinerV1MsgSubmitWork(value))).finish(),
24299
+ "/ault.miner.v1.MsgUnregisterOperator": (value) => MsgUnregisterOperator.encode(
24300
+ MsgUnregisterOperator.fromPartial(mapAultMinerV1MsgUnregisterOperator(value))
24301
+ ).finish(),
24302
+ "/ault.miner.v1.MsgUpdateOperatorInfo": (value) => MsgUpdateOperatorInfo.encode(
24303
+ MsgUpdateOperatorInfo.fromPartial(mapAultMinerV1MsgUpdateOperatorInfo(value))
24304
+ ).finish(),
24305
+ "/ault.miner.v1.MsgUpdateParams": (value) => MsgUpdateParams6.encode(
24306
+ MsgUpdateParams6.fromPartial(mapAultMinerV1MsgUpdateParams(value))
24307
+ ).finish(),
24308
+ "/ault.ratelimit.v1.MsgUpdateParams": (value) => MsgUpdateParams7.encode(
24309
+ MsgUpdateParams7.fromPartial(mapAultRatelimitV1MsgUpdateParams(value))
24310
+ ).finish(),
24311
+ "/ault.reward.v1.MsgApproveBuilder": (value) => MsgApproveBuilder.encode(
24312
+ MsgApproveBuilder.fromPartial(mapAultRewardV1MsgApproveBuilder(value))
24313
+ ).finish(),
24314
+ "/ault.reward.v1.MsgRevokeBuilder": (value) => MsgRevokeBuilder.encode(
24315
+ MsgRevokeBuilder.fromPartial(mapAultRewardV1MsgRevokeBuilder(value))
24316
+ ).finish(),
24317
+ "/ault.reward.v1.MsgSetDeployerShare": (value) => MsgSetDeployerShare.encode(
24318
+ MsgSetDeployerShare.fromPartial(mapAultRewardV1MsgSetDeployerShare(value))
24319
+ ).finish(),
24320
+ "/ault.reward.v1.MsgSetReferral": (value) => MsgSetReferral.encode(
24321
+ MsgSetReferral.fromPartial(mapAultRewardV1MsgSetReferral(value))
24322
+ ).finish(),
24323
+ "/ault.reward.v1.MsgSetReferralCode": (value) => MsgSetReferralCode.encode(
24324
+ MsgSetReferralCode.fromPartial(mapAultRewardV1MsgSetReferralCode(value))
24325
+ ).finish(),
24326
+ "/ault.reward.v1.MsgUpdateEligibleReferrers": (value) => MsgUpdateEligibleReferrers.encode(
24327
+ MsgUpdateEligibleReferrers.fromPartial(mapAultRewardV1MsgUpdateEligibleReferrers(value))
24328
+ ).finish(),
24329
+ "/ault.reward.v1.MsgUpdateFeeTierDiscounts": (value) => MsgUpdateFeeTierDiscounts.encode(
24330
+ MsgUpdateFeeTierDiscounts.fromPartial(mapAultRewardV1MsgUpdateFeeTierDiscounts(value))
24331
+ ).finish(),
24332
+ "/ault.reward.v1.MsgUpdateParams": (value) => MsgUpdateParams8.encode(
24333
+ MsgUpdateParams8.fromPartial(mapAultRewardV1MsgUpdateParams(value))
24334
+ ).finish(),
24335
+ "/ault.reward.v1.MsgUpdateRefereeDiscountRate": (value) => MsgUpdateRefereeDiscountRate.encode(
24336
+ MsgUpdateRefereeDiscountRate.fromPartial(mapAultRewardV1MsgUpdateRefereeDiscountRate(value))
24337
+ ).finish(),
24338
+ "/ault.reward.v1.MsgUpdateTradingTierBenefits": (value) => MsgUpdateTradingTierBenefits.encode(
24339
+ MsgUpdateTradingTierBenefits.fromPartial(mapAultRewardV1MsgUpdateTradingTierBenefits(value))
24340
+ ).finish(),
24341
+ "/ault.tokenregistry.v1.MsgDisableTokenPair": (value) => MsgDisableTokenPair.encode(
24342
+ MsgDisableTokenPair.fromPartial(mapAultTokenregistryV1MsgDisableTokenPair(value))
24343
+ ).finish(),
24344
+ "/ault.tokenregistry.v1.MsgDisableTransfers": (value) => MsgDisableTransfers.encode(
24345
+ MsgDisableTransfers.fromPartial(mapAultTokenregistryV1MsgDisableTransfers(value))
24346
+ ).finish(),
24347
+ "/ault.tokenregistry.v1.MsgEnableTokenPair": (value) => MsgEnableTokenPair.encode(
24348
+ MsgEnableTokenPair.fromPartial(mapAultTokenregistryV1MsgEnableTokenPair(value))
24349
+ ).finish(),
24350
+ "/ault.tokenregistry.v1.MsgEnableTransfers": (value) => MsgEnableTransfers.encode(
24351
+ MsgEnableTransfers.fromPartial(mapAultTokenregistryV1MsgEnableTransfers(value))
24352
+ ).finish(),
24353
+ "/ault.tokenregistry.v1.MsgRegisterTokenPair": (value) => MsgRegisterTokenPair.encode(
24354
+ MsgRegisterTokenPair.fromPartial(mapAultTokenregistryV1MsgRegisterTokenPair(value))
24355
+ ).finish(),
24356
+ "/ault.tokenregistry.v1.MsgRemoveTransferLimit": (value) => MsgRemoveTransferLimit.encode(
24357
+ MsgRemoveTransferLimit.fromPartial(mapAultTokenregistryV1MsgRemoveTransferLimit(value))
24358
+ ).finish(),
24359
+ "/ault.tokenregistry.v1.MsgSetTransferLimit": (value) => MsgSetTransferLimit.encode(
24360
+ MsgSetTransferLimit.fromPartial(mapAultTokenregistryV1MsgSetTransferLimit(value))
24361
+ ).finish(),
24362
+ "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward": (value) => MsgWithdrawDelegatorReward.encode(
24363
+ MsgWithdrawDelegatorReward.fromPartial(
24364
+ mapCosmosDistributionV1beta1MsgWithdrawDelegatorReward(value)
24365
+ )
24366
+ ).finish(),
24367
+ "/cosmos.staking.v1beta1.MsgBeginRedelegate": (value) => MsgBeginRedelegate.encode(
24368
+ MsgBeginRedelegate.fromPartial(mapCosmosStakingV1beta1MsgBeginRedelegate(value))
24369
+ ).finish(),
24370
+ "/cosmos.staking.v1beta1.MsgDelegate": (value) => MsgDelegate.encode(MsgDelegate.fromPartial(mapCosmosStakingV1beta1MsgDelegate(value))).finish(),
24371
+ "/cosmos.staking.v1beta1.MsgUndelegate": (value) => MsgUndelegate.encode(
24372
+ MsgUndelegate.fromPartial(mapCosmosStakingV1beta1MsgUndelegate(value))
24373
+ ).finish()
24374
+ };
24375
+
24376
+ // src/eip712/simulate.ts
24377
+ var SIMULATE_PATH = "/cosmos/tx/v1beta1/simulate";
24378
+ var SIMULATION_PLACEHOLDER_PUBKEY = new Uint8Array([
24379
+ 2,
24380
+ 121,
24381
+ 190,
24382
+ 102,
24383
+ 126,
24384
+ 249,
24385
+ 220,
24386
+ 187,
24387
+ 172,
24388
+ 85,
24389
+ 160,
24390
+ 98,
24391
+ 149,
24392
+ 206,
24393
+ 135,
24394
+ 11,
24395
+ 7,
24396
+ 2,
24397
+ 155,
24398
+ 252,
24399
+ 219,
24400
+ 45,
24401
+ 206,
24402
+ 40,
24403
+ 217,
24404
+ 89,
24405
+ 242,
24406
+ 129,
24407
+ 91,
24408
+ 22,
24409
+ 248,
24410
+ 23,
24411
+ 152
24412
+ ]);
24413
+ var SIMULATION_PLACEHOLDER_SIGNATURE = new Uint8Array(64);
24414
+ var CHAIN_VERDICT_STATUSES = /* @__PURE__ */ new Set([400, 500]);
24415
+ var CHAIN_VERDICT_CODES = /* @__PURE__ */ new Set([2, 3]);
24416
+ async function simulateTx({
24417
+ network,
24418
+ msgs,
24419
+ memo = "",
24420
+ sequence,
24421
+ pubkeyBase64,
24422
+ placeholderGasLimit,
24423
+ placeholderFee,
24424
+ fetchFn,
24425
+ fetchOptions
24426
+ }) {
24427
+ const encodedMessages = msgs.map((msg2) => {
24428
+ const encoder = MSG_ENCODERS[msg2.typeUrl];
24429
+ if (!encoder) {
24430
+ throw new Error(`No encoder found for message type: ${msg2.typeUrl}`);
24431
+ }
24432
+ return { typeUrl: msg2.typeUrl, value: encoder(msg2.value) };
24433
+ });
24434
+ const pubkeyBytes = pubkeyBase64 ? base64ToBytes(pubkeyBase64) : SIMULATION_PLACEHOLDER_PUBKEY;
24435
+ const txRawBytes = encodeTxRaw({
24436
+ bodyBytes: encodeTxBody({ messages: encodedMessages, memo }),
24437
+ authInfoBytes: encodeAuthInfo({
24438
+ signerInfos: [
24439
+ {
24440
+ publicKey: {
24441
+ typeUrl: "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey",
24442
+ value: encodeEthSecp256k1PubKey(pubkeyBytes)
24443
+ },
24444
+ mode: SIGN_MODE_LEGACY_AMINO_JSON,
24445
+ sequence
24446
+ }
24447
+ ],
24448
+ fee: { amount: [placeholderFee], gasLimit: BigInt(placeholderGasLimit) }
24449
+ }),
24450
+ signatures: [SIMULATION_PLACEHOLDER_SIGNATURE]
24451
+ });
24452
+ const url = `${network.restUrl}${SIMULATE_PATH}`;
24453
+ let response;
24454
+ try {
24455
+ response = await postJson(
24456
+ url,
24457
+ { tx_bytes: bytesToBase64(txRawBytes) },
24458
+ {
24459
+ ...fetchOptions,
24460
+ // 500 carries the verdict; never retry it. The rest of the caller's
24461
+ // policy stays.
24462
+ retryableStatuses: (fetchOptions?.retryableStatuses ?? DEFAULT_RETRYABLE_STATUSES).filter(
24463
+ (status) => status !== 500
24464
+ )
24465
+ },
24466
+ fetchFn
24467
+ );
24468
+ } catch (error) {
24469
+ const verdict = chainVerdict(error);
24470
+ if (verdict) {
24471
+ throw new TxSimulationError(verdict);
24472
+ }
24473
+ const detail = error instanceof Error ? error.message : String(error);
24474
+ console.warn(`[ault-sdk] tx simulation unavailable (${url}); using static gas: ${detail}`);
24475
+ return null;
24476
+ }
24477
+ const gasUsed = response.gas_info?.gas_used;
24478
+ if (typeof gasUsed !== "string" || !/^\d+$/.test(gasUsed) || gasUsed === "0") {
24479
+ console.warn(`[ault-sdk] tx simulation returned no usable gas_used (${url}); using static gas`);
24480
+ return null;
24481
+ }
24482
+ return { gasUsed: BigInt(gasUsed) };
24483
+ }
24484
+ function chainVerdict(error) {
24485
+ if (!(error instanceof ApiError) || typeof error.status !== "number") return null;
24486
+ if (!CHAIN_VERDICT_STATUSES.has(error.status) || !error.response) return null;
24487
+ let body;
24488
+ try {
24489
+ body = JSON.parse(error.response);
24490
+ } catch {
24491
+ return null;
24492
+ }
24493
+ if (typeof body !== "object" || body === null) return null;
24494
+ const { code, message } = body;
24495
+ if (typeof code !== "number" || !CHAIN_VERDICT_CODES.has(code)) return null;
24496
+ if (typeof message !== "string" || message.length === 0) return null;
24497
+ return { rawLog: message, chainCode: code };
24498
+ }
24499
+
24500
+ // src/rest/feemarket.ts
24501
+ async function fetchFeeMarketParams(network, fetchFn, fetchOptions) {
24502
+ const data = await fetchJson(
24503
+ `${network.restUrl}/cosmos/evm/feemarket/v1/params`,
24504
+ {},
24505
+ fetchOptions,
24506
+ fetchFn
24507
+ );
24508
+ const raw = data.params ?? {};
24509
+ return {
24510
+ noBaseFee: raw.noBaseFee ?? raw.no_base_fee ?? false,
24511
+ baseFee: raw.baseFee ?? raw.base_fee ?? "0",
24512
+ minGasPrice: raw.minGasPrice ?? raw.min_gas_price ?? "0"
24513
+ };
24514
+ }
24515
+ var ONE_E18 = 1000000000000000000n;
24516
+ var DEFAULT_FEE_MARGIN_PERCENT = 20;
24517
+ function marginFactorScaled(marginPercent) {
24518
+ if (!Number.isFinite(marginPercent) || !Number.isInteger(marginPercent)) {
24519
+ throw new Error(`marginPercent must be a non-negative integer, got ${marginPercent}`);
24520
+ }
24521
+ if (marginPercent < 0) {
24522
+ throw new Error(`marginPercent must be >= 0, got ${marginPercent}`);
24523
+ }
24524
+ return BigInt(100 + marginPercent);
24525
+ }
24526
+ function computeRequiredFee(params, gas, options) {
24527
+ const margin = marginFactorScaled(options?.marginPercent ?? DEFAULT_FEE_MARGIN_PERCENT);
24528
+ const minGasPriceI = BigInt(cosmosDecToProtoInt(params.minGasPrice || "0"));
24529
+ const baseFeeI = params.noBaseFee ? 0n : BigInt(cosmosDecToProtoInt(params.baseFee || "0"));
24530
+ const effectiveI = baseFeeI > minGasPriceI ? baseFeeI : minGasPriceI;
24531
+ if (effectiveI <= 0n) return "0";
24532
+ const gasI = BigInt(gas);
24533
+ if (gasI <= 0n) return "0";
24534
+ const numerator = effectiveI * gasI * margin;
24535
+ const denominator = ONE_E18 * 100n;
24536
+ return ((numerator + denominator - 1n) / denominator).toString();
24537
+ }
24538
+ var DEFAULT_FEE_MARKET_TTL_MS = 3e3;
24539
+ function createFeeMarketCache(ttlMs = DEFAULT_FEE_MARKET_TTL_MS) {
24540
+ return { ttlMs, entries: /* @__PURE__ */ new Map() };
24541
+ }
24542
+ async function getCachedFeeMarketParams(cache, network, fetchFn, fetchOptions) {
24543
+ const key = network.chainId;
24544
+ const now = Date.now();
24545
+ if (cache) {
24546
+ const existing = cache.entries.get(key);
24547
+ if (existing && now - existing.fetchedAt < cache.ttlMs) {
24548
+ return existing.params;
24549
+ }
24550
+ }
24551
+ let params;
24552
+ try {
24553
+ params = await fetchFeeMarketParams(network, fetchFn, fetchOptions);
24554
+ } catch (error) {
24555
+ if (!isGatewayUnsupportedError(error)) throw error;
24556
+ params = null;
24557
+ }
24558
+ if (cache) {
24559
+ cache.entries.set(key, { params, fetchedAt: now });
24560
+ }
24561
+ return params;
24562
+ }
24563
+ function isGatewayUnsupportedError(error) {
24564
+ return error instanceof ApiError && (error.status === 404 || error.status === 501);
24565
+ }
24566
+ function computeEvmFeesPerGas(params, options) {
24567
+ const margin = marginFactorScaled(options?.marginPercent ?? DEFAULT_FEE_MARGIN_PERCENT);
24568
+ const minGasPriceI = BigInt(cosmosDecToProtoInt(params.minGasPrice || "0"));
24569
+ const baseFeeI = params.noBaseFee ? 0n : BigInt(cosmosDecToProtoInt(params.baseFee || "0"));
24570
+ const effectiveI = baseFeeI > minGasPriceI ? baseFeeI : minGasPriceI;
24571
+ if (effectiveI <= 0n) {
24572
+ return { maxFeePerGas: 0n, maxPriorityFeePerGas: 0n };
24573
+ }
24574
+ const numerator = effectiveI * margin;
24575
+ const denominator = ONE_E18 * 100n;
24576
+ const gasPriceWei = (numerator + denominator - 1n) / denominator;
24577
+ return { maxFeePerGas: gasPriceWei, maxPriorityFeePerGas: gasPriceWei };
24578
+ }
24579
+ async function resolveEvmFeesPerGas(network, options) {
24580
+ const params = await getCachedFeeMarketParams(
24581
+ options?.cache,
24582
+ network,
24583
+ options?.fetchFn,
24584
+ options?.fetchOptions
24585
+ );
24586
+ if (!params) return null;
24587
+ let fees;
24588
+ try {
24589
+ fees = computeEvmFeesPerGas(params, { marginPercent: options?.marginPercent });
24590
+ } catch {
24591
+ return null;
24592
+ }
24593
+ if (fees.maxFeePerGas === 0n && fees.maxPriorityFeePerGas === 0n) return null;
24594
+ return fees;
24595
+ }
24596
+
24597
+ // src/eip712/signers.ts
24598
+ import { privateKeyToAccount } from "viem/accounts";
24599
+ var AULT_SIGNER_MARKER = /* @__PURE__ */ Symbol.for("ault-sdk:signer");
24600
+ function isAultSigner(obj) {
24601
+ return typeof obj === "object" && obj !== null && AULT_SIGNER_MARKER in obj && obj[AULT_SIGNER_MARKER] === true;
24602
+ }
24603
+ function normalizeSigner(input) {
24604
+ if (!input) return null;
24605
+ if (typeof input === "function") {
24606
+ return { signTypedData: input };
24607
+ }
24608
+ if (typeof input === "object" && typeof input.signTypedData === "function") {
24609
+ return input;
24610
+ }
24611
+ throw new Error("Invalid signer: expected a signer object or signTypedData function.");
24612
+ }
24613
+ function normalizeSignature(result) {
24614
+ if (typeof result === "string") {
24615
+ return result;
24616
+ }
24617
+ if (result && typeof result.signature === "string") {
24618
+ return result.signature;
24619
+ }
24620
+ throw new Error("Invalid signature response: expected hex string or { signature }.");
24621
+ }
24622
+ async function getSignerAddress(signer) {
24623
+ if (typeof signer.address === "string") {
24624
+ return signer.address;
24625
+ }
24626
+ if (typeof signer.getAddress === "function") {
24627
+ const address = await signer.getAddress();
24628
+ return typeof address === "string" ? address : null;
24629
+ }
24630
+ return null;
24631
+ }
24632
+ async function resolveSignerAddress(signer, signerAddress) {
24633
+ const raw = signerAddress ?? (signer ? await getSignerAddress(signer) : null);
24634
+ if (!raw) {
24635
+ throw new Error("signerAddress is required when the signer has no address.");
24636
+ }
24637
+ if (isValidAultAddress(raw)) {
24638
+ return raw;
24639
+ }
24640
+ if (isValidEvmAddress(raw)) {
24641
+ return evmToAult(raw);
24642
+ }
24643
+ throw new Error(`Invalid signerAddress: ${raw}`);
24644
+ }
24645
+ function stripEip712Domain(types) {
24646
+ const { EIP712Domain: _removed, ...rest } = types;
24647
+ return rest;
24648
+ }
24649
+ function createEip1193Signer(options) {
24650
+ const method = options.method ?? "eth_signTypedData_v4";
24651
+ return {
24652
+ [AULT_SIGNER_MARKER]: true,
24653
+ address: options.address,
24654
+ signTypedData: async (typedData) => {
24655
+ const payload = method === "eth_signTypedData_v4" ? JSON.stringify(typedData) : typedData;
24656
+ const signature = await options.provider.request({
24657
+ method,
24658
+ params: [options.address, payload]
24659
+ });
24660
+ if (typeof signature !== "string") {
24661
+ throw new Error("Provider did not return a signature string.");
24662
+ }
24663
+ return { signature };
24664
+ }
24665
+ };
24666
+ }
24667
+ function createViemSigner(wallet, options) {
24668
+ const preferRpc = options?.preferRpc ?? true;
24669
+ const getAddress3 = async () => {
24670
+ if (wallet.address) return wallet.address;
24671
+ if (wallet.getAddresses) {
24672
+ const addresses = await wallet.getAddresses();
24673
+ if (addresses?.length) return addresses[0];
24674
+ }
24675
+ return void 0;
24676
+ };
24677
+ return {
24678
+ [AULT_SIGNER_MARKER]: true,
24679
+ getAddress: async () => {
24680
+ const addr = await getAddress3();
24681
+ if (!addr) throw new Error("Viem wallet has no address");
24682
+ return addr;
24683
+ },
24684
+ signTypedData: async (typedData) => {
24685
+ if (preferRpc && wallet.request) {
24686
+ const address = await getAddress3();
24687
+ if (!address) {
24688
+ throw new Error("Viem wallet has no address; pass signerAddress explicitly.");
24689
+ }
24690
+ const signature2 = await wallet.request({
24691
+ method: "eth_signTypedData_v4",
24692
+ params: [address, JSON.stringify(typedData)]
24693
+ });
24694
+ if (typeof signature2 !== "string") {
24695
+ throw new Error("RPC signer did not return a signature string.");
24696
+ }
24697
+ return { signature: signature2 };
24698
+ }
24699
+ if (!wallet.signTypedData) {
24700
+ throw new Error("Viem signer does not support signTypedData.");
24701
+ }
24702
+ const signature = await wallet.signTypedData({
24703
+ domain: typedData.domain,
24704
+ types: typedData.types,
24705
+ primaryType: typedData.primaryType,
24706
+ message: typedData.message
24707
+ });
24708
+ return { signature };
24709
+ }
24710
+ };
24711
+ }
24712
+ function createEthersSigner(signer) {
24713
+ const sign = signer.signTypedData ?? signer._signTypedData;
24714
+ if (!sign) {
24715
+ throw new Error("Ethers signer must implement signTypedData or _signTypedData.");
24716
+ }
24351
24717
  return {
24352
- delegatorAddress: requireString(record2["delegatorAddress"], `${prefix}delegatorAddress`),
24353
- validatorAddress: requireString(record2["validatorAddress"], `${prefix}validatorAddress`),
24354
- amount: mapCosmosBaseV1beta1Coin(asRecord(record2["amount"]), `${prefix}amount`)
24718
+ [AULT_SIGNER_MARKER]: true,
24719
+ getAddress: () => signer.getAddress(),
24720
+ signTypedData: async (typedData) => {
24721
+ const types = stripEip712Domain(typedData.types);
24722
+ const signature = await sign(typedData.domain, types, typedData.message);
24723
+ return { signature };
24724
+ }
24355
24725
  };
24356
24726
  }
24357
- function mapGoogleProtobufAny(input, label = "value") {
24358
- const record2 = asRecord(input);
24359
- const prefix = label ? `${label}.` : "";
24727
+ function createPrivySigner(options) {
24360
24728
  return {
24361
- typeUrl: requireString(record2["typeUrl"], `${prefix}typeUrl`),
24362
- value: requireBytes(record2["value"], `${prefix}value`)
24729
+ [AULT_SIGNER_MARKER]: true,
24730
+ address: options.address,
24731
+ signTypedData: (typedData) => options.signTypedData(typedData, options.address ? { address: options.address } : void 0)
24363
24732
  };
24364
24733
  }
24365
- var MSG_ENCODERS = {
24366
- "/ault.accountx.v1.MsgOpenAccount": (value) => MsgOpenAccount.encode(
24367
- MsgOpenAccount.fromPartial(mapAultAccountxV1MsgOpenAccount(value))
24368
- ).finish(),
24369
- "/ault.accountx.v1.MsgUpdateFeeTiers": (value) => MsgUpdateFeeTiers.encode(
24370
- MsgUpdateFeeTiers.fromPartial(mapAultAccountxV1MsgUpdateFeeTiers(value))
24371
- ).finish(),
24372
- "/ault.accountx.v1.MsgUpdateParams": (value) => MsgUpdateParams.encode(
24373
- MsgUpdateParams.fromPartial(mapAultAccountxV1MsgUpdateParams(value))
24374
- ).finish(),
24375
- "/ault.accountx.v1.MsgUpdateTradingTiers": (value) => MsgUpdateTradingTiers.encode(
24376
- MsgUpdateTradingTiers.fromPartial(mapAultAccountxV1MsgUpdateTradingTiers(value))
24377
- ).finish(),
24378
- "/ault.agent.v1.MsgApproveAgent": (value) => MsgApproveAgent.encode(
24379
- MsgApproveAgent.fromPartial(mapAultAgentV1MsgApproveAgent(value))
24380
- ).finish(),
24381
- "/ault.agent.v1.MsgRevokeAgent": (value) => MsgRevokeAgent.encode(MsgRevokeAgent.fromPartial(mapAultAgentV1MsgRevokeAgent(value))).finish(),
24382
- "/ault.agent.v1.MsgUpdateParams": (value) => MsgUpdateParams2.encode(
24383
- MsgUpdateParams2.fromPartial(mapAultAgentV1MsgUpdateParams(value))
24384
- ).finish(),
24385
- "/ault.authority.v1.MsgGrantRole": (value) => MsgGrantRole.encode(MsgGrantRole.fromPartial(mapAultAuthorityV1MsgGrantRole(value))).finish(),
24386
- "/ault.authority.v1.MsgRevokeRole": (value) => MsgRevokeRole.encode(
24387
- MsgRevokeRole.fromPartial(mapAultAuthorityV1MsgRevokeRole(value))
24388
- ).finish(),
24389
- "/ault.clob.v1.MsgCancelOrders": (value) => MsgCancelOrders.encode(
24390
- MsgCancelOrders.fromPartial(mapAultClobV1MsgCancelOrders(value))
24391
- ).finish(),
24392
- "/ault.clob.v1.MsgModifyOrders": (value) => MsgModifyOrders.encode(
24393
- MsgModifyOrders.fromPartial(mapAultClobV1MsgModifyOrders(value))
24394
- ).finish(),
24395
- "/ault.clob.v1.MsgPlaceLimitOrder": (value) => MsgPlaceLimitOrder.encode(
24396
- MsgPlaceLimitOrder.fromPartial(mapAultClobV1MsgPlaceLimitOrder(value))
24397
- ).finish(),
24398
- "/ault.clob.v1.MsgPlaceMarketOrder": (value) => MsgPlaceMarketOrder.encode(
24399
- MsgPlaceMarketOrder.fromPartial(mapAultClobV1MsgPlaceMarketOrder(value))
24400
- ).finish(),
24401
- "/ault.clob.v1.MsgPlaceScaleOrder": (value) => MsgPlaceScaleOrder.encode(
24402
- MsgPlaceScaleOrder.fromPartial(mapAultClobV1MsgPlaceScaleOrder(value))
24403
- ).finish(),
24404
- "/ault.clob.v1.MsgPlaceTwapOrder": (value) => MsgPlaceTwapOrder.encode(
24405
- MsgPlaceTwapOrder.fromPartial(mapAultClobV1MsgPlaceTwapOrder(value))
24406
- ).finish(),
24407
- "/ault.clob.v1.MsgUpdateParams": (value) => MsgUpdateParams3.encode(
24408
- MsgUpdateParams3.fromPartial(mapAultClobV1MsgUpdateParams(value))
24409
- ).finish(),
24410
- "/ault.license.v1.MsgApproveMember": (value) => MsgApproveMember.encode(
24411
- MsgApproveMember.fromPartial(mapAultLicenseV1MsgApproveMember(value))
24412
- ).finish(),
24413
- "/ault.license.v1.MsgBatchApproveMember": (value) => MsgBatchApproveMember.encode(
24414
- MsgBatchApproveMember.fromPartial(mapAultLicenseV1MsgBatchApproveMember(value))
24415
- ).finish(),
24416
- "/ault.license.v1.MsgBatchMintLicense": (value) => MsgBatchMintLicense.encode(
24417
- MsgBatchMintLicense.fromPartial(mapAultLicenseV1MsgBatchMintLicense(value))
24418
- ).finish(),
24419
- "/ault.license.v1.MsgBatchRevokeMember": (value) => MsgBatchRevokeMember.encode(
24420
- MsgBatchRevokeMember.fromPartial(mapAultLicenseV1MsgBatchRevokeMember(value))
24421
- ).finish(),
24422
- "/ault.license.v1.MsgBurnLicense": (value) => MsgBurnLicense.encode(
24423
- MsgBurnLicense.fromPartial(mapAultLicenseV1MsgBurnLicense(value))
24424
- ).finish(),
24425
- "/ault.license.v1.MsgMintLicense": (value) => MsgMintLicense.encode(
24426
- MsgMintLicense.fromPartial(mapAultLicenseV1MsgMintLicense(value))
24427
- ).finish(),
24428
- "/ault.license.v1.MsgRevokeLicense": (value) => MsgRevokeLicense.encode(
24429
- MsgRevokeLicense.fromPartial(mapAultLicenseV1MsgRevokeLicense(value))
24430
- ).finish(),
24431
- "/ault.license.v1.MsgRevokeMember": (value) => MsgRevokeMember.encode(
24432
- MsgRevokeMember.fromPartial(mapAultLicenseV1MsgRevokeMember(value))
24433
- ).finish(),
24434
- "/ault.license.v1.MsgSetKYCApprovers": (value) => MsgSetKYCApprovers.encode(
24435
- MsgSetKYCApprovers.fromPartial(mapAultLicenseV1MsgSetKYCApprovers(value))
24436
- ).finish(),
24437
- "/ault.license.v1.MsgSetMinters": (value) => MsgSetMinters.encode(MsgSetMinters.fromPartial(mapAultLicenseV1MsgSetMinters(value))).finish(),
24438
- "/ault.license.v1.MsgSetTokenURI": (value) => MsgSetTokenURI.encode(
24439
- MsgSetTokenURI.fromPartial(mapAultLicenseV1MsgSetTokenURI(value))
24440
- ).finish(),
24441
- "/ault.license.v1.MsgTransferLicense": (value) => MsgTransferLicense.encode(
24442
- MsgTransferLicense.fromPartial(mapAultLicenseV1MsgTransferLicense(value))
24443
- ).finish(),
24444
- "/ault.license.v1.MsgUpdateParams": (value) => MsgUpdateParams4.encode(
24445
- MsgUpdateParams4.fromPartial(mapAultLicenseV1MsgUpdateParams(value))
24446
- ).finish(),
24447
- "/ault.market.v1.MsgCreateMarket": (value) => MsgCreateMarket.encode(
24448
- MsgCreateMarket.fromPartial(mapAultMarketV1MsgCreateMarket(value))
24449
- ).finish(),
24450
- "/ault.market.v1.MsgHaltAllMarkets": (value) => MsgHaltAllMarkets.encode(
24451
- MsgHaltAllMarkets.fromPartial(mapAultMarketV1MsgHaltAllMarkets(value))
24452
- ).finish(),
24453
- "/ault.market.v1.MsgHaltMarkets": (value) => MsgHaltMarkets.encode(
24454
- MsgHaltMarkets.fromPartial(mapAultMarketV1MsgHaltMarkets(value))
24455
- ).finish(),
24456
- "/ault.market.v1.MsgResumeAllMarkets": (value) => MsgResumeAllMarkets.encode(
24457
- MsgResumeAllMarkets.fromPartial(mapAultMarketV1MsgResumeAllMarkets(value))
24458
- ).finish(),
24459
- "/ault.market.v1.MsgResumeMarkets": (value) => MsgResumeMarkets.encode(
24460
- MsgResumeMarkets.fromPartial(mapAultMarketV1MsgResumeMarkets(value))
24461
- ).finish(),
24462
- "/ault.market.v1.MsgUpdateMarket": (value) => MsgUpdateMarket.encode(
24463
- MsgUpdateMarket.fromPartial(mapAultMarketV1MsgUpdateMarket(value))
24464
- ).finish(),
24465
- "/ault.market.v1.MsgUpdateMarketDeployer": (value) => MsgUpdateMarketDeployer.encode(
24466
- MsgUpdateMarketDeployer.fromPartial(mapAultMarketV1MsgUpdateMarketDeployer(value))
24467
- ).finish(),
24468
- "/ault.market.v1.MsgUpdateParams": (value) => MsgUpdateParams5.encode(
24469
- MsgUpdateParams5.fromPartial(mapAultMarketV1MsgUpdateParams(value))
24470
- ).finish(),
24471
- "/ault.miner.v1.MsgBatchSubmitWork": (value) => MsgBatchSubmitWork.encode(
24472
- MsgBatchSubmitWork.fromPartial(mapAultMinerV1MsgBatchSubmitWork(value))
24473
- ).finish(),
24474
- "/ault.miner.v1.MsgCancelMiningDelegation": (value) => MsgCancelMiningDelegation.encode(
24475
- MsgCancelMiningDelegation.fromPartial(mapAultMinerV1MsgCancelMiningDelegation(value))
24476
- ).finish(),
24477
- "/ault.miner.v1.MsgDelegateMining": (value) => MsgDelegateMining.encode(
24478
- MsgDelegateMining.fromPartial(mapAultMinerV1MsgDelegateMining(value))
24479
- ).finish(),
24480
- "/ault.miner.v1.MsgRedelegateMining": (value) => MsgRedelegateMining.encode(
24481
- MsgRedelegateMining.fromPartial(mapAultMinerV1MsgRedelegateMining(value))
24482
- ).finish(),
24483
- "/ault.miner.v1.MsgRegisterOperator": (value) => MsgRegisterOperator.encode(
24484
- MsgRegisterOperator.fromPartial(mapAultMinerV1MsgRegisterOperator(value))
24485
- ).finish(),
24486
- "/ault.miner.v1.MsgSetOwnerVrfKey": (value) => MsgSetOwnerVrfKey.encode(
24487
- MsgSetOwnerVrfKey.fromPartial(mapAultMinerV1MsgSetOwnerVrfKey(value))
24488
- ).finish(),
24489
- "/ault.miner.v1.MsgSubmitWork": (value) => MsgSubmitWork.encode(MsgSubmitWork.fromPartial(mapAultMinerV1MsgSubmitWork(value))).finish(),
24490
- "/ault.miner.v1.MsgUnregisterOperator": (value) => MsgUnregisterOperator.encode(
24491
- MsgUnregisterOperator.fromPartial(mapAultMinerV1MsgUnregisterOperator(value))
24492
- ).finish(),
24493
- "/ault.miner.v1.MsgUpdateOperatorInfo": (value) => MsgUpdateOperatorInfo.encode(
24494
- MsgUpdateOperatorInfo.fromPartial(mapAultMinerV1MsgUpdateOperatorInfo(value))
24495
- ).finish(),
24496
- "/ault.miner.v1.MsgUpdateParams": (value) => MsgUpdateParams6.encode(
24497
- MsgUpdateParams6.fromPartial(mapAultMinerV1MsgUpdateParams(value))
24498
- ).finish(),
24499
- "/ault.ratelimit.v1.MsgUpdateParams": (value) => MsgUpdateParams7.encode(
24500
- MsgUpdateParams7.fromPartial(mapAultRatelimitV1MsgUpdateParams(value))
24501
- ).finish(),
24502
- "/ault.reward.v1.MsgApproveBuilder": (value) => MsgApproveBuilder.encode(
24503
- MsgApproveBuilder.fromPartial(mapAultRewardV1MsgApproveBuilder(value))
24504
- ).finish(),
24505
- "/ault.reward.v1.MsgRevokeBuilder": (value) => MsgRevokeBuilder.encode(
24506
- MsgRevokeBuilder.fromPartial(mapAultRewardV1MsgRevokeBuilder(value))
24507
- ).finish(),
24508
- "/ault.reward.v1.MsgSetDeployerShare": (value) => MsgSetDeployerShare.encode(
24509
- MsgSetDeployerShare.fromPartial(mapAultRewardV1MsgSetDeployerShare(value))
24510
- ).finish(),
24511
- "/ault.reward.v1.MsgSetReferral": (value) => MsgSetReferral.encode(
24512
- MsgSetReferral.fromPartial(mapAultRewardV1MsgSetReferral(value))
24513
- ).finish(),
24514
- "/ault.reward.v1.MsgSetReferralCode": (value) => MsgSetReferralCode.encode(
24515
- MsgSetReferralCode.fromPartial(mapAultRewardV1MsgSetReferralCode(value))
24516
- ).finish(),
24517
- "/ault.reward.v1.MsgUpdateEligibleReferrers": (value) => MsgUpdateEligibleReferrers.encode(
24518
- MsgUpdateEligibleReferrers.fromPartial(mapAultRewardV1MsgUpdateEligibleReferrers(value))
24519
- ).finish(),
24520
- "/ault.reward.v1.MsgUpdateFeeTierDiscounts": (value) => MsgUpdateFeeTierDiscounts.encode(
24521
- MsgUpdateFeeTierDiscounts.fromPartial(mapAultRewardV1MsgUpdateFeeTierDiscounts(value))
24522
- ).finish(),
24523
- "/ault.reward.v1.MsgUpdateParams": (value) => MsgUpdateParams8.encode(
24524
- MsgUpdateParams8.fromPartial(mapAultRewardV1MsgUpdateParams(value))
24525
- ).finish(),
24526
- "/ault.reward.v1.MsgUpdateRefereeDiscountRate": (value) => MsgUpdateRefereeDiscountRate.encode(
24527
- MsgUpdateRefereeDiscountRate.fromPartial(mapAultRewardV1MsgUpdateRefereeDiscountRate(value))
24528
- ).finish(),
24529
- "/ault.reward.v1.MsgUpdateTradingTierBenefits": (value) => MsgUpdateTradingTierBenefits.encode(
24530
- MsgUpdateTradingTierBenefits.fromPartial(mapAultRewardV1MsgUpdateTradingTierBenefits(value))
24531
- ).finish(),
24532
- "/ault.tokenregistry.v1.MsgDisableTokenPair": (value) => MsgDisableTokenPair.encode(
24533
- MsgDisableTokenPair.fromPartial(mapAultTokenregistryV1MsgDisableTokenPair(value))
24534
- ).finish(),
24535
- "/ault.tokenregistry.v1.MsgDisableTransfers": (value) => MsgDisableTransfers.encode(
24536
- MsgDisableTransfers.fromPartial(mapAultTokenregistryV1MsgDisableTransfers(value))
24537
- ).finish(),
24538
- "/ault.tokenregistry.v1.MsgEnableTokenPair": (value) => MsgEnableTokenPair.encode(
24539
- MsgEnableTokenPair.fromPartial(mapAultTokenregistryV1MsgEnableTokenPair(value))
24540
- ).finish(),
24541
- "/ault.tokenregistry.v1.MsgEnableTransfers": (value) => MsgEnableTransfers.encode(
24542
- MsgEnableTransfers.fromPartial(mapAultTokenregistryV1MsgEnableTransfers(value))
24543
- ).finish(),
24544
- "/ault.tokenregistry.v1.MsgRegisterTokenPair": (value) => MsgRegisterTokenPair.encode(
24545
- MsgRegisterTokenPair.fromPartial(mapAultTokenregistryV1MsgRegisterTokenPair(value))
24546
- ).finish(),
24547
- "/ault.tokenregistry.v1.MsgRemoveTransferLimit": (value) => MsgRemoveTransferLimit.encode(
24548
- MsgRemoveTransferLimit.fromPartial(mapAultTokenregistryV1MsgRemoveTransferLimit(value))
24549
- ).finish(),
24550
- "/ault.tokenregistry.v1.MsgSetTransferLimit": (value) => MsgSetTransferLimit.encode(
24551
- MsgSetTransferLimit.fromPartial(mapAultTokenregistryV1MsgSetTransferLimit(value))
24552
- ).finish(),
24553
- "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward": (value) => MsgWithdrawDelegatorReward.encode(
24554
- MsgWithdrawDelegatorReward.fromPartial(
24555
- mapCosmosDistributionV1beta1MsgWithdrawDelegatorReward(value)
24556
- )
24557
- ).finish(),
24558
- "/cosmos.staking.v1beta1.MsgBeginRedelegate": (value) => MsgBeginRedelegate.encode(
24559
- MsgBeginRedelegate.fromPartial(mapCosmosStakingV1beta1MsgBeginRedelegate(value))
24560
- ).finish(),
24561
- "/cosmos.staking.v1beta1.MsgDelegate": (value) => MsgDelegate.encode(MsgDelegate.fromPartial(mapCosmosStakingV1beta1MsgDelegate(value))).finish(),
24562
- "/cosmos.staking.v1beta1.MsgUndelegate": (value) => MsgUndelegate.encode(
24563
- MsgUndelegate.fromPartial(mapCosmosStakingV1beta1MsgUndelegate(value))
24564
- ).finish()
24565
- };
24734
+ function createPrivateKeySigner(privateKey) {
24735
+ const normalized = privateKey.startsWith("0x") ? privateKey : `0x${privateKey}`;
24736
+ const account = privateKeyToAccount(normalized);
24737
+ return createViemSigner(account);
24738
+ }
24739
+
24740
+ // src/utils/tx-hash.ts
24741
+ function normalizeTxHash(raw) {
24742
+ if (!raw) return raw;
24743
+ const stripped = raw.startsWith("0x") || raw.startsWith("0X") ? raw.slice(2) : raw;
24744
+ return stripped.toLowerCase();
24745
+ }
24566
24746
 
24567
24747
  // src/eip712/sign-and-broadcast.ts
24568
24748
  async function queryAccount(network, address, fetchFn, fetchOptions) {
@@ -24621,6 +24801,9 @@ function createAccountCache() {
24621
24801
  function getNextSequence(sequence) {
24622
24802
  return String(BigInt(sequence) + 1n);
24623
24803
  }
24804
+ function isSequenceMismatch(rawLog) {
24805
+ return rawLog.includes("account sequence mismatch") || rawLog.includes("incorrect account sequence");
24806
+ }
24624
24807
  function clearCachedSequence(cache) {
24625
24808
  if (cache) {
24626
24809
  cache.nextSequence = null;
@@ -24723,6 +24906,8 @@ async function signAndBroadcastEip712({
24723
24906
  feeDenom,
24724
24907
  feeAmount,
24725
24908
  confirmationTimeoutMs,
24909
+ simulateGas = false,
24910
+ simulatedGasMultiplier,
24726
24911
  wait = true,
24727
24912
  fetchFn,
24728
24913
  fetchOptions,
@@ -24749,15 +24934,46 @@ async function signAndBroadcastEip712({
24749
24934
  if (!sequence) {
24750
24935
  throw new Error(`Unable to resolve account sequence for signer ${resolvedSignerAddress}.`);
24751
24936
  }
24752
- const resolvedGas = gasLimit ?? network.eip712GasLimit ?? GAS_CONSTANTS.EIP712_GAS_LIMIT;
24753
- const resolvedFeeAmount = feeAmount ?? network.eip712FeeAmount ?? await resolveDynamicFeeAmount(network, resolvedGas, feeMarketCache, fetchFn, fetchOptions);
24937
+ let resolvedGas = gasLimit ?? network.eip712GasLimit ?? GAS_CONSTANTS.EIP712_GAS_LIMIT;
24938
+ const resolvedFeeDenom = feeDenom ?? network.eip712FeeDenom ?? GAS_CONSTANTS.DENOM;
24939
+ const feeOverride = feeAmount ?? network.eip712FeeAmount;
24940
+ const feeFor = async (gas) => feeOverride ?? await resolveDynamicFeeAmount(network, gas, feeMarketCache, fetchFn, fetchOptions);
24941
+ let resolvedFeeAmount;
24942
+ if (simulateGas) {
24943
+ let simulated;
24944
+ try {
24945
+ simulated = await simulateTx({
24946
+ network,
24947
+ msgs,
24948
+ memo,
24949
+ sequence,
24950
+ pubkeyBase64: cache?.pubkeyBase64 ?? accountInfo?.pubkeyBase64 ?? null,
24951
+ placeholderGasLimit: resolvedGas,
24952
+ placeholderFee: { denom: resolvedFeeDenom, amount: await feeFor(resolvedGas) },
24953
+ fetchFn,
24954
+ fetchOptions
24955
+ });
24956
+ } catch (error) {
24957
+ if (error instanceof TxSimulationError && isSequenceMismatch(error.rawLog)) {
24958
+ clearCachedSequence(cache);
24959
+ }
24960
+ throw error;
24961
+ }
24962
+ if (simulated) {
24963
+ resolvedGas = computeSimulatedGas(
24964
+ simulated.gasUsed,
24965
+ simulatedGasMultiplier ?? GAS_CONSTANTS.SIMULATED_GAS_MULTIPLIER
24966
+ );
24967
+ }
24968
+ }
24969
+ resolvedFeeAmount = await feeFor(resolvedGas);
24754
24970
  const context = {
24755
24971
  chainId: network.chainId,
24756
24972
  accountNumber,
24757
24973
  sequence,
24758
24974
  fee: {
24759
24975
  amount: resolvedFeeAmount,
24760
- denom: feeDenom ?? network.eip712FeeDenom ?? GAS_CONSTANTS.DENOM,
24976
+ denom: resolvedFeeDenom,
24761
24977
  gas: resolvedGas
24762
24978
  },
24763
24979
  memo
@@ -26422,6 +26638,13 @@ function createRewardTxApi({ signerAddress, exec, getGas }) {
26422
26638
  }
26423
26639
 
26424
26640
  // src/high-level/tx/staking.ts
26641
+ function stakingGasOptions(gas, fallbackMinGas, gasLimit) {
26642
+ return {
26643
+ gasLimit: gasLimit ?? computeFeeFreeGas(fallbackMinGas, 1, gas.FEE_FREE_GAS_MULTIPLIER),
26644
+ simulateGas: gasLimit == null,
26645
+ simulatedGasMultiplier: gas.SIMULATED_GAS_MULTIPLIER
26646
+ };
26647
+ }
26425
26648
  function createStakingTxApi({ signerAddress, exec, getGas }) {
26426
26649
  return {
26427
26650
  async delegate({ validatorAddress, amount, gasLimit, feeAmount, memo, confirmationTimeoutMs }) {
@@ -26435,7 +26658,7 @@ function createStakingTxApi({ signerAddress, exec, getGas }) {
26435
26658
  })
26436
26659
  ],
26437
26660
  {
26438
- gasLimit: gasLimit ?? computeFeeFreeGas(gas.DELEGATE, 1, gas.FEE_FREE_GAS_MULTIPLIER),
26661
+ ...stakingGasOptions(gas, gas.DELEGATE, gasLimit),
26439
26662
  feeAmount,
26440
26663
  memo,
26441
26664
  confirmationTimeoutMs
@@ -26460,7 +26683,7 @@ function createStakingTxApi({ signerAddress, exec, getGas }) {
26460
26683
  })
26461
26684
  ],
26462
26685
  {
26463
- gasLimit: gasLimit ?? computeFeeFreeGas(gas.UNDELEGATE, 1, gas.FEE_FREE_GAS_MULTIPLIER),
26686
+ ...stakingGasOptions(gas, gas.UNDELEGATE, gasLimit),
26464
26687
  feeAmount,
26465
26688
  memo,
26466
26689
  confirmationTimeoutMs
@@ -26487,7 +26710,7 @@ function createStakingTxApi({ signerAddress, exec, getGas }) {
26487
26710
  })
26488
26711
  ],
26489
26712
  {
26490
- gasLimit: gasLimit ?? computeFeeFreeGas(gas.BEGIN_REDELEGATE, 1, gas.FEE_FREE_GAS_MULTIPLIER),
26713
+ ...stakingGasOptions(gas, gas.BEGIN_REDELEGATE, gasLimit),
26491
26714
  feeAmount,
26492
26715
  memo,
26493
26716
  confirmationTimeoutMs
@@ -26506,7 +26729,7 @@ function createStakingTxApi({ signerAddress, exec, getGas }) {
26506
26729
  }
26507
26730
  const normalized = validatorAddresses.map(assertValidatorAddress);
26508
26731
  const gas = getGas();
26509
- const resolvedGasLimit = gasLimit ?? computeFeeFreeGas(gas.WITHDRAW_DELEGATOR_REWARD, 1, gas.FEE_FREE_GAS_MULTIPLIER);
26732
+ const gasOptions = stakingGasOptions(gas, gas.WITHDRAW_DELEGATOR_REWARD, gasLimit);
26510
26733
  const results = [];
26511
26734
  const partial = [];
26512
26735
  for (let i = 0; i < normalized.length; i++) {
@@ -26519,7 +26742,7 @@ function createStakingTxApi({ signerAddress, exec, getGas }) {
26519
26742
  validatorAddress
26520
26743
  })
26521
26744
  ],
26522
- { gasLimit: resolvedGasLimit, feeAmount, memo, confirmationTimeoutMs }
26745
+ { ...gasOptions, feeAmount, memo, confirmationTimeoutMs }
26523
26746
  );
26524
26747
  results.push(result);
26525
26748
  partial.push({ txHash: result.txHash, validatorAddress });
@@ -26708,6 +26931,8 @@ function createTxExecutor(options) {
26708
26931
  feeAmount: txOptions?.feeAmount,
26709
26932
  memo: txOptions?.memo ?? defaultMemo,
26710
26933
  confirmationTimeoutMs: txOptions?.confirmationTimeoutMs ?? defaultConfirmationTimeoutMs,
26934
+ simulateGas: txOptions?.simulateGas ?? false,
26935
+ simulatedGasMultiplier: txOptions?.simulatedGasMultiplier,
26711
26936
  wait: txOptions?.wait ?? true,
26712
26937
  fetchFn: options.fetchFn,
26713
26938
  fetchOptions,
@@ -26730,6 +26955,8 @@ function createTxExecutor(options) {
26730
26955
  import { z } from "zod";
26731
26956
  var ManifestGasSchema = z.object({
26732
26957
  FEE_FREE_GAS_MULTIPLIER: z.number().int().positive(),
26958
+ // Under 100% signs less gas than the simulation already burned.
26959
+ SIMULATED_GAS_MULTIPLIER: z.number().int().min(100),
26733
26960
  PER_LICENSE: z.number().int().positive(),
26734
26961
  PER_KYC_MEMBER: z.number().int().positive(),
26735
26962
  PER_DELEGATE_MINING: z.number().int().positive(),
@@ -28435,9 +28662,6 @@ var GetUDFTimescaleMarksResponse = zod.array(GetUDFTimescaleMarksResponseItem);
28435
28662
  function createDexWs(url, options) {
28436
28663
  return new DexWsClient(url, options);
28437
28664
  }
28438
-
28439
- // src/index.ts
28440
- var SDK_VERSION = "0.7.0";
28441
28665
  export {
28442
28666
  AGENT_DEFAULTS,
28443
28667
  AULT_SIGNER_MARKER,
@@ -28447,6 +28671,7 @@ export {
28447
28671
  BondStatus,
28448
28672
  COIN_TYPE,
28449
28673
  DEFAULT_CHAIN_ID,
28674
+ DEFAULT_RETRYABLE_STATUSES,
28450
28675
  DexWsClient,
28451
28676
  EIP712_DOMAIN_TYPE,
28452
28677
  EIP712_MSG_TYPES,
@@ -28522,6 +28747,7 @@ export {
28522
28747
  SDK_VERSION,
28523
28748
  SIGN_MODE_DIRECT,
28524
28749
  SIGN_MODE_LEGACY_AMINO_JSON,
28750
+ SIMULATION_PLACEHOLDER_PUBKEY,
28525
28751
  SearchUDFSymbolsQueryParams,
28526
28752
  SearchUDFSymbolsResponse,
28527
28753
  SearchUDFSymbolsResponseItem,
@@ -28531,6 +28757,8 @@ export {
28531
28757
  TxConfirmationUnavailableError,
28532
28758
  TxError,
28533
28759
  TxNotConfirmedError,
28760
+ TxSimulationError,
28761
+ USER_AGENT,
28534
28762
  BondStatus as ValidatorStatus,
28535
28763
  WebSocketError,
28536
28764
  WithdrawRewardsPartialError,
@@ -28553,6 +28781,7 @@ export {
28553
28781
  computeFeeFreeGas,
28554
28782
  computeFeeFreeGasCompound,
28555
28783
  computeRequiredFee,
28784
+ computeSimulatedGas,
28556
28785
  cosmosDecToDecimalString,
28557
28786
  cosmosDecToProtoInt,
28558
28787
  createAccountCache,
@@ -28716,6 +28945,7 @@ export {
28716
28945
  resolveSignerAddress,
28717
28946
  signAndBroadcastAgentTx,
28718
28947
  signAndBroadcastEip712,
28948
+ simulateTx,
28719
28949
  stripEip712Domain,
28720
28950
  toViemChain,
28721
28951
  validateEip712FieldOrder,