Class: Bitshares::Wallet
- Inherits:
-
Object
show all
- Defined in:
- lib/bitshares/wallet.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name) ⇒ Wallet
7
8
9
10
11
|
# File 'lib/bitshares/wallet.rb', line 7
def initialize(name)
@name = name
@account = nil
@password = Bitshares.config[:wallet][@name]
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
48
49
50
|
# File 'lib/bitshares/wallet.rb', line 48
def method_missing(m, *args)
CLIENT.request('wallet_' + m.to_s, args)
end
|
Instance Attribute Details
#account(name) ⇒ Object
Returns the value of attribute account.
5
6
7
|
# File 'lib/bitshares/wallet.rb', line 5
def account
@account
end
|
#name ⇒ Object
Returns the value of attribute name.
5
6
7
|
# File 'lib/bitshares/wallet.rb', line 5
def name
@name
end
|
Instance Method Details
#closed? ⇒ Boolean
35
36
37
|
# File 'lib/bitshares/wallet.rb', line 35
def closed?
!open?
end
|
#lock ⇒ Object
21
22
23
24
|
# File 'lib/bitshares/wallet.rb', line 21
def lock
open
CLIENT.request 'wallet_lock'
end
|
#locked? ⇒ Boolean
44
45
46
|
# File 'lib/bitshares/wallet.rb', line 44
def locked?
!unlocked?
end
|
#open ⇒ Object
17
18
19
|
# File 'lib/bitshares/wallet.rb', line 17
def open
CLIENT.request('wallet_open', [@name])
end
|
#open? ⇒ Boolean
31
32
33
|
# File 'lib/bitshares/wallet.rb', line 31
def open?
self.get_info['open']
end
|
#unlock(timeout = 1776) ⇒ Object
26
27
28
29
|
# File 'lib/bitshares/wallet.rb', line 26
def unlock(timeout = 1776)
open
CLIENT.request('wallet_unlock', [timeout, @password])
end
|
#unlocked? ⇒ Boolean
39
40
41
42
|
# File 'lib/bitshares/wallet.rb', line 39
def unlocked?
open
get_info['unlocked']
end
|