I am using the ruby gem that they have: https://github.com/coinbase/coinbase-ruby/tree/4.2.1
This is the error I get after successfully using my api key to get get my primary account but then attempt to request a payment with it:
account.request(to: 'example@example.com', amount: '0.00001', currency: 'BTC')
Traceback (most recent call last):
10: from /usr/share/rvm/rubies/ruby-2.6.4/bin/irb:23:in `<main>'
9: from /usr/share/rvm/rubies/ruby-2.6.4/bin/irb:23:in `load'
8: from /usr/share/rvm/rubies/ruby-2.6.4/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
7: from (irb):13
6: from (irb):13:in `rescue in irb_binding'
5: from /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/models/account.rb:79:in `request'
4: from /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/api_client.rb:302:in `request'
3: from /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/api_client.rb:687:in `post'
2: from /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/adapters/net_http.rb:36:in `http_verb'
1: from /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/api_errors.rb:28:in `check_response_status'
Coinbase::Wallet::ParamRequiredError (Missing parameter: `type`)
I have gone through byebug and when I get through the gems/coinbase-4.2.1/lib/coinbase/wallet/api_client.rb:302:in
request'` method:
def request(account_id, params = {})
[ :to, :amount, :currency ].each do |param|
raise APIError, "Missing parameter: #{param}" unless params.include? param
end
params['type'] = 'request'
out = nil
post("/v2/accounts/#{account_id}/transactions", params) do |resp|
out = Request.new(self, resp.data)
yield(out, resp) if block_given?
end
out
end
I have the 'type' param added into my request. So I am unsure where this error is coming from and what I can do to move forward. Any insight would be appreciated.
EDIT: A log out of me checking with byebug:
byebug; account.request(to: 'example@example.com', amount: '0.00001', currency: 'BTC')
[74, 83] in /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/models/account.rb
74: yield(data, resp) if block_given?
75: end
76: end
77:
78: def request(params = {})
=> 79: @client.request(self['id'], params) do |data, resp|
80: yield(data, resp) if block_given?
81: end
82: end
83:
(byebug) step
[291, 300] in /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/api_client.rb
291: end
292: out
293: end
294:
295: def request(account_id, params = {})
=> 296: [ :to, :amount, :currency ].each do |param|
297: raise APIError, "Missing parameter: #{param}" unless params.include? param
298: end
299: params['type'] = 'request'
300:
(byebug) eval params
{:to=>"example@example.com", :amount=>"0.00001", :currency=>"BTC"}
(byebug) step
[292, 301] in /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/api_client.rb
292: out
293: end
294:
295: def request(account_id, params = {})
296: [ :to, :amount, :currency ].each do |param|
=> 297: raise APIError, "Missing parameter: #{param}" unless params.include? param
298: end
299: params['type'] = 'request'
300:
301: out = nil
(byebug)
[292, 301] in /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/api_client.rb
292: out
293: end
294:
295: def request(account_id, params = {})
296: [ :to, :amount, :currency ].each do |param|
=> 297: raise APIError, "Missing parameter: #{param}" unless params.include? param
298: end
299: params['type'] = 'request'
300:
301: out = nil
(byebug)
[292, 301] in /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/api_client.rb
292: out
293: end
294:
295: def request(account_id, params = {})
296: [ :to, :amount, :currency ].each do |param|
=> 297: raise APIError, "Missing parameter: #{param}" unless params.include? param
298: end
299: params['type'] = 'request'
300:
301: out = nil
(byebug)
[294, 303] in /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/api_client.rb
294:
295: def request(account_id, params = {})
296: [ :to, :amount, :currency ].each do |param|
297: raise APIError, "Missing parameter: #{param}" unless params.include? param
298: end
=> 299: params['type'] = 'request'
300:
301: out = nil
302: post("/v2/accounts/#{account_id}/transactions", params) do |resp|
303: out = Request.new(self, resp.data)
(byebug)
[296, 305] in /home/doom/.rvm/gems/ruby-2.6.4/gems/coinbase-4.2.1/lib/coinbase/wallet/api_client.rb
296: [ :to, :amount, :currency ].each do |param|
297: raise APIError, "Missing parameter: #{param}" unless params.include? param
298: end
299: params['type'] = 'request'
300:
=> 301: post("/v2/accounts/#{account_id}/transactions", params) do |resp|
303: out = Request.new(self, resp.data)
304: yield(out, resp) if block_given?
305: end
(byebug) eval params
{:to=>"example@example.com", :amount=>"0.00001", :currency=>"BTC", "type"=>"request"} out = nil
302: post("/v2/accounts/#{account_id}/transactions", params) do |resp|
303: out = Request.new(self, resp.data)
304: yield(out, resp) if block_given?
305: end
(byebug) eval params
{:to=>"example@example.com", :amount=>"0.00001", :currency=>"BTC", "type"=>"request"}
They have actually deprecated this gem.