【问题标题】:You must call enableActiveRecord() on your client before calling this method在调用此方法之前,您必须在客户端上调用 enableActiveRecord()
【发布时间】:2016-10-30 20:35:29
【问题描述】:

我正在使用 coinbase-php 库。

我正在尝试使用以下代码获取主帐户的地址。

$primaryAccount = $this->client->getPrimaryAccount();
$addresses = $primaryAccount->getAddresses();

在调用此方法之前在您的客户端上获取“enableActiveRecord()”错误。

【问题讨论】:

  • 不明白为什么我的问题被降级了!!!

标签: coinbase-api coinbase-php


【解决方案1】:

在使用 sn-p 之前,我应该通过

启用ActiveRecord
$this->client->enableActiveRecord();

不久之后

$this->client = Client::create($this->configuration);

【讨论】:

    【解决方案2】:

    试试这个,希望对你有帮助。

    将帐户设置为主帐户。

    示例请求:

    curl https://api.coinbase.com/v2/accounts/82de7fcd-db72-5085-8ceb-bee19303080b/primary
      -X POST
      -H 'Authorization: Bearer abd90df5f27a7b170cd775abf89d632b350b7c1c9d53e08b340cd9832ce52c2c'
    
    Response (200)
    {
       "data": 
       {
          "id": "82de7fcd-db72-5085-8ceb-bee19303080b",
          "name": "New hot wallet",
          "primary": true,
          "type": "wallet",
          "currency": "BTC",
          "balance": 
          {
             "amount": "0.00000000",
             "currency": "BTC"
          },
          "native_balance": 
          {
             "amount": "0.00",
             "currency": "USD"
          },
          "created_at": "2015-03-31T15:21:58-07:00",
          "updated_at": "2015-03-31T15:21:58-07:00",
          "resource": "account",
          "resource_path": "/v2/accounts/82de7fcd-db72-5085-8ceb-bee19303080b"
       }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-24
      • 1970-01-01
      • 2021-10-07
      • 1970-01-01
      • 1970-01-01
      • 2012-07-20
      相关资源
      最近更新 更多