【问题标题】:Argument 1 passed to Coinbase\Wallet\Exception\HttpException::exceptionClass() must be an instance of Psr\Http\Message\ResponseInterface, null given传递给 Coinbase\Wallet\Exception\HttpException::exceptionClass() 的参数 1 必须是 Psr\Http\Message\ResponseInterface 的实例,给定 null
【发布时间】:2020-10-19 11:56:52
【问题描述】:

当我离线运行 Coin Base Transactions 时它可以工作,但是当我将它放到网上时它会失败。 这是我的交易代码。


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

    $account = $client->getPrimaryAccount();

    $address = new Address([
        'name' => 'New Address19'
    ]);

    $add = $client->createAccountAddress($account, $address);
    $addressId = $client->getAccountAddresses($account);
    $addresses = $client->getAccountAddress($account, $addressId->getFirstId());
    echo "Your address is: ".json_encode($addresses->getAddress())."<br>";

我用谷歌搜索但一切都是徒劳的,我从这里得到的更新 etc 文件夹中的证书的答案也不起作用。谁来帮帮我

【问题讨论】:

  • 您找到解决方案了吗?

标签: laravel coinbase-api


【解决方案1】:

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

$account = $client->getPrimaryAccount();

$address = new Address([
    'name' => 'New Address19'
]);

$add = $client->createAccountAddress($account, $address);
$addressId = $client->getAccountAddresses($account);
$addresses = $client->getAccountAddress($account, $addressId->getFirstId());
echo "Your address is: ".json_encode($addresses->getAddress())."<br>";

【讨论】:

  • 这不起作用,它与我发布的内容没有什么不同。看来你确实复制和粘贴了
【解决方案2】:

我也有同样的问题。解决方案是从以下位置下载 cacert.pem 文件:

https://curl.se/docs/caextract.html

将其复制到 Coinbase API etc 文件夹(您将在同一位置找到 ca-coinbase.crt)。

然后编辑src\COnfiguration.php 以引用这个新文件:

    public function __construct(Authentication $authentication)
    {
        $this->authentication = $authentication;
        $this->apiUrl = self::DEFAULT_API_URL;
        $this->apiVersion = self::DEFAULT_API_VERSION;
//      $this->caBundle = __DIR__.'/../etc/ca-coinbase.crt'; // Replaced with:
        $this->caBundle = __DIR__.'/../etc/cacert.pem';
    }

【讨论】:

    猜你喜欢
    • 2015-05-11
    • 1970-01-01
    • 1970-01-01
    • 2018-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-24
    • 1970-01-01
    相关资源
    最近更新 更多