peerplays.instance module

class peerplays.instance.BlockchainInstance(*args, **kwargs)

Bases: graphenecommon.instance.AbstractBlockchainInstanceProvider

This is a class that allows compatibility with previous naming conventions

blockchain
chain

Short form for blockchain (for the lazy)

define_classes()

Needs to define instance variables that provide classes

get_instance_class()

Should return the Chain instance class, e.g. peerplays.PeerPlays

classmethod inject(cls)
peerplays

Alias for the specific blockchain

classmethod set_shared_blockchain_instance(instance)

This method allows us to override default instance for all users of SharedInstance.instance.

Parameters:instance (chaininstance) – Chain instance
classmethod set_shared_config(config)

This allows to set a config that will be used when calling shared_blockchain_instance and allows to define the configuration without requiring to actually create an instance

set_shared_instance()

This method allows to set the current instance as default

shared_blockchain_instance()

This method will initialize SharedInstance.instance and return it. The purpose of this method is to have offer single default instance that can be reused by multiple classes.

class peerplays.instance.SharedInstance

Bases: object

This class merely offers a singelton for the Blockchain Instance

config = {}
instance = None
peerplays.instance.set_shared_blockchain_instance(instance)
peerplays.instance.set_shared_config(config)
peerplays.instance.set_shared_peerplays_instance(instance)
peerplays.instance.shared_blockchain_instance()
peerplays.instance.shared_peerplays_instance()