onchain 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 434e9d7b76fb77c75cd6ee42ee305c88ff1e654f
4
- data.tar.gz: 3414885379272cc9c61a53a1310de8a30652c73b
3
+ metadata.gz: 8c228bc7fc04077cb97c968852319c837509037d
4
+ data.tar.gz: ffcfa36e6caa074822a3d9d0c94017b6377ef6ad
5
5
  SHA512:
6
- metadata.gz: 15e32c96f9ad075a6d390ed51c82fede89aadc6d964414b224c92887bb81e027e0730ff2ff3a7fd22e73535470966d0e1e4a2ea442f3bab26c5d99725e025437
7
- data.tar.gz: f38144aac4022320524fc41fb273b6f88afac0795f6b08598c4620d948f4faa035dedb287f9cd509205fae25b20eeae4f3023bb0d4615a858a29577b090955d3
6
+ metadata.gz: 8631349904a4a9b998b5adb898140361d939bc9e049de5a4625fba217ece90889c5eddf603bd99fe30c4e262abeb87099af1e34da4f84610c0187e6874144dee
7
+ data.tar.gz: 861eaf033070d9760caaaa709f28562213c3760489ae17c76d4ae3d3016f573567645d70d8682168f7b272f69d8ce49b2c8fb878e110292b7a5c0a1fd106e87e
@@ -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
@@ -34,7 +34,6 @@ class OnChain
34
34
  "OP_EQUALVERIFY OP_CHECKSIG").to_payload)
35
35
 
36
36
  tx.add_out(txout)
37
- puts tx.to_json
38
37
  end
39
38
 
40
39
  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: 1.0.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-01 00:00:00.000000000 Z
11
+ date: 2014-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake