@@ -94,9 +94,18 @@ public void deployOnly(String abi, String bin, List<Object> params) throws ABICo
9494 transactionPusher .pushOnly (createSignedConstructor (abi , bin , params ));
9595 }
9696
97+ public void deployOnly (String abi , String bin , List <Object > params , CryptoKeyPair cryptoKeyPair )
98+ throws ABICodecException {
99+ transactionPusher .pushOnly (createSignedConstructor (abi , bin , params , cryptoKeyPair ));
100+ }
101+
97102 @ Override
98103 public TransactionReceipt deployAndGetReceipt (String data ) {
99- String signedData = createSignedTransaction (null , data , this .cryptoKeyPair );
104+ return deployAndGetReceipt (data , this .cryptoKeyPair );
105+ }
106+
107+ public TransactionReceipt deployAndGetReceipt (String data , CryptoKeyPair cryptoKeyPair ) {
108+ String signedData = createSignedTransaction (null , data , cryptoKeyPair );
100109 return transactionPusher .push (signedData );
101110 }
102111
@@ -119,15 +128,27 @@ public TransactionResponse deployAndGetResponse(String abi, String bin, List<Obj
119128 return deployAndGetResponse (abi , createSignedConstructor (abi , bin , params ));
120129 }
121130
131+ public TransactionResponse deployAndGetResponse (
132+ String abi , String bin , List <Object > params , CryptoKeyPair cryptoKeyPair )
133+ throws ABICodecException {
134+ return deployAndGetResponse (abi , createSignedConstructor (abi , bin , params , cryptoKeyPair ));
135+ }
136+
122137 @ Override
123138 public TransactionResponse deployAndGetResponseWithStringParams (
124139 String abi , String bin , List <String > params ) throws ABICodecException {
140+ return deployAndGetResponseWithStringParams (abi , bin , params , this .cryptoKeyPair );
141+ }
142+
143+ public TransactionResponse deployAndGetResponseWithStringParams (
144+ String abi , String bin , List <String > params , CryptoKeyPair cryptoKeyPair )
145+ throws ABICodecException {
125146 return deployAndGetResponse (
126147 abi ,
127148 createSignedTransaction (
128149 null ,
129150 abiCodec .encodeConstructorFromString (abi , bin , params ),
130- this . cryptoKeyPair ));
151+ cryptoKeyPair ));
131152 }
132153
133154 @ Override
@@ -137,12 +158,30 @@ public void deployAsync(
137158 transactionPusher .pushAsync (createSignedConstructor (abi , bin , params ), callback );
138159 }
139160
161+ public void deployAsync (
162+ String abi ,
163+ String bin ,
164+ List <Object > params ,
165+ TransactionCallback callback ,
166+ CryptoKeyPair cryptoKeyPair )
167+ throws ABICodecException {
168+ transactionPusher .pushAsync (
169+ createSignedConstructor (abi , bin , params , cryptoKeyPair ), callback );
170+ }
171+
140172 @ Override
141173 public CompletableFuture <TransactionReceipt > deployAsync (
142174 String abi , String bin , List <Object > params ) throws ABICodecException {
143175 return transactionPusher .pushAsync (createSignedConstructor (abi , bin , params ));
144176 }
145177
178+ public CompletableFuture <TransactionReceipt > deployAsync (
179+ String abi , String bin , List <Object > params , CryptoKeyPair cryptoKeyPair )
180+ throws ABICodecException {
181+ return transactionPusher .pushAsync (
182+ createSignedConstructor (abi , bin , params , cryptoKeyPair ));
183+ }
184+
146185 /**
147186 * Deploy by bin and abi files. Should init with contractLoader.
148187 *
@@ -156,21 +195,38 @@ public CompletableFuture<TransactionReceipt> deployAsync(
156195 @ Override
157196 public TransactionResponse deployByContractLoader (String contractName , List <Object > args )
158197 throws ABICodecException , TransactionBaseException {
198+ return deployByContractLoader (contractName , args , this .cryptoKeyPair );
199+ }
200+
201+ public TransactionResponse deployByContractLoader (
202+ String contractName , List <Object > args , CryptoKeyPair cryptoKeyPair )
203+ throws ABICodecException , TransactionBaseException {
159204 return deployAndGetResponse (
160205 contractLoader .getABIByContractName (contractName ),
161206 contractLoader .getBinaryByContractName (contractName ),
162- args );
207+ args ,
208+ cryptoKeyPair );
163209 }
164210
165211 @ Override
166212 public void deployByContractLoaderAsync (
167213 String contractName , List <Object > args , TransactionCallback callback )
168214 throws ABICodecException , NoSuchTransactionFileException {
215+ deployByContractLoaderAsync (contractName , args , callback , this .cryptoKeyPair );
216+ }
217+
218+ public void deployByContractLoaderAsync (
219+ String contractName ,
220+ List <Object > args ,
221+ TransactionCallback callback ,
222+ CryptoKeyPair cryptoKeyPair )
223+ throws ABICodecException , NoSuchTransactionFileException {
169224 deployAsync (
170225 contractLoader .getABIByContractName (contractName ),
171226 contractLoader .getBinaryByContractName (contractName ),
172227 args ,
173- callback );
228+ callback ,
229+ cryptoKeyPair );
174230 }
175231
176232 @ Override
@@ -182,7 +238,18 @@ public void sendTransactionOnly(String signedData) {
182238 public TransactionResponse sendTransactionAndGetResponse (
183239 String to , String abi , String functionName , String data )
184240 throws TransactionBaseException , ABICodecException {
185- String signedData = createSignedTransaction (to , data , this .cryptoKeyPair );
241+ return sendTransactionAndGetResponse (to , abi , functionName , data , this .cryptoKeyPair );
242+ }
243+
244+ public TransactionResponse sendTransactionAndGetResponse (
245+ String to , String abi , String functionName , String data , CryptoKeyPair cryptoKeyPair )
246+ throws TransactionBaseException , ABICodecException {
247+ String signedData ;
248+ if (cryptoKeyPair == null ) {
249+ signedData = createSignedTransaction (to , data , cryptoKeyPair );
250+ } else {
251+ signedData = createSignedTransaction (to , data , this .cryptoKeyPair );
252+ }
186253 TransactionReceipt receipt = this .transactionPusher .push (signedData );
187254 try {
188255 return transactionDecoder .decodeReceiptWithValues (abi , functionName , receipt );
@@ -197,8 +264,18 @@ public TransactionResponse sendTransactionAndGetResponse(
197264 public TransactionResponse sendTransactionAndGetResponse (
198265 String to , String abi , String functionName , List <Object > params )
199266 throws ABICodecException , TransactionBaseException {
267+ return sendTransactionAndGetResponse (to , abi , functionName , params , this .cryptoKeyPair );
268+ }
269+
270+ public TransactionResponse sendTransactionAndGetResponse (
271+ String to ,
272+ String abi ,
273+ String functionName ,
274+ List <Object > params ,
275+ CryptoKeyPair cryptoKeyPair )
276+ throws ABICodecException , TransactionBaseException {
200277 String data = encodeFunction (abi , functionName , params );
201- return sendTransactionAndGetResponse (to , abi , functionName , data );
278+ return sendTransactionAndGetResponse (to , abi , functionName , data , cryptoKeyPair );
202279 }
203280
204281 @ Override
@@ -213,6 +290,17 @@ public TransactionResponse sendTransactionWithStringParamsAndGetResponse(
213290 public TransactionReceipt sendTransactionAndGetReceiptByContractLoader (
214291 String contractName , String contractAddress , String functionName , List <Object > args )
215292 throws ABICodecException , TransactionBaseException {
293+ return sendTransactionAndGetReceiptByContractLoader (
294+ contractName , contractAddress , functionName , args , this .cryptoKeyPair );
295+ }
296+
297+ public TransactionReceipt sendTransactionAndGetReceiptByContractLoader (
298+ String contractName ,
299+ String contractAddress ,
300+ String functionName ,
301+ List <Object > args ,
302+ CryptoKeyPair cryptoKeyPair )
303+ throws ABICodecException , TransactionBaseException {
216304 String data =
217305 abiCodec .encodeMethod (
218306 contractLoader .getABIByContractName (contractName ), functionName , args );
@@ -233,6 +321,21 @@ public TransactionResponse sendTransactionAndGetResponseByContractLoader(
233321 funcParams );
234322 }
235323
324+ public TransactionResponse sendTransactionAndGetResponseByContractLoader (
325+ String contractName ,
326+ String contractAddress ,
327+ String functionName ,
328+ List <Object > funcParams ,
329+ CryptoKeyPair cryptoKeyPair )
330+ throws ABICodecException , TransactionBaseException {
331+ return sendTransactionAndGetResponse (
332+ contractAddress ,
333+ contractLoader .getABIByContractName (contractName ),
334+ functionName ,
335+ funcParams ,
336+ cryptoKeyPair );
337+ }
338+
236339 @ Override
237340 public void sendTransactionAsync (String signedTransaction , TransactionCallback callback ) {
238341 transactionPusher .pushAsync (signedTransaction , callback );
@@ -246,8 +349,19 @@ public void sendTransactionAsync(
246349 List <Object > params ,
247350 TransactionCallback callback )
248351 throws TransactionBaseException , ABICodecException {
352+ sendTransactionAsync (to , abi , functionName , params , callback , this .cryptoKeyPair );
353+ }
354+
355+ public void sendTransactionAsync (
356+ String to ,
357+ String abi ,
358+ String functionName ,
359+ List <Object > params ,
360+ TransactionCallback callback ,
361+ CryptoKeyPair cryptoKeyPair )
362+ throws TransactionBaseException , ABICodecException {
249363 String data = encodeFunction (abi , functionName , params );
250- sendTransactionAsync (to , data , this . cryptoKeyPair , callback );
364+ sendTransactionAsync (to , data , cryptoKeyPair , callback );
251365 }
252366
253367 @ Override
@@ -263,10 +377,22 @@ public void sendTransactionAndGetReceiptByContractLoaderAsync(
263377 List <Object > args ,
264378 TransactionCallback callback )
265379 throws ABICodecException , TransactionBaseException {
380+ sendTransactionAndGetReceiptByContractLoaderAsync (
381+ contractName , contractAddress , functionName , args , callback , this .cryptoKeyPair );
382+ }
383+
384+ public void sendTransactionAndGetReceiptByContractLoaderAsync (
385+ String contractName ,
386+ String contractAddress ,
387+ String functionName ,
388+ List <Object > args ,
389+ TransactionCallback callback ,
390+ CryptoKeyPair cryptoKeyPair )
391+ throws ABICodecException , TransactionBaseException {
266392 String data =
267393 abiCodec .encodeMethod (
268394 contractLoader .getABIByContractName (contractName ), functionName , args );
269- sendTransactionAsync (contractAddress , data , this . cryptoKeyPair , callback );
395+ sendTransactionAsync (contractAddress , data , cryptoKeyPair , callback );
270396 }
271397
272398 @ Override
@@ -328,8 +454,18 @@ public CallResponse callAndGetResponse(
328454 @ Override
329455 public String createSignedConstructor (String abi , String bin , List <Object > params )
330456 throws ABICodecException {
457+ return createSignedConstructor (abi , bin , params , this .cryptoKeyPair );
458+ }
459+
460+ public String createSignedConstructor (
461+ String abi , String bin , List <Object > params , CryptoKeyPair cryptoKeyPair )
462+ throws ABICodecException {
463+ if (cryptoKeyPair == null ) {
464+ return createSignedTransaction (
465+ null , abiCodec .encodeConstructor (abi , bin , params ), this .cryptoKeyPair );
466+ }
331467 return createSignedTransaction (
332- null , abiCodec .encodeConstructor (abi , bin , params ), this . cryptoKeyPair );
468+ null , abiCodec .encodeConstructor (abi , bin , params ), cryptoKeyPair );
333469 }
334470
335471 @ Override
0 commit comments