Method: Bitcoin::PSBT::HDKeyPath#initialize
- Defined in:
- lib/bitcoin/psbt/hd_key_path.rb
#initialize(pubkey, info) ⇒ HDKeyPath
Returns a new instance of HDKeyPath.
11 12 13 14 15 16 17 18 |
# File 'lib/bitcoin/psbt/hd_key_path.rb', line 11 def initialize(pubkey, info) pubkey = pubkey.encoding == Encoding::ASCII_8BIT ? pubkey : pubkey.htb raise ArgumentError, 'Size of key was not the expected size for the type BIP32 keypath.' unless [Bitcoin::Key::PUBLIC_KEY_SIZE, Bitcoin::Key::COMPRESSED_PUBLIC_KEY_SIZE].include?(pubkey.bytesize) pubkey = Bitcoin::Key.new(pubkey: pubkey.bth) raise ArgumentError, Errors::Messages::INVALID_PUBLIC_KEY unless pubkey.fully_valid_pubkey? @pubkey = pubkey.pubkey @info = info end |