@talismn/balances 3.0.3 → 3.0.4
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.d.mts +1772 -494
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +1782 -504
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -3938,28 +3938,26 @@ const findDTaoClaimablePlancks = (balances, { networkId, address, hotkey }) => {
|
|
|
3938
3938
|
return claimablePlancks > 0n ? claimablePlancks : null;
|
|
3939
3939
|
};
|
|
3940
3940
|
/**
|
|
3941
|
-
* Fetches the TAO each coldkey would
|
|
3941
|
+
* Fetches the TAO each coldkey would receive by claiming its validator beta baskets
|
|
3942
3942
|
* (Bittensor spec 441 "Root Reborn": root dividends accrue in per-validator escrow funds
|
|
3943
3943
|
* and must be claimed manually; the payout is TAO staked back onto the root position).
|
|
3944
3944
|
*
|
|
3945
|
-
* Amounts are
|
|
3946
|
-
*
|
|
3947
|
-
* `
|
|
3945
|
+
* Amounts are the chain's own claim preview (`redeemable_tao`, spec 468): the entitlement
|
|
3946
|
+
* minus the dust rows the claim would skip, which is the figure the chain compares to
|
|
3947
|
+
* `RootClaimableThreshold` and pays out. They are marked NAV quotes, so they move with
|
|
3948
|
+
* subnet pool prices as well as accrual. Attribution is per validator hotkey:
|
|
3949
|
+
* `get_root_basket_claim_previews` walks the chain's own coldkey→hotkeys index and so
|
|
3948
3950
|
* includes validators the coldkey fully unstaked from (entitlement survives unstaking).
|
|
3949
|
-
*
|
|
3950
|
-
* It is the only entitlement read: the coldkey-wide `get_root_basket_owed` total sums the
|
|
3951
|
-
* same positions, and claiming is per validator hotkey, so entitlement outside a position
|
|
3952
|
-
* would be unclaimable anyway.
|
|
3953
3951
|
*/
|
|
3954
3952
|
const fetchBasketClaims = async (connector, networkId, metadataRpc, addresses, at) => {
|
|
3955
3953
|
if (!addresses.length) return [];
|
|
3956
3954
|
const { unifiedMetadata, builder } = parseMetadataRpcCached(metadataRpc);
|
|
3957
|
-
if (!hasRuntimeApi(unifiedMetadata, "BetaBasketRuntimeApi", "
|
|
3955
|
+
if (!hasRuntimeApi(unifiedMetadata, "BetaBasketRuntimeApi", "get_root_basket_claim_previews")) return [];
|
|
3958
3956
|
try {
|
|
3959
|
-
return (await Promise.all(addresses.map(async (address) => [address, await fetchRuntimeCallResult(connector, networkId, builder, "BetaBasketRuntimeApi", "
|
|
3957
|
+
return (await Promise.all(addresses.map(async (address) => [address, await fetchRuntimeCallResult(connector, networkId, builder, "BetaBasketRuntimeApi", "get_root_basket_claim_previews", [address], at)]))).flatMap(([address, previews]) => previews.filter((preview) => preview.redeemable_tao > 0n).map((preview) => ({
|
|
3960
3958
|
address,
|
|
3961
|
-
hotkey,
|
|
3962
|
-
amount:
|
|
3959
|
+
hotkey: preview.hotkey,
|
|
3960
|
+
amount: preview.redeemable_tao
|
|
3963
3961
|
})));
|
|
3964
3962
|
} catch (cause) {
|
|
3965
3963
|
log_default.warn(`Failed to fetch beta basket claims on ${networkId}`, { cause });
|
|
@@ -4566,7 +4564,7 @@ const getData$3 = (metadataRpc) => {
|
|
|
4566
4564
|
},
|
|
4567
4565
|
{
|
|
4568
4566
|
runtimeApi: "BetaBasketRuntimeApi",
|
|
4569
|
-
methods: ["
|
|
4567
|
+
methods: ["get_root_basket_claim_previews"]
|
|
4570
4568
|
}
|
|
4571
4569
|
]);
|
|
4572
4570
|
return encodeMetadata(metadata);
|