Skip to content

Commit

Permalink
Consolidate sends by DESTINATION and TICK
Browse files Browse the repository at this point in the history
  • Loading branch information
jdogresorg committed Apr 29, 2024
1 parent 0b8483c commit bd795d3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions indexer/includes/actions/send.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit bd795d3

Please sign in to comment.