From 61d6a8174a96d39bd1b6cf196a355bb74c14d38a Mon Sep 17 00:00:00 2001 From: gituser Date: Thu, 25 Apr 2019 01:55:02 +0300 Subject: [PATCH] Ability to sort transaction history for Stellar Account add optional $order parameter to Account::getTransactions() parameter $order can be either 'asc' or 'desc', default is 'asc' (default horizon param value). --- src/Model/Account.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Model/Account.php b/src/Model/Account.php index 1b4ab4f..81fe57d 100755 --- a/src/Model/Account.php +++ b/src/Model/Account.php @@ -163,7 +163,7 @@ public function sendPayment(Payment $payment, $signingKeys) * @param int $limit * @return Transaction[] */ - public function getTransactions($sinceCursor = null, $limit = 50) + public function getTransactions($sinceCursor = null, $limit = 50, $order = 'asc') { $transactions = []; @@ -172,6 +172,7 @@ public function getTransactions($sinceCursor = null, $limit = 50) if ($sinceCursor) $params['cursor'] = $sinceCursor; if ($limit) $params['limit'] = $limit; + if ($order) $params['order'] = $order; if ($params) { $url .= '?' . http_build_query($params); @@ -420,4 +421,4 @@ public function getData() { return $this->data; } -} \ No newline at end of file +}