Module: Solana::Ruby::Kit::Rpc::Api::GetVoteAccounts
- Extended by:
- T::Sig
- Included in:
- Client
- Defined in:
- lib/solana/ruby/kit/rpc/api/get_vote_accounts.rb
Overview
Fetch current and delinquent vote accounts. Returns { current: [], delinquent: [] }.
Instance Method Summary collapse
Instance Method Details
#get_vote_accounts(commitment: nil, vote_pubkey: nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/solana/ruby/kit/rpc/api/get_vote_accounts.rb', line 34 def get_vote_accounts(commitment: nil, vote_pubkey: nil) config = {} config['commitment'] = commitment.to_s if commitment config['votePubkey'] = vote_pubkey if vote_pubkey raw = transport.request('getVoteAccounts', config.empty? ? [] : [config]) parse_vote = Kernel.lambda do |v| VoteAccountInfo.new( vote_pubkey: v['votePubkey'], node_pubkey: v['nodePubkey'], activated_stake: Kernel.Integer(v['activatedStake']), epoch_vote_account: v['epochVoteAccount'], commission: Kernel.Integer(v['commission']), last_vote: Kernel.Integer(v['lastVote']), epoch_credits: v['epochCredits'], root_slot: v['rootSlot'] ? Kernel.Integer(v['rootSlot']) : nil ) end { current: Kernel.Array(raw['current']).map(&parse_vote), delinquent: Kernel.Array(raw['delinquent']).map(&parse_vote) } end |