Class: Sigma::BlockHeader

Inherits:
Object
  • Object
show all
Extended by:
FFI::Library
Defined in:
lib/sigma/block_header.rb

Overview

Represents data available of the Block Header in Sigma propositions.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pointerObject

Returns the value of attribute pointer.



14
15
16
# File 'lib/sigma/block_header.rb', line 14

def pointer
  @pointer
end

Class Method Details

.with_json(json) ⇒ BlockHeader

Parse BlockHeader array from json (NODE API)

Parameters:

  • json (String)

Returns:



19
20
21
22
23
24
# File 'lib/sigma/block_header.rb', line 19

def self.with_json(json)
  pointer = FFI::MemoryPointer.new(:pointer) 
  error = ergo_lib_block_header_from_json(json, pointer)
  Util.check_error!(error)
  init(pointer)
end

.with_raw_pointer(pointer) ⇒ BlockHeader

Note:

A user of sigma_rb generally does not need to call this function

Takes ownership of an existing BlockHeader Pointer.

Parameters:

  • pointer (FFI::MemoryPointer)

Returns:



30
31
32
# File 'lib/sigma/block_header.rb', line 30

def self.with_raw_pointer(pointer)
  init(pointer)
end

Instance Method Details

#==(bh_two) ⇒ bool

Equality check between two BlockHeaders

Parameters:

Returns:

  • (bool)


45
46
47
# File 'lib/sigma/block_header.rb', line 45

def ==(bh_two)
  ergo_lib_block_header_eq(self.pointer, bh_two.pointer)
end

#get_block_idBlockId

Get BlockId of BlockHeader

Returns:



36
37
38
39
40
# File 'lib/sigma/block_header.rb', line 36

def get_block_id
  pointer = FFI::MemoryPointer.new(:pointer) 
  ergo_lib_block_header_id(self.pointer, pointer)
  Sigma::BlockId.with_raw_pointer(:pointer)
end