money-tree 0.8.7 → 0.8.8

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: a90e8474cf23c05904d4abc4e84043f043189ecb
4
- data.tar.gz: 4c4281adf487eeba40c7821c3418470a0e6c1a1a
3
+ metadata.gz: 7ed16071f92b2708bab3c5f2b6bedcb059879ab4
4
+ data.tar.gz: 6cf07c4bab76d4c13f27b352c1851615afe63229
5
5
  SHA512:
6
- metadata.gz: f18dc30cb0f0f9388272d4ea896408c80284729da44ba7934c3b2b524e19ea2f2383acc68d9422c52ea5305e451d8435395a5043ee6ddaa9a29a2fb74db6caa4
7
- data.tar.gz: d61b370aad727819049ff671f2225f8543110dfdf68cbbb375ba14aeeecc74cde5937d29a407887aa20380c181cfd768bc88596e0cd9a961bd1dd7394bf432d1
6
+ metadata.gz: 99cb55b14f28c53ba6704c6ec442ed6e5e6b73272ebb96c65cc83bbb892c1d561fa77c50ecbc26f98b16b407431717360203877d20c616da7574e1b5e85638b4
7
+ data.tar.gz: 7998c7a665b64577ca2833cf191237ddaa4e29e604e497ebb403c8897e0a56b28b0d46d4725af777720421a99a7eecd734c758d98b2eed69f1f50d3994dd190e
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/wink/money-tree.png)](https://travis-ci.org/wink/money-tree) [![Coverage Status](https://coveralls.io/repos/wink/money-tree/badge.png?branch=master)](https://coveralls.io/r/wink/money-tree?branch=master) [![Code Climate](https://codeclimate.com/github/wink/money-tree.png)](https://codeclimate.com/github/wink/money-tree) [![Gem Version](https://badge.fury.io/rb/money-tree.png)](http://badge.fury.io/rb/money-tree)
1
+ [![Build Status](https://travis-ci.org/GemHQ/money-tree.png)](https://travis-ci.org/GemHQ/money-tree) [![Coverage Status](https://img.shields.io/coveralls/GemHQ/money-tree.svg)](https://coveralls.io/r/GemHQ/money-tree?branch=master) [![Code Climate](https://codeclimate.com/github/GemHQ/money-tree.png)](https://codeclimate.com/github/GemHQ/money-tree) [![Gem Version](https://badge.fury.io/rb/money-tree.png)](http://badge.fury.io/rb/money-tree)
2
2
  # MoneyTree
3
3
  ### RSpec tested. Big Brother removed.
4
4
 
@@ -2,7 +2,8 @@ module MoneyTree
2
2
  class Node
3
3
  include Support
4
4
  extend Support
5
- attr_reader :private_key, :public_key, :chain_code, :is_private, :depth, :index, :parent, :network, :network_key
5
+ attr_reader :private_key, :public_key, :chain_code,
6
+ :is_private, :depth, :index, :parent, :network, :network_key
6
7
 
7
8
  class PublicDerivationFailure < Exception; end
8
9
  class InvalidKeyForIndex < Exception; end
@@ -20,7 +21,7 @@ module MoneyTree
20
21
  version = from_version_hex hex.slice!(0..7)
21
22
  self.new({
22
23
  depth: hex.slice!(0..1).to_i(16),
23
- fingerprint: hex.slice!(0..7),
24
+ parent_fingerprint: hex.slice!(0..7),
24
25
  index: hex.slice!(0..7).to_i(16),
25
26
  chain_code: hex.slice!(0..63).to_i(16)
26
27
  }.merge(key_options(hex, version)))
@@ -118,7 +119,7 @@ module MoneyTree
118
119
  version_key = type.to_sym == :private ? :extended_privkey_version : :extended_pubkey_version
119
120
  hex = network[version_key] # version (4 bytes)
120
121
  hex += depth_hex(depth) # depth (1 byte)
121
- hex += depth.zero? ? '00000000' : parent.to_fingerprint# fingerprint of key (4 bytes)
122
+ hex += parent_fingerprint # fingerprint of key (4 bytes)
122
123
  hex += index_hex(index) # child number i (4 bytes)
123
124
  hex += chain_code_hex
124
125
  hex += type.to_sym == :private ? "00#{private_key.to_hex}" : public_key.compressed.to_hex
@@ -137,6 +138,14 @@ module MoneyTree
137
138
  public_key.compressed.to_fingerprint
138
139
  end
139
140
 
141
+ def parent_fingerprint
142
+ if @parent_fingerprint
143
+ @parent_fingerprint
144
+ else
145
+ depth.zero? ? '00000000' : parent.to_fingerprint
146
+ end
147
+ end
148
+
140
149
  def to_address
141
150
  address = network[:address_version] + to_identifier
142
151
  to_serialized_base58 address
@@ -1,3 +1,3 @@
1
1
  module MoneyTree
2
- VERSION = "0.8.7"
2
+ VERSION = "0.8.8"
3
3
  end
@@ -771,7 +771,8 @@ describe MoneyTree::Master do
771
771
  @node.is_private?.should == true
772
772
  @node.depth.should == 1
773
773
  @node.public_key.to_hex.should == "035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56"
774
- @node.chain_code_hex.should == "47fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141"
774
+ @node.chain_code_hex.should == "47fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141"
775
+ @node.parent_fingerprint.should == "3442193e"
775
776
  end
776
777
 
777
778
  it "imports a valid public node address" do
@@ -782,6 +783,7 @@ describe MoneyTree::Master do
782
783
  @node.depth.should == 1
783
784
  @node.public_key.to_hex.should == "035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56"
784
785
  @node.chain_code_hex.should == "47fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141"
786
+ @node.parent_fingerprint.should == "3442193e"
785
787
  end
786
788
  end
787
789
  end
@@ -86,7 +86,7 @@ describe MoneyTree::PrivateKey do
86
86
 
87
87
  describe "valid?(eckey)" do
88
88
  it "checks for a valid key" do
89
- @key.valid?.should be_true
89
+ @key.valid?.should be_truthy
90
90
  end
91
91
  end
92
92
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money-tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.8.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Winkelspecht
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-28 00:00:00.000000000 Z
11
+ date: 2014-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.2.0
162
+ rubygems_version: 2.2.2
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: Bitcoin Hierarchical Deterministic Wallets in Ruby! (Bitcoin standard BIP0032)