在调用此方法之前,必须在客户端上调用enableActiveRecord()

时间:2016-06-28 13:25:05

标签: coinbase-api coinbase-php

我正在使用coinbase-php库。

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

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

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

2 个答案:

答案 0 :(得分:0)

在使用代码段之前,我应该通过

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

之后不久
$this->client = Client::create($this->configuration);

答案 1 :(得分:0)

试试这个,我希望它有所帮助。

将帐户设为主要帐户。

请求示例:

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"
   }
}