Class: Bitcoin::Descriptor::Addr
- Inherits:
-
Expression
- Object
- Expression
- Bitcoin::Descriptor::Addr
- Includes:
- Util
- Defined in:
- lib/bitcoin/descriptor/addr.rb
Instance Attribute Summary collapse
-
#addr ⇒ Object
readonly
Returns the value of attribute addr.
Instance Method Summary collapse
- #args ⇒ Object
-
#initialize(addr) ⇒ Addr
constructor
A new instance of Addr.
- #to_script ⇒ Object
- #top_level? ⇒ Boolean
- #type ⇒ Object
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 inherited from Expression
#==, #compressed_key?, #derive_path, #extract_pubkey, #to_hex, #to_s
Constructor Details
#initialize(addr) ⇒ Addr
Returns a new instance of Addr.
8 9 10 11 12 |
# File 'lib/bitcoin/descriptor/addr.rb', line 8 def initialize(addr) raise ArgumentError, "Address must be string." unless addr.is_a?(String) raise ArgumentError, "Address is not valid." unless valid_address?(addr) @addr = addr end |
Instance Attribute Details
#addr ⇒ Object (readonly)
Returns the value of attribute addr.
6 7 8 |
# File 'lib/bitcoin/descriptor/addr.rb', line 6 def addr @addr end |
Instance Method Details
#args ⇒ Object
26 27 28 |
# File 'lib/bitcoin/descriptor/addr.rb', line 26 def args addr end |
#to_script ⇒ Object
18 19 20 |
# File 'lib/bitcoin/descriptor/addr.rb', line 18 def to_script Bitcoin::Script.parse_from_addr(addr) end |
#top_level? ⇒ Boolean
22 23 24 |
# File 'lib/bitcoin/descriptor/addr.rb', line 22 def top_level? true end |
#type ⇒ Object
14 15 16 |
# File 'lib/bitcoin/descriptor/addr.rb', line 14 def type :addr end |