<?php

use App\Application\Services\Treasury\TreasuryCollectionService;
use App\Models\Asset;
use Illuminate\Contracts\Console\Kernel;

require __DIR__.'/../../vendor/autoload.php';

$app = require __DIR__.'/../../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();

$environment = $argv[1] ?? config('gateway.environment');
$assetCode = $argv[2] ?? 'USDTTRC20';
$asset = Asset::where('code', strtoupper($assetCode))->firstOrFail();

$result = app(TreasuryCollectionService::class)->collectAsset($asset, $environment, 25);
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES).PHP_EOL;
