peatio-bitcoincash 2.5.4 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -12
- data/lib/peatio/bitcoincash/blockchain.rb +0 -11
- data/lib/peatio/bitcoincash/client.rb +13 -17
- data/lib/peatio/bitcoincash/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: 153350f03989bb74fea9f1b21b3a5140a68f647df3c43344a13e04262cfafab2
|
4
|
+
data.tar.gz: ad36fcbc23051f3f0e03f333771ca50e18c265931735817abfa2145f171baab5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 107a2d7934d667803dff0ec8f93384ce5adde514c639f32d1f6e6ce7a2554e3cbf9d654666548a1a7916fa2e98c49206d14f9d0bc936193a9e2b5c0f3522a244
|
7
|
+
data.tar.gz: 832f33bd88fdb6e27ae559625167a830cfd0c84a54eae21d3e90ae7821a4bc1edd393a3e54ec6f2ed8c9aec0582f29a7b1c6d208945944c6244c6fe7cc3ef476
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
peatio-bitcoincash (2.
|
4
|
+
peatio-bitcoincash (2.6.0)
|
5
5
|
activesupport (~> 5.2.3)
|
6
6
|
better-faraday (~> 1.0.5)
|
7
7
|
cash-addr (~> 0.2.0)
|
@@ -13,9 +13,9 @@ PATH
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
activemodel (5.2.4.
|
17
|
-
activesupport (= 5.2.4.
|
18
|
-
activesupport (5.2.4.
|
16
|
+
activemodel (5.2.4.2)
|
17
|
+
activesupport (= 5.2.4.2)
|
18
|
+
activesupport (5.2.4.2)
|
19
19
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
20
|
i18n (>= 0.7, < 2)
|
21
21
|
minitest (~> 5.1)
|
@@ -38,13 +38,13 @@ GEM
|
|
38
38
|
clamp (1.3.1)
|
39
39
|
coderay (1.1.2)
|
40
40
|
concurrent-ruby (1.1.6)
|
41
|
-
connection_pool (2.2.
|
41
|
+
connection_pool (2.2.2)
|
42
42
|
cookiejar (0.3.3)
|
43
43
|
crack (0.4.3)
|
44
44
|
safe_yaml (~> 1.0.0)
|
45
45
|
daemons (1.3.1)
|
46
46
|
diff-lcs (1.3)
|
47
|
-
em-http-request (1.1.
|
47
|
+
em-http-request (1.1.5)
|
48
48
|
addressable (>= 2.3.4)
|
49
49
|
cookiejar (!= 0.3.1)
|
50
50
|
em-socksify (>= 0.3)
|
@@ -62,7 +62,7 @@ GEM
|
|
62
62
|
multipart-post (>= 1.2, < 3)
|
63
63
|
faraday_middleware (0.13.1)
|
64
64
|
faraday (>= 0.7.4, < 1.0)
|
65
|
-
faye (1.
|
65
|
+
faye (1.2.5)
|
66
66
|
cookiejar (>= 0.3.0)
|
67
67
|
em-http-request (>= 0.3.0)
|
68
68
|
eventmachine (>= 0.12.0)
|
@@ -75,19 +75,19 @@ GEM
|
|
75
75
|
websocket-driver (>= 0.5.1)
|
76
76
|
hashdiff (1.0.1)
|
77
77
|
http_parser.rb (0.6.0)
|
78
|
-
i18n (1.8.
|
78
|
+
i18n (1.8.2)
|
79
79
|
concurrent-ruby (~> 1.0)
|
80
80
|
jwt (2.2.1)
|
81
81
|
memoist (0.16.2)
|
82
82
|
method_source (1.0.0)
|
83
|
-
minitest (5.14.
|
83
|
+
minitest (5.14.0)
|
84
84
|
mocha (1.11.2)
|
85
85
|
multi_json (1.14.1)
|
86
86
|
multipart-post (2.1.1)
|
87
87
|
mysql2 (0.5.3)
|
88
88
|
net-http-persistent (3.0.1)
|
89
89
|
connection_pool (~> 2.2)
|
90
|
-
peatio (2.
|
90
|
+
peatio (2.4.4)
|
91
91
|
activemodel (> 5.2, <= 6.0.0)
|
92
92
|
amqp
|
93
93
|
bunny
|
@@ -136,9 +136,9 @@ GEM
|
|
136
136
|
addressable (>= 2.3.6)
|
137
137
|
crack (>= 0.3.2)
|
138
138
|
hashdiff (>= 0.4.0, < 2.0.0)
|
139
|
-
websocket-driver (0.7.
|
139
|
+
websocket-driver (0.7.1)
|
140
140
|
websocket-extensions (>= 0.1.0)
|
141
|
-
websocket-extensions (0.1.
|
141
|
+
websocket-extensions (0.1.4)
|
142
142
|
|
143
143
|
PLATFORMS
|
144
144
|
ruby
|
@@ -53,17 +53,6 @@ module Peatio
|
|
53
53
|
raise Peatio::Blockchain::ClientError, e
|
54
54
|
end
|
55
55
|
|
56
|
-
def transaction_sources(transaction)
|
57
|
-
transaction_hash = client.json_rpc(:getrawtransaction, [transaction.hash, 1])
|
58
|
-
transaction_hash['vin'].each_with_object([]) do |vin, source_addresses|
|
59
|
-
next if vin['txid'].blank?
|
60
|
-
|
61
|
-
vin_transaction = client.json_rpc(:getrawtransaction, [vin['txid'], 1])
|
62
|
-
source = vin_transaction['vout'].find { |hash| hash['n'] == vin['vout'] }
|
63
|
-
source_addresses << source['scriptPubKey']['addresses'][0]
|
64
|
-
end.compact.uniq
|
65
|
-
end
|
66
|
-
|
67
56
|
private
|
68
57
|
|
69
58
|
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 Bitcoincash
|
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,29 +28,23 @@ 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
49
|
@connection ||= Faraday.new(@json_rpc_endpoint) do |f|
|
54
50
|
f.adapter :net_http_persistent, pool_size: 5
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peatio-bitcoincash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dinesh Chohda
|
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
|