Skip to content

Commit a3114f6

Browse files
authored
refactor: transaction api endpoints adjustments (#117)
1 parent af8e575 commit a3114f6

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

src/API/Transactions.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function show(string $id): ?array
4949
*/
5050
public function allUnconfirmed(): ?array
5151
{
52-
return $this->get('transactions/unconfirmed');
52+
return $this->withApi('transactions')->get('transactions/unconfirmed');
5353
}
5454

5555
/**
@@ -61,7 +61,7 @@ public function allUnconfirmed(): ?array
6161
*/
6262
public function showUnconfirmed(string $id): ?array
6363
{
64-
return $this->get("transactions/unconfirmed/{$id}");
64+
return $this->withApi('transactions')->get("transactions/unconfirmed/{$id}");
6565
}
6666

6767
/**
@@ -93,4 +93,14 @@ public function schemas(): ?array
9393
{
9494
return $this->get('transactions/schemas');
9595
}
96+
97+
/**
98+
* Get the pool configuration.
99+
*
100+
* @return array
101+
*/
102+
public function configuration(): ?array
103+
{
104+
return $this->withApi('transactions')->get('configuration');
105+
}
96106
}

tests/API/TransactionsTest.php

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,27 @@ public function show_calls_correct_url()
4343
/** @test */
4444
public function all_unconfirmed_calls_correct_url()
4545
{
46-
$this->assertResponse('GET', 'transactions/unconfirmed', function ($client) {
47-
return $client->transactions()->allUnconfirmed();
48-
});
46+
$this->assertResponse(
47+
method: 'GET',
48+
path: 'transactions/unconfirmed',
49+
callback: function ($client) {
50+
return $client->transactions()->allUnconfirmed();
51+
},
52+
expectedApi: 'transactions'
53+
);
4954
}
5055

5156
/** @test */
5257
public function show_unconfirmed_calls_correct_url()
5358
{
54-
$this->assertResponse('GET', 'transactions/unconfirmed/dummy', function ($client) {
55-
return $client->transactions()->showUnconfirmed('dummy');
56-
});
59+
$this->assertResponse(
60+
method: 'GET',
61+
path: 'transactions/unconfirmed/dummy',
62+
callback: function ($client) {
63+
return $client->transactions()->showUnconfirmed('dummy');
64+
},
65+
expectedApi: 'transactions'
66+
);
5767
}
5868

5969
/** @test */
@@ -79,4 +89,17 @@ public function schemas_calls_correct_url()
7989
return $client->transactions()->schemas();
8090
});
8191
}
92+
93+
/** @test */
94+
public function configuration_calls_correct_url()
95+
{
96+
$this->assertResponse(
97+
method: 'GET',
98+
path: 'configuration',
99+
callback: function ($client) {
100+
return $client->transactions()->configuration();
101+
},
102+
expectedApi: 'transactions'
103+
);
104+
}
82105
}

0 commit comments

Comments
 (0)