@0xsquid/react-hooks 8.8.1-beta-canton.3 → 8.8.1-beta-canton.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.
@@ -23375,7 +23375,7 @@ const filterViewableTokens = (tokens, config, direction) => {
23375
23375
  };
23376
23376
  const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
23377
23377
  const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
23378
- const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-BaRVTuK5.js'); });
23378
+ const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-DWq78rM5.js'); });
23379
23379
  return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
23380
23380
  };
23381
23381
  function getTokenAssetsKey(token) {
@@ -23402,9 +23402,29 @@ async function fetchAssetsColors() {
23402
23402
  };
23403
23403
  }
23404
23404
  }
23405
- function initializeSquidWithAssetsColors(squid, assetsColors) {
23406
- const evmosChainIds = squid.chains.filter(isEvmosChain).map((c) => c.chainId);
23407
- squid.tokens = squid.tokens.map((token) => {
23405
+ const supportedChainTypes = new Set(Object.values(squidTypes.ChainType));
23406
+ function isSupportedChainType(chainType) {
23407
+ return supportedChainTypes.has(chainType);
23408
+ }
23409
+ /**
23410
+ * Normalizes SDK data after each init/refetch before the rest of hooks consumes it.
23411
+ *
23412
+ * - Removes chains whose chainType is not supported by the local package.
23413
+ * - Drops tokens for those removed chains.
23414
+ * - Converts Evmos chains/tokens to EVM.
23415
+ * - Applies optional asset colors.
23416
+ */
23417
+ function initializeSquidData(squid, assetsColors = {
23418
+ chains: {},
23419
+ tokens: {},
23420
+ }) {
23421
+ const supportedChains = squid.chains.filter((chain) => isSupportedChainType(chain.chainType));
23422
+ const supportedChainIds = new Set(supportedChains.map((chain) => chain.chainId));
23423
+ const evmosChainIds = supportedChains
23424
+ .filter(isEvmosChain)
23425
+ .map((c) => c.chainId);
23426
+ const supportedTokens = squid.tokens.filter((token) => supportedChainIds.has(token.chainId));
23427
+ squid.tokens = supportedTokens.map((token) => {
23408
23428
  const isEvmosToken = evmosChainIds.includes(token.chainId);
23409
23429
  return {
23410
23430
  ...token,
@@ -23413,7 +23433,7 @@ function initializeSquidWithAssetsColors(squid, assetsColors) {
23413
23433
  textColor: assetsColors.tokens[getTokenAssetsKey(token)]?.textColor,
23414
23434
  };
23415
23435
  });
23416
- squid.chains = squid.chains.map((chain) => {
23436
+ squid.chains = supportedChains.map((chain) => {
23417
23437
  const bgColor = assetsColors.chains[chain.chainId]?.bgColor;
23418
23438
  // convert evmos cosmos chains to evm chains
23419
23439
  // TODO: this will be fixed in the backend
@@ -25290,7 +25310,7 @@ const useSquid = () => {
25290
25310
  queryFn: async () => {
25291
25311
  if (squid) {
25292
25312
  await squid?.init();
25293
- initializeSquidWithAssetsColors(squid, assetsColors);
25313
+ initializeSquidData(squid, assetsColors);
25294
25314
  return squid;
25295
25315
  }
25296
25316
  return null;
@@ -26784,7 +26804,7 @@ function useStellarWallets() {
26784
26804
  try {
26785
26805
  const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
26786
26806
  const { LedgerModule } = await import('@creit.tech/stellar-wallets-kit/modules/ledger.module.mjs');
26787
- const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-SFl8OhRJ.js'); });
26807
+ const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-DBROJ4yf.js'); });
26788
26808
  const modules = [...initializeAllModules(), new LedgerModule()];
26789
26809
  const promises = modules.map(async (module) => {
26790
26810
  const isAvailable = await module.isAvailable();
@@ -30134,7 +30154,7 @@ function hederaWalletConnect(parameters) {
30134
30154
  const optionalChains = config.chains.map((x) => x.id);
30135
30155
  if (!optionalChains.length)
30136
30156
  return;
30137
- const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-C7vw_7iQ.js'); });
30157
+ const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-3JPbTFKq.js'); });
30138
30158
  const rawProvider = await EthereumProvider.init({
30139
30159
  ...restParameters,
30140
30160
  disableProviderPing: true,
@@ -37574,8 +37594,10 @@ const SquidProvider = ({ children, config, placeholder, }) => {
37574
37594
  }
37575
37595
  if (assetsColorsResponse.status === "fulfilled") {
37576
37596
  useAssetsColorsStore.setState(assetsColorsResponse.value);
37577
- initializeSquidWithAssetsColors(squid, assetsColorsResponse.value);
37578
37597
  }
37598
+ initializeSquidData(squid, assetsColorsResponse.status === "fulfilled"
37599
+ ? assetsColorsResponse.value
37600
+ : undefined);
37579
37601
  const shouldResetSwapRouteStore =
37580
37602
  // reset swap route if specified in config
37581
37603
  !config?.loadPreviousStateFromLocalStorage ||
@@ -37764,7 +37786,7 @@ exports.getXummClient = getXummClient;
37764
37786
  exports.groupTokensByChainId = groupTokensByChainId;
37765
37787
  exports.groupTokensBySymbol = groupTokensBySymbol;
37766
37788
  exports.handleTransactionErrorEvents = handleTransactionErrorEvents;
37767
- exports.initializeSquidWithAssetsColors = initializeSquidWithAssetsColors;
37789
+ exports.initializeSquidData = initializeSquidData;
37768
37790
  exports.is404Error = is404Error;
37769
37791
  exports.isActionCompletedOnSourceTx = isActionCompletedOnSourceTx;
37770
37792
  exports.isChainflipBridgeTransaction = isChainflipBridgeTransaction;
@@ -37787,6 +37809,7 @@ exports.isStatusError = isStatusError;
37787
37809
  exports.isStellarAddressValid = isStellarAddressValid;
37788
37810
  exports.isStellarIssuedToken = isStellarIssuedToken;
37789
37811
  exports.isStellarToken = isStellarToken;
37812
+ exports.isSupportedChainType = isSupportedChainType;
37790
37813
  exports.isSwapRouteError = isSwapRouteError;
37791
37814
  exports.isUserRejectionError = isUserRejectionError;
37792
37815
  exports.isValidHorizonAsset = isValidHorizonAsset;
@@ -37918,4 +37941,4 @@ exports.useXrplTrustLine = useXrplTrustLine;
37918
37941
  exports.waitForReceiptWithRetry = waitForReceiptWithRetry;
37919
37942
  exports.walletIconBaseUrl = walletIconBaseUrl;
37920
37943
  exports.walletSupportsChainType = walletSupportsChainType;
37921
- //# sourceMappingURL=index-BXuWPj5X.js.map
37944
+ //# sourceMappingURL=index-mgE1SeE-.js.map