@talismn/balances 1.3.7 → 1.5.0

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 CHANGED
@@ -1,13 +1,13 @@
1
- import { TokenId, NetworkId, NetworkList, TokenList, TokenType, TokenOfType, Token, DotNetworkId, SolNetworkId, EthNetworkId, AnyMiniMetadata, ChaindataProvider, SubDTaoToken } from '@talismn/chaindata-provider';
1
+ import { TokenId, NetworkId, NetworkList, TokenList, TokenType, TokenOfType, DotNetworkId, SolNetworkId, Token, EthNetworkId, AnyMiniMetadata, ChaindataProvider, SubDTaoToken } from '@talismn/chaindata-provider';
2
2
  export { MINIMETADATA_VERSION } from '@talismn/chaindata-provider';
3
3
  import { Observable } from 'rxjs';
4
4
  import { IChainConnectorDot, IChainConnectorEth, IChainConnectorSol } from '@talismn/chain-connectors';
5
5
  import { TransactionInstruction } from '@solana/web3.js';
6
6
  import * as _talismn_token_rates from '@talismn/token-rates';
7
- import { TokenRates, TokenRateCurrency, TokenRatesList } from '@talismn/token-rates';
7
+ import { TokenRatesList, TokenRates, TokenRateCurrency } from '@talismn/token-rates';
8
8
  import { NonFunctionProperties } from '@talismn/util';
9
- import z from 'zod/v4';
10
9
  import { bittensor } from '@polkadot-api/descriptors';
10
+ import z from 'zod/v4';
11
11
 
12
12
  type Address = string;
13
13
 
@@ -320,6 +320,7 @@ declare class Balance {
320
320
  balancesConfig?: {
321
321
  "sol-native"?: Record<string, never> | undefined;
322
322
  "sol-spl"?: Record<string, never> | undefined;
323
+ "sol-token2022"?: Record<string, never> | undefined;
323
324
  } | undefined;
324
325
  } | null;
325
326
  get tokenId(): string;
@@ -511,6 +512,21 @@ declare class Balance {
511
512
  coingeckoId?: string | undefined;
512
513
  noDiscovery?: boolean | undefined;
513
514
  mirrorOf?: string | undefined;
515
+ } | {
516
+ id: string;
517
+ networkId: string;
518
+ decimals: number;
519
+ symbol: string;
520
+ type: "sol-token2022";
521
+ platform: "solana";
522
+ mintAddress: string;
523
+ isDefault?: boolean | undefined;
524
+ name?: string | undefined;
525
+ logo?: string | undefined;
526
+ coingeckoId?: string | undefined;
527
+ noDiscovery?: boolean | undefined;
528
+ mirrorOf?: string | undefined;
529
+ isTransferable?: boolean | undefined;
514
530
  } | null;
515
531
  get decimals(): number | null;
516
532
  get rates(): TokenRates | null;
@@ -1686,9 +1702,9 @@ declare const EvmErc20TokenConfigSchema: z.ZodObject<{
1686
1702
  }, z.core.$strict>;
1687
1703
  type EvmErc20TokenConfig = z.infer<typeof EvmErc20TokenConfigSchema>;
1688
1704
 
1689
- declare const MODULE_TYPE$b: "evm-erc20";
1705
+ declare const MODULE_TYPE$c: "evm-erc20";
1690
1706
 
1691
- declare const EvmErc20BalanceModule: IBalanceModule<typeof MODULE_TYPE$b, EvmErc20TokenConfig>;
1707
+ declare const EvmErc20BalanceModule: IBalanceModule<typeof MODULE_TYPE$c, EvmErc20TokenConfig>;
1692
1708
 
1693
1709
  declare const EvmNativeTokenConfigSchema: z.ZodObject<{
1694
1710
  symbol: z.ZodOptional<z.ZodString>;
@@ -1703,9 +1719,9 @@ declare const EvmNativeTokenConfigSchema: z.ZodObject<{
1703
1719
  }, z.core.$strict>;
1704
1720
  type EvmNativeTokenConfig = z.infer<typeof EvmNativeTokenConfigSchema>;
1705
1721
 
1706
- declare const MODULE_TYPE$a: "evm-native";
1722
+ declare const MODULE_TYPE$b: "evm-native";
1707
1723
 
1708
- declare const EvmNativeBalanceModule: IBalanceModule<typeof MODULE_TYPE$a, EvmNativeTokenConfig>;
1724
+ declare const EvmNativeBalanceModule: IBalanceModule<typeof MODULE_TYPE$b, EvmNativeTokenConfig>;
1709
1725
 
1710
1726
  declare const EvmUniswapV2TokenConfigSchema: z.ZodObject<{
1711
1727
  symbol: z.ZodOptional<z.ZodString>;
@@ -1721,9 +1737,9 @@ declare const EvmUniswapV2TokenConfigSchema: z.ZodObject<{
1721
1737
  }, z.core.$strict>;
1722
1738
  type EvmUniswapV2TokenConfig = z.infer<typeof EvmUniswapV2TokenConfigSchema>;
1723
1739
 
1724
- declare const MODULE_TYPE$9: "evm-uniswapv2";
1740
+ declare const MODULE_TYPE$a: "evm-uniswapv2";
1725
1741
 
1726
- declare const EvmUniswapV2BalanceModule: IBalanceModule<typeof MODULE_TYPE$9, EvmUniswapV2TokenConfig>;
1742
+ declare const EvmUniswapV2BalanceModule: IBalanceModule<typeof MODULE_TYPE$a, EvmUniswapV2TokenConfig>;
1727
1743
 
1728
1744
  declare const SolNativeTokenConfigSchema: z.ZodObject<{
1729
1745
  symbol: z.ZodOptional<z.ZodString>;
@@ -1738,9 +1754,9 @@ declare const SolNativeTokenConfigSchema: z.ZodObject<{
1738
1754
  }, z.core.$strict>;
1739
1755
  type SolNativeTokenConfig = z.infer<typeof SolNativeTokenConfigSchema>;
1740
1756
 
1741
- declare const MODULE_TYPE$8: "sol-native";
1757
+ declare const MODULE_TYPE$9: "sol-native";
1742
1758
 
1743
- declare const SolNativeBalanceModule: IBalanceModule<typeof MODULE_TYPE$8, SolNativeTokenConfig>;
1759
+ declare const SolNativeBalanceModule: IBalanceModule<typeof MODULE_TYPE$9, SolNativeTokenConfig>;
1744
1760
 
1745
1761
  declare const SolSplTokenConfigSchema: z.ZodObject<{
1746
1762
  symbol: z.ZodOptional<z.ZodString>;
@@ -1756,9 +1772,27 @@ declare const SolSplTokenConfigSchema: z.ZodObject<{
1756
1772
  }, z.core.$strict>;
1757
1773
  type SolSplTokenConfig = z.infer<typeof SolSplTokenConfigSchema>;
1758
1774
 
1759
- declare const MODULE_TYPE$7: "sol-spl";
1775
+ declare const MODULE_TYPE$8: "sol-spl";
1776
+
1777
+ declare const SolSplBalanceModule: IBalanceModule<typeof MODULE_TYPE$8, SolSplTokenConfig>;
1778
+
1779
+ declare const SolToken2022TokenConfigSchema: z.ZodObject<{
1780
+ symbol: z.ZodOptional<z.ZodString>;
1781
+ networkId: z.ZodOptional<z.ZodString>;
1782
+ isDefault: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
1783
+ decimals: z.ZodOptional<z.ZodInt>;
1784
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1785
+ logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1786
+ coingeckoId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1787
+ noDiscovery: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
1788
+ mirrorOf: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1789
+ mintAddress: z.ZodString;
1790
+ }, z.core.$strict>;
1791
+ type SolToken2022TokenConfig = z.infer<typeof SolToken2022TokenConfigSchema>;
1760
1792
 
1761
- declare const SolSplBalanceModule: IBalanceModule<typeof MODULE_TYPE$7, SolSplTokenConfig>;
1793
+ declare const MODULE_TYPE$7: "sol-token2022";
1794
+
1795
+ declare const SolToken2022BalanceModule: IBalanceModule<typeof MODULE_TYPE$7, SolToken2022TokenConfig>;
1762
1796
 
1763
1797
  declare const SubAssetsTokenConfigSchema: z.ZodObject<{
1764
1798
  symbol: z.ZodOptional<z.ZodString>;
@@ -1784,16 +1818,14 @@ declare const ALPHA_PRICE_SCALE: bigint;
1784
1818
  declare const getScaledAlphaPrice: (alphaIn: bigint, taoIn: bigint) => bigint;
1785
1819
  declare const alphaToTao: (alpha: bigint, scaledAlphaPrice: bigint) => bigint;
1786
1820
  declare const taoToAlpha: (tao: bigint, scaledAlphaPrice: bigint) => bigint;
1787
-
1788
1821
  /**
1789
- * To be used for tokens that don't have a coingecko id
1790
- *
1791
- * @param token
1792
- * @param tokenRates
1793
- * @param scaledAlphaPrice
1794
- * @returns
1822
+ * Like taoToAlpha but rounds up. Use for "must keep / must send at least this much alpha"
1823
+ * thresholds: the chain floors the alpha→TAO conversion when checking its TAO-denominated
1824
+ * minimums, so a floored alpha threshold can sit one planck below the real bound — an amount
1825
+ * meeting it exactly would still fail the on-chain check (or get the position force-swept).
1826
+ * Guarantees alphaToTao(taoToAlphaCeil(tao, price), price) >= tao.
1795
1827
  */
1796
- declare const getDTaoTokenRates: (token: SubDTaoToken, tokenRates: TokenRatesList, scaledAlphaPrice: string | bigint) => _talismn_token_rates.TokenRates | null;
1828
+ declare const taoToAlphaCeil: (tao: bigint, scaledAlphaPrice: bigint) => bigint;
1797
1829
 
1798
1830
  declare const SubDTaoTokenConfigSchema: z.ZodObject<{
1799
1831
  symbol: z.ZodOptional<z.ZodString>;
@@ -1810,6 +1842,13 @@ declare const SubDTaoTokenConfigSchema: z.ZodObject<{
1810
1842
  type SubDTaoTokenConfig = z.infer<typeof SubDTaoTokenConfigSchema>;
1811
1843
  type SubDTaoBalanceMeta = {
1812
1844
  scaledAlphaPrice: string;
1845
+ convictionLock?: SubDTaoConvictionLockMeta;
1846
+ };
1847
+ type SubDTaoConvictionLockType = "decaying" | "perpetual";
1848
+ type SubDTaoConvictionLockMeta = {
1849
+ type: "conviction-lock";
1850
+ hotkey: string;
1851
+ lockType: SubDTaoConvictionLockType;
1813
1852
  };
1814
1853
  type SubDTaoBalance = {
1815
1854
  address: string;
@@ -1817,12 +1856,57 @@ type SubDTaoBalance = {
1817
1856
  baseTokenId: string;
1818
1857
  stake: bigint;
1819
1858
  pendingRootClaim?: bigint;
1859
+ convictionLock?: SubDTaoConvictionLock;
1820
1860
  hotkey: string;
1821
1861
  netuid: number;
1822
1862
  scaledAlphaPrice: bigint;
1823
1863
  };
1864
+ type SubDTaoConvictionLock = {
1865
+ amount: bigint;
1866
+ hotkey: string;
1867
+ lockType: SubDTaoConvictionLockType;
1868
+ convictionRaw: string;
1869
+ };
1824
1870
  type GetDynamicInfosResult = (typeof bittensor)["descriptors"]["apis"]["SubnetInfoRuntimeApi"]["get_all_dynamic_info"][1];
1825
1871
  type GetStakeInfosResult = (typeof bittensor)["descriptors"]["apis"]["StakeInfoRuntimeApi"]["get_stake_info_for_coldkeys"][1];
1872
+ /**
1873
+ * `undefined` when the coldkey has no lock on the subnet; `null` is our own fetch-failure marker.
1874
+ * `conviction` is the raw U64F64 fixed-point value (shift right by 64 bits for the integer part),
1875
+ * despite decoding as a plain bigint.
1876
+ */
1877
+ type GetColdkeyLockResult = (typeof bittensor)["descriptors"]["apis"]["StakeInfoRuntimeApi"]["get_coldkey_lock"][1] | null;
1878
+
1879
+ declare const getConvictionLockLabel: (lockType: SubDTaoConvictionLockType) => string;
1880
+ type DTaoConvictionLockInfo = {
1881
+ amount: bigint;
1882
+ /** the hotkey the lock is keyed on: required to top-up (the chain rejects a different hotkey) */
1883
+ hotkey: string;
1884
+ lockType: SubDTaoConvictionLockType;
1885
+ label: string;
1886
+ };
1887
+ type BalanceLockLike = {
1888
+ amount: {
1889
+ planck: bigint;
1890
+ };
1891
+ meta?: unknown;
1892
+ };
1893
+ /**
1894
+ * Extracts the dtao conviction lock from a Balance locks array (Balance#locks), if any.
1895
+ * The locked amount cannot be unstaked until the lock decays (or ever, if perpetual);
1896
+ * transferring it is allowed but moves the lock and its conviction to the recipient.
1897
+ */
1898
+ declare const findDTaoConvictionLock: (locks: BalanceLockLike[] | null | undefined) => DTaoConvictionLockInfo | null;
1899
+
1900
+ /**
1901
+ * To be used for tokens that don't have a coingecko id
1902
+ *
1903
+ * @param token
1904
+ * @param tokenRates
1905
+ * @param scaledAlphaPrice
1906
+ * @param alphaPriceChange24h 24h change of the pool price (alpha vs TAO) in percent, when known
1907
+ * @returns
1908
+ */
1909
+ declare const getDTaoTokenRates: (token: SubDTaoToken, tokenRates: TokenRatesList, scaledAlphaPrice: string | bigint, alphaPriceChange24h?: number | null) => _talismn_token_rates.TokenRates | null;
1826
1910
 
1827
1911
  declare const MODULE_TYPE$5: "substrate-dtao";
1828
1912
  type TokenConfig = z.infer<typeof SubDTaoTokenConfigSchema>;
@@ -2017,6 +2101,17 @@ declare const BALANCE_MODULES: (IBalanceModule<"substrate-dtao", {
2017
2101
  coingeckoId?: string | undefined;
2018
2102
  noDiscovery?: boolean | undefined;
2019
2103
  mirrorOf?: string | undefined;
2104
+ }, unknown, unknown> | IBalanceModule<"sol-token2022", {
2105
+ mintAddress: string;
2106
+ symbol?: string | undefined;
2107
+ networkId?: string | undefined;
2108
+ isDefault?: boolean | undefined;
2109
+ decimals?: number | undefined;
2110
+ name?: string | undefined;
2111
+ logo?: string | undefined;
2112
+ coingeckoId?: string | undefined;
2113
+ noDiscovery?: boolean | undefined;
2114
+ mirrorOf?: string | undefined;
2020
2115
  }, unknown, unknown> | IBalanceModule<"substrate-assets", {
2021
2116
  assetId: string;
2022
2117
  symbol?: string | undefined;
@@ -2097,4 +2192,4 @@ declare const BALANCE_MODULES: (IBalanceModule<"substrate-dtao", {
2097
2192
  }>)[];
2098
2193
  type AnyBalanceModule = (typeof BALANCE_MODULES)[number];
2099
2194
 
2100
- export { ALPHA_PRICE_SCALE, type Address, type Amount, type AmountWithLabel, type AnyBalanceModule, BALANCE_MODULES, Balance, BalanceFormatter, type BalanceJson, type BalanceJsonList, type BalanceLockType, type BalanceSearchQuery, type BalanceSource, type BalanceStatus, type BalanceStatusTypes, type BalanceTransferType, BalanceValueGetter, Balances, BalancesProvider, type BalancesResult, type BalancesStorage, type ChainConnectors, Change24hCurrencyFormatter, EvmErc20BalanceModule, type EvmErc20TokenConfig, EvmErc20TokenConfigSchema, EvmNativeBalanceModule, type EvmNativeTokenConfig, EvmNativeTokenConfigSchema, EvmUniswapV2BalanceModule, type EvmUniswapV2TokenConfig, EvmUniswapV2TokenConfigSchema, type ExtraAmount, type FetchBalanceErrors, type FetchBalanceResults, FiatSumBalancesFormatter, type GetDynamicInfosResult, type GetStakeInfosResult, type HydrateDb, type IBalance, type IBalanceModule, type LockedAmount, type MiniMetadata, type NarrowBalanceType, PlanckSumBalancesFormatter, type PlatformConnector, SolNativeBalanceModule, type SolNativeTokenConfig, SolNativeTokenConfigSchema, SolSplBalanceModule, type SolSplTokenConfig, SolSplTokenConfigSchema, SubAssetsBalanceModule, type SubAssetsTokenConfig, SubAssetsTokenConfigSchema, type SubDTaoBalance, type SubDTaoBalanceMeta, SubDTaoBalanceModule, type SubDTaoTokenConfig, SubDTaoTokenConfigSchema, SubForeignAssetsBalanceModule, type SubForeignAssetsTokenConfig, SubForeignAssetsTokenConfigSchema, SubHydrationBalanceModule, type SubHydrationTokenConfig, SubHydrationTokenConfigSchema, SubNativeBalanceModule, type SubNativeMiniMetadataExtra, SubNativeMiniMetadataExtraSchema, type SubNativeModuleConfig, SubNativeModuleConfigSchema, type SubNativeTokenConfig, SubNativeTokenConfigSchema, SubPsp22BalanceModule, type SubPsp22TokenConfig, SubPsp22TokenConfigSchema, SubTokensBalanceModule, type SubTokensMiniMetadataExtra, SubTokensMiniMetadataExtraSchema, type SubTokensModuleConfig, SubTokensModuleConfigSchema, type SubTokensTokenConfig, SubTokensTokenConfigSchema, type SubscriptionCallback, SumBalancesFormatter, TAO_DECIMALS, type TokenPlatform, type TokensWithAddresses, type UnsubscribeFn, abiMulticall, alphaToTao, deriveMiniMetadataId, erc20BalancesAggregatorAbi, excludeFromFeePayableLocks, excludeFromTransferableAmount, filterBaseLocks, filterMirrorTokens, getBalanceId, getDTaoTokenRates, getLockTitle, getLockedType, getScaledAlphaPrice, getValueId, includeInTotalExtraAmount, taoToAlpha, uniswapV2PairAbi };
2195
+ export { ALPHA_PRICE_SCALE, type Address, type Amount, type AmountWithLabel, type AnyBalanceModule, BALANCE_MODULES, Balance, BalanceFormatter, type BalanceJson, type BalanceJsonList, type BalanceLockType, type BalanceSearchQuery, type BalanceSource, type BalanceStatus, type BalanceStatusTypes, type BalanceTransferType, BalanceValueGetter, Balances, BalancesProvider, type BalancesResult, type BalancesStorage, type ChainConnectors, Change24hCurrencyFormatter, type DTaoConvictionLockInfo, EvmErc20BalanceModule, type EvmErc20TokenConfig, EvmErc20TokenConfigSchema, EvmNativeBalanceModule, type EvmNativeTokenConfig, EvmNativeTokenConfigSchema, EvmUniswapV2BalanceModule, type EvmUniswapV2TokenConfig, EvmUniswapV2TokenConfigSchema, type ExtraAmount, type FetchBalanceErrors, type FetchBalanceResults, FiatSumBalancesFormatter, type GetColdkeyLockResult, type GetDynamicInfosResult, type GetStakeInfosResult, type HydrateDb, type IBalance, type IBalanceModule, type LockedAmount, type MiniMetadata, type NarrowBalanceType, PlanckSumBalancesFormatter, type PlatformConnector, SolNativeBalanceModule, type SolNativeTokenConfig, SolNativeTokenConfigSchema, SolSplBalanceModule, type SolSplTokenConfig, SolSplTokenConfigSchema, SolToken2022BalanceModule, type SolToken2022TokenConfig, SolToken2022TokenConfigSchema, SubAssetsBalanceModule, type SubAssetsTokenConfig, SubAssetsTokenConfigSchema, type SubDTaoBalance, type SubDTaoBalanceMeta, SubDTaoBalanceModule, type SubDTaoConvictionLock, type SubDTaoConvictionLockMeta, type SubDTaoConvictionLockType, type SubDTaoTokenConfig, SubDTaoTokenConfigSchema, SubForeignAssetsBalanceModule, type SubForeignAssetsTokenConfig, SubForeignAssetsTokenConfigSchema, SubHydrationBalanceModule, type SubHydrationTokenConfig, SubHydrationTokenConfigSchema, SubNativeBalanceModule, type SubNativeMiniMetadataExtra, SubNativeMiniMetadataExtraSchema, type SubNativeModuleConfig, SubNativeModuleConfigSchema, type SubNativeTokenConfig, SubNativeTokenConfigSchema, SubPsp22BalanceModule, type SubPsp22TokenConfig, SubPsp22TokenConfigSchema, SubTokensBalanceModule, type SubTokensMiniMetadataExtra, SubTokensMiniMetadataExtraSchema, type SubTokensModuleConfig, SubTokensModuleConfigSchema, type SubTokensTokenConfig, SubTokensTokenConfigSchema, type SubscriptionCallback, SumBalancesFormatter, TAO_DECIMALS, type TokenPlatform, type TokensWithAddresses, type UnsubscribeFn, abiMulticall, alphaToTao, deriveMiniMetadataId, erc20BalancesAggregatorAbi, excludeFromFeePayableLocks, excludeFromTransferableAmount, filterBaseLocks, filterMirrorTokens, findDTaoConvictionLock, getBalanceId, getConvictionLockLabel, getDTaoTokenRates, getLockTitle, getLockedType, getScaledAlphaPrice, getValueId, includeInTotalExtraAmount, taoToAlpha, taoToAlphaCeil, uniswapV2PairAbi };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { TokenId, NetworkId, NetworkList, TokenList, TokenType, TokenOfType, Token, DotNetworkId, SolNetworkId, EthNetworkId, AnyMiniMetadata, ChaindataProvider, SubDTaoToken } from '@talismn/chaindata-provider';
1
+ import { TokenId, NetworkId, NetworkList, TokenList, TokenType, TokenOfType, DotNetworkId, SolNetworkId, Token, EthNetworkId, AnyMiniMetadata, ChaindataProvider, SubDTaoToken } from '@talismn/chaindata-provider';
2
2
  export { MINIMETADATA_VERSION } from '@talismn/chaindata-provider';
3
3
  import { Observable } from 'rxjs';
4
4
  import { IChainConnectorDot, IChainConnectorEth, IChainConnectorSol } from '@talismn/chain-connectors';
5
5
  import { TransactionInstruction } from '@solana/web3.js';
6
6
  import * as _talismn_token_rates from '@talismn/token-rates';
7
- import { TokenRates, TokenRateCurrency, TokenRatesList } from '@talismn/token-rates';
7
+ import { TokenRatesList, TokenRates, TokenRateCurrency } from '@talismn/token-rates';
8
8
  import { NonFunctionProperties } from '@talismn/util';
9
- import z from 'zod/v4';
10
9
  import { bittensor } from '@polkadot-api/descriptors';
10
+ import z from 'zod/v4';
11
11
 
12
12
  type Address = string;
13
13
 
@@ -320,6 +320,7 @@ declare class Balance {
320
320
  balancesConfig?: {
321
321
  "sol-native"?: Record<string, never> | undefined;
322
322
  "sol-spl"?: Record<string, never> | undefined;
323
+ "sol-token2022"?: Record<string, never> | undefined;
323
324
  } | undefined;
324
325
  } | null;
325
326
  get tokenId(): string;
@@ -511,6 +512,21 @@ declare class Balance {
511
512
  coingeckoId?: string | undefined;
512
513
  noDiscovery?: boolean | undefined;
513
514
  mirrorOf?: string | undefined;
515
+ } | {
516
+ id: string;
517
+ networkId: string;
518
+ decimals: number;
519
+ symbol: string;
520
+ type: "sol-token2022";
521
+ platform: "solana";
522
+ mintAddress: string;
523
+ isDefault?: boolean | undefined;
524
+ name?: string | undefined;
525
+ logo?: string | undefined;
526
+ coingeckoId?: string | undefined;
527
+ noDiscovery?: boolean | undefined;
528
+ mirrorOf?: string | undefined;
529
+ isTransferable?: boolean | undefined;
514
530
  } | null;
515
531
  get decimals(): number | null;
516
532
  get rates(): TokenRates | null;
@@ -1686,9 +1702,9 @@ declare const EvmErc20TokenConfigSchema: z.ZodObject<{
1686
1702
  }, z.core.$strict>;
1687
1703
  type EvmErc20TokenConfig = z.infer<typeof EvmErc20TokenConfigSchema>;
1688
1704
 
1689
- declare const MODULE_TYPE$b: "evm-erc20";
1705
+ declare const MODULE_TYPE$c: "evm-erc20";
1690
1706
 
1691
- declare const EvmErc20BalanceModule: IBalanceModule<typeof MODULE_TYPE$b, EvmErc20TokenConfig>;
1707
+ declare const EvmErc20BalanceModule: IBalanceModule<typeof MODULE_TYPE$c, EvmErc20TokenConfig>;
1692
1708
 
1693
1709
  declare const EvmNativeTokenConfigSchema: z.ZodObject<{
1694
1710
  symbol: z.ZodOptional<z.ZodString>;
@@ -1703,9 +1719,9 @@ declare const EvmNativeTokenConfigSchema: z.ZodObject<{
1703
1719
  }, z.core.$strict>;
1704
1720
  type EvmNativeTokenConfig = z.infer<typeof EvmNativeTokenConfigSchema>;
1705
1721
 
1706
- declare const MODULE_TYPE$a: "evm-native";
1722
+ declare const MODULE_TYPE$b: "evm-native";
1707
1723
 
1708
- declare const EvmNativeBalanceModule: IBalanceModule<typeof MODULE_TYPE$a, EvmNativeTokenConfig>;
1724
+ declare const EvmNativeBalanceModule: IBalanceModule<typeof MODULE_TYPE$b, EvmNativeTokenConfig>;
1709
1725
 
1710
1726
  declare const EvmUniswapV2TokenConfigSchema: z.ZodObject<{
1711
1727
  symbol: z.ZodOptional<z.ZodString>;
@@ -1721,9 +1737,9 @@ declare const EvmUniswapV2TokenConfigSchema: z.ZodObject<{
1721
1737
  }, z.core.$strict>;
1722
1738
  type EvmUniswapV2TokenConfig = z.infer<typeof EvmUniswapV2TokenConfigSchema>;
1723
1739
 
1724
- declare const MODULE_TYPE$9: "evm-uniswapv2";
1740
+ declare const MODULE_TYPE$a: "evm-uniswapv2";
1725
1741
 
1726
- declare const EvmUniswapV2BalanceModule: IBalanceModule<typeof MODULE_TYPE$9, EvmUniswapV2TokenConfig>;
1742
+ declare const EvmUniswapV2BalanceModule: IBalanceModule<typeof MODULE_TYPE$a, EvmUniswapV2TokenConfig>;
1727
1743
 
1728
1744
  declare const SolNativeTokenConfigSchema: z.ZodObject<{
1729
1745
  symbol: z.ZodOptional<z.ZodString>;
@@ -1738,9 +1754,9 @@ declare const SolNativeTokenConfigSchema: z.ZodObject<{
1738
1754
  }, z.core.$strict>;
1739
1755
  type SolNativeTokenConfig = z.infer<typeof SolNativeTokenConfigSchema>;
1740
1756
 
1741
- declare const MODULE_TYPE$8: "sol-native";
1757
+ declare const MODULE_TYPE$9: "sol-native";
1742
1758
 
1743
- declare const SolNativeBalanceModule: IBalanceModule<typeof MODULE_TYPE$8, SolNativeTokenConfig>;
1759
+ declare const SolNativeBalanceModule: IBalanceModule<typeof MODULE_TYPE$9, SolNativeTokenConfig>;
1744
1760
 
1745
1761
  declare const SolSplTokenConfigSchema: z.ZodObject<{
1746
1762
  symbol: z.ZodOptional<z.ZodString>;
@@ -1756,9 +1772,27 @@ declare const SolSplTokenConfigSchema: z.ZodObject<{
1756
1772
  }, z.core.$strict>;
1757
1773
  type SolSplTokenConfig = z.infer<typeof SolSplTokenConfigSchema>;
1758
1774
 
1759
- declare const MODULE_TYPE$7: "sol-spl";
1775
+ declare const MODULE_TYPE$8: "sol-spl";
1776
+
1777
+ declare const SolSplBalanceModule: IBalanceModule<typeof MODULE_TYPE$8, SolSplTokenConfig>;
1778
+
1779
+ declare const SolToken2022TokenConfigSchema: z.ZodObject<{
1780
+ symbol: z.ZodOptional<z.ZodString>;
1781
+ networkId: z.ZodOptional<z.ZodString>;
1782
+ isDefault: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
1783
+ decimals: z.ZodOptional<z.ZodInt>;
1784
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1785
+ logo: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1786
+ coingeckoId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1787
+ noDiscovery: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
1788
+ mirrorOf: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1789
+ mintAddress: z.ZodString;
1790
+ }, z.core.$strict>;
1791
+ type SolToken2022TokenConfig = z.infer<typeof SolToken2022TokenConfigSchema>;
1760
1792
 
1761
- declare const SolSplBalanceModule: IBalanceModule<typeof MODULE_TYPE$7, SolSplTokenConfig>;
1793
+ declare const MODULE_TYPE$7: "sol-token2022";
1794
+
1795
+ declare const SolToken2022BalanceModule: IBalanceModule<typeof MODULE_TYPE$7, SolToken2022TokenConfig>;
1762
1796
 
1763
1797
  declare const SubAssetsTokenConfigSchema: z.ZodObject<{
1764
1798
  symbol: z.ZodOptional<z.ZodString>;
@@ -1784,16 +1818,14 @@ declare const ALPHA_PRICE_SCALE: bigint;
1784
1818
  declare const getScaledAlphaPrice: (alphaIn: bigint, taoIn: bigint) => bigint;
1785
1819
  declare const alphaToTao: (alpha: bigint, scaledAlphaPrice: bigint) => bigint;
1786
1820
  declare const taoToAlpha: (tao: bigint, scaledAlphaPrice: bigint) => bigint;
1787
-
1788
1821
  /**
1789
- * To be used for tokens that don't have a coingecko id
1790
- *
1791
- * @param token
1792
- * @param tokenRates
1793
- * @param scaledAlphaPrice
1794
- * @returns
1822
+ * Like taoToAlpha but rounds up. Use for "must keep / must send at least this much alpha"
1823
+ * thresholds: the chain floors the alpha→TAO conversion when checking its TAO-denominated
1824
+ * minimums, so a floored alpha threshold can sit one planck below the real bound — an amount
1825
+ * meeting it exactly would still fail the on-chain check (or get the position force-swept).
1826
+ * Guarantees alphaToTao(taoToAlphaCeil(tao, price), price) >= tao.
1795
1827
  */
1796
- declare const getDTaoTokenRates: (token: SubDTaoToken, tokenRates: TokenRatesList, scaledAlphaPrice: string | bigint) => _talismn_token_rates.TokenRates | null;
1828
+ declare const taoToAlphaCeil: (tao: bigint, scaledAlphaPrice: bigint) => bigint;
1797
1829
 
1798
1830
  declare const SubDTaoTokenConfigSchema: z.ZodObject<{
1799
1831
  symbol: z.ZodOptional<z.ZodString>;
@@ -1810,6 +1842,13 @@ declare const SubDTaoTokenConfigSchema: z.ZodObject<{
1810
1842
  type SubDTaoTokenConfig = z.infer<typeof SubDTaoTokenConfigSchema>;
1811
1843
  type SubDTaoBalanceMeta = {
1812
1844
  scaledAlphaPrice: string;
1845
+ convictionLock?: SubDTaoConvictionLockMeta;
1846
+ };
1847
+ type SubDTaoConvictionLockType = "decaying" | "perpetual";
1848
+ type SubDTaoConvictionLockMeta = {
1849
+ type: "conviction-lock";
1850
+ hotkey: string;
1851
+ lockType: SubDTaoConvictionLockType;
1813
1852
  };
1814
1853
  type SubDTaoBalance = {
1815
1854
  address: string;
@@ -1817,12 +1856,57 @@ type SubDTaoBalance = {
1817
1856
  baseTokenId: string;
1818
1857
  stake: bigint;
1819
1858
  pendingRootClaim?: bigint;
1859
+ convictionLock?: SubDTaoConvictionLock;
1820
1860
  hotkey: string;
1821
1861
  netuid: number;
1822
1862
  scaledAlphaPrice: bigint;
1823
1863
  };
1864
+ type SubDTaoConvictionLock = {
1865
+ amount: bigint;
1866
+ hotkey: string;
1867
+ lockType: SubDTaoConvictionLockType;
1868
+ convictionRaw: string;
1869
+ };
1824
1870
  type GetDynamicInfosResult = (typeof bittensor)["descriptors"]["apis"]["SubnetInfoRuntimeApi"]["get_all_dynamic_info"][1];
1825
1871
  type GetStakeInfosResult = (typeof bittensor)["descriptors"]["apis"]["StakeInfoRuntimeApi"]["get_stake_info_for_coldkeys"][1];
1872
+ /**
1873
+ * `undefined` when the coldkey has no lock on the subnet; `null` is our own fetch-failure marker.
1874
+ * `conviction` is the raw U64F64 fixed-point value (shift right by 64 bits for the integer part),
1875
+ * despite decoding as a plain bigint.
1876
+ */
1877
+ type GetColdkeyLockResult = (typeof bittensor)["descriptors"]["apis"]["StakeInfoRuntimeApi"]["get_coldkey_lock"][1] | null;
1878
+
1879
+ declare const getConvictionLockLabel: (lockType: SubDTaoConvictionLockType) => string;
1880
+ type DTaoConvictionLockInfo = {
1881
+ amount: bigint;
1882
+ /** the hotkey the lock is keyed on: required to top-up (the chain rejects a different hotkey) */
1883
+ hotkey: string;
1884
+ lockType: SubDTaoConvictionLockType;
1885
+ label: string;
1886
+ };
1887
+ type BalanceLockLike = {
1888
+ amount: {
1889
+ planck: bigint;
1890
+ };
1891
+ meta?: unknown;
1892
+ };
1893
+ /**
1894
+ * Extracts the dtao conviction lock from a Balance locks array (Balance#locks), if any.
1895
+ * The locked amount cannot be unstaked until the lock decays (or ever, if perpetual);
1896
+ * transferring it is allowed but moves the lock and its conviction to the recipient.
1897
+ */
1898
+ declare const findDTaoConvictionLock: (locks: BalanceLockLike[] | null | undefined) => DTaoConvictionLockInfo | null;
1899
+
1900
+ /**
1901
+ * To be used for tokens that don't have a coingecko id
1902
+ *
1903
+ * @param token
1904
+ * @param tokenRates
1905
+ * @param scaledAlphaPrice
1906
+ * @param alphaPriceChange24h 24h change of the pool price (alpha vs TAO) in percent, when known
1907
+ * @returns
1908
+ */
1909
+ declare const getDTaoTokenRates: (token: SubDTaoToken, tokenRates: TokenRatesList, scaledAlphaPrice: string | bigint, alphaPriceChange24h?: number | null) => _talismn_token_rates.TokenRates | null;
1826
1910
 
1827
1911
  declare const MODULE_TYPE$5: "substrate-dtao";
1828
1912
  type TokenConfig = z.infer<typeof SubDTaoTokenConfigSchema>;
@@ -2017,6 +2101,17 @@ declare const BALANCE_MODULES: (IBalanceModule<"substrate-dtao", {
2017
2101
  coingeckoId?: string | undefined;
2018
2102
  noDiscovery?: boolean | undefined;
2019
2103
  mirrorOf?: string | undefined;
2104
+ }, unknown, unknown> | IBalanceModule<"sol-token2022", {
2105
+ mintAddress: string;
2106
+ symbol?: string | undefined;
2107
+ networkId?: string | undefined;
2108
+ isDefault?: boolean | undefined;
2109
+ decimals?: number | undefined;
2110
+ name?: string | undefined;
2111
+ logo?: string | undefined;
2112
+ coingeckoId?: string | undefined;
2113
+ noDiscovery?: boolean | undefined;
2114
+ mirrorOf?: string | undefined;
2020
2115
  }, unknown, unknown> | IBalanceModule<"substrate-assets", {
2021
2116
  assetId: string;
2022
2117
  symbol?: string | undefined;
@@ -2097,4 +2192,4 @@ declare const BALANCE_MODULES: (IBalanceModule<"substrate-dtao", {
2097
2192
  }>)[];
2098
2193
  type AnyBalanceModule = (typeof BALANCE_MODULES)[number];
2099
2194
 
2100
- export { ALPHA_PRICE_SCALE, type Address, type Amount, type AmountWithLabel, type AnyBalanceModule, BALANCE_MODULES, Balance, BalanceFormatter, type BalanceJson, type BalanceJsonList, type BalanceLockType, type BalanceSearchQuery, type BalanceSource, type BalanceStatus, type BalanceStatusTypes, type BalanceTransferType, BalanceValueGetter, Balances, BalancesProvider, type BalancesResult, type BalancesStorage, type ChainConnectors, Change24hCurrencyFormatter, EvmErc20BalanceModule, type EvmErc20TokenConfig, EvmErc20TokenConfigSchema, EvmNativeBalanceModule, type EvmNativeTokenConfig, EvmNativeTokenConfigSchema, EvmUniswapV2BalanceModule, type EvmUniswapV2TokenConfig, EvmUniswapV2TokenConfigSchema, type ExtraAmount, type FetchBalanceErrors, type FetchBalanceResults, FiatSumBalancesFormatter, type GetDynamicInfosResult, type GetStakeInfosResult, type HydrateDb, type IBalance, type IBalanceModule, type LockedAmount, type MiniMetadata, type NarrowBalanceType, PlanckSumBalancesFormatter, type PlatformConnector, SolNativeBalanceModule, type SolNativeTokenConfig, SolNativeTokenConfigSchema, SolSplBalanceModule, type SolSplTokenConfig, SolSplTokenConfigSchema, SubAssetsBalanceModule, type SubAssetsTokenConfig, SubAssetsTokenConfigSchema, type SubDTaoBalance, type SubDTaoBalanceMeta, SubDTaoBalanceModule, type SubDTaoTokenConfig, SubDTaoTokenConfigSchema, SubForeignAssetsBalanceModule, type SubForeignAssetsTokenConfig, SubForeignAssetsTokenConfigSchema, SubHydrationBalanceModule, type SubHydrationTokenConfig, SubHydrationTokenConfigSchema, SubNativeBalanceModule, type SubNativeMiniMetadataExtra, SubNativeMiniMetadataExtraSchema, type SubNativeModuleConfig, SubNativeModuleConfigSchema, type SubNativeTokenConfig, SubNativeTokenConfigSchema, SubPsp22BalanceModule, type SubPsp22TokenConfig, SubPsp22TokenConfigSchema, SubTokensBalanceModule, type SubTokensMiniMetadataExtra, SubTokensMiniMetadataExtraSchema, type SubTokensModuleConfig, SubTokensModuleConfigSchema, type SubTokensTokenConfig, SubTokensTokenConfigSchema, type SubscriptionCallback, SumBalancesFormatter, TAO_DECIMALS, type TokenPlatform, type TokensWithAddresses, type UnsubscribeFn, abiMulticall, alphaToTao, deriveMiniMetadataId, erc20BalancesAggregatorAbi, excludeFromFeePayableLocks, excludeFromTransferableAmount, filterBaseLocks, filterMirrorTokens, getBalanceId, getDTaoTokenRates, getLockTitle, getLockedType, getScaledAlphaPrice, getValueId, includeInTotalExtraAmount, taoToAlpha, uniswapV2PairAbi };
2195
+ export { ALPHA_PRICE_SCALE, type Address, type Amount, type AmountWithLabel, type AnyBalanceModule, BALANCE_MODULES, Balance, BalanceFormatter, type BalanceJson, type BalanceJsonList, type BalanceLockType, type BalanceSearchQuery, type BalanceSource, type BalanceStatus, type BalanceStatusTypes, type BalanceTransferType, BalanceValueGetter, Balances, BalancesProvider, type BalancesResult, type BalancesStorage, type ChainConnectors, Change24hCurrencyFormatter, type DTaoConvictionLockInfo, EvmErc20BalanceModule, type EvmErc20TokenConfig, EvmErc20TokenConfigSchema, EvmNativeBalanceModule, type EvmNativeTokenConfig, EvmNativeTokenConfigSchema, EvmUniswapV2BalanceModule, type EvmUniswapV2TokenConfig, EvmUniswapV2TokenConfigSchema, type ExtraAmount, type FetchBalanceErrors, type FetchBalanceResults, FiatSumBalancesFormatter, type GetColdkeyLockResult, type GetDynamicInfosResult, type GetStakeInfosResult, type HydrateDb, type IBalance, type IBalanceModule, type LockedAmount, type MiniMetadata, type NarrowBalanceType, PlanckSumBalancesFormatter, type PlatformConnector, SolNativeBalanceModule, type SolNativeTokenConfig, SolNativeTokenConfigSchema, SolSplBalanceModule, type SolSplTokenConfig, SolSplTokenConfigSchema, SolToken2022BalanceModule, type SolToken2022TokenConfig, SolToken2022TokenConfigSchema, SubAssetsBalanceModule, type SubAssetsTokenConfig, SubAssetsTokenConfigSchema, type SubDTaoBalance, type SubDTaoBalanceMeta, SubDTaoBalanceModule, type SubDTaoConvictionLock, type SubDTaoConvictionLockMeta, type SubDTaoConvictionLockType, type SubDTaoTokenConfig, SubDTaoTokenConfigSchema, SubForeignAssetsBalanceModule, type SubForeignAssetsTokenConfig, SubForeignAssetsTokenConfigSchema, SubHydrationBalanceModule, type SubHydrationTokenConfig, SubHydrationTokenConfigSchema, SubNativeBalanceModule, type SubNativeMiniMetadataExtra, SubNativeMiniMetadataExtraSchema, type SubNativeModuleConfig, SubNativeModuleConfigSchema, type SubNativeTokenConfig, SubNativeTokenConfigSchema, SubPsp22BalanceModule, type SubPsp22TokenConfig, SubPsp22TokenConfigSchema, SubTokensBalanceModule, type SubTokensMiniMetadataExtra, SubTokensMiniMetadataExtraSchema, type SubTokensModuleConfig, SubTokensModuleConfigSchema, type SubTokensTokenConfig, SubTokensTokenConfigSchema, type SubscriptionCallback, SumBalancesFormatter, TAO_DECIMALS, type TokenPlatform, type TokensWithAddresses, type UnsubscribeFn, abiMulticall, alphaToTao, deriveMiniMetadataId, erc20BalancesAggregatorAbi, excludeFromFeePayableLocks, excludeFromTransferableAmount, filterBaseLocks, filterMirrorTokens, findDTaoConvictionLock, getBalanceId, getConvictionLockLabel, getDTaoTokenRates, getLockTitle, getLockedType, getScaledAlphaPrice, getValueId, includeInTotalExtraAmount, taoToAlpha, taoToAlphaCeil, uniswapV2PairAbi };