Class: Bitcoin::Message::SendTxRcncl
- Includes:
- Schnorr::Util
- Defined in:
- lib/bitcoin/message/send_tx_rcncl.rb
Overview
sendtxrcncl message for BIP-330. https://github.com/bitcoin/bips/blob/master/bip-0330.mediawiki
Constant Summary collapse
- COMMAND =
'sendtxrcncl'
Instance Attribute Summary collapse
-
#salt ⇒ Object
readonly
Returns the value of attribute salt.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(version, salt) ⇒ SendTxRcncl
constructor
A new instance of SendTxRcncl.
- #to_payload ⇒ Object
Methods inherited from Base
Methods included from Util
#byte_to_bit, #calc_checksum, #decode_base58_address, #double_sha256, #encode_base58_address, #hash160, #hkdf_sha256, #hmac_sha256, #pack_boolean, #pack_var_int, #pack_var_string, #padding_zero, #sha256, #tagged_hash, #unpack_boolean, #unpack_var_int, #unpack_var_int_from_io, #unpack_var_string, #valid_address?
Methods included from HexConverter
Constructor Details
#initialize(version, salt) ⇒ SendTxRcncl
Returns a new instance of SendTxRcncl.
14 15 16 17 18 19 20 21 22 |
# File 'lib/bitcoin/message/send_tx_rcncl.rb', line 14 def initialize(version, salt) raise ArgumentError, "version must be integer." unless version.is_a?(Integer) raise ArgumentError, "salt must be integer." unless salt.is_a?(Integer) raise ArgumentError, "version must be positive number." unless version > 0 raise ArgumentError, "version is out of range." if version < 0 || version > 0xffffffff raise ArgumentError, "salt is out of range." if salt < 0 || salt > 0xffffffffffffffff @version = version @salt = salt end |
Instance Attribute Details
#salt ⇒ Object (readonly)
Returns the value of attribute salt.
10 11 12 |
# File 'lib/bitcoin/message/send_tx_rcncl.rb', line 10 def salt @salt end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
9 10 11 |
# File 'lib/bitcoin/message/send_tx_rcncl.rb', line 9 def version @version end |
Class Method Details
.parse_from_payload(payload) ⇒ Object
24 25 26 27 28 |
# File 'lib/bitcoin/message/send_tx_rcncl.rb', line 24 def self.parse_from_payload(payload) buf = StringIO.new(payload) version, salt = buf.read(16).unpack('VQ<') SendTxRcncl.new(version, salt) end |
Instance Method Details
#to_payload ⇒ Object
30 31 32 |
# File 'lib/bitcoin/message/send_tx_rcncl.rb', line 30 def to_payload [version, salt].pack('VQ<') end |