@talismn/balances 0.0.0-pr2249-20251220031245 → 0.0.0-pr2249-20251222070519

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.
@@ -2310,17 +2310,10 @@ const calculatePendingRootClaimable = ({
2310
2310
  }
2311
2311
  const dynamicInfo = dynamicInfoByNetuid[netuid];
2312
2312
  const scaledAlphaPrice = dynamicInfo ? getScaledAlphaPrice(dynamicInfo.alpha_in, dynamicInfo.tao_in) : 0n;
2313
- // Calculate claimable = claimable_rate * root_stake
2314
- // Note: I96F32 is a fixed-point number format
2315
- // We'll need to handle the fixed-point multiplication correctly
2316
- // For now, we'll do a simple multiplication and assume I96F32 is represented
2317
- // as a bigint with appropriate scaling
2318
2313
 
2319
2314
  // Multiply claimable_rate by root_stake
2320
- // I96F32 multiplication: (a * b) / 2^32 to handle fixed-point
2321
- // But without knowing the exact scaling, we'll do simple multiplication
2322
- // This might need adjustment based on actual I96F32 implementation
2323
- const pendingRootClaim = stake * claimableRate / 2n ** 32n;
2315
+ // I96F32 multiplication: round((a * b) / 2^32)
2316
+ const pendingRootClaim = stake * claimableRate + (1n << 31n) >> 32n;
2324
2317
  pendingRootClaimBalances.push({
2325
2318
  address,
2326
2319
  tokenId: chaindataProvider.subDTaoTokenId(networkId, netuid, hotkey),
@@ -2310,17 +2310,10 @@ const calculatePendingRootClaimable = ({
2310
2310
  }
2311
2311
  const dynamicInfo = dynamicInfoByNetuid[netuid];
2312
2312
  const scaledAlphaPrice = dynamicInfo ? getScaledAlphaPrice(dynamicInfo.alpha_in, dynamicInfo.tao_in) : 0n;
2313
- // Calculate claimable = claimable_rate * root_stake
2314
- // Note: I96F32 is a fixed-point number format
2315
- // We'll need to handle the fixed-point multiplication correctly
2316
- // For now, we'll do a simple multiplication and assume I96F32 is represented
2317
- // as a bigint with appropriate scaling
2318
2313
 
2319
2314
  // Multiply claimable_rate by root_stake
2320
- // I96F32 multiplication: (a * b) / 2^32 to handle fixed-point
2321
- // But without knowing the exact scaling, we'll do simple multiplication
2322
- // This might need adjustment based on actual I96F32 implementation
2323
- const pendingRootClaim = stake * claimableRate / 2n ** 32n;
2315
+ // I96F32 multiplication: round((a * b) / 2^32)
2316
+ const pendingRootClaim = stake * claimableRate + (1n << 31n) >> 32n;
2324
2317
  pendingRootClaimBalances.push({
2325
2318
  address,
2326
2319
  tokenId: chaindataProvider.subDTaoTokenId(networkId, netuid, hotkey),
@@ -2301,17 +2301,10 @@ const calculatePendingRootClaimable = ({
2301
2301
  }
2302
2302
  const dynamicInfo = dynamicInfoByNetuid[netuid];
2303
2303
  const scaledAlphaPrice = dynamicInfo ? getScaledAlphaPrice(dynamicInfo.alpha_in, dynamicInfo.tao_in) : 0n;
2304
- // Calculate claimable = claimable_rate * root_stake
2305
- // Note: I96F32 is a fixed-point number format
2306
- // We'll need to handle the fixed-point multiplication correctly
2307
- // For now, we'll do a simple multiplication and assume I96F32 is represented
2308
- // as a bigint with appropriate scaling
2309
2304
 
2310
2305
  // Multiply claimable_rate by root_stake
2311
- // I96F32 multiplication: (a * b) / 2^32 to handle fixed-point
2312
- // But without knowing the exact scaling, we'll do simple multiplication
2313
- // This might need adjustment based on actual I96F32 implementation
2314
- const pendingRootClaim = stake * claimableRate / 2n ** 32n;
2306
+ // I96F32 multiplication: round((a * b) / 2^32)
2307
+ const pendingRootClaim = stake * claimableRate + (1n << 31n) >> 32n;
2315
2308
  pendingRootClaimBalances.push({
2316
2309
  address,
2317
2310
  tokenId: subDTaoTokenId(networkId, netuid, hotkey),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/balances",
3
- "version": "0.0.0-pr2249-20251220031245",
3
+ "version": "0.0.0-pr2249-20251222070519",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "GPL-3.0-or-later",
@@ -38,14 +38,14 @@
38
38
  "scale-ts": "^1.6.1",
39
39
  "viem": "^2.27.3",
40
40
  "zod": "^3.25.76",
41
+ "@talismn/chain-connectors": "0.0.0-pr2249-20251222070519",
42
+ "@talismn/chaindata-provider": "0.0.0-pr2249-20251222070519",
43
+ "@talismn/crypto": "0.3.0",
41
44
  "@talismn/sapi": "0.1.0",
42
45
  "@talismn/scale": "0.3.0",
43
- "@talismn/chain-connectors": "0.0.0-pr2249-20251220031245",
44
46
  "@talismn/solana": "0.0.5",
45
- "@talismn/util": "0.5.6",
46
- "@talismn/token-rates": "0.0.0-pr2249-20251220031245",
47
- "@talismn/chaindata-provider": "0.0.0-pr2249-20251220031245",
48
- "@talismn/crypto": "0.3.0"
47
+ "@talismn/token-rates": "0.0.0-pr2249-20251222070519",
48
+ "@talismn/util": "0.5.6"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@polkadot/api-contract": "16.1.2",