@rash2x/bridge-widget 0.7.6 → 0.7.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.
@@ -2402,7 +2402,7 @@ function calculateMinReceived(quote, slippageBps, dstToken) {
2402
2402
  }
2403
2403
  function getQuoteDetails(quote, srcToken, dstToken, tokens, chains, slippageBps, srcChain, dstChain) {
2404
2404
  const amounts = getQuoteAmounts(quote, srcToken, dstToken);
2405
- const fees = computeFeeBreakdownUsd(quote, srcToken, tokens, chains, srcChain, dstChain);
2405
+ const fees = computeFeeBreakdownUsd(quote, srcToken, dstToken, tokens, chains, srcChain, dstChain);
2406
2406
  const minimumReceived = calculateMinReceived(quote, slippageBps, dstToken);
2407
2407
  return {
2408
2408
  inputAmount: amounts.inputHuman,
@@ -2422,7 +2422,7 @@ function getRouteDisplayName(route) {
2422
2422
  if (routeLower.includes("v2")) return "Stargate V2";
2423
2423
  return route.split(/[/\-_]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
2424
2424
  }
2425
- function computeFeeBreakdownUsd(quote, srcToken, tokens, chains, srcChain, dstChain) {
2425
+ function computeFeeBreakdownUsd(quote, srcToken, dstToken, tokens, chains, srcChain, dstChain) {
2426
2426
  const defaultMsgSymbol = srcChain?.nativeCurrency?.symbol?.toUpperCase() ?? "";
2427
2427
  const defaultBridgeSymbol = srcToken?.symbol?.toUpperCase() ?? "";
2428
2428
  const defaultDstGasSymbol = dstChain?.nativeCurrency?.symbol?.toUpperCase() ?? "";
@@ -2465,7 +2465,7 @@ function computeFeeBreakdownUsd(quote, srcToken, tokens, chains, srcChain, dstCh
2465
2465
  let bridgeFeeUsd = 0;
2466
2466
  const bridgeFeeSymbol = srcToken.symbol?.toUpperCase() ?? "";
2467
2467
  const srcHuman = fromLD(quote.srcAmount, srcToken.decimals);
2468
- const dstHuman = fromLD(quote.dstAmount, srcToken.decimals);
2468
+ const dstHuman = dstToken ? fromLD(quote.dstAmount, dstToken.decimals) : 0;
2469
2469
  const diff = srcHuman - dstHuman;
2470
2470
  if (diff > 0) {
2471
2471
  bridgeFeeAmount = diff;
@@ -3051,7 +3051,12 @@ function useFeeBreakdown() {
3051
3051
  selectedAssetSymbol,
3052
3052
  fromChain?.chainKey
3053
3053
  );
3054
- return computeFeeBreakdownUsd(quote, srcToken, allTokens ?? tokens, chains, fromChain, toChain);
3054
+ const dstToken = resolveTokenOnChainFromMatrix$1(
3055
+ assetMatrix,
3056
+ selectedAssetSymbol,
3057
+ toChain?.chainKey
3058
+ );
3059
+ return computeFeeBreakdownUsd(quote, srcToken, dstToken, allTokens ?? tokens, chains, fromChain, toChain);
3055
3060
  }, [quote, allTokens, tokens, chains, selectedAssetSymbol, assetMatrix, fromChain, toChain]);
3056
3061
  }
3057
3062
  function useBridgeExternalData(options) {
@@ -4109,30 +4114,6 @@ function useSilentValidations(amountString) {
4109
4114
  status,
4110
4115
  error
4111
4116
  ]);
4112
- useEffect(() => {
4113
- if (validationResult.isValidForTransfer) return;
4114
- console.info("[SilentValidations] invalid", {
4115
- amountString,
4116
- hasTooManyDecimals: validationResult.hasTooManyDecimals,
4117
- hasUnsupportedTokenPair: validationResult.hasUnsupportedTokenPair,
4118
- hasInsufficientLiquidity: validationResult.hasInsufficientLiquidity,
4119
- status,
4120
- hasQuote: Boolean(quote),
4121
- error,
4122
- fromChainKey: fromChain?.chainKey,
4123
- toChainKey: toChain?.chainKey,
4124
- selectedAssetSymbol
4125
- });
4126
- }, [
4127
- validationResult,
4128
- amountString,
4129
- status,
4130
- quote,
4131
- error,
4132
- fromChain?.chainKey,
4133
- toChain?.chainKey,
4134
- selectedAssetSymbol
4135
- ]);
4136
4117
  return validationResult;
4137
4118
  }
4138
4119
  function useTelegramRestriction() {
@@ -4259,7 +4240,6 @@ const MainButton = ({
4259
4240
  }
4260
4241
  };
4261
4242
  const disabled = status === "loading" || requiresCustomAddress || !isTelegramRestricted && !missingSrc && !missingDst && (amountNum <= 0 || isBalanceLoading || hasInsufficientBalance || hasAmountTooLarge || !gas.hasEnoughGas || noRoute || !isValidForTransfer);
4262
- console.log(gas);
4263
4243
  return /* @__PURE__ */ jsxs("div", { className: "pt-4 space-y-4", children: [
4264
4244
  isTelegramRestricted && /* @__PURE__ */ jsx(
4265
4245
  Alert,
@@ -26106,7 +26086,7 @@ class WalletConnectModal {
26106
26086
  }
26107
26087
  async initUi() {
26108
26088
  if (typeof window !== "undefined") {
26109
- await import("./index-CDaFAnWU.js");
26089
+ await import("./index-D2IOd6mV.js");
26110
26090
  const modal = document.createElement("wcm-modal");
26111
26091
  document.body.insertAdjacentElement("beforeend", modal);
26112
26092
  OptionsCtrl.setIsUiLoaded(true);
@@ -27010,4 +26990,4 @@ export {
27010
26990
  calculateMinReceived as y,
27011
26991
  getQuoteDetails as z
27012
26992
  };
27013
- //# sourceMappingURL=index-CF3yEUFF.js.map
26993
+ //# sourceMappingURL=index-KQ4SsUup.js.map