Skip to content

Commit d869a89

Browse files
committed
It has been determined that the "json" flag/option in the RPCAdapter's Chain's getTableRows is redundant (because it needs to always be true), so I've recycled it to instead reference the undocumented "reverse" feature, which causes rows to be returned in reverse order
1 parent da1672e commit d869a89

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/main/java/io/topiacoin/eosrpcadapter/Chain.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ TableRows getTableRows(String contract,
4040
String scope,
4141
String table,
4242
long limit,
43-
boolean json) throws ChainException;
43+
boolean reverse) throws ChainException;
4444

4545
TableRows getTableRows(String contract,
4646
String scope,
4747
String table,
4848
String lowerBound,
4949
String upperBound,
5050
long limit,
51-
boolean json) throws ChainException;
51+
boolean reverse) throws ChainException;
5252

5353
TableRows getTableRows(String contract,
5454
String scope,
@@ -58,7 +58,7 @@ TableRows getTableRows(String contract,
5858
String lowerBound,
5959
String upperBound,
6060
long limit,
61-
boolean json) throws ChainException;
61+
boolean reverse) throws ChainException;
6262

6363
TransactionBinArgs abiJsonToBin(String code,
6464
String action,

src/main/java/io/topiacoin/eosrpcadapter/RPCChain.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ public TableRows getTableRows(String contract,
292292
String scope,
293293
String table,
294294
long limit,
295-
boolean json) throws ChainException {
296-
return getTableRows(contract, scope, table, 1, null, "0", "-1", limit, json);
295+
boolean reverse) throws ChainException {
296+
return getTableRows(contract, scope, table, 1, null, "0", "-1", limit, reverse);
297297
}
298298

299299
@Override
@@ -303,8 +303,8 @@ public TableRows getTableRows(String contract,
303303
String lowerBound,
304304
String upperBound,
305305
long limit,
306-
boolean json) throws ChainException {
307-
return getTableRows(contract, scope, table, 1, null, lowerBound, upperBound, limit, json);
306+
boolean reverse) throws ChainException {
307+
return getTableRows(contract, scope, table, 1, null, lowerBound, upperBound, limit, reverse);
308308
}
309309

310310
@Override
@@ -316,7 +316,7 @@ public TableRows getTableRows(String contract,
316316
String lowerBound,
317317
String upperBound,
318318
long limit,
319-
boolean json) throws ChainException {
319+
boolean reverse) throws ChainException {
320320
TableRows getTableRowsResponse = null;
321321

322322
try {
@@ -338,7 +338,8 @@ public TableRows getTableRows(String contract,
338338
}
339339
requestMap.put("lower_bound", lowerBound);
340340
requestMap.put("upper_bound", upperBound);
341-
requestMap.put("json", json);
341+
requestMap.put("json", true);
342+
requestMap.put("reverse", reverse);
342343

343344
String requestString = _objectMapper.writeValueAsString(requestMap);
344345

src/test/java/io/topiacoin/eosrpcadapter/AbstractChainTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void testChainGetCode() throws Exception {
7272
public void testChainGetTableRows() throws Exception {
7373
Chain chain = getChain();
7474

75-
TableRows response = chain.getTableRows("inita", "inita", "containers", -1, true);
75+
TableRows response = chain.getTableRows("inita", "inita", "containers", -1, false);
7676

7777
assertNotNull(response);
7878
}

0 commit comments

Comments
 (0)