Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added get pending tx in query api #31

Merged
merged 1 commit into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}