66import org .fisco .bcos .sdk .v3 .client .Client ;
77import org .fisco .bcos .sdk .v3 .contract .precompiled .callback .PrecompiledCallback ;
88import org .fisco .bcos .sdk .v3 .contract .precompiled .model .PrecompiledAddress ;
9- import org .fisco .bcos .sdk .v3 .contract .precompiled .model .PrecompiledVersionCheck ;
109import org .fisco .bcos .sdk .v3 .crypto .keypair .CryptoKeyPair ;
1110import org .fisco .bcos .sdk .v3 .model .EnumNodeVersion ;
1211import org .fisco .bcos .sdk .v3 .model .PrecompiledRetCode ;
@@ -43,15 +42,15 @@ public BalancePrecompiled getBalancePrecompiled() {
4342 }
4443
4544 public BigInteger getBalance (String address ) throws ContractException {
46- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
45+
4746 BigInteger balance = balancePrecompiled .getBalance (address );
4847 return balance ;
4948 }
5049
5150 public RetCode addBalance (String address , String amount , Convert .Unit unit )
5251 throws ContractException {
5352 BigDecimal weiValue = Convert .toWei (amount , unit );
54- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
53+
5554 TransactionReceipt transactionReceipt =
5655 balancePrecompiled .addBalance (address , weiValue .toBigIntegerExact ());
5756 if (transactionReceipt .isStatusOK ()) {
@@ -67,15 +66,15 @@ public void addBalanceAsync(
6766 String address , String amount , Convert .Unit unit , PrecompiledCallback callback )
6867 throws ContractException {
6968 BigDecimal weiValue = Convert .toWei (amount , unit );
70- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
69+
7170 this .balancePrecompiled .addBalance (
7271 address , weiValue .toBigIntegerExact (), createTransactionCallback (callback ));
7372 }
7473
7574 public RetCode subBalance (String address , String amount , Convert .Unit unit )
7675 throws ContractException {
7776 BigDecimal weiValue = Convert .toWei (amount , unit );
78- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
77+
7978 TransactionReceipt transactionReceipt =
8079 balancePrecompiled .subBalance (address , weiValue .toBigIntegerExact ());
8180 if (transactionReceipt .isStatusOK ()) {
@@ -91,15 +90,15 @@ public void subBalanceAsync(
9190 String address , String amount , Convert .Unit unit , PrecompiledCallback callback )
9291 throws ContractException {
9392 BigDecimal weiValue = Convert .toWei (amount , unit );
94- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
93+
9594 this .balancePrecompiled .subBalance (
9695 address , weiValue .toBigIntegerExact (), createTransactionCallback (callback ));
9796 }
9897
9998 public RetCode transfer (String from , String to , String amount , Convert .Unit unit )
10099 throws ContractException {
101100 BigDecimal weiValue = Convert .toWei (amount , unit );
102- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
101+
103102 TransactionReceipt transactionReceipt =
104103 balancePrecompiled .transfer (from , to , weiValue .toBigIntegerExact ());
105104 if (transactionReceipt .isStatusOK ()) {
@@ -115,13 +114,13 @@ public void transferAsync(
115114 String from , String to , String amount , Convert .Unit unit , PrecompiledCallback callback )
116115 throws ContractException {
117116 BigDecimal weiValue = Convert .toWei (amount , unit );
118- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
117+
119118 this .balancePrecompiled .transfer (
120119 from , to , weiValue .toBigIntegerExact (), createTransactionCallback (callback ));
121120 }
122121
123122 public RetCode registerCaller (String address ) throws ContractException {
124- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
123+
125124 TransactionReceipt receipt = balancePrecompiled .registerCaller (address );
126125 if (receipt .isStatusOK ()) {
127126 RetCode codeSuccess = PrecompiledRetCode .CODE_SUCCESS ;
@@ -134,12 +133,12 @@ public RetCode registerCaller(String address) throws ContractException {
134133
135134 public void registerCallerAsync (String address , PrecompiledCallback callback )
136135 throws ContractException {
137- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
136+
138137 this .balancePrecompiled .registerCaller (address , createTransactionCallback (callback ));
139138 }
140139
141140 public RetCode unregisterCaller (String address ) throws ContractException {
142- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
141+
143142 TransactionReceipt receipt = balancePrecompiled .unregisterCaller (address );
144143 if (receipt .isStatusOK ()) {
145144 RetCode codeSuccess = PrecompiledRetCode .CODE_SUCCESS ;
@@ -152,12 +151,12 @@ public RetCode unregisterCaller(String address) throws ContractException {
152151
153152 public void unregisterCallerAsync (String address , PrecompiledCallback callback )
154153 throws ContractException {
155- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
154+
156155 this .balancePrecompiled .unregisterCaller (address , createTransactionCallback (callback ));
157156 }
158157
159158 public List <String > listCaller () throws ContractException {
160- PrecompiledVersionCheck . BALANCE_PRECOMPILED_VERSION . checkVersion ( currentVersion );
159+
161160 List <String > result = balancePrecompiled .listCaller ();
162161 return result ;
163162 }
0 commit comments