bittensor.core.chain_data.utils#
Chain data helper functions and data.
Classes#
Create a collection of name/value pairs. |
Functions#
|
Decode the block data from the given input if it is not None. |
|
|
|
Decode the revealed commitment data from the given input if it is not None. |
|
Decode revealed commitment using a hotkey. |
|
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.EnumCreate a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- 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_block(data)#
Decode the block data from the given input if it is not None.
- bittensor.core.chain_data.utils.decode_metadata(metadata)#
- Parameters:
metadata (bittensor.core.types.CommitmentOfResponse)
- Return type:
- bittensor.core.chain_data.utils.decode_revealed_commitment(encoded_data)#
Decode the revealed commitment data from the given input if it is not None.
- bittensor.core.chain_data.utils.decode_revealed_commitment_with_hotkey(encoded_data)#
Decode revealed commitment using a hotkey.
- 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:
- Returns:
The decoded data as a dictionary, or
Noneif 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.