Class: Sigma::TransactionHintsBag

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pointerObject

Returns the value of attribute pointer.



247
248
249
# File 'lib/sigma/transaction.rb', line 247

def pointer
  @pointer
end

Class Method Details

.createTransactionHintsBag

Create empty collection

Returns:



251
252
253
254
255
# File 'lib/sigma/transaction.rb', line 251

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

.extract_hints_from_signed_transaction(transaction:, state_context:, boxes_to_spend:, data_boxes:, real_propositions:, simulated_propositions:) ⇒ TransactionHintsBag

Extract hints from signed transaction

Parameters:

Returns:



273
274
275
276
277
278
# File 'lib/sigma/transaction.rb', line 273

def self.extract_hints_from_signed_transaction(transaction:, state_context:, boxes_to_spend:, data_boxes:, real_propositions:, simulated_propositions:)
  pointer = FFI::MemoryPointer.new(:pointer)
  error = ergo_lib_transaction_extract_hints(transaction.pointer, state_context.pointer, boxes_to_spend.pointer, data_boxes.pointer, real_propositions.pointer, simulated_propositions.pointer, pointer)
  Util.check_error!(error)
  init(pointer)
end

.with_raw_pointer(pointer) ⇒ TransactionHintsBag

Note:

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

Takes ownership of an existing TransactionHintsBag Pointer.

Parameters:

  • pointer (FFI::MemoryPointer)

Returns:



261
262
263
# File 'lib/sigma/transaction.rb', line 261

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

Instance Method Details

#add_hints_for_input(index:, hints_bag:) ⇒ Object

Add hints for input

Parameters:

  • index: (Integer)
  • hints_bag: (HintsBag)


283
284
285
# File 'lib/sigma/transaction.rb', line 283

def add_hints_for_input(index:, hints_bag:)
  ergo_lib_transaction_hints_bag_add_hints_for_input(self.pointer, index, hints_bag.pointer)
end

#all_hints_for_input(index) ⇒ HintsBag

Get hints corresponding to index

Parameters:

  • index (Integer)

Returns:



290
291
292
293
294
# File 'lib/sigma/transaction.rb', line 290

def all_hints_for_input(index)
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_transaction_hints_bag_all_hints_for_input(self.pointer, index, pointer)
  Sigma::HintsBag.with_raw_pointer(pointer)
end