Search code examples
coinbase-apicoinbase-php

You must call enableActiveRecord() on your client before calling this method


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.


Solution

  • Before using the snippet, I should have enabledActiveRecord by

    $this->client->enableActiveRecord();
    

    Soon after

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