onchain 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onchain/block_chain.rb +21 -2
- data/lib/onchain/sweeper.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c228bc7fc04077cb97c968852319c837509037d
|
4
|
+
data.tar.gz: ffcfa36e6caa074822a3d9d0c94017b6377ef6ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8631349904a4a9b998b5adb898140361d939bc9e049de5a4625fba217ece90889c5eddf603bd99fe30c4e262abeb87099af1e34da4f84610c0187e6874144dee
|
7
|
+
data.tar.gz: 861eaf033070d9760caaaa709f28562213c3760489ae17c76d4ae3d3016f573567645d70d8682168f7b272f69d8ce49b2c8fb878e110292b7a5c0a1fd106e87e
|
data/lib/onchain/block_chain.rb
CHANGED
@@ -75,6 +75,27 @@ class OnChain
|
|
75
75
|
return []
|
76
76
|
end
|
77
77
|
|
78
|
+
def get_transactions(address)
|
79
|
+
begin
|
80
|
+
base_url = "http://btc.blockr.io/api/v1/address/txs/#{address}"
|
81
|
+
json = fetch_response(base_url, true)
|
82
|
+
|
83
|
+
unspent = []
|
84
|
+
|
85
|
+
json['data']['txs'].each do |data|
|
86
|
+
line = []
|
87
|
+
line << data['tx']
|
88
|
+
line << (data['amount'].to_f * 100000000).to_i
|
89
|
+
unspent << line
|
90
|
+
end
|
91
|
+
|
92
|
+
return unspent
|
93
|
+
rescue Exception => e
|
94
|
+
puts e.to_s
|
95
|
+
'Unspent outputs could not be retrieved'
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
78
99
|
def get_unspent_outs(address)
|
79
100
|
|
80
101
|
|
@@ -236,7 +257,6 @@ class OnChain
|
|
236
257
|
end
|
237
258
|
return cache_read(address)
|
238
259
|
rescue Exception => e
|
239
|
-
puts e
|
240
260
|
'Balance could not be retrieved'
|
241
261
|
end
|
242
262
|
end
|
@@ -257,7 +277,6 @@ class OnChain
|
|
257
277
|
begin
|
258
278
|
base_url = "http://blockchain.info/#{cmd}/#{address}?format=json" + params
|
259
279
|
|
260
|
-
puts base_url
|
261
280
|
fetch_response(base_url, true)
|
262
281
|
rescue
|
263
282
|
blockchain_is_down
|
data/lib/onchain/sweeper.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Purton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|