@rash2x/bridge-widget 0.8.10 → 0.8.11

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.
@@ -3239,6 +3239,11 @@ function isEvmBalanceDebugEnabled() {
3239
3239
  const flag = window.localStorage.getItem("evaa.debugBalances");
3240
3240
  return flag === "1" || flag === "true";
3241
3241
  }
3242
+ function isRpcTransportError(error) {
3243
+ const message = error instanceof Error ? error.message : String(error ?? "");
3244
+ const normalized = message.toLowerCase();
3245
+ return normalized.includes("err_name_not_resolved") || normalized.includes("dns") || normalized.includes("failed to fetch") || normalized.includes("fetch failed") || normalized.includes("networkerror") || normalized.includes("timeout");
3246
+ }
3242
3247
  async function getEvmBalances(publicClient, address, tokens) {
3243
3248
  const balances = {};
3244
3249
  const debugRows = [];
@@ -3256,7 +3261,7 @@ async function getEvmBalances(publicClient, address, tokens) {
3256
3261
  const chainNative = publicClient.chain?.nativeCurrency;
3257
3262
  const nativeSymbol = chainNative?.symbol ?? "ETH";
3258
3263
  const nativeDecimals = chainNative?.decimals ?? 18;
3259
- const maxAttempts = 2;
3264
+ const maxAttempts = 1;
3260
3265
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
3261
3266
  try {
3262
3267
  const nativeBalance = await publicClient.getBalance({
@@ -3408,6 +3413,12 @@ async function getEvmBalances(publicClient, address, tokens) {
3408
3413
  "Multicall failed, falling back to individual calls:",
3409
3414
  error
3410
3415
  );
3416
+ if (isRpcTransportError(error)) {
3417
+ console.warn(
3418
+ "Skipping per-token fallback because RPC transport is unavailable"
3419
+ );
3420
+ return balances;
3421
+ }
3411
3422
  for (const token of erc20Tokens) {
3412
3423
  try {
3413
3424
  const tokenBalance = await publicClient.readContract({
@@ -3640,6 +3651,7 @@ function useBalances(chainKey, address) {
3640
3651
  enabled: !!address && !!chainKey && !!assetMatrix && tokensOnChain.length > 0 && isAddressValidForChain(chainKey, address),
3641
3652
  staleTime: 6e4,
3642
3653
  gcTime: 5 * 6e4,
3654
+ retry: false,
3643
3655
  refetchOnWindowFocus: false,
3644
3656
  refetchInterval: 6e4,
3645
3657
  refetchIntervalInBackground: false
@@ -26792,7 +26804,7 @@ class WalletConnectModal {
26792
26804
  }
26793
26805
  async initUi() {
26794
26806
  if (typeof window !== "undefined") {
26795
- await import("./index-CPSV-tFm.js");
26807
+ await import("./index-BNr-8fA_.js");
26796
26808
  const modal = document.createElement("wcm-modal");
26797
26809
  document.body.insertAdjacentElement("beforeend", modal);
26798
26810
  OptionsCtrl.setIsUiLoaded(true);
@@ -27716,4 +27728,4 @@ export {
27716
27728
  calculateMinReceived as y,
27717
27729
  getQuoteDetails as z
27718
27730
  };
27719
- //# sourceMappingURL=index-DLlaTmxx.js.map
27731
+ //# sourceMappingURL=index-DnqFAL14.js.map