feat: balance change

This commit is contained in:
hashbro
2026-08-29 23:16:57 +08:00
parent e9192d5720
commit 3e87a44de3
19 changed files with 808 additions and 36 deletions
@@ -148,13 +148,13 @@ class TokenviewMonitorService
});
}
$inbound = [];
$changes = [];
foreach ($deltas as $col => $delta) {
if ($delta > 0) {
$inbound[$col] = $delta;
if ($delta != 0.0) {
$changes[$col] = $delta;
}
}
if ($inbound === []) {
if ($changes === []) {
return;
}
@@ -162,14 +162,15 @@ class TokenviewMonitorService
$primary->refresh();
$balanceSummary = $primary->coinsSummary();
$deviceKey = Device::query()->whereKey($primary->device_id)->value('device_id') ?: (string) $primary->device_id;
foreach ($inbound as $col => $delta) {
foreach ($changes as $col => $delta) {
$this->telegram->notifyBalanceChange(
(string) $deviceKey,
$lookup,
strtoupper($col),
WalletAddress::formatAmount($col, $delta),
WalletAddress::formatAmount($col, abs($delta)),
$coin,
$balanceSummary
$balanceSummary,
$delta > 0,
);
}
}