Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/API/Blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ public function show(string $id): array
return $this->get("blocks/{$id}");
}

/**
* Get the first block.
*
* @return array
*/
public function first(): array
{
return $this->get('blocks/first');
}

/**
* Get the last block.
*
* @return array
*/
public function last(): array
{
return $this->get('blocks/last');
}

/**
* Get all transactions by the given block.
*
Expand Down
16 changes: 16 additions & 0 deletions tests/API/BlocksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ public function show_calls_correct_url()
});
}

/** @test */
public function first_calls_correct_url()
{
$this->assertResponse('GET', 'blocks/first', function ($connection) {
return $connection->blocks()->first();
});
}

/** @test */
public function last_calls_correct_url()
{
$this->assertResponse('GET', 'blocks/last', function ($connection) {
return $connection->blocks()->last();
});
}

/** @test */
public function transactions_calls_correct_url()
{
Expand Down