Module: TezosClient::RpcInterface::Blocks

Included in:
TezosClient::RpcInterface
Defined in:
lib/tezos_client/rpc_interface/blocks.rb

Instance Method Summary collapse

Instance Method Details

#block(block_hash = "head") ⇒ Object



6
7
8
# File 'lib/tezos_client/rpc_interface/blocks.rb', line 6

def block(block_hash = "head")
  get "chains/main/blocks/#{block_hash}"
end

#block_header(block_hash = "head") ⇒ Object



21
22
23
# File 'lib/tezos_client/rpc_interface/blocks.rb', line 21

def block_header(block_hash = "head")
  get "chains/main/blocks/#{block_hash}/header"
end

#block_operation_hashes(block_hash = "head") ⇒ Object



29
30
31
# File 'lib/tezos_client/rpc_interface/blocks.rb', line 29

def block_operation_hashes(block_hash = "head")
  get "chains/main/blocks/#{block_hash}/operation_hashes"
end

#block_operations(block_hash = "head") ⇒ Object



25
26
27
# File 'lib/tezos_client/rpc_interface/blocks.rb', line 25

def block_operations(block_hash = "head")
  get "chains/main/blocks/#{block_hash}/operations"
end

#blocks(length: 50, head: nil, min_date: nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/tezos_client/rpc_interface/blocks.rb', line 10

def blocks(length: 50, head: nil, min_date: nil)
  query = {
    length: length,
    head: head,
    min_date: min_date&.to_i
  }.compact

  res = get "chains/main/blocks/", query: query
  res[0]
end