feat: balance change
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user