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>
33 lines
862 B
PHP
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);
|
|
}
|
|
}
|