@talismn/balances 3.1.1 → 3.1.2

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.
package/dist/index.mjs CHANGED
@@ -2495,6 +2495,12 @@ const createBalanceStabilizer = (isEffectivelyEqual, options) => {
2495
2495
  };
2496
2496
  };
2497
2497
  /**
2498
+ * Cross-module drift tolerance (see classifySmallAmountDrift): amounts moving by no more
2499
+ * than this classify as drift and re-emit at most once per stabilizer refresh interval.
2500
+ * Kept tight — a real incoming transfer above 0.01% of the position emits immediately.
2501
+ */
2502
+ const GENERIC_DRIFT_TOLERANCE_BPS = 1n;
2503
+ /**
2498
2504
  * Default cross-module drift classifier: balances whose SHAPE is identical (same
2499
2505
  * address/token/status, same value set with same types/labels/metas) but whose amounts
2500
2506
  * moved by no more than `toleranceBps` classify as "drift" — continuously-moving
@@ -4481,16 +4487,10 @@ const getTransferCallData$5 = ({ from, to, value, token, metadataRpc }) => {
4481
4487
  * dividend accrual on (nearly) every block; the display is informational */
4482
4488
  const CLAIM_DRIFT_TOLERANCE_BPS = 100n;
4483
4489
  /**
4484
- * subnet staking positions auto-compound: dividend injections land once per subnet tempo
4485
- * (staggered across subnets, so with many positions SOME position bumps on nearly every
4486
- * poll). Moves up to this size classify as drift (surfaced within the refresh interval);
4487
- * anything larger (a real stake/unstake) emits immediately.
4488
- */
4489
- const STAKE_DRIFT_TOLERANCE_BPS = 100n;
4490
- /**
4491
4490
  * dtao balances embed values that drift on (nearly) every block even when the user's
4492
- * position is untouched: staking positions auto-compound, basket claimable quotes move,
4493
- * and conviction locks decay.
4491
+ * position is untouched: basket claimable quotes move and conviction locks decay.
4492
+ * Stake itself only moves on dividend injections, once per subnet tempo, so every stake
4493
+ * move emits immediately.
4494
4494
  *
4495
4495
  * Without special handling, every 6s poll re-emits the full result set, which defeats
4496
4496
  * every distinctUntilChanged stage downstream and forces the whole pipeline
@@ -4541,7 +4541,6 @@ const classifyValue = (previous, next) => {
4541
4541
  if (previous.label === "Claimable rewards") {
4542
4542
  if (!isWithinDriftTolerance(previous.amount, next.amount, CLAIM_DRIFT_TOLERANCE_BPS)) drift = true;
4543
4543
  } else if (previousLock) drift = true;
4544
- else if (isWithinDriftTolerance(previous.amount, next.amount, STAKE_DRIFT_TOLERANCE_BPS)) drift = true;
4545
4544
  else return changed(`amount ${previous.amount}→${next.amount}`);
4546
4545
  }
4547
4546
  return { equivalence: drift ? "drift" : "equal" };
@@ -6824,12 +6823,6 @@ const fetchMiniMetadatas = async (chainConnector, chaindataProvider, chainId, sp
6824
6823
  };
6825
6824
  //#endregion
6826
6825
  //#region src/BalancesProvider.ts
6827
- /**
6828
- * Cross-module drift tolerance (see classifySmallAmountDrift): amounts moving by no more
6829
- * than this classify as drift and re-emit at most once per stabilizer refresh interval.
6830
- * Kept tight — a real incoming transfer above 0.1% of the position emits immediately.
6831
- */
6832
- const GENERIC_DRIFT_TOLERANCE_BPS = 10n;
6833
6826
  /** Delay before resubscribing a substrate module stream that errored: 2s, doubling, capped at 1min */
6834
6827
  const substrateModuleRetryDelay = (retryCount) => timer(Math.min(6e4, 2e3 * 2 ** (retryCount - 1)));
6835
6828
  const DEFAULT_STORAGE = {