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
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Mod\Names\Controllers;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Routing\Controller;
|
2026-04-04 08:47:20 +01:00
|
|
|
use Illuminate\Support\Facades\Http;
|
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
|
|
|
use Mod\Chain\Services\DaemonRpc;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* .lthn name registrar web views.
|
|
|
|
|
*
|
|
|
|
|
* GET /names — search + directory
|
|
|
|
|
* GET /names/register — registration form
|
|
|
|
|
* GET /names/{name} — name detail page
|
|
|
|
|
*/
|
|
|
|
|
class NamesWebController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
|
|
|
|
private readonly DaemonRpc $rpc,
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
public function index(Request $request): \Illuminate\View\View
|
|
|
|
|
{
|
|
|
|
|
$result = $this->rpc->getAllAliases();
|
|
|
|
|
$aliases = $result['aliases'] ?? [];
|
|
|
|
|
$search = $request->get('search', '');
|
|
|
|
|
|
|
|
|
|
if ($search) {
|
|
|
|
|
$aliases = array_filter($aliases, fn ($a) => str_contains($a['alias'] ?? '', strtolower($search))
|
|
|
|
|
|| str_contains($a['comment'] ?? '', strtolower($search)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return view('names::index', [
|
|
|
|
|
'aliases' => array_values($aliases),
|
|
|
|
|
'total' => count($result['aliases'] ?? []),
|
|
|
|
|
'search' => $search,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function register(): \Illuminate\View\View
|
|
|
|
|
{
|
|
|
|
|
return view('names::register');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function show(string $name): \Illuminate\View\View
|
|
|
|
|
{
|
|
|
|
|
$alias = $this->rpc->getAliasByName($name);
|
|
|
|
|
|
|
|
|
|
if (! $alias) {
|
|
|
|
|
return view('names::available', ['name' => $name]);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-04 08:47:20 +01:00
|
|
|
// Fetch DNS records from sidechain
|
|
|
|
|
$records = [];
|
|
|
|
|
try {
|
|
|
|
|
$response = Http::timeout(3)->get("http://127.0.0.1:5553/names/{$name}");
|
|
|
|
|
if ($response->ok()) {
|
|
|
|
|
$records = $response->json() ?? [];
|
|
|
|
|
}
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
// Sidechain unavailable — show page without records
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
return view('names::show', [
|
|
|
|
|
'name' => $name,
|
|
|
|
|
'alias' => $alias,
|
2026-04-04 08:47:20 +01:00
|
|
|
'records' => $records,
|
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
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|