onchain 1.3.4 → 1.3.5

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: c393f220ed7386b484272b0f43f9f0c55633b4f9
4
- data.tar.gz: 69ca9d5d7b35a7c3b01200433cf26e6ec5fbbace
3
+ metadata.gz: f97f703fb5014f03ff2396d8d1d5b86bef410733
4
+ data.tar.gz: a07dcebcc42c255d501ec1c2b2891c58a785853b
5
5
  SHA512:
6
- metadata.gz: 804dca62121bdcdbf8e6f50b86335019230658166a7b57152107dd9e944ead37400bde748c7441e2823a1949cc495005ce27fb3dc7ed010b9641f2dfda820639
7
- data.tar.gz: 8308f9c723a4b99158ab7745b129c63aff91cfaee9faddeb09ba3d9b77f6c3db79fa94c6e518dec794ef6fef6411b5ec72c643b40a5a32a7f929a8e8de29c941
6
+ metadata.gz: b3a3cf891cb74cace09d4dd30d9f659cf1ea578e3313f0d645d276c27037bb39714813ed23811c763d6a64e4dde3505b3e9fdeebdb76a373de4c08e5af1a9b4e
7
+ data.tar.gz: 59f6652377b1cd185b5242fc73e67849c6f929fc9faede954ba3b12cb7ef59ff7c2a2eb2fe19251f86dcce5393ae7e0893705e06ef587397eac7a71006a4ca07
@@ -54,8 +54,10 @@ class OnChain::BlockChain
54
54
  if cache_read(address) == nil
55
55
 
56
56
  addr = Chain.get_address(address)
57
- bal = addr["balance"] / 100000000.0
58
- cache_write(address, bal, BALANCE_CACHE_FOR)
57
+ if addr.count > 0
58
+ bal = addr[0]["total"]["balance"].to_i / 100000000.0
59
+ cache_write(address, bal, BALANCE_CACHE_FOR)
60
+ end
59
61
 
60
62
  end
61
63
  return cache_read(address)
@@ -110,7 +112,7 @@ class OnChain::BlockChain
110
112
  end
111
113
 
112
114
  res.each do |address|
113
- bal = address["balance"] / 100000000.0
115
+ bal = address["total"]["balance"] / 100000000.0
114
116
  cache_write(address["address"], bal, BALANCE_CACHE_FOR)
115
117
  end
116
118
  end
@@ -1,3 +1,5 @@
1
+ require 'rest_client'
2
+
1
3
  class OnChain::Sweeper
2
4
  class << self
3
5
 
@@ -135,5 +137,9 @@ class OnChain::Sweeper
135
137
  return OnChain.bin_to_hex(tx.to_payload), paths
136
138
  end
137
139
 
140
+ def post_tx_for_signing(tx_hex, meta)
141
+ RestClient.post 'https://onchain.io/api/v1/transaction', :tx => tx_hex, :meta_data => meta
142
+ end
143
+
138
144
  end
139
145
  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.3.4
4
+ version: 1.3.5
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-28 00:00:00.000000000 Z
11
+ date: 2014-11-03 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: rest-client
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
  - ian@onchain.io