-1

I am using coinbase-php library.

I am trying to get addresses of primary account using following code.

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

Getting "enableActiveRecord() on your client before calling this method" error.

Anoop Pete
  • 492
  • 2
  • 4
  • 17

2 Answers2

0

Before using the snippet, I should have enabledActiveRecord by

$this->client->enableActiveRecord();

Soon after

$this->client = Client::create($this->configuration);
Anoop Pete
  • 492
  • 2
  • 4
  • 17
0

Try this, I hope it helps.

Set account as primary.

Example request:

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"
   }
}
Dror Cohen
  • 6,731
  • 5
  • 29
  • 32
Hector David
  • 51
  • 1
  • 2