feat: address

This commit is contained in:
hashbro
2026-09-12 18:14:03 +08:00
parent f15df77828
commit 0996d4e563
14 changed files with 350 additions and 30 deletions
+31 -3
View File
@@ -24,7 +24,15 @@ class TokenviewClient
private function mutateAddress(string $action, string $coinAbbr, string $address): bool
{
$log = Log::channel('tokenview');
if (! $this->enabled()) {
$log->warning('mutate skipped: api_key not configured', [
'action' => $action,
'coin' => $coinAbbr,
'address' => $address,
]);
return false;
}
@@ -38,16 +46,36 @@ class TokenviewClient
rawurlencode($addr)
);
$log->info('tokenview request', [
'action' => $action,
'coin' => $coin,
'address' => $addr,
'endpoint' => $endpoint,
]);
try {
$resp = Http::timeout(20)->get($endpoint, [
'apikey' => (string) config('coruna.tokenview.api_key'),
]);
$ok = $resp->successful() && (int) $resp->json('code') === 1;
return $resp->successful() && (int) $resp->json('code') === 1;
} catch (\Throwable $e) {
Log::warning("tokenview address {$action} failed: ".$e->getMessage(), [
$log->info('tokenview response', [
'action' => $action,
'coin' => $coin,
'address' => $addr,
'http_status' => $resp->status(),
'body' => $resp->body(),
'ok' => $ok,
]);
return $ok;
} catch (\Throwable $e) {
$log->warning('tokenview request failed', [
'action' => $action,
'coin' => $coin,
'address' => $addr,
'endpoint' => $endpoint,
'error' => $e->getMessage(),
]);
return false;