Class: Sigma::UnsignedTransaction

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

.with_json(json) ⇒ Object



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

def self.with_json(json)
  pointer = FFI::MemoryPointer.new(:pointer)
  error = ergo_lib_unsigned_tx_from_json(json, pointer)
  Util.check_error!(error)
  init(pointer)
end

.with_raw_pointer(pointer) ⇒ Object



256
257
258
# File 'lib/sigma/transaction.rb', line 256

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

Instance Method Details

#get_data_inputsObject



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

def get_data_inputs
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_unsigned_tx_data_inputs(self.pointer, pointer)
  Sigma::DataInputs.with_raw_pointer(pointer)
end

#get_output_candidatesObject



278
279
280
281
282
# File 'lib/sigma/transaction.rb', line 278

def get_output_candidates
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_unsigned_tx_output_candidates(self.pointer, pointer)
  Sigma::ErgoBoxCandidates.with_raw_pointer(pointer)
end

#get_tx_idObject



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

def get_tx_id
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_unsigned_tx_id(self.pointer, pointer)
  Sigma::TxId.with_raw_pointer(pointer)
end

#get_unsigned_inputsObject



266
267
268
269
270
# File 'lib/sigma/transaction.rb', line 266

def get_unsigned_inputs
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_unsigned_tx_inputs(self.pointer, pointer)
  Sigma::UnsignedInputs.with_raw_pointer(pointer)
end

#to_jsonObject



284
285
286
287
288
289
290
291
292
# File 'lib/sigma/transaction.rb', line 284

def to_json
  s_ptr = FFI::MemoryPointer.new(:pointer, 1)
  error = ergo_lib_unsigned_tx_to_json(self.pointer, s_ptr)
  Util.check_error!(error)
  s_ptr = s_ptr.read_pointer()
  str = s_ptr.read_string().force_encoding('UTF-8')
  Util.ergo_lib_delete_string(s_ptr)
  str
end

#to_json_eip12Object



294
295
296
297
298
299
300
301
302
# File 'lib/sigma/transaction.rb', line 294

def to_json_eip12
  s_ptr = FFI::MemoryPointer.new(:pointer, 1)
  error = ergo_lib_unsigned_tx_to_json_eip12(self.pointer, s_ptr)
  Util.check_error!(error)
  s_ptr = s_ptr.read_pointer()
  str = s_ptr.read_string().force_encoding('UTF-8')
  Util.ergo_lib_delete_string(s_ptr)
  str
end