public abstract class Contract extends ManagedTransaction
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
contractAddress |
protected java.lang.String |
contractBinary |
protected java.util.Map<java.lang.String,java.lang.String> |
deployedAddresses |
static java.math.BigInteger |
GAS_LIMIT |
protected java.math.BigInteger |
gasLimit |
protected java.math.BigInteger |
gasPrice |
protected TransactionReceipt |
transactionReceipt |
ensResolver, GAS_PRICE, transactionManager, web3j| Modifier | Constructor and Description |
|---|---|
protected |
Contract(java.lang.String contractBinary,
java.lang.String contractAddress,
Web3j web3j,
org.web3j.crypto.Credentials credentials,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit) |
protected |
Contract(java.lang.String contractBinary,
java.lang.String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit) |
protected |
Contract(java.lang.String contractAddress,
Web3j web3j,
org.web3j.crypto.Credentials credentials,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit)
Deprecated.
|
protected |
Contract(java.lang.String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
protected static <T extends Contract> |
deploy(java.lang.Class<T> type,
Web3j web3j,
org.web3j.crypto.Credentials credentials,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit,
java.lang.String binary,
java.lang.String encodedConstructor,
java.math.BigInteger value) |
protected static <T extends Contract> |
deploy(java.lang.Class<T> type,
Web3j web3j,
TransactionManager transactionManager,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit,
java.lang.String binary,
java.lang.String encodedConstructor,
java.math.BigInteger value) |
protected static <T extends Contract> |
deployRemoteCall(java.lang.Class<T> type,
Web3j web3j,
org.web3j.crypto.Credentials credentials,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit,
java.lang.String binary,
java.lang.String encodedConstructor) |
protected static <T extends Contract> |
deployRemoteCall(java.lang.Class<T> type,
Web3j web3j,
org.web3j.crypto.Credentials credentials,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit,
java.lang.String binary,
java.lang.String encodedConstructor,
java.math.BigInteger value) |
protected static <T extends Contract> |
deployRemoteCall(java.lang.Class<T> type,
Web3j web3j,
TransactionManager transactionManager,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit,
java.lang.String binary,
java.lang.String encodedConstructor) |
protected static <T extends Contract> |
deployRemoteCall(java.lang.Class<T> type,
Web3j web3j,
TransactionManager transactionManager,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit,
java.lang.String binary,
java.lang.String encodedConstructor,
java.math.BigInteger value) |
protected java.util.List<org.web3j.abi.datatypes.Type> |
executeCallMultipleValueReturn(org.web3j.abi.datatypes.Function function) |
protected <T extends org.web3j.abi.datatypes.Type> |
executeCallSingleValueReturn(org.web3j.abi.datatypes.Function function) |
protected <T extends org.web3j.abi.datatypes.Type,R> |
executeCallSingleValueReturn(org.web3j.abi.datatypes.Function function,
java.lang.Class<R> returnType) |
protected RemoteCall<java.util.List<org.web3j.abi.datatypes.Type>> |
executeRemoteCallMultipleValueReturn(org.web3j.abi.datatypes.Function function) |
protected <T extends org.web3j.abi.datatypes.Type> |
executeRemoteCallSingleValueReturn(org.web3j.abi.datatypes.Function function) |
protected <T> RemoteCall<T> |
executeRemoteCallSingleValueReturn(org.web3j.abi.datatypes.Function function,
java.lang.Class<T> returnType) |
protected RemoteCall<TransactionReceipt> |
executeRemoteCallTransaction(org.web3j.abi.datatypes.Function function) |
protected RemoteCall<TransactionReceipt> |
executeRemoteCallTransaction(org.web3j.abi.datatypes.Function function,
java.math.BigInteger weiValue) |
protected TransactionReceipt |
executeTransaction(org.web3j.abi.datatypes.Function function) |
protected org.web3j.abi.EventValues |
extractEventParameters(org.web3j.abi.datatypes.Event event,
Log log) |
protected java.util.List<org.web3j.abi.EventValues> |
extractEventParameters(org.web3j.abi.datatypes.Event event,
TransactionReceipt transactionReceipt) |
java.lang.String |
getContractAddress() |
java.lang.String |
getContractBinary() |
java.lang.String |
getDeployedAddress(java.lang.String networkId) |
protected java.lang.String |
getStaticDeployedAddress(java.lang.String networkId)
Subclasses should implement this method to return pre-existing addresses for deployed
contracts.
|
java.util.Optional<TransactionReceipt> |
getTransactionReceipt()
If this Contract instance was created at deployment, the TransactionReceipt associated
with the initial creation will be provided, e.g.
|
boolean |
isValid()
Check that the contract deployed at the address associated with this smart contract wrapper
is in fact the contract you believe it is.
|
void |
setContractAddress(java.lang.String contractAddress) |
void |
setDeployedAddress(java.lang.String networkId,
java.lang.String address) |
void |
setTransactionReceipt(TransactionReceipt transactionReceipt) |
static org.web3j.abi.EventValues |
staticExtractEventParameters(org.web3j.abi.datatypes.Event event,
Log log) |
getGasPrice, getSyncThreshold, send, setSyncThresholdpublic static final java.math.BigInteger GAS_LIMIT
protected final java.lang.String contractBinary
protected java.lang.String contractAddress
protected java.math.BigInteger gasPrice
protected java.math.BigInteger gasLimit
protected TransactionReceipt transactionReceipt
protected java.util.Map<java.lang.String,java.lang.String> deployedAddresses
protected Contract(java.lang.String contractBinary,
java.lang.String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit)
protected Contract(java.lang.String contractBinary,
java.lang.String contractAddress,
Web3j web3j,
org.web3j.crypto.Credentials credentials,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit)
@Deprecated
protected Contract(java.lang.String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit)
@Deprecated
protected Contract(java.lang.String contractAddress,
Web3j web3j,
org.web3j.crypto.Credentials credentials,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit)
public void setContractAddress(java.lang.String contractAddress)
public java.lang.String getContractAddress()
public void setTransactionReceipt(TransactionReceipt transactionReceipt)
public java.lang.String getContractBinary()
public boolean isValid()
throws java.io.IOException
This method uses the eth_getCode method to get the contract byte code and validates it against the byte code stored in this smart contract wrapper.
java.io.IOException - if unable to connect to web3j nodepublic java.util.Optional<TransactionReceipt> getTransactionReceipt()
protected <T extends org.web3j.abi.datatypes.Type> T executeCallSingleValueReturn(org.web3j.abi.datatypes.Function function)
throws java.io.IOException
java.io.IOExceptionprotected <T extends org.web3j.abi.datatypes.Type,R> R executeCallSingleValueReturn(org.web3j.abi.datatypes.Function function,
java.lang.Class<R> returnType)
throws java.io.IOException
java.io.IOExceptionprotected java.util.List<org.web3j.abi.datatypes.Type> executeCallMultipleValueReturn(org.web3j.abi.datatypes.Function function)
throws java.io.IOException
java.io.IOExceptionprotected TransactionReceipt executeTransaction(org.web3j.abi.datatypes.Function function) throws java.io.IOException, TransactionException
java.io.IOExceptionTransactionExceptionprotected <T extends org.web3j.abi.datatypes.Type> RemoteCall<T> executeRemoteCallSingleValueReturn(org.web3j.abi.datatypes.Function function)
protected <T> RemoteCall<T> executeRemoteCallSingleValueReturn(org.web3j.abi.datatypes.Function function, java.lang.Class<T> returnType)
protected RemoteCall<java.util.List<org.web3j.abi.datatypes.Type>> executeRemoteCallMultipleValueReturn(org.web3j.abi.datatypes.Function function)
protected RemoteCall<TransactionReceipt> executeRemoteCallTransaction(org.web3j.abi.datatypes.Function function)
protected RemoteCall<TransactionReceipt> executeRemoteCallTransaction(org.web3j.abi.datatypes.Function function, java.math.BigInteger weiValue)
protected static <T extends Contract> T deploy(java.lang.Class<T> type, Web3j web3j, org.web3j.crypto.Credentials credentials, java.math.BigInteger gasPrice, java.math.BigInteger gasLimit, java.lang.String binary, java.lang.String encodedConstructor, java.math.BigInteger value) throws java.io.IOException, TransactionException
java.io.IOExceptionTransactionExceptionprotected static <T extends Contract> T deploy(java.lang.Class<T> type, Web3j web3j, TransactionManager transactionManager, java.math.BigInteger gasPrice, java.math.BigInteger gasLimit, java.lang.String binary, java.lang.String encodedConstructor, java.math.BigInteger value) throws java.io.IOException, TransactionException
java.io.IOExceptionTransactionExceptionprotected static <T extends Contract> RemoteCall<T> deployRemoteCall(java.lang.Class<T> type, Web3j web3j, org.web3j.crypto.Credentials credentials, java.math.BigInteger gasPrice, java.math.BigInteger gasLimit, java.lang.String binary, java.lang.String encodedConstructor, java.math.BigInteger value)
protected static <T extends Contract> RemoteCall<T> deployRemoteCall(java.lang.Class<T> type, Web3j web3j, org.web3j.crypto.Credentials credentials, java.math.BigInteger gasPrice, java.math.BigInteger gasLimit, java.lang.String binary, java.lang.String encodedConstructor)
protected static <T extends Contract> RemoteCall<T> deployRemoteCall(java.lang.Class<T> type, Web3j web3j, TransactionManager transactionManager, java.math.BigInteger gasPrice, java.math.BigInteger gasLimit, java.lang.String binary, java.lang.String encodedConstructor, java.math.BigInteger value)
protected static <T extends Contract> RemoteCall<T> deployRemoteCall(java.lang.Class<T> type, Web3j web3j, TransactionManager transactionManager, java.math.BigInteger gasPrice, java.math.BigInteger gasLimit, java.lang.String binary, java.lang.String encodedConstructor)
public static org.web3j.abi.EventValues staticExtractEventParameters(org.web3j.abi.datatypes.Event event,
Log log)
protected org.web3j.abi.EventValues extractEventParameters(org.web3j.abi.datatypes.Event event,
Log log)
protected java.util.List<org.web3j.abi.EventValues> extractEventParameters(org.web3j.abi.datatypes.Event event,
TransactionReceipt transactionReceipt)
protected java.lang.String getStaticDeployedAddress(java.lang.String networkId)
networkId - the network id, for example "1" for the main-net, "3" for ropsten, etc.public final void setDeployedAddress(java.lang.String networkId,
java.lang.String address)
public final java.lang.String getDeployedAddress(java.lang.String networkId)