Module: SolanaRuby::HttpMethods::BasicMethods

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

Overview

Basic Methods

Constant Summary collapse

FINALIZED_OPTIONS =
{ commitment: "finalized" }.freeze

Instance Method Summary collapse

Instance Method Details

#get_balance(pubkey) ⇒ Object



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

def get_balance(pubkey)
  balance_info = request("getBalance", [pubkey])
  balance_info["result"]["value"]
end

#get_balance_and_context(pubkey) ⇒ Object



14
15
16
17
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 14

def get_balance_and_context(pubkey)
  balance_info = request("getBalance", [pubkey])
  balance_info["result"]
end

#get_epoch_info(options = FINALIZED_OPTIONS) ⇒ Object



19
20
21
22
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 19

def get_epoch_info(options = FINALIZED_OPTIONS)
  epoch_info = request("getEpochInfo", [options])
  epoch_info["result"]
end

#get_epoch_scheduleObject



24
25
26
27
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 24

def get_epoch_schedule
  epoch_schedule = request("getEpochSchedule")
  epoch_schedule["result"]
end

#get_genesis_hashObject



29
30
31
32
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 29

def get_genesis_hash
  genesis_hash = request("getGenesisHash")
  genesis_hash["result"]
end

#get_healthObject



86
87
88
89
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 86

def get_health
  health_info = request("getHealth")
  health_info["result"]
end

#get_identityObject



91
92
93
94
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 91

def get_identity
  health_info = request("getIdentity")
  health_info["result"]
end

#get_inflation_governorObject



34
35
36
37
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 34

def get_inflation_governor
  inflation_governor = request("getInflationGovernor")
  inflation_governor["result"]
end

#get_inflation_rateObject



39
40
41
42
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 39

def get_inflation_rate
  inflation_rate = request("getInflationRate")
  inflation_rate["result"]
end

#get_inflation_reward(addresses, options = {}) ⇒ Object



44
45
46
47
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 44

def get_inflation_reward(addresses, options = {})
  params = [addresses, options]
  request("getInflationReward", params)
end

#get_leader_schedule(options = { epoch: nil }) ⇒ Object



49
50
51
52
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 49

def get_leader_schedule(options = { epoch: nil })
  leader_schedule = request("getLeaderSchedule", [options])
  leader_schedule["result"]
end

#get_minimum_balance_for_rent_exemption(account_data_size, options = FINALIZED_OPTIONS) ⇒ Object



54
55
56
57
58
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 54

def get_minimum_balance_for_rent_exemption(, options = FINALIZED_OPTIONS)
  params = [, options]
  minimum_balance_for_rent_exemption = request("getMinimumBalanceForRentExemption", params)
  minimum_balance_for_rent_exemption["result"]
end

#get_recent_performance_samples(limit = 10) ⇒ Object



96
97
98
99
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 96

def get_recent_performance_samples(limit = 10)
  performance_samples = request("getRecentPerformanceSamples", [limit])
  performance_samples["result"]
end

#get_recent_prioritization_fees(addresses) ⇒ Object



101
102
103
104
105
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 101

def get_recent_prioritization_fees(addresses)
  params = [addresses]
  prioritization_fees = request("getRecentPrioritizationFees", params)
  prioritization_fees["result"]
end

#get_stake_activation(account_pubkey, options = FINALIZED_OPTIONS.merge(epoch: nil)) ⇒ Object



60
61
62
63
64
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 60

def get_stake_activation(, options = FINALIZED_OPTIONS.merge(epoch: nil))
  params = [, options]
  stake_activation = request("getStakeActivation", params)
  stake_activation["result"]
end

#get_stake_minimum_delegation(options = FINALIZED_OPTIONS) ⇒ Object



66
67
68
69
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 66

def get_stake_minimum_delegation(options = FINALIZED_OPTIONS)
  stake_minimum_delagation = request("getStakeMinimumDelegation", [FINALIZED_OPTIONS])
  stake_minimum_delagation["result"]
end

#get_supply(options = FINALIZED_OPTIONS) ⇒ Object



71
72
73
74
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 71

def get_supply(options = FINALIZED_OPTIONS)
  supply_info = request("getSupply", [options])
  supply_info["result"]
end

#get_total_supply(options = FINALIZED_OPTIONS) ⇒ Object



81
82
83
84
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 81

def get_total_supply(options = FINALIZED_OPTIONS)
  supply_info = get_supply(options)
  supply_info["value"]["total"]
end

#get_versionObject



76
77
78
79
# File 'lib/solana_ruby/http_methods/basic_methods.rb', line 76

def get_version
  version_info = request("getVersion")
  version_info["result"]
end