Sha256: db1d083626260837d7bd9431bef49eb95e85e73301601d1b8ab17d7bed1b49ed

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

module BitWallet
  class Wallet

    def initialize(config={})
      @config = config
    end

    def accounts
      @accounts ||= Accounts.new(self)
    end

    def recent_transactions(options={})
      count = options.delete(:limit) || 10
      client.listtransactions('*', count).map do |hash|
        Transaction.new self, hash
      end
    end

    def move(from_account,
             to_account,
             amount,
             min_conf=BitWallet.min_conf,
             comment=nil)

      from_account_str = if from_account.respond_to?(:name)
                           from_account.name
                         else
                           from_account
                         end
      to_account_str = if to_account.respond_to?(:name)
                           to_account.name
                         else
                           to_account
                         end
      client.move(from_account_str,
                  to_account_str,
                  amount,
                  min_conf,
                  comment)
    end

    def client
      @client ||= InstantiatesBitcoinClient.execute(@config)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bit_wallet-0.7.5 lib/bit_wallet/wallet.rb
bit_wallet-0.7.3 lib/bit_wallet/wallet.rb
bit_wallet-0.7.2 lib/bit_wallet/wallet.rb
bit_wallet-0.7.1 lib/bit_wallet/wallet.rb
bit_wallet-0.7.0 lib/bit_wallet/wallet.rb