bip44 0.2.16 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f28cae3a0a831f0f9a93a548dd7ab78a0174a87
4
- data.tar.gz: a166c537d9484506fd7eebe66948f3f4212742e2
3
+ metadata.gz: 5e7a38b23565dfdc0099af222d5e72a3d613fddd
4
+ data.tar.gz: c710b0bb4f07ece827d2e8bf66a1520f588b6e9e
5
5
  SHA512:
6
- metadata.gz: 4c415efbdeae48477f77d5aeb040362e05cf3cde48de7f8ed4d1ebefe31382852ffe81b9a82a70cadfa7210e70cd0fdc3bb563156a96857cfc4433650ed867e0
7
- data.tar.gz: f987ae433ee8c0ed06a78c402b3da87241192f562f154e01476b869e9e0a04d4a169271ee9b805bb2364ef48637a4608a467c822084598ac731639d3120390b2
6
+ metadata.gz: 4b1a1edd6e788ae38c352221ff0b50f2a3fa2be8c0be10f1c0ce88ead591047085da3a36cc2bc4a2ab16378277d5b697153a68935aedce0cdc6dd5bbea9ab236
7
+ data.tar.gz: 81d1d4d16d647032988f93c313b3c48b8cb29b89f916b329adf8a767963707d4fefa68d792b1abc1d978d6ef4758124b2a833f3e240691df2c6fc02101035e6d
@@ -1,17 +1,8 @@
1
1
  module Bip44
2
2
  module Bitcoin
3
- def get_bitcoin_address(path)
4
- node = @wallet_node.node_for_path(path)
5
- node.to_address
6
- end
7
-
8
- def get_bitcoin_address(index)
9
- sub_wallet = sub_wallet()
10
- sub_wallet.bitcoin_address
11
- end
12
-
13
- def bitcoin_address
3
+ def bitcoin_address(testnet: false)
4
+ return @wallet_node.public_key.to_address(network: :bitcoin_testnet) if testnet
14
5
  @wallet_node.public_key.to_address
15
6
  end
16
7
  end
17
- end
8
+ end
@@ -1,15 +1,5 @@
1
1
  module Bip44
2
2
  module Ethereum
3
- def get_ethereum_address(path)
4
- sub_wallet = sub_wallet(path)
5
- sub_wallet.ethereum_address
6
- end
7
-
8
- def get_child_ethereum_address(index)
9
- sub_wallet = sub_wallet()
10
- sub_wallet.ethereum_address
11
- end
12
-
13
3
  def ethereum_address
14
4
  # from bitcoin public key to ethereum public key
15
5
  group = ECDSA::Group::Secp256k1
@@ -23,4 +13,4 @@ module Bip44
23
13
  Bip44::Utils.prefix_hex(address)
24
14
  end
25
15
  end
26
- end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module Bip44
2
- VERSION = "0.2.16"
2
+ VERSION = "0.2.18"
3
3
  end
@@ -34,16 +34,22 @@ module Bip44
34
34
  Wallet.new(@wallet_node.node_for_path(path))
35
35
  end
36
36
 
37
- def xpub
38
- @wallet_node.to_bip32
37
+ def xpub(testnet: false)
38
+ return @wallet_node.to_bip32(:public, network: :bitcoin_testnet) if testnet
39
+ @wallet_node.to_bip32(:public)
39
40
  end
40
41
 
41
- def xprv
42
+ def xprv(testnet: :false)
43
+ return @wallet_node.to_bip32(:private, network: :bitcoin_testnet) if testnet
42
44
  @wallet_node.to_bip32(:private)
43
45
  end
44
46
 
45
- def private_key(wif: true)
46
- return @wallet_node.private_key.to_wif if wif == true
47
+ def wif(compressed: true, testnet: false)
48
+ return @wallet_node.private_key.to_wif(compressed: compressed, network: :bitcoin_testnet) if testnet
49
+ @wallet_node.private_key.to_wif(compressed: compressed)
50
+ end
51
+
52
+ def private_key
47
53
  @wallet_node.private_key.to_hex
48
54
  end
49
55
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bip44
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - wuminzhe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-04 00:00:00.000000000 Z
11
+ date: 2019-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler