Class: MixinBot::Transaction
- Inherits:
-
Object
- Object
- MixinBot::Transaction
- Defined in:
- lib/mixin_bot/transaction.rb,
lib/mixin_bot/transaction/buffer.rb,
lib/mixin_bot/transaction/decoder.rb,
lib/mixin_bot/transaction/encoder.rb
Defined Under Namespace
Classes: Buffer, Decoder, Encoder
Constant Summary collapse
- REFERENCES_TX_VERSION =
0x04- SAFE_TX_VERSION =
0x05- DEAULT_VERSION =
5- MAGIC =
[0x77, 0x77].freeze
- TX_VERSION =
2- MAX_ENCODE_INT =
0xFFFF- MAX_EXTRA_SIZE =
512- NULL_BYTES =
[0x00, 0x00].freeze
- AGGREGATED_SIGNATURE_PREFIX =
0xFF01- AGGREGATED_SIGNATURE_ORDINAY_MASK =
[0x00].freeze
- AGGREGATED_SIGNATURE_SPARSE_MASK =
[0x01].freeze
Instance Attribute Summary collapse
-
#aggregated ⇒ Object
Returns the value of attribute aggregated.
-
#asset ⇒ Object
Returns the value of attribute asset.
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#hash ⇒ Object
Returns the value of attribute hash.
-
#hex ⇒ Object
Returns the value of attribute hex.
-
#inputs ⇒ Object
Returns the value of attribute inputs.
-
#outputs ⇒ Object
Returns the value of attribute outputs.
-
#references ⇒ Object
Returns the value of attribute references.
-
#signatures ⇒ Object
Returns the value of attribute signatures.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #decode ⇒ Object
- #encode ⇒ Object
-
#initialize(**kwargs) ⇒ Transaction
constructor
A new instance of Transaction.
- #to_h ⇒ Object
Constructor Details
#initialize(**kwargs) ⇒ Transaction
Returns a new instance of Transaction.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/mixin_bot/transaction.rb', line 19 def initialize(**kwargs) @version = kwargs[:version] || DEAULT_VERSION @asset = kwargs[:asset] @inputs = kwargs[:inputs] @outputs = kwargs[:outputs] @extra = kwargs[:extra].to_s @hex = kwargs[:hex] @signatures = kwargs[:signatures] @aggregated = kwargs[:aggregated] @references = kwargs[:references] end |
Instance Attribute Details
#aggregated ⇒ Object
Returns the value of attribute aggregated.
17 18 19 |
# File 'lib/mixin_bot/transaction.rb', line 17 def aggregated @aggregated end |
#asset ⇒ Object
Returns the value of attribute asset.
17 18 19 |
# File 'lib/mixin_bot/transaction.rb', line 17 def asset @asset end |
#extra ⇒ Object
Returns the value of attribute extra.
17 18 19 |
# File 'lib/mixin_bot/transaction.rb', line 17 def extra @extra end |
#hash ⇒ Object
Returns the value of attribute hash.
17 18 19 |
# File 'lib/mixin_bot/transaction.rb', line 17 def hash @hash end |
#hex ⇒ Object
Returns the value of attribute hex.
17 18 19 |
# File 'lib/mixin_bot/transaction.rb', line 17 def hex @hex end |
#inputs ⇒ Object
Returns the value of attribute inputs.
17 18 19 |
# File 'lib/mixin_bot/transaction.rb', line 17 def inputs @inputs end |
#outputs ⇒ Object
Returns the value of attribute outputs.
17 18 19 |
# File 'lib/mixin_bot/transaction.rb', line 17 def outputs @outputs end |
#references ⇒ Object
Returns the value of attribute references.
17 18 19 |
# File 'lib/mixin_bot/transaction.rb', line 17 def references @references end |
#signatures ⇒ Object
Returns the value of attribute signatures.
17 18 19 |
# File 'lib/mixin_bot/transaction.rb', line 17 def signatures @signatures end |
#version ⇒ Object
Returns the value of attribute version.
17 18 19 |
# File 'lib/mixin_bot/transaction.rb', line 17 def version @version end |
Instance Method Details
#decode ⇒ Object
35 36 37 |
# File 'lib/mixin_bot/transaction.rb', line 35 def decode Decoder.new(self).decode end |
#encode ⇒ Object
31 32 33 |
# File 'lib/mixin_bot/transaction.rb', line 31 def encode Encoder.new(self).encode end |
#to_h ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/mixin_bot/transaction.rb', line 39 def to_h { version:, asset:, inputs:, outputs:, extra:, signatures:, aggregated:, hash:, references: }.compact end |