Skip to content

Commit 78d7f30

Browse files
authored
Added getSignatories for QueryAPI (#27)
Signed-off-by: Mingela <[email protected]>
1 parent e92eeb8 commit 78d7f30

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

client/src/main/java/jp/co/soramitsu/iroha/java/QueryAPI.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import iroha.protocol.QryResponses.BlockResponse;
77
import iroha.protocol.QryResponses.ErrorResponse;
88
import iroha.protocol.QryResponses.QueryResponse;
9+
import iroha.protocol.QryResponses.SignatoriesResponse;
910
import iroha.protocol.QryResponses.TransactionsPageResponse;
1011
import iroha.protocol.QryResponses.TransactionsResponse;
1112
import java.security.KeyPair;
@@ -168,4 +169,16 @@ public AccountAssetResponse getAccountAssets(String accountId) {
168169

169170
return res.getAccountAssetsResponse();
170171
}
172+
173+
public SignatoriesResponse getSignatories(String accountId) {
174+
val q = Query.builder(this.accountId, counter.getAndIncrement())
175+
.getSignatories(accountId)
176+
.buildSigned(keyPair);
177+
178+
val res = api.query(q);
179+
180+
checkErrorResponse(res);
181+
182+
return res.getSignatoriesResponse();
183+
}
171184
}

client/src/test/groovy/jp/co/soramitsu/iroha/java/IntegrationTest.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,5 +234,14 @@ class IntegrationTest extends Specification {
234234
accountAsset.assetId == "${asset}#${defaultDomain}"
235235
accountAsset.accountId == defaultAccountId
236236
accountAsset.balance == "4"
237+
238+
when: "get account signatories query is executed"
239+
queryResponse = qapi.getSignatories(defaultAccountId)
240+
241+
then: "response is valid containing single signatory"
242+
queryResponse.keysCount == 1
243+
def accountKey = queryResponse.keysList.get(0)
244+
245+
accountKey == Utils.toHex(defaultKeypair.public.encoded).toLowerCase()
237246
}
238247
}

0 commit comments

Comments
 (0)