1 | <?php |
||
16 | class BittrexClient |
||
17 | { |
||
18 | /** |
||
19 | * Main URL to Bittrex Exchange |
||
20 | */ |
||
21 | private const BASE_URI = 'https://api.bittrex.com'; |
||
22 | |||
23 | private const CLIENT_HEADER = [ |
||
24 | 'User-Agent' => 'r3bers/bittrex-api/1.3.1', |
||
25 | 'Accept' => 'application/json', |
||
26 | 'Content-Type' => 'application/json' |
||
27 | ]; |
||
28 | |||
29 | /** @var Client */ |
||
30 | private $publicClient; |
||
31 | |||
32 | /** @var Client */ |
||
33 | private $privateClient; |
||
34 | |||
35 | /** @var string */ |
||
36 | private $key = ''; |
||
37 | |||
38 | /** @var string */ |
||
39 | private $secret = ''; |
||
40 | /** |
||
41 | * @var Batch |
||
42 | */ |
||
43 | 1 | private $batchClient; |
|
44 | |||
45 | 1 | /** |
|
46 | * @return PublicApi |
||
47 | */ |
||
48 | public function public(): PublicApi |
||
52 | |||
53 | 1 | /** |
|
54 | * @return Client |
||
55 | */ |
||
56 | private function getPublicClient(): Client |
||
60 | |||
61 | 1 | /** |
|
62 | 1 | * @return Client |
|
63 | 1 | */ |
|
64 | private function createPublicClient(): Client |
||
73 | |||
74 | /** |
||
75 | 4 | * @param string $key |
|
76 | 1 | * @param string $secret |
|
77 | * @throws InvalidCredentialException |
||
78 | 3 | */ |
|
79 | 3 | public function setCredential(string $key, string $secret): void |
|
88 | 4 | ||
89 | /** |
||
90 | * @param string $md5 |
||
91 | * @return bool |
||
92 | */ |
||
93 | public function isValidMd5(string $md5 = ''): bool |
||
97 | 2 | ||
98 | /** |
||
99 | * @return Batch |
||
100 | * @throws InvalidCredentialException |
||
101 | */ |
||
102 | public function batch(): Batch |
||
107 | |||
108 | /** |
||
109 | * @throws InvalidCredentialException |
||
110 | */ |
||
111 | private function createBatch(): Batch |
||
116 | 2 | ||
117 | /** |
||
118 | 2 | * @return Client |
|
119 | 2 | * @throws InvalidCredentialException |
|
120 | */ |
||
121 | 2 | private function getPrivateClient(): Client |
|
125 | |||
126 | /** |
||
127 | * @return Client |
||
128 | * @throws InvalidCredentialException |
||
129 | */ |
||
130 | private function createPrivateClient(): Client |
||
146 | |||
147 | /** |
||
148 | * @return bool |
||
149 | */ |
||
150 | public function haveValidCredentials(): bool |
||
154 | |||
155 | /** |
||
156 | * @return Market |
||
157 | * @throws InvalidCredentialException |
||
158 | */ |
||
159 | public function market(): Market |
||
163 | |||
164 | /** |
||
165 | * @return Account |
||
166 | * @throws InvalidCredentialException |
||
167 | */ |
||
168 | public function account(): Account |
||
172 | } |