class Bitcoin::PSBT::KeyOriginInfo

Attributes

fingerprint[R]
key_paths[R]

Public Class Methods

new(fingerprint: nil, key_paths: []) click to toggle source
# File lib/bitcoin/psbt/key_origin_info.rb, line 11
def initialize(fingerprint: nil, key_paths: [])
  @fingerprint = fingerprint
  @key_paths = key_paths
end
parse_from_payload(payload) click to toggle source
# File lib/bitcoin/psbt/key_origin_info.rb, line 16
def self.parse_from_payload(payload)
  buf = StringIO.new(payload)
  self.new(fingerprint: buf.read(4).bth, key_paths: buf.read.unpack('I*'))
end

Public Instance Methods

to_h() click to toggle source
# File lib/bitcoin/psbt/key_origin_info.rb, line 25
def to_h
  {fingerprint: fingerprint, key_paths: to_key_path(key_paths)}
end
to_payload() click to toggle source
# File lib/bitcoin/psbt/key_origin_info.rb, line 21
def to_payload
  fingerprint.htb + key_paths.pack('I*')
end
to_s() click to toggle source
# File lib/bitcoin/psbt/key_origin_info.rb, line 29
def to_s
  to_h.to_s
end