peatio-litecoin 2.5.4 → 2.6.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 +4 -4
- data/Gemfile.lock +12 -12
- data/lib/peatio/litecoin/blockchain.rb +0 -11
- data/lib/peatio/litecoin/client.rb +16 -21
- data/lib/peatio/litecoin/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: 49def88f2fc442575f1c09fd0e8a02217c4b16913cfeb8c532adb97361a8d292
|
|
4
|
+
data.tar.gz: fe9f56fe7280248fc0d145f7c73ffa1feddc484763bd074bfee2ef6616817d3f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7a7730ea06bb994f0501508c5751ef08eadd19638342a0953703d1af6fca2240a798ba3a5b238b9f9540179a53ab59aaa10cadf5895b0730fb0262f0ff99a8e
|
|
7
|
+
data.tar.gz: 26ef9930cd7a42030264288fb0ad9a28c003d6732bee3a8ae4aca84dcab55b289b7423f8f6f2e65f894758098ffe8046860653dd44a782f811f11a2f49c6e4b0
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
peatio-litecoin (2.
|
|
4
|
+
peatio-litecoin (2.6.0)
|
|
5
5
|
activesupport (~> 5.2.3)
|
|
6
6
|
better-faraday (~> 1.0.5)
|
|
7
7
|
faraday (~> 0.17)
|
|
@@ -12,9 +12,9 @@ PATH
|
|
|
12
12
|
GEM
|
|
13
13
|
remote: https://rubygems.org/
|
|
14
14
|
specs:
|
|
15
|
-
activemodel (5.2.4.
|
|
16
|
-
activesupport (= 5.2.4.
|
|
17
|
-
activesupport (5.2.4.
|
|
15
|
+
activemodel (5.2.4.2)
|
|
16
|
+
activesupport (= 5.2.4.2)
|
|
17
|
+
activesupport (5.2.4.2)
|
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
19
19
|
i18n (>= 0.7, < 2)
|
|
20
20
|
minitest (~> 5.1)
|
|
@@ -34,13 +34,13 @@ GEM
|
|
|
34
34
|
clamp (1.3.1)
|
|
35
35
|
coderay (1.1.2)
|
|
36
36
|
concurrent-ruby (1.1.6)
|
|
37
|
-
connection_pool (2.2.
|
|
37
|
+
connection_pool (2.2.2)
|
|
38
38
|
cookiejar (0.3.3)
|
|
39
39
|
crack (0.4.3)
|
|
40
40
|
safe_yaml (~> 1.0.0)
|
|
41
41
|
daemons (1.3.1)
|
|
42
42
|
diff-lcs (1.3)
|
|
43
|
-
em-http-request (1.1.
|
|
43
|
+
em-http-request (1.1.5)
|
|
44
44
|
addressable (>= 2.3.4)
|
|
45
45
|
cookiejar (!= 0.3.1)
|
|
46
46
|
em-socksify (>= 0.3)
|
|
@@ -58,7 +58,7 @@ GEM
|
|
|
58
58
|
multipart-post (>= 1.2, < 3)
|
|
59
59
|
faraday_middleware (0.13.1)
|
|
60
60
|
faraday (>= 0.7.4, < 1.0)
|
|
61
|
-
faye (1.
|
|
61
|
+
faye (1.2.5)
|
|
62
62
|
cookiejar (>= 0.3.0)
|
|
63
63
|
em-http-request (>= 0.3.0)
|
|
64
64
|
eventmachine (>= 0.12.0)
|
|
@@ -71,19 +71,19 @@ GEM
|
|
|
71
71
|
websocket-driver (>= 0.5.1)
|
|
72
72
|
hashdiff (1.0.1)
|
|
73
73
|
http_parser.rb (0.6.0)
|
|
74
|
-
i18n (1.8.
|
|
74
|
+
i18n (1.8.2)
|
|
75
75
|
concurrent-ruby (~> 1.0)
|
|
76
76
|
jwt (2.2.1)
|
|
77
77
|
memoist (0.16.2)
|
|
78
78
|
method_source (1.0.0)
|
|
79
|
-
minitest (5.14.
|
|
79
|
+
minitest (5.14.0)
|
|
80
80
|
mocha (1.11.2)
|
|
81
81
|
multi_json (1.14.1)
|
|
82
82
|
multipart-post (2.1.1)
|
|
83
83
|
mysql2 (0.5.3)
|
|
84
84
|
net-http-persistent (3.0.1)
|
|
85
85
|
connection_pool (~> 2.2)
|
|
86
|
-
peatio (2.
|
|
86
|
+
peatio (2.4.4)
|
|
87
87
|
activemodel (> 5.2, <= 6.0.0)
|
|
88
88
|
amqp
|
|
89
89
|
bunny
|
|
@@ -132,9 +132,9 @@ GEM
|
|
|
132
132
|
addressable (>= 2.3.6)
|
|
133
133
|
crack (>= 0.3.2)
|
|
134
134
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
135
|
-
websocket-driver (0.7.
|
|
135
|
+
websocket-driver (0.7.1)
|
|
136
136
|
websocket-extensions (>= 0.1.0)
|
|
137
|
-
websocket-extensions (0.1.
|
|
137
|
+
websocket-extensions (0.1.4)
|
|
138
138
|
|
|
139
139
|
PLATFORMS
|
|
140
140
|
ruby
|
|
@@ -51,17 +51,6 @@ module Peatio
|
|
|
51
51
|
raise Peatio::Blockchain::ClientError, e
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
def transaction_sources(transaction)
|
|
55
|
-
transaction_hash = client.json_rpc(:getrawtransaction, [transaction.hash, 1])
|
|
56
|
-
transaction_hash['vin'].each_with_object([]) do |vin, source_addresses|
|
|
57
|
-
next if vin['txid'].blank?
|
|
58
|
-
|
|
59
|
-
vin_transaction = client.json_rpc(:getrawtransaction, [vin['txid'], 1])
|
|
60
|
-
source = vin_transaction['vout'].find { |hash| hash['n'] == vin['vout'] }
|
|
61
|
-
source_addresses << source['scriptPubKey']['addresses'][0]
|
|
62
|
-
end.compact.uniq
|
|
63
|
-
end
|
|
64
|
-
|
|
65
54
|
private
|
|
66
55
|
|
|
67
56
|
def build_transaction(tx_hash)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'memoist'
|
|
2
4
|
require 'faraday'
|
|
3
5
|
require 'better-faraday'
|
|
@@ -6,7 +8,7 @@ module Peatio
|
|
|
6
8
|
module Litecoin
|
|
7
9
|
class Client
|
|
8
10
|
Error = Class.new(StandardError)
|
|
9
|
-
|
|
11
|
+
ConnectionError = Class.new(Error)
|
|
10
12
|
|
|
11
13
|
class ResponseError < Error
|
|
12
14
|
def initialize(code, msg)
|
|
@@ -26,33 +28,27 @@ module Peatio
|
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
def json_rpc(method, params = [])
|
|
29
|
-
response = post
|
|
30
|
-
|
|
31
|
+
response = connection.post \
|
|
32
|
+
'/',
|
|
33
|
+
{ jsonrpc: '1.0', method: method, params: params }.to_json,
|
|
34
|
+
{ 'Accept' => 'application/json',
|
|
35
|
+
'Content-Type' => 'application/json' }
|
|
31
36
|
response.assert_2xx!
|
|
32
37
|
response = JSON.parse(response.body)
|
|
33
|
-
response['error'].tap
|
|
34
|
-
|
|
35
|
-
rescue => e
|
|
36
|
-
if e.is_a?(Error)
|
|
37
|
-
raise e
|
|
38
|
-
elsif e.is_a?(Faraday::Error)
|
|
39
|
-
raise ConnectionError, e
|
|
40
|
-
else
|
|
41
|
-
raise Error, e
|
|
38
|
+
response['error'].tap do |e|
|
|
39
|
+
raise ResponseError.new(e['code'], e['message']) if e
|
|
42
40
|
end
|
|
41
|
+
response.fetch('result')
|
|
42
|
+
rescue Faraday::Error => e
|
|
43
|
+
raise ConnectionError, e
|
|
43
44
|
end
|
|
44
45
|
|
|
45
46
|
private
|
|
46
47
|
|
|
47
|
-
def post(method, params)
|
|
48
|
-
connection.post("/", {jsonrpc: "1.0", method: method, params: params}.to_json,
|
|
49
|
-
"Accept" => "application/json", "Content-Type" => "application/json")
|
|
50
|
-
end
|
|
51
|
-
|
|
52
48
|
def connection
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
@connection ||= Faraday.new(@json_rpc_endpoint) do |f|
|
|
50
|
+
f.adapter :net_http_persistent, pool_size: 5
|
|
51
|
+
end.tap do |connection|
|
|
56
52
|
unless @json_rpc_endpoint.user.blank?
|
|
57
53
|
connection.basic_auth(@json_rpc_endpoint.user,
|
|
58
54
|
@json_rpc_endpoint.password)
|
|
@@ -62,4 +58,3 @@ module Peatio
|
|
|
62
58
|
end
|
|
63
59
|
end
|
|
64
60
|
end
|
|
65
|
-
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: peatio-litecoin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yaroslav S.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-05-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|