Closed huturen closed 6 years ago
What PHP library version are you using?
Can you describe what you were trying to achieve, and can you provide a code snippet that caused the error?
Version: "bitpay/php-client": "^3.0"
I followed this tutorial: https://github.com/bitpay/php-bitpay-client/blob/master/examples/Currencies.php
,
and want to get something about Currencies information.
public function __construct() {
$this->bitpay = new \Bitpay\Bitpay([
'bitpay' => [
'network' => static::NET,
'public_key' => static::PUBLIC_KEY,
'private_key' => static::PRIVATE_KEY,
'key_storage_password' => static::KEY_PASSWORD,
]
]);
$this->client = $this->bitpay->get('client');
var_dump($currencies = $this->client->getCurrencies());
die;
}
"bitpay/php-client 2.2" has the same problem.
Thanks. The issue resides in the available currency list: https://github.com/bitpay/php-bitpay-client/commit/61cc445e7fd619e0853b932badf9728aeb29cd3b#diff-6cc189dc3811c0dd028edb1eebeacaee
Adding 'BCH' on line 40 resolves the issue. We'll do so in a next release.
PHP Fatal error: Uncaught Bitpay\Client\ArgumentException: The currency code "BCH" is not supported. in /home/hu/web/btcwallet/bitpay/vendor/bitpay/php-client/src/Bitpay/Currency.php:120 Stack trace:
0 /home/hu/web/btcwallet/bitpay/vendor/bitpay/php-client/src/Bitpay/Client/Client.php(230): Bitpay\Currency->setCode('BCH')
1 [internal function]: Bitpay\Client\Client->Bitpay\Client{closure}(Array, 1)
2 /home/hu/web/btcwallet/bitpay/vendor/bitpay/php-client/src/Bitpay/Client/Client.php(240): array_walk(Array, Object(Closure))
3 /home/hu/web/btcwallet/bitpay/MyBitpay.php(32): Bitpay\Client\Client->getCurrencies()
4 /home/hu/web/btcwallet/bitpay/MyBitpay.php(124): MyBitpay->__construct()
5 {main}
thrown in /home/hu/web/btcwallet/bitpay/vendor/bitpay/php-client/src/Bitpay/Currency.php on line 120