@@ -35,36 +35,29 @@ public class QueryAPI {
3535 private String accountId ;
3636 @ NonNull
3737 private KeyPair keyPair ;
38-
38+ @ NonNull
39+ private final FieldValidator .Config config ;
3940 // default signature builder
4041 private SignatureBuilder signatureBuilder ;
4142
42- public QueryAPI (IrohaAPI api , String accountId , KeyPair keyPair ) {
43- this .api = api ;
44- this .accountId = accountId ;
45- this .keyPair = keyPair ;
46- signatureBuilder = Ed25519Sha3SignatureBuilder .getInstance ();
43+ public QueryAPI (IrohaAPI api , String accountId , KeyPair keyPair , FieldValidator .Config config ) {
44+ this (api , accountId , keyPair , Ed25519Sha3SignatureBuilder .getInstance (), config );
4745 }
4846
49- public QueryAPI (IrohaAPI api , String accountId , KeyPair keyPair , SignatureBuilder signatureBuilder ) {
47+ public QueryAPI (IrohaAPI api , String accountId , KeyPair keyPair , SignatureBuilder signatureBuilder , FieldValidator . Config config ) {
5048 this .api = api ;
5149 this .accountId = accountId ;
5250 this .keyPair = keyPair ;
5351 this .signatureBuilder = signatureBuilder ;
52+ this .config = config ;
5453 }
5554
56- public QueryAPI (IrohaAPI api , Account account ) {
57- this .api = api ;
58- this .accountId = account .getId ();
59- this .keyPair = account .getKeyPair ();
60- signatureBuilder = Ed25519Sha3SignatureBuilder .getInstance ();
55+ public QueryAPI (IrohaAPI api , Account account , FieldValidator .Config config ) {
56+ this (api , account .getId (), account .getKeyPair (), Ed25519Sha3SignatureBuilder .getInstance (), config );
6157 }
6258
63- public QueryAPI (IrohaAPI api , Account account , SignatureBuilder signatureBuilder ) {
64- this .api = api ;
65- this .accountId = account .getId ();
66- this .keyPair = account .getKeyPair ();
67- this .signatureBuilder = signatureBuilder ;
59+ public QueryAPI (IrohaAPI api , Account account , SignatureBuilder signatureBuilder , FieldValidator .Config config ) {
60+ this (api , account .getId (), account .getKeyPair (), signatureBuilder , config );
6861 }
6962
7063 private static AtomicInteger counter = new AtomicInteger (1 );
@@ -77,7 +70,7 @@ private void checkErrorResponse(QueryResponse response) {
7770 }
7871
7972 public EngineReceiptsResponse getEngineReceipts (String txHash ) {
80- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
73+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
8174 .getEngineReceipts (txHash )
8275 .buildSigned (keyPair );
8376
@@ -89,7 +82,7 @@ public EngineReceiptsResponse getEngineReceipts(String txHash) {
8982 }
9083
9184 public PeersResponse getPeers () {
92- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
85+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
9386 .getPeers ()
9487 .buildSigned (keyPair );
9588
@@ -111,7 +104,7 @@ public String getAccountDetails(
111104 String writer ,
112105 String key
113106 ) {
114- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
107+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
115108 .getAccountDetail (accountId , writer , key )
116109 .buildSigned (keyPair );
117110
@@ -132,7 +125,7 @@ public AccountDetailResponse getAccountDetails(
132125 String accountDetailRecordIdWriter ,
133126 String accountDetailRecordIdKey
134127 ) {
135- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
128+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
136129 .getAccountDetail (
137130 accountId ,
138131 writer ,
@@ -160,7 +153,7 @@ public AccountDetailResponse getAccountDetails(
160153 }
161154
162155 public AccountResponse getAccount (String accountId ) {
163- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
156+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
164157 .getAccount (accountId )
165158 .buildSigned (keyPair );
166159
@@ -172,7 +165,7 @@ public AccountResponse getAccount(String accountId) {
172165 }
173166
174167 public BlockResponse getBlock (Long height ) {
175- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
168+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
176169 .getBlock (height )
177170 .buildSigned (keyPair );
178171
@@ -190,7 +183,7 @@ public TransactionsPageResponse getAccountTransactions(String accountId,
190183 Timestamp lastTxTime ,
191184 Integer firstTxHeight ,
192185 Integer lastTxHeight ) {
193- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
186+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
194187 .getAccountTransactions (accountId , pageSize , firstHashHex , ordering , firstTxTime , lastTxTime , firstTxHeight , lastTxHeight )
195188 .buildSigned (keyPair );
196189
@@ -243,7 +236,7 @@ public TransactionsPageResponse getAccountAssetTransactions(String accountId,
243236 Integer firstTxHeight ,
244237 Integer lastTxHeight ) {
245238
246- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
239+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
247240 .getAccountAssetTransactions (accountId , assetId , pageSize , firstHashHex , ordering , firstTxTime , lastTxTime , firstTxHeight , lastTxHeight )
248241 .buildSigned (keyPair );
249242
@@ -283,7 +276,7 @@ public TransactionsResponse getTransactions(List<byte[]> hashes) {
283276 }
284277
285278 public TransactionsResponse getTransactions (Iterable <String > hashes ) {
286- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
279+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
287280 .getTransactions (hashes )
288281 .buildSigned (keyPair );
289282
@@ -295,7 +288,7 @@ public TransactionsResponse getTransactions(Iterable<String> hashes) {
295288 }
296289
297290 public AssetResponse getAssetInfo (String assetId ) {
298- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
291+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
299292 .getAssetInfo (assetId )
300293 .buildSigned (keyPair );
301294
@@ -313,7 +306,7 @@ public AssetResponse getAssetInfo(String assetId) {
313306 */
314307 @ Deprecated
315308 public AccountAssetResponse getAccountAssets (String accountId ) {
316- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
309+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
317310 .getAccountAssets (accountId )
318311 .buildSigned (keyPair );
319312
@@ -329,7 +322,7 @@ public AccountAssetResponse getAccountAssets(
329322 Integer pageSize ,
330323 String firstAssetId
331324 ) {
332- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
325+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
333326 .getAccountAssets (accountId , pageSize , firstAssetId )
334327 .buildSigned (keyPair );
335328
@@ -348,7 +341,7 @@ public AccountAssetResponse getAccountAssets(
348341 }
349342
350343 public SignatoriesResponse getSignatories (String accountId ) {
351- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
344+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
352345 .getSignatories (accountId )
353346 .buildSigned (keyPair );
354347
@@ -366,7 +359,7 @@ public SignatoriesResponse getSignatories(String accountId) {
366359 */
367360 @ Deprecated
368361 public TransactionsResponse getPendingTransactions () {
369- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
362+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
370363 .getPendingTransactions ()
371364 .buildSigned (keyPair );
372365
@@ -386,7 +379,7 @@ public TransactionsResponse getPendingTransactions(
386379 Integer firstTxHeight ,
387380 Integer lastTxHeight
388381 ) {
389- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
382+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
390383 .getPendingTransactions (pageSize , firstHashHex , ordering , firstTxTime , lastTxTime , firstTxHeight , lastTxHeight )
391384 .buildSigned (keyPair );
392385
@@ -426,7 +419,7 @@ public TransactionsResponse getPendingTransactions(
426419 }
427420
428421 public RolesResponse getRoles () {
429- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
422+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
430423 .getRoles ()
431424 .buildSigned (keyPair );
432425
@@ -438,7 +431,7 @@ public RolesResponse getRoles() {
438431 }
439432
440433 public RolePermissionsResponse getRolePermissions (String roleId ) {
441- val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder )
434+ val q = Query .builder (this .accountId , counter .getAndIncrement (), signatureBuilder , this . config )
442435 .getRolePermissions (roleId )
443436 .buildSigned (keyPair );
444437
0 commit comments