peatio-coinpaymentnew 0.0.4 → 0.0.8

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
  SHA1:
3
- metadata.gz: '080072a6b070772a02d7ae5d8117707c31c32fc2'
4
- data.tar.gz: 30da7883e604329675f3e93f58b76db0fa98fbfa
3
+ metadata.gz: 89cb0e3405cea75e5abcd3aa418743b6779b0673
4
+ data.tar.gz: 50491be28e5d7f2b96f038696175a23d2df3862d
5
5
  SHA512:
6
- metadata.gz: d01c939e82efa40840947c22b04ebddbe422f29940298a95bafae318df39083b4d791b2c9b4347eb90dfa1e7534f84a96c06e8a4c2678f0040f35988bf2379f4
7
- data.tar.gz: 845114166d6268000d462a967a350809a6a6d8079bc33e50ed74266324e10866710b6bb27303ae32b5c69a63eb982fff8ade9268180bf0d289a00282cec28497
6
+ metadata.gz: 61a1d5a62f4698313b97f6182042403bf398c937bbe15a2d2ff32d73cc622597e945fc5d9636e53a0a3ea235fe04648bf0576fdb8124e4014fe66a5c6b38edbd
7
+ data.tar.gz: 2df07c66ee90855ecdf4b91585fbc124a0f20ece5faa50b99af4408c2c1e3a3a9e62d3ecebe1e326a48132ec9edacae625d278ddfca36793458f58f445d13c48
data/Gemfile CHANGED
@@ -5,4 +5,4 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in peatio-coinpaymentnew.gemspec
6
6
  gemspec
7
7
 
8
- gem 'coinpayments'
8
+ # gem 'coinpayments'
data/Gemfile.lock CHANGED
@@ -1,12 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- peatio-coinpaymentnew (0.0.2)
4
+ peatio-coinpaymentnew (0.0.5)
5
5
  activesupport (~> 5.2.3)
6
6
  better-faraday (~> 1.0.5)
7
+ coinpayments (~> 0.0.4)
7
8
  faraday (~> 0.17)
8
9
  memoist (~> 0.16.0)
9
- peatio (~> 0.6.3)
10
+ peatio (~> 2.6.3)
10
11
 
11
12
  GEM
12
13
  remote: https://rubygems.org/
@@ -37,22 +38,47 @@ GEM
37
38
  hashie
38
39
  httparty
39
40
  concurrent-ruby (1.1.9)
41
+ cookiejar (0.3.3)
40
42
  crack (0.4.5)
41
43
  rexml
44
+ daemons (1.4.1)
42
45
  diff-lcs (1.4.4)
43
- em-websocket (0.5.2)
46
+ em-http-request (1.1.7)
47
+ addressable (>= 2.3.4)
48
+ cookiejar (!= 0.3.1)
49
+ em-socksify (>= 0.3)
50
+ eventmachine (>= 1.0.3)
51
+ http_parser.rb (>= 0.6.0)
52
+ em-socksify (0.3.2)
53
+ eventmachine (>= 1.0.0.beta.4)
54
+ em-synchrony (1.0.6)
55
+ eventmachine (>= 1.0.0.beta.1)
56
+ em-websocket (0.5.3)
44
57
  eventmachine (>= 0.12.9)
45
- http_parser.rb (~> 0.6.0)
58
+ http_parser.rb (~> 0)
46
59
  eventmachine (1.2.7-x64-mingw32)
47
60
  faraday (0.17.4)
48
61
  multipart-post (>= 1.2, < 3)
62
+ faraday_middleware (0.13.1)
63
+ faraday (>= 0.7.4, < 1.0)
64
+ faye (1.4.0)
65
+ cookiejar (>= 0.3.0)
66
+ em-http-request (>= 1.1.6)
67
+ eventmachine (>= 0.12.0)
68
+ faye-websocket (>= 0.11.0)
69
+ multi_json (>= 1.0.0)
70
+ rack (>= 1.0.0)
71
+ websocket-driver (>= 0.5.1)
72
+ faye-websocket (0.11.1)
73
+ eventmachine (>= 0.12.0)
74
+ websocket-driver (>= 0.5.1)
49
75
  hashdiff (1.0.1)
50
76
  hashie (4.1.0)
51
- http_parser.rb (0.6.0)
77
+ http_parser.rb (0.8.0)
52
78
  httparty (0.20.0)
53
79
  mime-types (~> 3.0)
54
80
  multi_xml (>= 0.5.2)
55
- i18n (1.8.10)
81
+ i18n (1.8.11)
56
82
  concurrent-ruby (~> 1.0)
57
83
  jwt (2.3.0)
58
84
  memoist (0.16.2)
@@ -62,18 +88,25 @@ GEM
62
88
  mime-types-data (3.2021.0901)
63
89
  minitest (5.14.4)
64
90
  mocha (1.13.0)
91
+ multi_json (1.15.0)
65
92
  multi_xml (0.6.0)
66
93
  multipart-post (2.1.1)
67
94
  mysql2 (0.5.3-x64-mingw32)
68
- peatio (0.6.3)
95
+ peatio (2.6.5)
69
96
  activemodel (> 5.2, <= 6.0.0)
70
97
  amqp
71
98
  bunny
72
99
  clamp
100
+ em-synchrony (~> 1.0)
73
101
  em-websocket
74
102
  eventmachine
103
+ faraday_middleware (~> 0.13.1)
104
+ faye (~> 1.2)
75
105
  jwt
76
106
  mysql2
107
+ prometheus-client
108
+ thin
109
+ prometheus-client (2.1.0)
77
110
  pry (0.13.1)
78
111
  coderay (~> 1.1)
79
112
  method_source (~> 1.0)
@@ -81,6 +114,7 @@ GEM
81
114
  byebug (~> 11.0)
82
115
  pry (~> 0.13.0)
83
116
  public_suffix (4.0.6)
117
+ rack (2.2.3)
84
118
  rake (13.0.6)
85
119
  rbtree (0.4.4)
86
120
  rexml (3.2.5)
@@ -101,6 +135,10 @@ GEM
101
135
  sorted_set (1.0.3)
102
136
  rbtree
103
137
  set (~> 1.0)
138
+ thin (1.8.1)
139
+ daemons (~> 1.0, >= 1.0.9)
140
+ eventmachine (~> 1.0, >= 1.0.4)
141
+ rack (>= 1, < 3)
104
142
  thread_safe (0.3.6)
105
143
  tzinfo (1.2.9)
106
144
  thread_safe (~> 0.1)
@@ -108,13 +146,15 @@ GEM
108
146
  addressable (>= 2.8.0)
109
147
  crack (>= 0.3.2)
110
148
  hashdiff (>= 0.4.0, < 2.0.0)
149
+ websocket-driver (0.7.5)
150
+ websocket-extensions (>= 0.1.0)
151
+ websocket-extensions (0.1.5)
111
152
 
112
153
  PLATFORMS
113
154
  x64-mingw32
114
155
 
115
156
  DEPENDENCIES
116
157
  bundler (~> 1.16)
117
- coinpayments
118
158
  mocha (~> 1.8)
119
159
  peatio-coinpaymentnew!
120
160
  pry-byebug
@@ -123,4 +163,4 @@ DEPENDENCIES
123
163
  webmock (~> 3.5)
124
164
 
125
165
  BUNDLED WITH
126
- 1.17.2
166
+ 1.17.3
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Peatio
4
+ module Coinpaymentnew
5
+ class Client
6
+ Error = Class.new(StandardError)
7
+ ConnectionError = Class.new(Error)
8
+
9
+ class ResponseError < Error
10
+ def initialize(msg)
11
+ super "#{msg}"
12
+ end
13
+ end
14
+
15
+ def initialize(endpoint, access_token, access_token2)
16
+ @endpoint = URI.parse(endpoint)
17
+ @access_token = access_token
18
+ @access_token2 = access_token2
19
+ end
20
+ def self.hmac(body)
21
+ OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha512'), @access_token2, HTTParty::HashConversions.to_params(body))
22
+ end
23
+
24
+ def self.required_params
25
+ { version: 1, key: @access_token }
26
+ end
27
+
28
+ def rest_api(args)
29
+ body = required_params.merge!(args)
30
+ response = HTTParty.post(@endpoint.to_s, body: body, headers: {'hmac' => hmac(body)})
31
+ response['error'] == 'ok' ? Hashie::Mash.new(response['result']) : response['error']
32
+
33
+ end
34
+ end
35
+ end
36
+ end
37
+
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Peatio
4
4
  module Coinpaymentnew
5
- VERSION = "0.0.4"
5
+ VERSION = "0.0.8"
6
6
  end
7
7
  end
@@ -2,7 +2,7 @@ module Peatio
2
2
  module Coinpaymentnew
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
+ XLM_MEMO_TYPES = { 'memoId': 'id', 'memoText': 'text', 'memoHash': 'hash', 'memoReturn': 'return' }
6
6
 
7
7
  DEFAULT_FEATURES = { skip_deposit_collection: false }.freeze
8
8
 
@@ -19,7 +19,7 @@ module Peatio
19
19
 
20
20
  @wallet = @settings.fetch(:wallet) do
21
21
  raise Peatio::Wallet::MissingSettingError, :wallet
22
- end.slice(:uri, :address, :secret, :access_token, :wallet_id, :testnet)
22
+ end.slice(:uri, :address, :secret, :access_token, :access_token2, :wallet_id, :testnet)
23
23
 
24
24
  @currency = @settings.fetch(:currency) do
25
25
  raise Peatio::Wallet::MissingSettingError, :currency
@@ -29,213 +29,151 @@ module Peatio
29
29
  def create_address!(options = {})
30
30
  currency = erc20_currency_id
31
31
  options.deep_symbolize_keys!
32
- response = WalletApi.get_deposit_address(currency.upcase)
33
- { address: response[:address], secret: coinpayment_wallet_passphrase, details: { address_id: response[:address] }}
34
- # if options.dig(:pa_details, :address_id).present? &&
35
- # options.dig(:pa_details, :updated_at).present? &&
36
- # time_difference_in_minutes(options.dig(:pa_details, :updated_at)) >= TIME_DIFFERENCE_IN_MINUTES
37
- #
38
- # response = client.rest_api(:get, "#{currency}/wallet/#{wallet_id}/address/#{options.dig(:pa_details, :address_id)}")
39
- # { address: response['address'], secret: bitgo_wallet_passphrase }
40
- # elsif options.dig(:pa_details, :address_id).blank?
41
- # response = client.rest_api(:post, "#{currency}/wallet/#{wallet_id}/address")
42
- # { address: response['address'], secret: bitgo_wallet_passphrase, details: { address_id: response['id'] }}
43
- # end
44
- rescue Coinpaymentnew::Client::Error => e
32
+
33
+ args = { cmd: 'get_deposit_address', currency: currency.upcase }.merge!(options)
34
+ response = client.rest_api(args)
35
+ { address: response['address'] }
36
+ rescue Coinpayment::Client::Error => e
45
37
  raise Peatio::Wallet::ClientError, e
46
38
  end
47
39
 
48
40
  def create_transaction!(transaction, options = {})
49
41
  currency_options = @currency.fetch(:options).slice(:gas_limit, :gas_price, :erc20_contract_address)
50
-
51
- # if currency_options[:gas_limit].present? && currency_options[:gas_price].present?
52
- # options.merge!(currency_options)
53
- # create_eth_transaction(transaction, options)
54
- # else
55
- amount = convert_to_base_unit(transaction.amount)
56
-
57
- # if options[:subtract_fee].to_s == 'true'
58
- # fee = build_raw_transaction(transaction)
59
- # baseFeeInfo = fee.dig('feeInfo','fee')
60
- # fee = baseFeeInfo.present? ? baseFeeInfo : fee.dig('txInfo','Fee')
61
- # amount -= fee.to_i
62
- # end
63
- response = WalletApi.createTransaction(transaction.amount.to_s, "USD",currency_id.upcase, transaction.to_address.to_s)
64
- # response = client.rest_api(:post, "#{currency_id}/wallet/#{wallet_id}/sendcoins", {
65
- # address: normalize_address(transaction.to_address.to_s),
66
- # amount: amount.to_s,
67
- # walletPassphrase: bitgo_wallet_passphrase,
68
- # memo: xlm_memo(transaction.to_address.to_s)
69
- # }.compact)
70
- #
71
- # if response['feeString'].present?
72
- # fee = convert_from_base_unit(response['feeString'])
73
- # transaction.fee = fee
74
- # end
75
-
76
- transaction.hash = normalize_txid(response[:txn_id])
77
- transaction.fee_currency_id = erc20_currency_id
78
- transaction
79
- # end
80
- rescue Coinpaymentnew::Client::Error => e
42
+ amount = convert_to_base_unit(transaction.amount)
43
+ args = { cmd: "create_transaction", amount: amount, currency1: "USD", currency2: currency_id.upcase, buyer_email: "joshirockstar007@gmail.com", address: normalize_address(transaction.to_address.to_s) }
44
+ response = client.rest_api(args)
45
+ transaction.hash = normalize_txid(response['txn_id'])
46
+ transactio
47
+ rescue Coinpayment::Client::Error => e
81
48
  raise Peatio::Wallet::ClientError, e
82
49
  end
83
50
 
84
- #
85
- # def build_raw_transaction(transaction)
86
- # client.rest_api(:post, "#{currency_id}/wallet/#{wallet_id}/tx/build", {
87
- # recipients: [{
88
- # address: transaction.to_address,
89
- # amount: convert_to_base_unit(transaction.amount).to_s
90
- # }]
91
- # }.compact)
92
- # end
51
+
52
+ def build_raw_transaction(transaction)
53
+ args = { cmd: "rates" }
54
+ response = client.rest_api(args)
55
+ response[currency_id.upcase]
56
+ end
93
57
 
94
58
  # def create_eth_transaction(transaction, options = {})
95
59
  # amount = convert_to_base_unit(transaction.amount)
96
60
  # hop = true unless options.slice(:gas_price).present?
97
- #
61
+
98
62
  # fee_estimate = fee_estimate(amount.to_s, hop)
99
- #
63
+
100
64
  # if transaction.options.present? && transaction.options[:gas_price].present?
101
65
  # options[:gas_price] = transaction.options[:gas_price]
102
66
  # else
103
67
  # options[:gas_price] = fee_estimate['minGasPrice'].to_i
104
68
  # end
105
- #
69
+
106
70
  # response = client.rest_api(:post, "#{currency_id}/wallet/#{wallet_id}/sendcoins", {
107
71
  # address: transaction.to_address.to_s,
108
72
  # amount: amount.to_s,
109
- # walletPassphrase: bitgo_wallet_passphrase,
73
+ # walletPassphrase: coinpayment_wallet_passphrase,
110
74
  # gas: options.fetch(:gas_limit).to_i,
111
75
  # gasPrice: options.fetch(:gas_price).to_i,
112
76
  # hop: hop
113
77
  # }.compact)
114
- #
78
+
115
79
  # if response['feeString'].present?
116
80
  # fee = convert_from_base_unit(response['feeString'])
117
81
  # transaction.fee = fee
118
82
  # end
119
- #
83
+
120
84
  # transaction.hash = normalize_txid(response['txid'])
121
85
  # transaction.fee_currency_id = erc20_currency_id
122
86
  # transaction.options = options
123
87
  # transaction
124
88
  # end
125
89
 
126
- def fee_estimate(amount, hop)
127
- client.rest_api(:get, "#{erc20_currency_id}/tx/fee", { amount: amount, hop: hop }.compact)
128
- end
90
+ # def fee_estimate(amount, hop)
91
+ # client.rest_api(:get, "#{erc20_currency_id}/tx/fee", { amount: amount, hop: hop }.compact)
92
+ # end
129
93
 
130
94
  def load_balance!
131
- # if @currency.fetch(:options).slice(:erc20_contract_address).present?
132
- # load_erc20_balance!
133
- # else
134
- # response = client.rest_api(:get, "#{currency_id}/wallet/#{wallet_id}")
135
- response = WalletApi.balance
136
- response = response.fetch(currency_id)
137
- convert_from_base_unit(response["balance"])
138
- # end
139
- rescue Coinpaymentnew::Client::Error => e
95
+ args = { cmd: "balances" }
96
+ response = client.rest_api(args)
97
+ response[currency_id.upcase]['balancef']
98
+ rescue Coinpayment::Client::Error => e
140
99
  raise Peatio::Wallet::ClientError, e
141
100
  end
142
101
 
143
102
  # def load_erc20_balance!
144
103
  # response = client.rest_api(:get, "#{erc20_currency_id}/wallet/#{wallet_id}?allTokens=true")
145
104
  # convert_from_base_unit(response.dig('tokens', currency_id, 'balanceString'))
146
- # rescue Coinpaymentnew::Client::Error => e
105
+ # rescue Coinpayment::Client::Error => e
147
106
  # raise Peatio::Wallet::ClientError, e
148
107
  # end
149
108
 
150
109
  def trigger_webhook_event(request)
151
- currency = @wallet.fetch(:testnet).present? ? 't' + @currency.fetch(:id) : @currency.fetch(:id)
152
- if request.params['type'] == 'transfer'
153
- return unless currency == request.params['coin'] &&
154
- @wallet.fetch(:wallet_id) == request.params['wallet']
155
- else
156
- return unless @wallet.fetch(:wallet_id) == request.params['walletId']
157
- end
110
+ # currency = @wallet.fetch(:testnet).present? ? 't' + @currency.fetch(:id) : @currency.fetch(:id)
111
+ # if request.params['ipn_type'] == 'deposit'
112
+ # return unless currency == request.params['coin'] &&
113
+ # @wallet.fetch(:wallet_id) == request.params['wallet']
114
+ # else
115
+ # return unless @wallet.fetch(:wallet_id) == request.params['walletId']
116
+ # end
158
117
 
159
- if request.params['type'] == 'transfer'
160
- transactions = fetch_transfer!(request.params['transfer'])
118
+ if request.params['ipn_type'] == 'deposit'
119
+ transactions = fetch_transfer!(request.params['txn_id'])
161
120
  return transactions
162
- elsif request.params['type'] == 'address_confirmation'
163
- address_id = fetch_address_id(request.params['address'])
164
- return { address_id: address_id, address: request.params['address'], currency_id: currency_id }
165
121
  end
166
122
  end
167
123
 
168
- def register_webhooks!(url)
169
- transfer_webhook(url)
170
- address_confirmation_webhook(url)
171
- end
124
+ # def register_webhooks!(url)
125
+ # transfer_webhook(url)
126
+ # address_confirmation_webhook(url)
127
+ # end
172
128
 
173
129
  # def fetch_address_id(address)
174
130
  # currency = erc20_currency_id
175
131
  # client.rest_api(:get, "#{currency}/wallet/#{wallet_id}/address/#{address}")
176
132
  # .fetch('id')
177
- # rescue Coinpaymentnew::Client::Error => e
133
+ # rescue Coinpayment::Client::Error => e
178
134
  # raise Peatio::Wallet::ClientError, e
179
135
  # end
180
136
 
181
137
  def fetch_transfer!(id)
182
- response = client.rest_api(:get, "#{currency_id}/wallet/#{wallet_id}/transfer/#{id}")
183
- parse_entries(response['entries']).map do |entry|
184
- to_address = if response.dig('coinSpecific', 'memo').present?
185
- memo = response.dig('coinSpecific', 'memo')
186
- memo_type = memo.kind_of?(Array) ? memo.first : memo
187
- build_address(entry['address'], memo_type)
188
- else
189
- entry['address']
190
- end
191
- state = define_transaction_state(response['state'])
192
-
193
- if response['outputs'].present?
194
- output = response['outputs'].find { |out| out['address'] == to_address }
195
- txout = output['index'] if output.present?
196
- end
197
-
198
- if response['feeString'].present?
199
- fee = convert_from_base_unit(response['feeString']) / response['entries'].count
200
- end
201
-
202
- transaction = Peatio::Transaction.new(
203
- currency_id: @currency.fetch(:id),
204
- amount: convert_from_base_unit(entry['valueString']),
205
- fee: fee,
206
- fee_currency_id: erc20_currency_id,
207
- hash: normalize_txid(response['txid']),
208
- to_address: to_address,
209
- block_number: response['height'],
210
- txout: txout.to_i,
211
- status: state
212
- )
213
-
214
- transaction if transaction.valid?
215
- end.compact
216
- rescue Coinpaymentnew::Client::Error => e
138
+ args = { cmd: "get_tx_info", txid: id }
139
+ response = client.rest_api(args)
140
+ state = define_transaction_state(response['status'])
141
+ transaction = Peatio::Transaction.new(
142
+ currency_id: @currency.fetch(:id),
143
+ amount: convert_from_base_unit(response['amountf']),
144
+ fee: 0,
145
+ fee_currency_id: response["coin"],
146
+ hash: normalize_txid(response['txid']),
147
+ to_address: response["payment_address"],
148
+ block_number: 0,
149
+ txout: 0,
150
+ status: state
151
+ )
152
+
153
+ transaction
154
+ rescue Coinpayment::Client::Error => e
217
155
  raise Peatio::Wallet::ClientError, e
218
156
  end
219
157
 
220
- def transfer_webhook(url)
221
- client.rest_api(:post, "#{currency_id}/wallet/#{wallet_id}/webhooks", {
222
- type: 'transfer',
223
- allToken: true,
224
- url: url,
225
- label: "webhook for #{url}",
226
- listenToFailureStates: false
227
- })
228
- end
158
+ # def transfer_webhook(url)
159
+ # client.rest_api(:post, "#{currency_id}/wallet/#{wallet_id}/webhooks", {
160
+ # type: 'transfer',
161
+ # allToken: true,
162
+ # url: url,
163
+ # label: "webhook for #{url}",
164
+ # listenToFailureStates: false
165
+ # })
166
+ # end
229
167
 
230
- def address_confirmation_webhook(url)
231
- client.rest_api(:post, "#{currency_id}/wallet/#{wallet_id}/webhooks", {
232
- type: 'address_confirmation',
233
- allToken: true,
234
- url: url,
235
- label: "webhook for #{url}",
236
- listenToFailureStates: false
237
- })
238
- end
168
+ # def address_confirmation_webhook(url)
169
+ # client.rest_api(:post, "#{currency_id}/wallet/#{wallet_id}/webhooks", {
170
+ # type: 'address_confirmation',
171
+ # allToken: true,
172
+ # url: url,
173
+ # label: "webhook for #{url}",
174
+ # listenToFailureStates: false
175
+ # })
176
+ # end
239
177
 
240
178
  def parse_entries(entries)
241
179
  entries.map do |e|
@@ -243,15 +181,12 @@ module Peatio
243
181
  end.compact
244
182
  end
245
183
 
246
- private
247
-
248
184
  def client
249
185
  uri = @wallet.fetch(:uri) { raise Peatio::Wallet::MissingSettingError, :uri }
250
186
  access_token = @wallet.fetch(:access_token) { raise Peatio::Wallet::MissingSettingError, :access_token }
187
+ access_token2 = @wallet.fetch(:access_token2) { raise Peatio::Wallet::MissingSettingError, :access_token2 }
251
188
 
252
- currency_code_prefix = @wallet.fetch(:testnet) ? 't' : ''
253
- uri = uri.gsub(/\/+\z/, '') + '/' + currency_code_prefix
254
- @client ||= Client.new(uri, access_token)
189
+ @client ||= Client.new(uri, access_token, access_token2)
255
190
  end
256
191
 
257
192
  def build_address(address, memo)
@@ -331,12 +266,11 @@ module Peatio
331
266
  end
332
267
 
333
268
  def define_transaction_state(state)
334
- case state
335
- when 'unconfirmed'
269
+ if state >= 100
270
+ "success"
271
+ elsif state >= 0 and state <= 99
336
272
  'pending'
337
- when 'confirmed'
338
- 'success'
339
- when 'failed','rejected'
273
+ else
340
274
  'failed'
341
275
  end
342
276
  end
@@ -2,7 +2,6 @@
2
2
  require 'em/pure_ruby'
3
3
  require "peatio"
4
4
  require "coinpayments"
5
- require_relative "../../config/initializers/coinpayments"
6
5
  require_relative "coinpaymentnew/version"
7
6
 
8
7
  module Peatio
@@ -13,6 +12,7 @@ module Peatio
13
12
  require "bigdecimal/util"
14
13
 
15
14
  require_relative "coinpaymentnew/blockchain"
15
+ require_relative "coinpaymentnew/client"
16
16
  require_relative "coinpaymentnew/wallet"
17
17
 
18
18
  require_relative "coinpaymentnew/hooks"
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peatio-coinpaymentnew
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harishankar Joshi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-01 00:00:00.000000000 Z
11
+ date: 2021-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -205,14 +205,19 @@ files:
205
205
  - Rakefile
206
206
  - bin/console
207
207
  - bin/setup
208
- - config/initializers/coinpayments.rb
209
208
  - lib/peatio/coinpaymentnew.rb
210
209
  - lib/peatio/coinpaymentnew/blockchain.rb
210
+ - lib/peatio/coinpaymentnew/client.rb
211
211
  - lib/peatio/coinpaymentnew/hooks.rb
212
212
  - lib/peatio/coinpaymentnew/railtie.rb
213
213
  - lib/peatio/coinpaymentnew/version.rb
214
214
  - lib/peatio/coinpaymentnew/wallet.rb
215
- - lib/peatio/coinpaymentnew/walletApi.rb
215
+ - peatio-coinpaymentnew-0.0.2.gem
216
+ - peatio-coinpaymentnew-0.0.3.gem
217
+ - peatio-coinpaymentnew-0.0.4.gem
218
+ - peatio-coinpaymentnew-0.0.5.gem
219
+ - peatio-coinpaymentnew-0.0.6.gem
220
+ - peatio-coinpaymentnew-0.0.7.gem
216
221
  - peatio-coinpaymentnew.gemspec
217
222
  homepage: https://openware.com/
218
223
  licenses:
@@ -1,6 +0,0 @@
1
- Coinpayments.configure do |config|
2
- config.merchant_id = '81584a734276162e589fb2a5c19d1114'
3
- config.public_api_key = '1c68e7c5cd7f03d79325bc63e2985d3dc604847242a22d682673f531af4cadcb'
4
- config.private_api_key = '13F4855BFDa330B43063F07961CA373CfF3bb141d8ccCdF83B5e92ac2ad0f78b'
5
- config.secret_phrase = '@hari123'
6
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Peatio
4
- module Coinpaymentnew
5
- class WalletApi
6
- public
7
- def self.balance
8
- Coinpayments.balances
9
- end
10
- def self.rate
11
- Coinpayments.rates
12
- end
13
- def self.createTransaction(amount, currency1, currency2, address)
14
- Coinpayments.create_transaction(amount, currency1, currency2, {address: address, buyer_email: "joshirockstar007@gmail.com"})
15
- end
16
- def self.createWithdrawal(amount, currency, address)
17
- Coinpayments.create_withdrawal(amount, currency, address)
18
- end
19
- def self.cancelWithdrawal(id)
20
- Coinpayments.cancel_withdrawal(id)
21
- end
22
- def self.getTxInfo(txid)
23
- Coinpayments.get_tx_info(txid)
24
- end
25
- def self.getCallbackAddress(currency)
26
- Coinpayments.get_callback_address(currency)
27
- end
28
- def self.get_deposit_address(currency, options = {})
29
- args = { currency: currency }.merge!(options)
30
- Coinpayments.api_call(args)
31
- end
32
- def self.getWithdrawalInfo(id)
33
- Coinpayments.get_withdrawal_info(id)
34
- end
35
- def self.Sign(secretPhrase)
36
- Coinpayments.sign(secretPhrase)
37
- end
38
- end
39
- end
40
- end
41
-