peatio-bitgo 2.5.0 → 2.6.3

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: fce3c54f47f8933c24b2fef521c89acd4ead3ed48fa49c183fb9f67fb3f042a5
4
- data.tar.gz: 999ec62e379696270429caf760e02c95a078727539b9f5bb42cbd31435987109
3
+ metadata.gz: 20d80a146fee8a7c1589467c5dd7e2eb29797b31bc5f4568c0bc5ef404b92706
4
+ data.tar.gz: ca3c7ada85a2ab0e01c3abd2ecb28cd79cb368a6b5ec4c659eb27dba6f9b3742
5
5
  SHA512:
6
- metadata.gz: 30f38ef6aadce408ecf0cd4a4ec04333175f8eee4ca17a07445149dd6e4d31739836917dd3e7d7645dd2f86c7ab7b750c376dda9c0bc9b4e1b35821157543578
7
- data.tar.gz: 369b7c7d44c01743f8d32ed77d29f89462873ba1c0383dbc5c66ac67e372098be2a822a937ee9cb736a5ffd390b63f5c07d81aa981b8ff9c2d124ffe378e099f
6
+ metadata.gz: 063d9d8857083966a250daf77e4476c095b4b420b79f01a727006de559a7dba9dbdf4e3cfd057ef4fc734cd8dd79bfe2e659e5d6b6dc9dab37afca731d21ba8b
7
+ data.tar.gz: dd0d0752690f189809ccc531d6938c03af16e38b37b97a67066b0d993759ae81a6f7505136bdf498eab187e9913fc117490e61114df5ddf34ad01f85714013cc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- peatio-bitgo (2.5.0)
4
+ peatio-bitgo (2.6.3)
5
5
  activesupport (~> 5.2.3)
6
6
  better-faraday (~> 1.0.5)
7
7
  faraday (~> 0.17)
@@ -21,25 +21,25 @@ GEM
21
21
  tzinfo (~> 1.1)
22
22
  addressable (2.7.0)
23
23
  public_suffix (>= 2.0.2, < 5.0)
24
- amq-protocol (2.3.1)
24
+ amq-protocol (2.3.2)
25
25
  amqp (1.8.0)
26
26
  amq-protocol (>= 2.2.0)
27
27
  eventmachine
28
28
  better-faraday (1.0.8)
29
29
  activesupport (>= 4.0, < 6.0)
30
30
  faraday (~> 0.12)
31
- bunny (2.15.0)
31
+ bunny (2.16.1)
32
32
  amq-protocol (~> 2.3, >= 2.3.1)
33
- byebug (11.1.1)
34
- clamp (1.3.1)
35
- coderay (1.1.2)
36
- concurrent-ruby (1.1.6)
33
+ byebug (11.1.3)
34
+ clamp (1.3.2)
35
+ coderay (1.1.3)
36
+ concurrent-ruby (1.1.7)
37
37
  connection_pool (2.2.3)
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
- diff-lcs (1.3)
42
+ diff-lcs (1.4.4)
43
43
  em-http-request (1.1.6)
44
44
  addressable (>= 2.3.4)
45
45
  cookiejar (!= 0.3.1)
@@ -58,27 +58,27 @@ 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.3.0)
61
+ faye (1.4.0)
62
62
  cookiejar (>= 0.3.0)
63
- em-http-request (>= 0.3.0)
63
+ em-http-request (>= 1.1.6)
64
64
  eventmachine (>= 0.12.0)
65
- faye-websocket (>= 0.9.1)
65
+ faye-websocket (>= 0.11.0)
66
66
  multi_json (>= 1.0.0)
67
67
  rack (>= 1.0.0)
68
68
  websocket-driver (>= 0.5.1)
69
- faye-websocket (0.10.9)
69
+ faye-websocket (0.11.0)
70
70
  eventmachine (>= 0.12.0)
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.3)
74
+ i18n (1.8.5)
75
75
  concurrent-ruby (~> 1.0)
76
- jwt (2.2.1)
76
+ jwt (2.2.2)
77
77
  memoist (0.16.2)
78
78
  method_source (1.0.0)
79
79
  minitest (5.14.1)
80
80
  mocha (1.11.2)
81
- multi_json (1.14.1)
81
+ multi_json (1.15.0)
82
82
  multipart-post (2.1.1)
83
83
  mysql2 (0.5.3)
84
84
  net-http-persistent (3.0.1)
@@ -97,29 +97,29 @@ GEM
97
97
  mysql2
98
98
  prometheus-client
99
99
  thin
100
- prometheus-client (2.0.0)
101
- pry (0.13.0)
100
+ prometheus-client (2.1.0)
101
+ pry (0.13.1)
102
102
  coderay (~> 1.1)
103
103
  method_source (~> 1.0)
104
104
  pry-byebug (3.9.0)
105
105
  byebug (~> 11.0)
106
106
  pry (~> 0.13.0)
107
- public_suffix (4.0.4)
108
- rack (2.2.2)
107
+ public_suffix (4.0.5)
108
+ rack (2.2.3)
109
109
  rake (13.0.1)
110
110
  rspec (3.9.0)
111
111
  rspec-core (~> 3.9.0)
112
112
  rspec-expectations (~> 3.9.0)
113
113
  rspec-mocks (~> 3.9.0)
114
- rspec-core (3.9.1)
115
- rspec-support (~> 3.9.1)
116
- rspec-expectations (3.9.1)
114
+ rspec-core (3.9.2)
115
+ rspec-support (~> 3.9.3)
116
+ rspec-expectations (3.9.2)
117
117
  diff-lcs (>= 1.2.0, < 2.0)
118
118
  rspec-support (~> 3.9.0)
119
119
  rspec-mocks (3.9.1)
120
120
  diff-lcs (>= 1.2.0, < 2.0)
121
121
  rspec-support (~> 3.9.0)
122
- rspec-support (3.9.2)
122
+ rspec-support (3.9.3)
123
123
  safe_yaml (1.0.5)
124
124
  thin (1.7.2)
125
125
  daemons (~> 1.0, >= 1.0.9)
@@ -132,7 +132,7 @@ 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.2)
135
+ websocket-driver (0.7.3)
136
136
  websocket-extensions (>= 0.1.0)
137
137
  websocket-extensions (0.1.5)
138
138
 
@@ -5,7 +5,7 @@ module Peatio
5
5
  module Bitgo
6
6
  class Client
7
7
  Error = Class.new(StandardError)
8
- class ConnectionError < Error; end
8
+ ConnectionError = Class.new(Error)
9
9
 
10
10
  class ResponseError < Error
11
11
  def initialize(msg)
@@ -22,7 +22,7 @@ module Peatio
22
22
  args = [@endpoint.to_s + path]
23
23
 
24
24
  if data
25
- if %i[ post put patch ].include?(verb)
25
+ if %i[post put patch].include?(verb)
26
26
  args << data.compact.to_json
27
27
  args << { 'Content-Type' => 'application/json' }
28
28
  else
@@ -48,8 +48,6 @@ module Peatio
48
48
  else
49
49
  raise ConnectionError, JSON.parse(e.response.body)['message']
50
50
  end
51
- rescue StandardError => e
52
- raise Error, e
53
51
  end
54
52
  end
55
53
  end
@@ -9,7 +9,7 @@ module Peatio
9
9
  unless Gem::Requirement.new(BLOCKCHAIN_VERSION_REQUIREMENT)
10
10
  .satisfied_by?(Gem::Version.new(Peatio::Blockchain::VERSION))
11
11
  [
12
- "Bitgo blockchain version requiremnt was not suttisfied by Peatio::Blockchain.",
12
+ "Bitgo blockchain version requirement was not satisfied by Peatio::Blockchain.",
13
13
  "Bitgo blockchain requires #{BLOCKCHAIN_VERSION_REQUIREMENT}.",
14
14
  "Peatio::Blockchain version is #{Peatio::Blockchain::VERSION}"
15
15
  ].join('\n').tap { |s| Kernel.abort s }
@@ -18,7 +18,7 @@ module Peatio
18
18
  unless Gem::Requirement.new(WALLET_VERSION_REQUIREMENT)
19
19
  .satisfied_by?(Gem::Version.new(Peatio::Wallet::VERSION))
20
20
  [
21
- "Bitgo wallet version requiremnt was not suttisfied by Peatio::Wallet.",
21
+ "Bitgo wallet version requirement was not satisfied by Peatio::Wallet.",
22
22
  "Bitgo wallet requires #{WALLET_VERSION_REQUIREMENT}.",
23
23
  "Peatio::Wallet version is #{Peatio::Wallet::VERSION}"
24
24
  ].join('\n').tap { |s| Kernel.abort s }
@@ -1,5 +1,5 @@
1
1
  module Peatio
2
2
  module Bitgo
3
- VERSION = "2.5.0"
3
+ VERSION = "2.6.3".freeze
4
4
  end
5
5
  end
@@ -2,9 +2,13 @@ module Peatio
2
2
  module Bitgo
3
3
  class Wallet < Peatio::Wallet::Abstract
4
4
  TIME_DIFFERENCE_IN_MINUTES = 10
5
+ XLM_MEMO_TYPES = { 'memoId': 'id', 'memoText': 'text', 'memoHash': 'hash', 'memoReturn': 'return' }
5
6
 
6
- def initialize(settings = {})
7
- @settings = settings
7
+ DEFAULT_FEATURES = { skip_deposit_collection: false }.freeze
8
+
9
+ def initialize(custom_features = {})
10
+ @features = DEFAULT_FEATURES.merge(custom_features).slice(*SUPPORTED_FEATURES)
11
+ @settings = {}
8
12
  end
9
13
 
10
14
  def configure(settings = {})
@@ -57,7 +61,7 @@ module Peatio
57
61
  end
58
62
 
59
63
  txid = client.rest_api(:post, "#{currency_id}/wallet/#{wallet_id}/sendcoins", {
60
- address: transaction.to_address.to_s,
64
+ address: normalize_address(transaction.to_address.to_s),
61
65
  amount: amount.to_s,
62
66
  walletPassphrase: bitgo_wallet_passphrase,
63
67
  memo: xlm_memo(transaction.to_address.to_s)
@@ -221,19 +225,25 @@ module Peatio
221
225
  end
222
226
 
223
227
  def xlm_memo(address)
224
- if @currency.fetch(:id) == 'xlm'
225
- {
226
- type: "id",
227
- value: "#{memo_id_from(address)}"
228
- }
229
- end
228
+ build_xlm_memo(address) if @currency.fetch(:id) == 'xlm'
230
229
  end
231
230
 
232
- def memo_id_from(address)
233
- memo_id = address.partition('memoId=').last
234
- memo_id = 0 if memo_id.empty?
231
+ def build_xlm_memo(address)
232
+ case address.split('?').last.split('=').first
233
+ when 'memoId'
234
+ memo_value_from(address, 'memoId')
235
+ when 'memoText'
236
+ memo_value_from(address, 'memoText')
237
+ when 'memoHash'
238
+ memo_value_from(address, 'memoHash')
239
+ when 'memoReturn'
240
+ memo_value_from(address, 'memoReturn')
241
+ end
242
+ end
235
243
 
236
- memo_id
244
+ def memo_value_from(address, type)
245
+ memo_value = address.partition(type + '=').last
246
+ return { type: XLM_MEMO_TYPES[type.to_sym], value: memo_value } if memo_value.present?
237
247
  end
238
248
 
239
249
  def currency_id
@@ -248,6 +258,14 @@ module Peatio
248
258
  @wallet.fetch(:wallet_id)
249
259
  end
250
260
 
261
+ def normalize_address(address)
262
+ if @currency.fetch(:id) == 'xlm'
263
+ address.split('?').first
264
+ else
265
+ address
266
+ end
267
+ end
268
+
251
269
  def normalize_txid(txid)
252
270
  txid.downcase
253
271
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peatio-bitgo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nadia Ch., Maksym N.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-10 00:00:00.000000000 Z
11
+ date: 2020-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport