Skip to content

Commit

Permalink
Added get pending tx in query api (#31)
Browse files Browse the repository at this point in the history
Signed-off-by: Mingela <[email protected]>
  • Loading branch information
Mingela authored and Warchant committed May 30, 2019
1 parent 88c6e04 commit 8a16104
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions client/src/main/java/jp/co/soramitsu/iroha/java/QueryAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,16 @@ public SignatoriesResponse getSignatories(String accountId) {

return res.getSignatoriesResponse();
}

public TransactionsResponse getPendingTransactions() {
val q = Query.builder(this.accountId, counter.getAndIncrement())
.getPendingTransactions()
.buildSigned(keyPair);

val res = api.query(q);

checkErrorResponse(res);

return res.getTransactionsResponse();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,5 +243,18 @@ class IntegrationTest extends Specification {
def accountKey = queryResponse.keysList.get(0)

accountKey == Utils.toHex(defaultKeypair.public.encoded).toLowerCase()

def pendingTx = Transaction.builder(defaultAccountId, Instant.now())
.createAccount(anotherAccount, defaultDomain, defaultKeypair.getPublic())
.setQuorum(2)
.sign(defaultKeypair)
.build()
api.transactionSync(pendingTx)

when: "get pending transaxtions query is executed"
queryResponse = qapi.getPendingTransactions()

then: "response is valid containing single transaction"
queryResponse.transactionsCount == 1
}
}

0 comments on commit 8a16104

Please sign in to comment.