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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9421a1be926bd90f6279337fa64b3b3433f8f64f
|
4
|
+
data.tar.gz: 30a405eb7d851fe73718d6c16a33fbcfe192e0b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbe5b58c2f1a1edb0f2eb150dbb6ccda9a7f99402b57c155b8940b9b8fedd50bed8a6f44fdaf76d4ecc8f5bc28f5adb592d9badc0257384b100ad6e6527213df
|
7
|
+
data.tar.gz: eb84c2e065165deb649a687a905ee9009ae706d112278a213a2a72d3e2b691edad998553402877e4b8fef08f7f28be4d6b6eee7f9d33044e705060711d47d184
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
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:
|
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 "
|
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(:
|
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.
|
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.
|
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"]
|