Class 'Kucoin\SDK\Auth' not found
inazeem opened this issue · 4 comments
I am trying api with laravel and i am getting the auth not found error. I have checked the directory and file is there. I am not sure why it is not picking up. Any help will be great.
$auth = new Auth($this->api_key, $this->api_secret, $this->passphrase, Auth::API_KEY_VERSION_V2);
Did you forget to use namespace use KuCoin\SDK\Auth;
? Or try composer dumpautoload
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use KuCoin\SDK\PublicApi\Time;
use KuCoin\SDK\PrivateApi\Account;
use KuCoin\SDK\Exceptions\HttpException;
use KuCoin\SDK\Exceptions\BusinessException;
use Kucoin\SDK\Auth;
class kucoinController extends Controller
{
//removed the keys for security.
public function index(){
// Auth version v2 (recommend)
$auth = new Auth($this->api_key, $this->api_secret, $this->passphrase, Auth::API_KEY_VERSION_V2);
// Auth version v1
//$auth = new Auth('key', 'secret', 'passphrase');
$api = new Account($auth);
try {
$result = $api->getList(['type' => 'main']);
var_dump($result);
} catch (HttpException $e) {
var_dump($e->getMessage());
} catch (BusinessException $e) {
var_dump($e->getMessage());
}
}
}
So this is what I have on top of the controller class.
There is a typo 'Kucoin', it should be 'KuCoin'.
Thanks, It worked!