@talismn/balances 0.0.0-pr2043-20250628151732 → 0.0.0-pr2043-20250629051139

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.
@@ -1,6 +1,6 @@
1
1
  import { ChainConnector } from "@talismn/chain-connector";
2
2
  import { DotNetworkId } from "@talismn/chaindata-provider";
3
3
  /**
4
- * fetches the spec version of a network. current request is cached in case of multiple calls (all balance subs kick in at once)
4
+ * fetches the spec version of a network. current request is cached in case of multiple calls (all balance modules will kick in at once)
5
5
  */
6
6
  export declare const getSpecVersion: (chainConnector: ChainConnector, networkId: DotNetworkId) => Promise<number>;
@@ -1,5 +1,4 @@
1
1
  export * from "./BalanceModule";
2
- export * from "./EvmTokenFetcher";
3
2
  export * from "./TalismanBalancesDatabase";
4
3
  export * from "./modules";
5
4
  export * from "./types";
@@ -1,4 +1,4 @@
1
- import { CustomEvmNativeToken, EvmNativeToken } from "@talismn/chaindata-provider";
1
+ import { EvmNativeToken } from "@talismn/chaindata-provider";
2
2
  import z from "zod/v4";
3
3
  import { DefaultChainMeta, DefaultModuleConfig, NewBalanceModule } from "../BalanceModule";
4
4
  import { NewBalanceType } from "../types";
@@ -23,5 +23,5 @@ declare module "@talismn/balances/plugins" {
23
23
  "evm-native": EvmNativeBalance;
24
24
  }
25
25
  }
26
- export declare const EvmNativeModule: NewBalanceModule<ModuleType, EvmNativeToken | CustomEvmNativeToken, EvmNativeChainMeta, EvmNativeModuleConfig, EvmNativeTokenConfig>;
26
+ export declare const EvmNativeModule: NewBalanceModule<ModuleType, EvmNativeToken, EvmNativeChainMeta, EvmNativeModuleConfig, EvmNativeTokenConfig>;
27
27
  export {};
@@ -1,4 +1,4 @@
1
- import { CustomSubNativeToken, SubNativeToken } from "@talismn/chaindata-provider";
1
+ import { SubNativeToken } from "@talismn/chaindata-provider";
2
2
  import z from "zod/v4";
3
3
  import { NewBalanceModule } from "../../BalanceModule";
4
4
  import { ModuleType, SubNativeChainMeta, SubNativeModuleConfig, SubNativeTransferParams } from "./types";
@@ -18,4 +18,4 @@ export declare const SubNativeTokenConfigSchema: z.ZodObject<{
18
18
  mirrorOf: z.ZodOptional<z.ZodOptional<z.ZodString>>;
19
19
  }, z.core.$strict>;
20
20
  export type SubNativeTokenConfig = z.infer<typeof SubNativeTokenConfigSchema>;
21
- export declare const SubNativeModule: NewBalanceModule<ModuleType, SubNativeToken | CustomSubNativeToken, SubNativeChainMeta, SubNativeModuleConfig, SubNativeTokenConfig, SubNativeTransferParams>;
21
+ export declare const SubNativeModule: NewBalanceModule<ModuleType, SubNativeToken, SubNativeChainMeta, SubNativeModuleConfig, SubNativeTokenConfig, SubNativeTransferParams>;
@@ -11,7 +11,6 @@ export type SubNativeChainMeta = ChainMeta<{
11
11
  useLegacyTransferableCalculation?: boolean;
12
12
  existentialDeposit?: string;
13
13
  nominationPoolsPalletId?: string;
14
- crowdloanPalletId?: string;
15
14
  hasSubtensorPallet?: boolean;
16
15
  } | null>;
17
16
  export type SubNativeModuleConfig = SubNativeBalancesConfig;
@@ -1 +1 @@
1
- export declare const sortChainsNativeTokensByPriority: (a: string, b: string) => 0 | 1 | -1;
1
+ export declare const sortChainsNativeTokensByPriority: (a: string, b: string) => 1 | 0 | -1;
@@ -1,21 +1,4 @@
1
1
  import { ChainConnector } from "@talismn/chain-connector";
2
- import z from "zod/v4";
3
- export declare const DotNetworkProperties: z.ZodPipe<z.ZodUnion<readonly [z.ZodObject<{
4
- tokenDecimals: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
5
- tokenSymbol: z.ZodDefault<z.ZodOptional<z.ZodString>>;
6
- }, z.core.$strip>, z.ZodObject<{
7
- tokenDecimals: z.ZodArray<z.ZodNumber>;
8
- tokenSymbol: z.ZodArray<z.ZodString>;
9
- }, z.core.$strip>]>, z.ZodTransform<{
10
- tokenDecimals: number;
11
- tokenSymbol: string;
12
- }, {
13
- tokenDecimals: number;
14
- tokenSymbol: string;
15
- } | {
16
- tokenDecimals: number[];
17
- tokenSymbol: string[];
18
- }>>;
19
2
  export declare const getChainProperties: (chainConnector: ChainConnector, networkId: string) => Promise<{
20
3
  tokenDecimals: number;
21
4
  tokenSymbol: string;
@@ -37,20 +37,6 @@ export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-
37
37
  coingeckoId?: string | undefined;
38
38
  noDiscovery?: boolean | undefined;
39
39
  mirrorOf?: string | undefined;
40
- } | {
41
- id: string;
42
- networkId: string;
43
- decimals: number;
44
- symbol: string;
45
- type: "evm-native";
46
- platform: "ethereum";
47
- isCustom: true;
48
- isDefault?: boolean | undefined;
49
- name?: string | undefined;
50
- logo?: string | undefined;
51
- coingeckoId?: string | undefined;
52
- noDiscovery?: boolean | undefined;
53
- mirrorOf?: string | undefined;
54
40
  }, import("..").DefaultChainMeta, undefined, {
55
41
  symbol?: string | undefined;
56
42
  networkId?: string | undefined;
@@ -171,21 +157,6 @@ export declare const defaultBalanceModules: (import("..").NewBalanceModule<"evm-
171
157
  coingeckoId?: string | undefined;
172
158
  noDiscovery?: boolean | undefined;
173
159
  mirrorOf?: string | undefined;
174
- } | {
175
- id: string;
176
- networkId: string;
177
- decimals: number;
178
- symbol: string;
179
- type: "substrate-native";
180
- platform: "polkadot";
181
- existentialDeposit: string;
182
- isCustom: true;
183
- isDefault?: boolean | undefined;
184
- name?: string | undefined;
185
- logo?: string | undefined;
186
- coingeckoId?: string | undefined;
187
- noDiscovery?: boolean | undefined;
188
- mirrorOf?: string | undefined;
189
160
  }, import("./SubstrateNativeModule").SubNativeChainMeta, {
190
161
  disable?: boolean | undefined;
191
162
  }, {
@@ -1,5 +1,5 @@
1
- import { ChainId, TokenList } from "@talismn/chaindata-provider";
1
+ import { NetworkId, TokenList } from "@talismn/chaindata-provider";
2
2
  import { AddressesByToken } from "../../types";
3
3
  export declare const getUniqueChainIds: (addressesByToken: AddressesByToken<{
4
4
  id: string;
5
- }>, tokens: TokenList) => ChainId[];
5
+ }>, tokens: TokenList) => NetworkId[];
@@ -380,7 +380,6 @@ export declare class Balance {
380
380
  /** The frozen balance of this token. Is included in the free amount. */
381
381
  get locked(): BalanceFormatter;
382
382
  get locks(): FormattedAmount<AmountWithLabel<string>, string>[];
383
- get crowdloans(): FormattedAmount<AmountWithLabel<string>, string>[];
384
383
  get nompools(): FormattedAmount<AmountWithLabel<string>, string>[];
385
384
  get subtensor(): FormattedAmount<AmountWithLabel<string>, string>[];
386
385
  /** The extra balance of this token */
@@ -52,14 +52,14 @@ export type EvmBalance = IBalanceBase & (IBalanceSimpleValues | IBalanceComplexV
52
52
  export type SubstrateBalance = IBalanceBase & (IBalanceSimpleValues | IBalanceComplexValues);
53
53
  /** An unlabelled amount of a balance */
54
54
  export type Amount = string;
55
- export type BalanceStatusTypes = "free" | "reserved" | "locked" | "extra" | "crowdloan" | "nompool" | "subtensor";
55
+ export type BalanceStatusTypes = "free" | "reserved" | "locked" | "extra" | "nompool" | "subtensor";
56
56
  /** A labelled amount of a balance */
57
57
  type BaseAmountWithLabel<TLabel extends string> = {
58
58
  type: BalanceStatusTypes;
59
59
  /**
60
60
  * For modules which fetch balances via module sources, the source is equivalent to previous 'subSource' field
61
61
  * on the parent balance object
62
- * e.g. `staking` or `crowdloans`
62
+ * e.g. `staking`
63
63
  **/
64
64
  source?: string;
65
65
  label: TLabel;
@@ -40,8 +40,6 @@ var PQueue__default = /*#__PURE__*/_interopDefault(PQueue);
40
40
  var groupBy__default = /*#__PURE__*/_interopDefault(groupBy);
41
41
  var upperFirst__default = /*#__PURE__*/_interopDefault(upperFirst);
42
42
 
43
- // Record<string, unknown> | undefined
44
-
45
43
  // TODO: Document default balances module purpose/usage
46
44
  const DefaultBalanceModule = type => ({
47
45
  get type() {
@@ -75,58 +73,9 @@ const DefaultBalanceModule = type => ({
75
73
  // internal
76
74
  //
77
75
 
78
- // TODO yeet ?
79
- // there is no need to construct a lit of tokens, it's done by∏ chaindata
80
-
81
- /**
82
- * Fetches tokens for EVM networks.
83
- * @deprecated
84
- */
85
- class EvmTokenFetcher {
86
- #chaindataProvider;
87
- #balanceModules;
88
- constructor(chaindataProvider, balanceModules) {
89
- this.#chaindataProvider = chaindataProvider;
90
- this.#balanceModules = balanceModules;
91
- }
92
- async update(_evmNetworkIds) {
93
- // chaindataProvider's tokens should be in sync already
94
- // await this.updateEvmNetworks(evmNetworkIds)
95
- }
96
-
97
- // private async updateEvmNetworks(evmNetworkIds: EvmNetworkId[]) {
98
- // // feels unnecessary, chaindataProvider's tokens should be in sync already
99
- // // const evmNetworks = new Map(
100
- // // (await this.#chaindataProvider.evmNetworks()).map((evmNetwork) => [
101
- // // evmNetwork.id,
102
- // // evmNetwork,
103
- // // ]),
104
- // // )
105
- // // const allEvmTokens: TokenList = {}
106
- // // const evmNetworkConcurrency = 10
107
- // // await PromisePool.withConcurrency(evmNetworkConcurrency)
108
- // // .for(evmNetworkIds)
109
- // // .process(async (evmNetworkId) => {
110
- // // const evmNetwork = evmNetworks.get(evmNetworkId)
111
- // // if (!evmNetwork) return
112
- // // for (const mod of this.#balanceModules.filter((m) => m.type.startsWith("evm-"))) {
113
- // // // const balancesConfig = (evmNetwork.balancesConfig ?? []).find(
114
- // // // ({ moduleType }) => moduleType === mod.type,
115
- // // // )
116
- // // // const moduleConfig = balancesConfig?.moduleConfig ?? {}
117
- // // // chainMeta arg only needs the isTestnet property, let's save a db roundtrip for now
118
- // // const isTestnet = evmNetwork.isTestnet ?? false
119
- // // const tokens = await mod.fetchEvmChainTokens(evmNetworkId, { isTestnet }, moduleConfig)
120
- // // for (const [tokenId, token] of Object.entries(tokens)) allEvmTokens[tokenId] = token
121
- // // }
122
- // // })
123
- // // await this.#chaindataProvider.updateEvmNetworkTokens(Object.values(allEvmTokens))
124
- // }
125
- }
126
-
127
76
  var pkg = {
128
77
  name: "@talismn/balances",
129
- version: "0.0.0-pr2043-20250628151732"};
78
+ version: "0.0.0-pr2043-20250629051139"};
130
79
 
131
80
  var log = anylogger__default.default(pkg.name);
132
81
 
@@ -430,7 +379,6 @@ class Balance {
430
379
  // This means that those rates are always available for calculating the uniswapv2 rates,
431
380
  // regardless of whether or not the underlying erc20s are actually in chaindata and enabled.
432
381
  if (this.isSource("evm-uniswapv2") && this.token?.type === "evm-uniswapv2" // &&
433
- //this.evmNetworkId
434
382
  ) {
435
383
  const tokenId0 = chaindataProvider.evmErc20TokenId(this.networkId, this.token.tokenAddress0);
436
384
  const tokenId1 = chaindataProvider.evmErc20TokenId(this.networkId, this.token.tokenAddress1);
@@ -512,9 +460,7 @@ class Balance {
512
460
  const nomPoolStakedPlancks = this.locks.some(lock => lock.source === "substrate-native-holds" && lock.label === "DelegatedStaking") ? 0n : this.nompools.map(({
513
461
  amount
514
462
  }) => amount.planck).reduce((a, b) => a + b, 0n);
515
- return this.#format(this.free.planck + this.reserved.planck + nomPoolStakedPlancks + this.crowdloans.map(({
516
- amount
517
- }) => amount.planck).reduce((a, b) => a + b, 0n) + this.subtensor.map(({
463
+ return this.#format(this.free.planck + this.reserved.planck + nomPoolStakedPlancks + this.subtensor.map(({
518
464
  amount
519
465
  }) => amount.planck).reduce((a, b) => a + b, 0n) + includeInTotalExtraAmount(extra));
520
466
  }
@@ -550,9 +496,6 @@ class Balance {
550
496
  get locks() {
551
497
  return this.getValue("locked");
552
498
  }
553
- get crowdloans() {
554
- return this.getValue("crowdloan");
555
- }
556
499
  get nompools() {
557
500
  return this.getValue("nompool");
558
501
  }
@@ -631,7 +574,7 @@ class Balance {
631
574
  const nomPoolStakedPlancks = this.locks.some(lock => lock.source === "substrate-native-holds" && lock.label === "DelegatedStaking") ? 0n : this.nompools.map(({
632
575
  amount
633
576
  }) => amount.planck).reduce((a, b) => a + b, 0n);
634
- const otherUnavailable = nomPoolStakedPlancks + this.crowdloans.reduce((total, each) => total + each.amount.planck, 0n) + this.subtensor.reduce((total, each) => total + each.amount.planck, 0n);
577
+ const otherUnavailable = nomPoolStakedPlancks + this.subtensor.reduce((total, each) => total + each.amount.planck, 0n);
635
578
  return this.#format(baseUnavailable + otherUnavailable);
636
579
  }
637
580
 
@@ -886,21 +829,8 @@ const filterMirrorTokens = (balance, i, balances) => {
886
829
 
887
830
  /** A collection of `BalanceJson` objects */
888
831
 
889
- // type IBalanceBaseEvm = {
890
- // /** WIP, use `chainId` or `evmNetworkId` for now */
891
- // multiChainId: EvmChainId
892
-
893
- // }
894
-
895
- // type IBalanceBaseSubstrate = {
896
- // multiChainId: SubChainId
897
-
898
- // }
899
-
900
832
  /** `IBalance` is a common interface which all balance types must implement. */
901
833
 
902
- // & (IBalanceBaseEvm | IBalanceBaseSubstrate)
903
-
904
834
  /** An unlabelled amount of a balance */
905
835
 
906
836
  /** A labelled amount of a balance */
@@ -909,7 +839,6 @@ const getValueId = amount => {
909
839
  const getMetaId = () => {
910
840
  const meta = amount.meta;
911
841
  if (!meta) return "";
912
- if (amount.type === "crowdloan") return meta.paraId?.toString() ?? "";
913
842
  if (amount.type === "nompool") return meta.poolId?.toString() ?? "";
914
843
  if (amount.type === "subtensor") {
915
844
  const {
@@ -1315,8 +1244,6 @@ const EvmErc20Module = hydrate => {
1315
1244
  * In a future version of the balance libraries, we may build some kind of async scheduling system which will keep the list of tokens for each chain up to date without relying on a squid.
1316
1245
  */
1317
1246
  async fetchEvmChainTokens(chainId, _chainMeta, moduleConfig, tokens) {
1318
- //const { isTestnet } = chainMeta
1319
-
1320
1247
  const chainTokens = {};
1321
1248
  for (const tokenConfig of tokens ?? []) {
1322
1249
  const {
@@ -1330,8 +1257,6 @@ const EvmErc20Module = hydrate => {
1330
1257
  log.warn("ignoring token on chain %s", chainId, tokenConfig);
1331
1258
  continue;
1332
1259
  }
1333
-
1334
- // TODO zodify this
1335
1260
  const symbol = tokenConfig?.symbol ?? contractSymbol ?? "ETH";
1336
1261
  const decimals = typeof tokenConfig?.decimals === "number" ? tokenConfig.decimals : typeof contractDecimals === "number" ? contractDecimals : 18;
1337
1262
  if (!symbol || typeof decimals !== "number") continue;
@@ -1358,7 +1283,6 @@ const EvmErc20Module = hydrate => {
1358
1283
  } else {
1359
1284
  log.warn("Ignoring invalid token", token.id, validation.error.message, validation.error.issues);
1360
1285
  }
1361
- chainTokens[token.id] = token;
1362
1286
  }
1363
1287
  return chainTokens;
1364
1288
  },
@@ -1632,7 +1556,6 @@ const EvmNativeModule = hydrate => {
1632
1556
  */
1633
1557
  async fetchEvmChainTokens() {
1634
1558
  // token is currently generated in chaindata from the EthNetworkConfig["nativeCurrency"] field
1635
- // TODO normalise this
1636
1559
  return {};
1637
1560
  },
1638
1561
  async subscribeBalances({
@@ -2378,7 +2301,7 @@ const moduleType$5 = "evm-uniswapv2";
2378
2301
  const EvmUniswapV2TokenConfigSchema = z__default.default.strictObject({
2379
2302
  contractAddress: chaindataProvider.EvmUniswapV2TokenSchema.shape.contractAddress,
2380
2303
  ...TokenConfigBaseSchema.shape,
2381
- // the ones below are unused and prone to error, feels better to always fetch these from chain
2304
+ // on chaindata side these are fetched by a dedicated task
2382
2305
  symbol0: chaindataProvider.EvmUniswapV2TokenSchema.shape.symbol0.optional(),
2383
2306
  symbol1: chaindataProvider.EvmUniswapV2TokenSchema.shape.symbol1.optional(),
2384
2307
  decimals0: chaindataProvider.EvmUniswapV2TokenSchema.shape.decimals0.optional(),
@@ -2673,7 +2596,7 @@ const fetchSpecVersion = async (chainConnector, networkId) => {
2673
2596
  };
2674
2597
 
2675
2598
  /**
2676
- * fetches the spec version of a network. current request is cached in case of multiple calls (all balance subs kick in at once)
2599
+ * fetches the spec version of a network. current request is cached in case of multiple calls (all balance modules will kick in at once)
2677
2600
  */
2678
2601
  const getSpecVersion = async (chainConnector, networkId) => {
2679
2602
  if (CACHE_GET_SPEC_VERSION.has(networkId)) return CACHE_GET_SPEC_VERSION.get(networkId);
@@ -2757,7 +2680,7 @@ const fetchMiniMetadatas = async (chainConnector, chaindataProvider, chainId, sp
2757
2680
  const chain = await chaindataProvider.getNetworkById(chainId, "polkadot");
2758
2681
  const balancesConfig = chain?.balancesConfig?.[mod.type];
2759
2682
  const chainMeta = await mod.fetchSubstrateChainMeta(chainId, balancesConfig,
2760
- // TODO fix typings
2683
+ // TODO better typing
2761
2684
  metadataRpc);
2762
2685
  return {
2763
2686
  id: deriveMiniMetadataId({
@@ -2775,7 +2698,7 @@ const fetchMiniMetadatas = async (chainConnector, chaindataProvider, chainId, sp
2775
2698
  };
2776
2699
  }));
2777
2700
  } finally {
2778
- log.debug("[miniMetadata] updated miniMetadatas for %s in %sms", chainId, performance.now() - start);
2701
+ log.debug("[miniMetadata] updated miniMetadatas for %s in %sms", chainId, (performance.now() - start).toFixed(2));
2779
2702
  }
2780
2703
  };
2781
2704
 
@@ -2840,6 +2763,7 @@ async function balances(balanceModule, addressesByToken, callback) {
2840
2763
  return await balanceModule.fetchBalances(addressesByToken);
2841
2764
  }
2842
2765
 
2766
+ // TODO remove this one in favor of the network specific one below
2843
2767
  const buildStorageCoders = ({
2844
2768
  chainIds,
2845
2769
  chains,
@@ -3184,7 +3108,6 @@ const SubAssetsModule = hydrate => {
3184
3108
  if (controller.signal.aborted) return () => {};
3185
3109
  const stateHelper = new RpcStateQueryHelper(chainConnector, queries);
3186
3110
  return await stateHelper.subscribe((error, result) => {
3187
- // console.log("SubstrateAssetsModule.callback", { error, result })
3188
3111
  if (error) return callback(error);
3189
3112
  const balances = result?.filter(b => b !== null) ?? [];
3190
3113
  if (balances.length > 0) callback(null, new Balances(balances));
@@ -3297,7 +3220,7 @@ async function buildNetworkQueries$2(networkId, chainConnector, chaindataProvide
3297
3220
  }
3298
3221
  return addresses.flatMap(address => {
3299
3222
  const scaleCoder = networkStorageCoders?.storage;
3300
- const stateKey = tryEncode(scaleCoder, BigInt(token.assetId), address) ?? tryEncode(scaleCoder, Number(token.assetId), address);
3223
+ const stateKey = tryEncode(scaleCoder, Number(token.assetId), address) ?? tryEncode(scaleCoder, BigInt(token.assetId), address);
3301
3224
  if (!stateKey) {
3302
3225
  log.warn(`Invalid assetId / address in ${networkId} storage query ${token.assetId} / ${address}`);
3303
3226
  return [];
@@ -4318,22 +4241,14 @@ const filterBaseLocks = locks => {
4318
4241
  };
4319
4242
 
4320
4243
  // TODO: Make these titles translatable
4321
- const getLockTitle = (lock, {
4244
+ const getLockTitle = (lock,
4245
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
4246
+ {
4322
4247
  balance
4323
4248
  } = {}) => {
4324
4249
  if (!lock.label) return lock.label;
4325
4250
  if (lock.label === "democracy") return "Governance";
4326
- if (lock.label === "crowdloan") {
4327
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4328
- const paraId = lock.meta?.paraId;
4329
- if (!paraId) return "Crowdloan";
4330
-
4331
- // balance?.network?.parathreads?.find(
4332
- // (parathread) => parathread?.paraId === paraId,
4333
- // )?.name
4334
-
4335
- return `${`Parachain ${paraId}`} Crowdloan`;
4336
- }
4251
+ if (lock.label === "crowdloan") return "Crowdloan";
4337
4252
  if (lock.label === "nompools-staking") return "Pooled Staking";
4338
4253
  if (lock.label === "nompools-unbonding") return "Pooled Staking";
4339
4254
  if (lock.label === "subtensor-staking") return "Root Staking";
@@ -4346,10 +4261,6 @@ const getLockTitle = (lock, {
4346
4261
 
4347
4262
  const moduleType$2 = "substrate-native";
4348
4263
 
4349
- // {
4350
- // disable?: boolean
4351
- // } & BalancesConfigTokenParams
4352
-
4353
4264
  /**
4354
4265
  * Function to merge two 'sub sources' of the same balance together, or
4355
4266
  * two instances of the same balance with different values.
@@ -4724,8 +4635,6 @@ class QueryCache {
4724
4635
  #chainConnector;
4725
4636
  miniMetadatas = new Map();
4726
4637
  balanceQueryCache = new Map();
4727
- // private metadataSub: Subscription | null = null
4728
-
4729
4638
  constructor(chaindataProvider, chainConnector) {
4730
4639
  this.chaindataProvider = chaindataProvider;
4731
4640
  this.#chaindataProvider = chaindataProvider;
@@ -4809,13 +4718,13 @@ const DotNetworkPropertiesArray = z__default.default.object({
4809
4718
  tokenDecimals: z__default.default.array(z__default.default.number()).nonempty(),
4810
4719
  tokenSymbol: z__default.default.array(z__default.default.string()).nonempty()
4811
4720
  });
4812
- const DotNetworkProperties = z__default.default.union([DotNetworkPropertiesSimple, DotNetworkPropertiesArray]).transform(val => ({
4721
+ const DotNetworkPropertiesSchema = z__default.default.union([DotNetworkPropertiesSimple, DotNetworkPropertiesArray]).transform(val => ({
4813
4722
  tokenDecimals: Array.isArray(val.tokenDecimals) ? val.tokenDecimals[0] : val.tokenDecimals,
4814
4723
  tokenSymbol: Array.isArray(val.tokenSymbol) ? val.tokenSymbol[0] : val.tokenSymbol
4815
4724
  }));
4816
4725
  const getChainProperties = async (chainConnector, networkId) => {
4817
4726
  const properties = await chainConnector.send(networkId, "system_properties", [], true);
4818
- return DotNetworkProperties.parse(properties);
4727
+ return DotNetworkPropertiesSchema.parse(properties);
4819
4728
  };
4820
4729
 
4821
4730
  const POLLING_WINDOW_SIZE = 20;
@@ -4840,6 +4749,7 @@ const SubNativeModule = hydrate => {
4840
4749
  // subscribeBalances was split by network to prevent all subs to wait for all minimetadatas to be ready.
4841
4750
  // however the multichain logic in there is so deep in the function below that i had to keep it as-is, and call it by per-network chunks
4842
4751
  // TODO refactor this be actually network specific
4752
+ // Note: had to extract this function from the result object or this.subscribeBalances wouldn't be typed correctly
4843
4753
  const subscribeChainBalances = (chainId, opts, callback, signal) => {
4844
4754
  const {
4845
4755
  addressesByToken,
@@ -5041,7 +4951,6 @@ const SubNativeModule = hydrate => {
5041
4951
  };
5042
4952
  const existentialDeposit = getConstantValue("Balances", "ExistentialDeposit")?.toString();
5043
4953
  const nominationPoolsPalletId = getConstantValue("NominationPools", "PalletId")?.asText();
5044
- const crowdloanPalletId = getConstantValue("Crowdloan", "PalletId")?.asText(); // TODO yeet
5045
4954
  const hasSubtensorPallet = getConstantValue("SubtensorModule", "KeySwapCost") !== undefined;
5046
4955
 
5047
4956
  //
@@ -5061,16 +4970,7 @@ const SubNativeModule = hydrate => {
5061
4970
  }, {
5062
4971
  pallet: "Staking",
5063
4972
  items: ["Ledger"]
5064
- }, {
5065
- pallet: "Crowdloan",
5066
- items: ["Funds"]
5067
- },
5068
- // TODO yeet
5069
- {
5070
- pallet: "Paras",
5071
- items: ["Parachains"]
5072
4973
  },
5073
- // TODO yeet
5074
4974
  // TotalColdkeyStake is used until v.2.2.1, then it is replaced by StakingHotkeys+Stake
5075
4975
  // Need to keep TotalColdkeyStake for a while so chaindata keeps including it in miniMetadatas, so it doesnt break old versions of the wallet
5076
4976
  {
@@ -5096,7 +4996,6 @@ const SubNativeModule = hydrate => {
5096
4996
  useLegacyTransferableCalculation,
5097
4997
  existentialDeposit,
5098
4998
  nominationPoolsPalletId,
5099
- crowdloanPalletId,
5100
4999
  hasSubtensorPallet
5101
5000
  }
5102
5001
  };
@@ -5147,7 +5046,7 @@ const SubNativeModule = hydrate => {
5147
5046
  const unsubsribeFns = Promise.all(lodash.keys(addressesByTokenByNetwork).map(async networkId => {
5148
5047
  try {
5149
5048
  // this is what we want to be done separately for each network
5150
- // this will update the DB so minimetadata will be available when it's used, veeeeery far down the tree of subscribeChainBalances
5049
+ // this will update the DB so minimetadata will be available when it's used, everywhere else down the tree of subscribeChainBalances
5151
5050
  await getMiniMetadata(chaindataProvider$1, chainConnector$1, networkId, moduleType$2, controller.signal);
5152
5051
  } catch (err) {
5153
5052
  if (!util.isAbortError(err)) log.warn("Failed to get native token miniMetadata for network", networkId, err);
@@ -6943,7 +6842,6 @@ exports.EvmErc20Module = EvmErc20Module;
6943
6842
  exports.EvmErc20TokenConfigSchema = EvmErc20TokenConfigSchema;
6944
6843
  exports.EvmNativeModule = EvmNativeModule;
6945
6844
  exports.EvmNativeTokenConfigSchema = EvmNativeTokenConfigSchema;
6946
- exports.EvmTokenFetcher = EvmTokenFetcher;
6947
6845
  exports.EvmUniswapV2Module = EvmUniswapV2Module;
6948
6846
  exports.EvmUniswapV2TokenConfigSchema = EvmUniswapV2TokenConfigSchema;
6949
6847
  exports.FiatSumBalancesFormatter = FiatSumBalancesFormatter;
@@ -40,8 +40,6 @@ var PQueue__default = /*#__PURE__*/_interopDefault(PQueue);
40
40
  var groupBy__default = /*#__PURE__*/_interopDefault(groupBy);
41
41
  var upperFirst__default = /*#__PURE__*/_interopDefault(upperFirst);
42
42
 
43
- // Record<string, unknown> | undefined
44
-
45
43
  // TODO: Document default balances module purpose/usage
46
44
  const DefaultBalanceModule = type => ({
47
45
  get type() {
@@ -75,58 +73,9 @@ const DefaultBalanceModule = type => ({
75
73
  // internal
76
74
  //
77
75
 
78
- // TODO yeet ?
79
- // there is no need to construct a lit of tokens, it's done by∏ chaindata
80
-
81
- /**
82
- * Fetches tokens for EVM networks.
83
- * @deprecated
84
- */
85
- class EvmTokenFetcher {
86
- #chaindataProvider;
87
- #balanceModules;
88
- constructor(chaindataProvider, balanceModules) {
89
- this.#chaindataProvider = chaindataProvider;
90
- this.#balanceModules = balanceModules;
91
- }
92
- async update(_evmNetworkIds) {
93
- // chaindataProvider's tokens should be in sync already
94
- // await this.updateEvmNetworks(evmNetworkIds)
95
- }
96
-
97
- // private async updateEvmNetworks(evmNetworkIds: EvmNetworkId[]) {
98
- // // feels unnecessary, chaindataProvider's tokens should be in sync already
99
- // // const evmNetworks = new Map(
100
- // // (await this.#chaindataProvider.evmNetworks()).map((evmNetwork) => [
101
- // // evmNetwork.id,
102
- // // evmNetwork,
103
- // // ]),
104
- // // )
105
- // // const allEvmTokens: TokenList = {}
106
- // // const evmNetworkConcurrency = 10
107
- // // await PromisePool.withConcurrency(evmNetworkConcurrency)
108
- // // .for(evmNetworkIds)
109
- // // .process(async (evmNetworkId) => {
110
- // // const evmNetwork = evmNetworks.get(evmNetworkId)
111
- // // if (!evmNetwork) return
112
- // // for (const mod of this.#balanceModules.filter((m) => m.type.startsWith("evm-"))) {
113
- // // // const balancesConfig = (evmNetwork.balancesConfig ?? []).find(
114
- // // // ({ moduleType }) => moduleType === mod.type,
115
- // // // )
116
- // // // const moduleConfig = balancesConfig?.moduleConfig ?? {}
117
- // // // chainMeta arg only needs the isTestnet property, let's save a db roundtrip for now
118
- // // const isTestnet = evmNetwork.isTestnet ?? false
119
- // // const tokens = await mod.fetchEvmChainTokens(evmNetworkId, { isTestnet }, moduleConfig)
120
- // // for (const [tokenId, token] of Object.entries(tokens)) allEvmTokens[tokenId] = token
121
- // // }
122
- // // })
123
- // // await this.#chaindataProvider.updateEvmNetworkTokens(Object.values(allEvmTokens))
124
- // }
125
- }
126
-
127
76
  var pkg = {
128
77
  name: "@talismn/balances",
129
- version: "0.0.0-pr2043-20250628151732"};
78
+ version: "0.0.0-pr2043-20250629051139"};
130
79
 
131
80
  var log = anylogger__default.default(pkg.name);
132
81
 
@@ -430,7 +379,6 @@ class Balance {
430
379
  // This means that those rates are always available for calculating the uniswapv2 rates,
431
380
  // regardless of whether or not the underlying erc20s are actually in chaindata and enabled.
432
381
  if (this.isSource("evm-uniswapv2") && this.token?.type === "evm-uniswapv2" // &&
433
- //this.evmNetworkId
434
382
  ) {
435
383
  const tokenId0 = chaindataProvider.evmErc20TokenId(this.networkId, this.token.tokenAddress0);
436
384
  const tokenId1 = chaindataProvider.evmErc20TokenId(this.networkId, this.token.tokenAddress1);
@@ -512,9 +460,7 @@ class Balance {
512
460
  const nomPoolStakedPlancks = this.locks.some(lock => lock.source === "substrate-native-holds" && lock.label === "DelegatedStaking") ? 0n : this.nompools.map(({
513
461
  amount
514
462
  }) => amount.planck).reduce((a, b) => a + b, 0n);
515
- return this.#format(this.free.planck + this.reserved.planck + nomPoolStakedPlancks + this.crowdloans.map(({
516
- amount
517
- }) => amount.planck).reduce((a, b) => a + b, 0n) + this.subtensor.map(({
463
+ return this.#format(this.free.planck + this.reserved.planck + nomPoolStakedPlancks + this.subtensor.map(({
518
464
  amount
519
465
  }) => amount.planck).reduce((a, b) => a + b, 0n) + includeInTotalExtraAmount(extra));
520
466
  }
@@ -550,9 +496,6 @@ class Balance {
550
496
  get locks() {
551
497
  return this.getValue("locked");
552
498
  }
553
- get crowdloans() {
554
- return this.getValue("crowdloan");
555
- }
556
499
  get nompools() {
557
500
  return this.getValue("nompool");
558
501
  }
@@ -631,7 +574,7 @@ class Balance {
631
574
  const nomPoolStakedPlancks = this.locks.some(lock => lock.source === "substrate-native-holds" && lock.label === "DelegatedStaking") ? 0n : this.nompools.map(({
632
575
  amount
633
576
  }) => amount.planck).reduce((a, b) => a + b, 0n);
634
- const otherUnavailable = nomPoolStakedPlancks + this.crowdloans.reduce((total, each) => total + each.amount.planck, 0n) + this.subtensor.reduce((total, each) => total + each.amount.planck, 0n);
577
+ const otherUnavailable = nomPoolStakedPlancks + this.subtensor.reduce((total, each) => total + each.amount.planck, 0n);
635
578
  return this.#format(baseUnavailable + otherUnavailable);
636
579
  }
637
580
 
@@ -886,21 +829,8 @@ const filterMirrorTokens = (balance, i, balances) => {
886
829
 
887
830
  /** A collection of `BalanceJson` objects */
888
831
 
889
- // type IBalanceBaseEvm = {
890
- // /** WIP, use `chainId` or `evmNetworkId` for now */
891
- // multiChainId: EvmChainId
892
-
893
- // }
894
-
895
- // type IBalanceBaseSubstrate = {
896
- // multiChainId: SubChainId
897
-
898
- // }
899
-
900
832
  /** `IBalance` is a common interface which all balance types must implement. */
901
833
 
902
- // & (IBalanceBaseEvm | IBalanceBaseSubstrate)
903
-
904
834
  /** An unlabelled amount of a balance */
905
835
 
906
836
  /** A labelled amount of a balance */
@@ -909,7 +839,6 @@ const getValueId = amount => {
909
839
  const getMetaId = () => {
910
840
  const meta = amount.meta;
911
841
  if (!meta) return "";
912
- if (amount.type === "crowdloan") return meta.paraId?.toString() ?? "";
913
842
  if (amount.type === "nompool") return meta.poolId?.toString() ?? "";
914
843
  if (amount.type === "subtensor") {
915
844
  const {
@@ -1315,8 +1244,6 @@ const EvmErc20Module = hydrate => {
1315
1244
  * In a future version of the balance libraries, we may build some kind of async scheduling system which will keep the list of tokens for each chain up to date without relying on a squid.
1316
1245
  */
1317
1246
  async fetchEvmChainTokens(chainId, _chainMeta, moduleConfig, tokens) {
1318
- //const { isTestnet } = chainMeta
1319
-
1320
1247
  const chainTokens = {};
1321
1248
  for (const tokenConfig of tokens ?? []) {
1322
1249
  const {
@@ -1330,8 +1257,6 @@ const EvmErc20Module = hydrate => {
1330
1257
  log.warn("ignoring token on chain %s", chainId, tokenConfig);
1331
1258
  continue;
1332
1259
  }
1333
-
1334
- // TODO zodify this
1335
1260
  const symbol = tokenConfig?.symbol ?? contractSymbol ?? "ETH";
1336
1261
  const decimals = typeof tokenConfig?.decimals === "number" ? tokenConfig.decimals : typeof contractDecimals === "number" ? contractDecimals : 18;
1337
1262
  if (!symbol || typeof decimals !== "number") continue;
@@ -1358,7 +1283,6 @@ const EvmErc20Module = hydrate => {
1358
1283
  } else {
1359
1284
  log.warn("Ignoring invalid token", token.id, validation.error.message, validation.error.issues);
1360
1285
  }
1361
- chainTokens[token.id] = token;
1362
1286
  }
1363
1287
  return chainTokens;
1364
1288
  },
@@ -1632,7 +1556,6 @@ const EvmNativeModule = hydrate => {
1632
1556
  */
1633
1557
  async fetchEvmChainTokens() {
1634
1558
  // token is currently generated in chaindata from the EthNetworkConfig["nativeCurrency"] field
1635
- // TODO normalise this
1636
1559
  return {};
1637
1560
  },
1638
1561
  async subscribeBalances({
@@ -2378,7 +2301,7 @@ const moduleType$5 = "evm-uniswapv2";
2378
2301
  const EvmUniswapV2TokenConfigSchema = z__default.default.strictObject({
2379
2302
  contractAddress: chaindataProvider.EvmUniswapV2TokenSchema.shape.contractAddress,
2380
2303
  ...TokenConfigBaseSchema.shape,
2381
- // the ones below are unused and prone to error, feels better to always fetch these from chain
2304
+ // on chaindata side these are fetched by a dedicated task
2382
2305
  symbol0: chaindataProvider.EvmUniswapV2TokenSchema.shape.symbol0.optional(),
2383
2306
  symbol1: chaindataProvider.EvmUniswapV2TokenSchema.shape.symbol1.optional(),
2384
2307
  decimals0: chaindataProvider.EvmUniswapV2TokenSchema.shape.decimals0.optional(),
@@ -2673,7 +2596,7 @@ const fetchSpecVersion = async (chainConnector, networkId) => {
2673
2596
  };
2674
2597
 
2675
2598
  /**
2676
- * fetches the spec version of a network. current request is cached in case of multiple calls (all balance subs kick in at once)
2599
+ * fetches the spec version of a network. current request is cached in case of multiple calls (all balance modules will kick in at once)
2677
2600
  */
2678
2601
  const getSpecVersion = async (chainConnector, networkId) => {
2679
2602
  if (CACHE_GET_SPEC_VERSION.has(networkId)) return CACHE_GET_SPEC_VERSION.get(networkId);
@@ -2757,7 +2680,7 @@ const fetchMiniMetadatas = async (chainConnector, chaindataProvider, chainId, sp
2757
2680
  const chain = await chaindataProvider.getNetworkById(chainId, "polkadot");
2758
2681
  const balancesConfig = chain?.balancesConfig?.[mod.type];
2759
2682
  const chainMeta = await mod.fetchSubstrateChainMeta(chainId, balancesConfig,
2760
- // TODO fix typings
2683
+ // TODO better typing
2761
2684
  metadataRpc);
2762
2685
  return {
2763
2686
  id: deriveMiniMetadataId({
@@ -2775,7 +2698,7 @@ const fetchMiniMetadatas = async (chainConnector, chaindataProvider, chainId, sp
2775
2698
  };
2776
2699
  }));
2777
2700
  } finally {
2778
- log.debug("[miniMetadata] updated miniMetadatas for %s in %sms", chainId, performance.now() - start);
2701
+ log.debug("[miniMetadata] updated miniMetadatas for %s in %sms", chainId, (performance.now() - start).toFixed(2));
2779
2702
  }
2780
2703
  };
2781
2704
 
@@ -2840,6 +2763,7 @@ async function balances(balanceModule, addressesByToken, callback) {
2840
2763
  return await balanceModule.fetchBalances(addressesByToken);
2841
2764
  }
2842
2765
 
2766
+ // TODO remove this one in favor of the network specific one below
2843
2767
  const buildStorageCoders = ({
2844
2768
  chainIds,
2845
2769
  chains,
@@ -3184,7 +3108,6 @@ const SubAssetsModule = hydrate => {
3184
3108
  if (controller.signal.aborted) return () => {};
3185
3109
  const stateHelper = new RpcStateQueryHelper(chainConnector, queries);
3186
3110
  return await stateHelper.subscribe((error, result) => {
3187
- // console.log("SubstrateAssetsModule.callback", { error, result })
3188
3111
  if (error) return callback(error);
3189
3112
  const balances = result?.filter(b => b !== null) ?? [];
3190
3113
  if (balances.length > 0) callback(null, new Balances(balances));
@@ -3297,7 +3220,7 @@ async function buildNetworkQueries$2(networkId, chainConnector, chaindataProvide
3297
3220
  }
3298
3221
  return addresses.flatMap(address => {
3299
3222
  const scaleCoder = networkStorageCoders?.storage;
3300
- const stateKey = tryEncode(scaleCoder, BigInt(token.assetId), address) ?? tryEncode(scaleCoder, Number(token.assetId), address);
3223
+ const stateKey = tryEncode(scaleCoder, Number(token.assetId), address) ?? tryEncode(scaleCoder, BigInt(token.assetId), address);
3301
3224
  if (!stateKey) {
3302
3225
  log.warn(`Invalid assetId / address in ${networkId} storage query ${token.assetId} / ${address}`);
3303
3226
  return [];
@@ -4318,22 +4241,14 @@ const filterBaseLocks = locks => {
4318
4241
  };
4319
4242
 
4320
4243
  // TODO: Make these titles translatable
4321
- const getLockTitle = (lock, {
4244
+ const getLockTitle = (lock,
4245
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
4246
+ {
4322
4247
  balance
4323
4248
  } = {}) => {
4324
4249
  if (!lock.label) return lock.label;
4325
4250
  if (lock.label === "democracy") return "Governance";
4326
- if (lock.label === "crowdloan") {
4327
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4328
- const paraId = lock.meta?.paraId;
4329
- if (!paraId) return "Crowdloan";
4330
-
4331
- // balance?.network?.parathreads?.find(
4332
- // (parathread) => parathread?.paraId === paraId,
4333
- // )?.name
4334
-
4335
- return `${`Parachain ${paraId}`} Crowdloan`;
4336
- }
4251
+ if (lock.label === "crowdloan") return "Crowdloan";
4337
4252
  if (lock.label === "nompools-staking") return "Pooled Staking";
4338
4253
  if (lock.label === "nompools-unbonding") return "Pooled Staking";
4339
4254
  if (lock.label === "subtensor-staking") return "Root Staking";
@@ -4346,10 +4261,6 @@ const getLockTitle = (lock, {
4346
4261
 
4347
4262
  const moduleType$2 = "substrate-native";
4348
4263
 
4349
- // {
4350
- // disable?: boolean
4351
- // } & BalancesConfigTokenParams
4352
-
4353
4264
  /**
4354
4265
  * Function to merge two 'sub sources' of the same balance together, or
4355
4266
  * two instances of the same balance with different values.
@@ -4724,8 +4635,6 @@ class QueryCache {
4724
4635
  #chainConnector;
4725
4636
  miniMetadatas = new Map();
4726
4637
  balanceQueryCache = new Map();
4727
- // private metadataSub: Subscription | null = null
4728
-
4729
4638
  constructor(chaindataProvider, chainConnector) {
4730
4639
  this.chaindataProvider = chaindataProvider;
4731
4640
  this.#chaindataProvider = chaindataProvider;
@@ -4809,13 +4718,13 @@ const DotNetworkPropertiesArray = z__default.default.object({
4809
4718
  tokenDecimals: z__default.default.array(z__default.default.number()).nonempty(),
4810
4719
  tokenSymbol: z__default.default.array(z__default.default.string()).nonempty()
4811
4720
  });
4812
- const DotNetworkProperties = z__default.default.union([DotNetworkPropertiesSimple, DotNetworkPropertiesArray]).transform(val => ({
4721
+ const DotNetworkPropertiesSchema = z__default.default.union([DotNetworkPropertiesSimple, DotNetworkPropertiesArray]).transform(val => ({
4813
4722
  tokenDecimals: Array.isArray(val.tokenDecimals) ? val.tokenDecimals[0] : val.tokenDecimals,
4814
4723
  tokenSymbol: Array.isArray(val.tokenSymbol) ? val.tokenSymbol[0] : val.tokenSymbol
4815
4724
  }));
4816
4725
  const getChainProperties = async (chainConnector, networkId) => {
4817
4726
  const properties = await chainConnector.send(networkId, "system_properties", [], true);
4818
- return DotNetworkProperties.parse(properties);
4727
+ return DotNetworkPropertiesSchema.parse(properties);
4819
4728
  };
4820
4729
 
4821
4730
  const POLLING_WINDOW_SIZE = 20;
@@ -4840,6 +4749,7 @@ const SubNativeModule = hydrate => {
4840
4749
  // subscribeBalances was split by network to prevent all subs to wait for all minimetadatas to be ready.
4841
4750
  // however the multichain logic in there is so deep in the function below that i had to keep it as-is, and call it by per-network chunks
4842
4751
  // TODO refactor this be actually network specific
4752
+ // Note: had to extract this function from the result object or this.subscribeBalances wouldn't be typed correctly
4843
4753
  const subscribeChainBalances = (chainId, opts, callback, signal) => {
4844
4754
  const {
4845
4755
  addressesByToken,
@@ -5041,7 +4951,6 @@ const SubNativeModule = hydrate => {
5041
4951
  };
5042
4952
  const existentialDeposit = getConstantValue("Balances", "ExistentialDeposit")?.toString();
5043
4953
  const nominationPoolsPalletId = getConstantValue("NominationPools", "PalletId")?.asText();
5044
- const crowdloanPalletId = getConstantValue("Crowdloan", "PalletId")?.asText(); // TODO yeet
5045
4954
  const hasSubtensorPallet = getConstantValue("SubtensorModule", "KeySwapCost") !== undefined;
5046
4955
 
5047
4956
  //
@@ -5061,16 +4970,7 @@ const SubNativeModule = hydrate => {
5061
4970
  }, {
5062
4971
  pallet: "Staking",
5063
4972
  items: ["Ledger"]
5064
- }, {
5065
- pallet: "Crowdloan",
5066
- items: ["Funds"]
5067
- },
5068
- // TODO yeet
5069
- {
5070
- pallet: "Paras",
5071
- items: ["Parachains"]
5072
4973
  },
5073
- // TODO yeet
5074
4974
  // TotalColdkeyStake is used until v.2.2.1, then it is replaced by StakingHotkeys+Stake
5075
4975
  // Need to keep TotalColdkeyStake for a while so chaindata keeps including it in miniMetadatas, so it doesnt break old versions of the wallet
5076
4976
  {
@@ -5096,7 +4996,6 @@ const SubNativeModule = hydrate => {
5096
4996
  useLegacyTransferableCalculation,
5097
4997
  existentialDeposit,
5098
4998
  nominationPoolsPalletId,
5099
- crowdloanPalletId,
5100
4999
  hasSubtensorPallet
5101
5000
  }
5102
5001
  };
@@ -5147,7 +5046,7 @@ const SubNativeModule = hydrate => {
5147
5046
  const unsubsribeFns = Promise.all(lodash.keys(addressesByTokenByNetwork).map(async networkId => {
5148
5047
  try {
5149
5048
  // this is what we want to be done separately for each network
5150
- // this will update the DB so minimetadata will be available when it's used, veeeeery far down the tree of subscribeChainBalances
5049
+ // this will update the DB so minimetadata will be available when it's used, everywhere else down the tree of subscribeChainBalances
5151
5050
  await getMiniMetadata(chaindataProvider$1, chainConnector$1, networkId, moduleType$2, controller.signal);
5152
5051
  } catch (err) {
5153
5052
  if (!util.isAbortError(err)) log.warn("Failed to get native token miniMetadata for network", networkId, err);
@@ -6943,7 +6842,6 @@ exports.EvmErc20Module = EvmErc20Module;
6943
6842
  exports.EvmErc20TokenConfigSchema = EvmErc20TokenConfigSchema;
6944
6843
  exports.EvmNativeModule = EvmNativeModule;
6945
6844
  exports.EvmNativeTokenConfigSchema = EvmNativeTokenConfigSchema;
6946
- exports.EvmTokenFetcher = EvmTokenFetcher;
6947
6845
  exports.EvmUniswapV2Module = EvmUniswapV2Module;
6948
6846
  exports.EvmUniswapV2TokenConfigSchema = EvmUniswapV2TokenConfigSchema;
6949
6847
  exports.FiatSumBalancesFormatter = FiatSumBalancesFormatter;
@@ -26,8 +26,6 @@ import { u32, Struct, u128 } from 'scale-ts';
26
26
  import upperFirst from 'lodash/upperFirst';
27
27
  import { Abi } from '@polkadot/api-contract';
28
28
 
29
- // Record<string, unknown> | undefined
30
-
31
29
  // TODO: Document default balances module purpose/usage
32
30
  const DefaultBalanceModule = type => ({
33
31
  get type() {
@@ -61,58 +59,9 @@ const DefaultBalanceModule = type => ({
61
59
  // internal
62
60
  //
63
61
 
64
- // TODO yeet ?
65
- // there is no need to construct a lit of tokens, it's done by∏ chaindata
66
-
67
- /**
68
- * Fetches tokens for EVM networks.
69
- * @deprecated
70
- */
71
- class EvmTokenFetcher {
72
- #chaindataProvider;
73
- #balanceModules;
74
- constructor(chaindataProvider, balanceModules) {
75
- this.#chaindataProvider = chaindataProvider;
76
- this.#balanceModules = balanceModules;
77
- }
78
- async update(_evmNetworkIds) {
79
- // chaindataProvider's tokens should be in sync already
80
- // await this.updateEvmNetworks(evmNetworkIds)
81
- }
82
-
83
- // private async updateEvmNetworks(evmNetworkIds: EvmNetworkId[]) {
84
- // // feels unnecessary, chaindataProvider's tokens should be in sync already
85
- // // const evmNetworks = new Map(
86
- // // (await this.#chaindataProvider.evmNetworks()).map((evmNetwork) => [
87
- // // evmNetwork.id,
88
- // // evmNetwork,
89
- // // ]),
90
- // // )
91
- // // const allEvmTokens: TokenList = {}
92
- // // const evmNetworkConcurrency = 10
93
- // // await PromisePool.withConcurrency(evmNetworkConcurrency)
94
- // // .for(evmNetworkIds)
95
- // // .process(async (evmNetworkId) => {
96
- // // const evmNetwork = evmNetworks.get(evmNetworkId)
97
- // // if (!evmNetwork) return
98
- // // for (const mod of this.#balanceModules.filter((m) => m.type.startsWith("evm-"))) {
99
- // // // const balancesConfig = (evmNetwork.balancesConfig ?? []).find(
100
- // // // ({ moduleType }) => moduleType === mod.type,
101
- // // // )
102
- // // // const moduleConfig = balancesConfig?.moduleConfig ?? {}
103
- // // // chainMeta arg only needs the isTestnet property, let's save a db roundtrip for now
104
- // // const isTestnet = evmNetwork.isTestnet ?? false
105
- // // const tokens = await mod.fetchEvmChainTokens(evmNetworkId, { isTestnet }, moduleConfig)
106
- // // for (const [tokenId, token] of Object.entries(tokens)) allEvmTokens[tokenId] = token
107
- // // }
108
- // // })
109
- // // await this.#chaindataProvider.updateEvmNetworkTokens(Object.values(allEvmTokens))
110
- // }
111
- }
112
-
113
62
  var pkg = {
114
63
  name: "@talismn/balances",
115
- version: "0.0.0-pr2043-20250628151732"};
64
+ version: "0.0.0-pr2043-20250629051139"};
116
65
 
117
66
  var log = anylogger(pkg.name);
118
67
 
@@ -416,7 +365,6 @@ class Balance {
416
365
  // This means that those rates are always available for calculating the uniswapv2 rates,
417
366
  // regardless of whether or not the underlying erc20s are actually in chaindata and enabled.
418
367
  if (this.isSource("evm-uniswapv2") && this.token?.type === "evm-uniswapv2" // &&
419
- //this.evmNetworkId
420
368
  ) {
421
369
  const tokenId0 = evmErc20TokenId(this.networkId, this.token.tokenAddress0);
422
370
  const tokenId1 = evmErc20TokenId(this.networkId, this.token.tokenAddress1);
@@ -498,9 +446,7 @@ class Balance {
498
446
  const nomPoolStakedPlancks = this.locks.some(lock => lock.source === "substrate-native-holds" && lock.label === "DelegatedStaking") ? 0n : this.nompools.map(({
499
447
  amount
500
448
  }) => amount.planck).reduce((a, b) => a + b, 0n);
501
- return this.#format(this.free.planck + this.reserved.planck + nomPoolStakedPlancks + this.crowdloans.map(({
502
- amount
503
- }) => amount.planck).reduce((a, b) => a + b, 0n) + this.subtensor.map(({
449
+ return this.#format(this.free.planck + this.reserved.planck + nomPoolStakedPlancks + this.subtensor.map(({
504
450
  amount
505
451
  }) => amount.planck).reduce((a, b) => a + b, 0n) + includeInTotalExtraAmount(extra));
506
452
  }
@@ -536,9 +482,6 @@ class Balance {
536
482
  get locks() {
537
483
  return this.getValue("locked");
538
484
  }
539
- get crowdloans() {
540
- return this.getValue("crowdloan");
541
- }
542
485
  get nompools() {
543
486
  return this.getValue("nompool");
544
487
  }
@@ -617,7 +560,7 @@ class Balance {
617
560
  const nomPoolStakedPlancks = this.locks.some(lock => lock.source === "substrate-native-holds" && lock.label === "DelegatedStaking") ? 0n : this.nompools.map(({
618
561
  amount
619
562
  }) => amount.planck).reduce((a, b) => a + b, 0n);
620
- const otherUnavailable = nomPoolStakedPlancks + this.crowdloans.reduce((total, each) => total + each.amount.planck, 0n) + this.subtensor.reduce((total, each) => total + each.amount.planck, 0n);
563
+ const otherUnavailable = nomPoolStakedPlancks + this.subtensor.reduce((total, each) => total + each.amount.planck, 0n);
621
564
  return this.#format(baseUnavailable + otherUnavailable);
622
565
  }
623
566
 
@@ -872,21 +815,8 @@ const filterMirrorTokens = (balance, i, balances) => {
872
815
 
873
816
  /** A collection of `BalanceJson` objects */
874
817
 
875
- // type IBalanceBaseEvm = {
876
- // /** WIP, use `chainId` or `evmNetworkId` for now */
877
- // multiChainId: EvmChainId
878
-
879
- // }
880
-
881
- // type IBalanceBaseSubstrate = {
882
- // multiChainId: SubChainId
883
-
884
- // }
885
-
886
818
  /** `IBalance` is a common interface which all balance types must implement. */
887
819
 
888
- // & (IBalanceBaseEvm | IBalanceBaseSubstrate)
889
-
890
820
  /** An unlabelled amount of a balance */
891
821
 
892
822
  /** A labelled amount of a balance */
@@ -895,7 +825,6 @@ const getValueId = amount => {
895
825
  const getMetaId = () => {
896
826
  const meta = amount.meta;
897
827
  if (!meta) return "";
898
- if (amount.type === "crowdloan") return meta.paraId?.toString() ?? "";
899
828
  if (amount.type === "nompool") return meta.poolId?.toString() ?? "";
900
829
  if (amount.type === "subtensor") {
901
830
  const {
@@ -1301,8 +1230,6 @@ const EvmErc20Module = hydrate => {
1301
1230
  * In a future version of the balance libraries, we may build some kind of async scheduling system which will keep the list of tokens for each chain up to date without relying on a squid.
1302
1231
  */
1303
1232
  async fetchEvmChainTokens(chainId, _chainMeta, moduleConfig, tokens) {
1304
- //const { isTestnet } = chainMeta
1305
-
1306
1233
  const chainTokens = {};
1307
1234
  for (const tokenConfig of tokens ?? []) {
1308
1235
  const {
@@ -1316,8 +1243,6 @@ const EvmErc20Module = hydrate => {
1316
1243
  log.warn("ignoring token on chain %s", chainId, tokenConfig);
1317
1244
  continue;
1318
1245
  }
1319
-
1320
- // TODO zodify this
1321
1246
  const symbol = tokenConfig?.symbol ?? contractSymbol ?? "ETH";
1322
1247
  const decimals = typeof tokenConfig?.decimals === "number" ? tokenConfig.decimals : typeof contractDecimals === "number" ? contractDecimals : 18;
1323
1248
  if (!symbol || typeof decimals !== "number") continue;
@@ -1344,7 +1269,6 @@ const EvmErc20Module = hydrate => {
1344
1269
  } else {
1345
1270
  log.warn("Ignoring invalid token", token.id, validation.error.message, validation.error.issues);
1346
1271
  }
1347
- chainTokens[token.id] = token;
1348
1272
  }
1349
1273
  return chainTokens;
1350
1274
  },
@@ -1618,7 +1542,6 @@ const EvmNativeModule = hydrate => {
1618
1542
  */
1619
1543
  async fetchEvmChainTokens() {
1620
1544
  // token is currently generated in chaindata from the EthNetworkConfig["nativeCurrency"] field
1621
- // TODO normalise this
1622
1545
  return {};
1623
1546
  },
1624
1547
  async subscribeBalances({
@@ -2364,7 +2287,7 @@ const moduleType$5 = "evm-uniswapv2";
2364
2287
  const EvmUniswapV2TokenConfigSchema = z.strictObject({
2365
2288
  contractAddress: EvmUniswapV2TokenSchema.shape.contractAddress,
2366
2289
  ...TokenConfigBaseSchema.shape,
2367
- // the ones below are unused and prone to error, feels better to always fetch these from chain
2290
+ // on chaindata side these are fetched by a dedicated task
2368
2291
  symbol0: EvmUniswapV2TokenSchema.shape.symbol0.optional(),
2369
2292
  symbol1: EvmUniswapV2TokenSchema.shape.symbol1.optional(),
2370
2293
  decimals0: EvmUniswapV2TokenSchema.shape.decimals0.optional(),
@@ -2659,7 +2582,7 @@ const fetchSpecVersion = async (chainConnector, networkId) => {
2659
2582
  };
2660
2583
 
2661
2584
  /**
2662
- * fetches the spec version of a network. current request is cached in case of multiple calls (all balance subs kick in at once)
2585
+ * fetches the spec version of a network. current request is cached in case of multiple calls (all balance modules will kick in at once)
2663
2586
  */
2664
2587
  const getSpecVersion = async (chainConnector, networkId) => {
2665
2588
  if (CACHE_GET_SPEC_VERSION.has(networkId)) return CACHE_GET_SPEC_VERSION.get(networkId);
@@ -2743,7 +2666,7 @@ const fetchMiniMetadatas = async (chainConnector, chaindataProvider, chainId, sp
2743
2666
  const chain = await chaindataProvider.getNetworkById(chainId, "polkadot");
2744
2667
  const balancesConfig = chain?.balancesConfig?.[mod.type];
2745
2668
  const chainMeta = await mod.fetchSubstrateChainMeta(chainId, balancesConfig,
2746
- // TODO fix typings
2669
+ // TODO better typing
2747
2670
  metadataRpc);
2748
2671
  return {
2749
2672
  id: deriveMiniMetadataId({
@@ -2761,7 +2684,7 @@ const fetchMiniMetadatas = async (chainConnector, chaindataProvider, chainId, sp
2761
2684
  };
2762
2685
  }));
2763
2686
  } finally {
2764
- log.debug("[miniMetadata] updated miniMetadatas for %s in %sms", chainId, performance.now() - start);
2687
+ log.debug("[miniMetadata] updated miniMetadatas for %s in %sms", chainId, (performance.now() - start).toFixed(2));
2765
2688
  }
2766
2689
  };
2767
2690
 
@@ -2826,6 +2749,7 @@ async function balances(balanceModule, addressesByToken, callback) {
2826
2749
  return await balanceModule.fetchBalances(addressesByToken);
2827
2750
  }
2828
2751
 
2752
+ // TODO remove this one in favor of the network specific one below
2829
2753
  const buildStorageCoders = ({
2830
2754
  chainIds,
2831
2755
  chains,
@@ -3170,7 +3094,6 @@ const SubAssetsModule = hydrate => {
3170
3094
  if (controller.signal.aborted) return () => {};
3171
3095
  const stateHelper = new RpcStateQueryHelper(chainConnector, queries);
3172
3096
  return await stateHelper.subscribe((error, result) => {
3173
- // console.log("SubstrateAssetsModule.callback", { error, result })
3174
3097
  if (error) return callback(error);
3175
3098
  const balances = result?.filter(b => b !== null) ?? [];
3176
3099
  if (balances.length > 0) callback(null, new Balances(balances));
@@ -3283,7 +3206,7 @@ async function buildNetworkQueries$2(networkId, chainConnector, chaindataProvide
3283
3206
  }
3284
3207
  return addresses.flatMap(address => {
3285
3208
  const scaleCoder = networkStorageCoders?.storage;
3286
- const stateKey = tryEncode(scaleCoder, BigInt(token.assetId), address) ?? tryEncode(scaleCoder, Number(token.assetId), address);
3209
+ const stateKey = tryEncode(scaleCoder, Number(token.assetId), address) ?? tryEncode(scaleCoder, BigInt(token.assetId), address);
3287
3210
  if (!stateKey) {
3288
3211
  log.warn(`Invalid assetId / address in ${networkId} storage query ${token.assetId} / ${address}`);
3289
3212
  return [];
@@ -4304,22 +4227,14 @@ const filterBaseLocks = locks => {
4304
4227
  };
4305
4228
 
4306
4229
  // TODO: Make these titles translatable
4307
- const getLockTitle = (lock, {
4230
+ const getLockTitle = (lock,
4231
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
4232
+ {
4308
4233
  balance
4309
4234
  } = {}) => {
4310
4235
  if (!lock.label) return lock.label;
4311
4236
  if (lock.label === "democracy") return "Governance";
4312
- if (lock.label === "crowdloan") {
4313
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4314
- const paraId = lock.meta?.paraId;
4315
- if (!paraId) return "Crowdloan";
4316
-
4317
- // balance?.network?.parathreads?.find(
4318
- // (parathread) => parathread?.paraId === paraId,
4319
- // )?.name
4320
-
4321
- return `${`Parachain ${paraId}`} Crowdloan`;
4322
- }
4237
+ if (lock.label === "crowdloan") return "Crowdloan";
4323
4238
  if (lock.label === "nompools-staking") return "Pooled Staking";
4324
4239
  if (lock.label === "nompools-unbonding") return "Pooled Staking";
4325
4240
  if (lock.label === "subtensor-staking") return "Root Staking";
@@ -4332,10 +4247,6 @@ const getLockTitle = (lock, {
4332
4247
 
4333
4248
  const moduleType$2 = "substrate-native";
4334
4249
 
4335
- // {
4336
- // disable?: boolean
4337
- // } & BalancesConfigTokenParams
4338
-
4339
4250
  /**
4340
4251
  * Function to merge two 'sub sources' of the same balance together, or
4341
4252
  * two instances of the same balance with different values.
@@ -4710,8 +4621,6 @@ class QueryCache {
4710
4621
  #chainConnector;
4711
4622
  miniMetadatas = new Map();
4712
4623
  balanceQueryCache = new Map();
4713
- // private metadataSub: Subscription | null = null
4714
-
4715
4624
  constructor(chaindataProvider, chainConnector) {
4716
4625
  this.chaindataProvider = chaindataProvider;
4717
4626
  this.#chaindataProvider = chaindataProvider;
@@ -4795,13 +4704,13 @@ const DotNetworkPropertiesArray = z.object({
4795
4704
  tokenDecimals: z.array(z.number()).nonempty(),
4796
4705
  tokenSymbol: z.array(z.string()).nonempty()
4797
4706
  });
4798
- const DotNetworkProperties = z.union([DotNetworkPropertiesSimple, DotNetworkPropertiesArray]).transform(val => ({
4707
+ const DotNetworkPropertiesSchema = z.union([DotNetworkPropertiesSimple, DotNetworkPropertiesArray]).transform(val => ({
4799
4708
  tokenDecimals: Array.isArray(val.tokenDecimals) ? val.tokenDecimals[0] : val.tokenDecimals,
4800
4709
  tokenSymbol: Array.isArray(val.tokenSymbol) ? val.tokenSymbol[0] : val.tokenSymbol
4801
4710
  }));
4802
4711
  const getChainProperties = async (chainConnector, networkId) => {
4803
4712
  const properties = await chainConnector.send(networkId, "system_properties", [], true);
4804
- return DotNetworkProperties.parse(properties);
4713
+ return DotNetworkPropertiesSchema.parse(properties);
4805
4714
  };
4806
4715
 
4807
4716
  const POLLING_WINDOW_SIZE = 20;
@@ -4826,6 +4735,7 @@ const SubNativeModule = hydrate => {
4826
4735
  // subscribeBalances was split by network to prevent all subs to wait for all minimetadatas to be ready.
4827
4736
  // however the multichain logic in there is so deep in the function below that i had to keep it as-is, and call it by per-network chunks
4828
4737
  // TODO refactor this be actually network specific
4738
+ // Note: had to extract this function from the result object or this.subscribeBalances wouldn't be typed correctly
4829
4739
  const subscribeChainBalances = (chainId, opts, callback, signal) => {
4830
4740
  const {
4831
4741
  addressesByToken,
@@ -5027,7 +4937,6 @@ const SubNativeModule = hydrate => {
5027
4937
  };
5028
4938
  const existentialDeposit = getConstantValue("Balances", "ExistentialDeposit")?.toString();
5029
4939
  const nominationPoolsPalletId = getConstantValue("NominationPools", "PalletId")?.asText();
5030
- const crowdloanPalletId = getConstantValue("Crowdloan", "PalletId")?.asText(); // TODO yeet
5031
4940
  const hasSubtensorPallet = getConstantValue("SubtensorModule", "KeySwapCost") !== undefined;
5032
4941
 
5033
4942
  //
@@ -5047,16 +4956,7 @@ const SubNativeModule = hydrate => {
5047
4956
  }, {
5048
4957
  pallet: "Staking",
5049
4958
  items: ["Ledger"]
5050
- }, {
5051
- pallet: "Crowdloan",
5052
- items: ["Funds"]
5053
- },
5054
- // TODO yeet
5055
- {
5056
- pallet: "Paras",
5057
- items: ["Parachains"]
5058
4959
  },
5059
- // TODO yeet
5060
4960
  // TotalColdkeyStake is used until v.2.2.1, then it is replaced by StakingHotkeys+Stake
5061
4961
  // Need to keep TotalColdkeyStake for a while so chaindata keeps including it in miniMetadatas, so it doesnt break old versions of the wallet
5062
4962
  {
@@ -5082,7 +4982,6 @@ const SubNativeModule = hydrate => {
5082
4982
  useLegacyTransferableCalculation,
5083
4983
  existentialDeposit,
5084
4984
  nominationPoolsPalletId,
5085
- crowdloanPalletId,
5086
4985
  hasSubtensorPallet
5087
4986
  }
5088
4987
  };
@@ -5133,7 +5032,7 @@ const SubNativeModule = hydrate => {
5133
5032
  const unsubsribeFns = Promise.all(keys(addressesByTokenByNetwork).map(async networkId => {
5134
5033
  try {
5135
5034
  // this is what we want to be done separately for each network
5136
- // this will update the DB so minimetadata will be available when it's used, veeeeery far down the tree of subscribeChainBalances
5035
+ // this will update the DB so minimetadata will be available when it's used, everywhere else down the tree of subscribeChainBalances
5137
5036
  await getMiniMetadata(chaindataProvider, chainConnector, networkId, moduleType$2, controller.signal);
5138
5037
  } catch (err) {
5139
5038
  if (!isAbortError(err)) log.warn("Failed to get native token miniMetadata for network", networkId, err);
@@ -6919,4 +6818,4 @@ async function buildQueries(chainConnector, chaindataProvider, addressesByToken,
6919
6818
 
6920
6819
  const defaultBalanceModules = [EvmErc20Module, EvmNativeModule, EvmUniswapV2Module, SubAssetsModule, SubForeignAssetsModule, SubNativeModule, SubPsp22Module, SubTokensModule];
6921
6820
 
6922
- export { Balance, BalanceFormatter, BalanceValueGetter, Balances, Change24hCurrencyFormatter, DefaultBalanceModule, EvmErc20Module, EvmErc20TokenConfigSchema, EvmNativeModule, EvmNativeTokenConfigSchema, EvmTokenFetcher, EvmUniswapV2Module, EvmUniswapV2TokenConfigSchema, FiatSumBalancesFormatter, ONE_ALPHA_TOKEN, PlanckSumBalancesFormatter, RpcStateQueryHelper, SCALE_FACTOR, SUBTENSOR_MIN_STAKE_AMOUNT_PLANK, SUBTENSOR_ROOT_NETUID, SubAssetsModule, SubAssetsTokenConfigSchema, SubForeignAssetsModule, SubForeignAssetsTokenConfigSchema, SubNativeModule, SubNativeTokenConfigSchema, SubPsp22Module, SubPsp22TokenConfigSchema, SubTokensModule, SubTokensTokenConfigSchema, SumBalancesFormatter, TalismanBalancesDatabase, abiMulticall, balances, buildNetworkStorageCoders, buildStorageCoders, calculateAlphaPrice, calculateTaoAmountFromAlpha, calculateTaoFromDynamicInfo, compress, configureStore, db, decodeOutput, decompress, defaultBalanceModules, deriveMiniMetadataId, detectTransferMethod, erc20Abi, erc20BalancesAggregatorAbi, excludeFromFeePayableLocks, excludeFromTransferableAmount, filterBaseLocks, filterMirrorTokens, getBalanceId, getLockTitle, getUniqueChainIds, getValueId, includeInTotalExtraAmount, makeContractCaller, uniswapV2PairAbi };
6821
+ export { Balance, BalanceFormatter, BalanceValueGetter, Balances, Change24hCurrencyFormatter, DefaultBalanceModule, EvmErc20Module, EvmErc20TokenConfigSchema, EvmNativeModule, EvmNativeTokenConfigSchema, EvmUniswapV2Module, EvmUniswapV2TokenConfigSchema, FiatSumBalancesFormatter, ONE_ALPHA_TOKEN, PlanckSumBalancesFormatter, RpcStateQueryHelper, SCALE_FACTOR, SUBTENSOR_MIN_STAKE_AMOUNT_PLANK, SUBTENSOR_ROOT_NETUID, SubAssetsModule, SubAssetsTokenConfigSchema, SubForeignAssetsModule, SubForeignAssetsTokenConfigSchema, SubNativeModule, SubNativeTokenConfigSchema, SubPsp22Module, SubPsp22TokenConfigSchema, SubTokensModule, SubTokensTokenConfigSchema, SumBalancesFormatter, TalismanBalancesDatabase, abiMulticall, balances, buildNetworkStorageCoders, buildStorageCoders, calculateAlphaPrice, calculateTaoAmountFromAlpha, calculateTaoFromDynamicInfo, compress, configureStore, db, decodeOutput, decompress, defaultBalanceModules, deriveMiniMetadataId, detectTransferMethod, erc20Abi, erc20BalancesAggregatorAbi, excludeFromFeePayableLocks, excludeFromTransferableAmount, filterBaseLocks, filterMirrorTokens, getBalanceId, getLockTitle, getUniqueChainIds, getValueId, includeInTotalExtraAmount, makeContractCaller, uniswapV2PairAbi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/balances",
3
- "version": "0.0.0-pr2043-20250628151732",
3
+ "version": "0.0.0-pr2043-20250629051139",
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-pr2043-20250628151732",
39
- "@talismn/chain-connector-evm": "0.0.0-pr2043-20250628151732",
40
- "@talismn/chaindata-provider": "0.0.0-pr2043-20250628151732",
41
- "@talismn/sapi": "0.0.0-pr2043-20250628151732",
38
+ "@talismn/chain-connector-evm": "0.0.0-pr2043-20250629051139",
39
+ "@talismn/chaindata-provider": "0.0.0-pr2043-20250629051139",
40
+ "@talismn/sapi": "0.0.0-pr2043-20250629051139",
42
41
  "@talismn/scale": "0.1.2",
43
- "@talismn/token-rates": "0.0.0-pr2043-20250628151732",
44
- "@talismn/util": "0.0.0-pr2043-20250628151732"
42
+ "@talismn/token-rates": "0.0.0-pr2043-20250629051139",
43
+ "@talismn/util": "0.0.0-pr2043-20250629051139",
44
+ "@talismn/chain-connector": "0.0.0-pr2043-20250629051139"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@polkadot/api-contract": "16.1.2",
@@ -1,11 +0,0 @@
1
- import { ChaindataProvider, EvmNetworkId } from "@talismn/chaindata-provider";
2
- import { AnyBalanceModule } from "./modules/util";
3
- /**
4
- * Fetches tokens for EVM networks.
5
- * @deprecated
6
- */
7
- export declare class EvmTokenFetcher {
8
- #private;
9
- constructor(chaindataProvider: ChaindataProvider, balanceModules: Array<AnyBalanceModule>);
10
- update(_evmNetworkIds: EvmNetworkId[]): Promise<void>;
11
- }