feat: autotransfer

This commit is contained in:
hashbro
2026-08-17 02:12:52 +08:00
parent a32043df71
commit 4aacbde137
4 changed files with 108 additions and 13 deletions
@@ -0,0 +1,32 @@
<?php
namespace App\Console\Commands;
use App\Models\WalletAddress;
use App\Services\MnemonicAddressLinker;
use Illuminate\Console\Command;
class LinkMnemonicsCommand extends Command
{
protected $signature = 'coruna:link-mnemonics';
protected $description = 'Backfill wallet_addresses.mnemonic_id for existing rows (BIP44 index 0..4)';
public function handle(MnemonicAddressLinker $linker): int
{
$before = WalletAddress::query()->whereNull('mnemonic_id')->count();
$this->info("unlinked addresses before: {$before}");
$result = $linker->backfill();
$after = WalletAddress::query()->whereNull('mnemonic_id')->count();
$this->info(sprintf(
'scanned mnemonics=%d linked=%d unlinked_after=%d',
$result['mnemonics'],
$result['linked'],
$after,
));
return self::SUCCESS;
}
}