Class: Sigma::ReducedTransaction
- Inherits:
-
Object
- Object
- Sigma::ReducedTransaction
- Extended by:
- FFI::Library
- Defined in:
- lib/sigma/reduced_transaction.rb
Overview
Represent ‘reduced` transaction, i.e. unsigned transaction where each unsigned input is augmented with ReducedInput which contains a script reduction result. After an unsigned transaction is reduced it can be signed without context. Thus, it can be serialized and transferred for example to Cold Wallet and signed in an environment where secrets are known. see EIP-19 for more details
Instance Attribute Summary collapse
-
#pointer ⇒ Object
Returns the value of attribute pointer.
Class Method Summary collapse
-
.from_unsigned_tx(unsigned_tx:, boxes_to_spend:, data_boxes:, state_context:) ⇒ ReducedTransaction
Create ‘reduced` transaction, i.e.
-
.with_raw_pointer(pointer) ⇒ ReducedTransaction
Takes ownership of an existing ReducedTransaction Pointer.
Instance Method Summary collapse
-
#get_unsigned_transaction ⇒ UnsignedTransaction
Get unsigned transaction.
Instance Attribute Details
#pointer ⇒ Object
Returns the value of attribute pointer.
20 21 22 |
# File 'lib/sigma/reduced_transaction.rb', line 20 def pointer @pointer end |
Class Method Details
.from_unsigned_tx(unsigned_tx:, boxes_to_spend:, data_boxes:, state_context:) ⇒ ReducedTransaction
Create ‘reduced` transaction, i.e. unsigned transaction where each unsigned input is augmented with ReducedInput which contains a script reduction result.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/sigma/reduced_transaction.rb', line 29 def self.from_unsigned_tx(unsigned_tx:, boxes_to_spend:, data_boxes:, state_context:) pointer = FFI::MemoryPointer.new(:pointer) error = ergo_lib_reduced_tx_from_unsigned_tx( unsigned_tx.pointer, boxes_to_spend.pointer, data_boxes.pointer, state_context.pointer, pointer ) Util.check_error!(error) init(pointer) end |
.with_raw_pointer(pointer) ⇒ ReducedTransaction
A user of sigma_rb generally does not need to call this function
Takes ownership of an existing ReducedTransaction Pointer.
46 47 48 |
# File 'lib/sigma/reduced_transaction.rb', line 46 def self.with_raw_pointer(pointer) init(pointer) end |
Instance Method Details
#get_unsigned_transaction ⇒ UnsignedTransaction
Get unsigned transaction
52 53 54 55 56 |
# File 'lib/sigma/reduced_transaction.rb', line 52 def get_unsigned_transaction pointer = FFI::MemoryPointer.new(:pointer) ergo_lib_reduced_tx_unsigned_tx(self.pointer, pointer) UnsignedTransaction.with_raw_pointer(pointer) end |