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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48b2f2ab9c8a1c69e3ffc4437dc7288b0dc4ba014c7bbdbf55703ab87b246d38
4
- data.tar.gz: 66fb09f0725d67ea994d8dd33f39381f11fb54775eaa4c4f39be40a2c91f37a1
3
+ metadata.gz: 153350f03989bb74fea9f1b21b3a5140a68f647df3c43344a13e04262cfafab2
4
+ data.tar.gz: ad36fcbc23051f3f0e03f333771ca50e18c265931735817abfa2145f171baab5
5
5
  SHA512:
6
- metadata.gz: 8e78082443be6dfbdd3a7392d86d653bd3ca443cfac0181a1171a81c432411cea7003288ad77b1f1341889593348e60757d0cb4a05f38a2f50792f5d86944fb2
7
- data.tar.gz: c7e72eb4fa1571e6819a912aa44fe96e681d2e6a8c7747a88c12d196a445b74f453bf270db367ed1e8b0a3dc3965f90723d8f6e216824cfe14631bc7d7590d32
6
+ metadata.gz: 107a2d7934d667803dff0ec8f93384ce5adde514c639f32d1f6e6ce7a2554e3cbf9d654666548a1a7916fa2e98c49206d14f9d0bc936193a9e2b5c0f3522a244
7
+ data.tar.gz: 832f33bd88fdb6e27ae559625167a830cfd0c84a54eae21d3e90ae7821a4bc1edd393a3e54ec6f2ed8c9aec0582f29a7b1c6d208945944c6244c6fe7cc3ef476
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- peatio-bitcoincash (2.5.4)
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.3)
17
- activesupport (= 5.2.4.3)
18
- activesupport (5.2.4.3)
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.3)
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.6)
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.3.0)
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.3)
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.1)
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.6.1)
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.2)
139
+ websocket-driver (0.7.1)
140
140
  websocket-extensions (>= 0.1.0)
141
- websocket-extensions (0.1.5)
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
- class ConnectionError < Error; end
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(method, params)
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 { |e| raise ResponseError.new(e['code'], e['message']) if e }
34
- response.fetch('result')
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
@@ -1,5 +1,5 @@
1
1
  module Peatio
2
2
  module Bitcoincash
3
- VERSION = "2.5.4".freeze
3
+ VERSION = "2.6.0".freeze
4
4
  end
5
5
  end
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.5.4
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-06-12 00:00:00.000000000 Z
11
+ date: 2020-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport