Class: BitWallet::Wallet

Inherits:
Object
  • Object
show all
Defined in:
lib/bit_wallet/wallet.rb

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Wallet

Returns a new instance of Wallet.



4
5
6
# File 'lib/bit_wallet/wallet.rb', line 4

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

Instance Method Details

#accountsObject



8
9
10
# File 'lib/bit_wallet/wallet.rb', line 8

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

#clientObject



42
43
44
# File 'lib/bit_wallet/wallet.rb', line 42

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

#move(from_account, to_account, amount, min_conf = BitWallet.min_conf, comment = nil) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/bit_wallet/wallet.rb', line 19

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

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

#recent_transactions(options = {}) ⇒ Object



12
13
14
15
16
17
# File 'lib/bit_wallet/wallet.rb', line 12

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