Class: Bitcoin::PSBT::GlobalXpub
- Inherits:
-
Object
- Object
- Bitcoin::PSBT::GlobalXpub
- Includes:
- HexConverter
- Defined in:
- lib/bitcoin/psbt/tx.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Bitcoin::PSBT::KeyOriginInfo.
-
#xpub ⇒ Object
readonly
Bitcoin::ExtPubkey.
Instance Method Summary collapse
-
#initialize(xpub, info) ⇒ GlobalXpub
constructor
A new instance of GlobalXpub.
- #to_h ⇒ Object
- #to_payload ⇒ Object
- #to_s ⇒ Object
Methods included from HexConverter
Constructor Details
#initialize(xpub, info) ⇒ GlobalXpub
Returns a new instance of GlobalXpub.
10 11 12 13 |
# File 'lib/bitcoin/psbt/tx.rb', line 10 def initialize(xpub, info) @xpub = xpub @info = info end |
Instance Attribute Details
#info ⇒ Object (readonly)
Bitcoin::PSBT::KeyOriginInfo
8 9 10 |
# File 'lib/bitcoin/psbt/tx.rb', line 8 def info @info end |
#xpub ⇒ Object (readonly)
Bitcoin::ExtPubkey
7 8 9 |
# File 'lib/bitcoin/psbt/tx.rb', line 7 def xpub @xpub end |
Instance Method Details
#to_h ⇒ Object
19 20 21 |
# File 'lib/bitcoin/psbt/tx.rb', line 19 def to_h {xpub: xpub.to_hex}.merge(info.to_h) end |
#to_payload ⇒ Object
15 16 17 |
# File 'lib/bitcoin/psbt/tx.rb', line 15 def to_payload PSBT.serialize_to_vector(PSBT_GLOBAL_TYPES[:xpub], key: xpub.to_payload, value: info.to_payload) end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/bitcoin/psbt/tx.rb', line 23 def to_s to_h.to_s end |