@talismn/balances 0.0.0-pr2075-20250707100944 → 0.0.0-pr2075-20250707104634
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.
@@ -11,8 +11,8 @@ var utilCrypto = require('@polkadot/util-crypto');
|
|
11
11
|
var pako = require('pako');
|
12
12
|
var viem = require('viem');
|
13
13
|
var lodash = require('lodash');
|
14
|
-
var rxjs = require('rxjs');
|
15
14
|
var z = require('zod/v4');
|
15
|
+
var rxjs = require('rxjs');
|
16
16
|
var isEqual = require('lodash/isEqual');
|
17
17
|
var scale = require('@talismn/scale');
|
18
18
|
var types = require('@polkadot/types');
|
@@ -1684,12 +1684,18 @@ const getTypedContract$1 = (client, abi, contractAddress) => viem.getContract({
|
|
1684
1684
|
}
|
1685
1685
|
});
|
1686
1686
|
|
1687
|
-
const TokenCacheSchema$1 =
|
1688
|
-
id:
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1687
|
+
const TokenCacheSchema$1 = z__default.default.discriminatedUnion("isValid", [z__default.default.strictObject({
|
1688
|
+
id: chaindataProvider.EvmErc20TokenSchema.shape.id,
|
1689
|
+
isValid: z__default.default.literal(true),
|
1690
|
+
...chaindataProvider.EvmErc20TokenSchema.pick({
|
1691
|
+
symbol: true,
|
1692
|
+
decimals: true,
|
1693
|
+
name: true
|
1694
|
+
})
|
1695
|
+
}), z__default.default.strictObject({
|
1696
|
+
id: chaindataProvider.EvmErc20TokenSchema.shape.id,
|
1697
|
+
isValid: z__default.default.literal(false)
|
1698
|
+
})]);
|
1693
1699
|
const fetchTokens$8 = async ({
|
1694
1700
|
networkId,
|
1695
1701
|
tokens,
|
@@ -1699,7 +1705,8 @@ const fetchTokens$8 = async ({
|
|
1699
1705
|
const result = [];
|
1700
1706
|
for (const tokenConfig of tokens) {
|
1701
1707
|
const tokenId = chaindataProvider.evmErc20TokenId(networkId, tokenConfig.contractAddress);
|
1702
|
-
|
1708
|
+
const cached = cache[tokenId] && TokenCacheSchema$1.safeParse(cache[tokenId]).data;
|
1709
|
+
if (cached?.isValid) {
|
1703
1710
|
const client = await connector.getPublicClientForEvmNetwork(networkId);
|
1704
1711
|
if (!client) {
|
1705
1712
|
log.warn(`No client found for network ${networkId} while fetching EVM ERC20 tokens`);
|
@@ -1710,7 +1717,15 @@ const fetchTokens$8 = async ({
|
|
1710
1717
|
name,
|
1711
1718
|
decimals,
|
1712
1719
|
symbol
|
1713
|
-
} = await getErc20ContractData$1(client, tokenConfig.contractAddress)
|
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
|
+
});
|
1714
1729
|
cache[tokenId] = {
|
1715
1730
|
id: tokenId,
|
1716
1731
|
symbol,
|
@@ -1718,7 +1733,11 @@ const fetchTokens$8 = async ({
|
|
1718
1733
|
name
|
1719
1734
|
};
|
1720
1735
|
} catch (err) {
|
1721
|
-
|
1736
|
+
const msg = err.shortMessage;
|
1737
|
+
if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) cache[tokenId] = {
|
1738
|
+
id: tokenId,
|
1739
|
+
isValid: false
|
1740
|
+
};else log.warn(`Failed to fetch ERC20 token data for ${networkId}:${tokenConfig.contractAddress}`, err.shortMessage);
|
1722
1741
|
continue;
|
1723
1742
|
}
|
1724
1743
|
}
|
@@ -2178,18 +2197,38 @@ const getUniswapV2PairContractData = async (client, contractAddress) => {
|
|
2178
2197
|
};
|
2179
2198
|
};
|
2180
2199
|
|
2181
|
-
const TokenCacheSchema =
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2190
|
-
|
2191
|
-
|
2192
|
-
})
|
2200
|
+
// const TokenCacheSchema = EvmUniswapV2TokenSchema.pick({
|
2201
|
+
// id: true,
|
2202
|
+
// symbol: true,
|
2203
|
+
// decimals: true,
|
2204
|
+
// name: true,
|
2205
|
+
// tokenAddress0: true,
|
2206
|
+
// tokenAddress1: true,
|
2207
|
+
// decimals0: true,
|
2208
|
+
// decimals1: true,
|
2209
|
+
// symbol0: true,
|
2210
|
+
// symbol1: true,
|
2211
|
+
// })
|
2212
|
+
|
2213
|
+
const TokenCacheSchema = z__default.default.discriminatedUnion("isValid", [z__default.default.strictObject({
|
2214
|
+
id: chaindataProvider.EvmUniswapV2TokenSchema.shape.id,
|
2215
|
+
isValid: z__default.default.literal(true),
|
2216
|
+
...chaindataProvider.EvmUniswapV2TokenSchema.pick({
|
2217
|
+
id: true,
|
2218
|
+
symbol: true,
|
2219
|
+
decimals: true,
|
2220
|
+
name: true,
|
2221
|
+
tokenAddress0: true,
|
2222
|
+
tokenAddress1: true,
|
2223
|
+
decimals0: true,
|
2224
|
+
decimals1: true,
|
2225
|
+
symbol0: true,
|
2226
|
+
symbol1: true
|
2227
|
+
})
|
2228
|
+
}), z__default.default.strictObject({
|
2229
|
+
id: chaindataProvider.EvmUniswapV2TokenSchema.shape.id,
|
2230
|
+
isValid: z__default.default.literal(false)
|
2231
|
+
})]);
|
2193
2232
|
const fetchTokens$6 = async ({
|
2194
2233
|
networkId,
|
2195
2234
|
tokens,
|
@@ -2199,7 +2238,8 @@ const fetchTokens$6 = async ({
|
|
2199
2238
|
const result = [];
|
2200
2239
|
for (const tokenConfig of tokens) {
|
2201
2240
|
const tokenId = chaindataProvider.evmUniswapV2TokenId(networkId, tokenConfig.contractAddress);
|
2202
|
-
|
2241
|
+
const cached = cache[tokenId] && TokenCacheSchema.safeParse(cache[tokenId]).data;
|
2242
|
+
if (cached?.isValid) {
|
2203
2243
|
const client = await connector.getPublicClientForEvmNetwork(networkId);
|
2204
2244
|
if (!client) {
|
2205
2245
|
log.warn(`No client found for network ${networkId} while fetching EVM ERC20 tokens`);
|
@@ -2233,7 +2273,15 @@ const fetchTokens$6 = async ({
|
|
2233
2273
|
symbol1
|
2234
2274
|
};
|
2235
2275
|
} catch (err) {
|
2236
|
-
|
2276
|
+
const msg = err.shortMessage;
|
2277
|
+
if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) {
|
2278
|
+
cache[tokenId] = {
|
2279
|
+
id: tokenId,
|
2280
|
+
isValid: false
|
2281
|
+
};
|
2282
|
+
} else {
|
2283
|
+
log.warn(`Failed to fetch UniswapV2 token data for ${tokenConfig.contractAddress}`, err.shortMessage);
|
2284
|
+
}
|
2237
2285
|
continue;
|
2238
2286
|
}
|
2239
2287
|
}
|
@@ -11,8 +11,8 @@ var utilCrypto = require('@polkadot/util-crypto');
|
|
11
11
|
var pako = require('pako');
|
12
12
|
var viem = require('viem');
|
13
13
|
var lodash = require('lodash');
|
14
|
-
var rxjs = require('rxjs');
|
15
14
|
var z = require('zod/v4');
|
15
|
+
var rxjs = require('rxjs');
|
16
16
|
var isEqual = require('lodash/isEqual');
|
17
17
|
var scale = require('@talismn/scale');
|
18
18
|
var types = require('@polkadot/types');
|
@@ -1684,12 +1684,18 @@ const getTypedContract$1 = (client, abi, contractAddress) => viem.getContract({
|
|
1684
1684
|
}
|
1685
1685
|
});
|
1686
1686
|
|
1687
|
-
const TokenCacheSchema$1 =
|
1688
|
-
id:
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1687
|
+
const TokenCacheSchema$1 = z__default.default.discriminatedUnion("isValid", [z__default.default.strictObject({
|
1688
|
+
id: chaindataProvider.EvmErc20TokenSchema.shape.id,
|
1689
|
+
isValid: z__default.default.literal(true),
|
1690
|
+
...chaindataProvider.EvmErc20TokenSchema.pick({
|
1691
|
+
symbol: true,
|
1692
|
+
decimals: true,
|
1693
|
+
name: true
|
1694
|
+
})
|
1695
|
+
}), z__default.default.strictObject({
|
1696
|
+
id: chaindataProvider.EvmErc20TokenSchema.shape.id,
|
1697
|
+
isValid: z__default.default.literal(false)
|
1698
|
+
})]);
|
1693
1699
|
const fetchTokens$8 = async ({
|
1694
1700
|
networkId,
|
1695
1701
|
tokens,
|
@@ -1699,7 +1705,8 @@ const fetchTokens$8 = async ({
|
|
1699
1705
|
const result = [];
|
1700
1706
|
for (const tokenConfig of tokens) {
|
1701
1707
|
const tokenId = chaindataProvider.evmErc20TokenId(networkId, tokenConfig.contractAddress);
|
1702
|
-
|
1708
|
+
const cached = cache[tokenId] && TokenCacheSchema$1.safeParse(cache[tokenId]).data;
|
1709
|
+
if (cached?.isValid) {
|
1703
1710
|
const client = await connector.getPublicClientForEvmNetwork(networkId);
|
1704
1711
|
if (!client) {
|
1705
1712
|
log.warn(`No client found for network ${networkId} while fetching EVM ERC20 tokens`);
|
@@ -1710,7 +1717,15 @@ const fetchTokens$8 = async ({
|
|
1710
1717
|
name,
|
1711
1718
|
decimals,
|
1712
1719
|
symbol
|
1713
|
-
} = await getErc20ContractData$1(client, tokenConfig.contractAddress)
|
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
|
+
});
|
1714
1729
|
cache[tokenId] = {
|
1715
1730
|
id: tokenId,
|
1716
1731
|
symbol,
|
@@ -1718,7 +1733,11 @@ const fetchTokens$8 = async ({
|
|
1718
1733
|
name
|
1719
1734
|
};
|
1720
1735
|
} catch (err) {
|
1721
|
-
|
1736
|
+
const msg = err.shortMessage;
|
1737
|
+
if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) cache[tokenId] = {
|
1738
|
+
id: tokenId,
|
1739
|
+
isValid: false
|
1740
|
+
};else log.warn(`Failed to fetch ERC20 token data for ${networkId}:${tokenConfig.contractAddress}`, err.shortMessage);
|
1722
1741
|
continue;
|
1723
1742
|
}
|
1724
1743
|
}
|
@@ -2178,18 +2197,38 @@ const getUniswapV2PairContractData = async (client, contractAddress) => {
|
|
2178
2197
|
};
|
2179
2198
|
};
|
2180
2199
|
|
2181
|
-
const TokenCacheSchema =
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2190
|
-
|
2191
|
-
|
2192
|
-
})
|
2200
|
+
// const TokenCacheSchema = EvmUniswapV2TokenSchema.pick({
|
2201
|
+
// id: true,
|
2202
|
+
// symbol: true,
|
2203
|
+
// decimals: true,
|
2204
|
+
// name: true,
|
2205
|
+
// tokenAddress0: true,
|
2206
|
+
// tokenAddress1: true,
|
2207
|
+
// decimals0: true,
|
2208
|
+
// decimals1: true,
|
2209
|
+
// symbol0: true,
|
2210
|
+
// symbol1: true,
|
2211
|
+
// })
|
2212
|
+
|
2213
|
+
const TokenCacheSchema = z__default.default.discriminatedUnion("isValid", [z__default.default.strictObject({
|
2214
|
+
id: chaindataProvider.EvmUniswapV2TokenSchema.shape.id,
|
2215
|
+
isValid: z__default.default.literal(true),
|
2216
|
+
...chaindataProvider.EvmUniswapV2TokenSchema.pick({
|
2217
|
+
id: true,
|
2218
|
+
symbol: true,
|
2219
|
+
decimals: true,
|
2220
|
+
name: true,
|
2221
|
+
tokenAddress0: true,
|
2222
|
+
tokenAddress1: true,
|
2223
|
+
decimals0: true,
|
2224
|
+
decimals1: true,
|
2225
|
+
symbol0: true,
|
2226
|
+
symbol1: true
|
2227
|
+
})
|
2228
|
+
}), z__default.default.strictObject({
|
2229
|
+
id: chaindataProvider.EvmUniswapV2TokenSchema.shape.id,
|
2230
|
+
isValid: z__default.default.literal(false)
|
2231
|
+
})]);
|
2193
2232
|
const fetchTokens$6 = async ({
|
2194
2233
|
networkId,
|
2195
2234
|
tokens,
|
@@ -2199,7 +2238,8 @@ const fetchTokens$6 = async ({
|
|
2199
2238
|
const result = [];
|
2200
2239
|
for (const tokenConfig of tokens) {
|
2201
2240
|
const tokenId = chaindataProvider.evmUniswapV2TokenId(networkId, tokenConfig.contractAddress);
|
2202
|
-
|
2241
|
+
const cached = cache[tokenId] && TokenCacheSchema.safeParse(cache[tokenId]).data;
|
2242
|
+
if (cached?.isValid) {
|
2203
2243
|
const client = await connector.getPublicClientForEvmNetwork(networkId);
|
2204
2244
|
if (!client) {
|
2205
2245
|
log.warn(`No client found for network ${networkId} while fetching EVM ERC20 tokens`);
|
@@ -2233,7 +2273,15 @@ const fetchTokens$6 = async ({
|
|
2233
2273
|
symbol1
|
2234
2274
|
};
|
2235
2275
|
} catch (err) {
|
2236
|
-
|
2276
|
+
const msg = err.shortMessage;
|
2277
|
+
if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) {
|
2278
|
+
cache[tokenId] = {
|
2279
|
+
id: tokenId,
|
2280
|
+
isValid: false
|
2281
|
+
};
|
2282
|
+
} else {
|
2283
|
+
log.warn(`Failed to fetch UniswapV2 token data for ${tokenConfig.contractAddress}`, err.shortMessage);
|
2284
|
+
}
|
2237
2285
|
continue;
|
2238
2286
|
}
|
2239
2287
|
}
|
@@ -8,10 +8,10 @@ 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, encodeFunctionData, isHex, hexToBigInt
|
11
|
+
import { parseAbi, erc20Abi, getContract, ContractFunctionExecutionError, hexToString, erc20Abi_bytes32, withRetry, encodeFunctionData, isHex, hexToBigInt } from 'viem';
|
12
12
|
import { assign, isEqual, fromPairs, toPairs, keys, keyBy, uniq, values, groupBy as groupBy$1 } from 'lodash';
|
13
|
-
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';
|
14
13
|
import z from 'zod/v4';
|
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';
|
15
15
|
import isEqual$1 from 'lodash/isEqual';
|
16
16
|
import { unifyMetadata, decAnyMetadata, getDynamicBuilder, getLookupFn, decodeScale, parseMetadataRpc, getStorageKeyPrefix, compactMetadata, encodeMetadata, papiParse, papiStringify, toHex, getMetadataVersion, encodeStateKey } from '@talismn/scale';
|
17
17
|
import { Metadata, TypeRegistry } from '@polkadot/types';
|
@@ -1671,12 +1671,18 @@ const getTypedContract$1 = (client, abi, contractAddress) => getContract({
|
|
1671
1671
|
}
|
1672
1672
|
});
|
1673
1673
|
|
1674
|
-
const TokenCacheSchema$1 =
|
1675
|
-
id:
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1674
|
+
const TokenCacheSchema$1 = z.discriminatedUnion("isValid", [z.strictObject({
|
1675
|
+
id: EvmErc20TokenSchema.shape.id,
|
1676
|
+
isValid: z.literal(true),
|
1677
|
+
...EvmErc20TokenSchema.pick({
|
1678
|
+
symbol: true,
|
1679
|
+
decimals: true,
|
1680
|
+
name: true
|
1681
|
+
})
|
1682
|
+
}), z.strictObject({
|
1683
|
+
id: EvmErc20TokenSchema.shape.id,
|
1684
|
+
isValid: z.literal(false)
|
1685
|
+
})]);
|
1680
1686
|
const fetchTokens$8 = async ({
|
1681
1687
|
networkId,
|
1682
1688
|
tokens,
|
@@ -1686,7 +1692,8 @@ const fetchTokens$8 = async ({
|
|
1686
1692
|
const result = [];
|
1687
1693
|
for (const tokenConfig of tokens) {
|
1688
1694
|
const tokenId = evmErc20TokenId(networkId, tokenConfig.contractAddress);
|
1689
|
-
|
1695
|
+
const cached = cache[tokenId] && TokenCacheSchema$1.safeParse(cache[tokenId]).data;
|
1696
|
+
if (cached?.isValid) {
|
1690
1697
|
const client = await connector.getPublicClientForEvmNetwork(networkId);
|
1691
1698
|
if (!client) {
|
1692
1699
|
log.warn(`No client found for network ${networkId} while fetching EVM ERC20 tokens`);
|
@@ -1697,7 +1704,15 @@ const fetchTokens$8 = async ({
|
|
1697
1704
|
name,
|
1698
1705
|
decimals,
|
1699
1706
|
symbol
|
1700
|
-
} = await getErc20ContractData$1(client, tokenConfig.contractAddress)
|
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
|
+
});
|
1701
1716
|
cache[tokenId] = {
|
1702
1717
|
id: tokenId,
|
1703
1718
|
symbol,
|
@@ -1705,7 +1720,11 @@ const fetchTokens$8 = async ({
|
|
1705
1720
|
name
|
1706
1721
|
};
|
1707
1722
|
} catch (err) {
|
1708
|
-
|
1723
|
+
const msg = err.shortMessage;
|
1724
|
+
if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) cache[tokenId] = {
|
1725
|
+
id: tokenId,
|
1726
|
+
isValid: false
|
1727
|
+
};else log.warn(`Failed to fetch ERC20 token data for ${networkId}:${tokenConfig.contractAddress}`, err.shortMessage);
|
1709
1728
|
continue;
|
1710
1729
|
}
|
1711
1730
|
}
|
@@ -2165,18 +2184,38 @@ const getUniswapV2PairContractData = async (client, contractAddress) => {
|
|
2165
2184
|
};
|
2166
2185
|
};
|
2167
2186
|
|
2168
|
-
const TokenCacheSchema = EvmUniswapV2TokenSchema.pick({
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
})
|
2187
|
+
// const TokenCacheSchema = EvmUniswapV2TokenSchema.pick({
|
2188
|
+
// id: true,
|
2189
|
+
// symbol: true,
|
2190
|
+
// decimals: true,
|
2191
|
+
// name: true,
|
2192
|
+
// tokenAddress0: true,
|
2193
|
+
// tokenAddress1: true,
|
2194
|
+
// decimals0: true,
|
2195
|
+
// decimals1: true,
|
2196
|
+
// symbol0: true,
|
2197
|
+
// symbol1: true,
|
2198
|
+
// })
|
2199
|
+
|
2200
|
+
const TokenCacheSchema = z.discriminatedUnion("isValid", [z.strictObject({
|
2201
|
+
id: EvmUniswapV2TokenSchema.shape.id,
|
2202
|
+
isValid: z.literal(true),
|
2203
|
+
...EvmUniswapV2TokenSchema.pick({
|
2204
|
+
id: true,
|
2205
|
+
symbol: true,
|
2206
|
+
decimals: true,
|
2207
|
+
name: true,
|
2208
|
+
tokenAddress0: true,
|
2209
|
+
tokenAddress1: true,
|
2210
|
+
decimals0: true,
|
2211
|
+
decimals1: true,
|
2212
|
+
symbol0: true,
|
2213
|
+
symbol1: true
|
2214
|
+
})
|
2215
|
+
}), z.strictObject({
|
2216
|
+
id: EvmUniswapV2TokenSchema.shape.id,
|
2217
|
+
isValid: z.literal(false)
|
2218
|
+
})]);
|
2180
2219
|
const fetchTokens$6 = async ({
|
2181
2220
|
networkId,
|
2182
2221
|
tokens,
|
@@ -2186,7 +2225,8 @@ const fetchTokens$6 = async ({
|
|
2186
2225
|
const result = [];
|
2187
2226
|
for (const tokenConfig of tokens) {
|
2188
2227
|
const tokenId = evmUniswapV2TokenId(networkId, tokenConfig.contractAddress);
|
2189
|
-
|
2228
|
+
const cached = cache[tokenId] && TokenCacheSchema.safeParse(cache[tokenId]).data;
|
2229
|
+
if (cached?.isValid) {
|
2190
2230
|
const client = await connector.getPublicClientForEvmNetwork(networkId);
|
2191
2231
|
if (!client) {
|
2192
2232
|
log.warn(`No client found for network ${networkId} while fetching EVM ERC20 tokens`);
|
@@ -2220,7 +2260,15 @@ const fetchTokens$6 = async ({
|
|
2220
2260
|
symbol1
|
2221
2261
|
};
|
2222
2262
|
} catch (err) {
|
2223
|
-
|
2263
|
+
const msg = err.shortMessage;
|
2264
|
+
if (msg.includes("returned no data") || msg.includes("is out of bounds") || msg.includes("reverted")) {
|
2265
|
+
cache[tokenId] = {
|
2266
|
+
id: tokenId,
|
2267
|
+
isValid: false
|
2268
|
+
};
|
2269
|
+
} else {
|
2270
|
+
log.warn(`Failed to fetch UniswapV2 token data for ${tokenConfig.contractAddress}`, err.shortMessage);
|
2271
|
+
}
|
2224
2272
|
continue;
|
2225
2273
|
}
|
2226
2274
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@talismn/balances",
|
3
|
-
"version": "0.0.0-pr2075-
|
3
|
+
"version": "0.0.0-pr2075-20250707104634",
|
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": "0.0.0-pr2075-
|
39
|
-
"@talismn/
|
40
|
-
"@talismn/
|
41
|
-
"@talismn/
|
42
|
-
"@talismn/
|
43
|
-
"@talismn/
|
44
|
-
"@talismn/
|
38
|
+
"@talismn/chain-connector-evm": "0.0.0-pr2075-20250707104634",
|
39
|
+
"@talismn/chain-connector": "0.0.0-pr2075-20250707104634",
|
40
|
+
"@talismn/chaindata-provider": "0.0.0-pr2075-20250707104634",
|
41
|
+
"@talismn/sapi": "0.0.0-pr2075-20250707104634",
|
42
|
+
"@talismn/scale": "0.0.0-pr2075-20250707104634",
|
43
|
+
"@talismn/token-rates": "0.0.0-pr2075-20250707104634",
|
44
|
+
"@talismn/util": "0.0.0-pr2075-20250707104634"
|
45
45
|
},
|
46
46
|
"devDependencies": {
|
47
47
|
"@polkadot/api-contract": "16.1.2",
|