Update APIs returning futures

This commit is contained in:
Nex
2018-09-12 10:00:00 +08:00
parent 1eac2150b1
commit 5a76d9114b
3 changed files with 201 additions and 20 deletions

View File

@@ -12,28 +12,28 @@ public class Test {
final int index = 0;
TransactionLedgerClient tlClient = new TransactionLedgerClient("localhost", 8004);
System.out.println(tlClient.createLedger(ledger).getOk());
GetLedgersResponse r = tlClient.getLedgers();
System.out.println(tlClient.createLedgerSync(ledger).getOk());
GetLedgersResponse r = tlClient.getLedgersSync();
for (int i = 0; i < r.getLedgersCount(); i++) {
System.out.println(r.getLedgers(i));
}
System.out.println(
tlClient
.sendTransaction(ledger, TransactionType.RECORD, "0x0", "0x1", "data".getBytes())
.sendTransactionSync(ledger, TransactionType.RECORD, "0x0", "0x1", "data".getBytes())
.getHash());
tlClient.shutdown();
AccountingChainClient acClient = new AccountingChainClient("localhost", 8013);
System.out.println(acClient.blockNumber(ledger).getBlockNumber());
System.out.println(acClient.getBlockByNumber(ledger, block_number, false).toString());
System.out.println(acClient.getBlockByNumber(ledger, block_number, true).toString());
System.out.println(acClient.getBlockByHash(ledger, block_hash, false).toString());
System.out.println(acClient.getBlockByHash(ledger, block_hash, true).toString());
System.out.println(acClient.getTransactionByHash(ledger, "0x0").toString());
System.out.println(acClient.blockNumberSync(ledger).getBlockNumber());
System.out.println(acClient.getBlockByNumberSync(ledger, block_number, false).toString());
System.out.println(acClient.getBlockByNumberSync(ledger, block_number, true).toString());
System.out.println(acClient.getBlockByHashSync(ledger, block_hash, false).toString());
System.out.println(acClient.getBlockByHashSync(ledger, block_hash, true).toString());
System.out.println(acClient.getTransactionByHashSync(ledger, "0x0").toString());
System.out.println(
acClient.getTransactionByBlockNumberAndIndex(ledger, block_number, index).toString());
acClient.getTransactionByBlockNumberAndIndexSync(ledger, block_number, index).toString());
System.out.println(
acClient.getTransactionByBlockHashAndIndex(ledger, block_hash, index).toString());
acClient.getTransactionByBlockHashAndIndexSync(ledger, block_hash, index).toString());
acClient.shutdown();
}
}