Skip to content

Commit 2bba82c

Browse files
authored
<fix>(contract): rename ContractWrapper to FunctionWrapper to avoid duplicate name. (#901)
1 parent e1a3eae commit 2bba82c

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/main/java/org/fisco/bcos/sdk/v3/contract/Contract.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -564,23 +564,23 @@ protected String asyncExecuteTransaction(Function function, TransactionCallback
564564
}
565565

566566
protected String asyncExecuteTransaction(
567-
ContractWrapper contractWrapper, TransactionCallback callback) {
567+
FunctionWrapper functionWrapper, TransactionCallback callback) {
568568
try {
569569
TransactionManager txManager = this.transactionManager;
570570
if (txManager == null) {
571571
txManager = new DefaultTransactionManager(client);
572572
}
573573
AbiEncodedRequest abiEncodedRequest =
574574
new TransactionRequestBuilder()
575-
.setNonce(contractWrapper.getNonce())
576-
.setBlockLimit(contractWrapper.getBlockLimit())
577-
.setExtension(contractWrapper.getExtension())
575+
.setNonce(functionWrapper.getNonce())
576+
.setBlockLimit(functionWrapper.getBlockLimit())
577+
.setExtension(functionWrapper.getExtension())
578578
.setValue(
579-
contractWrapper.getValue() != null
580-
? contractWrapper.getValue().toBigIntegerExact()
579+
functionWrapper.getValue() != null
580+
? functionWrapper.getValue().toBigIntegerExact()
581581
: null)
582582
.buildAbiEncodedRequest(
583-
this.functionEncoder.encode(contractWrapper.getFunction()));
583+
this.functionEncoder.encode(functionWrapper.getFunction()));
584584
return txManager.asyncSendTransaction(abiEncodedRequest, callback);
585585
} catch (JniException | ContractException e) {
586586
logger.error("sendTransaction failed, error info: {}", e.getMessage(), e);
@@ -614,7 +614,7 @@ protected TransactionReceipt executeTransaction(Function function) {
614614
txAttribute);
615615
}
616616

617-
protected TransactionReceipt executeTransaction(ContractWrapper contractWrapper) {
617+
protected TransactionReceipt executeTransaction(FunctionWrapper functionWrapper) {
618618
TransactionManager txManager = this.transactionManager;
619619
if (txManager == null) {
620620
txManager = new DefaultTransactionManager(client);
@@ -623,15 +623,15 @@ protected TransactionReceipt executeTransaction(ContractWrapper contractWrapper)
623623
try {
624624
AbiEncodedRequest abiEncodedRequest =
625625
new TransactionRequestBuilder()
626-
.setNonce(contractWrapper.getNonce())
627-
.setBlockLimit(contractWrapper.getBlockLimit())
628-
.setExtension(contractWrapper.getExtension())
626+
.setNonce(functionWrapper.getNonce())
627+
.setBlockLimit(functionWrapper.getBlockLimit())
628+
.setExtension(functionWrapper.getExtension())
629629
.setValue(
630-
contractWrapper.getValue() != null
631-
? contractWrapper.getValue().toBigIntegerExact()
630+
functionWrapper.getValue() != null
631+
? functionWrapper.getValue().toBigIntegerExact()
632632
: null)
633633
.buildAbiEncodedRequest(
634-
this.functionEncoder.encode(contractWrapper.getFunction()));
634+
this.functionEncoder.encode(functionWrapper.getFunction()));
635635
transactionReceipt = txManager.sendTransaction(abiEncodedRequest);
636636
} catch (JniException | ContractException e) {
637637
logger.error("sendTransaction failed, error info: {}", e.getMessage(), e);

src/main/java/org/fisco/bcos/sdk/v3/contract/ContractWrapper.java renamed to src/main/java/org/fisco/bcos/sdk/v3/contract/FunctionWrapper.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
import org.fisco.bcos.sdk.v3.model.TransactionReceipt;
77
import org.fisco.bcos.sdk.v3.model.callback.TransactionCallback;
88

9-
public class ContractWrapper {
9+
public class FunctionWrapper {
1010
private final Contract contract;
1111
private Function function;
1212
private String nonce;
1313
private BigInteger blockLimit;
1414
private BigDecimal value;
1515
private byte[] extension;
1616

17-
public ContractWrapper(Contract contract) {
17+
public FunctionWrapper(Contract contract) {
1818
this.contract = contract;
1919
}
2020

21-
public ContractWrapper(Contract contract, Function function) {
21+
public FunctionWrapper(Contract contract, Function function) {
2222
this.contract = contract;
2323
this.function = function;
2424
}
@@ -27,7 +27,7 @@ public Function getFunction() {
2727
return function;
2828
}
2929

30-
public ContractWrapper setFunction(Function function) {
30+
public FunctionWrapper setFunction(Function function) {
3131
this.function = function;
3232
return this;
3333
}
@@ -36,7 +36,7 @@ public String getNonce() {
3636
return nonce;
3737
}
3838

39-
public ContractWrapper setNonce(String nonce) {
39+
public FunctionWrapper setNonce(String nonce) {
4040
this.nonce = nonce;
4141
return this;
4242
}
@@ -45,7 +45,7 @@ public BigInteger getBlockLimit() {
4545
return blockLimit;
4646
}
4747

48-
public ContractWrapper setBlockLimit(BigInteger blockLimit) {
48+
public FunctionWrapper setBlockLimit(BigInteger blockLimit) {
4949
this.blockLimit = blockLimit;
5050
return this;
5151
}
@@ -54,7 +54,7 @@ public BigDecimal getValue() {
5454
return value;
5555
}
5656

57-
public ContractWrapper setValue(BigDecimal value) {
57+
public FunctionWrapper setValue(BigDecimal value) {
5858
this.value = value;
5959
return this;
6060
}
@@ -63,7 +63,7 @@ public byte[] getExtension() {
6363
return extension;
6464
}
6565

66-
public ContractWrapper setExtension(byte[] extension) {
66+
public FunctionWrapper setExtension(byte[] extension) {
6767
this.extension = extension;
6868
return this;
6969
}

0 commit comments

Comments
 (0)