Constants and simple types¶
These submodules contain constants and simple types used to represent Cardano data structures that don’t need any internal functionality.
API reference¶
- class cardano.consts.Era(value)¶
Represents Cardano era, a distinct phase of platform development.
Warning
Do NOT use the integer values directly. There are new Eras being introduced, as for example Allegra and Mary were inserted as stepping stones into full Goguen. However, you may use comparison operators between them, to check which was earlier or later than the other one.
- class cardano.simpletypes.AssetID(asset_name, policy_id)¶
Represents the ID of a native Cardano asset. It consists of asset name and policy ID. It renders as string representation of
asset_name:policy_id
.The
asset_name
is always kept encoded as hexadecimal string and must be passed to the constructor as such.The
.name_bytes
property is abytes
decoded representation of the hex. Because Cardano allows full ASCII set to be used in asset names, some of them are not safe to be displayed directly.
- class cardano.simpletypes.Balance(total, available, reward)¶
Represents a balance of asset, including total, principal and reward
- property available¶
The principal, i.e. the total minus staking rewards
- property reward¶
The staking rewards (interest)
- property total¶
The total balance
- class cardano.simpletypes.BlockPosition(epoch, slot, absolute_slot, height)¶
Represents block’s position within the blockchain
- property absolute_slot¶
Absolute slot number
- property epoch¶
Epoch number
- property height¶
Block number (height of the chain) [optional]
- property slot¶
Slot number
- class cardano.simpletypes.Epoch(number, starts)¶
- property number¶
Alias for field number 0
- property starts¶
Alias for field number 1
- class cardano.simpletypes.StakePoolInfo(id, status, ticker, name, description, homepage, rewards, cost, margin, pledge, relative_stake, saturation, produced_blocks, retirement)¶
Stores stake pool data
- property cost¶
Fixed pool running cost in ADA
- property description¶
Description
- property homepage¶
Homepage URL
- property id¶
Unique ID
- property margin¶
Operator’s margin on the total reward before splitting it among stakeholders (as
Decimal
fraction)
- property name¶
Name
- property pledge¶
Minimal stake amount that the pool is willing to honor
- property produced_blocks¶
Number of blocks produced by a given stake pool in its lifetime.
- property relative_stake¶
The live pool stake relative to the total stake
- property rewards¶
Alias for field number 6
- property saturation¶
Saturation-level of the pool based on the desired number of pools aimed by the network. A value above 1 indicates that the pool is saturated.
- property status¶
Status, one of
StakePoolStatus
enum
- property ticker¶
3-5 chars long ticker
- class cardano.simpletypes.StakePoolStatus(value)¶
Represents stake pool status