Class: BSV::Network::UTXO

Inherits:
Object
  • Object
show all
Defined in:
lib/bsv/network/utxo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tx_hash:, tx_pos:, satoshis:, height: nil) ⇒ UTXO

Returns a new instance of UTXO.



8
9
10
11
12
13
# File 'lib/bsv/network/utxo.rb', line 8

def initialize(tx_hash:, tx_pos:, satoshis:, height: nil)
  @tx_hash = tx_hash
  @tx_pos = tx_pos
  @satoshis = satoshis
  @height = height
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



6
7
8
# File 'lib/bsv/network/utxo.rb', line 6

def height
  @height
end

#satoshisObject (readonly)

Returns the value of attribute satoshis.



6
7
8
# File 'lib/bsv/network/utxo.rb', line 6

def satoshis
  @satoshis
end

#tx_hashObject (readonly)

Returns the value of attribute tx_hash.



6
7
8
# File 'lib/bsv/network/utxo.rb', line 6

def tx_hash
  @tx_hash
end

#tx_posObject (readonly)

Returns the value of attribute tx_pos.



6
7
8
# File 'lib/bsv/network/utxo.rb', line 6

def tx_pos
  @tx_pos
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



15
16
17
18
19
# File 'lib/bsv/network/utxo.rb', line 15

def ==(other)
  other.is_a?(self.class) &&
    tx_hash == other.tx_hash &&
    tx_pos == other.tx_pos
end

#hashObject



23
24
25
# File 'lib/bsv/network/utxo.rb', line 23

def hash
  [tx_hash, tx_pos].hash
end