Class: CronosExplorer::Blocks

Inherits:
Object
  • Object
show all
Defined in:
lib/cronos_explorer/blocks.rb

Constant Summary collapse

DEFAULT_HASH =
{ module: 'block' }.freeze

Class Method Summary collapse

Class Method Details

.eth_block_numberObject

Mimics Ethereum JSON RPC’s eth_blockNumber. Returns the lastest block number



9
10
11
12
13
# File 'lib/cronos_explorer/blocks.rb', line 9

def eth_block_number
  hash = DEFAULT_HASH.merge(action: 'eth_block_number')

  Request.get hash
end

.getblockreward(blockno) ⇒ Object

Get block reward by block number.



16
17
18
19
20
# File 'lib/cronos_explorer/blocks.rb', line 16

def getblockreward(blockno)
  hash = DEFAULT_HASH.merge(action: 'getblockreward', blockno: blockno)

  Request.get hash
end