@@ -0,0 +1,3600 @@
+package nxt.http.rpc;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport nxt.MofoQueries;%0Aimport nxt.MofoQueries.TransactionFilter;%0Aimport nxt.Nxt;%0Aimport nxt.Transaction;%0Aimport nxt.db.DbIterator;%0Aimport nxt.http.ParameterException;%0Aimport nxt.http.websocket.JSONData;%0Aimport nxt.http.websocket.RPCCall;%0A%0Aimport org.json.simple.JSONArray;%0Aimport org.json.simple.JSONObject;%0Aimport org.json.simple.JSONStreamAware;%0A%0Apublic final class GetRecentTransactions extends RPCCall %7B%0A%0A  public static RPCCall instance = new GetRecentTransactions(%22getRecentTransactions%22);%0A  static int COUNT = 15;%0A%0A  public GetRecentTransactions(String identifier) %7B%0A      super(identifier);%0A  %7D%0A%0A  @SuppressWarnings(%7B %22unchecked%22 %7D)%0A  @Override%0A  public JSONStreamAware call(JSONObject arguments) throws ParameterException %7B%0A      %0A        List%3CLong%3E accountIds = ParameterParser.getAccountIds(arguments);%0A        int timestamp = ParameterParser.getTimestamp(arguments);        %0A        List%3CTransactionFilter%3E filters = ParameterParser.getTransactionFilter(arguments);%0A        List%3CTransaction%3E unconfirmed_transactions = new ArrayList%3CTransaction%3E();%0A        List%3CTransaction%3E confirmed_transactions = new ArrayList%3CTransaction%3E();%0A        %0A        JSONArray transactions = new JSONArray();%0A        JSONObject response = new JSONObject();        %0A        %0A        try %7B%0A       %0A            /* Unconfirmed transactions are always included */%0A           %0A            try (%0A                DbIterator%3C? extends Transaction%3E iterator_unconfirmed = Nxt.getTransactionProcessor().getAllUnconfirmedTransactions();%0A                DbIterator%3C? extends Transaction%3E iterator = MofoQueries.getRecentTransactions(accountIds, timestamp, filters, COUNT);%0A            ) %7B%0A                try %7B%0A                    System.out.println(%22Start getAllUnconfirmedTransactions%22);%0A                    while (iterator_unconfirmed != null && iterator_unconfirmed.hasNext()) %7B%0A                        Transaction transaction = iterator_unconfirmed.next();%0A                        for (Long id : accountIds) %7B%0A                            if (id.equals(Long.valueOf(transaction.getSenderId())) %7C%7C id.equals(Long.valueOf(transaction.getRecipientId()))) %7B%0A                                unconfirmed_transactions.add(transaction);%0A                                break;%0A                            %7D%0A                        %7D%0A                    %7D%0A                %7D%0A                catch (Exception e) %7B%0A                    System.out.println(e);%0A                %7D                %0A                finally %7B                   %0A                    System.out.println(%22Start getRecentTransactions%22);%0A                    while (iterator != null && iterator.hasNext()) %7B%0A                      confirmed_transactions.add(iterator.next());%0A                    %7D%0A                %7D%0A            %7D%0A            %0A            System.out.println(%22unconfirmed_transactions = %22 + unconfirmed_transactions.size());%0A            System.out.println(%22confirmed_transactions = %22 + confirmed_transactions.size());%0A            %0A            for (Transaction transaction : unconfirmed_transactions) %7B%0A                transactions.add(JSONData.transaction(transaction, true));%0A            %7D%0A            for (Transaction transaction : confirmed_transactions) %7B%0A                transactions.add(JSONData.transaction(transaction, false));%0A            %7D%0A        %7D%0A        catch (Exception e) %7B%0A            System.out.println(e);%0A        %7D%0A        finally %7B        %0A            response.put(%22transactions%22, transactions);%0A        %7D%0A        return response;        %0A    %7D  %0A%0A%7D%0A

Add websocket API GetRecentTransactions