@sodax/sdk 2.1.0-rc.5 → 2.1.0-rc.7

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.cjs CHANGED
@@ -11,7 +11,7 @@ var bitcoinjsLib = require('bitcoinjs-lib');
11
11
  var ecc = require('@bitcoinerlab/secp256k1');
12
12
  var infinitySdk = require('@pancakeswap/infinity-sdk');
13
13
  var transactions = require('@mysten/sui/transactions');
14
- var client = require('@mysten/sui/client');
14
+ var grpc = require('@mysten/sui/grpc');
15
15
  var splToken = require('@solana/spl-token');
16
16
  var anchor = require('@coral-xyz/anchor');
17
17
  var BN = require('bn.js');
@@ -19,7 +19,7 @@ var IconSdkRaw = require('icon-sdk-js');
19
19
  var sdkTs = require('@injectivelabs/sdk-ts');
20
20
  var tx_js = require('cosmjs-types/cosmos/tx/v1beta1/tx.js');
21
21
  var networks = require('@injectivelabs/networks');
22
- var v7 = require('valibot');
22
+ var v = require('valibot');
23
23
  var swapsApi = require('@sodax/swaps-api');
24
24
  var BigNumber5 = require('bignumber.js');
25
25
  var swapSdkCore = require('@pancakeswap/swap-sdk-core');
@@ -49,7 +49,7 @@ var rlp__namespace = /*#__PURE__*/_interopNamespace(rlp);
49
49
  var ecc__namespace = /*#__PURE__*/_interopNamespace(ecc);
50
50
  var BN__default = /*#__PURE__*/_interopDefault(BN);
51
51
  var IconSdkRaw__namespace = /*#__PURE__*/_interopNamespace(IconSdkRaw);
52
- var v7__namespace = /*#__PURE__*/_interopNamespace(v7);
52
+ var v__namespace = /*#__PURE__*/_interopNamespace(v);
53
53
  var BigNumber5__default = /*#__PURE__*/_interopDefault(BigNumber5);
54
54
 
55
55
  // src/errors/SodaxError.ts
@@ -122,8 +122,8 @@ function serializeCause(cause, depth) {
122
122
  }
123
123
  function sanitizeContext(value, depth) {
124
124
  const out = {};
125
- for (const [key, v9] of Object.entries(value)) {
126
- out[key] = sanitizeValue(v9, depth + 1);
125
+ for (const [key, v10] of Object.entries(value)) {
126
+ out[key] = sanitizeValue(v10, depth + 1);
127
127
  }
128
128
  return out;
129
129
  }
@@ -134,13 +134,13 @@ function sanitizeValue(value, depth) {
134
134
  if (t === "bigint") return value.toString();
135
135
  if (t === "string" || t === "number" || t === "boolean") return value;
136
136
  if (t === "function" || t === "symbol") return safeString(value);
137
- if (Array.isArray(value)) return value.map((v9) => sanitizeValue(v9, depth + 1));
137
+ if (Array.isArray(value)) return value.map((v10) => sanitizeValue(v10, depth + 1));
138
138
  if (value instanceof Date) return value.toISOString();
139
139
  if (value instanceof Map) {
140
- return Array.from(value.entries()).map(([k, v9]) => [sanitizeValue(k, depth + 1), sanitizeValue(v9, depth + 1)]);
140
+ return Array.from(value.entries()).map(([k, v10]) => [sanitizeValue(k, depth + 1), sanitizeValue(v10, depth + 1)]);
141
141
  }
142
142
  if (value instanceof Set) {
143
- return Array.from(value.values()).map((v9) => sanitizeValue(v9, depth + 1));
143
+ return Array.from(value.values()).map((v10) => sanitizeValue(v10, depth + 1));
144
144
  }
145
145
  if (value instanceof Error) return { name: value.name, message: value.message };
146
146
  if (t === "object") {
@@ -152,9 +152,9 @@ function sanitizeValue(value, depth) {
152
152
  }
153
153
  return safeString(value);
154
154
  }
155
- function safeString(v9) {
155
+ function safeString(v10) {
156
156
  try {
157
- return String(v9);
157
+ return String(v10);
158
158
  } catch {
159
159
  return "[unserializable]";
160
160
  }
@@ -1387,7 +1387,7 @@ var baseSupportedTokens = {
1387
1387
  symbol: "AERO",
1388
1388
  name: "Aerodrome Finance",
1389
1389
  decimals: 18,
1390
- address: "0x940181a94A35A4569e4529A3CDfB74e38FD98631",
1390
+ address: "0x940181a94A35A4569E4529A3CDfB74e38FD98631",
1391
1391
  chainKey: ChainKeys.BASE_MAINNET,
1392
1392
  hubAsset: "0x348e086ab6f424dfc575a325c28624ed23973173",
1393
1393
  vault: "0x348e086ab6f424dfc575a325c28624ed23973173"
@@ -1699,7 +1699,7 @@ var polygonSupportedTokens = {
1699
1699
  symbol: "WBTC",
1700
1700
  name: "Wrapped BTC",
1701
1701
  decimals: 8,
1702
- address: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9bfD6",
1702
+ address: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",
1703
1703
  chainKey: ChainKeys.POLYGON_MAINNET,
1704
1704
  hubAsset: "0xf3182ae79be69d9e0cad5da8273d4300a7d585d3",
1705
1705
  vault: "0xf3182ae79be69d9e0cad5da8273d4300a7d585d3"
@@ -1717,7 +1717,7 @@ var polygonSupportedTokens = {
1717
1717
  symbol: "LINK",
1718
1718
  name: "ChainLink Token",
1719
1719
  decimals: 18,
1720
- address: "0x53E0bca35eC356BD5dDDFebbD1Fc0fD03FaBad39",
1720
+ address: "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39",
1721
1721
  chainKey: ChainKeys.POLYGON_MAINNET,
1722
1722
  hubAsset: "0x30d1be6ae96e9832674f1fcf429c5176bd891e1f",
1723
1723
  vault: "0x30d1be6ae96e9832674f1fcf429c5176bd891e1f"
@@ -3365,7 +3365,7 @@ var spokeChainConfig = {
3365
3365
  supportedTokens: suiSupportedTokens,
3366
3366
  nativeToken: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
3367
3367
  bnUSD: "0xff4de2b2b57dd7611d2812d231a467d007b702a101fd5c7ad3b278257cddb507::bnusd::BNUSD",
3368
- rpc_url: "https://sui-rpc.publicnode.com",
3368
+ grpc_url: "https://fullnode.mainnet.sui.io",
3369
3369
  chain: baseChainInfo[ChainKeys.SUI_MAINNET],
3370
3370
  pollingConfig: {
3371
3371
  pollingIntervalMs: 500,
@@ -4344,6 +4344,29 @@ var isHookSupportedToken = (chainKey, kind, token) => {
4344
4344
  return !hook.supportedTokens || hook.supportedTokens.some((t) => t.toLowerCase() === token.toLowerCase());
4345
4345
  };
4346
4346
 
4347
+ // ../types/dist/sui/core.js
4348
+ function toSuiPaginatedCoins(response, coinType) {
4349
+ return {
4350
+ data: response.objects.map((coin) => ({
4351
+ balance: coin.balance,
4352
+ coinObjectId: coin.objectId,
4353
+ coinType,
4354
+ digest: coin.digest,
4355
+ version: coin.version
4356
+ })),
4357
+ hasNextPage: response.hasNextPage,
4358
+ nextCursor: response.cursor
4359
+ };
4360
+ }
4361
+ function toSuiExecutionResult(command) {
4362
+ return {
4363
+ returnValues: command.returnValues.map((value) => [Array.from(value.bcs), ""])
4364
+ };
4365
+ }
4366
+ function toSuiExecutionStatus(status) {
4367
+ return status.success ? { status: "success" } : { status: "failure", error: status.error.message };
4368
+ }
4369
+
4347
4370
  // ../types/dist/utils/utils.js
4348
4371
  function isHubChainKey(chainId) {
4349
4372
  return chainId === HUB_CHAIN_KEY;
@@ -4458,7 +4481,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
4458
4481
  }
4459
4482
 
4460
4483
  // ../types/dist/index.js
4461
- var CONFIG_VERSION = 225;
4484
+ var CONFIG_VERSION = 227;
4462
4485
 
4463
4486
  // src/shared/utils/resolveTimeoutMs.ts
4464
4487
  function resolveTimeoutMs(timeout, fallbackMs) {
@@ -4845,10 +4868,11 @@ async function submitTransaction(payload, apiUrl) {
4845
4868
  return { ok: false, error };
4846
4869
  }
4847
4870
  }
4848
- async function getTransactionPackets(payload, apiUrl) {
4871
+ async function getTransactionPackets(payload, apiUrl, timeoutMs) {
4849
4872
  invariant(payload.params.chain_id.length > 0, "Invalid input parameters. source_chain_id empty");
4850
4873
  invariant(payload.params.tx_hash.length > 0, "Invalid input parameters. tx_hash empty");
4851
- return postRequest(payload, apiUrl);
4874
+ if (timeoutMs === void 0) return postRequest(payload, apiUrl);
4875
+ return pollTransactionPackets(payload, apiUrl, Date.now() + resolveTimeoutMs(timeoutMs, RELAY_REQUEST_TIMEOUT_MS));
4852
4876
  }
4853
4877
  async function getPacket(payload, apiUrl) {
4854
4878
  invariant(payload.params.chain_id.length > 0, "Invalid input parameters. source_chain_id empty");
@@ -14395,7 +14419,7 @@ function mergeSodaxConfig(base2, override) {
14395
14419
  }
14396
14420
  function encodeContractCalls(calls) {
14397
14421
  return viem.encodeAbiParameters(viem.parseAbiParameters("(address,uint256,bytes)[]"), [
14398
- calls.map((v9) => [v9.address, v9.value, v9.data])
14422
+ calls.map((v10) => [v10.address, v10.value, v10.data])
14399
14423
  ]);
14400
14424
  }
14401
14425
  async function waitForTransactionReceipt(hash, provider) {
@@ -15808,12 +15832,12 @@ function encodeBtcPayloadToBytes(payload) {
15808
15832
  });
15809
15833
  }
15810
15834
  function normalizePsbtToBase64(signedPsbt) {
15811
- const isHex = /^[0-9a-fA-F]+$/.test(signedPsbt);
15812
- return isHex ? Buffer.from(signedPsbt, "hex").toString("base64") : signedPsbt;
15835
+ const isHex2 = /^[0-9a-fA-F]+$/.test(signedPsbt);
15836
+ return isHex2 ? Buffer.from(signedPsbt, "hex").toString("base64") : signedPsbt;
15813
15837
  }
15814
15838
  function normalizeSignatureToBase64(signature) {
15815
- const isHex = /^[0-9a-fA-F]+$/.test(signature);
15816
- return isHex ? Buffer.from(signature, "hex").toString("base64") : signature;
15839
+ const isHex2 = /^[0-9a-fA-F]+$/.test(signature);
15840
+ return isHex2 ? Buffer.from(signature, "hex").toString("base64") : signature;
15817
15841
  }
15818
15842
 
15819
15843
  // src/shared/services/spoke/BitcoinSpokeService.ts
@@ -17087,22 +17111,22 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
17087
17111
  const byte0 = Uint8Array.of(0);
17088
17112
  const byte1 = Uint8Array.of(1);
17089
17113
  const _maxDrbgIters = 1e3;
17090
- let v9 = u8n(hashLen);
17114
+ let v10 = u8n(hashLen);
17091
17115
  let k = u8n(hashLen);
17092
17116
  let i = 0;
17093
17117
  const reset = () => {
17094
- v9.fill(1);
17118
+ v10.fill(1);
17095
17119
  k.fill(0);
17096
17120
  i = 0;
17097
17121
  };
17098
- const h = (...msgs) => hmacFn(k, concatBytes(v9, ...msgs));
17122
+ const h = (...msgs) => hmacFn(k, concatBytes(v10, ...msgs));
17099
17123
  const reseed = (seed = NULL) => {
17100
17124
  k = h(byte0, seed);
17101
- v9 = h();
17125
+ v10 = h();
17102
17126
  if (seed.length === 0)
17103
17127
  return;
17104
17128
  k = h(byte1, seed);
17105
- v9 = h();
17129
+ v10 = h();
17106
17130
  };
17107
17131
  const gen = () => {
17108
17132
  if (i++ >= _maxDrbgIters)
@@ -17110,10 +17134,10 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
17110
17134
  let len = 0;
17111
17135
  const out = [];
17112
17136
  while (len < qByteLen) {
17113
- v9 = h();
17114
- const sl = v9.slice();
17137
+ v10 = h();
17138
+ const sl = v10.slice();
17115
17139
  out.push(sl);
17116
- len += v9.length;
17140
+ len += v10.length;
17117
17141
  }
17118
17142
  return concatBytes(...out);
17119
17143
  };
@@ -17139,7 +17163,7 @@ function validateObject(object5, fields = {}, optFields = {}) {
17139
17163
  if (current !== expectedType || val === null)
17140
17164
  throw new Error(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`);
17141
17165
  }
17142
- const iter = (f, isOpt) => Object.entries(f).forEach(([k, v9]) => checkField(k, v9, isOpt));
17166
+ const iter = (f, isOpt) => Object.entries(f).forEach(([k, v10]) => checkField(k, v10, isOpt));
17143
17167
  iter(fields, false);
17144
17168
  iter(optFields, true);
17145
17169
  }
@@ -17210,9 +17234,9 @@ function sqrt3mod4(Fp, n) {
17210
17234
  function sqrt5mod8(Fp, n) {
17211
17235
  const p5div8 = (Fp.ORDER - _5n) / _8n;
17212
17236
  const n2 = Fp.mul(n, _2n);
17213
- const v9 = Fp.pow(n2, p5div8);
17214
- const nv = Fp.mul(n, v9);
17215
- const i = Fp.mul(Fp.mul(nv, _2n), v9);
17237
+ const v10 = Fp.pow(n2, p5div8);
17238
+ const nv = Fp.mul(n, v10);
17239
+ const i = Fp.mul(Fp.mul(nv, _2n), v10);
17216
17240
  const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
17217
17241
  assertIsSquare(Fp, root, n);
17218
17242
  return root;
@@ -17794,9 +17818,9 @@ function edwards(params, extraOpts = {}) {
17794
17818
  validateObject(extraOpts, {}, { uvRatio: "function" });
17795
17819
  const MASK = _2n2 << BigInt(Fn.BYTES * 8) - _1n4;
17796
17820
  const modP = (n) => Fp.create(n);
17797
- const uvRatio2 = extraOpts.uvRatio || ((u, v9) => {
17821
+ const uvRatio2 = extraOpts.uvRatio || ((u, v10) => {
17798
17822
  try {
17799
- return { isValid: true, value: Fp.sqrt(Fp.div(u, v9)) };
17823
+ return { isValid: true, value: Fp.sqrt(Fp.div(u, v10)) };
17800
17824
  } catch (e) {
17801
17825
  return { isValid: false, value: _0n4 };
17802
17826
  }
@@ -17892,8 +17916,8 @@ function edwards(params, extraOpts = {}) {
17892
17916
  aInRange("point.y", y, _0n4, max);
17893
17917
  const y2 = modP(y * y);
17894
17918
  const u = modP(y2 - _1n4);
17895
- const v9 = modP(d * y2 - a);
17896
- let { isValid, value: x } = uvRatio2(u, v9);
17919
+ const v10 = modP(d * y2 - a);
17920
+ let { isValid, value: x } = uvRatio2(u, v10);
17897
17921
  if (!isValid)
17898
17922
  throw new Error("bad point: invalid y coordinate");
17899
17923
  const isXOdd = (x & _1n4) === _1n4;
@@ -18233,13 +18257,13 @@ function adjustScalarBytes(bytes) {
18233
18257
  return bytes;
18234
18258
  }
18235
18259
  var ED25519_SQRT_M1 = /* @__PURE__ */ BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");
18236
- function uvRatio(u, v9) {
18260
+ function uvRatio(u, v10) {
18237
18261
  const P = ed25519_CURVE_p;
18238
- const v32 = mod(v9 * v9 * v9, P);
18239
- const v72 = mod(v32 * v32 * v9, P);
18262
+ const v32 = mod(v10 * v10 * v10, P);
18263
+ const v72 = mod(v32 * v32 * v10, P);
18240
18264
  const pow = ed25519_pow_2_252_3(u * v72).pow_p_5_8;
18241
18265
  let x = mod(u * v32 * pow, P);
18242
- const vx2 = mod(v9 * x * x, P);
18266
+ const vx2 = mod(v10 * x * x, P);
18243
18267
  const root1 = x;
18244
18268
  const root2 = mod(x * ED25519_SQRT_M1, P);
18245
18269
  const useRoot1 = vx2 === u;
@@ -18570,7 +18594,7 @@ function findSeatPrice(validators, maxNumberOfSeats, minimumStakeRatio, protocol
18570
18594
  return findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumStakeRatio);
18571
18595
  }
18572
18596
  function findSeatPriceForProtocolBefore49(validators, numSeats) {
18573
- const stakes = validators.map((v9) => BigInt(v9.stake)).sort(sortBigIntAsc);
18597
+ const stakes = validators.map((v10) => BigInt(v10.stake)).sort(sortBigIntAsc);
18574
18598
  const num = BigInt(numSeats);
18575
18599
  const stakesSum = stakes.reduce((a, b) => a + b);
18576
18600
  if (stakesSum < num) {
@@ -18599,7 +18623,7 @@ function findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumSt
18599
18623
  if (minimumStakeRatio.length != 2) {
18600
18624
  throw Error("minimumStakeRatio should have 2 elements");
18601
18625
  }
18602
- const stakes = validators.map((v9) => BigInt(v9.stake)).sort(sortBigIntAsc);
18626
+ const stakes = validators.map((v10) => BigInt(v10.stake)).sort(sortBigIntAsc);
18603
18627
  const stakesSum = stakes.reduce((a, b) => a + b);
18604
18628
  if (validators.length < maxNumberOfSeats) {
18605
18629
  return stakesSum * BigInt(minimumStakeRatio[0]) / BigInt(minimumStakeRatio[1]);
@@ -18771,10 +18795,10 @@ var DER = {
18771
18795
  if (length < 128)
18772
18796
  throw new E("tlv.decode(long): not minimal encoding");
18773
18797
  }
18774
- const v9 = data.subarray(pos, pos + length);
18775
- if (v9.length !== length)
18798
+ const v10 = data.subarray(pos, pos + length);
18799
+ if (v10.length !== length)
18776
18800
  throw new E("tlv.decode: wrong value length");
18777
- return { v: v9, l: data.subarray(pos + length) };
18801
+ return { v: v10, l: data.subarray(pos + length) };
18778
18802
  }
18779
18803
  },
18780
18804
  // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
@@ -19521,14 +19545,14 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
19521
19545
  return false;
19522
19546
  const { r, s } = sig;
19523
19547
  const h = bits2int_modN(message);
19524
- const is2 = Fn.inv(s);
19525
- const u1 = Fn.create(h * is2);
19526
- const u2 = Fn.create(r * is2);
19548
+ const is3 = Fn.inv(s);
19549
+ const u1 = Fn.create(h * is3);
19550
+ const u2 = Fn.create(r * is3);
19527
19551
  const R = Point.BASE.multiplyUnsafe(u1).add(P.multiplyUnsafe(u2));
19528
19552
  if (R.is0())
19529
19553
  return false;
19530
- const v9 = Fn.create(R.x);
19531
- return v9 === r;
19554
+ const v10 = Fn.create(R.x);
19555
+ return v10 === r;
19532
19556
  } catch (e) {
19533
19557
  return false;
19534
19558
  }
@@ -23297,8 +23321,133 @@ var SonicSpokeService = class {
23297
23321
  return params.walletProvider.sendTransaction(rawTx);
23298
23322
  }
23299
23323
  };
23324
+ async function toMystenTransaction(txn) {
23325
+ if (txn instanceof transactions.Transaction) return txn;
23326
+ return transactions.Transaction.from(await txn.toJSON());
23327
+ }
23328
+ function isTimeoutError(error) {
23329
+ if (typeof error === "object" && error !== null && "name" in error) {
23330
+ const { name } = error;
23331
+ if (name === "TimeoutError" || name === "AbortError") {
23332
+ return true;
23333
+ }
23334
+ }
23335
+ return error instanceof Error && /timed?\s?out|timeout/i.test(error.message);
23336
+ }
23337
+ var DEFAULT_GET_COINS_LIMIT = 10;
23338
+ function toSuiObjectOwner(owner) {
23339
+ switch (owner?.$kind) {
23340
+ case "AddressOwner":
23341
+ return { AddressOwner: owner.AddressOwner };
23342
+ case "ObjectOwner":
23343
+ return { ObjectOwner: owner.ObjectOwner };
23344
+ case "Shared":
23345
+ return { Shared: { initial_shared_version: owner.Shared.initialSharedVersion } };
23346
+ default:
23347
+ return "Immutable";
23348
+ }
23349
+ }
23350
+ function toSuiTransactionEffects(effects, executedEpoch) {
23351
+ const gasObject = effects.gasObject;
23352
+ return {
23353
+ messageVersion: "v1",
23354
+ status: toSuiExecutionStatus(effects.status),
23355
+ executedEpoch,
23356
+ gasUsed: effects.gasUsed,
23357
+ transactionDigest: effects.transactionDigest,
23358
+ gasObject: {
23359
+ owner: toSuiObjectOwner(gasObject?.outputOwner ?? null),
23360
+ reference: {
23361
+ objectId: gasObject?.objectId ?? "",
23362
+ version: gasObject?.outputVersion ?? "",
23363
+ digest: gasObject?.outputDigest ?? ""
23364
+ }
23365
+ },
23366
+ dependencies: effects.dependencies,
23367
+ eventsDigest: effects.eventsDigest
23368
+ };
23369
+ }
23370
+ var SuiGrpcTransport = class {
23371
+ endpoint;
23372
+ client;
23373
+ constructor(endpoint) {
23374
+ this.endpoint = endpoint;
23375
+ this.client = new grpc.SuiGrpcClient({ network: "mainnet", baseUrl: endpoint });
23376
+ }
23377
+ async getCoins(owner, coinType, limit = DEFAULT_GET_COINS_LIMIT) {
23378
+ const response = await this.client.core.listCoins({ owner, coinType, limit });
23379
+ return toSuiPaginatedCoins(response, coinType);
23380
+ }
23381
+ async simulate(tx, sender) {
23382
+ const transaction = await toMystenTransaction(tx);
23383
+ transaction.setSenderIfNotSet(sender);
23384
+ const result = await this.client.core.simulateTransaction({
23385
+ transaction,
23386
+ include: { commandResults: true },
23387
+ checksEnabled: false
23388
+ });
23389
+ const command = result.commandResults?.[0];
23390
+ if (!command) {
23391
+ throw new Error(`transaction didn't return any values: ${JSON.stringify(result, null, 2)}`);
23392
+ }
23393
+ return toSuiExecutionResult(command);
23394
+ }
23395
+ async estimateGas(tx, sender) {
23396
+ const transaction = await toMystenTransaction(tx);
23397
+ transaction.setSenderIfNotSet(sender);
23398
+ const result = await this.client.core.simulateTransaction({ transaction, include: { effects: true } });
23399
+ const effects = (result.Transaction ?? result.FailedTransaction)?.effects;
23400
+ if (!effects) {
23401
+ throw new Error("Transaction simulation returned no effects");
23402
+ }
23403
+ return effects.gasUsed;
23404
+ }
23405
+ async fetchLatestPackageId(objectId) {
23406
+ let object5;
23407
+ try {
23408
+ ({ object: object5 } = await this.client.core.getObject({ objectId, include: { json: true } }));
23409
+ } catch (error) {
23410
+ throw new Error("Failed to fetch asset manager id", { cause: error });
23411
+ }
23412
+ if (!object5) {
23413
+ throw new Error("Asset manager id not found (no data)");
23414
+ }
23415
+ const fields = object5.json;
23416
+ if (!fields) {
23417
+ throw new Error("Asset manager id not found (not a move object)");
23418
+ }
23419
+ if (!("latest_package_id" in fields)) {
23420
+ throw new Error("Asset manager id not found (no latest package id)");
23421
+ }
23422
+ const latestPackageId = fields["latest_package_id"];
23423
+ if (typeof latestPackageId !== "string") {
23424
+ throw new Error("Asset manager id invalid (latest package id is not a string)");
23425
+ }
23426
+ if (!latestPackageId) {
23427
+ throw new Error("Asset manager id not found (no latest package id)");
23428
+ }
23429
+ return latestPackageId;
23430
+ }
23431
+ async waitForTransaction(params) {
23432
+ const result = await this.client.core.waitForTransaction({
23433
+ digest: params.digest,
23434
+ include: { effects: true },
23435
+ timeout: params.timeoutMs,
23436
+ pollSchedule: [0, Math.max(1, params.pollingIntervalMs)]
23437
+ });
23438
+ const transaction = result.Transaction ?? result.FailedTransaction;
23439
+ return {
23440
+ digest: transaction.digest,
23441
+ effects: transaction.effects ? toSuiTransactionEffects(transaction.effects, transaction.epoch ?? "0") : void 0
23442
+ };
23443
+ }
23444
+ };
23445
+
23446
+ // src/shared/services/spoke/SuiSpokeService.ts
23300
23447
  var SuiSpokeService = class {
23301
23448
  config;
23449
+ transport;
23450
+ /** @deprecated Renamed to `transport`, and no longer a raw `@mysten/sui` client. */
23302
23451
  publicClient;
23303
23452
  assetManagerAddress;
23304
23453
  pollingIntervalMs;
@@ -23306,12 +23455,13 @@ var SuiSpokeService = class {
23306
23455
  constructor(config) {
23307
23456
  this.config = config;
23308
23457
  const chainConfig = config.getChainConfig(ChainKeys.SUI_MAINNET);
23309
- this.publicClient = new client.SuiClient({ url: chainConfig.rpc_url });
23458
+ this.transport = new SuiGrpcTransport(chainConfig.rpc_url ?? chainConfig.grpc_url);
23459
+ this.publicClient = this.transport;
23310
23460
  this.pollingIntervalMs = chainConfig.pollingConfig.pollingIntervalMs;
23311
23461
  this.maxTimeoutMs = chainConfig.pollingConfig.maxTimeoutMs;
23312
23462
  }
23313
23463
  async getCoins(address, token) {
23314
- return this.publicClient.getCoins({ owner: address, coinType: token, limit: 10 });
23464
+ return this.transport.getCoins(address, token);
23315
23465
  }
23316
23466
  async getCoin(tx, coin, amount, address) {
23317
23467
  const coins = await this.getCoins(address, coin);
@@ -23372,14 +23522,7 @@ var SuiSpokeService = class {
23372
23522
  arguments: args,
23373
23523
  typeArguments: typeArgs
23374
23524
  });
23375
- const txResults = await this.publicClient.devInspectTransactionBlock({
23376
- transactionBlock: tx,
23377
- sender
23378
- });
23379
- if (txResults.results && txResults.results[0] !== void 0) {
23380
- return txResults.results[0];
23381
- }
23382
- throw Error(`transaction didn't return any values: ${JSON.stringify(txResults, null, 2)}`);
23525
+ return this.transport.simulate(tx, sender);
23383
23526
  }
23384
23527
  /**
23385
23528
  * Deposit tokens to the spoke chain.
@@ -23446,12 +23589,7 @@ var SuiSpokeService = class {
23446
23589
  * @returns {Promise<bigint>} The estimated computation cost.
23447
23590
  */
23448
23591
  async estimateGas({ tx }) {
23449
- const txb = transactions.Transaction.from(tx.data);
23450
- const result = await this.publicClient.devInspectTransactionBlock({
23451
- sender: tx.from,
23452
- transactionBlock: txb
23453
- });
23454
- return result.effects.gasUsed;
23592
+ return this.transport.estimateGas(transactions.Transaction.from(tx.data), tx.from);
23455
23593
  }
23456
23594
  /**
23457
23595
  * Get the balance of the token in the spoke chain.
@@ -23492,40 +23630,14 @@ var SuiSpokeService = class {
23492
23630
  * @returns {Promise<string>} The latest asset manager package id.
23493
23631
  */
23494
23632
  async fetchLatestAssetManagerPackageId(chainId) {
23495
- const configData = await this.publicClient.getObject({
23496
- id: this.config.getChainConfig(chainId).addresses.assetManagerConfigId,
23497
- options: {
23498
- showContent: true
23499
- }
23500
- });
23501
- if (configData.error) {
23502
- throw new Error(`Failed to fetch asset manager id. Details: ${JSON.stringify(configData.error)}`);
23503
- }
23504
- if (!configData.data) {
23505
- throw new Error("Asset manager id not found (no data)");
23506
- }
23507
- if (configData.data.content?.dataType !== "moveObject") {
23508
- throw new Error("Asset manager id not found (not a move object)");
23509
- }
23510
- if (!("latest_package_id" in configData.data.content.fields)) {
23511
- throw new Error("Asset manager id not found (no latest package id)");
23512
- }
23513
- const latestPackageId = configData.data.content.fields["latest_package_id"];
23514
- if (typeof latestPackageId !== "string") {
23515
- throw new Error("Asset manager id invalid (latest package id is not a string)");
23516
- }
23517
- if (!latestPackageId) {
23518
- throw new Error("Asset manager id not found (no latest package id)");
23519
- }
23520
- return latestPackageId.toString();
23633
+ return this.transport.fetchLatestPackageId(this.config.getChainConfig(chainId).addresses.assetManagerConfigId);
23521
23634
  }
23522
23635
  async waitForTransactionReceipt(params) {
23523
23636
  try {
23524
- const result = await this.publicClient.waitForTransaction({
23637
+ const result = await this.transport.waitForTransaction({
23525
23638
  digest: params.txHash,
23526
- timeout: params.maxTimeoutMs ?? this.maxTimeoutMs,
23527
- pollInterval: params.pollingIntervalMs ?? this.pollingIntervalMs,
23528
- options: { showEffects: true }
23639
+ timeoutMs: params.maxTimeoutMs ?? this.maxTimeoutMs,
23640
+ pollingIntervalMs: params.pollingIntervalMs ?? this.pollingIntervalMs
23529
23641
  });
23530
23642
  if (!result.effects?.status) {
23531
23643
  return {
@@ -23547,11 +23659,10 @@ var SuiSpokeService = class {
23547
23659
  }
23548
23660
  return { ok: true, value: { status: "success", receipt: result } };
23549
23661
  } catch (error) {
23550
- const isTimeout = error instanceof Error && error.message.includes("timeout");
23551
23662
  return {
23552
23663
  ok: true,
23553
23664
  value: {
23554
- status: isTimeout ? "timeout" : "failure",
23665
+ status: isTimeoutError(error) ? "timeout" : "failure",
23555
23666
  error: error instanceof Error ? error : new Error(String(error))
23556
23667
  }
23557
23668
  };
@@ -26923,19 +27034,32 @@ var SolverApiService = class {
26923
27034
  *
26924
27035
  * @param request - Object containing `intent_tx_hash` — the hub-chain tx hash of the intent.
26925
27036
  * @param config - Solver endpoint configuration.
27037
+ * @param logger - Diagnostics sink; defaults to the silent logger.
27038
+ * @param timeoutMs - Optional budget for the request. Omit it and the call is unbounded, as it has
27039
+ * always been. Supply it when a stalled solver must not hold the caller open — a status read
27040
+ * polled on a short interval, say. An expiry surfaces as `UNKNOWN`, like any other failure.
27041
+ * A non-finite value (`NaN` out of `Number(process.env.X)`, or `Infinity`) is treated as no
27042
+ * budget at all rather than passed to `setTimeout`, which would coerce it to ~0 and fail every
27043
+ * request instantly. A non-positive one is a real budget of zero: the request aborts at once.
27044
+ * The relay's `getTransactionPackets` takes the same parameter but degrades a non-finite value
27045
+ * to its own per-request budget instead; the divergence is deliberate, and explained inline.
26926
27046
  * @returns A `Result` containing `{ status: SolverIntentStatusCode, fill_tx_hash?: string }`.
26927
27047
  * `fill_tx_hash` is set only when `status === SolverIntentStatusCode.SOLVED (3)`.
26928
27048
  * @throws Invariant error if `intent_tx_hash` is empty (thrown before the async request).
26929
27049
  */
26930
- static async getStatus(request, config, logger = silentLogger) {
27050
+ static async getStatus(request, config, logger = silentLogger, timeoutMs) {
26931
27051
  invariant(request.intent_tx_hash.length > 0, "Empty intent_tx_hash");
27052
+ const budgetMs = timeoutMs !== void 0 && Number.isFinite(timeoutMs) ? Math.max(0, timeoutMs) : void 0;
27053
+ const controller = budgetMs === void 0 ? void 0 : new AbortController();
27054
+ const timeoutId = controller ? setTimeout(() => controller.abort(), budgetMs) : void 0;
26932
27055
  try {
26933
27056
  const response = await fetch(`${config.solverApiEndpoint}/status`, {
26934
27057
  method: "POST",
26935
27058
  headers: {
26936
27059
  "Content-Type": "application/json"
26937
27060
  },
26938
- body: JSON.stringify(request)
27061
+ body: JSON.stringify(request),
27062
+ signal: controller?.signal
26939
27063
  });
26940
27064
  if (!response.ok) {
26941
27065
  return {
@@ -26957,10 +27081,12 @@ var SolverApiService = class {
26957
27081
  error: {
26958
27082
  detail: {
26959
27083
  code: exports.SolverIntentErrorCode.UNKNOWN,
26960
- message: e ? JSON.stringify(e, bigintReplacer) : "Unknown error"
27084
+ message: controller?.signal.aborted ? `solver /status timed out after ${budgetMs}ms` : e ? JSON.stringify(e, bigintReplacer) : "Unknown error"
26961
27085
  }
26962
27086
  }
26963
27087
  };
27088
+ } finally {
27089
+ clearTimeout(timeoutId);
26964
27090
  }
26965
27091
  }
26966
27092
  };
@@ -27054,6 +27180,152 @@ async function runBackendSubmitTx({
27054
27180
  });
27055
27181
  return polled.ok ? { ok: true, value: polled.value } : { ok: false, cause: polled.cause };
27056
27182
  }
27183
+ var ChainKeySchema = v__namespace.custom((input) => typeof input === "string");
27184
+ var SpokeChainKeySchema = v__namespace.custom((input) => typeof input === "string");
27185
+ var AddressSchema = v__namespace.custom((input) => typeof input === "string");
27186
+ var XTokenSchema = v__namespace.object({
27187
+ symbol: v__namespace.string(),
27188
+ name: v__namespace.string(),
27189
+ decimals: v__namespace.number(),
27190
+ address: v__namespace.string(),
27191
+ chainKey: ChainKeySchema,
27192
+ hubAsset: AddressSchema,
27193
+ vault: AddressSchema,
27194
+ access: v__namespace.optional(v__namespace.picklist(["withdrawOnly", "depositOnly"]))
27195
+ });
27196
+ var IntentStructSchema = v__namespace.object({
27197
+ intentId: v__namespace.string(),
27198
+ creator: v__namespace.string(),
27199
+ inputToken: v__namespace.string(),
27200
+ outputToken: v__namespace.string(),
27201
+ inputAmount: v__namespace.string(),
27202
+ minOutputAmount: v__namespace.string(),
27203
+ deadline: v__namespace.string(),
27204
+ allowPartialFill: v__namespace.boolean(),
27205
+ srcChain: v__namespace.number(),
27206
+ dstChain: v__namespace.number(),
27207
+ srcAddress: v__namespace.string(),
27208
+ dstAddress: v__namespace.string(),
27209
+ solver: v__namespace.string(),
27210
+ data: v__namespace.string()
27211
+ });
27212
+ var FillEventSchema = v__namespace.object({
27213
+ eventType: v__namespace.literal("intent-filled"),
27214
+ // The hub-chain fill tx; an empty one is no use as `fill_tx_hash`.
27215
+ txHash: v__namespace.pipe(v__namespace.string(), v__namespace.nonEmpty()),
27216
+ // Terminality. An intent created with `allowPartialFill` emits a fill event per fill, so the
27217
+ // event alone does not mean the intent is done — only `remainingInput === '0'` does. Required:
27218
+ // without it there is no proof of completion, and claiming SOLVED on a partial fill would report
27219
+ // an unfinished swap as complete.
27220
+ intentState: v__namespace.object({
27221
+ remainingInput: v__namespace.string()
27222
+ })
27223
+ });
27224
+ var IntentResponseSchema = v__namespace.object({
27225
+ intentHash: v__namespace.string(),
27226
+ txHash: v__namespace.string(),
27227
+ logIndex: v__namespace.number(),
27228
+ chainId: v__namespace.number(),
27229
+ blockNumber: v__namespace.number(),
27230
+ open: v__namespace.boolean(),
27231
+ intent: IntentStructSchema,
27232
+ events: v__namespace.array(v__namespace.unknown())
27233
+ });
27234
+ var UserIntentsResponseSchema = v__namespace.object({
27235
+ total: v__namespace.number(),
27236
+ offset: v__namespace.number(),
27237
+ limit: v__namespace.number(),
27238
+ items: v__namespace.array(IntentResponseSchema)
27239
+ });
27240
+ var OrderbookResponseSchema = v__namespace.object({
27241
+ total: v__namespace.number(),
27242
+ data: v__namespace.array(
27243
+ v__namespace.object({
27244
+ intentState: v__namespace.object({
27245
+ exists: v__namespace.boolean(),
27246
+ remainingInput: v__namespace.string(),
27247
+ receivedOutput: v__namespace.string(),
27248
+ pendingPayment: v__namespace.boolean()
27249
+ }),
27250
+ intentData: v__namespace.object({
27251
+ intentId: v__namespace.string(),
27252
+ creator: v__namespace.string(),
27253
+ inputToken: v__namespace.string(),
27254
+ outputToken: v__namespace.string(),
27255
+ inputAmount: v__namespace.string(),
27256
+ minOutputAmount: v__namespace.string(),
27257
+ deadline: v__namespace.string(),
27258
+ allowPartialFill: v__namespace.boolean(),
27259
+ srcChain: v__namespace.number(),
27260
+ dstChain: v__namespace.number(),
27261
+ srcAddress: v__namespace.string(),
27262
+ dstAddress: v__namespace.string(),
27263
+ solver: v__namespace.string(),
27264
+ data: v__namespace.string(),
27265
+ intentHash: v__namespace.string(),
27266
+ txHash: v__namespace.string(),
27267
+ blockNumber: v__namespace.number()
27268
+ })
27269
+ })
27270
+ )
27271
+ });
27272
+ var MoneyMarketPositionSchema = v__namespace.object({
27273
+ userAddress: v__namespace.string(),
27274
+ positions: v__namespace.array(
27275
+ v__namespace.object({
27276
+ reserveAddress: v__namespace.string(),
27277
+ aTokenAddress: v__namespace.string(),
27278
+ variableDebtTokenAddress: v__namespace.string(),
27279
+ aTokenBalance: v__namespace.string(),
27280
+ variableDebtTokenBalance: v__namespace.string(),
27281
+ blockNumber: v__namespace.number()
27282
+ })
27283
+ )
27284
+ });
27285
+ var MoneyMarketAssetSchema = v__namespace.object({
27286
+ reserveAddress: v__namespace.string(),
27287
+ aTokenAddress: v__namespace.string(),
27288
+ totalATokenBalance: v__namespace.string(),
27289
+ variableDebtTokenAddress: v__namespace.string(),
27290
+ totalVariableDebtTokenBalance: v__namespace.string(),
27291
+ liquidityRate: v__namespace.string(),
27292
+ symbol: v__namespace.string(),
27293
+ totalSuppliers: v__namespace.number(),
27294
+ totalBorrowers: v__namespace.number(),
27295
+ variableBorrowRate: v__namespace.string(),
27296
+ stableBorrowRate: v__namespace.string(),
27297
+ liquidityIndex: v__namespace.string(),
27298
+ variableBorrowIndex: v__namespace.string(),
27299
+ blockNumber: v__namespace.number()
27300
+ });
27301
+ var MoneyMarketAssetsSchema = v__namespace.array(MoneyMarketAssetSchema);
27302
+ var MoneyMarketAssetBorrowersSchema = v__namespace.object({
27303
+ borrowers: v__namespace.array(v__namespace.string()),
27304
+ total: v__namespace.number(),
27305
+ offset: v__namespace.number(),
27306
+ limit: v__namespace.number()
27307
+ });
27308
+ var MoneyMarketAssetSuppliersSchema = v__namespace.object({
27309
+ suppliers: v__namespace.array(v__namespace.string()),
27310
+ total: v__namespace.number(),
27311
+ offset: v__namespace.number(),
27312
+ limit: v__namespace.number()
27313
+ });
27314
+ var MoneyMarketBorrowersSchema = v__namespace.object({
27315
+ borrowers: v__namespace.array(v__namespace.string()),
27316
+ total: v__namespace.number(),
27317
+ offset: v__namespace.number(),
27318
+ limit: v__namespace.number()
27319
+ });
27320
+ var GetChainsResponseSchema = v__namespace.array(SpokeChainKeySchema);
27321
+ var TokensByChainMapSchema = v__namespace.custom(
27322
+ (input) => typeof input === "object" && input !== null && Object.values(input).every((tokens) => Array.isArray(tokens) && tokens.every((t) => v__namespace.is(XTokenSchema, t)))
27323
+ );
27324
+ var TokensListSchema = v__namespace.array(XTokenSchema);
27325
+ var ReserveAssetsSchema = v__namespace.array(AddressSchema);
27326
+
27327
+ // src/backendApi/guards.ts
27328
+ var isFillEvent = (value) => v__namespace.is(FillEventSchema, value);
27057
27329
  function decodePacketIntentTarget(payload) {
27058
27330
  try {
27059
27331
  const hex = payload.startsWith("0x") ? payload.slice(2) : payload;
@@ -27073,6 +27345,12 @@ function selectSolvedIntentPacket(packets, intentsContract) {
27073
27345
  return packets.reduce((highest, packet) => packet.conn_sn > highest.conn_sn ? packet : highest);
27074
27346
  }
27075
27347
 
27348
+ // src/swap/detailedStatus.ts
27349
+ var DETAILED_STATUS_NOT_DELIVERED = "relay_not_delivered";
27350
+ function isBackendSubmitTxAbandoned(data) {
27351
+ return data.status === "failed" || Boolean(data.abandonedAt);
27352
+ }
27353
+
27076
27354
  // src/swap/errors.ts
27077
27355
  var swapInvariant = createInvariant("swap");
27078
27356
  var POST_EXECUTION_ERROR_CODES = /* @__PURE__ */ new Set([
@@ -27097,6 +27375,8 @@ var isPostExecutionError = isCodeMember(POST_EXECUTION_ERROR_CODES);
27097
27375
  var isSwapError = isCodeMember(SWAP_ERROR_CODES);
27098
27376
 
27099
27377
  // src/swap/SwapService.ts
27378
+ var RECONCILE_TIMEOUT_MS = 5e3;
27379
+ var DETAILED_STATUS_SOLVER_TIMEOUT_MS = 5e3;
27100
27380
  var SwapService = class {
27101
27381
  // dependent services
27102
27382
  hubProvider;
@@ -27197,7 +27477,8 @@ var SwapService = class {
27197
27477
  return calculatePercentageFeeAmount(inputAmount, 10);
27198
27478
  }
27199
27479
  /**
27200
- * Polls the solver API for the current execution status of an intent.
27480
+ * Polls the solver API for the current execution status of an intent. A `NOT_FOUND` or a failed
27481
+ * request is cross-checked against the backend's durable intent record.
27201
27482
  *
27202
27483
  * The `intent_tx_hash` in the request must be the hub-chain (Sonic) transaction hash where
27203
27484
  * the intent was registered — this is the `dst_tx_hash` from the relay packet returned by
@@ -27208,7 +27489,145 @@ var SwapService = class {
27208
27489
  * `fill_tx_hash` is populated only when `status === SolverIntentStatusCode.SOLVED (3)`.
27209
27490
  */
27210
27491
  async getStatus(request) {
27211
- return SolverApiService.getStatus(request, this.solver, this.config.logger);
27492
+ return this.resolveSolverStatus(request);
27493
+ }
27494
+ /**
27495
+ * {@link SwapService.getStatus} with an optional budget for the solver leg. Public `getStatus` is a
27496
+ * one-shot read a caller bounds however it likes, so it stays unbounded; `getDetailedStatus` is
27497
+ * polled and passes {@link DETAILED_STATUS_SOLVER_TIMEOUT_MS}. Both go through here so the
27498
+ * durable-intent reconcile below is written once.
27499
+ *
27500
+ * `timeoutMs` bounds the solver request alone. The reconcile that a failed or NOT_FOUND solver read
27501
+ * falls through to carries its own {@link RECONCILE_TIMEOUT_MS}, so a bounded call can cost both.
27502
+ */
27503
+ async resolveSolverStatus(request, timeoutMs) {
27504
+ const solverResult = await SolverApiService.getStatus(request, this.solver, this.config.logger, timeoutMs);
27505
+ const forgotten = !solverResult.ok || solverResult.value.status === exports.SolverIntentStatusCode.NOT_FOUND;
27506
+ if (!forgotten) return solverResult;
27507
+ const timeout = Math.min(RECONCILE_TIMEOUT_MS, this.backendApi.requestTimeoutMs);
27508
+ const intent = await this.backendApi.getIntentByTxHash(request.intent_tx_hash, { timeout });
27509
+ const settled = intent.ok ? intent.value.events.filter(isFillEvent).find((fill) => fill.intentState.remainingInput === "0") : void 0;
27510
+ if (settled) return { ok: true, value: { status: exports.SolverIntentStatusCode.SOLVED, fill_tx_hash: settled.txHash } };
27511
+ const backendAnswered = intent.ok || isSodaxError(intent.error) && intent.error.context?.status === 404;
27512
+ if (solverResult.ok && !backendAnswered) {
27513
+ return {
27514
+ ok: false,
27515
+ error: {
27516
+ detail: {
27517
+ code: exports.SolverIntentErrorCode.UNKNOWN,
27518
+ message: "solver reported NOT_FOUND and the durable intent record could not be read to verify it"
27519
+ }
27520
+ }
27521
+ };
27522
+ }
27523
+ return solverResult;
27524
+ }
27525
+ /**
27526
+ * Reads a swap's status from its source-chain transaction — the identifier a caller always holds.
27527
+ *
27528
+ * **Routes; does not translate.** Returns the backend submit-tx record while it is in play,
27529
+ * otherwise the solver's answer via the hub tx hash resolved from the relay packet. The result is
27530
+ * tagged with `source` (discriminate on it) and carries that source's payload unmodified.
27531
+ *
27532
+ * **Any** unusable backend response routes to the solver — a 404, a transport or server error, or
27533
+ * a record the backend gave up on. See `docs/SWAPS.md` § Get Detailed Status for why.
27534
+ *
27535
+ * A point-in-time read; poll it yourself, or use dapp-kit's `useDetailedStatus`.
27536
+ *
27537
+ * @param params - `srcChainKey` and `srcTxHash` of the source-chain swap transaction.
27538
+ * @returns A `Result` containing a {@link DetailedSwapStatus}. Fails with `LOOKUP_FAILED` when no
27539
+ * source can answer yet — usually the relay has not delivered the packet, so there is no hub tx
27540
+ * hash for the solver to be asked about.
27541
+ */
27542
+ async getDetailedStatus(params) {
27543
+ try {
27544
+ const record3 = await this.backendApi.swaps.getSubmitTxStatus({
27545
+ txHash: params.srcTxHash,
27546
+ srcChainKey: params.srcChainKey
27547
+ });
27548
+ if (record3.ok && record3.value.success && !isBackendSubmitTxAbandoned(record3.value.data)) {
27549
+ return { ok: true, value: { source: "backend", data: record3.value.data } };
27550
+ }
27551
+ const backendAnswered = record3.ok || isSodaxError(record3.error) && record3.error.context?.status === 404;
27552
+ const dstTxHash = await this.resolveHubTxHash(params, backendAnswered);
27553
+ if (!dstTxHash.ok) return dstTxHash;
27554
+ const solver = await this.resolveSolverStatus(
27555
+ { intent_tx_hash: dstTxHash.value },
27556
+ DETAILED_STATUS_SOLVER_TIMEOUT_MS
27557
+ );
27558
+ if (!solver.ok) {
27559
+ return { ok: false, error: this.detailedStatusLookupFailed(solver.error, params.srcChainKey) };
27560
+ }
27561
+ return { ok: true, value: { source: "solver", dstTxHash: dstTxHash.value, data: solver.value } };
27562
+ } catch (error) {
27563
+ return { ok: false, error: this.detailedStatusLookupFailed(error, params.srcChainKey) };
27564
+ }
27565
+ }
27566
+ /**
27567
+ * The hub-chain tx hash the solver is keyed on. A hub-source swap has no relay leg — the source
27568
+ * tx *is* the hub tx. Otherwise the delivered relay packet carries it, so an undelivered packet
27569
+ * is simply "no hash yet".
27570
+ */
27571
+ async resolveHubTxHash(key, backendAnswered) {
27572
+ const missReason = backendAnswered ? DETAILED_STATUS_NOT_DELIVERED : void 0;
27573
+ let hubTxHash = key.srcTxHash;
27574
+ if (!isHubChainKeyType(key.srcChainKey)) {
27575
+ const relayChainId = getIntentRelayChainId(key.srcChainKey);
27576
+ const packets = await getTransactionPackets(
27577
+ {
27578
+ action: "get_transaction_packets",
27579
+ params: { chain_id: relayChainId.toString(), tx_hash: key.srcTxHash }
27580
+ },
27581
+ this.relayerApiEndpoint,
27582
+ RELAY_REQUEST_TIMEOUT_MS
27583
+ );
27584
+ if (!packets.ok) {
27585
+ const notIndexed = packets.error instanceof HttpRelayError && packets.error.status === 404;
27586
+ return {
27587
+ ok: false,
27588
+ error: this.detailedStatusLookupFailed(packets.error, key.srcChainKey, notIndexed ? missReason : void 0)
27589
+ };
27590
+ }
27591
+ if (!packets.value?.success || !Array.isArray(packets.value.data)) {
27592
+ return {
27593
+ ok: false,
27594
+ error: this.detailedStatusLookupFailed(
27595
+ new Error("relay returned no usable transaction packets"),
27596
+ key.srcChainKey
27597
+ )
27598
+ };
27599
+ }
27600
+ const delivered = packets.value.data.find(
27601
+ (packet) => typeof packet?.src_tx_hash === "string" && packet.src_tx_hash.toLowerCase() === key.srcTxHash.toLowerCase() && packet.src_chain_id === Number(relayChainId) && packet.status === "executed" && typeof packet.dst_tx_hash === "string" && packet.dst_tx_hash.length > 0
27602
+ );
27603
+ if (!delivered) {
27604
+ return {
27605
+ ok: false,
27606
+ error: this.detailedStatusLookupFailed(
27607
+ new Error("relay has not delivered the intent to the hub yet"),
27608
+ key.srcChainKey,
27609
+ missReason
27610
+ )
27611
+ };
27612
+ }
27613
+ hubTxHash = delivered.dst_tx_hash;
27614
+ }
27615
+ if (viem.isHex(hubTxHash)) return { ok: true, value: hubTxHash };
27616
+ return {
27617
+ ok: false,
27618
+ error: this.detailedStatusLookupFailed(
27619
+ new Error(`hub tx hash is not a hex string: ${hubTxHash}`),
27620
+ key.srcChainKey
27621
+ )
27622
+ };
27623
+ }
27624
+ /**
27625
+ * `reason` is set only for {@link DETAILED_STATUS_NOT_DELIVERED} — the miss a caller can bound
27626
+ * with a retry budget. Leaving it off marks a dependency that is failing right now, which a
27627
+ * caller should keep retrying rather than give up on.
27628
+ */
27629
+ detailedStatusLookupFailed(cause, srcChainKey, reason) {
27630
+ return lookupFailed("swap", "getDetailedStatus", cause, { srcChainKey, action: "swap", reason });
27212
27631
  }
27213
27632
  /**
27214
27633
  * Notifies the solver API that an intent has been registered on the hub chain, triggering
@@ -30523,7 +30942,7 @@ var SwapsApiService = class _SwapsApiService {
30523
30942
  if (error.code === "VALIDATION_ERROR" && error.context.issues !== void 0) {
30524
30943
  context.reason = "invalid_response_shape";
30525
30944
  const issues = error.context.issues;
30526
- context.issues = issues instanceof v7__namespace.ValiError ? v7__namespace.flatten(issues.issues) : issues;
30945
+ context.issues = issues instanceof v__namespace.ValiError ? v__namespace.flatten(issues.issues) : issues;
30527
30946
  }
30528
30947
  if (error.context.status !== void 0) context.status = error.context.status;
30529
30948
  }
@@ -30698,21 +31117,21 @@ var SwapsApiService = class _SwapsApiService {
30698
31117
  return this.config.timeout ?? DEFAULT_BACKEND_API_TIMEOUT;
30699
31118
  }
30700
31119
  };
30701
- var StellarSponsorConfigSchema = v7__namespace.object({
30702
- sponsorAccount: v7__namespace.string(),
30703
- networkPassphrase: v7__namespace.string(),
30704
- minTotalFeeStroops: v7__namespace.string(),
30705
- maxTotalFeeStroops: v7__namespace.string(),
30706
- operationCount: v7__namespace.number(),
30707
- minPerOperationFeeStroops: v7__namespace.string(),
30708
- maxPerOperationFeeStroops: v7__namespace.string(),
30709
- recommendedPerOperationFeeStroops: v7__namespace.string(),
30710
- maxTimeboundSeconds: v7__namespace.number(),
30711
- requiredStartingBalance: v7__namespace.string()
31120
+ var StellarSponsorConfigSchema = v__namespace.object({
31121
+ sponsorAccount: v__namespace.string(),
31122
+ networkPassphrase: v__namespace.string(),
31123
+ minTotalFeeStroops: v__namespace.string(),
31124
+ maxTotalFeeStroops: v__namespace.string(),
31125
+ operationCount: v__namespace.number(),
31126
+ minPerOperationFeeStroops: v__namespace.string(),
31127
+ maxPerOperationFeeStroops: v__namespace.string(),
31128
+ recommendedPerOperationFeeStroops: v__namespace.string(),
31129
+ maxTimeboundSeconds: v__namespace.number(),
31130
+ requiredStartingBalance: v__namespace.string()
30712
31131
  });
30713
- var StellarSponsoredAccountResponseSchema = v7__namespace.variant("alreadyActive", [
30714
- v7__namespace.object({ hash: v7__namespace.string(), alreadyActive: v7__namespace.literal(false) }),
30715
- v7__namespace.object({ hash: v7__namespace.null(), alreadyActive: v7__namespace.literal(true) })
31132
+ var StellarSponsoredAccountResponseSchema = v__namespace.variant("alreadyActive", [
31133
+ v__namespace.object({ hash: v__namespace.string(), alreadyActive: v__namespace.literal(false) }),
31134
+ v__namespace.object({ hash: v__namespace.null(), alreadyActive: v__namespace.literal(true) })
30716
31135
  ]);
30717
31136
 
30718
31137
  // src/backendApi/SponsoringApiService.ts
@@ -30740,7 +31159,7 @@ var SponsoringApiService = class {
30740
31159
  logger: this.logger,
30741
31160
  serviceLabel: "SponsoringApiService"
30742
31161
  });
30743
- const parsed = v7__namespace.safeParse(schema, raw);
31162
+ const parsed = v__namespace.safeParse(schema, raw);
30744
31163
  if (!parsed.success) {
30745
31164
  return {
30746
31165
  ok: false,
@@ -30748,7 +31167,7 @@ var SponsoringApiService = class {
30748
31167
  api: "sponsoring",
30749
31168
  feature: "backend",
30750
31169
  endpoint,
30751
- issues: v7__namespace.flatten(parsed.issues)
31170
+ issues: v__namespace.flatten(parsed.issues)
30752
31171
  })
30753
31172
  };
30754
31173
  }
@@ -30786,141 +31205,141 @@ var SponsoringApiService = class {
30786
31205
  return this.config.baseURL;
30787
31206
  }
30788
31207
  };
30789
- var RelayExtraDataResponseSchema = v7__namespace.object({
30790
- address: v7__namespace.string(),
30791
- payload: v7__namespace.string()
31208
+ var RelayExtraDataResponseSchema = v__namespace.object({
31209
+ address: v__namespace.string(),
31210
+ payload: v__namespace.string()
30792
31211
  });
30793
- var BridgeTokenSchema = v7__namespace.object({
30794
- symbol: v7__namespace.string(),
30795
- name: v7__namespace.string(),
30796
- decimals: v7__namespace.number(),
30797
- address: v7__namespace.string(),
30798
- chainKey: v7__namespace.string(),
30799
- hubAsset: v7__namespace.string(),
30800
- vault: v7__namespace.string()
31212
+ var BridgeTokenSchema = v__namespace.object({
31213
+ symbol: v__namespace.string(),
31214
+ name: v__namespace.string(),
31215
+ decimals: v__namespace.number(),
31216
+ address: v__namespace.string(),
31217
+ chainKey: v__namespace.string(),
31218
+ hubAsset: v__namespace.string(),
31219
+ vault: v__namespace.string()
30801
31220
  });
30802
- var BridgeTokensResponseSchema = v7__namespace.record(v7__namespace.string(), v7__namespace.array(BridgeTokenSchema));
30803
- var BridgeTokensByChainResponseSchema = v7__namespace.array(BridgeTokenSchema);
30804
- var BridgeAllowanceCheckResponseSchema = v7__namespace.object({
30805
- valid: v7__namespace.boolean()
31221
+ var BridgeTokensResponseSchema = v__namespace.record(v__namespace.string(), v__namespace.array(BridgeTokenSchema));
31222
+ var BridgeTokensByChainResponseSchema = v__namespace.array(BridgeTokenSchema);
31223
+ var BridgeAllowanceCheckResponseSchema = v__namespace.object({
31224
+ valid: v__namespace.boolean()
30806
31225
  });
30807
- var makeBridgeApproveResponseSchema = (txSchema) => v7__namespace.object({ tx: txSchema });
30808
- var makeCreateBridgeIntentResponseSchema = (txSchema) => v7__namespace.object({
31226
+ var makeBridgeApproveResponseSchema = (txSchema) => v__namespace.object({ tx: txSchema });
31227
+ var makeCreateBridgeIntentResponseSchema = (txSchema) => v__namespace.object({
30809
31228
  tx: txSchema,
30810
31229
  relayData: RelayExtraDataResponseSchema
30811
31230
  });
30812
- var BridgeSubmitTxResponseSchema = v7__namespace.object({
30813
- success: v7__namespace.boolean(),
30814
- data: v7__namespace.object({
30815
- status: v7__namespace.picklist(["inserted", "duplicate"]),
30816
- message: v7__namespace.string()
31231
+ var BridgeSubmitTxResponseSchema = v__namespace.object({
31232
+ success: v__namespace.boolean(),
31233
+ data: v__namespace.object({
31234
+ status: v__namespace.picklist(["inserted", "duplicate"]),
31235
+ message: v__namespace.string()
30817
31236
  })
30818
31237
  });
30819
- var BridgePacketDataSchema = v7__namespace.object({
30820
- src_chain_id: v7__namespace.number(),
30821
- src_tx_hash: v7__namespace.string(),
30822
- src_address: v7__namespace.string(),
30823
- status: v7__namespace.picklist(["pending", "validating", "executing", "executed"]),
30824
- dst_chain_id: v7__namespace.number(),
30825
- conn_sn: v7__namespace.number(),
30826
- dst_address: v7__namespace.string(),
30827
- dst_tx_hash: v7__namespace.string(),
30828
- signatures: v7__namespace.array(v7__namespace.string()),
30829
- payload: v7__namespace.string()
31238
+ var BridgePacketDataSchema = v__namespace.object({
31239
+ src_chain_id: v__namespace.number(),
31240
+ src_tx_hash: v__namespace.string(),
31241
+ src_address: v__namespace.string(),
31242
+ status: v__namespace.picklist(["pending", "validating", "executing", "executed"]),
31243
+ dst_chain_id: v__namespace.number(),
31244
+ conn_sn: v__namespace.number(),
31245
+ dst_address: v__namespace.string(),
31246
+ dst_tx_hash: v__namespace.string(),
31247
+ signatures: v__namespace.array(v__namespace.string()),
31248
+ payload: v__namespace.string()
30830
31249
  });
30831
- var BridgeSubmitTxStatusResultSchema = v7__namespace.object({
30832
- dstIntentTxHash: v7__namespace.string(),
30833
- packetData: v7__namespace.optional(BridgePacketDataSchema)
31250
+ var BridgeSubmitTxStatusResultSchema = v__namespace.object({
31251
+ dstIntentTxHash: v__namespace.string(),
31252
+ packetData: v__namespace.optional(BridgePacketDataSchema)
30834
31253
  });
30835
- var BridgeSubmitTxStatusDataSchema = v7__namespace.object({
30836
- txHash: v7__namespace.string(),
30837
- srcChainKey: v7__namespace.string(),
30838
- status: v7__namespace.string(),
30839
- failedAtStep: v7__namespace.optional(v7__namespace.string()),
30840
- failureReason: v7__namespace.optional(v7__namespace.string()),
30841
- processingAttempts: v7__namespace.number(),
30842
- abandonedAt: v7__namespace.optional(v7__namespace.string()),
30843
- result: v7__namespace.optional(BridgeSubmitTxStatusResultSchema),
30844
- userMessage: v7__namespace.optional(v7__namespace.string())
31254
+ var BridgeSubmitTxStatusDataSchema = v__namespace.object({
31255
+ txHash: v__namespace.string(),
31256
+ srcChainKey: v__namespace.string(),
31257
+ status: v__namespace.string(),
31258
+ failedAtStep: v__namespace.optional(v__namespace.string()),
31259
+ failureReason: v__namespace.optional(v__namespace.string()),
31260
+ processingAttempts: v__namespace.number(),
31261
+ abandonedAt: v__namespace.optional(v__namespace.string()),
31262
+ result: v__namespace.optional(BridgeSubmitTxStatusResultSchema),
31263
+ userMessage: v__namespace.optional(v__namespace.string())
30845
31264
  });
30846
- var BridgeSubmitTxStatusResponseSchema = v7__namespace.object({
30847
- success: v7__namespace.boolean(),
31265
+ var BridgeSubmitTxStatusResponseSchema = v__namespace.object({
31266
+ success: v__namespace.boolean(),
30848
31267
  data: BridgeSubmitTxStatusDataSchema
30849
31268
  });
30850
- var BridgeFeeResponseSchema = v7__namespace.object({ fee: v7__namespace.string() });
30851
- var BridgeLimitSchema = v7__namespace.object({
30852
- amount: v7__namespace.string(),
30853
- decimals: v7__namespace.number(),
30854
- type: v7__namespace.picklist(["DEPOSIT_LIMIT", "WITHDRAWAL_LIMIT"])
31269
+ var BridgeFeeResponseSchema = v__namespace.object({ fee: v__namespace.string() });
31270
+ var BridgeLimitSchema = v__namespace.object({
31271
+ amount: v__namespace.string(),
31272
+ decimals: v__namespace.number(),
31273
+ type: v__namespace.picklist(["DEPOSIT_LIMIT", "WITHDRAWAL_LIMIT"])
30855
31274
  });
30856
- var BridgeableAmountResponseSchema = v7__namespace.object({ limit: BridgeLimitSchema });
30857
- var BridgeableCheckResponseSchema = v7__namespace.object({ bridgeable: v7__namespace.boolean() });
30858
- var AddressSchema = v7__namespace.custom((input) => typeof input === "string");
30859
- var HexSchema = v7__namespace.custom((input) => typeof input === "string");
30860
- var BigintFromString = v7__namespace.pipe(v7__namespace.string(), v7__namespace.toBigint());
30861
- var BytesFromIndexRecord = v7__namespace.pipe(
30862
- v7__namespace.record(v7__namespace.string(), v7__namespace.number()),
30863
- v7__namespace.transform((indexed) => Uint8Array.from(Object.values(indexed)))
31275
+ var BridgeableAmountResponseSchema = v__namespace.object({ limit: BridgeLimitSchema });
31276
+ var BridgeableCheckResponseSchema = v__namespace.object({ bridgeable: v__namespace.boolean() });
31277
+ var AddressSchema2 = v__namespace.custom((input) => typeof input === "string");
31278
+ var HexSchema = v__namespace.custom((input) => typeof input === "string");
31279
+ var BigintFromString = v__namespace.pipe(v__namespace.string(), v__namespace.toBigint());
31280
+ var BytesFromIndexRecord = v__namespace.pipe(
31281
+ v__namespace.record(v__namespace.string(), v__namespace.number()),
31282
+ v__namespace.transform((indexed) => Uint8Array.from(Object.values(indexed)))
30864
31283
  );
30865
- var EvmRawTxSchema = v7__namespace.object({
30866
- from: AddressSchema,
30867
- to: AddressSchema,
31284
+ var EvmRawTxSchema = v__namespace.object({
31285
+ from: AddressSchema2,
31286
+ to: AddressSchema2,
30868
31287
  value: BigintFromString,
30869
31288
  data: HexSchema
30870
31289
  });
30871
- var SolanaRawTxSchema = v7__namespace.object({
30872
- from: v7__namespace.string(),
30873
- to: v7__namespace.string(),
31290
+ var SolanaRawTxSchema = v__namespace.object({
31291
+ from: v__namespace.string(),
31292
+ to: v__namespace.string(),
30874
31293
  value: BigintFromString,
30875
- data: v7__namespace.string()
31294
+ data: v__namespace.string()
30876
31295
  });
30877
- var SuiRawTxSchema = v7__namespace.object({
31296
+ var SuiRawTxSchema = v__namespace.object({
30878
31297
  from: HexSchema,
30879
- to: v7__namespace.string(),
31298
+ to: v__namespace.string(),
30880
31299
  value: BigintFromString,
30881
- data: v7__namespace.string()
31300
+ data: v__namespace.string()
30882
31301
  });
30883
- var StellarRawTxSchema = v7__namespace.object({
30884
- from: v7__namespace.string(),
30885
- to: v7__namespace.string(),
31302
+ var StellarRawTxSchema = v__namespace.object({
31303
+ from: v__namespace.string(),
31304
+ to: v__namespace.string(),
30886
31305
  value: BigintFromString,
30887
- data: v7__namespace.string()
31306
+ data: v__namespace.string()
30888
31307
  });
30889
- var BitcoinRawTxSchema = v7__namespace.object({
30890
- from: v7__namespace.string(),
30891
- to: v7__namespace.string(),
31308
+ var BitcoinRawTxSchema = v__namespace.object({
31309
+ from: v__namespace.string(),
31310
+ to: v__namespace.string(),
30892
31311
  value: BigintFromString,
30893
- data: v7__namespace.string()
31312
+ data: v__namespace.string()
30894
31313
  });
30895
- var InjectiveRawTxSchema = v7__namespace.object({
31314
+ var InjectiveRawTxSchema = v__namespace.object({
30896
31315
  from: HexSchema,
30897
31316
  to: HexSchema,
30898
- signedDoc: v7__namespace.object({
31317
+ signedDoc: v__namespace.object({
30899
31318
  bodyBytes: BytesFromIndexRecord,
30900
31319
  authInfoBytes: BytesFromIndexRecord,
30901
- chainId: v7__namespace.string(),
31320
+ chainId: v__namespace.string(),
30902
31321
  accountNumber: BigintFromString
30903
31322
  })
30904
31323
  });
30905
- var NearRawTxSchema = v7__namespace.object({
30906
- signerId: v7__namespace.string(),
30907
- params: v7__namespace.object({
30908
- contractId: v7__namespace.string(),
30909
- method: v7__namespace.string(),
30910
- args: v7__namespace.custom((input) => typeof input === "object" && input !== null),
30911
- gas: v7__namespace.optional(BigintFromString),
30912
- deposit: v7__namespace.optional(BigintFromString)
31324
+ var NearRawTxSchema = v__namespace.object({
31325
+ signerId: v__namespace.string(),
31326
+ params: v__namespace.object({
31327
+ contractId: v__namespace.string(),
31328
+ method: v__namespace.string(),
31329
+ args: v__namespace.custom((input) => typeof input === "object" && input !== null),
31330
+ gas: v__namespace.optional(BigintFromString),
31331
+ deposit: v__namespace.optional(BigintFromString)
30913
31332
  })
30914
31333
  });
30915
- var IconRawTxSchema = v7__namespace.record(
30916
- v7__namespace.string(),
30917
- v7__namespace.union([v7__namespace.string(), v7__namespace.custom((input) => typeof input === "object" && input !== null)])
31334
+ var IconRawTxSchema = v__namespace.record(
31335
+ v__namespace.string(),
31336
+ v__namespace.union([v__namespace.string(), v__namespace.custom((input) => typeof input === "object" && input !== null)])
30918
31337
  );
30919
- var StacksRawTxSchema = v7__namespace.object({
30920
- payload: v7__namespace.string(),
30921
- estimatedLength: v7__namespace.optional(v7__namespace.number())
31338
+ var StacksRawTxSchema = v__namespace.object({
31339
+ payload: v__namespace.string(),
31340
+ estimatedLength: v__namespace.optional(v__namespace.number())
30922
31341
  });
30923
- var AnyRawTxSchema = v7__namespace.custom((input) => typeof input === "object" && input !== null);
31342
+ var AnyRawTxSchema = v__namespace.custom((input) => typeof input === "object" && input !== null);
30924
31343
  function rawTxSchemaForChainKey(chainKey) {
30925
31344
  let chainType;
30926
31345
  try {
@@ -30999,13 +31418,13 @@ var BridgeApiService = class {
30999
31418
  logger: this.logger,
31000
31419
  serviceLabel: "BridgeApiService"
31001
31420
  });
31002
- const parsed = v7__namespace.safeParse(schema, raw);
31421
+ const parsed = v__namespace.safeParse(schema, raw);
31003
31422
  if (!parsed.success) {
31004
31423
  return {
31005
31424
  ok: false,
31006
31425
  error: new SodaxError("EXTERNAL_API_ERROR", `Invalid response shape from bridge API for ${endpoint}`, {
31007
31426
  feature: "backend",
31008
- context: { api: "bridge", endpoint, reason: "invalid_response_shape", issues: v7__namespace.flatten(parsed.issues) }
31427
+ context: { api: "bridge", endpoint, reason: "invalid_response_shape", issues: v__namespace.flatten(parsed.issues) }
31009
31428
  })
31010
31429
  };
31011
31430
  }
@@ -31200,137 +31619,6 @@ var BridgeApiService = class {
31200
31619
  return this.config.timeout;
31201
31620
  }
31202
31621
  };
31203
- var ChainKeySchema = v7__namespace.custom((input) => typeof input === "string");
31204
- var SpokeChainKeySchema = v7__namespace.custom((input) => typeof input === "string");
31205
- var AddressSchema2 = v7__namespace.custom((input) => typeof input === "string");
31206
- var XTokenSchema = v7__namespace.object({
31207
- symbol: v7__namespace.string(),
31208
- name: v7__namespace.string(),
31209
- decimals: v7__namespace.number(),
31210
- address: v7__namespace.string(),
31211
- chainKey: ChainKeySchema,
31212
- hubAsset: AddressSchema2,
31213
- vault: AddressSchema2,
31214
- access: v7__namespace.optional(v7__namespace.picklist(["withdrawOnly", "depositOnly"]))
31215
- });
31216
- var IntentStructSchema = v7__namespace.object({
31217
- intentId: v7__namespace.string(),
31218
- creator: v7__namespace.string(),
31219
- inputToken: v7__namespace.string(),
31220
- outputToken: v7__namespace.string(),
31221
- inputAmount: v7__namespace.string(),
31222
- minOutputAmount: v7__namespace.string(),
31223
- deadline: v7__namespace.string(),
31224
- allowPartialFill: v7__namespace.boolean(),
31225
- srcChain: v7__namespace.number(),
31226
- dstChain: v7__namespace.number(),
31227
- srcAddress: v7__namespace.string(),
31228
- dstAddress: v7__namespace.string(),
31229
- solver: v7__namespace.string(),
31230
- data: v7__namespace.string()
31231
- });
31232
- var IntentResponseSchema = v7__namespace.object({
31233
- intentHash: v7__namespace.string(),
31234
- txHash: v7__namespace.string(),
31235
- logIndex: v7__namespace.number(),
31236
- chainId: v7__namespace.number(),
31237
- blockNumber: v7__namespace.number(),
31238
- open: v7__namespace.boolean(),
31239
- intent: IntentStructSchema,
31240
- events: v7__namespace.array(v7__namespace.unknown())
31241
- });
31242
- var UserIntentsResponseSchema = v7__namespace.object({
31243
- total: v7__namespace.number(),
31244
- offset: v7__namespace.number(),
31245
- limit: v7__namespace.number(),
31246
- items: v7__namespace.array(IntentResponseSchema)
31247
- });
31248
- var OrderbookResponseSchema = v7__namespace.object({
31249
- total: v7__namespace.number(),
31250
- data: v7__namespace.array(
31251
- v7__namespace.object({
31252
- intentState: v7__namespace.object({
31253
- exists: v7__namespace.boolean(),
31254
- remainingInput: v7__namespace.string(),
31255
- receivedOutput: v7__namespace.string(),
31256
- pendingPayment: v7__namespace.boolean()
31257
- }),
31258
- intentData: v7__namespace.object({
31259
- intentId: v7__namespace.string(),
31260
- creator: v7__namespace.string(),
31261
- inputToken: v7__namespace.string(),
31262
- outputToken: v7__namespace.string(),
31263
- inputAmount: v7__namespace.string(),
31264
- minOutputAmount: v7__namespace.string(),
31265
- deadline: v7__namespace.string(),
31266
- allowPartialFill: v7__namespace.boolean(),
31267
- srcChain: v7__namespace.number(),
31268
- dstChain: v7__namespace.number(),
31269
- srcAddress: v7__namespace.string(),
31270
- dstAddress: v7__namespace.string(),
31271
- solver: v7__namespace.string(),
31272
- data: v7__namespace.string(),
31273
- intentHash: v7__namespace.string(),
31274
- txHash: v7__namespace.string(),
31275
- blockNumber: v7__namespace.number()
31276
- })
31277
- })
31278
- )
31279
- });
31280
- var MoneyMarketPositionSchema = v7__namespace.object({
31281
- userAddress: v7__namespace.string(),
31282
- positions: v7__namespace.array(
31283
- v7__namespace.object({
31284
- reserveAddress: v7__namespace.string(),
31285
- aTokenAddress: v7__namespace.string(),
31286
- variableDebtTokenAddress: v7__namespace.string(),
31287
- aTokenBalance: v7__namespace.string(),
31288
- variableDebtTokenBalance: v7__namespace.string(),
31289
- blockNumber: v7__namespace.number()
31290
- })
31291
- )
31292
- });
31293
- var MoneyMarketAssetSchema = v7__namespace.object({
31294
- reserveAddress: v7__namespace.string(),
31295
- aTokenAddress: v7__namespace.string(),
31296
- totalATokenBalance: v7__namespace.string(),
31297
- variableDebtTokenAddress: v7__namespace.string(),
31298
- totalVariableDebtTokenBalance: v7__namespace.string(),
31299
- liquidityRate: v7__namespace.string(),
31300
- symbol: v7__namespace.string(),
31301
- totalSuppliers: v7__namespace.number(),
31302
- totalBorrowers: v7__namespace.number(),
31303
- variableBorrowRate: v7__namespace.string(),
31304
- stableBorrowRate: v7__namespace.string(),
31305
- liquidityIndex: v7__namespace.string(),
31306
- variableBorrowIndex: v7__namespace.string(),
31307
- blockNumber: v7__namespace.number()
31308
- });
31309
- var MoneyMarketAssetsSchema = v7__namespace.array(MoneyMarketAssetSchema);
31310
- var MoneyMarketAssetBorrowersSchema = v7__namespace.object({
31311
- borrowers: v7__namespace.array(v7__namespace.string()),
31312
- total: v7__namespace.number(),
31313
- offset: v7__namespace.number(),
31314
- limit: v7__namespace.number()
31315
- });
31316
- var MoneyMarketAssetSuppliersSchema = v7__namespace.object({
31317
- suppliers: v7__namespace.array(v7__namespace.string()),
31318
- total: v7__namespace.number(),
31319
- offset: v7__namespace.number(),
31320
- limit: v7__namespace.number()
31321
- });
31322
- var MoneyMarketBorrowersSchema = v7__namespace.object({
31323
- borrowers: v7__namespace.array(v7__namespace.string()),
31324
- total: v7__namespace.number(),
31325
- offset: v7__namespace.number(),
31326
- limit: v7__namespace.number()
31327
- });
31328
- var GetChainsResponseSchema = v7__namespace.array(SpokeChainKeySchema);
31329
- var TokensByChainMapSchema = v7__namespace.custom(
31330
- (input) => typeof input === "object" && input !== null && Object.values(input).every((tokens) => Array.isArray(tokens) && tokens.every((t) => v7__namespace.is(XTokenSchema, t)))
31331
- );
31332
- var TokensListSchema = v7__namespace.array(XTokenSchema);
31333
- var ReserveAssetsSchema = v7__namespace.array(AddressSchema2);
31334
31622
 
31335
31623
  // src/backendApi/BackendApiService.ts
31336
31624
  var BackendApiService = class {
@@ -31343,6 +31631,15 @@ var BackendApiService = class {
31343
31631
  config;
31344
31632
  headers;
31345
31633
  logger;
31634
+ /**
31635
+ * The resolved request timeout. Exposed so a caller wanting a *shorter* per-call budget can clamp
31636
+ * to it: a `RequestOverrideConfig.timeout` replaces the configured value rather than capping it,
31637
+ * so passing a fixed override would silently lengthen requests for a consumer who configured a
31638
+ * stricter timeout.
31639
+ */
31640
+ get requestTimeoutMs() {
31641
+ return this.config.timeout;
31642
+ }
31346
31643
  /**
31347
31644
  * Whether a legacy `/be` suffix is trimmed off a per-call `baseURL` override. Mirrors the config-level
31348
31645
  * decision: an explicit `basePath` means the consumer writes complete roots, so their per-call value is
@@ -31413,7 +31710,7 @@ var BackendApiService = class {
31413
31710
  async request(endpoint, config, schema) {
31414
31711
  try {
31415
31712
  const raw = await this.send(endpoint, config);
31416
- const parsed = v7__namespace.safeParse(schema, raw);
31713
+ const parsed = v__namespace.safeParse(schema, raw);
31417
31714
  if (!parsed.success) {
31418
31715
  return {
31419
31716
  ok: false,
@@ -31421,7 +31718,7 @@ var BackendApiService = class {
31421
31718
  api: "backend",
31422
31719
  feature: "backend",
31423
31720
  endpoint,
31424
- issues: v7__namespace.flatten(parsed.issues)
31721
+ issues: v__namespace.flatten(parsed.issues)
31425
31722
  })
31426
31723
  };
31427
31724
  }
@@ -40643,7 +40940,7 @@ var LeverageYieldService = class {
40643
40940
  }
40644
40941
  /** Looks up a vault by its `name` field. Returns `undefined` when not registered. */
40645
40942
  getVault(name) {
40646
- return this.listVaults().find((v9) => v9.name === name);
40943
+ return this.listVaults().find((v10) => v10.name === name);
40647
40944
  }
40648
40945
  /**
40649
40946
  * Looks up a registered vault by its on-chain proxy address (case-insensitive).
@@ -40651,7 +40948,7 @@ var LeverageYieldService = class {
40651
40948
  */
40652
40949
  getVaultByAddress(address) {
40653
40950
  const normalized = address.toLowerCase();
40654
- return this.listVaults().find((v9) => v9.vault.toLowerCase() === normalized);
40951
+ return this.listVaults().find((v10) => v10.vault.toLowerCase() === normalized);
40655
40952
  }
40656
40953
  /**
40657
40954
  * Resolves the intent `deadline`: returns the caller-supplied value verbatim, otherwise
@@ -42249,6 +42546,7 @@ exports.DEFAULT_RELAYER_API_ENDPOINT = DEFAULT_RELAYER_API_ENDPOINT;
42249
42546
  exports.DEFAULT_RELAY_TX_TIMEOUT = DEFAULT_RELAY_TX_TIMEOUT;
42250
42547
  exports.DEFAULT_RETRY_DELAY_MS = DEFAULT_RETRY_DELAY_MS;
42251
42548
  exports.DEFAULT_SPONSORING_API_ENDPOINT = DEFAULT_SPONSORING_API_ENDPOINT;
42549
+ exports.DETAILED_STATUS_NOT_DELIVERED = DETAILED_STATUS_NOT_DELIVERED;
42252
42550
  exports.DexService = DexService;
42253
42551
  exports.EVM_CHAIN_ID_TO_KEY = EVM_CHAIN_ID_TO_KEY;
42254
42552
  exports.EVM_CHAIN_KEYS = EVM_CHAIN_KEYS;
@@ -42313,6 +42611,7 @@ exports.RAY = RAY;
42313
42611
  exports.RAY_DECIMALS = RAY_DECIMALS;
42314
42612
  exports.RELAY_ERROR_CODES = RELAY_ERROR_CODES;
42315
42613
  exports.RELAY_FALLBACK_FLOOR_MS = RELAY_FALLBACK_FLOOR_MS;
42614
+ exports.RELAY_REQUEST_TIMEOUT_MS = RELAY_REQUEST_TIMEOUT_MS;
42316
42615
  exports.RadfiApiError = RadfiApiError;
42317
42616
  exports.RadfiProvider = RadfiProvider;
42318
42617
  exports.RecoveryService = RecoveryService;
@@ -42349,6 +42648,7 @@ exports.StakingLogic = StakingLogic;
42349
42648
  exports.StakingService = StakingService;
42350
42649
  exports.StatATokenAddresses = StatATokenAddresses;
42351
42650
  exports.StellarSpokeService = StellarSpokeService;
42651
+ exports.SuiGrpcTransport = SuiGrpcTransport;
42352
42652
  exports.SuiSpokeService = SuiSpokeService;
42353
42653
  exports.SupportedMigrationTokens = SupportedMigrationTokens;
42354
42654
  exports.SwapService = SwapService;
@@ -42485,6 +42785,7 @@ exports.isEvmSpokeOnlyChainKey = isEvmSpokeOnlyChainKey;
42485
42785
  exports.isEvmSpokeOnlyChainKeyType = isEvmSpokeOnlyChainKeyType;
42486
42786
  exports.isEvmWalletProviderType = isEvmWalletProviderType;
42487
42787
  exports.isFeatureError = isFeatureError;
42788
+ exports.isFillEvent = isFillEvent;
42488
42789
  exports.isHookSupportedToken = isHookSupportedToken;
42489
42790
  exports.isHubChainKey = isHubChainKey;
42490
42791
  exports.isHubChainKeyType = isHubChainKeyType;
@@ -42655,6 +42956,9 @@ exports.swapInvariant = swapInvariant;
42655
42956
  exports.swapSupportedTokens = swapSupportedTokens;
42656
42957
  exports.swapsConfig = swapsConfig;
42657
42958
  exports.toCreateBridgeIntentParamsV2 = toCreateBridgeIntentParamsV2;
42959
+ exports.toSuiExecutionResult = toSuiExecutionResult;
42960
+ exports.toSuiExecutionStatus = toSuiExecutionStatus;
42961
+ exports.toSuiPaginatedCoins = toSuiPaginatedCoins;
42658
42962
  exports.tokenLogo = tokenLogo;
42659
42963
  exports.tokenLogoSlug = tokenLogoSlug;
42660
42964
  exports.uiPoolDataAbi = uiPoolDataAbi;