peatio-bitgo 2.6.7 → 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 +99 -71
- data/lib/peatio/bitgo/client.rb +1 -1
- data/lib/peatio/bitgo/version.rb +1 -1
- data/lib/peatio/bitgo/wallet.rb +27 -9
- 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,45 +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)
|
34
|
+
sorted_set (~> 1, >= 1.0.2)
|
33
35
|
byebug (11.1.3)
|
34
36
|
clamp (1.3.2)
|
35
37
|
coderay (1.1.3)
|
36
|
-
concurrent-ruby (1.
|
37
|
-
connection_pool (2.
|
38
|
+
concurrent-ruby (1.2.2)
|
39
|
+
connection_pool (2.3.0)
|
38
40
|
cookiejar (0.3.3)
|
39
|
-
crack (0.4.
|
40
|
-
|
41
|
-
daemons (1.4.
|
42
|
-
diff-lcs (1.
|
41
|
+
crack (0.4.5)
|
42
|
+
rexml
|
43
|
+
daemons (1.4.1)
|
44
|
+
diff-lcs (1.5.0)
|
43
45
|
em-http-request (1.1.7)
|
44
46
|
addressable (>= 2.3.4)
|
45
47
|
cookiejar (!= 0.3.1)
|
@@ -50,14 +52,33 @@ GEM
|
|
50
52
|
eventmachine (>= 1.0.0.beta.4)
|
51
53
|
em-synchrony (1.0.6)
|
52
54
|
eventmachine (>= 1.0.0.beta.1)
|
53
|
-
em-websocket (0.5.
|
55
|
+
em-websocket (0.5.3)
|
54
56
|
eventmachine (>= 0.12.9)
|
55
|
-
http_parser.rb (~> 0
|
57
|
+
http_parser.rb (~> 0)
|
56
58
|
eventmachine (1.2.7)
|
57
|
-
faraday (
|
58
|
-
|
59
|
-
|
60
|
-
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)
|
61
82
|
faye (1.4.0)
|
62
83
|
cookiejar (>= 0.3.0)
|
63
84
|
em-http-request (>= 1.1.6)
|
@@ -66,81 +87,88 @@ GEM
|
|
66
87
|
multi_json (>= 1.0.0)
|
67
88
|
rack (>= 1.0.0)
|
68
89
|
websocket-driver (>= 0.5.1)
|
69
|
-
faye-websocket (0.11.
|
90
|
+
faye-websocket (0.11.1)
|
70
91
|
eventmachine (>= 0.12.0)
|
71
92
|
websocket-driver (>= 0.5.1)
|
72
93
|
hashdiff (1.0.1)
|
73
|
-
http_parser.rb (0.
|
74
|
-
i18n (1.
|
94
|
+
http_parser.rb (0.8.0)
|
95
|
+
i18n (1.12.0)
|
75
96
|
concurrent-ruby (~> 1.0)
|
76
|
-
jwt (2.
|
97
|
+
jwt (2.7.0)
|
77
98
|
memoist (0.16.2)
|
78
99
|
method_source (1.0.0)
|
79
|
-
minitest (5.
|
80
|
-
mocha (1.
|
100
|
+
minitest (5.17.0)
|
101
|
+
mocha (1.16.1)
|
81
102
|
multi_json (1.15.0)
|
82
|
-
multipart-post (2.
|
83
|
-
mysql2 (0.5.
|
84
|
-
net-http-persistent (
|
103
|
+
multipart-post (2.3.0)
|
104
|
+
mysql2 (0.5.5)
|
105
|
+
net-http-persistent (4.0.1)
|
85
106
|
connection_pool (~> 2.2)
|
86
|
-
peatio (
|
87
|
-
activemodel (> 5.2
|
107
|
+
peatio (3.1.1)
|
108
|
+
activemodel (> 5.2)
|
88
109
|
amqp
|
89
110
|
bunny
|
90
111
|
clamp
|
91
112
|
em-synchrony (~> 1.0)
|
92
113
|
em-websocket
|
93
114
|
eventmachine
|
94
|
-
|
115
|
+
faraday (~> 1.10)
|
95
116
|
faye (~> 1.2)
|
96
117
|
jwt
|
97
118
|
mysql2
|
98
119
|
prometheus-client
|
99
120
|
thin
|
100
|
-
prometheus-client (
|
101
|
-
pry (0.
|
121
|
+
prometheus-client (4.0.0)
|
122
|
+
pry (0.14.2)
|
102
123
|
coderay (~> 1.1)
|
103
124
|
method_source (~> 1.0)
|
104
|
-
pry-byebug (3.
|
125
|
+
pry-byebug (3.8.0)
|
105
126
|
byebug (~> 11.0)
|
106
|
-
pry (~> 0.
|
107
|
-
public_suffix (
|
108
|
-
rack (2.2.
|
109
|
-
rake (13.0.
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
rspec-
|
114
|
-
|
115
|
-
rspec-
|
116
|
-
rspec-
|
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)
|
117
140
|
diff-lcs (>= 1.2.0, < 2.0)
|
118
|
-
rspec-support (~> 3.
|
119
|
-
rspec-mocks (3.
|
141
|
+
rspec-support (~> 3.12.0)
|
142
|
+
rspec-mocks (3.12.3)
|
120
143
|
diff-lcs (>= 1.2.0, < 2.0)
|
121
|
-
rspec-support (~> 3.
|
122
|
-
rspec-support (3.
|
123
|
-
|
124
|
-
|
144
|
+
rspec-support (~> 3.12.0)
|
145
|
+
rspec-support (3.12.0)
|
146
|
+
ruby2_keywords (0.0.5)
|
147
|
+
set (1.0.3)
|
148
|
+
sorted_set (1.0.3)
|
149
|
+
rbtree
|
150
|
+
set (~> 1.0)
|
151
|
+
thin (1.8.1)
|
125
152
|
daemons (~> 1.0, >= 1.0.9)
|
126
153
|
eventmachine (~> 1.0, >= 1.0.4)
|
127
154
|
rack (>= 1, < 3)
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
addressable (>= 2.3.6)
|
155
|
+
tzinfo (2.0.6)
|
156
|
+
concurrent-ruby (~> 1.0)
|
157
|
+
webmock (3.18.1)
|
158
|
+
addressable (>= 2.8.0)
|
133
159
|
crack (>= 0.3.2)
|
134
160
|
hashdiff (>= 0.4.0, < 2.0.0)
|
135
|
-
websocket-driver (0.7.
|
161
|
+
websocket-driver (0.7.5)
|
136
162
|
websocket-extensions (>= 0.1.0)
|
137
163
|
websocket-extensions (0.1.5)
|
164
|
+
zeitwerk (2.6.7)
|
138
165
|
|
139
166
|
PLATFORMS
|
140
|
-
|
167
|
+
arm64-darwin-21
|
168
|
+
x86_64-linux
|
141
169
|
|
142
170
|
DEPENDENCIES
|
143
|
-
bundler (~>
|
171
|
+
bundler (~> 2.4.7)
|
144
172
|
mocha (~> 1.8)
|
145
173
|
peatio-bitgo!
|
146
174
|
pry-byebug
|
@@ -149,4 +177,4 @@ DEPENDENCIES
|
|
149
177
|
webmock (~> 3.5)
|
150
178
|
|
151
179
|
BUNDLED WITH
|
152
|
-
|
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
|
@@ -86,32 +92,38 @@ module Peatio
|
|
86
92
|
|
87
93
|
def create_eth_transaction(transaction, options = {})
|
88
94
|
amount = convert_to_base_unit(transaction.amount)
|
89
|
-
hop = options.slice(:
|
95
|
+
hop = true unless options.slice(:gas_price).present?
|
90
96
|
|
91
97
|
fee_estimate = fee_estimate(amount.to_s, hop)
|
92
98
|
|
93
|
-
if transaction.options.present?
|
99
|
+
if transaction.options.present? && transaction.options[:gas_price].present?
|
94
100
|
options[:gas_price] = transaction.options[:gas_price]
|
95
101
|
else
|
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
|
112
124
|
|
113
125
|
def fee_estimate(amount, hop)
|
114
|
-
client.rest_api(:get, "#{erc20_currency_id}/tx/fee", {amount: amount, hop: hop})
|
126
|
+
client.rest_api(:get, "#{erc20_currency_id}/tx/fee", { amount: amount, hop: hop }.compact)
|
115
127
|
end
|
116
128
|
|
117
129
|
def load_balance!
|
@@ -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
|