Skip to content

Commit

Permalink
Added getSignatories for QueryAPI (#27)
Browse files Browse the repository at this point in the history
Signed-off-by: Mingela <[email protected]>
  • Loading branch information
Mingela authored May 20, 2019
1 parent e92eeb8 commit 78d7f30
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
13 changes: 13 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 @@ -6,6 +6,7 @@
import iroha.protocol.QryResponses.BlockResponse;
import iroha.protocol.QryResponses.ErrorResponse;
import iroha.protocol.QryResponses.QueryResponse;
import iroha.protocol.QryResponses.SignatoriesResponse;
import iroha.protocol.QryResponses.TransactionsPageResponse;
import iroha.protocol.QryResponses.TransactionsResponse;
import java.security.KeyPair;
Expand Down Expand Up @@ -168,4 +169,16 @@ public AccountAssetResponse getAccountAssets(String accountId) {

return res.getAccountAssetsResponse();
}

public SignatoriesResponse getSignatories(String accountId) {
val q = Query.builder(this.accountId, counter.getAndIncrement())
.getSignatories(accountId)
.buildSigned(keyPair);

val res = api.query(q);

checkErrorResponse(res);

return res.getSignatoriesResponse();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,14 @@ class IntegrationTest extends Specification {
accountAsset.assetId == "${asset}#${defaultDomain}"
accountAsset.accountId == defaultAccountId
accountAsset.balance == "4"

when: "get account signatories query is executed"
queryResponse = qapi.getSignatories(defaultAccountId)

then: "response is valid containing single signatory"
queryResponse.keysCount == 1
def accountKey = queryResponse.keysList.get(0)

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

0 comments on commit 78d7f30

Please sign in to comment.