Skip to content

Commit a028178

Browse files
authored
Merge pull request #116 from wanfeiyy/master
update api
2 parents 99436ca + 162f672 commit a028178

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ go(function () {
318318
| KuCoin\SDK\PublicApi\Currency::getList() | NO | https://docs.kucoin.com/#get-currencies |
319319
| KuCoin\SDK\PublicApi\Currency::getDetail() | NO | https://docs.kucoin.com/#get-currency-detail |
320320
| KuCoin\SDK\PublicApi\Currency::getPrices() | NO | https://docs.kucoin.com/#get-fiat-price |
321+
| KuCoin\SDK\PublicApi\Currency::getV2Detail() | NO | https://docs.kucoin.com/#get-currency-detail-recommend |
321322

322323
</details>
323324

src/Api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ abstract class Api
1616
/**
1717
* @var string SDK Version
1818
*/
19-
const VERSION = '1.1.23';
19+
const VERSION = '1.1.24';
2020

2121
/**
2222
* @var string SDK update date
2323
*/
24-
const UPDATE_DATE = '2021.10.25';
24+
const UPDATE_DATE = '2021.12.02';
2525

2626
/**
2727
* @var string

src/PublicApi/Currency.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,20 @@ public function getPrices($base = null, $currencies = null)
5454
$response = $this->call(Request::METHOD_GET, '/api/v1/prices', compact('base', 'currencies'));
5555
return $response->getApiData();
5656
}
57+
58+
/**
59+
* Get the v2 details of a currency
60+
*
61+
* @param $currency
62+
* @param null $chain
63+
* @return mixed|null
64+
* @throws \KuCoin\SDK\Exceptions\BusinessException
65+
* @throws \KuCoin\SDK\Exceptions\HttpException
66+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
67+
*/
68+
public function getV2Detail($currency, $chain = null)
69+
{
70+
$response = $this->call(Request::METHOD_GET, '/api/v2/currencies/' . $currency, compact('chain'));
71+
return $response->getApiData();
72+
}
5773
}

tests/PublicApi/CurrencyTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,27 @@ public function testGetPrices(Currency $api)
6565
$this->assertInternalType('array', $prices);
6666
$this->assertNotEmpty($prices);
6767
}
68+
69+
/**
70+
* @dataProvider apiProvider
71+
* @param Currency $api
72+
* @throws \KuCoin\SDK\Exceptions\BusinessException
73+
* @throws \KuCoin\SDK\Exceptions\HttpException
74+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
75+
*/
76+
public function testGetV2Detail(Currency $api)
77+
{
78+
$currency = $api->getV2Detail('BTC');
79+
$this->assertInternalType('array', $currency);
80+
$this->assertArrayHasKey('currency', $currency);
81+
$this->assertArrayHasKey('name', $currency);
82+
$this->assertArrayHasKey('fullName', $currency);
83+
$this->assertArrayHasKey('precision', $currency);
84+
$this->assertArrayHasKey('confirms', $currency);
85+
$this->assertArrayHasKey('contractAddress', $currency);
86+
$this->assertArrayHasKey('isMarginEnabled', $currency);
87+
$this->assertArrayHasKey('isDebitEnabled', $currency);
88+
$this->assertArrayHasKey('chains', $currency);
89+
$this->assertInternalType('array', $currency['chains']);
90+
}
6891
}

0 commit comments

Comments
 (0)