Class: Casper::Entity::BlockInfo

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

Overview

BlockInfo class entity

Instance Method Summary collapse

Constructor Details

#initialize(last_added_block_info = {}) ⇒ BlockInfo

Returns a new instance of BlockInfo.

Parameters:

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

Options Hash (last_added_block_info):

  • :hash (String)
  • :timestamp (String)
  • :era_id (Integer)
  • :height (Integer)
  • :state_root_hash (String)
  • :creator (String)


13
14
15
16
17
18
19
20
# File 'lib/entity/block_info.rb', line 13

def initialize(last_added_block_info = {})
  @hash = last_added_block_info[:hash]
  @timestamp = last_added_block_info[:timestamp]
  @era_id = last_added_block_info[:era_id]
  @height = last_added_block_info[:height]
  @state_root_hash = last_added_block_info[:state_root_hash]
  @creator = last_added_block_info[:creator]
end

Instance Method Details

#get_creatorString

Returns hex-encoded cryptographic public key, including the algorithm tag prefix.

Returns:

  • (String)

    hex-encoded cryptographic public key, including the algorithm tag prefix.



51
52
53
# File 'lib/entity/block_info.rb', line 51

def get_creator
  @creator
end

#get_era_idInteger

Returns era id in which this block was created.

Returns:

  • (Integer)

    era id in which this block was created.



33
34
35
# File 'lib/entity/block_info.rb', line 33

def get_era_id 
  @era_id
end

#get_hashString

Returns a cryptographic hash identifying a Block.

Returns:

  • (String)

    a cryptographic hash identifying a Block.



23
24
25
# File 'lib/entity/block_info.rb', line 23

def get_hash
  @hash
end

#get_heightInteger

Returns the height of this block, i.e., the number of ancestors.

Returns:

  • (Integer)

    the height of this block, i.e., the number of ancestors.



39
40
41
# File 'lib/entity/block_info.rb', line 39

def get_height
  @height
end

#get_state_root_hashString

Returns the global state root hash produced by executing this block’s body.

Returns:

  • (String)

    the global state root hash produced by executing this block’s body.



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

def get_state_root_hash
  @state_root_hash
end

#get_timestampString

Returns timestamp formatted as per RFC 3339.

Returns:

  • (String)

    timestamp formatted as per RFC 3339.



28
29
30
# File 'lib/entity/block_info.rb', line 28

def get_timestamp
  @timestamp
end