Module: Solana::Ruby::Kit::Rpc::Api::GetEpochInfo
- Extended by:
- T::Helpers, T::Sig
- Included in:
- Client
- Defined in:
- lib/solana/ruby/kit/rpc/api/get_epoch_info.rb
Overview
Fetch information about the current epoch. Mirrors TypeScript's GetEpochInfoApi.getEpochInfo.
Instance Method Summary collapse
Instance Method Details
#get_epoch_info(commitment: nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/solana/ruby/kit/rpc/api/get_epoch_info.rb', line 34 def get_epoch_info(commitment: nil) config = {} config['commitment'] = commitment.to_s if commitment raw = transport.request('getEpochInfo', config.empty? ? [] : [config]) EpochInfo.new( absolute_slot: Kernel.Integer(raw['absoluteSlot']), block_height: Kernel.Integer(raw['blockHeight']), epoch: Kernel.Integer(raw['epoch']), slot_index: Kernel.Integer(raw['slotIndex']), slots_in_epoch: Kernel.Integer(raw['slotsInEpoch']), transaction_count: raw['transactionCount'] ? Kernel.Integer(raw['transactionCount']) : nil ) end |