@trustware/sdk-staging 1.1.12-staging.5 → 1.1.12-staging.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/widget.cjs CHANGED
@@ -593,7 +593,7 @@ var init_constants = __esm({
593
593
  "src/constants.ts"() {
594
594
  "use strict";
595
595
  SDK_NAME = "@trustware/sdk";
596
- SDK_VERSION = "1.1.12-staging.5";
596
+ SDK_VERSION = "1.1.12-staging.7";
597
597
  API_ROOT = "https://bv-staging-api.trustware.io";
598
598
  GTM_ID = "GTM-TZDGNCXB";
599
599
  API_PREFIX = "/api";
@@ -822,6 +822,104 @@ var init_chains = __esm({
822
822
  }
823
823
  });
824
824
 
825
+ // src/wallets/chainParams.ts
826
+ function chainParamsFor(chainId) {
827
+ return registered.get(chainId) ?? BUILTIN_CHAIN_PARAMS[chainId];
828
+ }
829
+ function registerChainParams(chainId, params) {
830
+ registered.set(chainId, params);
831
+ }
832
+ function usableRpcUrls(chain) {
833
+ const candidates = [
834
+ ...Array.isArray(chain.rpcList) ? chain.rpcList : [],
835
+ ...chain.rpc ? [chain.rpc] : []
836
+ ];
837
+ const seen = /* @__PURE__ */ new Set();
838
+ const out = [];
839
+ for (const raw of candidates) {
840
+ const url = String(raw ?? "").trim();
841
+ if (!/^https?:\/\//i.test(url) || seen.has(url)) continue;
842
+ seen.add(url);
843
+ out.push(url);
844
+ }
845
+ return out;
846
+ }
847
+ function chainParamsFromChainDef(chain) {
848
+ const chainType = String(
849
+ chain.chainType ?? chain.type ?? "evm"
850
+ ).toLowerCase();
851
+ if (chainType !== "evm") return void 0;
852
+ const numericId = Number(chain.chainId ?? chain.id);
853
+ if (!Number.isSafeInteger(numericId) || numericId <= 0) return void 0;
854
+ const rpcUrls = usableRpcUrls(chain);
855
+ if (rpcUrls.length === 0) return void 0;
856
+ const native = chain.nativeCurrency;
857
+ const symbol = String(native?.symbol ?? "").trim();
858
+ if (!symbol) return void 0;
859
+ const decimals = Number(native?.decimals);
860
+ const chainName = String(
861
+ chain.networkName ?? chain.axelarChainName ?? chain.networkIdentifier ?? ""
862
+ ).trim();
863
+ const explorers = (chain.blockExplorerUrls ?? []).filter(
864
+ (u) => /^https?:\/\//i.test(String(u ?? ""))
865
+ );
866
+ return {
867
+ chainIdHex: `0x${numericId.toString(16)}`,
868
+ chainName: chainName || `Chain ${numericId}`,
869
+ rpcUrls,
870
+ nativeCurrency: {
871
+ name: String(native?.name ?? symbol),
872
+ symbol,
873
+ decimals: Number.isFinite(decimals) ? decimals : 18
874
+ },
875
+ ...explorers.length > 0 ? { blockExplorerUrls: explorers } : {}
876
+ };
877
+ }
878
+ var BUILTIN_CHAIN_PARAMS, registered;
879
+ var init_chainParams = __esm({
880
+ "src/wallets/chainParams.ts"() {
881
+ "use strict";
882
+ BUILTIN_CHAIN_PARAMS = {
883
+ 1: {
884
+ chainIdHex: "0x1",
885
+ chainName: "Ethereum",
886
+ rpcUrls: ["https://eth.llamarpc.com"],
887
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
888
+ blockExplorerUrls: ["https://etherscan.io"]
889
+ },
890
+ 137: {
891
+ chainIdHex: "0x89",
892
+ chainName: "Polygon",
893
+ rpcUrls: ["https://polygon-rpc.com"],
894
+ nativeCurrency: { name: "POL", symbol: "POL", decimals: 18 },
895
+ blockExplorerUrls: ["https://polygonscan.com"]
896
+ },
897
+ 8453: {
898
+ chainIdHex: "0x2105",
899
+ chainName: "Base",
900
+ rpcUrls: ["https://mainnet.base.org"],
901
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
902
+ blockExplorerUrls: ["https://basescan.org"]
903
+ },
904
+ 42161: {
905
+ chainIdHex: "0xa4b1",
906
+ chainName: "Arbitrum One",
907
+ rpcUrls: ["https://arb1.arbitrum.io/rpc"],
908
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
909
+ blockExplorerUrls: ["https://arbiscan.io"]
910
+ },
911
+ 43114: {
912
+ chainIdHex: "0xa86a",
913
+ chainName: "Avalanche C-Chain",
914
+ rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"],
915
+ nativeCurrency: { name: "Avalanche", symbol: "AVAX", decimals: 18 },
916
+ blockExplorerUrls: ["https://snowtrace.io"]
917
+ }
918
+ };
919
+ registered = /* @__PURE__ */ new Map();
920
+ }
921
+ });
922
+
825
923
  // src/registry.ts
826
924
  function getChainAliases(chain) {
827
925
  const values = [
@@ -866,6 +964,7 @@ var init_registry = __esm({
866
964
  "use strict";
867
965
  init_store();
868
966
  init_chains();
967
+ init_chainParams();
869
968
  NATIVE = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
870
969
  PAGE_CACHE_TTL_MS = 5 * 60 * 1e3;
871
970
  PAGE_CACHE_LIMIT = 100;
@@ -944,6 +1043,10 @@ var init_registry = __esm({
944
1043
  for (const alias of getChainAliases(normalized)) {
945
1044
  this._chainAliases.set(alias, canonicalKey);
946
1045
  }
1046
+ const addParams = chainParamsFromChainDef(normalized);
1047
+ if (addParams) {
1048
+ registerChainParams(Number(normalized.chainId ?? canonical), addParams);
1049
+ }
947
1050
  }
948
1051
  storeTokenForAlias(chainKey, token) {
949
1052
  const key = tokenKey(token);
@@ -5920,7 +6023,7 @@ var init_bridges = __esm({
5920
6023
 
5921
6024
  // src/wallets/eipWallets.ts
5922
6025
  async function addThenSwitch(eth, chainId) {
5923
- const p = CHAIN_PARAMS[chainId];
6026
+ const p = chainParamsFor(chainId);
5924
6027
  if (!p) throw new Error(`Unknown chain ${chainId} (no params to add)`);
5925
6028
  await eth.request({ method: "wallet_addEthereumChain", params: [p] });
5926
6029
  await eth.request({
@@ -5948,7 +6051,7 @@ function useEIP1193(eth) {
5948
6051
  async switchChain(chainId) {
5949
6052
  if (switching) return;
5950
6053
  switching = true;
5951
- const hex = CHAIN_PARAMS[chainId]?.chainIdHex ?? `0x${chainId.toString(16)}`;
6054
+ const hex = chainParamsFor(chainId)?.chainIdHex ?? `0x${chainId.toString(16)}`;
5952
6055
  try {
5953
6056
  await eth.request({
5954
6057
  method: "wallet_switchEthereumChain",
@@ -5957,7 +6060,6 @@ function useEIP1193(eth) {
5957
6060
  } catch (e2) {
5958
6061
  if (e2?.code === 4902) {
5959
6062
  await addThenSwitch(eth, chainId);
5960
- } else if (e2?.code === 4001) {
5961
6063
  } else {
5962
6064
  throw e2;
5963
6065
  }
@@ -5968,47 +6070,10 @@ function useEIP1193(eth) {
5968
6070
  request: (args) => eth.request(args)
5969
6071
  };
5970
6072
  }
5971
- var CHAIN_PARAMS;
5972
6073
  var init_eipWallets = __esm({
5973
6074
  "src/wallets/eipWallets.ts"() {
5974
6075
  "use strict";
5975
- CHAIN_PARAMS = {
5976
- 1: {
5977
- chainIdHex: "0x1",
5978
- chainName: "Ethereum",
5979
- rpcUrls: ["https://eth.llamarpc.com"],
5980
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
5981
- blockExplorerUrls: ["https://etherscan.io"]
5982
- },
5983
- 137: {
5984
- chainIdHex: "0x89",
5985
- chainName: "Polygon",
5986
- rpcUrls: ["https://polygon-rpc.com"],
5987
- nativeCurrency: { name: "POL", symbol: "POL", decimals: 18 },
5988
- blockExplorerUrls: ["https://polygonscan.com"]
5989
- },
5990
- 8453: {
5991
- chainIdHex: "0x2105",
5992
- chainName: "Base",
5993
- rpcUrls: ["https://mainnet.base.org"],
5994
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
5995
- blockExplorerUrls: ["https://basescan.org"]
5996
- },
5997
- 42161: {
5998
- chainIdHex: "0xa4b1",
5999
- chainName: "Arbitrum One",
6000
- rpcUrls: ["https://arb1.arbitrum.io/rpc"],
6001
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
6002
- blockExplorerUrls: ["https://arbiscan.io"]
6003
- },
6004
- 43114: {
6005
- chainIdHex: "0xa86a",
6006
- chainName: "Avalanche C-Chain",
6007
- rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"],
6008
- nativeCurrency: { name: "Avalanche", symbol: "AVAX", decimals: 18 },
6009
- blockExplorerUrls: ["https://snowtrace.io"]
6010
- }
6011
- };
6076
+ init_chainParams();
6012
6077
  }
6013
6078
  });
6014
6079
 
@@ -9224,6 +9289,25 @@ function backendChainId(chain, fallback) {
9224
9289
  function sleep2(ms) {
9225
9290
  return new Promise((resolve) => setTimeout(resolve, ms));
9226
9291
  }
9292
+ async function ensureWalletOnChain(wallet, target) {
9293
+ if (!Number.isSafeInteger(target) || target <= 0) {
9294
+ throw new Error(`Invalid chain id: ${target}`);
9295
+ }
9296
+ if (await wallet.getChainId() === target) return;
9297
+ let switchError;
9298
+ try {
9299
+ await wallet.switchChain(target);
9300
+ } catch (e2) {
9301
+ switchError = e2;
9302
+ }
9303
+ if (await wallet.getChainId() === target) return;
9304
+ if (switchError && isUserRejected(switchError)) {
9305
+ throw switchError;
9306
+ }
9307
+ throw new Error(
9308
+ `Wallet is on the wrong network. Switch to chain ${target} and try again.`
9309
+ );
9310
+ }
9227
9311
  async function sendEvmTx(w, tx) {
9228
9312
  if (w.type === "eip1193") {
9229
9313
  const from = await w.getAddress();
@@ -9250,19 +9334,37 @@ async function sendEvmTx(w, tx) {
9250
9334
  });
9251
9335
  return response.hash;
9252
9336
  }
9253
- async function waitForTxConfirmation(chainId, txHash) {
9254
- const timeoutMs = 12e4;
9255
- const intervalMs = 2e3;
9337
+ async function waitForEvmTxConfirmation(chainId, txHash, label, options = {}) {
9338
+ const {
9339
+ readStatus = getEVMTxStatus,
9340
+ timeoutMs = 12e4,
9341
+ intervalMs = 2e3,
9342
+ notFoundGraceMs = NOT_FOUND_GRACE_MS
9343
+ } = options;
9256
9344
  const started = Date.now();
9345
+ let notFoundSince = null;
9257
9346
  while (Date.now() - started < timeoutMs) {
9258
- const status = await getEVMTxStatus({ chainId, txHash });
9347
+ const status = await readStatus({ chainId, txHash });
9259
9348
  if (status.status === "success") return;
9260
9349
  if (status.status === "reverted") {
9261
- throw new Error("Approval transaction reverted");
9350
+ throw new Error(`${label} transaction reverted`);
9351
+ }
9352
+ if (status.status === "not_found") {
9353
+ notFoundSince ?? (notFoundSince = Date.now());
9354
+ if (Date.now() - notFoundSince >= notFoundGraceMs) {
9355
+ throw new Error(
9356
+ `${label} transaction ${txHash} was not found on chain ${chainId}. It may have been sent on a different network \u2014 check your wallet's selected network and try again.`
9357
+ );
9358
+ }
9359
+ } else {
9360
+ notFoundSince = null;
9262
9361
  }
9263
9362
  await sleep2(intervalMs);
9264
9363
  }
9265
- throw new Error("Timed out waiting for approval confirmation");
9364
+ throw new Error(`Timed out waiting for ${label.toLowerCase()} confirmation`);
9365
+ }
9366
+ function waitForApprovalConfirmation(chainId, txHash, options) {
9367
+ return waitForEvmTxConfirmation(chainId, txHash, "Approval", options);
9266
9368
  }
9267
9369
  function requiredApprovalAmount(planAmountWei, routeAmountWei) {
9268
9370
  if (planAmountWei >= UNLIMITED_APPROVAL_FLOOR && routeAmountWei !== void 0 && routeAmountWei > 0n) {
@@ -9302,17 +9404,22 @@ async function ensureApprovals(w, approvals, fallbackChainId, intentId, routeAmo
9302
9404
  functionName: "approve",
9303
9405
  args: [spender, amountWei]
9304
9406
  });
9407
+ const approvalChainId = Number(chainId);
9408
+ if (!Number.isSafeInteger(approvalChainId) || approvalChainId <= 0) {
9409
+ throw new Error(`Approval has an invalid chain id: ${chainId}`);
9410
+ }
9411
+ await ensureWalletOnChain(w, approvalChainId);
9305
9412
  const hash = await sendEvmTx(w, {
9306
9413
  to: tokenAddress,
9307
9414
  data,
9308
9415
  value: 0n,
9309
- chainId: Number.isFinite(Number(chainId)) ? Number(chainId) : void 0
9416
+ chainId: approvalChainId
9310
9417
  });
9311
9418
  if (intentId) {
9312
9419
  void submitStepReceipt(intentId, stepIndex, hash).catch(() => {
9313
9420
  });
9314
9421
  }
9315
- await waitForTxConfirmation(chainId, hash);
9422
+ await waitForApprovalConfirmation(chainId, hash);
9316
9423
  }
9317
9424
  }
9318
9425
  function isUserRejected(e2) {
@@ -9339,15 +9446,14 @@ async function sendRouteTransaction(b, fallbackChainId, options) {
9339
9446
  validatedSponsorship = b.sponsorship;
9340
9447
  }
9341
9448
  }
9342
- if (Number.isFinite(target)) {
9343
- const current = await w.getChainId();
9344
- if (current !== target) {
9345
- try {
9346
- await w.switchChain(target);
9347
- } catch {
9348
- }
9349
- }
9449
+ if (!Number.isSafeInteger(target) || target <= 0) {
9450
+ throw new Error(
9451
+ `Route is missing a usable chain id (got ${String(
9452
+ txReq.chainId ?? fallbackChainId
9453
+ )}).`
9454
+ );
9350
9455
  }
9456
+ await ensureWalletOnChain(w, target);
9351
9457
  if (!validatedSponsorship && !options?.approvalsEnsured) {
9352
9458
  await ensureApprovals(
9353
9459
  w,
@@ -9453,7 +9559,7 @@ async function runTopUp(params) {
9453
9559
  }
9454
9560
  }
9455
9561
  }
9456
- var import_viem2, erc20ApproveAbi, UNLIMITED_APPROVAL_FLOOR;
9562
+ var import_viem2, erc20ApproveAbi, NOT_FOUND_GRACE_MS, UNLIMITED_APPROVAL_FLOOR;
9457
9563
  var init_tx = __esm({
9458
9564
  "src/core/tx.ts"() {
9459
9565
  "use strict";
@@ -9464,6 +9570,7 @@ var init_tx = __esm({
9464
9570
  erc20ApproveAbi = (0, import_viem2.parseAbi)([
9465
9571
  "function approve(address spender, uint256 amount) returns (bool)"
9466
9572
  ]);
9573
+ NOT_FOUND_GRACE_MS = 2e4;
9467
9574
  UNLIMITED_APPROVAL_FLOOR = 1n << 255n;
9468
9575
  }
9469
9576
  });
@@ -33611,6 +33718,35 @@ var init_useSwapRoute = __esm({
33611
33718
  }
33612
33719
  });
33613
33720
 
33721
+ // src/modes/swap/routeValue.ts
33722
+ function parseUsd(value) {
33723
+ if (value == null) return null;
33724
+ const n = parseFloat(value);
33725
+ return Number.isFinite(n) ? n : null;
33726
+ }
33727
+ function routeNetUsd(estimate) {
33728
+ if (!estimate) return null;
33729
+ const toUsd = parseUsd(estimate.toAmountUsd);
33730
+ const feesUsd = parseUsd(estimate.totalFeesUsd);
33731
+ if (toUsd == null || feesUsd == null) return null;
33732
+ return toUsd - feesUsd;
33733
+ }
33734
+ function isValueDestroying(estimate) {
33735
+ const net = routeNetUsd(estimate);
33736
+ if (net == null) return false;
33737
+ const toUsd = parseUsd(estimate?.toAmountUsd) ?? 0;
33738
+ const feesUsd = parseUsd(estimate?.totalFeesUsd) ?? 0;
33739
+ if (toUsd < USD_NOISE_FLOOR && feesUsd < USD_NOISE_FLOOR) return false;
33740
+ return net < 0;
33741
+ }
33742
+ var USD_NOISE_FLOOR;
33743
+ var init_routeValue = __esm({
33744
+ "src/modes/swap/routeValue.ts"() {
33745
+ "use strict";
33746
+ USD_NOISE_FLOOR = 5e-3;
33747
+ }
33748
+ });
33749
+
33614
33750
  // src/modes/swap/hooks/useSwapExecution.ts
33615
33751
  function normalizeTx(raw) {
33616
33752
  const r = raw;
@@ -33622,9 +33758,6 @@ function normalizeTx(raw) {
33622
33758
  toChainTxUrl: r.toChainTxUrl || r.to_chain_tx_url || void 0
33623
33759
  };
33624
33760
  }
33625
- function sleep4(ms) {
33626
- return new Promise((resolve) => setTimeout(resolve, ms));
33627
- }
33628
33761
  function isUserRejection(err) {
33629
33762
  if (!err) return false;
33630
33763
  const e2 = err;
@@ -33633,17 +33766,6 @@ function isUserRejection(err) {
33633
33766
  const msg = (err instanceof Error ? err.message : String(err)).toLowerCase();
33634
33767
  return msg.includes("user rejected") || msg.includes("user denied") || msg.includes("cancelled");
33635
33768
  }
33636
- async function waitForApprovalConfirmation(chainId, txHash) {
33637
- const started = Date.now();
33638
- while (Date.now() - started < 12e4) {
33639
- const status = await getEVMTxStatus({ chainId, txHash });
33640
- if (status.status === "success") return;
33641
- if (status.status === "reverted")
33642
- throw new Error("Approval transaction reverted");
33643
- await sleep4(2e3);
33644
- }
33645
- throw new Error("Timed out waiting for approval confirmation");
33646
- }
33647
33769
  async function requireActiveAddress(wallet, plannedFor) {
33648
33770
  if (!wallet) throw new Error("Wallet not connected. Please reconnect.");
33649
33771
  const active = await wallet.getAddress();
@@ -33807,6 +33929,12 @@ function useSwapExecution(fromChain) {
33807
33929
  onError(msg);
33808
33930
  return;
33809
33931
  }
33932
+ if (isValueDestroying(routeResult.route?.estimate)) {
33933
+ const msg = "This route now costs more in fees than it delivers. Get a new quote.";
33934
+ setState((p) => ({ ...p, txStatus: "error", errorMessage: msg }));
33935
+ onError(msg);
33936
+ return;
33937
+ }
33810
33938
  setState((p) => ({
33811
33939
  ...p,
33812
33940
  isSubmitting: true,
@@ -33948,15 +34076,10 @@ function useSwapExecution(fromChain) {
33948
34076
  throw new Error("Invalid chain ID for token approval");
33949
34077
  }
33950
34078
  const targetChain = Number(required.chainId ?? txReq.chainId);
33951
- if (Number.isFinite(targetChain)) {
33952
- const current = await wallet.getChainId();
33953
- if (current !== targetChain) {
33954
- try {
33955
- await wallet.switchChain(targetChain);
33956
- } catch {
33957
- }
33958
- }
34079
+ if (!Number.isFinite(targetChain)) {
34080
+ throw new Error("Invalid chain ID for token approval");
33959
34081
  }
34082
+ await ensureWalletOnChain(wallet, targetChain);
33960
34083
  const approveAmount = maxApproval ? BigInt(
33961
34084
  "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
33962
34085
  ) : required.amountWei;
@@ -34084,6 +34207,7 @@ var init_useSwapExecution = __esm({
34084
34207
  init_failure();
34085
34208
  init_tx();
34086
34209
  init_sdkRpc();
34210
+ init_routeValue();
34087
34211
  init_chainHelpers();
34088
34212
  FAST_POLL_MS = 1500;
34089
34213
  SLOW_POLL_MS = 2500;
@@ -38020,8 +38144,9 @@ function SwapMode({
38020
38144
  }
38021
38145
  ) });
38022
38146
  }
38023
- const ctaLabel = !hasTokens ? "Get started" : !hasAmount ? "Enter an amount" : insufficient ? `Insufficient ${fromToken?.symbol} balance` : !isConnected ? "Connect Wallet" : needsDestAddress && !isValidDestAddress ? `Enter ${toChain?.networkName ?? "destination"} address` : route.loading ? "Getting quote..." : "Review";
38024
- const ctaDisabled = !hasTokens || !hasAmount || insufficient || isConnected && needsDestAddress && !isValidDestAddress || route.loading;
38147
+ const feesExceedOutput = isValueDestroying(route.data?.route?.estimate);
38148
+ const ctaLabel = !hasTokens ? "Get started" : !hasAmount ? "Enter an amount" : insufficient ? `Insufficient ${fromToken?.symbol} balance` : !isConnected ? "Connect Wallet" : needsDestAddress && !isValidDestAddress ? `Enter ${toChain?.networkName ?? "destination"} address` : route.loading ? "Getting quote..." : feesExceedOutput ? "Fees exceed amount received" : "Review";
38149
+ const ctaDisabled = !hasTokens || !hasAmount || insufficient || isConnected && needsDestAddress && !isValidDestAddress || route.loading || feesExceedOutput;
38025
38150
  const ctaAction = !isConnected ? handleConnectAndReview : () => void handleReview();
38026
38151
  const showRateRow = hasTokens && exchangeRate !== null;
38027
38152
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
@@ -39123,35 +39248,51 @@ function SwapMode({
39123
39248
  ]
39124
39249
  }
39125
39250
  ),
39126
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { style: { padding: `${spacing[2]} ${spacing[3]} 0` }, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
39127
- "button",
39128
- {
39129
- disabled: ctaDisabled,
39130
- onClick: ctaAction,
39131
- style: mergeStyles(
39132
- {
39133
- width: "100%",
39134
- height: "3.5rem",
39135
- borderRadius: "1.5rem",
39136
- fontSize: fontSize.base,
39137
- fontWeight: fontWeight.semibold,
39138
- border: 0,
39139
- transition: "all 0.2s",
39140
- marginBottom: spacing[3]
39251
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { style: { padding: `${spacing[2]} ${spacing[3]} 0` }, children: [
39252
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
39253
+ "button",
39254
+ {
39255
+ disabled: ctaDisabled,
39256
+ onClick: ctaAction,
39257
+ style: mergeStyles(
39258
+ {
39259
+ width: "100%",
39260
+ height: "3.5rem",
39261
+ borderRadius: "1.5rem",
39262
+ fontSize: fontSize.base,
39263
+ fontWeight: fontWeight.semibold,
39264
+ border: 0,
39265
+ transition: "all 0.2s",
39266
+ marginBottom: spacing[3]
39267
+ },
39268
+ !ctaDisabled ? {
39269
+ backgroundColor: colors.primary,
39270
+ color: colors.primaryForeground,
39271
+ cursor: "pointer"
39272
+ } : {
39273
+ backgroundColor: "hsl(var(--tw-muted))",
39274
+ color: colors.mutedForeground,
39275
+ cursor: "default"
39276
+ }
39277
+ ),
39278
+ children: ctaLabel
39279
+ }
39280
+ ),
39281
+ feesExceedOutput && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
39282
+ "div",
39283
+ {
39284
+ style: {
39285
+ marginTop: `-${spacing[2]}`,
39286
+ marginBottom: spacing[3],
39287
+ fontSize: fontSize.xs,
39288
+ lineHeight: 1.4,
39289
+ color: "#f87171",
39290
+ textAlign: "center"
39141
39291
  },
39142
- !ctaDisabled ? {
39143
- backgroundColor: colors.primary,
39144
- color: colors.primaryForeground,
39145
- cursor: "pointer"
39146
- } : {
39147
- backgroundColor: "hsl(var(--tw-muted))",
39148
- color: colors.mutedForeground,
39149
- cursor: "default"
39150
- }
39151
- ),
39152
- children: ctaLabel
39153
- }
39154
- ) }),
39292
+ children: "This route costs more in fees than it delivers. Try a larger amount, or a different token or network."
39293
+ }
39294
+ )
39295
+ ] }),
39155
39296
  showRateRow && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
39156
39297
  "div",
39157
39298
  {
@@ -39998,6 +40139,7 @@ var init_SwapMode = __esm({
39998
40139
  init_provider();
39999
40140
  init_useSwapRoute();
40000
40141
  init_useSwapExecution();
40142
+ init_routeValue();
40001
40143
  init_useForex();
40002
40144
  init_SwapTokenSelect();
40003
40145
  init_currency();