1 | <?php |
||
15 | class BittrexClient |
||
16 | { |
||
17 | /** |
||
18 | * Main URL to Bittrex Exchange |
||
19 | */ |
||
20 | private const BASE_URI = 'https://api.bittrex.com'; |
||
21 | |||
22 | private const CLIENT_HEADER = [ |
||
23 | 'User-Agent' => 'r3bers/bittrex-api/1.3.1', |
||
24 | 'Accept' => 'application/json', |
||
25 | 'Content-Type' => 'application/json' |
||
26 | ]; |
||
27 | |||
28 | /** @var Client */ |
||
29 | private $publicClient; |
||
30 | |||
31 | /** @var Client */ |
||
32 | private $privateClient; |
||
33 | |||
34 | /** @var string */ |
||
35 | private $key = ''; |
||
36 | |||
37 | /** @var string */ |
||
38 | private $secret = ''; |
||
39 | |||
40 | /** |
||
41 | * @return PublicApi |
||
42 | */ |
||
43 | 1 | public function public(): PublicApi |
|
47 | |||
48 | /** |
||
49 | * @return Client |
||
50 | */ |
||
51 | 1 | private function getPublicClient(): Client |
|
55 | |||
56 | /** |
||
57 | * @return Client |
||
58 | */ |
||
59 | 1 | private function createPublicClient(): Client |
|
66 | |||
67 | /** |
||
68 | * @param string $key |
||
69 | * @param string $secret |
||
70 | * @throws InvalidCredentialException |
||
71 | */ |
||
72 | 4 | public function setCredential(string $key, string $secret): void |
|
81 | |||
82 | /** |
||
83 | * @param string $md5 |
||
84 | * @return bool |
||
85 | */ |
||
86 | 4 | private function isValidMd5($md5 = '') |
|
90 | |||
91 | /** |
||
92 | * @return Market |
||
93 | * @throws InvalidCredentialException |
||
94 | */ |
||
95 | 2 | public function market(): Market |
|
99 | |||
100 | /** |
||
101 | * @return Client |
||
102 | * @throws InvalidCredentialException |
||
103 | */ |
||
104 | 4 | private function getPrivateClient(): Client |
|
108 | |||
109 | /** |
||
110 | * @return Client |
||
111 | * @throws InvalidCredentialException |
||
112 | */ |
||
113 | 4 | private function createPrivateClient(): Client |
|
127 | |||
128 | /** |
||
129 | * @return bool |
||
130 | */ |
||
131 | 5 | public function haveValidCredentials(): bool |
|
135 | |||
136 | /** |
||
137 | * @return Account |
||
138 | * @throws InvalidCredentialException |
||
139 | */ |
||
140 | 2 | public function account(): Account |
|
144 | } |