Class: Tapyrus::Message::Tx

Inherits:
Base
  • Object
show all
Defined in:
lib/tapyrus/message/tx.rb

Overview

Constant Summary collapse

COMMAND =
"tx"

Constants included from Util

Util::DIGEST_NAME_SHA256

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#to_pkt

Methods included from Util

#byte_to_bit, #calc_checksum, #decode_base58_address, #double_sha256, #encode_base58_address, #hash160, #hmac_sha256, #pack_boolean, #pack_var_int, #pack_var_string, #padding_zero, #sha256, #unpack_boolean, #unpack_var_int, #unpack_var_int_from_io, #unpack_var_string, #valid_address?

Methods included from HexConverter

#to_hex

Constructor Details

#initialize(tx, use_segwit = false) ⇒ Tx

Returns a new instance of Tx.



11
12
13
14
# File 'lib/tapyrus/message/tx.rb', line 11

def initialize(tx, use_segwit = false)
  @tx = tx
  @use_segwit = use_segwit
end

Instance Attribute Details

#txObject

Returns the value of attribute tx.



8
9
10
# File 'lib/tapyrus/message/tx.rb', line 8

def tx
  @tx
end

#use_segwitObject

Returns the value of attribute use_segwit.



9
10
11
# File 'lib/tapyrus/message/tx.rb', line 9

def use_segwit
  @use_segwit
end

Class Method Details

.parse_from_payload(payload) ⇒ Object



16
17
18
19
# File 'lib/tapyrus/message/tx.rb', line 16

def self.parse_from_payload(payload)
  tx = Tapyrus::Tx.parse_from_payload(payload)
  new(tx)
end

Instance Method Details

#to_payloadObject



21
22
23
# File 'lib/tapyrus/message/tx.rb', line 21

def to_payload
  tx.to_payload
end