onchain 2.23 → 3.00
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/onchain/block_chain.rb +11 -5
- data/lib/onchain.rb +22 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c7e9b92e6b645c709f1c5bbf2cfc22eebbd7c37
|
4
|
+
data.tar.gz: bc3b2e62455912eef0238b55cc84ea75338ffffb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20b36da1e5060053b06751bf6b770d813850ff9e0a2015d25f5ad7e063dcf22743ce711984a287bf4c52cf71cfaa5a307edb4de80fac0b84f02ba9d20098bd44
|
7
|
+
data.tar.gz: 7835ddfe5e983f7ebd74a87d85b42a12336c66f2c9b305141278e5b73df6503e22283f34a5543b5e8f7fb589833687205c00bdabaeab2c2c8514d3a25c2bcac4
|
data/lib/onchain/block_chain.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'net/http'
|
2
|
+
require 'net/ssh'
|
2
3
|
require 'json'
|
3
4
|
|
4
5
|
# We support a number of blockchain API providers,
|
@@ -27,13 +28,14 @@ end
|
|
27
28
|
class OnChain::BlockChain
|
28
29
|
class << self
|
29
30
|
|
30
|
-
ALL_SUPPLIERS = [ :blockinfo, :insight, :blockr ]
|
31
|
+
ALL_SUPPLIERS = [ :blockinfo, :insight, :blockr, :bitcoind ]
|
31
32
|
|
32
33
|
def method_missing (method_name, *args, &block)
|
33
34
|
|
34
35
|
network = :bitcoin
|
36
|
+
# List of allowable networks.
|
35
37
|
if args.length > 0
|
36
|
-
if
|
38
|
+
if [:testnet3, :zcash_testnet, :zcash, :zclassic].include? args[args.length - 1]
|
37
39
|
network = args[args.length - 1]
|
38
40
|
end
|
39
41
|
end
|
@@ -124,15 +126,19 @@ class OnChain::BlockChain
|
|
124
126
|
ALL_SUPPLIERS.each do |supplier|
|
125
127
|
if cache_read(supplier.to_s) == nil
|
126
128
|
|
127
|
-
if supplier == :blockinfo and
|
129
|
+
if supplier == :blockinfo and ! [:bitcoin].include? network
|
128
130
|
next
|
129
131
|
end
|
130
132
|
|
131
|
-
if supplier == :
|
133
|
+
if supplier == :blockr and ! [:bitcoin, :testnet3].include? network
|
132
134
|
next
|
133
135
|
end
|
134
136
|
|
135
|
-
if supplier == :
|
137
|
+
if supplier == :insight and ! [:bitcoin, :testnet3].include? network
|
138
|
+
next
|
139
|
+
end
|
140
|
+
|
141
|
+
if supplier == :bitcoind and ENV[network.to_s.upcase + '_HOST'] == nil
|
136
142
|
next
|
137
143
|
end
|
138
144
|
|
data/lib/onchain.rb
CHANGED
@@ -2,8 +2,30 @@ require 'onchain/block_chain.rb'
|
|
2
2
|
require 'onchain/providers/blockchaininfo_api.rb'
|
3
3
|
require 'onchain/providers/blockr_api.rb'
|
4
4
|
require 'onchain/providers/insight_api.rb'
|
5
|
+
require 'onchain/providers/bitcoind_api.rb'
|
5
6
|
require 'onchain/sweeper.rb'
|
6
7
|
require 'onchain/payments.rb'
|
7
8
|
require 'onchain/transaction.rb'
|
8
9
|
require 'money-tree'
|
9
10
|
require 'bitcoin'
|
11
|
+
|
12
|
+
|
13
|
+
# Setup the bitcoin gem for zcash
|
14
|
+
module Bitcoin
|
15
|
+
|
16
|
+
NETWORKS[:zcash_testnet] = NETWORKS[:testnet3].merge({
|
17
|
+
address_version: "1D25",
|
18
|
+
p2sh_version: "1CBA"
|
19
|
+
})
|
20
|
+
|
21
|
+
NETWORKS[:zcash] = NETWORKS[:bitcoin].merge({
|
22
|
+
address_version: "1CB8",
|
23
|
+
p2sh_version: "1CBD"
|
24
|
+
})
|
25
|
+
|
26
|
+
NETWORKS[:zclassic] = NETWORKS[:bitcoin].merge({
|
27
|
+
address_version: "1CB8",
|
28
|
+
p2sh_version: "1CBD"
|
29
|
+
})
|
30
|
+
|
31
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onchain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '3.00'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Number 6
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: net-ssh
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: Call 3rd party API's but also switch API's if a 3rd party is down
|
84
98
|
email:
|
85
99
|
- support@onchain.io
|