-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<feat>(transaction,contract): add transaction manager extension field…
…, adapt v2 transaction, add contract wrapper. (#899)
- Loading branch information
Showing
10 changed files
with
311 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
src/main/java/org/fisco/bcos/sdk/v3/contract/ContractWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package org.fisco.bcos.sdk.v3.contract; | ||
|
||
import java.math.BigDecimal; | ||
import java.math.BigInteger; | ||
import org.fisco.bcos.sdk.v3.codec.datatypes.Function; | ||
import org.fisco.bcos.sdk.v3.model.TransactionReceipt; | ||
import org.fisco.bcos.sdk.v3.model.callback.TransactionCallback; | ||
|
||
public class ContractWrapper { | ||
private final Contract contract; | ||
private Function function; | ||
private String nonce; | ||
private BigInteger blockLimit; | ||
private BigDecimal value; | ||
private byte[] extension; | ||
|
||
public ContractWrapper(Contract contract) { | ||
this.contract = contract; | ||
} | ||
|
||
public ContractWrapper(Contract contract, Function function) { | ||
this.contract = contract; | ||
this.function = function; | ||
} | ||
|
||
public Function getFunction() { | ||
return function; | ||
} | ||
|
||
public ContractWrapper setFunction(Function function) { | ||
this.function = function; | ||
return this; | ||
} | ||
|
||
public String getNonce() { | ||
return nonce; | ||
} | ||
|
||
public ContractWrapper setNonce(String nonce) { | ||
this.nonce = nonce; | ||
return this; | ||
} | ||
|
||
public BigInteger getBlockLimit() { | ||
return blockLimit; | ||
} | ||
|
||
public ContractWrapper setBlockLimit(BigInteger blockLimit) { | ||
this.blockLimit = blockLimit; | ||
return this; | ||
} | ||
|
||
public BigDecimal getValue() { | ||
return value; | ||
} | ||
|
||
public ContractWrapper setValue(BigDecimal value) { | ||
this.value = value; | ||
return this; | ||
} | ||
|
||
public byte[] getExtension() { | ||
return extension; | ||
} | ||
|
||
public ContractWrapper setExtension(byte[] extension) { | ||
this.extension = extension; | ||
return this; | ||
} | ||
|
||
public TransactionReceipt send() { | ||
return contract.executeTransaction(this); | ||
} | ||
|
||
public String asyncSend(TransactionCallback callback) { | ||
return contract.asyncExecuteTransaction(this, callback); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.