From bd795d3e3a6bba35a531e9644573662b032222c8 Mon Sep 17 00:00:00 2001 From: J-Dog Date: Sun, 28 Apr 2024 22:22:10 -0700 Subject: [PATCH] Consolidate sends by DESTINATION and TICK --- indexer/includes/actions/send.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/indexer/includes/actions/send.php b/indexer/includes/actions/send.php index 5ba304e..631b05d 100644 --- a/indexer/includes/actions/send.php +++ b/indexer/includes/actions/send.php @@ -87,6 +87,17 @@ function btnsSend($params=null, $data=null, $error=null){ $ticks[$tick] = getTokenInfo($tick, null, $data->BLOCK_INDEX, $data->TX_INDEX); } + // Consolidate sends by DESTINATION and TICK + $keys = []; + foreach($sends as $info){ + [$tick, $amount, $destination, $memo] = $info; + $key = $destination . '|' . $tick; + if(isset($keys[$key])) + $amount = bcadd($amount, strval($keys[$key][1]), $ticks[$tick]->DECIMALS); + $keys[$key] = array($tick, $amount, $destination, $memo); + } + $sends = array_values($keys); + // Get source address balances $balances = getAddressBalances($data->SOURCE, null, $data->BLOCK_INDEX, $data->TX_INDEX);