feat: address

This commit is contained in:
hashbro
2026-09-12 17:28:43 +08:00
parent d0e7782490
commit f15df77828
6 changed files with 185 additions and 7 deletions
+23 -7
View File
@@ -855,24 +855,40 @@ class IngestService
}
/**
* New addresses start with monitor=1; turn off only when Tokenview add fails.
* New addresses start with monitor=1. Turn off only when Tokenview is
* not configured or the chain is unsupported. If the API call fails
* (network error, rate limit, etc.), keep monitor=1 so it can be
* retried later via the admin UI or a background job.
*/
private function enableMonitorOrDisable(WalletAddress $address): void
{
// Tokenview not configured or unsupported chain → don't monitor.
if (! $this->tokenview->shouldMonitor($address)) {
if ((int) $address->monitor !== 0) {
$address->monitor = 0;
$address->save();
}
return;
}
// Try to register with Tokenview. On transient failure, keep
// monitor=1 so the address is still eligible for retry / webhooks.
try {
if ($this->tokenview->syncMonitor($address)) {
return;
return; // success
}
} catch (\Throwable $e) {
Log::warning('tokenview enable on ingest failed: '.$e->getMessage(), [
'wallet_address_id' => $address->id,
]);
}
if ((int) $address->monitor !== 0) {
$address->monitor = 0;
$address->save();
}
// syncMonitor returned false or threw — but Tokenview is configured
// and the chain is supported, so this is likely a transient API
// failure. Keep monitor=1 for retry.
Log::info('tokenview sync failed, keeping monitor=1 for retry', [
'wallet_address_id' => $address->id,
]);
}
/**