lthn.io/app/Mod/Chain/Boot.php
Claude 9286f84020
feat: chain:start and chain:status artisan commands
CorePHP manages the testnet chain binaries via ConsoleBooting lifecycle.
chain:start checks if daemon/wallet are running, starts them if not,
waits for RPC readiness. chain:status shows daemon height, aliases,
PoS status, wallet and LNS node state. Config-driven paths for
binary locations, data dirs, mining address.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 10:39:24 +01:00

33 lines
862 B
PHP

<?php
declare(strict_types=1);
namespace Mod\Chain;
use Core\Events\ConsoleBooting;
use Core\Events\FrameworkBooted;
use Mod\Chain\Services\DaemonRpc;
use Mod\Chain\Services\WalletRpc;
class Boot
{
public static array $listens = [
FrameworkBooted::class => 'onFrameworkBooted',
ConsoleBooting::class => 'onConsole',
];
public function onFrameworkBooted(FrameworkBooted $event): void
{
app('config')->set('chain', require __DIR__ . '/config.php');
app()->singleton(DaemonRpc::class);
app()->singleton(WalletRpc::class);
app('router')->aliasMiddleware('auth.api', \App\Http\Middleware\ApiTokenAuth::class);
}
public function onConsole(ConsoleBooting $event): void
{
$event->command(Commands\ChainStart::class);
$event->command(Commands\ChainStatus::class);
}
}