Class: OpenAssets::Transaction::OutPoint

Inherits:
Object
  • Object
show all
Defined in:
lib/openassets/transaction/out_point.rb

Overview

The combination of a transaction hash and an index n into its vout

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash, index) ⇒ OutPoint

Returns a new instance of OutPoint.

Parameters:

  • hash: (String)

    32 bytes transaction hash in vout.

  • index: (Integer)

    index in vout.

Raises:

  • (ArgumentError)


12
13
14
15
16
17
# File 'lib/openassets/transaction/out_point.rb', line 12

def initialize(hash, index)
  raise ArgumentError, 'hash must be exactly 32 bytes.' unless [hash].pack("H*").bytesize == 32
  raise ArgumentError, 'index must be in range 0x0 to 0xffffffff.' unless index.between?(0x0, 0xffffffff)
  @hash = hash
  @index = index
end

Instance Attribute Details

#hashObject

Returns the value of attribute hash.



7
8
9
# File 'lib/openassets/transaction/out_point.rb', line 7

def hash
  @hash
end

#indexObject

Returns the value of attribute index.



8
9
10
# File 'lib/openassets/transaction/out_point.rb', line 8

def index
  @index
end