peatio-bitgo 2.6.8 → 3.1.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 +92 -70
- data/lib/peatio/bitgo/client.rb +1 -1
- data/lib/peatio/bitgo/version.rb +1 -1
- data/lib/peatio/bitgo/wallet.rb +24 -6
- data/peatio-bitgo.gemspec +6 -6
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0a23b303c27e33702466a81aadeea6e1fd2520ec68775ee5b70398ed9439518
|
4
|
+
data.tar.gz: 5248c0f5746772e67f4080758f5e017ddf7a7a69d14f73e41bb3a18a38400ac5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b96e9340b72203e6188320980dd0dac3e560ba4db37d6629edb7e22f4b17f21fe5dd6e889dea9c98399fb29a791715f6d3f0585fc44e68a6f843a0b84296da3
|
7
|
+
data.tar.gz: aca2516464d376318cab6e0382ea72f93731a6b7b8224bf361fd4b96342a98e634bf9dcaf81168b3e281d9a1f24187e442636ab6d38bbe5fa3a2333460c1ebac
|
data/Gemfile.lock
CHANGED
@@ -1,46 +1,47 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
peatio-bitgo (
|
5
|
-
activesupport (~>
|
6
|
-
better-faraday (~>
|
7
|
-
faraday (~>
|
4
|
+
peatio-bitgo (3.1.0)
|
5
|
+
activesupport (~> 6.1.0)
|
6
|
+
better-faraday (~> 2.0.1)
|
7
|
+
faraday (~> 1.10)
|
8
8
|
memoist (~> 0.16.0)
|
9
|
-
net-http-persistent (~>
|
10
|
-
peatio (>=
|
9
|
+
net-http-persistent (~> 4.0.1)
|
10
|
+
peatio (>= 3.1.1)
|
11
11
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activemodel (
|
16
|
-
activesupport (=
|
17
|
-
activesupport (
|
15
|
+
activemodel (6.1.7.2)
|
16
|
+
activesupport (= 6.1.7.2)
|
17
|
+
activesupport (6.1.7.2)
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
|
-
i18n (>=
|
20
|
-
minitest (
|
21
|
-
tzinfo (~>
|
22
|
-
|
23
|
-
|
19
|
+
i18n (>= 1.6, < 2)
|
20
|
+
minitest (>= 5.1)
|
21
|
+
tzinfo (~> 2.0)
|
22
|
+
zeitwerk (~> 2.3)
|
23
|
+
addressable (2.8.1)
|
24
|
+
public_suffix (>= 2.0.2, < 6.0)
|
24
25
|
amq-protocol (2.3.2)
|
25
26
|
amqp (1.8.0)
|
26
27
|
amq-protocol (>= 2.2.0)
|
27
28
|
eventmachine
|
28
|
-
better-faraday (
|
29
|
-
activesupport (>= 4.0, <
|
30
|
-
faraday (
|
31
|
-
bunny (2.
|
29
|
+
better-faraday (2.0.1)
|
30
|
+
activesupport (>= 4.0, < 7.0)
|
31
|
+
faraday (>= 1.0, < 3.0)
|
32
|
+
bunny (2.20.3)
|
32
33
|
amq-protocol (~> 2.3, >= 2.3.1)
|
33
34
|
sorted_set (~> 1, >= 1.0.2)
|
34
35
|
byebug (11.1.3)
|
35
36
|
clamp (1.3.2)
|
36
37
|
coderay (1.1.3)
|
37
|
-
concurrent-ruby (1.
|
38
|
-
connection_pool (2.
|
38
|
+
concurrent-ruby (1.2.2)
|
39
|
+
connection_pool (2.3.0)
|
39
40
|
cookiejar (0.3.3)
|
40
|
-
crack (0.4.
|
41
|
-
|
42
|
-
daemons (1.4.
|
43
|
-
diff-lcs (1.
|
41
|
+
crack (0.4.5)
|
42
|
+
rexml
|
43
|
+
daemons (1.4.1)
|
44
|
+
diff-lcs (1.5.0)
|
44
45
|
em-http-request (1.1.7)
|
45
46
|
addressable (>= 2.3.4)
|
46
47
|
cookiejar (!= 0.3.1)
|
@@ -51,14 +52,33 @@ GEM
|
|
51
52
|
eventmachine (>= 1.0.0.beta.4)
|
52
53
|
em-synchrony (1.0.6)
|
53
54
|
eventmachine (>= 1.0.0.beta.1)
|
54
|
-
em-websocket (0.5.
|
55
|
+
em-websocket (0.5.3)
|
55
56
|
eventmachine (>= 0.12.9)
|
56
|
-
http_parser.rb (~> 0
|
57
|
+
http_parser.rb (~> 0)
|
57
58
|
eventmachine (1.2.7)
|
58
|
-
faraday (
|
59
|
-
|
60
|
-
|
61
|
-
faraday (
|
59
|
+
faraday (1.10.3)
|
60
|
+
faraday-em_http (~> 1.0)
|
61
|
+
faraday-em_synchrony (~> 1.0)
|
62
|
+
faraday-excon (~> 1.1)
|
63
|
+
faraday-httpclient (~> 1.0)
|
64
|
+
faraday-multipart (~> 1.0)
|
65
|
+
faraday-net_http (~> 1.0)
|
66
|
+
faraday-net_http_persistent (~> 1.0)
|
67
|
+
faraday-patron (~> 1.0)
|
68
|
+
faraday-rack (~> 1.0)
|
69
|
+
faraday-retry (~> 1.0)
|
70
|
+
ruby2_keywords (>= 0.0.4)
|
71
|
+
faraday-em_http (1.0.0)
|
72
|
+
faraday-em_synchrony (1.0.0)
|
73
|
+
faraday-excon (1.1.0)
|
74
|
+
faraday-httpclient (1.0.1)
|
75
|
+
faraday-multipart (1.0.4)
|
76
|
+
multipart-post (~> 2)
|
77
|
+
faraday-net_http (1.0.1)
|
78
|
+
faraday-net_http_persistent (1.2.0)
|
79
|
+
faraday-patron (1.0.0)
|
80
|
+
faraday-rack (1.0.0)
|
81
|
+
faraday-retry (1.0.3)
|
62
82
|
faye (1.4.0)
|
63
83
|
cookiejar (>= 0.3.0)
|
64
84
|
em-http-request (>= 1.1.6)
|
@@ -71,59 +91,60 @@ GEM
|
|
71
91
|
eventmachine (>= 0.12.0)
|
72
92
|
websocket-driver (>= 0.5.1)
|
73
93
|
hashdiff (1.0.1)
|
74
|
-
http_parser.rb (0.
|
75
|
-
i18n (1.
|
94
|
+
http_parser.rb (0.8.0)
|
95
|
+
i18n (1.12.0)
|
76
96
|
concurrent-ruby (~> 1.0)
|
77
|
-
jwt (2.
|
97
|
+
jwt (2.7.0)
|
78
98
|
memoist (0.16.2)
|
79
99
|
method_source (1.0.0)
|
80
|
-
minitest (5.
|
81
|
-
mocha (1.
|
100
|
+
minitest (5.17.0)
|
101
|
+
mocha (1.16.1)
|
82
102
|
multi_json (1.15.0)
|
83
|
-
multipart-post (2.
|
84
|
-
mysql2 (0.5.
|
85
|
-
net-http-persistent (
|
103
|
+
multipart-post (2.3.0)
|
104
|
+
mysql2 (0.5.5)
|
105
|
+
net-http-persistent (4.0.1)
|
86
106
|
connection_pool (~> 2.2)
|
87
|
-
peatio (
|
88
|
-
activemodel (> 5.2
|
107
|
+
peatio (3.1.1)
|
108
|
+
activemodel (> 5.2)
|
89
109
|
amqp
|
90
110
|
bunny
|
91
111
|
clamp
|
92
112
|
em-synchrony (~> 1.0)
|
93
113
|
em-websocket
|
94
114
|
eventmachine
|
95
|
-
|
115
|
+
faraday (~> 1.10)
|
96
116
|
faye (~> 1.2)
|
97
117
|
jwt
|
98
118
|
mysql2
|
99
119
|
prometheus-client
|
100
120
|
thin
|
101
|
-
prometheus-client (
|
102
|
-
pry (0.
|
121
|
+
prometheus-client (4.0.0)
|
122
|
+
pry (0.14.2)
|
103
123
|
coderay (~> 1.1)
|
104
124
|
method_source (~> 1.0)
|
105
|
-
pry-byebug (3.
|
125
|
+
pry-byebug (3.8.0)
|
106
126
|
byebug (~> 11.0)
|
107
|
-
pry (~> 0.
|
108
|
-
public_suffix (
|
109
|
-
rack (2.2.
|
110
|
-
rake (13.0.
|
111
|
-
rbtree (0.4.
|
112
|
-
|
113
|
-
|
114
|
-
rspec-
|
115
|
-
rspec-
|
116
|
-
|
117
|
-
|
118
|
-
|
127
|
+
pry (~> 0.10)
|
128
|
+
public_suffix (5.0.1)
|
129
|
+
rack (2.2.6.2)
|
130
|
+
rake (13.0.6)
|
131
|
+
rbtree (0.4.6)
|
132
|
+
rexml (3.2.5)
|
133
|
+
rspec (3.12.0)
|
134
|
+
rspec-core (~> 3.12.0)
|
135
|
+
rspec-expectations (~> 3.12.0)
|
136
|
+
rspec-mocks (~> 3.12.0)
|
137
|
+
rspec-core (3.12.1)
|
138
|
+
rspec-support (~> 3.12.0)
|
139
|
+
rspec-expectations (3.12.2)
|
119
140
|
diff-lcs (>= 1.2.0, < 2.0)
|
120
|
-
rspec-support (~> 3.
|
121
|
-
rspec-mocks (3.
|
141
|
+
rspec-support (~> 3.12.0)
|
142
|
+
rspec-mocks (3.12.3)
|
122
143
|
diff-lcs (>= 1.2.0, < 2.0)
|
123
|
-
rspec-support (~> 3.
|
124
|
-
rspec-support (3.
|
125
|
-
|
126
|
-
set (1.0.
|
144
|
+
rspec-support (~> 3.12.0)
|
145
|
+
rspec-support (3.12.0)
|
146
|
+
ruby2_keywords (0.0.5)
|
147
|
+
set (1.0.3)
|
127
148
|
sorted_set (1.0.3)
|
128
149
|
rbtree
|
129
150
|
set (~> 1.0)
|
@@ -131,22 +152,23 @@ GEM
|
|
131
152
|
daemons (~> 1.0, >= 1.0.9)
|
132
153
|
eventmachine (~> 1.0, >= 1.0.4)
|
133
154
|
rack (>= 1, < 3)
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
addressable (>= 2.3.6)
|
155
|
+
tzinfo (2.0.6)
|
156
|
+
concurrent-ruby (~> 1.0)
|
157
|
+
webmock (3.18.1)
|
158
|
+
addressable (>= 2.8.0)
|
139
159
|
crack (>= 0.3.2)
|
140
160
|
hashdiff (>= 0.4.0, < 2.0.0)
|
141
161
|
websocket-driver (0.7.5)
|
142
162
|
websocket-extensions (>= 0.1.0)
|
143
163
|
websocket-extensions (0.1.5)
|
164
|
+
zeitwerk (2.6.7)
|
144
165
|
|
145
166
|
PLATFORMS
|
146
|
-
|
167
|
+
arm64-darwin-21
|
168
|
+
x86_64-linux
|
147
169
|
|
148
170
|
DEPENDENCIES
|
149
|
-
bundler (~>
|
171
|
+
bundler (~> 2.4.7)
|
150
172
|
mocha (~> 1.8)
|
151
173
|
peatio-bitgo!
|
152
174
|
pry-byebug
|
@@ -155,4 +177,4 @@ DEPENDENCIES
|
|
155
177
|
webmock (~> 3.5)
|
156
178
|
|
157
179
|
BUNDLED WITH
|
158
|
-
|
180
|
+
2.4.7
|
data/lib/peatio/bitgo/client.rb
CHANGED
@@ -38,7 +38,7 @@ module Peatio
|
|
38
38
|
args.last['Authorization'] = 'Bearer ' + @access_token
|
39
39
|
|
40
40
|
response = Faraday.send(verb, *args)
|
41
|
-
response.
|
41
|
+
response.assert_2xx!
|
42
42
|
response = JSON.parse(response.body)
|
43
43
|
response['error'].tap { |error| raise ResponseError.new(error) if error }
|
44
44
|
response
|
data/lib/peatio/bitgo/version.rb
CHANGED
data/lib/peatio/bitgo/wallet.rb
CHANGED
@@ -60,14 +60,20 @@ module Peatio
|
|
60
60
|
amount -= fee.to_i
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
response = client.rest_api(:post, "#{currency_id}/wallet/#{wallet_id}/sendcoins", {
|
64
64
|
address: normalize_address(transaction.to_address.to_s),
|
65
65
|
amount: amount.to_s,
|
66
66
|
walletPassphrase: bitgo_wallet_passphrase,
|
67
67
|
memo: xlm_memo(transaction.to_address.to_s)
|
68
|
-
}.compact)
|
68
|
+
}.compact)
|
69
69
|
|
70
|
-
|
70
|
+
if response['feeString'].present?
|
71
|
+
fee = convert_from_base_unit(response['feeString'])
|
72
|
+
transaction.fee = fee
|
73
|
+
end
|
74
|
+
|
75
|
+
transaction.hash = normalize_txid(response['txid'])
|
76
|
+
transaction.fee_currency_id = erc20_currency_id
|
71
77
|
transaction
|
72
78
|
end
|
73
79
|
rescue Bitgo::Client::Error => e
|
@@ -96,16 +102,22 @@ module Peatio
|
|
96
102
|
options[:gas_price] = fee_estimate['minGasPrice'].to_i
|
97
103
|
end
|
98
104
|
|
99
|
-
|
105
|
+
response = client.rest_api(:post, "#{currency_id}/wallet/#{wallet_id}/sendcoins", {
|
100
106
|
address: transaction.to_address.to_s,
|
101
107
|
amount: amount.to_s,
|
102
108
|
walletPassphrase: bitgo_wallet_passphrase,
|
103
109
|
gas: options.fetch(:gas_limit).to_i,
|
104
110
|
gasPrice: options.fetch(:gas_price).to_i,
|
105
111
|
hop: hop
|
106
|
-
}.compact)
|
112
|
+
}.compact)
|
107
113
|
|
108
|
-
|
114
|
+
if response['feeString'].present?
|
115
|
+
fee = convert_from_base_unit(response['feeString'])
|
116
|
+
transaction.fee = fee
|
117
|
+
end
|
118
|
+
|
119
|
+
transaction.hash = normalize_txid(response['txid'])
|
120
|
+
transaction.fee_currency_id = erc20_currency_id
|
109
121
|
transaction.options = options
|
110
122
|
transaction
|
111
123
|
end
|
@@ -180,9 +192,15 @@ module Peatio
|
|
180
192
|
txout = output['index'] if output.present?
|
181
193
|
end
|
182
194
|
|
195
|
+
if response['feeString'].present?
|
196
|
+
fee = convert_from_base_unit(response['feeString']) / response['entries'].count
|
197
|
+
end
|
198
|
+
|
183
199
|
transaction = Peatio::Transaction.new(
|
184
200
|
currency_id: @currency.fetch(:id),
|
185
201
|
amount: convert_from_base_unit(entry['valueString']),
|
202
|
+
fee: fee,
|
203
|
+
fee_currency_id: erc20_currency_id,
|
186
204
|
hash: normalize_txid(response['txid']),
|
187
205
|
to_address: to_address,
|
188
206
|
block_number: response['height'],
|
data/peatio-bitgo.gemspec
CHANGED
@@ -23,14 +23,14 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
spec.add_dependency "activesupport", "~>
|
27
|
-
spec.add_dependency "better-faraday", "~>
|
28
|
-
spec.add_dependency "faraday", "~>
|
26
|
+
spec.add_dependency "activesupport", "~> 6.1.0"
|
27
|
+
spec.add_dependency "better-faraday", "~> 2.0.1"
|
28
|
+
spec.add_dependency "faraday", "~> 1.10"
|
29
29
|
spec.add_dependency "memoist", "~> 0.16.0"
|
30
|
-
spec.add_dependency "peatio", ">=
|
31
|
-
spec.add_dependency 'net-http-persistent', '~>
|
30
|
+
spec.add_dependency "peatio", ">= 3.1.1"
|
31
|
+
spec.add_dependency 'net-http-persistent', '~> 4.0.1'
|
32
32
|
|
33
|
-
spec.add_development_dependency "bundler", "~>
|
33
|
+
spec.add_development_dependency "bundler", "~> 2.4.7"
|
34
34
|
spec.add_development_dependency "mocha", "~> 1.8"
|
35
35
|
spec.add_development_dependency "pry-byebug"
|
36
36
|
spec.add_development_dependency "rake", "~> 13.0"
|
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:
|
4
|
+
version: 3.1.0
|
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:
|
11
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 6.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: better-faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.0.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.0.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: faraday
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.10'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1.10'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: memoist
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,42 +72,42 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 3.1.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 3.1.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: net-http-persistent
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 4.0.1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 4.0.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 2.4.7
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 2.4.7
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: mocha
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|