Coinbase php lib not working fine showing errors

心已入冬 提交于 2021-01-07 04:15:13

问题


I'm a trying to develop a system that generates btc address i am trying to use the coinbase php lib but i seem not to understand it and it's giving me errors that i don't understand

My code

use Coinbase\Wallet\Client;
use Coinbase\Wallet\Configuration;

include 'vendor/autoload.php';
include 'conn.php';

$result = $conn->query("SELECT * FROM settings WHERE bot =2");
$settings = mysqli_fetch_assoc($result);
$apiSecret = $settings['apiSecret'];
$apiKey = $settings['apiKey'];

$configuration = Configuration::apiKey($id, $secret);
$client = Client::create($configuration);

use Coinbase\Wallet\Resource\Address;
$account = $client->getPrimaryAccount();
$address = new Address([
    'name' => 'user'.$user
]);
print_r($address);
?>

My error Fatal error: Uncaught TypeError: Argument 1 passed to Coinbase\Wallet\Exception\HttpException::errors() must be an instance of Psr\Http\Message\ResponseInterface, null given, called in /www/wwwroot/xxxx/tg/vendor/coinbase/coinbase/src/Exception/HttpException.php on line 29 and defined in /www/wwwroot/xxxx/tg/vendor/coinbase/coinbase/src/Exception/HttpException.php:77 Stack trace: #0 /www/wwwroot/xxxx/tg/vendor/coinbase/coinbase/src/Exception/HttpException.php(29): Coinbase\Wallet\Exception\HttpException::errors(NULL) #1 /www/wwwroot/xxxx/tg/vendor/coinbase/coinbase/src/HttpClient.php(137): Coinbase\Wallet\Exception\HttpException::wrap(Object(GuzzleHttp\Exception\RequestException)) #2 /www/wwwroot/xxxx/tg/vendor/coinbase/coinbase/src/HttpClient.php(121): Coinbase\Wallet\HttpClient->send(Object(GuzzleHttp\Psr7\Request), Array) #3 /www/wwwroot/xxxx/tg/vendor/coinbase/coinbase/src/HttpClient.php(74): Coinbase\Wallet\HttpClient->request('GET', '/v2/accounts/pr...', Array) #4 /www/wwwroot/cry in /www/wwwroot/xxxx/tg/vendor/coinbase/coinbase/src/Exception/HttpException.php on line 77


回答1:


Php is depreciated so the best language to use is python since no more available support for the php library. if your using php you can use the exec() function to grab whatever response you want to grab



来源:https://stackoverflow.com/questions/61735624/coinbase-php-lib-not-working-fine-showing-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!