20
20
import java .util .HashMap ;
21
21
import java .util .List ;
22
22
import java .util .Map ;
23
- import java .util .Objects ;
24
23
import java .util .Optional ;
25
24
import java .util .regex .Matcher ;
26
25
import java .util .regex .Pattern ;
49
48
import org .tron .common .crypto .Hash ;
50
49
import org .tron .common .utils .ByteArray ;
51
50
import org .tron .common .utils .ByteUtil ;
52
- import org .tron .common .utils .Utils ;
53
-
54
51
import org .tron .core .Wallet ;
55
52
import org .tron .keystore .WalletFile ;
56
53
import org .tron .protos .Contract ;
61
58
import org .tron .protos .Protocol ;
62
59
import org .tron .protos .Protocol .Account ;
63
60
import org .tron .protos .Protocol .Block ;
64
- //import org.tron.protos.Protocol.DeferredTransaction;
65
61
import org .tron .protos .Protocol .DelegatedResourceAccountIndex ;
66
62
import org .tron .protos .Protocol .Exchange ;
67
63
import org .tron .protos .Protocol .Key ;
74
70
import stest .tron .wallet .common .client .Parameter .CommonConstant ;
75
71
import stest .tron .wallet .common .client .WalletClient ;
76
72
73
+ //import org.tron.protos.Protocol.DeferredTransaction;
74
+
77
75
78
76
public class PublicMethed {
79
77
@@ -3061,13 +3059,10 @@ public static String triggerContract(byte[] contractAddress, String method, Stri
3061
3059
/**
3062
3060
* constructor.
3063
3061
*/
3064
-
3065
- public static String triggerParamListContract (byte [] contractAddress , String method ,
3066
- List <Object > params ,
3062
+ public static String triggerContract (byte [] contractAddress , String method , String argsStr ,
3067
3063
Boolean isHex , long callValue , long feeLimit , String tokenId , long tokenValue ,
3068
3064
byte [] ownerAddress ,
3069
3065
String priKey , WalletGrpc .WalletBlockingStub blockingStubFull ) {
3070
-
3071
3066
Wallet .setAddressPreFixByte (CommonConstant .ADD_PRE_FIX_BYTE_MAINNET );
3072
3067
ECKey temKey = null ;
3073
3068
try {
@@ -3077,9 +3072,13 @@ public static String triggerParamListContract(byte[] contractAddress, String met
3077
3072
ex .printStackTrace ();
3078
3073
}
3079
3074
final ECKey ecKey = temKey ;
3075
+ if (argsStr .equalsIgnoreCase ("#" )) {
3076
+ logger .info ("argsstr is #" );
3077
+ argsStr = "" ;
3078
+ }
3080
3079
3081
3080
byte [] owner = ownerAddress ;
3082
- byte [] input = Hex .decode (AbiUtil .parseMethod (method , params ));
3081
+ byte [] input = Hex .decode (AbiUtil .parseMethod (method , argsStr , isHex ));
3083
3082
3084
3083
Contract .TriggerSmartContract .Builder builder = Contract .TriggerSmartContract .newBuilder ();
3085
3084
builder .setOwnerAddress (ByteString .copyFrom (owner ));
@@ -3152,18 +3151,18 @@ public static String triggerParamListContract(byte[] contractAddress, String met
3152
3151
} else {
3153
3152
return ByteArray .toHexString (Sha256Hash .hash (transaction .getRawData ().toByteArray ()));
3154
3153
}
3155
-
3156
-
3157
3154
}
3158
3155
3159
3156
/**
3160
3157
* constructor.
3161
3158
*/
3162
3159
3163
- public static String triggerContract (byte [] contractAddress , String method , String argsStr ,
3160
+ public static String triggerParamListContract (byte [] contractAddress , String method ,
3161
+ List <Object > params ,
3164
3162
Boolean isHex , long callValue , long feeLimit , String tokenId , long tokenValue ,
3165
3163
byte [] ownerAddress ,
3166
3164
String priKey , WalletGrpc .WalletBlockingStub blockingStubFull ) {
3165
+
3167
3166
Wallet .setAddressPreFixByte (CommonConstant .ADD_PRE_FIX_BYTE_MAINNET );
3168
3167
ECKey temKey = null ;
3169
3168
try {
@@ -3173,13 +3172,9 @@ public static String triggerContract(byte[] contractAddress, String method, Stri
3173
3172
ex .printStackTrace ();
3174
3173
}
3175
3174
final ECKey ecKey = temKey ;
3176
- if (argsStr .equalsIgnoreCase ("#" )) {
3177
- logger .info ("argsstr is #" );
3178
- argsStr = "" ;
3179
- }
3180
3175
3181
3176
byte [] owner = ownerAddress ;
3182
- byte [] input = Hex .decode (AbiUtil .parseMethod (method , argsStr , isHex ));
3177
+ byte [] input = Hex .decode (AbiUtil .parseMethod (method , params ));
3183
3178
3184
3179
Contract .TriggerSmartContract .Builder builder = Contract .TriggerSmartContract .newBuilder ();
3185
3180
builder .setOwnerAddress (ByteString .copyFrom (owner ));
@@ -3252,6 +3247,8 @@ public static String triggerContract(byte[] contractAddress, String method, Stri
3252
3247
} else {
3253
3248
return ByteArray .toHexString (Sha256Hash .hash (transaction .getRawData ().toByteArray ()));
3254
3249
}
3250
+
3251
+
3255
3252
}
3256
3253
3257
3254
/**
@@ -4488,6 +4485,9 @@ public static HashMap<String, String> getBycodeAbiForLibrary(String solFile,
4488
4485
return retMap ;
4489
4486
}
4490
4487
4488
+ /**
4489
+ * constructor.
4490
+ */
4491
4491
public static String triggerConstantContract (byte [] contractAddress , String method ,
4492
4492
String argsStr ,
4493
4493
Boolean isHex , long callValue , long feeLimit , String tokenId , long tokenValue ,
@@ -4584,7 +4584,10 @@ public static String triggerConstantContract(byte[] contractAddress, String meth
4584
4584
}
4585
4585
}
4586
4586
4587
- public static String clearContractABI (byte [] contractAddress ,
4587
+ /**
4588
+ * constructor.
4589
+ */
4590
+ public static String clearContractAbi (byte [] contractAddress ,
4588
4591
byte [] ownerAddress ,
4589
4592
String priKey , WalletGrpc .WalletBlockingStub blockingStubFull ) {
4590
4593
Wallet .setAddressPreFixByte (CommonConstant .ADD_PRE_FIX_BYTE_MAINNET );
@@ -4604,10 +4607,10 @@ public static String clearContractABI(byte[] contractAddress,
4604
4607
builder .setOwnerAddress (ByteString .copyFrom (owner ));
4605
4608
builder .setContractAddress (ByteString .copyFrom (contractAddress ));
4606
4609
4607
- Contract .ClearABIContract clearABIContract = builder .build ();
4610
+ Contract .ClearABIContract clearAbiContract = builder .build ();
4608
4611
4609
4612
TransactionExtention transactionExtention = blockingStubFull
4610
- .clearContractABI (clearABIContract );
4613
+ .clearContractABI (clearAbiContract );
4611
4614
if (transactionExtention == null || !transactionExtention .getResult ().getResult ()) {
4612
4615
System .out .println ("RPC create call trx failed!" );
4613
4616
System .out .println ("Code = " + transactionExtention .getResult ().getCode ());
@@ -4670,8 +4673,10 @@ public static String clearContractABI(byte[] contractAddress,
4670
4673
}
4671
4674
}
4672
4675
4673
-
4674
- public static TransactionExtention clearContractABIForExtention (byte [] contractAddress ,
4676
+ /**
4677
+ * constructor.
4678
+ */
4679
+ public static TransactionExtention clearContractAbiForExtention (byte [] contractAddress ,
4675
4680
byte [] ownerAddress ,
4676
4681
String priKey , WalletGrpc .WalletBlockingStub blockingStubFull ) {
4677
4682
Wallet .setAddressPreFixByte (CommonConstant .ADD_PRE_FIX_BYTE_MAINNET );
@@ -4691,15 +4696,17 @@ public static TransactionExtention clearContractABIForExtention(byte[] contractA
4691
4696
builder .setOwnerAddress (ByteString .copyFrom (owner ));
4692
4697
builder .setContractAddress (ByteString .copyFrom (contractAddress ));
4693
4698
4694
- Contract .ClearABIContract clearABIContract = builder .build ();
4699
+ Contract .ClearABIContract clearAbiContract = builder .build ();
4695
4700
4696
4701
TransactionExtention transactionExtention = blockingStubFull
4697
- .clearContractABI (clearABIContract );
4702
+ .clearContractABI (clearAbiContract );
4698
4703
return transactionExtention ;
4699
4704
4700
4705
}
4701
4706
4702
-
4707
+ /**
4708
+ * constructor.
4709
+ */
4703
4710
public static TransactionExtention triggerConstantContractForExtention (byte [] contractAddress ,
4704
4711
String method ,
4705
4712
String argsStr ,
@@ -4778,6 +4785,9 @@ public static TransactionExtention triggerContractForExtention(byte[] contractAd
4778
4785
4779
4786
}
4780
4787
4788
+ /**
4789
+ * constructor.
4790
+ */
4781
4791
public static String create2 (String [] parameters ) {
4782
4792
if (parameters == null || parameters .length != 3 ) {
4783
4793
logger .error ("create2 needs 3 parameter:\n create2 address code salt" );
0 commit comments