sibit 0.20.4 → 0.21.0

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
  SHA256:
3
- metadata.gz: 5fce6b2ed89b0207cda60852aa0308c19e176725782e6821141c73a24dcdb2f9
4
- data.tar.gz: 807d723a53772eb71002a0223030795ab47710952979398b207b4d87c58fca75
3
+ metadata.gz: b6560adb5310350a01c7d22c8fa4dd58abc73e9c60c737117d8929cc1a77bdc1
4
+ data.tar.gz: 31f7e57e269801972b5e3f8cb11f29d9ff847a214b29f488c0a809bc35d0341e
5
5
  SHA512:
6
- metadata.gz: 5186670b03e26882ab1863b056d2951e0116bd71e4f4ef1ca213ea4e08958b85bac00baeb9763ab24c3ffce35bcc280d282d5ab89621a38874f53df530308c66
7
- data.tar.gz: 9c816996ea654affba93c3d7d4e42b46559a7ff8a73f74765f28331c991038f2af4aa0361deea5b3332f7a9b44896f450e666888adef13414a15dbd9bb5a3523
6
+ metadata.gz: 87d170b48eca5cd5ecd76d6e60bbf9b2fb5575f1e203a92aab6d10547fcfbf9043f30e55d12f21e45ff6929ab46538a2c56edd103df8e48cc0e621fca1810fe2
7
+ data.tar.gz: 910666d824ba0e74414e39a51d18b3e5fbbeae6af37cd4c8d15cf27e2b591a1b3d0b992f98b324e3c43dc0fa07ae5a5d19e0bb403f5958242e2f47a2eaeb412a
@@ -58,8 +58,13 @@ class Sibit
58
58
  end
59
59
 
60
60
  # Get hash of the block after this one.
61
- def next_of(_hash)
62
- raise Sibit::NotSupportedError, 'Blockchain API doesn\'t provide next_of()'
61
+ def next_of(hash)
62
+ json = Sibit::Json.new(http: @http, log: @log).get(
63
+ URI("https://blockchain.info/rawblock/#{hash}")
64
+ )
65
+ nxt = json['next_block']
66
+ @log.info("The next block of #{hash} is #{nxt}")
67
+ nxt
63
68
  end
64
69
 
65
70
  # The height of the block.
@@ -26,5 +26,5 @@
26
26
  # License:: MIT
27
27
  class Sibit
28
28
  # Current version of the library.
29
- VERSION = '0.20.4'
29
+ VERSION = '0.21.0'
30
30
  end
@@ -45,4 +45,13 @@ class TestBlockchain < Minitest::Test
45
45
  assert_equal('h1', json[:txns][0][:hash])
46
46
  assert(json[:txns][0][:outputs].is_a?(Array))
47
47
  end
48
+
49
+ def test_next_of
50
+ hash = '0000000000000000000f676241aabc9b62b748d26192a44bc25720c34de27d19'
51
+ stub_request(:get, "https://blockchain.info/rawblock/#{hash}")
52
+ .to_return(body: '{"next_block": "nxt"}')
53
+ sibit = Sibit::Blockchain.new
54
+ nxt = sibit.next_of(hash)
55
+ assert_equal('nxt', nxt)
56
+ end
48
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sibit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.4
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko