Skip to content

Commit

Permalink
fix api: get wait list
Browse files Browse the repository at this point in the history
  • Loading branch information
grkamil committed Oct 20, 2020
1 parent 1d9aa0b commit 1c56556
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This is a pure PHP SDK for working with <b>Minter</b> blockchain
- [getMaxGasPrice](#getmaxgasprice)
- [getMinGasPrice](#getmingasprice)
- [getMissedBlocks](#getmissedblocks)
- [getMissedBlocks](#getwaitlist)
- [Error handling](#error-handling)

* [Minter SDK](#using-mintersdk)
Expand Down Expand Up @@ -290,6 +291,14 @@ Return node network information.
getNetworkInfo(): \stdClass
``

### getWaitlist

Return waitlisted stakes by address

``
getWaitlist(string $address, ?string $publicKey = null, ?int $height = null): \stdClass
``

### Error handling

Example of how you can handle errors and get the response body.
Expand Down
21 changes: 16 additions & 5 deletions src/Minter/MinterAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,24 @@ public function getFrozen(?string $address = null, ?string $coin = null): \stdCl
}

/**
* @param string $publicKey
* @param string $address
* @param int|null $height
* @param string $address
* @param string|null $publicKey
* @param int|null $height
* @return \stdClass
* @throws GuzzleException
*/
public function getWaitlist(string $publicKey, string $address, ?int $height = null): \stdClass
public function getWaitlist(string $address, ?string $publicKey = null, ?int $height = null): \stdClass
{
return $this->get('waitlist/' . $publicKey . '/' . $address, ($height ? ['height' => $height] : null));
$params = [];

if ($height) {
$params['height'] = $height;
}

if ($publicKey) {
$params['publicKey'] = $publicKey;
}

return $this->get('waitlist/' . $address, $params);
}
}

0 comments on commit 1c56556

Please sign in to comment.