money-tree 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
data/money-tree.gemspec CHANGED
@@ -1,27 +1,30 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'money-tree/version'
4
+ require "money-tree/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "money-tree"
8
- spec.version = MoneyTree::VERSION
9
- spec.authors = ["Micah Winkelspecht", "Afri Schoedon"]
10
- spec.email = ["winkelspecht@gmail.com", "gems@q9f.cc"]
11
- spec.description = %q{A Ruby Gem implementation of Bitcoin HD Wallets}
12
- spec.summary = %q{Bitcoin Hierarchical Deterministic Wallets in Ruby! (Bitcoin standard BIP0032)}
13
- spec.homepage = "https://github.com/gemhq/money-tree"
14
- spec.license = "MIT"
7
+ spec.name = "money-tree"
8
+ spec.version = MoneyTree::VERSION
9
+ spec.authors = ["Micah Winkelspecht", "Afri Schoedon"]
10
+ spec.email = ["winkelspecht@gmail.com", "gems@q9f.cc"]
11
+ spec.description = %q{A Ruby Gem implementation of Bitcoin HD Wallets}
12
+ spec.summary = %q{Bitcoin Hierarchical Deterministic Wallets in Ruby! (Bitcoin standard BIP0032)}
13
+ spec.homepage = "https://github.com/GemHQ/money-tree"
14
+ spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency 'openssl', '>= 2.2'
21
+ spec.metadata = {
22
+ "homepage_uri" => "https://github.com/GemHQ/money-tree",
23
+ "source_code_uri" => "https://github.com/GemHQ/money-tree",
24
+ "github_repo" => "https://github.com/GemHQ/money-tree",
25
+ "bug_tracker_uri" => "https://github.com/GemHQ/money-tree/issues",
26
+ }.freeze
22
27
 
23
- spec.add_development_dependency "bundler", "~> 2.2"
24
- spec.add_development_dependency "rake", "~> 13.0"
25
- spec.add_development_dependency "rspec", "~> 3.10"
26
- spec.add_development_dependency "pry", "~> 0.4"
28
+ spec.platform = Gem::Platform::RUBY
29
+ spec.required_ruby_version = ">= 2.6", "< 4.0"
27
30
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe MoneyTree::Address do
4
4
  describe "initialize" do
@@ -25,6 +25,8 @@ describe MoneyTree::Address do
25
25
  expect(address.to_s).to eql("13uVqa35BMo4mYq9LiZrXVzoz9EFZ6aoXe")
26
26
  expect(address.private_key.to_s).to eql("KzPkwAXJ4wtXHnbamTaJqoMrzwCUUJaqhUxnqYhnZvZH6KhgmDPK")
27
27
  expect(address.public_key.to_s).to eql("13uVqa35BMo4mYq9LiZrXVzoz9EFZ6aoXe")
28
+ expect(address.to_p2wpkh_p2sh).to eql("31vNN7WVDxjvc5XZVKW3qV4B3nFLxsRPnE")
29
+ expect(address.to_bech32).to eql("bc1qrlwlgt5d0sdtq882qvk3jc0sywucn76fwcmqma")
28
30
  end
29
31
 
30
32
  it "imports a private key in compressed wif format" do
@@ -32,6 +34,8 @@ describe MoneyTree::Address do
32
34
  expect(address.private_key.key).to eql("5eae5375fb5f7a0ea650566363befa2830ef441bdcb19198adf318faee86d64b")
33
35
  expect(address.public_key.key).to eql("022dfc2557a007c93092c2915f11e8aa70c4f399a6753e2e908330014091580e4b")
34
36
  expect(address.to_s).to eql("13uVqa35BMo4mYq9LiZrXVzoz9EFZ6aoXe")
37
+ expect(address.to_p2wpkh_p2sh).to eql("31vNN7WVDxjvc5XZVKW3qV4B3nFLxsRPnE")
38
+ expect(address.to_bech32).to eql("bc1qrlwlgt5d0sdtq882qvk3jc0sywucn76fwcmqma")
35
39
  end
36
40
 
37
41
  it "imports a private key in uncompressed wif format" do
@@ -49,6 +53,8 @@ describe MoneyTree::Address do
49
53
  it "returns compressed base58 public key" do
50
54
  expect(@address.to_s).to eql("13uVqa35BMo4mYq9LiZrXVzoz9EFZ6aoXe")
51
55
  expect(@address.public_key.to_s).to eql("13uVqa35BMo4mYq9LiZrXVzoz9EFZ6aoXe")
56
+ expect(@address.to_p2wpkh_p2sh).to eql("31vNN7WVDxjvc5XZVKW3qV4B3nFLxsRPnE")
57
+ expect(@address.to_bech32).to eql("bc1qrlwlgt5d0sdtq882qvk3jc0sywucn76fwcmqma")
52
58
  end
53
59
 
54
60
  it "returns compressed WIF private key" do
@@ -58,11 +64,23 @@ describe MoneyTree::Address do
58
64
 
59
65
  context "bitcoin wiki" do
60
66
  # ref https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
61
- subject(:wiki) { MoneyTree::Address.new private_key: '18e14a7b6a307f426a94f8114701e7c8e774e7f9a47e2c2035db29a206321725' }
67
+ subject(:wiki_v1) { MoneyTree::Address.new private_key: "18e14a7b6a307f426a94f8114701e7c8e774e7f9a47e2c2035db29a206321725" }
62
68
 
63
- it "always regenerates the bitcoin wiki example" do
64
- expect(wiki.public_key.key).to eq "0250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352"
65
- expect(wiki.to_s).to eq "1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs"
69
+ it "always regenerates the bitcoin wiki v1 example" do
70
+ expect(wiki_v1.public_key.key).to eq "0250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352"
71
+ expect(wiki_v1.to_s).to eq "1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs"
72
+ expect(wiki_v1.to_p2wpkh_p2sh).to eql("3BxwGNjvG4CP14tAZodgYyZ7UTjruYDyAM")
73
+ expect(wiki_v1.to_bech32).to eql("bc1q7499s50fxu4c0qg23esvm5h8elvqkm33r2tdza")
74
+ end
75
+
76
+ # ref https://en.bitcoin.it/wiki/Bech32
77
+ subject(:wiki_bech32) { MoneyTree::Address.new private_key: "0000000000000000000000000000000000000000000000000000000000000001" }
78
+
79
+ it "always regenerates the bitcoin wiki v1 example" do
80
+ expect(wiki_bech32.public_key.key).to eq "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
81
+ expect(wiki_bech32.to_s).to eq "1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH"
82
+ expect(wiki_bech32.to_p2wpkh_p2sh).to eql("3JvL6Ymt8MVWiCNHC7oWU6nLeHNJKLZGLN")
83
+ expect(wiki_bech32.to_bech32).to eql("bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4")
66
84
  end
67
85
  end
68
86
 
@@ -0,0 +1,9 @@
1
+ require "spec_helper"
2
+
3
+ describe MoneyTree do
4
+ it "0.11.1 works" do
5
+
6
+ # placeholder to set up spec in future
7
+ expect(MoneyTree::VERSION).to eq "0.11.1"
8
+ end
9
+ end