straight 0.2.0 → 0.2.1

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: 1ce549f0d3b951b8ce6e5d6e35ba868497b977e7
4
- data.tar.gz: 5c44763aa3b9d35441e0d1bdd4824dac85238320
3
+ metadata.gz: 9421a1be926bd90f6279337fa64b3b3433f8f64f
4
+ data.tar.gz: 30a405eb7d851fe73718d6c16a33fbcfe192e0b2
5
5
  SHA512:
6
- metadata.gz: e4632fafae05cd13ab8443a6817806bca0e67fa0f7eddc03027944287e6c57c8437bd914f18589db3b9e39a91ac2a9e796d68015485132ff2e68774fe70f4f86
7
- data.tar.gz: 0724e768858d85d0b3f9290d6570f75944167554b9b5ed5177cbb97c1ae76f5569b68730e5a77cba88db1b499413e486381b0dfe35681f5c8aab8051cbc0982d
6
+ metadata.gz: dbe5b58c2f1a1edb0f2eb150dbb6ccda9a7f99402b57c155b8940b9b8fedd50bed8a6f44fdaf76d4ecc8f5bc28f5adb592d9badc0257384b100ad6e6527213df
7
+ data.tar.gz: eb84c2e065165deb649a687a905ee9009ae706d112278a213a2a72d3e2b691edad998553402877e4b8fef08f7f28be4d6b6eee7f9d33044e705060711d47d184
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -51,8 +51,6 @@ module Straight
51
51
  unspent
52
52
  end
53
53
 
54
- # Here we are using Blockchain.info API at this point because I'm not sure how
55
- # to get latest block from Mycelium WAPI
56
54
  def latest_block(force_reload: false)
57
55
  # If we checked Blockchain.info latest block data
58
56
  # more than a minute ago, check again. Otherwise, use cached version.
@@ -61,7 +59,7 @@ module Straight
61
59
  force_reload
62
60
  @latest_block = {
63
61
  cache_timestamp: Time.now,
64
- block: JSON.parse(HTTParty.get("https://blockchain.info/latestblock", timeout: 4, verify: false).body)
62
+ block: api_request('queryUnspentOutputs', { addresses: []} )
65
63
  }
66
64
  else
67
65
  @latest_block
@@ -30,10 +30,14 @@ RSpec.describe Straight::Blockchain::MyceliumAdapter do
30
30
  expect(adapter.fetch_transaction(tid)[:tid]).to eq(tid)
31
31
  end
32
32
 
33
- it "caches blockchain.info latestblock requests" do
33
+ it "gets the latest block number" do
34
+ expect(adapter.latest_block[:block]["height"]).to be_kind_of(Integer)
35
+ end
36
+
37
+ it "caches latestblock requests" do
34
38
  latest_block_response = double('Blockchain info latest block response')
35
- expect(latest_block_response).to receive(:body).and_return('{ "height": 1 }')
36
- expect(HTTParty).to receive(:get).with("https://blockchain.info/latestblock", timeout: 4, verify: false).once.and_return(latest_block_response)
39
+ expect(latest_block_response).to receive(:body).and_return('{ "r": { "height": 1 }}')
40
+ expect(HTTParty).to receive(:post).with("https://mws2.mycelium.com/wapi/wapi/queryUnspentOutputs", anything).once.and_return(latest_block_response)
37
41
  adapter.send(:calculate_confirmations, 1, force_latest_block_reload: true)
38
42
  adapter.send(:calculate_confirmations, 1)
39
43
  adapter.send(:calculate_confirmations, 1)
data/straight.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: straight 0.2.0 ruby lib
5
+ # stub: straight 0.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "straight"
9
- s.version = "0.2.0"
9
+ s.version = "0.2.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: straight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Snitko