Issues (7)

src/Helpers/Blockchains/Bitcoin.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace HopekellDev\Tatum\Helpers\Blockchains;
4
5
use Illuminate\Support\Facades\Http;
0 ignored issues
show
The type Illuminate\Support\Facades\Http was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class Bitcoin
8
{
9
    protected $apiKey;
10
    protected $accountID;
11
    protected $baseUrl;
12
13
    /**
14
     * Construct
15
     */
16
    function __construct(String $apiKey, String $accountID, String $baseUrl)
17
    {
18
        $this->apiKey = $apiKey;
19
        $this->accountID = $accountID;
20
        $this->baseUrl = $baseUrl . '/bitcoin/';
21
    }
22
23
24
    /**
25
     * Generate wallet
26
     * Generates a wallet and address [returns xpub, mnemonic phrase and wallet address]
27
     */
28
    public function createWallet()
29
    {
30
        $payload = [];
31
        $wallet = Http::withToken($this->apiKey)
32
            ->get($this->baseUrl . 'wallet')
33
            ->json();
34
35
        $payload['wallet'] = $wallet;
36
        $address = Http::withToken($this->apiKey)
37
            ->get($this->baseUrl . 'address/' . $wallet['xpub'] . "/" . 0)
38
            ->json();
39
        $payload['address'] = $address;
40
        return $payload;
41
    }
42
43
}