From c3f01a6e0598a81ef5e13084ba85ab4a7d0ffbf4 Mon Sep 17 00:00:00 2001 From: arianoangelo Date: Fri, 31 Mar 2023 09:36:58 +0100 Subject: [PATCH] v1.1.0 * Added Payouts * Minor bugfixes --- BlockBee/BlockBee.php | 22 ++++++++++++++++++++++ README.md | 36 ++++++++++++++++++++++++++++++++---- composer.json | 4 ++-- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/BlockBee/BlockBee.php b/BlockBee/BlockBee.php index 053915a..5997f21 100644 --- a/BlockBee/BlockBee.php +++ b/BlockBee/BlockBee.php @@ -191,6 +191,10 @@ public static function get_estimate($coin, $addresses = 1, $priority = 'default' public static function get_convert($coin, $value, $from, $api_key) { + if (empty($api_key)) { + throw new Exception('API Key is Empty'); + } + $response = BlockBee::_request($coin, 'convert', [ 'value' => $value, 'from' => $from, @@ -204,6 +208,24 @@ public static function get_convert($coin, $value, $from, $api_key) return null; } + public static function create_payout ($coin, $address, $value, $api_key) { + if (empty($api_key)) { + throw new Exception('API Key is Empty'); + } + + $response = BlockBee::_request($coin, 'payout', [ + 'address' => $address, + 'value' => $value, + 'apikey' => $api_key + ]); + + if ($response->status == 'success') { + return $response; + } + + return null; + } + public static function process_callback($_get) { $params = [ diff --git a/README.md b/README.md index 5dac56b..b64b79e 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,8 @@ PHP >= 5.6 ext-curl ``` - - ## Install - ``` composer require blockbee/php-blockbee ``` @@ -182,8 +179,39 @@ $coins = BlockBee\BlockBee::get_supported_coins($api_key); Response is an array with all support coins. +### Request Payout + +```php +=5.6.0", + "php": ">=7.2.0", "ext-curl": "*", "ext-json": "*" }, @@ -28,5 +28,5 @@ "BlockBee\\": "BlockBee/" } }, - "version": "1.0.1" + "version": "1.1.0" }