lthn.io/app/Mod/Pool/Controllers/PoolController.php
Claude 756be80d04
feat: complete module scaffolding — all 6 modules with controllers, routes, services
Modules built:
- Home: landing page with live chain stats and service directory
- Chain: DaemonRpc singleton, config, events
- Explorer: web + API controllers (block, tx, alias, search, stats)
- Names: TLD registrar (availability, lookup, directory, registration)
- Trade: DEX controllers + API (config, pairs, orders)
- Pool: dashboard + PoolClient service (stats, blocks, payments, miner)

Infrastructure:
- composer.json: lthn/lthn.io deps (core/php + laravel 12)
- Dockerfile: FrankenPHP with Caddy
- Caddyfile: PHP server config

Co-Authored-By: Charon <charon@lethean.io>
2026-04-03 16:26:17 +01:00

56 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace Mod\Pool\Controllers;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Mod\Pool\Services\PoolClient;
/**
* Mining pool dashboard.
*
* GET /pool — pool overview
* GET /pool/blocks — blocks found
* GET /pool/payments — payout history
* GET /pool/miner — individual miner stats
*/
class PoolController extends Controller
{
public function __construct(
private readonly PoolClient $pool,
) {}
public function index(): \Illuminate\View\View
{
return view('pool::index', [
'stats' => $this->pool->getStats(),
]);
}
public function blocks(): \Illuminate\View\View
{
return view('pool::blocks', [
'blocks' => $this->pool->getBlocks(),
]);
}
public function payments(): \Illuminate\View\View
{
return view('pool::payments', [
'payments' => $this->pool->getPayments(),
]);
}
public function miner(Request $request): \Illuminate\View\View
{
$address = $request->get('address', '');
return view('pool::miner', [
'stats' => $address ? $this->pool->getMinerStats($address) : [],
'address' => $address,
]);
}
}