@talismn/balances 0.0.0-pr2032-20250610081842 → 0.0.0-pr2032-20250610083550

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.
@@ -1184,8 +1184,19 @@ class MiniMetadataUpdater {
1184
1184
  } = chain;
1185
1185
  if (specName === null) return;
1186
1186
  if (specVersion === null) return;
1187
- if (!this.#chainConnectors.substrate) return;
1188
- const [metadataRpc, systemProperties] = await Promise.all([sapi.fetchBestMetadata((method, params, isCacheable) => this.#chainConnectors.substrate.send(chainId, method, params, isCacheable)), this.#chainConnectors.substrate.send(chainId, "system_properties", [])]);
1187
+ const fetchMetadata = async () => {
1188
+ try {
1189
+ return await sapi.fetchBestMetadata((method, params, isCacheable) => {
1190
+ if (!this.#chainConnectors.substrate) throw new Error("Substrate connector is not available");
1191
+ return this.#chainConnectors.substrate.send(chainId, method, params, isCacheable);
1192
+ }, true // allow v14 fallback
1193
+ );
1194
+ } catch (err) {
1195
+ log.warn(`Failed to fetch metadata for chain ${chainId}`);
1196
+ return undefined;
1197
+ }
1198
+ };
1199
+ const [metadataRpc, systemProperties] = await Promise.all([fetchMetadata(), this.#chainConnectors.substrate?.send(chainId, "system_properties", [])]);
1189
1200
  for (const mod of this.#balanceModules.filter(m => m.type.startsWith("substrate-"))) {
1190
1201
  const balancesConfig = (chain.balancesConfig ?? []).find(({
1191
1202
  moduleType
@@ -1184,8 +1184,19 @@ class MiniMetadataUpdater {
1184
1184
  } = chain;
1185
1185
  if (specName === null) return;
1186
1186
  if (specVersion === null) return;
1187
- if (!this.#chainConnectors.substrate) return;
1188
- const [metadataRpc, systemProperties] = await Promise.all([sapi.fetchBestMetadata((method, params, isCacheable) => this.#chainConnectors.substrate.send(chainId, method, params, isCacheable)), this.#chainConnectors.substrate.send(chainId, "system_properties", [])]);
1187
+ const fetchMetadata = async () => {
1188
+ try {
1189
+ return await sapi.fetchBestMetadata((method, params, isCacheable) => {
1190
+ if (!this.#chainConnectors.substrate) throw new Error("Substrate connector is not available");
1191
+ return this.#chainConnectors.substrate.send(chainId, method, params, isCacheable);
1192
+ }, true // allow v14 fallback
1193
+ );
1194
+ } catch (err) {
1195
+ log.warn(`Failed to fetch metadata for chain ${chainId}`);
1196
+ return undefined;
1197
+ }
1198
+ };
1199
+ const [metadataRpc, systemProperties] = await Promise.all([fetchMetadata(), this.#chainConnectors.substrate?.send(chainId, "system_properties", [])]);
1189
1200
  for (const mod of this.#balanceModules.filter(m => m.type.startsWith("substrate-"))) {
1190
1201
  const balancesConfig = (chain.balancesConfig ?? []).find(({
1191
1202
  moduleType
@@ -1171,8 +1171,19 @@ class MiniMetadataUpdater {
1171
1171
  } = chain;
1172
1172
  if (specName === null) return;
1173
1173
  if (specVersion === null) return;
1174
- if (!this.#chainConnectors.substrate) return;
1175
- const [metadataRpc, systemProperties] = await Promise.all([fetchBestMetadata((method, params, isCacheable) => this.#chainConnectors.substrate.send(chainId, method, params, isCacheable)), this.#chainConnectors.substrate.send(chainId, "system_properties", [])]);
1174
+ const fetchMetadata = async () => {
1175
+ try {
1176
+ return await fetchBestMetadata((method, params, isCacheable) => {
1177
+ if (!this.#chainConnectors.substrate) throw new Error("Substrate connector is not available");
1178
+ return this.#chainConnectors.substrate.send(chainId, method, params, isCacheable);
1179
+ }, true // allow v14 fallback
1180
+ );
1181
+ } catch (err) {
1182
+ log.warn(`Failed to fetch metadata for chain ${chainId}`);
1183
+ return undefined;
1184
+ }
1185
+ };
1186
+ const [metadataRpc, systemProperties] = await Promise.all([fetchMetadata(), this.#chainConnectors.substrate?.send(chainId, "system_properties", [])]);
1176
1187
  for (const mod of this.#balanceModules.filter(m => m.type.startsWith("substrate-"))) {
1177
1188
  const balancesConfig = (chain.balancesConfig ?? []).find(({
1178
1189
  moduleType
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/balances",
3
- "version": "0.0.0-pr2032-20250610081842",
3
+ "version": "0.0.0-pr2032-20250610083550",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "GPL-3.0-or-later",
@@ -34,12 +34,12 @@
34
34
  "rxjs": "^7.8.1",
35
35
  "scale-ts": "^1.6.1",
36
36
  "viem": "^2.27.3",
37
- "@talismn/chain-connector": "0.0.0-pr2032-20250610081842",
38
- "@talismn/chain-connector-evm": "0.0.0-pr2032-20250610081842",
39
- "@talismn/chaindata-provider": "0.0.0-pr2032-20250610081842",
40
- "@talismn/sapi": "0.0.0-pr2032-20250610081842",
37
+ "@talismn/chain-connector-evm": "0.0.0-pr2032-20250610083550",
38
+ "@talismn/chain-connector": "0.0.0-pr2032-20250610083550",
39
+ "@talismn/chaindata-provider": "0.0.0-pr2032-20250610083550",
41
40
  "@talismn/scale": "0.1.2",
42
- "@talismn/token-rates": "0.0.0-pr2032-20250610081842",
41
+ "@talismn/sapi": "0.0.0-pr2032-20250610083550",
42
+ "@talismn/token-rates": "0.0.0-pr2032-20250610083550",
43
43
  "@talismn/util": "0.4.2"
44
44
  },
45
45
  "devDependencies": {