Skip to content

Commit

Permalink
fix multiple payments serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
deemru committed Dec 9, 2020
1 parent 7a96423 commit 214e000
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/WavesKit.php
Original file line number Diff line number Diff line change
Expand Up @@ -2187,13 +2187,12 @@ public function txBody( $tx )
$body .= chr( 0 );
}
$body .= pack( 'n', count( $tx['payment'] ) );
$payments = '';
foreach( $tx['payment'] as $rec )
{
$payments .= pack( 'J', $rec['amount'] );
$payments .= isset( $rec['assetId'] ) ? ( chr( 1 ) . $this->base58Decode( $rec['assetId'] ) ) : chr( 0 );
$payment = pack( 'J', $rec['amount'] );
$payment .= isset( $rec['assetId'] ) ? ( chr( 1 ) . $this->base58Decode( $rec['assetId'] ) ) : chr( 0 );
$body .= pack( 'n', strlen( $payment ) ) . $payment;
}
$body .= strlen( $payments ) ? ( pack( 'n', strlen( $payments ) ) . $payments ) : '';
$body .= pack( 'J', $tx['fee'] );
$body .= isset( $tx['feeAssetId'] ) ? chr( 1 ) . $this->base58Decode( $tx['feeAssetId'] ) : chr( 0 );
$body .= pack( 'J', $tx['timestamp'] );
Expand Down

0 comments on commit 214e000

Please sign in to comment.