Class: Bitcoin::Descriptor::Combo
Overview
Instance Attribute Summary
#key
Instance Method Summary
collapse
#args, #extracted_key, #initialize, #musig?
Methods inherited from Expression
#args, #compressed_key?, #derive_path, #extract_pubkey, #to_s, #to_script
Instance Method Details
#==(other) ⇒ Object
24
25
26
27
|
# File 'lib/bitcoin/descriptor/combo.rb', line 24
def ==(other)
return false unless other.is_a?(Combo)
type == other.type && to_scripts == other.to_scripts
end
|
#to_hex ⇒ Object
10
11
12
|
# File 'lib/bitcoin/descriptor/combo.rb', line 10
def to_hex
raise ArgumentError, 'musig() is not allowed in top-level combo().' if musig?
end
|
#to_scripts ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/bitcoin/descriptor/combo.rb', line 14
def to_scripts
candidates = [Pk.new(key), Pkh.new(key)]
pubkey =
if pubkey.compressed?
candidates << Wpkh.new(pubkey.pubkey)
candidates << Sh.new(candidates.last)
end
candidates.map(&:to_script)
end
|
#top_level? ⇒ Boolean
29
30
31
|
# File 'lib/bitcoin/descriptor/combo.rb', line 29
def top_level?
true
end
|
#type ⇒ Object
6
7
8
|
# File 'lib/bitcoin/descriptor/combo.rb', line 6
def type
:combo
end
|