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 +4 -4
- data/.rultor.yml +2 -7
- data/lib/sibit/btc.rb +15 -7
- data/lib/sibit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e4825728b50903a70df2ad5349bbf7ccdd785d30d3c884200dd03cdb9c315c3
|
4
|
+
data.tar.gz: 047fcd5c26abee133f4c52f3a53a9b52033a382607b719e87afa1a5c26803dcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
5
|
-
|
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
|
-
|
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
|
-
|
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']
|
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
|
-
|
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:
|
145
|
-
orphan:
|
152
|
+
hash: data['hash'],
|
153
|
+
orphan: data['is_orphan'],
|
146
154
|
next: nxt,
|
147
|
-
previous:
|
155
|
+
previous: data['prev_block_hash'],
|
148
156
|
txns: txns(hash)
|
149
157
|
}
|
150
158
|
end
|
data/lib/sibit/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2020-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|