Class: Sigma::ErgoBoxCandidate
- Inherits:
-
Object
- Object
- Sigma::ErgoBoxCandidate
- Extended by:
- FFI::Library
- Defined in:
- lib/sigma/ergo_box.rb
Overview
Contains the same fields as “ErgoBox“, except for transaction id and index, that will be calculated after full transaction formation. Use “ErgoBoxCandidateBuilder“ to create an instance
Instance Attribute Summary collapse
-
#pointer ⇒ Object
Returns the value of attribute pointer.
Class Method Summary collapse
-
.with_raw_pointer(pointer) ⇒ ErgoBoxCandidate
Takes ownership of an existing ErgoBoxCandidate Pointer.
Instance Method Summary collapse
-
#==(ebc_two) ⇒ bool
Equality check.
-
#get_box_value ⇒ BoxValue
Get box value.
-
#get_creation_height ⇒ Integer
Get box creation height.
-
#get_ergo_tree ⇒ ErgoTree
Get ErgoTree for box.
-
#get_register_value(register_id) ⇒ Constant?
Returns value (ErgoTree constant) stored in the register or ‘nil` if the register is empty.
-
#get_tokens ⇒ Tokens
Get tokens for box.
Instance Attribute Details
#pointer ⇒ Object
Returns the value of attribute pointer.
176 177 178 |
# File 'lib/sigma/ergo_box.rb', line 176 def pointer @pointer end |
Class Method Details
.with_raw_pointer(pointer) ⇒ ErgoBoxCandidate
A user of sigma_rb generally does not need to call this function
Takes ownership of an existing ErgoBoxCandidate Pointer.
182 183 184 |
# File 'lib/sigma/ergo_box.rb', line 182 def self.with_raw_pointer(pointer) init(pointer) end |
Instance Method Details
#==(ebc_two) ⇒ bool
Equality check
234 235 236 |
# File 'lib/sigma/ergo_box.rb', line 234 def ==(ebc_two) ergo_lib_ergo_box_candidate_eq(self.pointer, ebc_two.pointer) end |
#get_box_value ⇒ BoxValue
Get box value
225 226 227 228 229 |
# File 'lib/sigma/ergo_box.rb', line 225 def get_box_value pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_ergo_box_candidate_box_value(self.pointer, pointer) Sigma::BoxValue.with_raw_pointer(pointer) end |
#get_creation_height ⇒ Integer
Get box creation height
203 204 205 |
# File 'lib/sigma/ergo_box.rb', line 203 def get_creation_height ergo_lib_ergo_box_candidate_creation_height(self.pointer) end |
#get_ergo_tree ⇒ ErgoTree
Get ErgoTree for box
217 218 219 220 221 |
# File 'lib/sigma/ergo_box.rb', line 217 def get_ergo_tree pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_ergo_box_candidate_ergo_tree(self.pointer, pointer) Sigma::ErgoTree.with_raw_pointer(pointer) end |
#get_register_value(register_id) ⇒ Constant?
Returns value (ErgoTree constant) stored in the register or ‘nil` if the register is empty
190 191 192 193 194 195 196 197 198 199 |
# File 'lib/sigma/ergo_box.rb', line 190 def get_register_value(register_id) constant_ptr = FFI::MemoryPointer.new(:pointer) res = ergo_lib_ergo_box_candidate_register_value(self.pointer, register_id, constant_ptr) Util.check_error!(res[:error]) if res[:is_some] Sigma::Constant.with_raw_pointer(constant_ptr) else nil end end |
#get_tokens ⇒ Tokens
Get tokens for box
209 210 211 212 213 |
# File 'lib/sigma/ergo_box.rb', line 209 def get_tokens pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_ergo_box_candidate_tokens(self.pointer, pointer) Sigma::Tokens.with_raw_pointer(pointer) end |