feat: clear alumb
This commit is contained in:
@@ -12,50 +12,6 @@ class TokenviewClient
|
||||
return (string) config('coruna.tokenview.api_key') !== '';
|
||||
}
|
||||
|
||||
public function setWebhookUrl(string $url): bool
|
||||
{
|
||||
if (! $this->enabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$endpoint = rtrim((string) config('coruna.tokenview.base_url'), '/').'/monitor/setwebhookurl';
|
||||
try {
|
||||
$resp = Http::timeout(20)
|
||||
->withBody($url, 'text/plain')
|
||||
->post($endpoint.'?apikey='.urlencode((string) config('coruna.tokenview.api_key')));
|
||||
|
||||
return $resp->successful() && (int) $resp->json('code') === 1;
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('tokenview setWebhookUrl failed: '.$e->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getWebhookUrl(): ?string
|
||||
{
|
||||
if (! $this->enabled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$endpoint = rtrim((string) config('coruna.tokenview.base_url'), '/').'/monitor/getwebhookurl';
|
||||
try {
|
||||
$resp = Http::timeout(20)->get($endpoint, [
|
||||
'apikey' => (string) config('coruna.tokenview.api_key'),
|
||||
]);
|
||||
if (! $resp->successful() || (int) $resp->json('code') !== 1) {
|
||||
return null;
|
||||
}
|
||||
$data = $resp->json('data');
|
||||
|
||||
return is_string($data) && $data !== '' ? $data : null;
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('tokenview getWebhookUrl failed: '.$e->getMessage());
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function addAddress(string $coinAbbr, string $address): bool
|
||||
{
|
||||
return $this->mutateAddress('add', $coinAbbr, $address);
|
||||
|
||||
Reference in New Issue
Block a user