Class: ItsyBtc::Commands::GenCommand
- Defined in:
- lib/itsy-btc/commands/gen_command.rb
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
-
#initialize(comment = "") ⇒ GenCommand
constructor
A new instance of GenCommand.
- #run ⇒ Object
Methods inherited from Command
Constructor Details
#initialize(comment = "") ⇒ GenCommand
Returns a new instance of GenCommand.
8 9 10 |
# File 'lib/itsy-btc/commands/gen_command.rb', line 8 def initialize(comment = "") @comment = comment.to_s end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/itsy-btc/commands/gen_command.rb', line 12 def run if @wallet.nil? puts "No wallet found. Run `itsy init` to create one." exit end key_gen = Bitcoin::Wallet::KeyGenerator.new key = key_gen.get_key @wallet.add(key.to_base58, @comment) puts "Address #{@wallet.entries.last.address} added to wallet." end |