Class: Straight::AddressProvider::Bip32
- Defined in:
- lib/straight/address_providers/bip32.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Straight::AddressProvider::Base
Instance Method Details
#new_address(keychain_id:, **args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/straight/address_providers/bip32.rb', line 6 def new_address(keychain_id:, **args) path = if gateway.address_derivation_scheme.to_s.empty? # First check the depth. If the depth is 4 use '/i' notation (Mycelium iOS wallet) if gateway.keychain.depth > 3 keychain_id.to_s else # Otherwise, use 'm/0/n' - both Electrum and Mycelium on Android "m/0/#{keychain_id.to_s}" end else gateway.address_derivation_scheme.to_s.downcase.sub('n', keychain_id.to_s) end gateway.keychain.derived_key(path).address.to_s end |