47 lines
997 B
PHP
47 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');
|
||
|
|
}
|
||
|
|
}
|