Class: MoneyTree::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/money-tree/address.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Address

Returns a new instance of Address.



5
6
7
8
9
# File 'lib/money-tree/address.rb', line 5

def initialize(opts = {})
  private_key = opts.delete(:private_key)
  @private_key = MoneyTree::PrivateKey.new({ key: private_key }.merge(opts))
  @public_key = MoneyTree::PublicKey.new(@private_key, opts)
end

Instance Attribute Details

#private_keyObject (readonly)

Returns the value of attribute private_key.



3
4
5
# File 'lib/money-tree/address.rb', line 3

def private_key
  @private_key
end

#public_keyObject (readonly)

Returns the value of attribute public_key.



3
4
5
# File 'lib/money-tree/address.rb', line 3

def public_key
  @public_key
end

Instance Method Details

#to_s(network: :bitcoin) ⇒ Object



11
12
13
# File 'lib/money-tree/address.rb', line 11

def to_s(network: :bitcoin)
  public_key.to_s(network: network)
end