wallet tron transactions
This commit is contained in:
33
sdk/Wallet/Http.php
Normal file
33
sdk/Wallet/Http.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace Sdk\Wallet;
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
class Http
|
||||
{
|
||||
protected Client $httpClient;
|
||||
|
||||
function __construct($client)
|
||||
{
|
||||
$this->httpClient = $client;
|
||||
}
|
||||
|
||||
function getClient()
|
||||
{
|
||||
return $this->httpClient;
|
||||
}
|
||||
|
||||
function get(string $endpoint, array $data = [])
|
||||
{
|
||||
$stream = (string)$this->getClient()->get($endpoint, ['query' => $data])->getBody();
|
||||
$body = json_decode($stream, false);
|
||||
return $body;
|
||||
}
|
||||
|
||||
function post(string $endpoint, array $data = [])
|
||||
{
|
||||
$stream = (string)$this->getClient()->post($endpoint, ['json' => $data])->getBody();
|
||||
$body = json_decode($stream, false);
|
||||
return $body;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user