Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
- Minor bugfixes
  • Loading branch information
arianoangelo committed Jan 3, 2023
1 parent 6f3d1b6 commit 77eda03
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
19 changes: 16 additions & 3 deletions BlockBee/BlockBee.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BlockBee
private $parameters = [];
private $api_key = null;

public function __construct($coin, $own_address, $callback_url, $parameters = [], $bb_params = [], $api_key)
public function __construct($coin, $own_address, $callback_url, $parameters = [], $bb_params = [], $api_key = '')
{
$this->valid_coins = BlockBee::get_supported_coins($api_key);

Expand All @@ -25,6 +25,10 @@ public function __construct($coin, $own_address, $callback_url, $parameters = []
throw new Exception("Unsupported Coin: {$coin}, Valid options are: {$vc}");
}

if (empty($api_key)) {
throw new Exception('API Key is Empty');
}

$this->own_address = $own_address;
$this->callback_url = $callback_url;
$this->coin = $coin;
Expand Down Expand Up @@ -143,9 +147,14 @@ public function get_qrcode($value = false, $size = false)
return null;
}

public static function get_info($coin = null, $assoc = false, $api_key)
public static function get_info($coin = null, $assoc = false, $api_key = '')
{
$params = [];

if (empty($api_key)) {
throw new Exception('API Key is Empty');
}

$params['apikey'] = $api_key;

if (empty($coin)) {
Expand All @@ -161,8 +170,12 @@ public static function get_info($coin = null, $assoc = false, $api_key)
return null;
}

public static function get_estimate($coin, $addresses = 1, $priority = 'default', $api_key)
public static function get_estimate($coin, $addresses = 1, $priority = 'default', $api_key = '')
{
if (empty($api_key)) {
throw new Exception('API Key is Empty');
}

$response = BlockBee::_request($coin, 'estimate', [
'addresses' => $addresses,
'priority' => $priority,
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "library",
"description": "BlockBee's PHP library",
"keywords": ["crypto", "bitcoin", "litecoin", "ethereum", "bitcoin cash", "monero", "iota", "payments", "cryptocurrencies", "polygon", "tron", "binance smart chain", "erc20", "bep20"],
"homepage": "https://github.com/cryptapi/php-cryptapi",
"homepage": "https://github.com/blockbee-io/php-blockbee",
"license": "MIT",
"authors": [
{
Expand All @@ -28,5 +28,5 @@
"BlockBee\\": "BlockBee/"
}
},
"version": "1.0.0"
"version": "1.0.1"
}

0 comments on commit 77eda03

Please sign in to comment.