Class: Nano::Wallet

Inherits:
Object
  • Object
show all
Defined in:
lib/nano/wallet.rb,
lib/nano/wallet/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(seed) ⇒ Wallet

Returns a new instance of Wallet.



12
13
14
15
# File 'lib/nano/wallet.rb', line 12

def initialize(seed)
  @seed = seed
  @accounts = []
end

Instance Attribute Details

#accountsObject (readonly)

Returns the value of attribute accounts.



10
11
12
# File 'lib/nano/wallet.rb', line 10

def accounts
  @accounts
end

Class Method Details

.with_random_seedObject



6
7
8
# File 'lib/nano/wallet.rb', line 6

def self.with_random_seed
  self.new(SecureRandom.hex(32))
end

Instance Method Details

#account_at_index(index) ⇒ Object



17
18
19
# File 'lib/nano/wallet.rb', line 17

def (index)
  Nano::Account.new(@seed, index)
end

#add_account!Object



25
26
27
28
29
# File 'lib/nano/wallet.rb', line 25

def add_account!
   = Nano::Account.new(@seed, @accounts.size)
  @accounts << 
  
end

#add_accounts!(count) ⇒ Object



21
22
23
# File 'lib/nano/wallet.rb', line 21

def add_accounts!(count)
  count.times { add_account! }
end