Coinbase API 4.2.1 帐户请求方法,缺少参数:`type`

Coinbase API 4.2.1 Account Request Method, Missing parameter: `type`

我正在使用他们拥有的 ruby gem: https://github.com/coinbase/coinbase-ruby/tree/4.2.1

这是我在成功使用 api 密钥获取我的主帐户后尝试使用它请求付款后遇到的错误:

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`)

我已经通过 byebug,当我通过 gems/coinbase-4.2.1/lib/coinbase/wallet/api_client.rb:302:inrequest'` 方法时:

  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

我已将 'type' 参数添加到我的请求中。所以我不确定这个错误是从哪里来的,我能做些什么来继续前进。任何见解将不胜感激。

编辑: 注销我用 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"}

他们实际上已经弃用了这个 gem。

https://github.com/coinbase/coinbase-ruby/issues/124