Class: Sigma::Propositions

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

Overview

Propositions list (public keys)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pointerObject

Returns the value of attribute pointer.



80
81
82
# File 'lib/sigma/reduced_transaction.rb', line 80

def pointer
  @pointer
end

Class Method Details

.createPropositions

Create an empty collection

Returns:



84
85
86
87
88
# File 'lib/sigma/reduced_transaction.rb', line 84

def self.create
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_propositions_new(pointer)
  init(pointer)
end

Instance Method Details

#add_proposition(bytes) ⇒ Object

Add a proposition

Parameters:

  • bytes (Array<uint8>)

    Array of 8-bit integers (0-255)



92
93
94
95
96
97
# File 'lib/sigma/reduced_transaction.rb', line 92

def add_proposition(bytes)
  b_ptr = FFI::MemoryPointer.new(:uint8, bytes.size)
  b_ptr.write_array_of_uint8(bytes)
  error = ergo_lib_propositions_add_proposition_from_bytes(self.pointer, b_ptr, bytes.size)
  Util.check_error!(error)
end