-1

我正在使用 coinbase-php 库。

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

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

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

4

2 回答 2

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"
   }
}
于 2016-07-05T02:01:23.117 回答
0

在使用片段之前,我应该启用ActiveRecord

$this->client->enableActiveRecord();

不久之后

$this->client = Client::create($this->configuration);
于 2016-06-29T12:22:08.040 回答