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