From 040498b6b73dda9fcd5b95f1393841b16134e262 Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Thu, 17 Apr 2025 12:21:03 +0100 Subject: [PATCH 1/5] update delegates --- src/API/Rounds.php | 6 +++--- src/API/{Delegates.php => Validators.php} | 14 +++++++------- tests/API/DelegatesTest.php | 20 ++++++++++---------- tests/API/RoundsTest.php | 6 +++--- 4 files changed, 23 insertions(+), 23 deletions(-) rename src/API/{Delegates.php => Validators.php} (67%) diff --git a/src/API/Rounds.php b/src/API/Rounds.php index 8f3e2c3..6a798d6 100644 --- a/src/API/Rounds.php +++ b/src/API/Rounds.php @@ -31,14 +31,14 @@ public function get(int $round_id): ?array } /** - * Get the forging delegates of a round by the given id. + * Get the forging validators of a round by the given id. * * @param int $round_id * * @return array */ - public function delegates(int $round_id): ?array + public function validators(int $round_id): ?array { - return $this->requestGet("rounds/{$round_id}/delegates"); + return $this->requestGet("rounds/{$round_id}/validators"); } } diff --git a/src/API/Delegates.php b/src/API/Validators.php similarity index 67% rename from src/API/Delegates.php rename to src/API/Validators.php index e7142ff..6202b9d 100644 --- a/src/API/Delegates.php +++ b/src/API/Validators.php @@ -4,7 +4,7 @@ namespace ArkEcosystem\Client\API; -class Delegates extends AbstractAPI +class Validators extends AbstractAPI { /** * Get all accounts. @@ -15,7 +15,7 @@ class Delegates extends AbstractAPI */ public function all(array $query = []): ?array { - return $this->requestGet('delegates', $query); + return $this->requestGet('validators', $query); } /** @@ -27,11 +27,11 @@ public function all(array $query = []): ?array */ public function get(string $id): ?array { - return $this->requestGet("delegates/{$id}"); + return $this->requestGet("validators/{$id}"); } /** - * Get all blocks for the given delegate. + * Get all blocks for the given validator. * * @param string $id * @param array $query @@ -40,11 +40,11 @@ public function get(string $id): ?array */ public function blocks(string $id, array $query = []): ?array { - return $this->requestGet("delegates/{$id}/blocks", $query); + return $this->requestGet("validators/{$id}/blocks", $query); } /** - * Get all voters for the given delegate. + * Get all voters for the given validator. * * @param string $id * @param array $query @@ -53,6 +53,6 @@ public function blocks(string $id, array $query = []): ?array */ public function voters(string $id, array $query = []): ?array { - return $this->requestGet("delegates/{$id}/voters", $query); + return $this->requestGet("validators/{$id}/voters", $query); } } diff --git a/tests/API/DelegatesTest.php b/tests/API/DelegatesTest.php index 8da8435..c29d5c6 100644 --- a/tests/API/DelegatesTest.php +++ b/tests/API/DelegatesTest.php @@ -7,39 +7,39 @@ use ArkEcosystem\Tests\Client\TestCase; /** - * @covers \ArkEcosystem\Client\API\Delegates + * @covers \ArkEcosystem\Client\API\Validators */ -class DelegatesTest extends TestCase +class ValidatorsTest extends TestCase { /** @test */ public function all_calls_correct_url() { - $this->assertResponse('GET', 'delegates', function ($client) { - return $client->delegates()->all(); + $this->assertResponse('GET', 'validators', function ($client) { + return $client->validators()->all(); }); } /** @test */ public function get_calls_correct_url() { - $this->assertResponse('GET', 'delegates/dummy', function ($client) { - return $client->delegates()->get('dummy'); + $this->assertResponse('GET', 'validators/dummy', function ($client) { + return $client->validators()->get('dummy'); }); } /** @test */ public function blocks_calls_correct_url() { - $this->assertResponse('GET', 'delegates/dummy/blocks', function ($client) { - return $client->delegates()->blocks('dummy'); + $this->assertResponse('GET', 'validators/dummy/blocks', function ($client) { + return $client->validators()->blocks('dummy'); }); } /** @test */ public function voters_calls_correct_url() { - $this->assertResponse('GET', 'delegates/dummy/voters', function ($client) { - return $client->delegates()->voters('dummy'); + $this->assertResponse('GET', 'validators/dummy/voters', function ($client) { + return $client->validators()->voters('dummy'); }); } } diff --git a/tests/API/RoundsTest.php b/tests/API/RoundsTest.php index e2e9636..c9f4415 100644 --- a/tests/API/RoundsTest.php +++ b/tests/API/RoundsTest.php @@ -28,10 +28,10 @@ public function view_calls_correct_url() } /** @test */ - public function delegates_calls_correct_url() + public function validators_calls_correct_url() { - $this->assertResponse('GET', 'rounds/12345/delegates', function ($client) { - return $client->rounds()->delegates(12345); + $this->assertResponse('GET', 'rounds/12345/validators', function ($client) { + return $client->rounds()->validators(12345); }); } } From a2e4689c9e308d09abbb3b670ea1cf38c603547b Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Thu, 17 Apr 2025 12:21:30 +0100 Subject: [PATCH 2/5] update height argument for commit block number --- src/API/Commits.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/API/Commits.php b/src/API/Commits.php index 916255e..cd7c543 100644 --- a/src/API/Commits.php +++ b/src/API/Commits.php @@ -7,14 +7,14 @@ class Commits extends AbstractAPI { /** - * Takes a block height and returns the commit details. + * Takes a block number and returns the commit details. * * @param int $id * * @return array */ - public function get(int $height): ?array + public function get(int $number): ?array { - return $this->requestGet("commits/{$height}"); + return $this->requestGet("commits/{$number}"); } } From fe68b2c95d4da0267e82093a1166c1eb9cc2bb96 Mon Sep 17 00:00:00 2001 From: alexbarnsley Date: Thu, 17 Apr 2025 11:22:25 +0000 Subject: [PATCH 3/5] style: resolve style guide violations --- tests/API/DelegatesTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/API/DelegatesTest.php b/tests/API/DelegatesTest.php index c29d5c6..bb3767f 100644 --- a/tests/API/DelegatesTest.php +++ b/tests/API/DelegatesTest.php @@ -9,7 +9,7 @@ /** * @covers \ArkEcosystem\Client\API\Validators */ -class ValidatorsTest extends TestCase +class DelegatesTest extends TestCase { /** @test */ public function all_calls_correct_url() From b560d0b9eb595a740f9c80a56ed9b1a79f78e22a Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Thu, 17 Apr 2025 12:37:41 +0100 Subject: [PATCH 4/5] rename delegates test --- tests/API/{DelegatesTest.php => ValidatorsTest.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/API/{DelegatesTest.php => ValidatorsTest.php} (100%) diff --git a/tests/API/DelegatesTest.php b/tests/API/ValidatorsTest.php similarity index 100% rename from tests/API/DelegatesTest.php rename to tests/API/ValidatorsTest.php From 878cda625eb793c3cb40110433870dc823cf4a34 Mon Sep 17 00:00:00 2001 From: alexbarnsley Date: Thu, 17 Apr 2025 11:38:16 +0000 Subject: [PATCH 5/5] style: resolve style guide violations --- tests/API/ValidatorsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/API/ValidatorsTest.php b/tests/API/ValidatorsTest.php index bb3767f..c29d5c6 100644 --- a/tests/API/ValidatorsTest.php +++ b/tests/API/ValidatorsTest.php @@ -9,7 +9,7 @@ /** * @covers \ArkEcosystem\Client\API\Validators */ -class DelegatesTest extends TestCase +class ValidatorsTest extends TestCase { /** @test */ public function all_calls_correct_url()