Class: Bip44::Wallet
Overview
“44’”, # bip 44 “60’”, # coin, 0’: bitcoin, 60’: ethereum “0’”, # wallet “0” # 0 - public, 1 = private “0” # index
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Ethereum
#ethereum_address, #get_ethereum_address
Methods included from Bitcoin
#get_bitcoin_address
Class Method Details
.from_mnemonic(mnemonic, path) ⇒ Object
18
19
20
21
|
# File 'lib/bip44/wallet.rb', line 18
def self.from_mnemonic(mnemonic, path)
seed = BipMnemonic.to_seed(mnemonic: mnemonic) Wallet.from_seed(seed, path)
end
|
.from_seed(seed, path) ⇒ Object
12
13
14
15
16
|
# File 'lib/bip44/wallet.rb', line 12
def self.from_seed(seed, path)
master = MoneyTree::Master.new(seed_hex: seed) wallet_node = master.node_for_path(path) Wallet.new(wallet_node)
end
|
.from_xprv(xprv) ⇒ Object
28
29
30
31
|
# File 'lib/bip44/wallet.rb', line 28
def self.from_xprv(xprv)
wallet_node = MoneyTree::Node.from_bip32(xprv)
Wallet.new(wallet_node)
end
|
.from_xpub(xpub) ⇒ Object
23
24
25
26
|
# File 'lib/bip44/wallet.rb', line 23
def self.from_xpub(xpub)
wallet_node = MoneyTree::Node.from_bip32(xpub)
Wallet.new(wallet_node)
end
|
Instance Method Details
#private_key ⇒ Object
49
50
51
|
# File 'lib/bip44/wallet.rb', line 49
def private_key
@wallet_node.private_key.to_hex
end
|
#public_key ⇒ Object
45
46
47
|
# File 'lib/bip44/wallet.rb', line 45
def public_key
@wallet_node.public_key.to_hex
end
|
#sub_wallet(path) ⇒ Object
33
34
35
|
# File 'lib/bip44/wallet.rb', line 33
def sub_wallet(path)
Wallet.new(@wallet_node.node_for_path(path))
end
|
#xprv ⇒ Object
41
42
43
|
# File 'lib/bip44/wallet.rb', line 41
def xprv
@wallet_node.to_bip32(:private)
end
|
#xpub ⇒ Object
37
38
39
|
# File 'lib/bip44/wallet.rb', line 37
def xpub
@wallet_node.to_bip32
end
|