Class: Sigma::TxBuilder
- Inherits:
-
Object
- Object
- Sigma::TxBuilder
- Extended by:
- FFI::Library
- Defined in:
- lib/sigma/tx_builder.rb
Overview
UnsignedTransaction builder
Instance Attribute Summary collapse
-
#pointer ⇒ Object
Returns the value of attribute pointer.
Class Method Summary collapse
-
.create(box_selection:, output_candidates:, current_height:, fee_amount:, change_address:, min_change_value:) ⇒ TxBuilder
Create new TxBuilder.
-
.suggested_tx_fee ⇒ BoxValue
Suggested transaction fee (semi-default value used across wallets and dApps as of Oct 2020).
Instance Method Summary collapse
-
#build ⇒ UnsignedTransaction
Build the UnsignedTransaction.
-
#get_box_selection ⇒ BoxSelection
Get box selection.
-
#get_change_address ⇒ Address
Get change address.
-
#get_current_height ⇒ Integer
Get current height.
-
#get_data_inputs ⇒ DataInputs
Get data inputs.
-
#get_fee_amount ⇒ BoxValue
Get fee amount.
-
#get_min_change_value ⇒ BoxValue
Get min change value.
-
#get_output_candidates ⇒ ErgoBoxCandidates
Get output candidates.
-
#set_context_extension(box_id, context_extension) ⇒ Object
Set context extension for given input.
-
#set_data_inputs(data_inputs) ⇒ Object
Set transaction’s data inputs.
Instance Attribute Details
#pointer ⇒ Object
Returns the value of attribute pointer.
26 27 28 |
# File 'lib/sigma/tx_builder.rb', line 26 def pointer @pointer end |
Class Method Details
.create(box_selection:, output_candidates:, current_height:, fee_amount:, change_address:, min_change_value:) ⇒ TxBuilder
Create new TxBuilder
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/sigma/tx_builder.rb', line 36 def self.create(box_selection:, output_candidates:, current_height:, fee_amount:, change_address:, min_change_value:) pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_tx_builder_new( box_selection.pointer, output_candidates.pointer, current_height, fee_amount.pointer, change_address.pointer, min_change_value.pointer, pointer ) init(pointer) end |
.suggested_tx_fee ⇒ BoxValue
Suggested transaction fee (semi-default value used across wallets and dApps as of Oct 2020)
52 53 54 55 56 |
# File 'lib/sigma/tx_builder.rb', line 52 def self.suggested_tx_fee pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_tx_builder_suggested_tx_fee(pointer) Sigma::BoxValue.with_raw_pointer(pointer) end |
Instance Method Details
#build ⇒ UnsignedTransaction
Build the UnsignedTransaction
81 82 83 84 85 86 |
# File 'lib/sigma/tx_builder.rb', line 81 def build pointer = FFI::MemoryPointer.new(:pointer) error = ergo_lib_tx_builder_build(self.pointer, pointer) Util.check_error!(error) Sigma::UnsignedTransaction.with_raw_pointer(pointer) end |
#get_box_selection ⇒ BoxSelection
Get box selection
90 91 92 93 94 |
# File 'lib/sigma/tx_builder.rb', line 90 def get_box_selection pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_tx_builder_box_selection(self.pointer, pointer) Sigma::BoxSelection.with_raw_pointer(pointer) end |
#get_change_address ⇒ Address
Get change address
120 121 122 123 124 |
# File 'lib/sigma/tx_builder.rb', line 120 def get_change_address pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_tx_builder_change_address(self.pointer, pointer) Sigma::Address.with_raw_pointer(pointer) end |
#get_current_height ⇒ Integer
Get current height
106 107 108 |
# File 'lib/sigma/tx_builder.rb', line 106 def get_current_height ergo_lib_tx_builder_current_height(self.pointer) end |
#get_data_inputs ⇒ DataInputs
Get data inputs
73 74 75 76 77 |
# File 'lib/sigma/tx_builder.rb', line 73 def get_data_inputs pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_tx_builder_data_inputs(self.pointer, pointer) Sigma::DataInputs.with_raw_pointer(pointer) end |
#get_fee_amount ⇒ BoxValue
Get fee amount
112 113 114 115 116 |
# File 'lib/sigma/tx_builder.rb', line 112 def get_fee_amount pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_tx_builder_fee_amount(self.pointer, pointer) Sigma::BoxValue.with_raw_pointer(pointer) end |
#get_min_change_value ⇒ BoxValue
Get min change value
128 129 130 131 132 |
# File 'lib/sigma/tx_builder.rb', line 128 def get_min_change_value pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_tx_builder_min_change_value(self.pointer, pointer) Sigma::BoxValue.with_raw_pointer(pointer) end |
#get_output_candidates ⇒ ErgoBoxCandidates
Get output candidates
98 99 100 101 102 |
# File 'lib/sigma/tx_builder.rb', line 98 def get_output_candidates pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_tx_builder_output_candidates(self.pointer, pointer) Sigma::ErgoBoxCandidates.with_raw_pointer(pointer) end |
#set_context_extension(box_id, context_extension) ⇒ Object
Set context extension for given input
67 68 69 |
# File 'lib/sigma/tx_builder.rb', line 67 def set_context_extension(box_id, context_extension) ergo_lib_tx_builder_set_context_extension(self.pointer, box_id.pointer, context_extension.pointer) end |
#set_data_inputs(data_inputs) ⇒ Object
Set transaction’s data inputs
60 61 62 |
# File 'lib/sigma/tx_builder.rb', line 60 def set_data_inputs(data_inputs) ergo_lib_tx_builder_set_data_inputs(self.pointer, data_inputs.pointer) end |