Class: Bitcoin::Wallet::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/extensions/bitcoin/wallet/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#utxo_dbObject (readonly)

Returns the value of attribute utxo_db.



4
5
6
# File 'lib/extensions/bitcoin/wallet/base.rb', line 4

def utxo_db
  @utxo_db
end

Instance Method Details

#closeObject



40
41
42
43
# File 'lib/extensions/bitcoin/wallet/base.rb', line 40

def close
  db.close
  utxo_db.close
end

#get_asset_balance(asset_type, asset_id, account_name: nil, current_block_height: 9999999, min: 0, max: 9999999) ⇒ Object



28
29
30
31
32
# File 'lib/extensions/bitcoin/wallet/base.rb', line 28

def get_asset_balance(asset_type, asset_id, account_name: nil, current_block_height: 9999999, min: 0, max: 9999999)
   = ()
  return 0 unless 
  utxo_db.get_asset_balance(asset_type, asset_id, , current_block_height: current_block_height, min: min, max: max)
end

#get_balance(account_name) ⇒ Object



6
7
8
9
10
# File 'lib/extensions/bitcoin/wallet/base.rb', line 6

def get_balance()
   = ()
  return 0 unless 
  utxo_db.get_balance()
end

#list_uncolored_unspent(account_name: nil, current_block_height: 9999999, min: 0, max: 9999999) ⇒ Object



22
23
24
25
26
# File 'lib/extensions/bitcoin/wallet/base.rb', line 22

def list_uncolored_unspent(account_name: nil, current_block_height: 9999999, min: 0, max: 9999999)
   = ()
  return [] unless 
  utxo_db.(, current_block_height: current_block_height, min: min, max: max)
end

#list_unspent(account_name: nil, current_block_height: 9999999, min: 0, max: 9999999, addresses: nil) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/extensions/bitcoin/wallet/base.rb', line 12

def list_unspent(account_name: nil, current_block_height: 9999999, min: 0, max: 9999999, addresses: nil)
  if 
     = ()
    return [] unless 
    utxo_db.(, current_block_height: current_block_height, min: min, max: max)
  else
    utxo_db.list_unspent(current_block_height: current_block_height, min: min, max: max, addresses: addresses)
  end
end

#list_unspent_assets_in_account(asset_type, asset_id, account_name: nil, current_block_height: 9999999, min: 0, max: 9999999) ⇒ Object



34
35
36
37
38
# File 'lib/extensions/bitcoin/wallet/base.rb', line 34

def (asset_type, asset_id, account_name: nil, current_block_height: 9999999, min: 0, max: 9999999)
   = ()
  return [] unless 
  utxo_db.(asset_type, asset_id, , current_block_height: current_block_height, min: min, max: max)
end