Class: Sigma::HintsBag
- Inherits:
-
Object
- Object
- Sigma::HintsBag
- Extended by:
- FFI::Library
- Defined in:
- lib/sigma/transaction.rb
Overview
Collection of hints to be used by prover
Instance Attribute Summary collapse
-
#pointer ⇒ Object
Returns the value of attribute pointer.
Class Method Summary collapse
-
.create ⇒ HintsBag
Create an empty collection.
-
.with_raw_pointer(pointer) ⇒ HintsBag
Takes ownership of an existing HintsBag Pointer.
Instance Method Summary collapse
-
#add_commitment_hint(commitment_hint) ⇒ Object
Add to collection.
-
#get_commitment_hint(index) ⇒ CommitmentHint?
Get item at specified index or return nil if no item exists.
-
#len ⇒ Integer
Get length of collection.
Instance Attribute Details
#pointer ⇒ Object
Returns the value of attribute pointer.
180 181 182 |
# File 'lib/sigma/transaction.rb', line 180 def pointer @pointer end |
Class Method Details
.create ⇒ HintsBag
Create an empty collection
184 185 186 187 188 |
# File 'lib/sigma/transaction.rb', line 184 def self.create pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_hints_bag_empty(pointer) init(pointer) end |
.with_raw_pointer(pointer) ⇒ HintsBag
Note:
A user of sigma_rb generally does not need to call this function
Takes ownership of an existing HintsBag Pointer.
194 195 196 |
# File 'lib/sigma/transaction.rb', line 194 def self.with_raw_pointer(pointer) init(pointer) end |
Instance Method Details
#add_commitment_hint(commitment_hint) ⇒ Object
Add to collection
200 201 202 |
# File 'lib/sigma/transaction.rb', line 200 def add_commitment_hint(commitment_hint) ergo_lib_hints_bag_add_commitment(self.pointer, commitment_hint.pointer) end |
#get_commitment_hint(index) ⇒ CommitmentHint?
Get item at specified index or return nil if no item exists
213 214 215 216 217 218 219 220 221 222 |
# File 'lib/sigma/transaction.rb', line 213 def get_commitment_hint(index) pointer = FFI::MemoryPointer.new(:pointer) res = ergo_lib_hints_bag_get(self.pointer, index, pointer) Util.check_error!(res[:error]) if res[:is_some] Sigma::CommitmentHint.with_raw_pointer(pointer) else nil end end |
#len ⇒ Integer
Get length of collection
206 207 208 |
# File 'lib/sigma/transaction.rb', line 206 def len ergo_lib_hints_bag_add_commitment_len(self.pointer) end |