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

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
@@ -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://fullnode.mainnet.sui.io:443",
3368
+ rpc_url: "https://sui-rpc.publicnode.com",
3369
3369
  chain: baseChainInfo[ChainKeys.SUI_MAINNET],
3370
3370
  pollingConfig: {
3371
3371
  pollingIntervalMs: 500,
@@ -3517,6 +3517,7 @@ var ICON_TX_RESULT_WAIT_MAX_RETRY = 10;
3517
3517
  var MAX_UINT256 = (1n << 256n) - 1n;
3518
3518
  var FEE_PERCENTAGE_SCALE = 10000n;
3519
3519
  var DEFAULT_DEADLINE_OFFSET = 300n;
3520
+ var DEFAULT_API_BASE_URL = "https://api.sodax.com/v1";
3520
3521
  var DEFAULT_BACKEND_API_ENDPOINT = "https://api.sodax.com/v1/be";
3521
3522
  var DEFAULT_BACKEND_API_TIMEOUT = 3e4;
3522
3523
  var DEFAULT_BACKEND_API_HEADERS = {
@@ -3527,8 +3528,9 @@ var DEFAULT_RELAYER_API_ENDPOINT = "https://xcall-relay.nw.iconblockchain.xyz";
3527
3528
  var VAULT_TOKEN_DECIMALS = 18;
3528
3529
  var DEFAULT_SPONSORING_API_ENDPOINT = "https://api.sodax.com/v1";
3529
3530
  var SPONSORING_API_STELLAR_BASE_PATH = "/sponsorships/stellar";
3531
+ var BACKEND_API_BASE_PATH = "/be";
3530
3532
  var apiConfig = {
3531
- baseURL: DEFAULT_BACKEND_API_ENDPOINT,
3533
+ baseURL: DEFAULT_API_BASE_URL,
3532
3534
  timeout: DEFAULT_BACKEND_API_TIMEOUT,
3533
3535
  headers: DEFAULT_BACKEND_API_HEADERS
3534
3536
  };
@@ -4456,7 +4458,13 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
4456
4458
  }
4457
4459
 
4458
4460
  // ../types/dist/index.js
4459
- var CONFIG_VERSION = 223;
4461
+ var CONFIG_VERSION = 225;
4462
+
4463
+ // src/shared/utils/resolveTimeoutMs.ts
4464
+ function resolveTimeoutMs(timeout, fallbackMs) {
4465
+ if (timeout === void 0 || !Number.isFinite(timeout)) return fallbackMs;
4466
+ return Math.max(0, timeout);
4467
+ }
4460
4468
  function isEvmSpokeChainConfig(value) {
4461
4469
  return typeof value === "object" && value !== null && value.chain.type === "EVM" && value.chain.key !== HUB_CHAIN_KEY;
4462
4470
  }
@@ -4883,7 +4891,7 @@ async function pollForExecutedPacket(payload, deadline) {
4883
4891
  }
4884
4892
  async function waitUntilIntentExecuted(payload) {
4885
4893
  try {
4886
- const timeout = payload.timeout ?? DEFAULT_RELAY_TX_TIMEOUT;
4894
+ const timeout = resolveTimeoutMs(payload.timeout, DEFAULT_RELAY_TX_TIMEOUT);
4887
4895
  const startTime = Date.now();
4888
4896
  const deadline = startTime + timeout;
4889
4897
  let lastPollingError;
@@ -4916,7 +4924,8 @@ async function waitUntilIntentExecuted(payload) {
4916
4924
  }
4917
4925
  async function relayTxAndWaitPacket(params) {
4918
4926
  try {
4919
- const { srcTxHash, data, chainKey, relayerApiEndpoint, timeout = DEFAULT_RELAY_TX_TIMEOUT, pollTxHash } = params;
4927
+ const { srcTxHash, data, chainKey, relayerApiEndpoint, pollTxHash } = params;
4928
+ const timeout = resolveTimeoutMs(params.timeout, DEFAULT_RELAY_TX_TIMEOUT);
4920
4929
  const intentRelayChainId = getIntentRelayChainId(chainKey).toString();
4921
4930
  const isSplitTxChain = isSolanaChainKeyType(chainKey) || isBitcoinChainKeyType(chainKey);
4922
4931
  invariant(!isSplitTxChain || data !== void 0, "Data is required for Solana and Bitcoin chain keys");
@@ -14324,6 +14333,17 @@ var ConfigService = class {
14324
14333
  get leverageYieldPartnerFee() {
14325
14334
  return this.leverageYield.partnerFee ?? this.fee;
14326
14335
  }
14336
+ // Effective backend submit-tx toggle per feature. Read live off the same `swaps` / `bridge` slots as
14337
+ // `partnerFee` so an omitted flag resolves to the ON default here, in one place, instead of leaving
14338
+ // `config.swaps.useBackendSubmitTx === undefined` while the backend path is actually active.
14339
+ // The deprecated `swapsOptions` / `bridgeOptions` keys are still honoured as a second-precedence
14340
+ // fallback, so a pre-existing explicit opt-out keeps the client-side path instead of silently flipping.
14341
+ get swapUseBackendSubmitTx() {
14342
+ return this.swaps.useBackendSubmitTx ?? this.sodax.swapsOptions?.useBackendSubmitTx ?? true;
14343
+ }
14344
+ get bridgeUseBackendSubmitTx() {
14345
+ return this.bridge.useBackendSubmitTx ?? this.sodax.bridgeOptions?.useBackendSubmitTx ?? true;
14346
+ }
14327
14347
  get dex() {
14328
14348
  return this.sodax.dex;
14329
14349
  }
@@ -26947,19 +26967,20 @@ var SolverApiService = class {
26947
26967
 
26948
26968
  // src/backendApi/pollBackendSubmitTx.ts
26949
26969
  async function pollBackendSubmitTx({
26950
- deadline,
26970
+ attempt,
26951
26971
  terminalStatus,
26952
26972
  getStatus,
26953
26973
  onExecuted,
26954
26974
  intervalMs = 1e3,
26955
26975
  requestTimeoutMs
26956
26976
  }) {
26957
- const reserveMs = Math.min(Math.ceil((deadline - Date.now()) / 3), 2e4);
26958
- const pollDeadline = deadline - reserveMs;
26959
- const requestOverride = () => requestTimeoutMs === void 0 ? void 0 : { timeout: Math.min(pollDeadline - Date.now(), requestTimeoutMs) };
26960
- while (Date.now() < pollDeadline) {
26961
- const statusResult = await getStatus(requestOverride());
26977
+ let polls = 0;
26978
+ let lastStatusError;
26979
+ for (let requestTimeout = attempt.requestTimeout(requestTimeoutMs); requestTimeout !== null; requestTimeout = attempt.requestTimeout(requestTimeoutMs)) {
26980
+ polls += 1;
26981
+ const statusResult = await getStatus({ timeout: requestTimeout });
26962
26982
  if (statusResult.ok) {
26983
+ lastStatusError = void 0;
26963
26984
  const { status, result, failureReason, abandonedAt } = statusResult.value.data;
26964
26985
  if (status === terminalStatus) {
26965
26986
  const value = onExecuted(result);
@@ -26969,11 +26990,70 @@ async function pollBackendSubmitTx({
26969
26990
  const reason = failureReason ? `: ${failureReason}` : "";
26970
26991
  return { ok: false, cause: new Error(`backend submit-tx ${status}${reason}`) };
26971
26992
  }
26993
+ } else {
26994
+ lastStatusError = statusResult.error;
26972
26995
  }
26973
- await new Promise((resolve) => setTimeout(resolve, Math.min(intervalMs, pollDeadline - Date.now())));
26996
+ if (attempt.remaining() <= intervalMs) break;
26997
+ await sleep(intervalMs);
26998
+ }
26999
+ if (polls === 0) {
27000
+ return { ok: false, cause: new Error("backend submit-tx submitted, but no budget was left to poll for status") };
27001
+ }
27002
+ if (lastStatusError !== void 0) {
27003
+ return {
27004
+ ok: false,
27005
+ cause: new Error(`backend submit-tx status polling failed before reaching ${terminalStatus}`, {
27006
+ cause: lastStatusError
27007
+ })
27008
+ };
26974
27009
  }
26975
27010
  return { ok: false, cause: new Error(`backend submit-tx polling timed out before reaching ${terminalStatus}`) };
26976
27011
  }
27012
+
27013
+ // src/backendApi/submitTxAttempt.ts
27014
+ function noRequestBudgetCause(serviceTimeoutMs) {
27015
+ return serviceTimeoutMs > 0 ? new Error("backend submit-tx skipped: the caller timeout left no budget for the attempt") : new Error(`backend submit-tx skipped: api timeout must be a positive number, got ${serviceTimeoutMs}`);
27016
+ }
27017
+ function createSubmitTxAttempt(callerTimeoutMs) {
27018
+ const deadline = Date.now() + resolveTimeoutMs(callerTimeoutMs, 0);
27019
+ const remaining = () => Math.max(0, deadline - Date.now());
27020
+ return {
27021
+ remaining,
27022
+ requestTimeout: (serviceTimeoutMs) => {
27023
+ const timeout = Math.min(remaining(), serviceTimeoutMs);
27024
+ return timeout > 0 ? timeout : null;
27025
+ }
27026
+ };
27027
+ }
27028
+
27029
+ // src/backendApi/runBackendSubmitTx.ts
27030
+ async function runBackendSubmitTx({
27031
+ attempt,
27032
+ api,
27033
+ body,
27034
+ statusQuery,
27035
+ terminalStatus,
27036
+ onExecuted
27037
+ }) {
27038
+ const serviceTimeoutMs = api.getTimeout();
27039
+ const requestTimeout = attempt.requestTimeout(serviceTimeoutMs);
27040
+ if (requestTimeout === null) return { ok: false, cause: noRequestBudgetCause(serviceTimeoutMs) };
27041
+ const submitted = await api.submitTx(body, { timeout: requestTimeout });
27042
+ if (!submitted.ok) return { ok: false, cause: submitted.error };
27043
+ if (!submitted.value.success) {
27044
+ return { ok: false, cause: new Error(`backend submit-tx not accepted: ${submitted.value.data.message}`) };
27045
+ }
27046
+ const polled = await pollBackendSubmitTx({
27047
+ attempt,
27048
+ terminalStatus,
27049
+ getStatus: (override) => api.getSubmitTxStatus(statusQuery, override),
27050
+ onExecuted,
27051
+ // While this ceiling is the smaller bound the poll retries within the attempt; once the attempt's
27052
+ // remainder falls below it, one stalled request can spend the rest.
27053
+ requestTimeoutMs: serviceTimeoutMs
27054
+ });
27055
+ return polled.ok ? { ok: true, value: polled.value } : { ok: false, cause: polled.cause };
27056
+ }
26977
27057
  function decodePacketIntentTarget(payload) {
26978
27058
  try {
26979
27059
  const hex = payload.startsWith("0x") ? payload.slice(2) : payload;
@@ -27024,20 +27104,33 @@ var SwapService = class {
27024
27104
  spoke;
27025
27105
  // swap config
27026
27106
  solver;
27027
- partnerFee;
27028
27107
  relayerApiEndpoint;
27029
- // backend swaps-API client + opt-in 2-step submit-tx flag
27108
+ // backend swaps-API client
27030
27109
  backendApi;
27031
- useBackendSubmitTx;
27032
- constructor({ config, hubProvider, spoke, backendApi, useBackendSubmitTx }) {
27110
+ /**
27111
+ * Effective 2-step submit-tx flow (`swaps.useBackendSubmitTx`, default on). Read live off
27112
+ * `ConfigService`, like {@link SwapService.partnerFee}, so the config object and the behavior can
27113
+ * never disagree.
27114
+ */
27115
+ get useBackendSubmitTx() {
27116
+ return this.config.swapUseBackendSubmitTx;
27117
+ }
27118
+ /**
27119
+ * Effective swap partner fee (`swaps.partnerFee`, else the global `fee`). Read live off
27120
+ * `ConfigService` rather than snapshotted in the constructor, so it cannot diverge from
27121
+ * `config.swapPartnerFee` if the config object is ever replaced (see `ConfigService.initialize`).
27122
+ * `BridgeService` and `LeverageYieldService` resolve their fees the same way.
27123
+ */
27124
+ get partnerFee() {
27125
+ return this.config.swapPartnerFee;
27126
+ }
27127
+ constructor({ config, hubProvider, spoke, backendApi }) {
27033
27128
  this.solver = config.solver;
27034
- this.partnerFee = config.swapPartnerFee;
27035
27129
  this.relayerApiEndpoint = config.relay.relayerApiEndpoint;
27036
27130
  this.config = config;
27037
27131
  this.hubProvider = hubProvider;
27038
27132
  this.spoke = spoke;
27039
27133
  this.backendApi = backendApi;
27040
- this.useBackendSubmitTx = useBackendSubmitTx ?? false;
27041
27134
  }
27042
27135
  /**
27043
27136
  * Estimates the gas cost for a raw (unsigned) transaction on a spoke chain.
@@ -27182,21 +27275,26 @@ var SwapService = class {
27182
27275
  * Executes a full end-to-end cross-chain swap.
27183
27276
  *
27184
27277
  * Orchestrates the complete swap lifecycle. `createIntent` first submits the intent transaction on
27185
- * the source spoke chain; completion then runs via one of two paths, both bounded by a single
27186
- * shared `timeout` budget:
27187
- *
27188
- * - **Client-side (default), {@link fallbackSwapSteps}:** verifies the spoke tx landed on-chain,
27189
- * relays it to the hub (Sonic) and waits for the packet — skipped when `srcChainKey` is the hub,
27190
- * where the spoke tx already is the hub tx — then calls `postExecution` to notify the solver,
27191
- * triggering it to fill the intent.
27192
- * - **Backend 2-step (opt-in via `swapsOptions.useBackendSubmitTx`), {@link submitTx}:** hands the
27278
+ * the source spoke chain; completion then runs via one of two paths, each bounded by its own `timeout`
27279
+ * budget:
27280
+ *
27281
+ * - **Client-side (opt-out via `swaps.useBackendSubmitTx: false`), {@link fallbackSwapSteps}:** verifies
27282
+ * the spoke tx landed on-chain, relays it to the hub (Sonic) and waits for the packet — skipped when
27283
+ * `srcChainKey` is the hub, where the spoke tx already is the hub tx — then calls `postExecution` to
27284
+ * notify the solver, triggering it to fill the intent.
27285
+ * - **Backend 2-step (default via `swaps.useBackendSubmitTx`), {@link submitTx}:** hands the
27193
27286
  * broadcast tx to the swaps API, which verifies, relays and post-executes server-side, then polls
27194
27287
  * for completion. On ANY non-success it transparently falls back to the client-side path above —
27195
27288
  * safe because re-relaying / re-posting an already-processed swap is idempotent (no double-fill).
27196
27289
  *
27197
27290
  * @param _params - Swap action params including intent parameters, wallet provider, and an optional
27198
- * `timeout` — the single shared budget for the whole completion flow (relay/poll plus any
27199
- * fallback), so total wall-clock never exceeds it.
27291
+ * `timeout` — a PER-ATTEMPT budget, not an end-to-end one. The backend attempt (submit POST + status
27292
+ * poll) gets it, and if that attempt does not complete the client-side relay wait gets a fresh one
27293
+ * starting after verification, so neither a stalled backend nor a slow source-chain confirmation can
27294
+ * shorten it. Worst-case wall-clock is `createIntent + timeout + verification +
27295
+ * max(timeout, RELAY_FALLBACK_FLOOR_MS) + postExecution`, where verification is bounded by the source
27296
+ * chain's `pollingConfig.maxTimeoutMs` and the first and last terms are not bounded by `timeout` at
27297
+ * all. See `docs/SWAPS.md` § How `timeout` bounds each attempt.
27200
27298
  * @returns A `Result<SwapResponse, SwapError>`. On success:
27201
27299
  * - `solverExecutionResponse` — solver acknowledgement (`{ answer: 'OK', intent_hash }`).
27202
27300
  * - `intent` — the on-chain intent object that was created.
@@ -27230,9 +27328,9 @@ var SwapService = class {
27230
27328
  return { ok: false, error: createIntentResult.error };
27231
27329
  }
27232
27330
  const created = createIntentResult.value;
27233
- const deadline = Date.now() + (_params.timeout ?? DEFAULT_RELAY_TX_TIMEOUT);
27331
+ const timeoutMs = resolveTimeoutMs(_params.timeout, DEFAULT_RELAY_TX_TIMEOUT);
27234
27332
  if (this.useBackendSubmitTx) {
27235
- const submitted = await this.submitTx(_params, created, deadline);
27333
+ const submitted = await this.submitTx(_params, created, createSubmitTxAttempt(timeoutMs));
27236
27334
  if (submitted.ok) return submitted;
27237
27335
  this.config.logger.warn(
27238
27336
  "[swap] backend submit-tx did not complete; falling back to the client-side relay",
@@ -27241,7 +27339,7 @@ var SwapService = class {
27241
27339
  }
27242
27340
  );
27243
27341
  }
27244
- return this.fallbackSwapSteps(_params, created, deadline);
27342
+ return this.fallbackSwapSteps(_params, created, timeoutMs);
27245
27343
  } catch (error) {
27246
27344
  if (isSwapError(error)) return { ok: false, error };
27247
27345
  return {
@@ -27268,12 +27366,16 @@ var SwapService = class {
27268
27366
  );
27269
27367
  }
27270
27368
  /**
27271
- * Client-side swap completion (the default path): relay the broadcast intent tx to the hub — or
27272
- * use it directly when the source IS the hub — then notify the solver via post-execution and
27273
- * build the {@link SwapResponse}. Extracted verbatim from `swap()` so the opt-in backend 2-step
27274
- * path ({@link submitTx}) can fall back to it on any non-success.
27369
+ * Client-side swap completion (opt-out via `swaps.useBackendSubmitTx: false`): verify the broadcast intent
27370
+ * tx landed, then relay it to the hub — or use it directly when the source IS the hub — then notify the
27371
+ * solver via post-execution and build the {@link SwapResponse}. Extracted verbatim from `swap()` so the
27372
+ * backend 2-step path ({@link submitTx}) can fall back to it on any non-success.
27373
+ *
27374
+ * Verification belongs to THIS path only: the backend runs its own, so verifying before handing over
27375
+ * would delay every backend success by the source chain's confirmation wait and could fail a swap the
27376
+ * backend would have completed.
27275
27377
  */
27276
- async fallbackSwapSteps(_params, created, deadline) {
27378
+ async fallbackSwapSteps(_params, created, timeoutMs) {
27277
27379
  const { params } = _params;
27278
27380
  const srcChainKey = params.srcChainKey;
27279
27381
  const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey };
@@ -27294,9 +27396,12 @@ var SwapService = class {
27294
27396
  data: relayData,
27295
27397
  chainKey: srcChainKey,
27296
27398
  relayerApiEndpoint: this.relayerApiEndpoint,
27297
- // Remaining shared budget: ≈ full `timeout` on the flag-off path (called immediately), or
27298
- // the reserve `submitTx` left on the backend path. Floor keeps a stalled-backend fallback viable.
27299
- timeout: Math.max(deadline - Date.now(), RELAY_FALLBACK_FLOOR_MS)
27399
+ // The caller's full `timeout`, starting HERE — after verification, and whether this runs as the
27400
+ // only path or as the backend's fallback. Neither a stalled backend attempt nor a slow source-chain
27401
+ // confirmation may shorten the relay wait. The floor covers a sub-floor caller `timeout`:
27402
+ // `relayTxAndWaitPacket` SUBMITS before `timeout` bounds anything, so a zero budget would strand an
27403
+ // already-landed tx unrelayed. Re-relay is idempotent, so spending it is safe.
27404
+ timeout: Math.max(timeoutMs, RELAY_FALLBACK_FLOOR_MS)
27300
27405
  });
27301
27406
  if (!packet.ok) {
27302
27407
  return { ok: false, error: mapRelayFailure(packet.error, { feature: "swap", action: "swap", ...baseCtx }) };
@@ -27326,7 +27431,7 @@ var SwapService = class {
27326
27431
  };
27327
27432
  }
27328
27433
  /**
27329
- * Backend 2-step swap path (opt-in via `swapsOptions.useBackendSubmitTx`): hand the broadcast
27434
+ * Backend 2-step swap path (default via `swaps.useBackendSubmitTx`): hand the broadcast
27330
27435
  * intent tx to the swaps API (`POST /swaps/submit-tx`); the backend relays + post-executes
27331
27436
  * server-side. Polls `getSubmitTxStatus` until `solved`, then reconstructs the same
27332
27437
  * {@link SwapResponse} the client-side path returns (`result.dstIntentTxHash` → delivery info,
@@ -27337,32 +27442,36 @@ var SwapService = class {
27337
27442
  *
27338
27443
  * Falling back is safe: re-relaying / re-posting an already-processed swap is idempotent — the
27339
27444
  * relay dedups and returns the existing `executed` packet, and the solver re-affirms the intent
27340
- * (no double-fill). Verified live by `e2e-tests/e2e-relay.test.ts`. Polling stops at
27341
- * `deadline - reserve` so the fallback keeps a guaranteed slice of the shared `swap` budget.
27445
+ * (no double-fill). Verified live by `e2e-tests/e2e-relay.test.ts`. It is also load-bearing rather
27446
+ * than belt-and-braces: the backend keeps processing after this attempt gives up, so the fallback's
27447
+ * relay can race the backend's own.
27448
+ *
27449
+ * The attempt itself — POST, budget clamps, status poll — is {@link runBackendSubmitTx}, shared with
27450
+ * bridge. What is swap-specific and lives here: the request body, the `solved` terminal status, the
27451
+ * mapping from a terminal result to a {@link SwapResponse}, and the swap error taxonomy.
27452
+ *
27453
+ * `attempt` bounds this attempt alone — the POST and every status request draw on it, and the
27454
+ * client-side fallback holds a separate fresh `timeout`.
27342
27455
  */
27343
- async submitTx(_params, created, deadline) {
27456
+ async submitTx(_params, created, attempt) {
27344
27457
  const { params } = _params;
27345
27458
  const srcChainKey = params.srcChainKey;
27346
27459
  const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey };
27347
27460
  const { tx: spokeTxHash, intent, relayData } = created;
27348
- const submitTxFailed = (cause) => ({
27349
- ok: false,
27350
- error: executionFailed("swap", cause, { ...baseCtx, action: "swap" })
27351
- });
27352
27461
  try {
27353
- const submitted = await this.backendApi.swaps.submitTx({
27354
- txHash: spokeTxHash,
27355
- srcChainKey,
27356
- walletAddress: params.srcAddress,
27357
- intent,
27358
- relayData: relayData.payload
27359
- });
27360
- if (!submitted.ok) return submitTxFailed(submitted.error);
27361
- const polled = await pollBackendSubmitTx({
27362
- deadline,
27462
+ const outcome = await runBackendSubmitTx({
27463
+ attempt,
27464
+ api: this.backendApi.swaps,
27465
+ body: {
27466
+ txHash: spokeTxHash,
27467
+ srcChainKey,
27468
+ walletAddress: params.srcAddress,
27469
+ intent,
27470
+ relayData: relayData.payload
27471
+ },
27472
+ statusQuery: { txHash: spokeTxHash, srcChainKey },
27363
27473
  // Swaps terminal success is `solved` (solver filled) — not the bridge `executed`.
27364
27474
  terminalStatus: "solved",
27365
- getStatus: () => this.backendApi.swaps.getSubmitTxStatus({ txHash: spokeTxHash, srcChainKey }),
27366
27475
  onExecuted: (result) => result?.dstIntentTxHash && result.intent_hash ? {
27367
27476
  // Backend serializes the hex intent_hash as a plain string; brand it at the boundary.
27368
27477
  solverExecutionResponse: { answer: "OK", intent_hash: result.intent_hash },
@@ -27377,7 +27486,7 @@ var SwapService = class {
27377
27486
  }
27378
27487
  } : void 0
27379
27488
  });
27380
- return polled.ok ? { ok: true, value: polled.value } : submitTxFailed(polled.cause);
27489
+ return outcome.ok ? { ok: true, value: outcome.value } : { ok: false, error: executionFailed("swap", outcome.cause, { ...baseCtx, action: "swap" }) };
27381
27490
  } catch (error) {
27382
27491
  return { ok: false, error: unknownFailed("swap", error, { ...baseCtx, action: "swap" }) };
27383
27492
  }
@@ -30226,7 +30335,6 @@ async function makeRequest(params) {
30226
30335
  body: config.body,
30227
30336
  signal: controller.signal
30228
30337
  });
30229
- clearTimeout(timeoutId);
30230
30338
  if (!response.ok) {
30231
30339
  const errorText = await response.text();
30232
30340
  throw new BackendHttpError(response.status, errorText);
@@ -30234,7 +30342,6 @@ async function makeRequest(params) {
30234
30342
  const data = await response.json();
30235
30343
  return data;
30236
30344
  } catch (error) {
30237
- clearTimeout(timeoutId);
30238
30345
  if (error instanceof Error) {
30239
30346
  if (error.name === "AbortError") {
30240
30347
  throw new Error("REQUEST_TIMEOUT", { cause: new Error(`Request timeout after ${timeout}ms`) });
@@ -30244,6 +30351,8 @@ async function makeRequest(params) {
30244
30351
  }
30245
30352
  logger.error(`[${serviceLabel}] Unknown error`, error);
30246
30353
  throw new Error("UNKNOWN_REQUEST_ERROR", { cause: error });
30354
+ } finally {
30355
+ clearTimeout(timeoutId);
30247
30356
  }
30248
30357
  }
30249
30358
  function resolveRequestConfig(config, defaults) {
@@ -30272,16 +30381,112 @@ function toInvalidResponseShapeError(params) {
30272
30381
  context: { api, endpoint, reason: "invalid_response_shape", issues }
30273
30382
  });
30274
30383
  }
30384
+
30385
+ // src/backendApi/apiConfig.ts
30386
+ function flatLayer({ baseURL, timeout, headers }) {
30387
+ return { baseURL, timeout, headers };
30388
+ }
30389
+ function layerConfigs(...slices) {
30390
+ return slices.reduce(
30391
+ (acc, slice) => slice ? {
30392
+ // Truthy (not nullish) so a set-but-empty env var falls back, matching `makeRequest`.
30393
+ baseURL: slice.baseURL || acc.baseURL,
30394
+ timeout: slice.timeout ?? acc.timeout,
30395
+ headers: { ...acc.headers, ...slice.headers }
30396
+ } : acc,
30397
+ {
30398
+ baseURL: DEFAULT_API_BASE_URL,
30399
+ timeout: DEFAULT_BACKEND_API_TIMEOUT,
30400
+ headers: { ...DEFAULT_BACKEND_API_HEADERS }
30401
+ }
30402
+ );
30403
+ }
30404
+ function isHttpUrl(value) {
30405
+ return value.startsWith("http://") || value.startsWith("https://");
30406
+ }
30407
+ function normalizeBaseURL(baseURL) {
30408
+ const trimmed = trimTrailingSlashes(baseURL);
30409
+ return isHttpUrl(trimmed) ? trimmed : baseURL;
30410
+ }
30411
+ function stripBackendMount(baseURL) {
30412
+ const trimmed = trimTrailingSlashes(baseURL);
30413
+ if (!trimmed.endsWith(BACKEND_API_BASE_PATH)) return void 0;
30414
+ const root = trimmed.slice(0, -BACKEND_API_BASE_PATH.length);
30415
+ return isHttpUrl(root) ? root : void 0;
30416
+ }
30417
+ function stripLegacyBackendMount(baseURL) {
30418
+ return stripBackendMount(baseURL) ?? baseURL;
30419
+ }
30420
+ function normalizeOverrideBaseURL(override) {
30421
+ if (!override?.baseURL) return override;
30422
+ return { ...override, baseURL: stripLegacyBackendMount(override.baseURL) };
30423
+ }
30424
+ function toGatewayRoot(baseURL) {
30425
+ return stripBackendMount(baseURL) ?? normalizeBaseURL(baseURL);
30426
+ }
30427
+ function configuredBasePath(layers) {
30428
+ return layers.baseApiConfig?.basePath ?? layers.basePath;
30429
+ }
30430
+ function hasExplicitBasePath(layers) {
30431
+ return configuredBasePath(layers) !== void 0;
30432
+ }
30433
+ function hasLegacyBackendBaseURL(layers) {
30434
+ if (configuredBasePath(layers) !== void 0) return false;
30435
+ return stripBackendMount(layerConfigs(flatLayer(layers), layers.baseApiConfig).baseURL) !== void 0;
30436
+ }
30437
+ var PACKAGED_API_ORIGIN = new URL(DEFAULT_API_BASE_URL).origin;
30438
+ function isOnPackagedOrigin(baseURL) {
30439
+ return baseURL === PACKAGED_API_ORIGIN || baseURL.startsWith(`${PACKAGED_API_ORIGIN}/`);
30440
+ }
30441
+ function isMissingVersionPrefix(baseURL) {
30442
+ const normalized = trimTrailingSlashes(baseURL);
30443
+ if (!isOnPackagedOrigin(normalized)) return false;
30444
+ return normalized !== DEFAULT_API_BASE_URL && !normalized.startsWith(`${DEFAULT_API_BASE_URL}/`);
30445
+ }
30446
+ function normalizeBasePath(basePath) {
30447
+ const trimmed = trimTrailingSlashes(basePath.trim());
30448
+ const withoutLeadingSlashes = trimmed.replace(/^\/+/, "");
30449
+ return withoutLeadingSlashes.length === 0 ? "" : `/${withoutLeadingSlashes}`;
30450
+ }
30451
+ function resolveSharedApiConfig(layers, slice) {
30452
+ const layered = layerConfigs(flatLayer(layers), layers.baseApiConfig, slice);
30453
+ const baseURL = configuredBasePath(layers) === void 0 ? toGatewayRoot(layered.baseURL) : normalizeBaseURL(layered.baseURL);
30454
+ return { ...layered, baseURL };
30455
+ }
30456
+ function resolveBaseApiConfig(layers) {
30457
+ return {
30458
+ ...resolveSharedApiConfig(layers),
30459
+ basePath: normalizeBasePath(configuredBasePath(layers) ?? BACKEND_API_BASE_PATH)
30460
+ };
30461
+ }
30462
+ function resolveSwapsApiConfig(layers) {
30463
+ return resolveSharedApiConfig(layers, layers.swapsApiConfig);
30464
+ }
30465
+ function resolveSponsoringApiConfig(layers) {
30466
+ const slice = layers.sponsoringApiConfig;
30467
+ return {
30468
+ baseURL: normalizeBaseURL(slice?.baseURL ?? DEFAULT_SPONSORING_API_ENDPOINT),
30469
+ timeout: slice?.timeout ?? resolveSharedApiConfig(layers).timeout,
30470
+ headers: { ...DEFAULT_BACKEND_API_HEADERS, ...slice?.headers },
30471
+ ...slice?.apiKey === void 0 ? {} : { apiKey: slice.apiKey }
30472
+ };
30473
+ }
30474
+ function resolveBridgeApiConfig(layers) {
30475
+ return resolveSharedApiConfig(layers);
30476
+ }
30275
30477
  var SwapsApiService = class _SwapsApiService {
30276
30478
  // Fully-resolved swaps-API config supplied by the caller (BackendApiService resolves the
30277
30479
  // `ApiConfig` union via `resolveSwapsApiConfig`); this service does not resolve the union.
30278
30480
  config;
30279
30481
  headers;
30280
30482
  logger;
30281
- constructor(config, logger = consoleLogger) {
30483
+ /** See {@link SwapsApiServiceOptions.trimLegacyOverrides}. */
30484
+ trimsLegacyOverrides;
30485
+ constructor(config, logger = consoleLogger, options = {}) {
30282
30486
  this.config = config;
30283
30487
  this.headers = { ...config.headers };
30284
30488
  this.logger = logger;
30489
+ this.trimsLegacyOverrides = options.trimLegacyOverrides ?? true;
30285
30490
  }
30286
30491
  /**
30287
30492
  * Build a `@sodax/swaps-api` client for a single call. Maps the SDK's `SwapsApiConfig`
@@ -30292,7 +30497,8 @@ var SwapsApiService = class _SwapsApiService {
30292
30497
  * overrides both take effect without caching stale state.
30293
30498
  */
30294
30499
  buildClient(overrideConfig) {
30295
- const baseUrl = overrideConfig?.baseURL || this.config.baseURL;
30500
+ const override = overrideConfig?.baseURL;
30501
+ const baseUrl = override ? this.trimsLegacyOverrides ? stripLegacyBackendMount(override) : override : this.config.baseURL;
30296
30502
  const timeout = overrideConfig?.timeout ?? this.config.timeout ?? DEFAULT_BACKEND_API_TIMEOUT;
30297
30503
  const headers = { ...this.headers, ...overrideConfig?.headers };
30298
30504
  return new swapsApi.SwapsApi({ baseUrl, headers, timeout });
@@ -30448,7 +30654,9 @@ var SwapsApiService = class _SwapsApiService {
30448
30654
  // ──────────────────────────────────────────────────────────────────────
30449
30655
  // Submit-tx state machine
30450
30656
  // ──────────────────────────────────────────────────────────────────────
30451
- /** Submit a swap transaction to be processed (relay, post-execution, etc.). Idempotent on `(txHash, srcChainKey)`. */
30657
+ /** Submit a swap transaction to be processed (relay, post-execution, etc.). Idempotent on `(txHash, srcChainKey)`.
30658
+ * Response is immediate after successful submission. Use getSubmitTxStatus to poll the status of the submission.
30659
+ */
30452
30660
  async submitTx(body, config) {
30453
30661
  return this.toResult(
30454
30662
  "/swaps/submit-tx",
@@ -30477,6 +30685,18 @@ var SwapsApiService = class _SwapsApiService {
30477
30685
  getBaseURL() {
30478
30686
  return this.config.baseURL;
30479
30687
  }
30688
+ /**
30689
+ * Return the effective per-request timeout (ms) — the same value {@link buildClient} resolves, so
30690
+ * `SwapsApiConfig.timeout` being optional never leaks an `undefined` ceiling.
30691
+ *
30692
+ * Callers bounding a request tighter than this need it as the CEILING, because a
30693
+ * `RequestOverrideConfig.timeout` REPLACES the service value rather than lowering it: an override
30694
+ * derived from a caller budget alone would raise the bound whenever that budget is the larger of the
30695
+ * two. `SubmitTxAttempt.requestTimeout` clamps against both (`min(budget left in the attempt, this)`).
30696
+ */
30697
+ getTimeout() {
30698
+ return this.config.timeout ?? DEFAULT_BACKEND_API_TIMEOUT;
30699
+ }
30480
30700
  };
30481
30701
  var StellarSponsorConfigSchema = v7__namespace.object({
30482
30702
  sponsorAccount: v7__namespace.string(),
@@ -30753,10 +30973,13 @@ var BridgeApiService = class {
30753
30973
  config;
30754
30974
  headers;
30755
30975
  logger;
30756
- constructor(config, logger = consoleLogger) {
30976
+ /** See {@link BridgeApiServiceOptions.trimLegacyOverrides}. */
30977
+ trimsLegacyOverrides;
30978
+ constructor(config, logger = consoleLogger, options = {}) {
30757
30979
  this.config = config;
30758
30980
  this.headers = { ...config.headers };
30759
30981
  this.logger = logger;
30982
+ this.trimsLegacyOverrides = options.trimLegacyOverrides ?? true;
30760
30983
  }
30761
30984
  /**
30762
30985
  * Issues a single HTTP request, validates the JSON body against `schema`, and
@@ -30769,7 +30992,10 @@ var BridgeApiService = class {
30769
30992
  const raw = await makeRequest({
30770
30993
  endpoint,
30771
30994
  config: { baseURL: this.config.baseURL, timeout: this.config.timeout, headers: this.headers, ...config },
30772
- overrideConfig,
30995
+ // Normalized like a configured base URL: the override is the gateway root, so a legacy
30996
+ // `/be`-suffixed value must not nest `/bridge/*` under the data API's mount — unless the config
30997
+ // opted out of the legacy trim, in which case the per-call value is left exactly as given.
30998
+ overrideConfig: this.trimsLegacyOverrides ? normalizeOverrideBaseURL(overrideConfig) : overrideConfig,
30773
30999
  logger: this.logger,
30774
31000
  serviceLabel: "BridgeApiService"
30775
31001
  });
@@ -30963,61 +31189,17 @@ var BridgeApiService = class {
30963
31189
  return this.config.baseURL;
30964
31190
  }
30965
31191
  /**
30966
- * Return the effective per-request timeout (ms). Callers that bound a request tighter than the
30967
- * service default (e.g. `pollBackendSubmitTx` clamping to its poll cutoff) need this as the ceiling,
30968
- * because a `RequestOverrideConfig.timeout` REPLACES the service value rather than lowering it.
31192
+ * Return the effective per-request timeout (ms).
31193
+ *
31194
+ * Callers bounding a request tighter than this need it as the CEILING, because a
31195
+ * `RequestOverrideConfig.timeout` REPLACES the service value rather than lowering it: an override
31196
+ * derived from a caller budget alone would raise the bound whenever that budget is the larger of the
31197
+ * two. `SubmitTxAttempt.requestTimeout` clamps against both (`min(budget left in the attempt, this)`).
30969
31198
  */
30970
31199
  getTimeout() {
30971
31200
  return this.config.timeout;
30972
31201
  }
30973
31202
  };
30974
-
30975
- // src/backendApi/apiConfig.ts
30976
- function flatLayer({ baseURL, timeout, headers }) {
30977
- return { baseURL, timeout, headers };
30978
- }
30979
- function layerConfigs(...slices) {
30980
- return slices.reduce(
30981
- (acc, slice) => slice ? {
30982
- baseURL: slice.baseURL ?? acc.baseURL,
30983
- timeout: slice.timeout ?? acc.timeout,
30984
- headers: { ...acc.headers, ...slice.headers }
30985
- } : acc,
30986
- {
30987
- baseURL: DEFAULT_BACKEND_API_ENDPOINT,
30988
- timeout: DEFAULT_BACKEND_API_TIMEOUT,
30989
- headers: { ...DEFAULT_BACKEND_API_HEADERS }
30990
- }
30991
- );
30992
- }
30993
- function resolveBaseApiConfig(config) {
30994
- const layers = config;
30995
- return layerConfigs(flatLayer(layers), layers.baseApiConfig);
30996
- }
30997
- function resolveSwapsApiConfig(config) {
30998
- const layers = config;
30999
- return layerConfigs(flatLayer(layers), layers.baseApiConfig, layers.swapsApiConfig);
31000
- }
31001
- function isHttpUrl(value) {
31002
- return value.startsWith("http://") || value.startsWith("https://");
31003
- }
31004
- function normalizeBaseURL(baseURL) {
31005
- const trimmed = trimTrailingSlashes(baseURL);
31006
- return isHttpUrl(trimmed) ? trimmed : baseURL;
31007
- }
31008
- function resolveSponsoringApiConfig(config) {
31009
- const layers = config;
31010
- const slice = layers.sponsoringApiConfig;
31011
- return {
31012
- baseURL: normalizeBaseURL(slice?.baseURL ?? DEFAULT_SPONSORING_API_ENDPOINT),
31013
- timeout: slice?.timeout ?? resolveBaseApiConfig(config).timeout,
31014
- headers: { ...DEFAULT_BACKEND_API_HEADERS, ...slice?.headers },
31015
- ...slice?.apiKey === void 0 ? {} : { apiKey: slice.apiKey }
31016
- };
31017
- }
31018
- function resolveBridgeApiConfig(config) {
31019
- return resolveBaseApiConfig(config);
31020
- }
31021
31203
  var ChainKeySchema = v7__namespace.custom((input) => typeof input === "string");
31022
31204
  var SpokeChainKeySchema = v7__namespace.custom((input) => typeof input === "string");
31023
31205
  var AddressSchema2 = v7__namespace.custom((input) => typeof input === "string");
@@ -31156,17 +31338,70 @@ var BackendApiService = class {
31156
31338
  swaps;
31157
31339
  sponsoring;
31158
31340
  bridge;
31159
- // resolved base-API config: the flat fields of the ApiConfig union with any `baseApiConfig` layered on top
31341
+ // resolved base-API config: the flat fields of the ApiConfig union with any `baseApiConfig` layered on
31342
+ // top. `baseURL` is the gateway root; `basePath` is this service's own mount below it.
31160
31343
  config;
31161
31344
  headers;
31162
31345
  logger;
31346
+ /**
31347
+ * Whether a legacy `/be` suffix is trimmed off a per-call `baseURL` override. Mirrors the config-level
31348
+ * decision: an explicit `basePath` means the consumer writes complete roots, so their per-call value is
31349
+ * left exactly as given rather than having a real path segment eaten.
31350
+ */
31351
+ trimsLegacyOverrides;
31163
31352
  constructor(config, logger = consoleLogger) {
31164
31353
  this.config = resolveBaseApiConfig(config);
31165
31354
  this.headers = { ...this.config.headers };
31166
31355
  this.logger = logger;
31167
- this.swaps = new SwapsApiService(resolveSwapsApiConfig(config), this.logger);
31168
- this.sponsoring = new SponsoringApiService(resolveSponsoringApiConfig(config), this.logger);
31169
- this.bridge = new BridgeApiService(resolveBridgeApiConfig(config), this.logger);
31356
+ this.trimsLegacyOverrides = !hasExplicitBasePath(config);
31357
+ const swapsConfig2 = resolveSwapsApiConfig(config);
31358
+ const sponsoringConfig = resolveSponsoringApiConfig(config);
31359
+ const bridgeConfig2 = resolveBridgeApiConfig(config);
31360
+ const shortRoots = [
31361
+ ["backendApi", this.config.baseURL],
31362
+ ["api.swaps", swapsConfig2.baseURL],
31363
+ ["api.bridge", bridgeConfig2.baseURL],
31364
+ ["api.sponsoring", sponsoringConfig.baseURL]
31365
+ ].filter(([, baseURL]) => isMissingVersionPrefix(baseURL));
31366
+ if (shortRoots.length > 0) {
31367
+ const named = shortRoots.map(([service, baseURL]) => `${service} ("${baseURL}")`).join(", ");
31368
+ this.logger.warn(
31369
+ `[BackendApiService] api.baseURL is missing the gateway's version prefix for ${named}: every route resolves one segment short. Use "${DEFAULT_API_BASE_URL}" \u2014 the prefix is deployment-owned, so it belongs in baseURL, and only the data API has a basePath to compensate.`
31370
+ );
31371
+ }
31372
+ if (hasLegacyBackendBaseURL(config)) {
31373
+ this.logger.warn(
31374
+ `[BackendApiService] api.baseURL should be the gateway root, not the backend data API's mount: trimmed "${BACKEND_API_BASE_PATH}" to "${this.config.baseURL}". Drop the suffix \u2014 the SDK appends it, and sibling services (/swaps, /bridge) must not sit under it.`
31375
+ );
31376
+ }
31377
+ const overrideOptions = { trimLegacyOverrides: this.trimsLegacyOverrides };
31378
+ this.swaps = new SwapsApiService(swapsConfig2, this.logger, overrideOptions);
31379
+ this.sponsoring = new SponsoringApiService(sponsoringConfig, this.logger);
31380
+ this.bridge = new BridgeApiService(bridgeConfig2, this.logger, overrideOptions);
31381
+ }
31382
+ /**
31383
+ * Issue the HTTP call for a route.
31384
+ *
31385
+ * The mount is applied here rather than at each route literal, so `error.context.endpoint` stays
31386
+ * route-relative and the mount survives a per-call `baseURL` override — that retargets the gateway
31387
+ * root, not which service the route belongs to. For the same reason an override is put through the
31388
+ * legacy-mount trim: without it, passing the old `…/v1/be` value per call would yield `/be/be/…`.
31389
+ *
31390
+ * Defaults are listed field by field so `basePath` cannot cross into `RequestConfig`, where it has no
31391
+ * meaning — a spread would pass it silently, since TypeScript skips excess-property checks on spreads.
31392
+ */
31393
+ async send(endpoint, config) {
31394
+ const { baseURL, ...rest } = config;
31395
+ const overrideBaseURL = baseURL !== void 0 && this.trimsLegacyOverrides ? stripLegacyBackendMount(baseURL) : baseURL;
31396
+ return makeRequest({
31397
+ endpoint: `${this.config.basePath}${endpoint}`,
31398
+ config: resolveRequestConfig(
31399
+ { ...rest, ...overrideBaseURL === void 0 ? {} : { baseURL: overrideBaseURL } },
31400
+ { baseURL: this.config.baseURL, timeout: this.config.timeout, headers: this.headers }
31401
+ ),
31402
+ logger: this.logger,
31403
+ serviceLabel: "BackendApiService"
31404
+ });
31170
31405
  }
31171
31406
  /**
31172
31407
  * Issue a request and validate the JSON body against `schema`, wrapping the result in `Result<T>`.
@@ -31177,12 +31412,7 @@ var BackendApiService = class {
31177
31412
  */
31178
31413
  async request(endpoint, config, schema) {
31179
31414
  try {
31180
- const raw = await makeRequest({
31181
- endpoint,
31182
- config: resolveRequestConfig(config, { ...this.config, headers: this.headers }),
31183
- logger: this.logger,
31184
- serviceLabel: "BackendApiService"
31185
- });
31415
+ const raw = await this.send(endpoint, config);
31186
31416
  const parsed = v7__namespace.safeParse(schema, raw);
31187
31417
  if (!parsed.success) {
31188
31418
  return {
@@ -31209,12 +31439,7 @@ var BackendApiService = class {
31209
31439
  */
31210
31440
  async requestUnvalidated(endpoint, config) {
31211
31441
  try {
31212
- const value = await makeRequest({
31213
- endpoint,
31214
- config: resolveRequestConfig(config, { ...this.config, headers: this.headers }),
31215
- logger: this.logger,
31216
- serviceLabel: "BackendApiService"
31217
- });
31442
+ const value = await this.send(endpoint, config);
31218
31443
  return { ok: true, value };
31219
31444
  } catch (error) {
31220
31445
  return { ok: false, error: toExternalApiError({ api: "backend", feature: "backend", endpoint, error }) };
@@ -31516,8 +31741,9 @@ var BackendApiService = class {
31516
31741
  * without constructing a new service instance. Existing header keys are
31517
31742
  * overwritten; keys absent from `headers` are preserved.
31518
31743
  *
31519
- * Headers also reach `swaps`, which shares this origin, but never `sponsoring`,
31520
- * whose separate origin must not receive base-API credentials.
31744
+ * Headers also reach `swaps` and `bridge`, but never `sponsoring`: it is configured independently, so
31745
+ * base-API credentials must not be forwarded to whatever origin it points at. Note `swaps` can also be
31746
+ * retargeted to another origin via `swapsApiConfig`, in which case a header set here follows it.
31521
31747
  *
31522
31748
  * @param headers - Key-value pairs to add or overwrite in the default headers.
31523
31749
  */
@@ -31529,13 +31755,22 @@ var BackendApiService = class {
31529
31755
  this.bridge.setHeaders(headers);
31530
31756
  }
31531
31757
  /**
31532
- * Return the base URL the service is currently pointing at.
31758
+ * Return the gateway root the service is currently pointing at — WITHOUT this service's own mount.
31759
+ * Requests go to `getBaseURL() + getBasePath() + <route>`.
31533
31760
  *
31534
- * @returns The `baseURL` from the `ApiConfig` this instance was constructed with.
31761
+ * @returns The resolved gateway root, i.e. the `baseURL` from the `ApiConfig` this instance was
31762
+ * constructed with, minus a legacy `/be` suffix if one was supplied.
31535
31763
  */
31536
31764
  getBaseURL() {
31537
31765
  return this.config.baseURL;
31538
31766
  }
31767
+ /**
31768
+ * Return the backend data API's mount below {@link getBaseURL} — `/be` by default, or whatever
31769
+ * `basePath` the `ApiConfig` supplied (`''` for a service addressed directly at its origin).
31770
+ */
31771
+ getBasePath() {
31772
+ return this.config.basePath;
31773
+ }
31539
31774
  };
31540
31775
 
31541
31776
  // src/bridge/errors.ts
@@ -31577,15 +31812,20 @@ var BridgeService = class {
31577
31812
  hubProvider;
31578
31813
  config;
31579
31814
  spoke;
31580
- // backend bridge-API client + opt-in backend submit-tx flag
31815
+ // backend bridge-API client
31581
31816
  backendApi;
31582
- useBackendSubmitTx;
31583
- constructor({ hubProvider, config, spoke, backendApi, useBackendSubmitTx }) {
31817
+ /**
31818
+ * Effective backend submit-tx flow (`bridge.useBackendSubmitTx`, default on). Read live off
31819
+ * `ConfigService` like `bridgePartnerFee`, so the config object and the behavior can never disagree.
31820
+ */
31821
+ get useBackendSubmitTx() {
31822
+ return this.config.bridgeUseBackendSubmitTx;
31823
+ }
31824
+ constructor({ hubProvider, config, spoke, backendApi }) {
31584
31825
  this.config = config;
31585
31826
  this.hubProvider = hubProvider;
31586
31827
  this.spoke = spoke;
31587
31828
  this.backendApi = backendApi;
31588
- this.useBackendSubmitTx = useBackendSubmitTx ?? false;
31589
31829
  }
31590
31830
  /**
31591
31831
  * Calculates the partner fee deducted from a given bridge input amount.
@@ -31750,15 +31990,27 @@ var BridgeService = class {
31750
31990
  /**
31751
31991
  * Executes a full end-to-end bridge transfer: spoke deposit → relay → hub settlement.
31752
31992
  *
31753
- * Internally calls `createBridgeIntent()` to submit the spoke-side deposit transaction,
31754
- * then waits for the cross-chain relay packet to be confirmed on the hub (Sonic).
31755
- * Use this method for the typical "fire and wait" bridge UX.
31993
+ * Internally calls `createBridgeIntent()` to submit the spoke-side deposit transaction, then
31994
+ * completes the transfer via one of two paths. Use this method for the typical "fire and wait" UX.
31995
+ *
31996
+ * - **Backend submit-tx (default, `bridge.useBackendSubmitTx`), {@link submitTx}:** hands the deposit
31997
+ * to the bridge API, which relays server-side, and polls until `executed`. On ANY non-success it
31998
+ * falls back to the path below — safe because re-relaying is idempotent.
31999
+ * - **Client-side (opt-out with `useBackendSubmitTx: false`), {@link fallbackBridgeSteps}:** verifies
32000
+ * the deposit landed on-chain, then relays it and waits for the settlement packet. `verifyTxHash`
32001
+ * runs on this path only; the backend runs its own.
31756
32002
  *
31757
32003
  * For manual relay control (e.g. monitoring or batching), use `createBridgeIntent()` directly
31758
32004
  * and handle the relay step yourself.
31759
32005
  *
31760
32006
  * @param _params - Bridge parameters including source/destination chain keys, token addresses,
31761
- * amount, recipient address, wallet provider, and optional timeout.
32007
+ * amount, recipient address, wallet provider, and an optional `timeout` — a PER-ATTEMPT budget,
32008
+ * not an end-to-end one. The backend attempt gets it, and if that attempt does not complete the
32009
+ * client-side relay wait gets a fresh one starting after verification, so neither a stalled backend
32010
+ * nor a slow source-chain confirmation can shorten it. Worst-case wall-clock is
32011
+ * `createBridgeIntent + timeout + verification + max(timeout, RELAY_FALLBACK_FLOOR_MS)`, where
32012
+ * verification is bounded by the source chain's `pollingConfig.maxTimeoutMs` and intent creation is
32013
+ * not bounded by `timeout` at all. See `docs/BRIDGE.md` § Completion paths and `timeout`.
31762
32014
  * @returns `Result<TxHashPair>` — `{ srcChainTxHash, dstChainTxHash }` on success,
31763
32015
  * where `srcChainTxHash` is the spoke deposit tx and `dstChainTxHash` is the hub settlement tx.
31764
32016
  *
@@ -31792,16 +32044,16 @@ var BridgeService = class {
31792
32044
  try {
31793
32045
  const created = await this.createBridgeIntent(_params);
31794
32046
  if (!created.ok) return { ok: false, error: created.error };
31795
- const deadline = Date.now() + (_params.timeout ?? DEFAULT_RELAY_TX_TIMEOUT);
32047
+ const timeoutMs = resolveTimeoutMs(_params.timeout, DEFAULT_RELAY_TX_TIMEOUT);
31796
32048
  if (this.useBackendSubmitTx) {
31797
- const submitted = await this.submitTx(_params, created.value, deadline);
32049
+ const submitted = await this.submitTx(_params, created.value, createSubmitTxAttempt(timeoutMs));
31798
32050
  if (submitted.ok) return submitted;
31799
32051
  this.config.logger.warn(
31800
32052
  "[bridge] backend submit-tx did not complete; falling back to the client-side relay",
31801
32053
  { error: submitted.error }
31802
32054
  );
31803
32055
  }
31804
- return this.fallbackBridgeSteps(_params, created.value, deadline);
32056
+ return this.fallbackBridgeSteps(_params, created.value, timeoutMs);
31805
32057
  } catch (error) {
31806
32058
  if (isBridgeOrchestrationError(error)) return { ok: false, error };
31807
32059
  return {
@@ -31829,12 +32081,16 @@ var BridgeService = class {
31829
32081
  );
31830
32082
  }
31831
32083
  /**
31832
- * Client-side bridge completion (the default path): verify the broadcast spoke-deposit tx, then
31833
- * relay it to the hub and wait for the settlement packet. Extracted verbatim from `bridge()` so the
31834
- * opt-in backend submit-tx path ({@link submitTx}) can fall back to it on any non-success. Bridge
31835
- * always relays — there is no hub-source short-circuit.
32084
+ * Client-side bridge completion (opt-out via `bridge.useBackendSubmitTx: false`): verify the broadcast
32085
+ * spoke-deposit tx, then relay it to the hub and wait for the settlement packet. Extracted verbatim from
32086
+ * `bridge()` so the backend submit-tx path ({@link submitTx}) can fall back to it on any non-success.
32087
+ * Bridge always relays — there is no hub-source short-circuit.
32088
+ *
32089
+ * Verification belongs to THIS path only: the backend runs its own, so verifying before handing over
32090
+ * would delay every backend success by the source chain's confirmation wait and could fail a bridge the
32091
+ * backend would have completed.
31836
32092
  */
31837
- async fallbackBridgeSteps(_params, created, deadline) {
32093
+ async fallbackBridgeSteps(_params, created, timeoutMs) {
31838
32094
  const { params } = _params;
31839
32095
  const baseCtx = { srcChainKey: params.srcChainKey, dstChainKey: params.dstChainKey };
31840
32096
  const verifyTxHashResult = await this.spoke.verifyTxHash({
@@ -31849,13 +32105,13 @@ var BridgeService = class {
31849
32105
  data: created.relayData,
31850
32106
  chainKey: params.srcChainKey,
31851
32107
  relayerApiEndpoint: this.config.relay.relayerApiEndpoint,
31852
- // Remaining shared budget: ≈ full `timeout` on the flag-off path minus the `verifyTxHash` wait,
31853
- // or the reserve `submitTx` left on the backend path (`pollBackendSubmitTx` holds back up to a
31854
- // third, capped at 20s). The floor matters because `relayTxAndWaitPacket` SUBMITS the tx to the
31855
- // relay before `timeout` bounds anything: a budget exhausted by a slow source-chain confirmation
31856
- // (Stacks polls for up to its full 120s `maxTimeoutMs`) would otherwise strand an already-landed
31857
- // deposit unrelayed. Re-relay is idempotent, so always spending the floor is safe.
31858
- timeout: Math.max(deadline - Date.now(), RELAY_FALLBACK_FLOOR_MS)
32108
+ // The caller's full `timeout`, starting HERE — after verification, and whether this runs as the only
32109
+ // path or as the backend's fallback. Neither a stalled backend attempt nor a slow source-chain
32110
+ // confirmation (Stacks polls for up to its full 120s `maxTimeoutMs`) may shorten the relay wait. The
32111
+ // floor covers a sub-floor caller `timeout`: `relayTxAndWaitPacket` SUBMITS the tx to the relay
32112
+ // before `timeout` bounds anything, so a zero budget would strand an already-landed deposit
32113
+ // unrelayed. Re-relay is idempotent, so always spending the floor is safe.
32114
+ timeout: Math.max(timeoutMs, RELAY_FALLBACK_FLOOR_MS)
31859
32115
  });
31860
32116
  if (!packetResult.ok) {
31861
32117
  return {
@@ -31874,7 +32130,7 @@ var BridgeService = class {
31874
32130
  };
31875
32131
  }
31876
32132
  /**
31877
- * Backend bridge path (opt-in via `bridgeOptions.useBackendSubmitTx`): hand the broadcast
32133
+ * Backend bridge path (default via `bridge.useBackendSubmitTx`): hand the broadcast
31878
32134
  * spoke-deposit tx to the bridge API (`POST /bridge/submit-tx`) with the FULL `relayData`
31879
32135
  * envelope; the backend relays server-side. Polls `getSubmitTxStatus` until `executed`, then
31880
32136
  * returns the same {@link TxHashPair} the client-side path returns (`result.dstIntentTxHash` →
@@ -31883,39 +32139,39 @@ var BridgeService = class {
31883
32139
  * Never throws — returns `{ ok: false }` on any non-success (submit `!ok`, terminal `failed` /
31884
32140
  * abandoned, or poll timeout) so `bridge()` falls back to {@link fallbackBridgeSteps}. Falling back
31885
32141
  * is safe: re-relaying an already-relayed bridge tx is idempotent — the relay dedups and returns the
31886
- * existing `executed` packet. Polling stops at `deadline - reserve` so the fallback keeps a
31887
- * guaranteed slice of the shared `bridge` budget.
32142
+ * existing `executed` packet. It is also load-bearing rather than belt-and-braces: the backend keeps
32143
+ * processing after this attempt gives up, so the fallback's relay can race the backend's own.
32144
+ *
32145
+ * The attempt itself — POST, budget clamps, status poll — is {@link runBackendSubmitTx}, shared with
32146
+ * swaps. What is bridge-specific and lives here: the request body (the FULL `relayData` envelope), the
32147
+ * `executed` terminal status, the mapping to a {@link TxHashPair}, and the bridge error taxonomy.
32148
+ *
32149
+ * `attempt` bounds this attempt alone — the POST and every status request draw on it, and the
32150
+ * client-side fallback holds a separate fresh `timeout`.
31888
32151
  */
31889
- async submitTx(_params, created, deadline) {
32152
+ async submitTx(_params, created, attempt) {
31890
32153
  const { params } = _params;
31891
32154
  const srcChainKey = params.srcChainKey;
31892
32155
  const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey };
31893
32156
  const { tx: spokeTxHash, relayData } = created;
31894
- const submitTxFailed = (cause) => ({
31895
- ok: false,
31896
- error: executionFailed("bridge", cause, { ...baseCtx, action: "bridge" })
31897
- });
31898
32157
  try {
31899
- const submitted = await this.backendApi.bridge.submitTx({
31900
- txHash: spokeTxHash,
31901
- srcChainKey,
31902
- walletAddress: params.srcAddress,
31903
- // Send the FULL { address, payload } envelope — bridge has no intent.creator for the backend
31904
- // to rebuild the relay address, so dropping it would break split-tx-chain relay.
31905
- relayData
31906
- });
31907
- if (!submitted.ok) return submitTxFailed(submitted.error);
31908
- const polled = await pollBackendSubmitTx({
31909
- deadline,
32158
+ const outcome = await runBackendSubmitTx({
32159
+ attempt,
32160
+ api: this.backendApi.bridge,
32161
+ body: {
32162
+ txHash: spokeTxHash,
32163
+ srcChainKey,
32164
+ walletAddress: params.srcAddress,
32165
+ // Send the FULL { address, payload } envelope — bridge has no intent.creator for the backend
32166
+ // to rebuild the relay address, so dropping it would break split-tx-chain relay.
32167
+ relayData
32168
+ },
32169
+ statusQuery: { txHash: spokeTxHash, srcChainKey },
31910
32170
  // Bridge terminal success is `executed` (hub-settled) — not the swaps `solved`.
31911
32171
  terminalStatus: "executed",
31912
- getStatus: (override) => this.backendApi.bridge.getSubmitTxStatus({ txHash: spokeTxHash, srcChainKey }, override),
31913
- onExecuted: (result) => result?.dstIntentTxHash ? { srcChainTxHash: spokeTxHash, dstChainTxHash: result.dstIntentTxHash } : void 0,
31914
- // Bound each status request by the poll cutoff, never above the service default — so a stalled
31915
- // request can neither eat the fallback's reserve nor consume the window in one attempt.
31916
- requestTimeoutMs: this.backendApi.bridge.getTimeout()
32172
+ onExecuted: (result) => result?.dstIntentTxHash ? { srcChainTxHash: spokeTxHash, dstChainTxHash: result.dstIntentTxHash } : void 0
31917
32173
  });
31918
- return polled.ok ? { ok: true, value: polled.value } : submitTxFailed(polled.cause);
32174
+ return outcome.ok ? { ok: true, value: outcome.value } : { ok: false, error: executionFailed("bridge", outcome.cause, { ...baseCtx, action: "bridge" }) };
31919
32175
  } catch (error) {
31920
32176
  return { ok: false, error: unknownFailed("bridge", error, { ...baseCtx, action: "bridge" }) };
31921
32177
  }
@@ -38089,15 +38345,25 @@ var MoneyMarketService = class _MoneyMarketService {
38089
38345
  config;
38090
38346
  spoke;
38091
38347
  // money market config (hoisted from config for ergonomics, mirrors SwapService)
38092
- partnerFee;
38093
38348
  relayerApiEndpoint;
38094
38349
  // sub-service
38095
38350
  data;
38351
+ /**
38352
+ * Effective money-market partner fee (`moneyMarket.partnerFee`, else the global `fee`). Read live
38353
+ * off `ConfigService` rather than snapshotted in the constructor, so it cannot diverge from
38354
+ * `config.moneyMarketPartnerFee` if the config object is ever replaced. Mirrors
38355
+ * {@link SwapService.partnerFee}.
38356
+ *
38357
+ * Money market has no per-action override: unlike swap / bridge / leverage-yield, every flow here
38358
+ * charges this configured fee.
38359
+ */
38360
+ get partnerFee() {
38361
+ return this.config.moneyMarketPartnerFee;
38362
+ }
38096
38363
  constructor({ config, hubProvider, spoke }) {
38097
38364
  this.config = config;
38098
38365
  this.hubProvider = hubProvider;
38099
38366
  this.spoke = spoke;
38100
- this.partnerFee = config.moneyMarketPartnerFee;
38101
38367
  this.relayerApiEndpoint = config.relay.relayerApiEndpoint;
38102
38368
  this.data = new MoneyMarketDataService({ hubProvider, config });
38103
38369
  }
@@ -40410,6 +40676,68 @@ var LeverageYieldService = class {
40410
40676
  return { ok: false, error: lookupFailed("leverageYield", "resolveDeadline", error, { srcChainKey }) };
40411
40677
  }
40412
40678
  }
40679
+ /**
40680
+ * Quotes a vault deposit or withdraw. Vault shares are solver-tradeable, so this is the
40681
+ * generic solver quote with one difference that matters: the fee deducted before quoting is
40682
+ * the effective **leverage-yield** fee, matching what {@link LeverageYieldService.createVaultIntent}
40683
+ * will charge. `sodax.swaps.getQuote` deducts the effective *swap* fee instead, so quoting a
40684
+ * vault flow through it makes the quote and the intent disagree whenever the two feature fees
40685
+ * differ. Quoting a vault flow through the swap service can be made to agree — pass the same fee
40686
+ * explicitly, using a zero fee (`{ address, percentage: 0 }`) where the effective leverage-yield
40687
+ * fee is `undefined`, since an explicit `undefined` there falls back to the swap fee — but this
40688
+ * method resolves it for you and is the canonical way to quote a vault flow.
40689
+ *
40690
+ * Pass the vault address as `token_dst` to quote a deposit, or as `token_src` to quote a
40691
+ * withdraw; subtract your slippage tolerance from `quoted_amount` to get `minOutputAmount`.
40692
+ * When overriding the fee per intent, pass the same `partnerFee` here and to whichever builder
40693
+ * you use ({@link LeverageYieldService.deposit}, {@link LeverageYieldService.withdraw}) or
40694
+ * directly to {@link LeverageYieldService.vaultSwap} — omitting it everywhere is equally safe,
40695
+ * since each side then resolves the same effective leverage-yield fee. Both directions are
40696
+ * charged, so this applies to withdrawals as much as deposits.
40697
+ *
40698
+ * @returns `SolverIntentQuoteResponse` on success. On failure `result.error` is either the
40699
+ * solver's own `SolverErrorResponse` (no path, insufficient liquidity, …) or a SodaxError
40700
+ * with `VALIDATION_FAILED` (bad `amount`, or a partner fee that leaves nothing to quote),
40701
+ * `LOOKUP_FAILED` (unsupported token — the solver payload could not be assembled) or
40702
+ * `UNKNOWN`. Discriminate with `isSodaxError(error)`.
40703
+ */
40704
+ async getQuote(payload) {
40705
+ const { partnerFee = this.config.leverageYieldPartnerFee, ...request } = payload;
40706
+ const baseCtx = {
40707
+ method: "getQuote",
40708
+ tokenSrcChainKey: request.token_src_blockchain_id,
40709
+ tokenDstChainKey: request.token_dst_blockchain_id
40710
+ };
40711
+ try {
40712
+ leverageYieldInvariant(request.amount > 0n, "amount must be greater than 0", {
40713
+ ...baseCtx,
40714
+ field: "amount"
40715
+ });
40716
+ if (isPartnerFeeAmount(partnerFee)) {
40717
+ leverageYieldInvariant(
40718
+ partnerFee.amount < request.amount,
40719
+ `partnerFee amount (${partnerFee.amount}) must be less than the quote amount (${request.amount})`,
40720
+ { ...baseCtx, field: "partnerFee" }
40721
+ );
40722
+ } else if (isPartnerFeePercentage(partnerFee)) {
40723
+ leverageYieldInvariant(
40724
+ Number.isInteger(partnerFee.percentage) && partnerFee.percentage >= 0 && partnerFee.percentage <= Number(FEE_PERCENTAGE_SCALE),
40725
+ `partnerFee percentage must be a whole number of basis points between 0 and ${FEE_PERCENTAGE_SCALE} (got ${partnerFee.percentage})`,
40726
+ { ...baseCtx, field: "partnerFee" }
40727
+ );
40728
+ }
40729
+ const netAmount = adjustAmountByFee(request.amount, partnerFee, request.quote_type);
40730
+ leverageYieldInvariant(netAmount > 0n, "amount net of the partner fee must be greater than 0", {
40731
+ ...baseCtx,
40732
+ field: "partnerFee"
40733
+ });
40734
+ const adjustedPayload = { ...request, amount: netAmount };
40735
+ return await SolverApiService.getQuote(adjustedPayload, this.config.solver, this.config);
40736
+ } catch (error) {
40737
+ if (isLeverageYieldLookupError(error)) return { ok: false, error };
40738
+ return { ok: false, error: lookupFailed("leverageYield", "getQuote", error, baseCtx) };
40739
+ }
40740
+ }
40413
40741
  /**
40414
40742
  * Builds the {@link LeverageYieldSwapPayload} for a leverage-yield deposit (any token → lsoda*).
40415
40743
  * The lsoda* output is delivered to the user's hub wallet on Sonic so a later
@@ -40417,9 +40745,8 @@ var LeverageYieldService = class {
40417
40745
  * {@link LeverageYieldService.vaultSwap}: `vaultSwap({ ...payload, walletProvider })`.
40418
40746
  * An optional `partnerFee` is forwarded on the payload as the per-intent fee override.
40419
40747
  *
40420
- * For `minOutputAmount`, quote via `sodax.swaps.getQuote` with the vault address as the
40421
- * destination token (`token_dst`) — vault shares are solver-tradeable, so the generic swap
40422
- * quote applies; then subtract your slippage tolerance.
40748
+ * For `minOutputAmount`, quote via {@link LeverageYieldService.getQuote} with the vault
40749
+ * address as the destination token (`token_dst`), then subtract your slippage tolerance.
40423
40750
  */
40424
40751
  async deposit(params) {
40425
40752
  const baseCtx = { srcChainKey: params.srcChainKey, action: "deposit" };
@@ -40472,9 +40799,13 @@ var LeverageYieldService = class {
40472
40799
  * a call shape uniform with {@link LeverageYieldService.deposit}; async because the default
40473
40800
  * `deadline` is read from the hub block timestamp.
40474
40801
  *
40475
- * For `minOutputAmount`, quote via `sodax.swaps.getQuote` with the vault address as the
40476
- * source token (`token_src`) — vault shares are solver-tradeable, so the generic swap quote
40477
- * applies; then subtract your slippage tolerance.
40802
+ * An optional `partnerFee` is forwarded on the payload as the per-intent fee override; omit it
40803
+ * and the configured leverage-yield fee applies. Withdrawals **are** charged — the fee comes out
40804
+ * of `inputAmount`, which for a withdraw is the vault's own shares, so the receiver accrues
40805
+ * lsoda\* rather than the output token.
40806
+ *
40807
+ * For `minOutputAmount`, quote via {@link LeverageYieldService.getQuote} with the vault
40808
+ * address as the source token (`token_src`), then subtract your slippage tolerance.
40478
40809
  */
40479
40810
  async withdraw(params) {
40480
40811
  const baseCtx = { srcChainKey: params.srcChainKey, action: "withdraw" };
@@ -40508,7 +40839,10 @@ var LeverageYieldService = class {
40508
40839
  solver: params.solver ?? ANY_SOLVER_ADDRESS,
40509
40840
  data: "0x"
40510
40841
  },
40511
- hubWalletSwap: true
40842
+ hubWalletSwap: true,
40843
+ // Per-intent fee override — only included when the caller supplies one, so the
40844
+ // payload stays free of undefined-valued keys (mirrors `deposit`).
40845
+ ...params.partnerFee !== void 0 && { partnerFee: params.partnerFee }
40512
40846
  }
40513
40847
  };
40514
40848
  } catch (error) {
@@ -40541,7 +40875,7 @@ var LeverageYieldService = class {
40541
40875
  * `UNKNOWN` (defensive fallback).
40542
40876
  */
40543
40877
  async createVaultIntent(_params) {
40544
- const { params, skipSimulation, hubWalletSwap, partnerFee = this.config.swapPartnerFee } = _params;
40878
+ const { params, skipSimulation, hubWalletSwap, partnerFee = this.config.leverageYieldPartnerFee } = _params;
40545
40879
  const baseCtx = { srcChainKey: params.srcChainKey, dstChainKey: params.dstChainKey };
40546
40880
  try {
40547
40881
  leverageYieldInvariant(
@@ -41771,8 +42105,6 @@ var Sodax = class {
41771
42105
  const analytics = resolveAnalytics(options?.analytics);
41772
42106
  const fee = options?.fee;
41773
42107
  const radfiSigner = options?.radfi?.signRequest;
41774
- const useBackendSubmitTx = options?.swapsOptions?.useBackendSubmitTx ?? false;
41775
- const bridgeUseBackendSubmitTx = options?.bridgeOptions?.useBackendSubmitTx ?? false;
41776
42108
  this.instanceConfig = options ? mergeSodaxConfig(sodaxConfig, options) : sodaxConfig;
41777
42109
  this.backendApi = new BackendApiService(this.instanceConfig.api, logger);
41778
42110
  this.api = this.backendApi;
@@ -41791,8 +42123,7 @@ var Sodax = class {
41791
42123
  config: this.config,
41792
42124
  hubProvider: this.hubProvider,
41793
42125
  spoke: this.spoke,
41794
- backendApi: this.backendApi,
41795
- useBackendSubmitTx
42126
+ backendApi: this.backendApi
41796
42127
  });
41797
42128
  this.moneyMarket = new MoneyMarketService({
41798
42129
  config: this.config,
@@ -41813,8 +42144,7 @@ var Sodax = class {
41813
42144
  hubProvider: this.hubProvider,
41814
42145
  config: this.config,
41815
42146
  spoke: this.spoke,
41816
- backendApi: this.backendApi,
41817
- useBackendSubmitTx: bridgeUseBackendSubmitTx
42147
+ backendApi: this.backendApi
41818
42148
  });
41819
42149
  this.staking = new StakingService({ hubProvider: this.hubProvider, config: this.config, spoke: this.spoke });
41820
42150
  this.partners = new PartnerService({
@@ -41885,6 +42215,7 @@ Object.defineProperty(exports, "SwapsApiError", {
41885
42215
  exports.ALLOWANCE_CHECK_CODES = ALLOWANCE_CHECK_CODES;
41886
42216
  exports.APPROVE_CODES = APPROVE_CODES;
41887
42217
  exports.AssetService = AssetService;
42218
+ exports.BACKEND_API_BASE_PATH = BACKEND_API_BASE_PATH;
41888
42219
  exports.BITCOIN_CHAIN_KEYS = BITCOIN_CHAIN_KEYS;
41889
42220
  exports.BITCOIN_CHAIN_KEYS_SET = BITCOIN_CHAIN_KEYS_SET;
41890
42221
  exports.BITCOIN_DUST_SATS = BITCOIN_DUST_SATS;
@@ -41908,6 +42239,7 @@ exports.ClService = ClService;
41908
42239
  exports.ConfigService = ConfigService;
41909
42240
  exports.CustomSorobanServer = CustomSorobanServer;
41910
42241
  exports.CustomStellarAccount = CustomStellarAccount;
42242
+ exports.DEFAULT_API_BASE_URL = DEFAULT_API_BASE_URL;
41911
42243
  exports.DEFAULT_BACKEND_API_ENDPOINT = DEFAULT_BACKEND_API_ENDPOINT;
41912
42244
  exports.DEFAULT_BACKEND_API_HEADERS = DEFAULT_BACKEND_API_HEADERS;
41913
42245
  exports.DEFAULT_BACKEND_API_TIMEOUT = DEFAULT_BACKEND_API_TIMEOUT;