Skip to content

Commit

Permalink
Merge pull request #3 from JaminPeng/main
Browse files Browse the repository at this point in the history
update api getAddressHistoryList to support pagination
  • Loading branch information
caixiao-QA authored Jul 11, 2022
2 parents 5b97201 + 2fe6126 commit 32df7c1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,12 @@ function verifyValidAddress(string $coin, string $address)
* @return mixed|string
* @throws Exception
*/
function getAddressHistoryList(string $coin)
function getAddressHistoryList(string $coin, int $pageIndex = null , int $pageLength = null)
{
$params = [
"coin" => $coin
"coin" => $coin,
"page_index" => $pageIndex,
"page_length" => $pageLength
];
return $this->request("GET", "/v1/custody/address_history/", $params);
}
Expand Down
22 changes: 21 additions & 1 deletion ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class ClientTest extends TestCase
{
private $client;

/**
* @throws Exception
*/
protected function setUp(): void
{
$signer = new LocalSigner($GLOBALS["secret"]);
Expand All @@ -30,7 +33,7 @@ protected function setUp(): void
$this->data = Config::PROD_DATA;
}
else{
throw("Invalid env parameter.");
throw new Exception("Invalid env parameter.");
}
$signer = new LocalSigner($GLOBALS["secret"]);
$this->client = new Client($signer, $env, false);
Expand Down Expand Up @@ -293,7 +296,24 @@ public function GetValidAddressHistoryList_Provider()
array("BTC", 1)
);
}
/**
* @throws Exception
* @dataProvider GetValidAddressHistoryListWithPage_Provider
*/
public function testGetValidAddressHistoryListWithPage($coin, $pageIndex, $pageLength)
{
$res = $this->client->getAddressHistoryList("ETH",0,2);
$this->assertTrue($res->success);
$this->assertEquals(sizeof($res->result), $pageLength);

}

public function GetValidAddressHistoryListWithPage_Provider()
{
return array(
array("ETH", 0, 2)
);
}
/**
* @throws Exception
* @dataProvider GetInvalidAddressHistoryList_Provider
Expand Down
4 changes: 2 additions & 2 deletions README.md

Large diffs are not rendered by default.

0 comments on commit 32df7c1

Please sign in to comment.