Sha256: 5f737bed8f15b3640225f3e39ac0c1acd812b2d64031a3f86e008dd99effa59a

Contents?: true

Size: 435 Bytes

Versions: 1

Compression:

Stored size: 435 Bytes

Contents

# frozen_string_literal: true

module Bitcoin
  module Grpc
    module Api
      class GetBalance
        attr_reader :spv

        def initialize(spv)
          @spv = spv
        end

        def execute(request)
          height = spv.chain.latest_block.height
          balance = spv.wallet.get_balance(request.account_name)
          Bitcoin::Grpc::GetBalanceResponse.new(balance: balance)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitcoinrb-grpc-0.1.9 lib/bitcoin/grpc/api/get_balance.rb