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>
46 lines
997 B
PHP
46 lines
997 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Mod\Trade\Controllers;
|
|
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Routing\Controller;
|
|
use Mod\Chain\Services\DaemonRpc;
|
|
|
|
/**
|
|
* DEX trade controller.
|
|
*
|
|
* GET /trade — DEX overview with trading pairs
|
|
* GET /trade/swap — token swap interface
|
|
* GET /trade/p2p — P2P marketplace
|
|
* GET /trade/orders — user order history
|
|
*/
|
|
class TradeController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly DaemonRpc $rpc,
|
|
) {}
|
|
|
|
public function index(): \Illuminate\View\View
|
|
{
|
|
return view('trade::index', [
|
|
'info' => $this->rpc->getInfo(),
|
|
]);
|
|
}
|
|
|
|
public function swap(): \Illuminate\View\View
|
|
{
|
|
return view('trade::swap');
|
|
}
|
|
|
|
public function p2p(): \Illuminate\View\View
|
|
{
|
|
return view('trade::p2p');
|
|
}
|
|
|
|
public function orders(): \Illuminate\View\View
|
|
{
|
|
return view('trade::orders');
|
|
}
|
|
}
|