Class: Casper::Entity::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/entity/status.rb

Instance Method Summary collapse

Constructor Details

#initialize(status = {}) ⇒ Status

Returns a new instance of Status.

Parameters:

  • status (Hash) (defaults to: {})

Options Hash (status):

  • :api_version (String)
  • :chainspec_name (String)
  • :starting_state_root_hash (String)
  • :peers (Array<Hash>)
  • :last_added_block_info (Hash)
  • :our_public_signing_key (String)
  • :round_length (Integer)
  • :next_upgrade (String)
  • :build_version (String)
  • :uptime (String)


15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/entity/status.rb', line 15

def initialize(status = {})
  @api_version = status[:api_version] 
  @chainspec_name = status[:chainspec_name] 
  @starting_state_root_hash = status[:starting_state_root_hash] 
  @peers = []
  status[:peers].map { |peer| @peers << Casper::Entity::Peer.new(peer)}
  @last_added_block_info = status[:last_added_block_info]
  @our_public_signing_key = status[:our_public_signing_key]
  @round_length = status[:round_length]
  @next_upgrade = status[:next_upgrade]
  @build_version = status[:build_version]
  @uptime = status[:uptime]
end

Instance Method Details

#get_api_versionString

Returns the RPC API version.

Returns:

  • (String)

    the RPC API version.



30
31
32
# File 'lib/entity/status.rb', line 30

def get_api_version
  @api_version
end

#get_build_versionString

Returns the compiled node version.

Returns:

  • (String)

    the compiled node version.



70
71
72
# File 'lib/entity/status.rb', line 70

def get_build_version
  @build_version
end

#get_chainspec_nameString

Returns the chainspec name.

Returns:

  • (String)

    the chainspec name.



35
36
37
# File 'lib/entity/status.rb', line 35

def get_chainspec_name
  @chainspec_name
end

#get_last_added_block_infoHash

Returns the minimal info of the last block from the linear chain.

Returns:

  • (Hash)

    the minimal info of the last block from the linear chain.



50
51
52
# File 'lib/entity/status.rb', line 50

def get_last_added_block_info
  @last_added_block_info
end

#get_next_upgradeString

Returns information about the next scheduled upgrade.

Returns:

  • (String)

    information about the next scheduled upgrade.



65
66
67
# File 'lib/entity/status.rb', line 65

def get_next_upgrade
  @next_upgrade
end

#get_our_public_signing_keyString

Returns Our public signing key.

Returns:

  • (String)

    Our public signing key.



55
56
57
# File 'lib/entity/status.rb', line 55

def get_our_public_signing_key
  @our_public_signing_key
end

#get_peersArray<Peer>

Returns the node ID and network address of each connected peer.

Returns:

  • (Array<Peer>)

    the node ID and network address of each connected peer.



45
46
47
# File 'lib/entity/status.rb', line 45

def get_peers
  @peers
end

#get_round_lengthInteger

Returns the next round length if this node is a validator.

Returns:

  • (Integer)

    the next round length if this node is a validator.



60
61
62
# File 'lib/entity/status.rb', line 60

def get_round_length
  @round_length
end

#get_starting_state_root_hashString

Returns the state root hash used at the start of the current sessio.

Returns:

  • (String)

    the state root hash used at the start of the current sessio



40
41
42
# File 'lib/entity/status.rb', line 40

def get_starting_state_root_hash
  @starting_state_root_hash
end

#get_uptimeString

Returns the time that passed since the node has started.

Returns:

  • (String)

    the time that passed since the node has started.



75
76
77
# File 'lib/entity/status.rb', line 75

def get_uptime
  @uptime
end