Class: Bitcoin::Wallet::Base
- Inherits:
-
Object
- Object
- Bitcoin::Wallet::Base
- Defined in:
- lib/extensions/bitcoin/wallet/base.rb
Instance Attribute Summary collapse
-
#utxo_db ⇒ Object
readonly
Returns the value of attribute utxo_db.
Instance Method Summary collapse
- #close ⇒ Object
- #get_asset_balance(asset_type, asset_id, account_name: nil, current_block_height: 9999999, min: 0, max: 9999999) ⇒ Object
- #get_balance(account_name) ⇒ Object
- #list_uncolored_unspent(account_name: nil, current_block_height: 9999999, min: 0, max: 9999999) ⇒ Object
- #list_unspent(account_name: nil, current_block_height: 9999999, min: 0, max: 9999999, addresses: nil) ⇒ Object
- #list_unspent_assets_in_account(asset_type, asset_id, account_name: nil, current_block_height: 9999999, min: 0, max: 9999999) ⇒ Object
Instance Attribute Details
#utxo_db ⇒ Object (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
#close ⇒ Object
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) account = find_account(account_name) return 0 unless account utxo_db.get_asset_balance(asset_type, asset_id, account, 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(account_name) account = find_account(account_name) return 0 unless account utxo_db.get_balance(account) 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) account = find_account(account_name) return [] unless account utxo_db.list_uncolored_unspent_in_account(account, 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 account_name account = find_account(account_name) return [] unless account utxo_db.list_unspent_in_account(account, 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 list_unspent_assets_in_account(asset_type, asset_id, account_name: nil, current_block_height: 9999999, min: 0, max: 9999999) account = find_account(account_name) return [] unless account utxo_db.list_unspent_assets_in_account(asset_type, asset_id, account, current_block_height: current_block_height, min: min, max: max) end |