@talismn/balances 0.0.0-pr2075-20250713081649 → 0.0.0-pr2075-20250713093608

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.
@@ -6293,10 +6293,7 @@ class BalancesProvider {
6293
6293
  ...b,
6294
6294
  status: "stale"
6295
6295
  } : b)).sort(sortByBalanceId)
6296
- })), rxjs.startWith({
6297
- status: "initialising",
6298
- balances: this.getStoredBalances(addressesByTokenId)
6299
- }), rxjs.distinctUntilChanged(lodashEs.isEqual));
6296
+ })), rxjs.distinctUntilChanged(lodashEs.isEqual));
6300
6297
  }
6301
6298
  fetchBalances(addressesByTokenId) {
6302
6299
  // TODO: better
@@ -6389,17 +6386,21 @@ class BalancesProvider {
6389
6386
  }) => status === "initialising") ? "initialising" : "live",
6390
6387
  balances: results.flatMap(result => result.balances).sort(sortByBalanceId)
6391
6388
  };
6392
- }), rxjs.distinctUntilChanged(lodashEs.isEqual),
6393
- // shareReplay + keepAlive allow for subscription to not restart as long as the inputs dont change
6394
- // for example, if another network is enabled/disabled
6389
+ }), rxjs.distinctUntilChanged(lodashEs.isEqual), rxjs.startWith({
6390
+ status: "initialising",
6391
+ balances: this.getStoredBalances(addressesByTokenId)
6392
+ }),
6393
+ // shareReplay + keepAlive allow for this network subscription to not restart as long as the inputs don't change
6394
+ // for example if another network is enabled/disabled, we don't want this subscription to be restarted
6395
+ // the unsubscribe/resubscribe is instantaneous when parameters parameters change, so keepAlive 0ms does the job
6395
6396
  rxjs.shareReplay({
6396
6397
  refCount: true,
6397
6398
  bufferSize: 1
6398
- }), util.keepAlive(2_000));
6399
+ }), util.keepAlive(0));
6399
6400
  });
6400
6401
  }
6401
6402
  getNetworkMiniMetadatas$(networkId) {
6402
- return this.#chaindataProvider.getNetworkById$(networkId).pipe(rxjs.switchMap(network => chaindataProvider.isNetworkDot(network) ? this.getNetworkSpecVersion$(networkId).pipe(rxjs.switchMap(specVersion => specVersion === null ? rxjs.of([]) : this.getMiniMetadatas$(networkId, specVersion))) : rxjs.of([])));
6403
+ return this.#chaindataProvider.getNetworkById$(networkId).pipe(rxjs.switchMap(network => chaindataProvider.isNetworkDot(network) ? this.getNetworkSpecVersion$(networkId).pipe(rxjs.switchMap(specVersion => specVersion === null ? rxjs.of([]) : this.getMiniMetadatas$(networkId, specVersion))) : rxjs.of([])), rxjs.distinctUntilChanged(lodashEs.isEqual));
6403
6404
  }
6404
6405
  getNetworkSpecVersion$(networkId) {
6405
6406
  return rxjs.from(viem.withRetry(() => getSpecVersion(this.#chainConnectors.substrate, networkId), {
@@ -6293,10 +6293,7 @@ class BalancesProvider {
6293
6293
  ...b,
6294
6294
  status: "stale"
6295
6295
  } : b)).sort(sortByBalanceId)
6296
- })), rxjs.startWith({
6297
- status: "initialising",
6298
- balances: this.getStoredBalances(addressesByTokenId)
6299
- }), rxjs.distinctUntilChanged(lodashEs.isEqual));
6296
+ })), rxjs.distinctUntilChanged(lodashEs.isEqual));
6300
6297
  }
6301
6298
  fetchBalances(addressesByTokenId) {
6302
6299
  // TODO: better
@@ -6389,17 +6386,21 @@ class BalancesProvider {
6389
6386
  }) => status === "initialising") ? "initialising" : "live",
6390
6387
  balances: results.flatMap(result => result.balances).sort(sortByBalanceId)
6391
6388
  };
6392
- }), rxjs.distinctUntilChanged(lodashEs.isEqual),
6393
- // shareReplay + keepAlive allow for subscription to not restart as long as the inputs dont change
6394
- // for example, if another network is enabled/disabled
6389
+ }), rxjs.distinctUntilChanged(lodashEs.isEqual), rxjs.startWith({
6390
+ status: "initialising",
6391
+ balances: this.getStoredBalances(addressesByTokenId)
6392
+ }),
6393
+ // shareReplay + keepAlive allow for this network subscription to not restart as long as the inputs don't change
6394
+ // for example if another network is enabled/disabled, we don't want this subscription to be restarted
6395
+ // the unsubscribe/resubscribe is instantaneous when parameters parameters change, so keepAlive 0ms does the job
6395
6396
  rxjs.shareReplay({
6396
6397
  refCount: true,
6397
6398
  bufferSize: 1
6398
- }), util.keepAlive(2_000));
6399
+ }), util.keepAlive(0));
6399
6400
  });
6400
6401
  }
6401
6402
  getNetworkMiniMetadatas$(networkId) {
6402
- return this.#chaindataProvider.getNetworkById$(networkId).pipe(rxjs.switchMap(network => chaindataProvider.isNetworkDot(network) ? this.getNetworkSpecVersion$(networkId).pipe(rxjs.switchMap(specVersion => specVersion === null ? rxjs.of([]) : this.getMiniMetadatas$(networkId, specVersion))) : rxjs.of([])));
6403
+ return this.#chaindataProvider.getNetworkById$(networkId).pipe(rxjs.switchMap(network => chaindataProvider.isNetworkDot(network) ? this.getNetworkSpecVersion$(networkId).pipe(rxjs.switchMap(specVersion => specVersion === null ? rxjs.of([]) : this.getMiniMetadatas$(networkId, specVersion))) : rxjs.of([])), rxjs.distinctUntilChanged(lodashEs.isEqual));
6403
6404
  }
6404
6405
  getNetworkSpecVersion$(networkId) {
6405
6406
  return rxjs.from(viem.withRetry(() => getSpecVersion(this.#chainConnectors.substrate, networkId), {
@@ -6284,10 +6284,7 @@ class BalancesProvider {
6284
6284
  ...b,
6285
6285
  status: "stale"
6286
6286
  } : b)).sort(sortByBalanceId)
6287
- })), startWith({
6288
- status: "initialising",
6289
- balances: this.getStoredBalances(addressesByTokenId)
6290
- }), distinctUntilChanged(isEqual));
6287
+ })), distinctUntilChanged(isEqual));
6291
6288
  }
6292
6289
  fetchBalances(addressesByTokenId) {
6293
6290
  // TODO: better
@@ -6380,17 +6377,21 @@ class BalancesProvider {
6380
6377
  }) => status === "initialising") ? "initialising" : "live",
6381
6378
  balances: results.flatMap(result => result.balances).sort(sortByBalanceId)
6382
6379
  };
6383
- }), distinctUntilChanged(isEqual),
6384
- // shareReplay + keepAlive allow for subscription to not restart as long as the inputs dont change
6385
- // for example, if another network is enabled/disabled
6380
+ }), distinctUntilChanged(isEqual), startWith({
6381
+ status: "initialising",
6382
+ balances: this.getStoredBalances(addressesByTokenId)
6383
+ }),
6384
+ // shareReplay + keepAlive allow for this network subscription to not restart as long as the inputs don't change
6385
+ // for example if another network is enabled/disabled, we don't want this subscription to be restarted
6386
+ // the unsubscribe/resubscribe is instantaneous when parameters parameters change, so keepAlive 0ms does the job
6386
6387
  shareReplay({
6387
6388
  refCount: true,
6388
6389
  bufferSize: 1
6389
- }), keepAlive(2_000));
6390
+ }), keepAlive(0));
6390
6391
  });
6391
6392
  }
6392
6393
  getNetworkMiniMetadatas$(networkId) {
6393
- return this.#chaindataProvider.getNetworkById$(networkId).pipe(switchMap(network => isNetworkDot(network) ? this.getNetworkSpecVersion$(networkId).pipe(switchMap(specVersion => specVersion === null ? of([]) : this.getMiniMetadatas$(networkId, specVersion))) : of([])));
6394
+ return this.#chaindataProvider.getNetworkById$(networkId).pipe(switchMap(network => isNetworkDot(network) ? this.getNetworkSpecVersion$(networkId).pipe(switchMap(specVersion => specVersion === null ? of([]) : this.getMiniMetadatas$(networkId, specVersion))) : of([])), distinctUntilChanged(isEqual));
6394
6395
  }
6395
6396
  getNetworkSpecVersion$(networkId) {
6396
6397
  return from(withRetry(() => getSpecVersion(this.#chainConnectors.substrate, networkId), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/balances",
3
- "version": "0.0.0-pr2075-20250713081649",
3
+ "version": "0.0.0-pr2075-20250713093608",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "GPL-3.0-or-later",
@@ -34,13 +34,13 @@
34
34
  "scale-ts": "^1.6.1",
35
35
  "viem": "^2.27.3",
36
36
  "zod": "^3.25.62",
37
- "@talismn/chain-connector": "0.0.0-pr2075-20250713081649",
38
- "@talismn/chain-connector-evm": "0.0.0-pr2075-20250713081649",
39
- "@talismn/chaindata-provider": "0.0.0-pr2075-20250713081649",
40
- "@talismn/sapi": "0.0.0-pr2075-20250713081649",
41
- "@talismn/scale": "0.0.0-pr2075-20250713081649",
42
- "@talismn/token-rates": "0.0.0-pr2075-20250713081649",
43
- "@talismn/util": "0.0.0-pr2075-20250713081649"
37
+ "@talismn/chain-connector": "0.0.0-pr2075-20250713093608",
38
+ "@talismn/chain-connector-evm": "0.0.0-pr2075-20250713093608",
39
+ "@talismn/chaindata-provider": "0.0.0-pr2075-20250713093608",
40
+ "@talismn/sapi": "0.0.0-pr2075-20250713093608",
41
+ "@talismn/scale": "0.0.0-pr2075-20250713093608",
42
+ "@talismn/token-rates": "0.0.0-pr2075-20250713093608",
43
+ "@talismn/util": "0.0.0-pr2075-20250713093608"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@polkadot/api-contract": "16.1.2",