bittensor.core.chain_data.utils#
Chain data helper functions and data.
Classes#
Generic enumeration. |
Functions#
|
Decodes an AccountId from bytes to a Base64 string using SS58 encoding. |
|
|
|
Decodes input_ data from SCALE encoding based on the specified type name and modifiers. |
|
Decodes SCALE encoded data to a dictionary based on the provided type string. |
|
Processes stake data to decode account IDs and convert stakes from rao to Balance objects. |
Module Contents#
- class bittensor.core.chain_data.utils.ChainDataType#
Bases:
enum.Enum
Generic enumeration.
Derive from this class to define new enumerations.
- AccountId = 10#
- AxonInfo = 16#
- ChainIdentity = 15#
- DelegateInfo = 3#
- DelegatedInfo = 5#
- DynamicInfo = 12#
- IPInfo = 7#
- MetagraphInfo = 14#
- NeuronInfo = 1#
- NeuronInfoLite = 4#
- ScheduledColdkeySwapInfo = 9#
- StakeInfo = 6#
- SubnetHyperparameters = 8#
- SubnetIdentity = 13#
- SubnetInfo = 2#
- SubnetState = 11#
- bittensor.core.chain_data.utils.decode_account_id(account_id_bytes)#
Decodes an AccountId from bytes to a Base64 string using SS58 encoding.
- bittensor.core.chain_data.utils.decode_metadata(metadata)#
- bittensor.core.chain_data.utils.from_scale_encoding(input_, type_name, is_vec=False, is_option=False)#
Decodes input_ data from SCALE encoding based on the specified type name and modifiers.
- Parameters:
input (Union[List[int], bytes, ScaleBytes]) – The input_ data to decode.
type_name (ChainDataType) – The type of data being decoded.
is_vec (bool) – Whether the data is a vector of the specified type. Default is
False
.is_option (bool) – Whether the data is an optional value of the specified type. Default is
False
.input_ (Union[list[int], bytes, scalecodec.base.ScaleBytes])
- Returns:
The decoded data as a dictionary, or
None
if the decoding fails.- Return type:
Optional[dict]
- bittensor.core.chain_data.utils.from_scale_encoding_using_type_string(input_, type_string)#
Decodes SCALE encoded data to a dictionary based on the provided type string.
- bittensor.core.chain_data.utils.process_stake_data(stake_data)#
Processes stake data to decode account IDs and convert stakes from rao to Balance objects.