sibit 0.18.6 → 0.18.7

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
  SHA256:
3
- metadata.gz: ecbcb8af739829048716cc6a4982194b5789a387cc8bf43bff7c04aea56e3837
4
- data.tar.gz: 50b3b2d711f8fa716dc0eb1f87f398d66dc7156256342b8bfe26893bf6447f35
3
+ metadata.gz: 2e4825728b50903a70df2ad5349bbf7ccdd785d30d3c884200dd03cdb9c315c3
4
+ data.tar.gz: 047fcd5c26abee133f4c52f3a53a9b52033a382607b719e87afa1a5c26803dcb
5
5
  SHA512:
6
- metadata.gz: cf27929a0f51bee419d1b50c5bff9b378e8505503f4e872b5d842c9c1abdeaf6bcc9f4538b3755b7a7d4baacf15782f0571adddc2857b119d5bacbbc95839db8
7
- data.tar.gz: 2761fa763d4800979cf5b0df30c90b62f5f879992e01f46dd9746f92651dc65497caaea54db3608bedcf38d602195fc3576a626567fc7ca886545a5482fbbf05
6
+ metadata.gz: 76412795bcfbbe81463431234c774a0a91d6aadb7722760ee2190899ee28325ad0631abfc6d3e0d440cc864e54220cb9ea3323a4c34671270ed8341d7b1509db
7
+ data.tar.gz: 7ec2b144c506667427f29e0531df039cb2761760e78a6d42a92174c521af56d69039bf420e77b6ee84abf887b9902681bd8c6bc6882ec0586feddc36a56c0d3e
data/.rultor.yml CHANGED
@@ -1,15 +1,11 @@
1
1
  assets:
2
2
  rubygems.yml: yegor256/home#assets/rubygems.yml
3
3
  install: |
4
- export GEM_HOME=~/.ruby
5
- export GEM_PATH=$GEM_HOME:$GEM_PATH
6
- sudo apt-get -y update
7
- sudo gem install pdd -v 0.20.5
8
- bundle install
4
+ pdd -f /dev/null
5
+ sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
9
6
  release:
10
7
  script: |-
11
8
  bundle exec rake
12
- rm -rf *.gem
13
9
  sed -i "s/1\.0\.snapshot/${tag}/g" lib/sibit/version.rb
14
10
  git add lib/sibit/version.rb
15
11
  git commit -m "version set to ${tag}"
@@ -19,7 +15,6 @@ release:
19
15
  merge:
20
16
  script: |-
21
17
  bundle exec rake
22
- pdd -f /dev/null
23
18
  deploy:
24
19
  script: |-
25
20
  echo "There is nothing to deploy"
data/lib/sibit/btc.rb CHANGED
@@ -83,7 +83,9 @@ class Sibit
83
83
  json = Sibit::Json.new(http: @http, log: @log).get(
84
84
  URI("https://chain.api.btc.com/v3/block/#{hash}")
85
85
  )
86
- h = json['data']['height']
86
+ data = json['data']
87
+ raise Sibit::Error, "The block #{hash} not found" if data.nil?
88
+ h = data['height']
87
89
  @log.info("The height of #{hash} is #{h}")
88
90
  h
89
91
  end
@@ -97,7 +99,9 @@ class Sibit
97
99
  def latest
98
100
  uri = URI('https://chain.api.btc.com/v3/block/latest')
99
101
  json = Sibit::Json.new(http: @http, log: @log).get(uri)
100
- hash = json['data']['hash']
102
+ data = json['data']
103
+ raise Sibit::Error, 'The latest block not found' if data.nil?
104
+ hash = data['hash']
101
105
  @log.info("The hash of the latest block is #{hash}")
102
106
  hash
103
107
  end
@@ -109,7 +113,9 @@ class Sibit
109
113
  json = Sibit::Json.new(http: @http, log: @log).get(
110
114
  URI("https://chain.api.btc.com/v3/address/#{hash}/unspent")
111
115
  )
112
- json['data']['list'].each do |u|
116
+ data = json['data']
117
+ raise Sibit::Error, "The address #{hash} not found" if data.nil?
118
+ data['list'].each do |u|
113
119
  outs = Sibit::Json.new(http: @http, log: @log).get(
114
120
  URI("https://chain.api.btc.com/v3/tx/#{u['tx_hash']}?verbose=3")
115
121
  )['data']['outputs']
@@ -138,13 +144,15 @@ class Sibit
138
144
  head = Sibit::Json.new(http: @http, log: @log).get(
139
145
  URI("https://chain.api.btc.com/v3/block/#{hash}")
140
146
  )
141
- nxt = head['data']['next_block_hash']
147
+ data = head['data']
148
+ raise Sibit::Error, "The block #{hash} not found" if data.nil?
149
+ nxt = data['next_block_hash']
142
150
  nxt = nil if nxt == '0000000000000000000000000000000000000000000000000000000000000000'
143
151
  {
144
- hash: head['data']['hash'],
145
- orphan: head['data']['is_orphan'],
152
+ hash: data['hash'],
153
+ orphan: data['is_orphan'],
146
154
  next: nxt,
147
- previous: head['data']['prev_block_hash'],
155
+ previous: data['prev_block_hash'],
148
156
  txns: txns(hash)
149
157
  }
150
158
  end
data/lib/sibit/version.rb CHANGED
@@ -26,5 +26,5 @@
26
26
  # License:: MIT
27
27
  class Sibit
28
28
  # Current version of the library.
29
- VERSION = '0.18.6'
29
+ VERSION = '0.18.7'
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sibit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.6
4
+ version: 0.18.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-14 00:00:00.000000000 Z
11
+ date: 2020-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace