Class: Bitcoin::Descriptor::KeyExpression
- Inherits:
-
Expression
- Object
- Expression
- Bitcoin::Descriptor::KeyExpression
- Defined in:
- lib/bitcoin/descriptor/key_expression.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #args ⇒ Object
-
#extracted_key ⇒ Bitcoin::Key
Get extracted key.
-
#initialize(key) ⇒ KeyExpression
constructor
Constructor.
-
#musig? ⇒ Boolean
Key is musig or not?.
- #top_level? ⇒ Boolean
Methods inherited from Expression
#==, #compressed_key?, #derive_path, #extract_pubkey, #to_hex, #to_s, #to_script, #type
Constructor Details
#initialize(key) ⇒ KeyExpression
Constructor
8 9 10 11 12 |
# File 'lib/bitcoin/descriptor/key_expression.rb', line 8 def initialize(key) raise ArgumentError, "Key must be string or MuSig." unless key.is_a?(String) || key.is_a?(MuSig) @key = key extracted_key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
4 5 6 |
# File 'lib/bitcoin/descriptor/key_expression.rb', line 4 def key @key end |
Instance Method Details
#args ⇒ Object
14 15 16 |
# File 'lib/bitcoin/descriptor/key_expression.rb', line 14 def args key end |
#extracted_key ⇒ Bitcoin::Key
Get extracted key.
24 25 26 |
# File 'lib/bitcoin/descriptor/key_expression.rb', line 24 def extracted_key extract_pubkey(musig? ? key.to_hex : key) end |
#musig? ⇒ Boolean
Key is musig or not?
30 31 32 |
# File 'lib/bitcoin/descriptor/key_expression.rb', line 30 def musig? key.is_a?(MuSig) end |
#top_level? ⇒ Boolean
18 19 20 |
# File 'lib/bitcoin/descriptor/key_expression.rb', line 18 def top_level? false end |