Class: Sigma::BoxSelection
- Inherits:
-
Object
- Object
- Sigma::BoxSelection
- Extended by:
- FFI::Library
- Defined in:
- lib/sigma/box_selection.rb
Overview
Selected boxes with change boxes. Instances of this class are created by SimpleBoxSelector.
Instance Attribute Summary collapse
-
#pointer ⇒ Object
Returns the value of attribute pointer.
Class Method Summary collapse
-
.create(ergo_boxes:, change_ergo_boxes:) ⇒ BoxSelection
Create a selection to inject custom select algorithms.
-
.with_raw_pointer(pointer) ⇒ BoxSelection
Takes ownership of an existing BoxSelection Pointer.
Instance Method Summary collapse
-
#==(bs_two) ⇒ bool
Equality check between two BoxSelections.
-
#get_boxes ⇒ ErgoBoxes
Selected Boxes to spend as transaction inputs.
-
#get_change_boxes ⇒ ErgoBoxAssetsDataList
Selected Boxes to use as change.
Instance Attribute Details
#pointer ⇒ Object
Returns the value of attribute pointer.
18 19 20 |
# File 'lib/sigma/box_selection.rb', line 18 def pointer @pointer end |
Class Method Details
.create(ergo_boxes:, change_ergo_boxes:) ⇒ BoxSelection
Create a selection to inject custom select algorithms
24 25 26 27 28 |
# File 'lib/sigma/box_selection.rb', line 24 def self.create(ergo_boxes:, change_ergo_boxes:) pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_box_selection_new(ergo_boxes.pointer, change_ergo_boxes.pointer, pointer) init(pointer) end |
.with_raw_pointer(pointer) ⇒ BoxSelection
Note:
A user of sigma_rb generally does not need to call this function
Takes ownership of an existing BoxSelection Pointer.
34 35 36 |
# File 'lib/sigma/box_selection.rb', line 34 def self.with_raw_pointer(pointer) init(pointer) end |
Instance Method Details
#==(bs_two) ⇒ bool
Equality check between two BoxSelections
57 58 59 |
# File 'lib/sigma/box_selection.rb', line 57 def ==(bs_two) ergo_lib_box_selection_eq(self.pointer, bs_two.pointer) end |
#get_boxes ⇒ ErgoBoxes
Selected Boxes to spend as transaction inputs
40 41 42 43 44 |
# File 'lib/sigma/box_selection.rb', line 40 def get_boxes pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_box_selection_boxes(self.pointer, pointer) Sigma::ErgoBoxes.with_raw_pointer(pointer) end |
#get_change_boxes ⇒ ErgoBoxAssetsDataList
Selected Boxes to use as change
48 49 50 51 52 |
# File 'lib/sigma/box_selection.rb', line 48 def get_change_boxes pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_box_selection_change(self.pointer, pointer) Sigma::ErgoBoxAssetsDataList.with_raw_pointer(pointer) end |