feat: autotransfer
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user