@rash2x/bridge-widget 0.8.3 → 0.8.4

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.
@@ -2462,6 +2462,7 @@ function computeFeeBreakdownUsd(quote, srcToken, dstToken, tokens, chains, srcCh
2462
2462
  let messageFeeUsd = 0;
2463
2463
  let messageFeeAmount = 0;
2464
2464
  let messageFeeSymbol = "";
2465
+ let messageFeeTokenPriceUsd = 0;
2465
2466
  const messageFees = quote.fees.filter((f4) => f4.type === "message");
2466
2467
  for (const f4 of messageFees) {
2467
2468
  const { decimals, priceUsd } = lookupTokenMeta(
@@ -2479,6 +2480,7 @@ function computeFeeBreakdownUsd(quote, srcToken, dstToken, tokens, chains, srcCh
2479
2480
  (t2) => t2.chainKey === f4.chainKey && t2.address.toLowerCase() === f4.token.toLowerCase()
2480
2481
  );
2481
2482
  messageFeeSymbol = token?.symbol?.toUpperCase() ?? chain2?.nativeCurrency?.symbol?.toUpperCase() ?? "";
2483
+ messageFeeTokenPriceUsd = priceUsd ?? 0;
2482
2484
  }
2483
2485
  }
2484
2486
  let bridgeFeeAmount = 0;
@@ -2509,7 +2511,14 @@ function computeFeeBreakdownUsd(quote, srcToken, dstToken, tokens, chains, srcCh
2509
2511
  dstGasUsd = dstGasAmount * (priceUsd ?? 0);
2510
2512
  }
2511
2513
  }
2512
- const totalFeeUsd = messageFeeUsd + bridgeFeeUsd + dstGasUsd;
2514
+ if (dstGasAmount > 0 && messageFeeSymbol) {
2515
+ if (messageFeeSymbol === dstGasSymbol) {
2516
+ messageFeeAmount += dstGasAmount;
2517
+ } else if (messageFeeTokenPriceUsd > 0) {
2518
+ messageFeeAmount += dstGasUsd / messageFeeTokenPriceUsd;
2519
+ }
2520
+ }
2521
+ const totalFeeUsd = messageFeeUsd + bridgeFeeUsd;
2513
2522
  return {
2514
2523
  messageFeeAmount,
2515
2524
  messageFeeSymbol,
@@ -26553,7 +26562,7 @@ class WalletConnectModal {
26553
26562
  }
26554
26563
  async initUi() {
26555
26564
  if (typeof window !== "undefined") {
26556
- await Promise.resolve().then(() => require("./index-s4FyGXJW.cjs"));
26565
+ await Promise.resolve().then(() => require("./index-BdfMMh_j.cjs"));
26557
26566
  const modal = document.createElement("wcm-modal");
26558
26567
  document.body.insertAdjacentElement("beforeend", modal);
26559
26568
  OptionsCtrl.setIsUiLoaded(true);
@@ -27456,4 +27465,4 @@ exports.useSettingsStore = useSettingsStore;
27456
27465
  exports.useSwapModel = useSwapModel;
27457
27466
  exports.useTokensStore = useTokensStore;
27458
27467
  exports.useTransactionStore = useTransactionStore;
27459
- //# sourceMappingURL=index-egFmHlPu.cjs.map
27468
+ //# sourceMappingURL=index-BDGHvxEQ.cjs.map