Module: SolanaRuby::HttpMethods::BlockMethods

Defined in:
lib/solana_ruby/http_methods/block_methods.rb

Overview

Block Related HTTP Methods

Constant Summary collapse

DEFAULT_OPTIONS =
{ maxSupportedTransactionVersion: 0 }.freeze

Instance Method Summary collapse

Instance Method Details

#get_block(slot, options = DEFAULT_OPTIONS) ⇒ Object



15
16
17
18
19
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 15

def get_block(slot, options = DEFAULT_OPTIONS)
  params = [slot, options]
  block_info = request("getBlock", params)
  block_info["result"]
end

#get_block_commitment(block_slot) ⇒ Object



72
73
74
75
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 72

def get_block_commitment(block_slot)
  block_commitment = request("getBlockCommitment", [block_slot])
  block_commitment["result"]
end

#get_block_heightObject



67
68
69
70
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 67

def get_block_height
  block_height = request("getBlockHeight")
  block_height["result"]
end

#get_block_productionObject



21
22
23
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 21

def get_block_production
  request("getBlockProduction")
end

#get_block_signatures(slot, options = DEFAULT_OPTIONS) ⇒ Object



30
31
32
33
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 30

def get_block_signatures(slot, options = DEFAULT_OPTIONS)
  block_info = get_block(slot, options)
  block_signatures(block_info)
end

#get_block_time(slot) ⇒ Object



25
26
27
28
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 25

def get_block_time(slot)
  block_info = request("getBlockTime", [slot])
  block_info["result"]
end

#get_blocks(start_slot, end_slot) ⇒ Object



9
10
11
12
13
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 9

def get_blocks(start_slot, end_slot)
  params = [start_slot, end_slot]
  block_info = request("getBlocks", params)
  block_info["result"]
end

#get_blocks_with_limit(start_slot, limit) ⇒ Object



61
62
63
64
65
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 61

def get_blocks_with_limit(start_slot, limit)
  params = [start_slot, limit]
  response = request("getBlocksWithLimit", params)
  response["result"]
end

#get_cluster_nodesObject



35
36
37
38
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 35

def get_cluster_nodes
  cluster_nodes_info = request("getClusterNodes")
  cluster_nodes_info["result"]
end

#get_confirmed_block(slot, options = DEFAULT_OPTIONS) ⇒ Object



40
41
42
43
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 40

def get_confirmed_block(slot, options = DEFAULT_OPTIONS)
  block_info = get_block(slot, options)
  block_info["result"]
end

#get_confirmed_block_signatures(slot) ⇒ Object



45
46
47
48
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 45

def get_confirmed_block_signatures(slot)
  block_info = get_confirmed_block(slot)
  block_signatures(block_info)
end

#get_first_available_blockObject



56
57
58
59
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 56

def get_first_available_block
  result = request("getFirstAvailableBlock")
  result["result"]
end

#get_parsed_block(slot, options = {}) ⇒ Object



50
51
52
53
54
# File 'lib/solana_ruby/http_methods/block_methods.rb', line 50

def get_parsed_block(slot, options = {})
  params = [slot, { encoding: "jsonParsed", transactionDetails: "full" }.merge(options)]
  result = request("getBlock", params)
  result["result"]
end