Class: Bitcoin::Message::FilterAdd

Inherits:
Base
  • Object
show all
Defined in:
lib/bitcoin/message/filter_add.rb

Overview

Constant Summary collapse

COMMAND =
'filteradd'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

from_pkt, #to_pkt

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

#to_hex

Constructor Details

#initialize(element) ⇒ FilterAdd

Returns a new instance of FilterAdd.



13
14
15
# File 'lib/bitcoin/message/filter_add.rb', line 13

def initialize(element)
  @element = element
end

Instance Attribute Details

#elementObject

element must be sent in the byte order they would use when appearing in a raw transaction;



11
12
13
# File 'lib/bitcoin/message/filter_add.rb', line 11

def element
  @element
end

Class Method Details

.parse_from_payload(payload) ⇒ Object



17
18
19
# File 'lib/bitcoin/message/filter_add.rb', line 17

def self.parse_from_payload(payload)
  new(Bitcoin.unpack_var_string(payload).first.bth)
end

Instance Method Details

#to_payloadObject



21
22
23
# File 'lib/bitcoin/message/filter_add.rb', line 21

def to_payload
  Bitcoin.pack_var_string(element.htb)
end