From 74cf058b8b6c41862350cf922a6c93e585fcccc4 Mon Sep 17 00:00:00 2001 From: Alfonso Bribiesca Date: Thu, 13 Feb 2025 09:25:24 -0600 Subject: [PATCH 1/4] add configuration endpoint & tests --- src/API/Transactions.php | 10 ++++++++++ tests/API/TransactionsTest.php | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/API/Transactions.php b/src/API/Transactions.php index 60ce910..99ca9ef 100644 --- a/src/API/Transactions.php +++ b/src/API/Transactions.php @@ -93,4 +93,14 @@ public function schemas(): ?array { return $this->get('transactions/schemas'); } + + /** + * Get the pool configuration + * + * @return array + */ + public function configuration(): ?array + { + return $this->withApi('transactions')->get('configuration'); + } } diff --git a/tests/API/TransactionsTest.php b/tests/API/TransactionsTest.php index 5c3c263..6139789 100644 --- a/tests/API/TransactionsTest.php +++ b/tests/API/TransactionsTest.php @@ -79,4 +79,17 @@ public function schemas_calls_correct_url() return $client->transactions()->schemas(); }); } + + /** @test */ + public function configuration_calls_correct_url() + { + $this->assertResponse( + method: 'GET', + path: 'configuration', + callback: function ($client) { + return $client->transactions()->configuration(); + }, + expectedApi: 'transactions' + ); + } } From 71b05633e9273761d91afdedbae296027fe2b985 Mon Sep 17 00:00:00 2001 From: Alfonso Bribiesca Date: Thu, 13 Feb 2025 09:29:11 -0600 Subject: [PATCH 2/4] fix unconfirmed endpoint --- src/API/Transactions.php | 2 +- tests/API/TransactionsTest.php | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/API/Transactions.php b/src/API/Transactions.php index 99ca9ef..52cfda7 100644 --- a/src/API/Transactions.php +++ b/src/API/Transactions.php @@ -49,7 +49,7 @@ public function show(string $id): ?array */ public function allUnconfirmed(): ?array { - return $this->get('transactions/unconfirmed'); + return $this->withApi('transactions')->get('transactions/unconfirmed'); } /** diff --git a/tests/API/TransactionsTest.php b/tests/API/TransactionsTest.php index 6139789..cabd116 100644 --- a/tests/API/TransactionsTest.php +++ b/tests/API/TransactionsTest.php @@ -43,9 +43,14 @@ public function show_calls_correct_url() /** @test */ public function all_unconfirmed_calls_correct_url() { - $this->assertResponse('GET', 'transactions/unconfirmed', function ($client) { - return $client->transactions()->allUnconfirmed(); - }); + $this->assertResponse( + method: 'GET', + path: 'transactions/unconfirmed', + callback: function ($client) { + return $client->transactions()->allUnconfirmed(); + }, + expectedApi: 'transactions' + ); } /** @test */ From 94c14d30e3add5a97b1d8c648081a2fbdb04d922 Mon Sep 17 00:00:00 2001 From: Alfonso Bribiesca Date: Thu, 13 Feb 2025 09:32:24 -0600 Subject: [PATCH 3/4] adjust unconfirmed url --- src/API/Transactions.php | 2 +- tests/API/TransactionsTest.php | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/API/Transactions.php b/src/API/Transactions.php index 52cfda7..c04aab2 100644 --- a/src/API/Transactions.php +++ b/src/API/Transactions.php @@ -61,7 +61,7 @@ public function allUnconfirmed(): ?array */ public function showUnconfirmed(string $id): ?array { - return $this->get("transactions/unconfirmed/{$id}"); + return $this->withApi('transactions')->get("transactions/unconfirmed/{$id}"); } /** diff --git a/tests/API/TransactionsTest.php b/tests/API/TransactionsTest.php index cabd116..7088361 100644 --- a/tests/API/TransactionsTest.php +++ b/tests/API/TransactionsTest.php @@ -56,9 +56,14 @@ public function all_unconfirmed_calls_correct_url() /** @test */ public function show_unconfirmed_calls_correct_url() { - $this->assertResponse('GET', 'transactions/unconfirmed/dummy', function ($client) { - return $client->transactions()->showUnconfirmed('dummy'); - }); + $this->assertResponse( + method: 'GET', + path: 'transactions/unconfirmed/dummy', + callback: function ($client) { + return $client->transactions()->showUnconfirmed('dummy'); + }, + expectedApi: 'transactions' + ); } /** @test */ From 0a2194185bdc582a809c22a6563370de420cbf6c Mon Sep 17 00:00:00 2001 From: alfonsobries Date: Thu, 13 Feb 2025 15:36:03 +0000 Subject: [PATCH 4/4] style: resolve style guide violations --- src/API/Transactions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/API/Transactions.php b/src/API/Transactions.php index c04aab2..d24c144 100644 --- a/src/API/Transactions.php +++ b/src/API/Transactions.php @@ -95,7 +95,7 @@ public function schemas(): ?array } /** - * Get the pool configuration + * Get the pool configuration. * * @return array */