@talismn/balances 0.0.0-pr2075-20250707143634 → 0.0.0-pr2075-20250707160526

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.
@@ -1717,22 +1717,14 @@ const fetchTokens$8 = async ({
1717
1717
  name,
1718
1718
  decimals,
1719
1719
  symbol
1720
- } = await viem.withRetry(() => getErc20ContractData$1(client, tokenConfig.contractAddress), {
1721
- delay: 1000,
1722
- // should help with rate limiting
1723
- retryCount: 1,
1724
- shouldRetry: err => {
1725
- const msg = err.error.shortMessage;
1726
- return !msg.includes("returned no data") && !msg.includes("is out of bounds") && !msg.includes("reverted");
1727
- }
1728
- });
1729
- cache[tokenId] = {
1720
+ } = await getErc20ContractData$1(client, tokenConfig.contractAddress);
1721
+ cache[tokenId] = TokenCacheSchema$1.parse({
1730
1722
  id: tokenId,
1731
1723
  symbol,
1732
1724
  decimals,
1733
1725
  name,
1734
1726
  isValid: true
1735
- };
1727
+ });
1736
1728
  } catch (err) {
1737
1729
  const msg = err.shortMessage;
1738
1730
  if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) cache[tokenId] = {
@@ -1975,7 +1967,7 @@ const fetchTokens$7 = async ({
1975
1967
  }, tokens[0]);
1976
1968
  const parsed = chaindataProvider.EvmNativeTokenSchema.safeParse(token);
1977
1969
  if (!parsed.success) {
1978
- log.warn("Ignoring token with invalid EvmErc20TokenSchema", token);
1970
+ log.warn("Ignoring token with invalid schema", token);
1979
1971
  return [];
1980
1972
  }
1981
1973
  return [parsed.data];
@@ -2265,7 +2257,7 @@ const fetchTokens$6 = async ({
2265
2257
  symbol: symbol1,
2266
2258
  decimals: decimals1
2267
2259
  } = await getErc20ContractData(client, token1);
2268
- cache[tokenId] = {
2260
+ cache[tokenId] = TokenCacheSchema.parse({
2269
2261
  id: tokenId,
2270
2262
  symbol: `${symbol0}/${symbol1}`,
2271
2263
  decimals,
@@ -2277,7 +2269,7 @@ const fetchTokens$6 = async ({
2277
2269
  symbol0,
2278
2270
  symbol1,
2279
2271
  isValid: true
2280
- };
2272
+ });
2281
2273
  } catch (err) {
2282
2274
  const msg = err.shortMessage;
2283
2275
  if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) {
@@ -2302,7 +2294,7 @@ const fetchTokens$6 = async ({
2302
2294
  const token = lodash.assign(base, cached2?.isValid ? lodash.omit(cached2, ["isValid"]) : {}, tokenConfig);
2303
2295
  const parsed = chaindataProvider.EvmUniswapV2TokenSchema.safeParse(token);
2304
2296
  if (!parsed.success) {
2305
- log.warn("Ignoring token with invalid EvmErc20TokenSchema", token);
2297
+ log.warn("Ignoring token with invalid schema", token);
2306
2298
  continue;
2307
2299
  }
2308
2300
  result.push(parsed.data);
@@ -1717,22 +1717,14 @@ const fetchTokens$8 = async ({
1717
1717
  name,
1718
1718
  decimals,
1719
1719
  symbol
1720
- } = await viem.withRetry(() => getErc20ContractData$1(client, tokenConfig.contractAddress), {
1721
- delay: 1000,
1722
- // should help with rate limiting
1723
- retryCount: 1,
1724
- shouldRetry: err => {
1725
- const msg = err.error.shortMessage;
1726
- return !msg.includes("returned no data") && !msg.includes("is out of bounds") && !msg.includes("reverted");
1727
- }
1728
- });
1729
- cache[tokenId] = {
1720
+ } = await getErc20ContractData$1(client, tokenConfig.contractAddress);
1721
+ cache[tokenId] = TokenCacheSchema$1.parse({
1730
1722
  id: tokenId,
1731
1723
  symbol,
1732
1724
  decimals,
1733
1725
  name,
1734
1726
  isValid: true
1735
- };
1727
+ });
1736
1728
  } catch (err) {
1737
1729
  const msg = err.shortMessage;
1738
1730
  if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) cache[tokenId] = {
@@ -1975,7 +1967,7 @@ const fetchTokens$7 = async ({
1975
1967
  }, tokens[0]);
1976
1968
  const parsed = chaindataProvider.EvmNativeTokenSchema.safeParse(token);
1977
1969
  if (!parsed.success) {
1978
- log.warn("Ignoring token with invalid EvmErc20TokenSchema", token);
1970
+ log.warn("Ignoring token with invalid schema", token);
1979
1971
  return [];
1980
1972
  }
1981
1973
  return [parsed.data];
@@ -2265,7 +2257,7 @@ const fetchTokens$6 = async ({
2265
2257
  symbol: symbol1,
2266
2258
  decimals: decimals1
2267
2259
  } = await getErc20ContractData(client, token1);
2268
- cache[tokenId] = {
2260
+ cache[tokenId] = TokenCacheSchema.parse({
2269
2261
  id: tokenId,
2270
2262
  symbol: `${symbol0}/${symbol1}`,
2271
2263
  decimals,
@@ -2277,7 +2269,7 @@ const fetchTokens$6 = async ({
2277
2269
  symbol0,
2278
2270
  symbol1,
2279
2271
  isValid: true
2280
- };
2272
+ });
2281
2273
  } catch (err) {
2282
2274
  const msg = err.shortMessage;
2283
2275
  if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) {
@@ -2302,7 +2294,7 @@ const fetchTokens$6 = async ({
2302
2294
  const token = lodash.assign(base, cached2?.isValid ? lodash.omit(cached2, ["isValid"]) : {}, tokenConfig);
2303
2295
  const parsed = chaindataProvider.EvmUniswapV2TokenSchema.safeParse(token);
2304
2296
  if (!parsed.success) {
2305
- log.warn("Ignoring token with invalid EvmErc20TokenSchema", token);
2297
+ log.warn("Ignoring token with invalid schema", token);
2306
2298
  continue;
2307
2299
  }
2308
2300
  result.push(parsed.data);
@@ -8,7 +8,7 @@ import BigNumber from 'bignumber.js';
8
8
  import { u8aToHex, assert, stringCamelCase, u8aConcatStrict, u8aToString, hexToNumber, arrayChunk, hexToU8a } from '@polkadot/util';
9
9
  import { xxhashAsU8a } from '@polkadot/util-crypto';
10
10
  import pako from 'pako';
11
- import { parseAbi, erc20Abi, getContract, ContractFunctionExecutionError, hexToString, erc20Abi_bytes32, withRetry, encodeFunctionData, isHex, hexToBigInt } from 'viem';
11
+ import { parseAbi, erc20Abi, getContract, ContractFunctionExecutionError, hexToString, erc20Abi_bytes32, encodeFunctionData, isHex, hexToBigInt, withRetry } from 'viem';
12
12
  import { assign, omit, isEqual, fromPairs, toPairs, keys, keyBy, uniq, values, groupBy as groupBy$1 } from 'lodash';
13
13
  import z from 'zod/v4';
14
14
  import { Observable, distinctUntilChanged, of, timer, switchMap, from, firstValueFrom, scan, share, map, switchAll, combineLatest, mergeMap, toArray, interval, startWith, exhaustMap, BehaviorSubject, debounceTime, takeUntil, withLatestFrom, concatMap } from 'rxjs';
@@ -1704,22 +1704,14 @@ const fetchTokens$8 = async ({
1704
1704
  name,
1705
1705
  decimals,
1706
1706
  symbol
1707
- } = await withRetry(() => getErc20ContractData$1(client, tokenConfig.contractAddress), {
1708
- delay: 1000,
1709
- // should help with rate limiting
1710
- retryCount: 1,
1711
- shouldRetry: err => {
1712
- const msg = err.error.shortMessage;
1713
- return !msg.includes("returned no data") && !msg.includes("is out of bounds") && !msg.includes("reverted");
1714
- }
1715
- });
1716
- cache[tokenId] = {
1707
+ } = await getErc20ContractData$1(client, tokenConfig.contractAddress);
1708
+ cache[tokenId] = TokenCacheSchema$1.parse({
1717
1709
  id: tokenId,
1718
1710
  symbol,
1719
1711
  decimals,
1720
1712
  name,
1721
1713
  isValid: true
1722
- };
1714
+ });
1723
1715
  } catch (err) {
1724
1716
  const msg = err.shortMessage;
1725
1717
  if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) cache[tokenId] = {
@@ -1962,7 +1954,7 @@ const fetchTokens$7 = async ({
1962
1954
  }, tokens[0]);
1963
1955
  const parsed = EvmNativeTokenSchema.safeParse(token);
1964
1956
  if (!parsed.success) {
1965
- log.warn("Ignoring token with invalid EvmErc20TokenSchema", token);
1957
+ log.warn("Ignoring token with invalid schema", token);
1966
1958
  return [];
1967
1959
  }
1968
1960
  return [parsed.data];
@@ -2252,7 +2244,7 @@ const fetchTokens$6 = async ({
2252
2244
  symbol: symbol1,
2253
2245
  decimals: decimals1
2254
2246
  } = await getErc20ContractData(client, token1);
2255
- cache[tokenId] = {
2247
+ cache[tokenId] = TokenCacheSchema.parse({
2256
2248
  id: tokenId,
2257
2249
  symbol: `${symbol0}/${symbol1}`,
2258
2250
  decimals,
@@ -2264,7 +2256,7 @@ const fetchTokens$6 = async ({
2264
2256
  symbol0,
2265
2257
  symbol1,
2266
2258
  isValid: true
2267
- };
2259
+ });
2268
2260
  } catch (err) {
2269
2261
  const msg = err.shortMessage;
2270
2262
  if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) {
@@ -2289,7 +2281,7 @@ const fetchTokens$6 = async ({
2289
2281
  const token = assign(base, cached2?.isValid ? omit(cached2, ["isValid"]) : {}, tokenConfig);
2290
2282
  const parsed = EvmUniswapV2TokenSchema.safeParse(token);
2291
2283
  if (!parsed.success) {
2292
- log.warn("Ignoring token with invalid EvmErc20TokenSchema", token);
2284
+ log.warn("Ignoring token with invalid schema", token);
2293
2285
  continue;
2294
2286
  }
2295
2287
  result.push(parsed.data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/balances",
3
- "version": "0.0.0-pr2075-20250707143634",
3
+ "version": "0.0.0-pr2075-20250707160526",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "GPL-3.0-or-later",
@@ -35,13 +35,13 @@
35
35
  "scale-ts": "^1.6.1",
36
36
  "viem": "^2.27.3",
37
37
  "zod": "^3.25.62",
38
- "@talismn/chain-connector-evm": "0.0.0-pr2075-20250707143634",
39
- "@talismn/chain-connector": "0.0.0-pr2075-20250707143634",
40
- "@talismn/chaindata-provider": "0.0.0-pr2075-20250707143634",
41
- "@talismn/sapi": "0.0.0-pr2075-20250707143634",
42
- "@talismn/scale": "0.0.0-pr2075-20250707143634",
43
- "@talismn/token-rates": "0.0.0-pr2075-20250707143634",
44
- "@talismn/util": "0.0.0-pr2075-20250707143634"
38
+ "@talismn/chain-connector": "0.0.0-pr2075-20250707160526",
39
+ "@talismn/chain-connector-evm": "0.0.0-pr2075-20250707160526",
40
+ "@talismn/sapi": "0.0.0-pr2075-20250707160526",
41
+ "@talismn/scale": "0.0.0-pr2075-20250707160526",
42
+ "@talismn/token-rates": "0.0.0-pr2075-20250707160526",
43
+ "@talismn/util": "0.0.0-pr2075-20250707160526",
44
+ "@talismn/chaindata-provider": "0.0.0-pr2075-20250707160526"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@polkadot/api-contract": "16.1.2",