public abstract class Contract extends ManagedTransaction
Modifier and Type | Class and Description |
---|---|
static class |
Contract.EventValuesWithLog
Adds a log field to
EventValues . |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BIN_NOT_PROVIDED |
protected java.lang.String |
contractAddress |
protected java.lang.String |
contractBinary |
protected DefaultBlockParameter |
defaultBlockParameter |
protected java.util.Map<java.lang.String,java.lang.String> |
deployedAddresses |
static java.lang.String |
FUNC_DEPLOY |
static java.math.BigInteger |
GAS_LIMIT
Deprecated.
...
|
protected ContractGasProvider |
gasProvider |
protected TransactionReceipt |
transactionReceipt |
ensResolver, GAS_PRICE, transactionManager, web3j
Modifier | Constructor and Description |
---|---|
protected |
Contract(EnsResolver ensResolver,
java.lang.String contractBinary,
java.lang.String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider gasProvider) |
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 contractBinary,
java.lang.String contractAddress,
Web3j web3j,
org.web3j.crypto.Credentials credentials,
ContractGasProvider gasProvider) |
protected |
Contract(java.lang.String contractBinary,
java.lang.String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
java.math.BigInteger gasPrice,
java.math.BigInteger gasLimit)
Deprecated.
|
protected |
Contract(java.lang.String contractBinary,
java.lang.String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider gasProvider) |
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 <S extends org.web3j.abi.datatypes.Type,T> |
convertToNative(java.util.List<S> arr) |
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)
Deprecated.
|
protected static <T extends Contract> |
deploy(java.lang.Class<T> type,
Web3j web3j,
org.web3j.crypto.Credentials credentials,
ContractGasProvider contractGasProvider,
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)
Deprecated.
|
protected static <T extends Contract> |
deploy(java.lang.Class<T> type,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider contractGasProvider,
java.lang.String binary,
java.lang.String encodedConstructor,
java.math.BigInteger value) |
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) |
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) |
static <T extends Contract> |
deployRemoteCall(java.lang.Class<T> type,
Web3j web3j,
org.web3j.crypto.Credentials credentials,
ContractGasProvider contractGasProvider,
java.lang.String binary,
java.lang.String encodedConstructor) |
static <T extends Contract> |
deployRemoteCall(java.lang.Class<T> type,
Web3j web3j,
org.web3j.crypto.Credentials credentials,
ContractGasProvider contractGasProvider,
java.lang.String binary,
java.lang.String encodedConstructor,
java.math.BigInteger value) |
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) |
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) |
static <T extends Contract> |
deployRemoteCall(java.lang.Class<T> type,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider contractGasProvider,
java.lang.String binary,
java.lang.String encodedConstructor) |
static <T extends Contract> |
deployRemoteCall(java.lang.Class<T> type,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider contractGasProvider,
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 java.lang.String |
executeCallWithoutDecoding(org.web3j.abi.datatypes.Function function) |
protected RemoteFunctionCall<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> RemoteFunctionCall<T> |
executeRemoteCallSingleValueReturn(org.web3j.abi.datatypes.Function function,
java.lang.Class<T> returnType) |
protected RemoteFunctionCall<TransactionReceipt> |
executeRemoteCallTransaction(org.web3j.abi.datatypes.Function function) |
protected RemoteFunctionCall<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) |
protected Contract.EventValuesWithLog |
extractEventParametersWithLog(org.web3j.abi.datatypes.Event event,
Log log) |
protected java.util.List<Contract.EventValuesWithLog> |
extractEventParametersWithLog(org.web3j.abi.datatypes.Event event,
TransactionReceipt transactionReceipt) |
java.lang.String |
getContractAddress() |
java.lang.String |
getContractBinary() |
java.lang.String |
getDeployedAddress(java.lang.String networkId) |
java.math.BigInteger |
getGasPrice()
Deprecated.
use ContractGasProvider
|
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.
|
protected java.lang.String |
resolveContractAddress(java.lang.String contractAddress) |
void |
setContractAddress(java.lang.String contractAddress) |
void |
setDefaultBlockParameter(DefaultBlockParameter defaultBlockParameter)
Sets the default block parameter.
|
void |
setDeployedAddress(java.lang.String networkId,
java.lang.String address) |
void |
setGasPrice(java.math.BigInteger newPrice)
Deprecated.
use ContractGasProvider
|
void |
setGasProvider(ContractGasProvider gasProvider) |
void |
setTransactionReceipt(TransactionReceipt transactionReceipt) |
static org.web3j.abi.EventValues |
staticExtractEventParameters(org.web3j.abi.datatypes.Event event,
Log log) |
protected static Contract.EventValuesWithLog |
staticExtractEventParametersWithLog(org.web3j.abi.datatypes.Event event,
Log log) |
protected static java.util.List<Contract.EventValuesWithLog> |
staticExtractEventParametersWithLog(org.web3j.abi.datatypes.Event event,
TransactionReceipt transactionReceipt) |
call, getSyncThreshold, requestCurrentGasPrice, send, send, sendEIP1559, sendEIP1559, setSyncThreshold
public static final java.math.BigInteger GAS_LIMIT
DefaultGasProvider
public static final java.lang.String BIN_NOT_PROVIDED
public static final java.lang.String FUNC_DEPLOY
protected final java.lang.String contractBinary
protected java.lang.String contractAddress
protected ContractGasProvider gasProvider
protected TransactionReceipt transactionReceipt
protected java.util.Map<java.lang.String,java.lang.String> deployedAddresses
protected DefaultBlockParameter defaultBlockParameter
protected Contract(java.lang.String contractBinary, java.lang.String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider gasProvider)
protected Contract(EnsResolver ensResolver, java.lang.String contractBinary, java.lang.String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider gasProvider)
protected Contract(java.lang.String contractBinary, java.lang.String contractAddress, Web3j web3j, org.web3j.crypto.Credentials credentials, ContractGasProvider gasProvider)
@Deprecated protected Contract(java.lang.String contractBinary, java.lang.String contractAddress, Web3j web3j, TransactionManager transactionManager, java.math.BigInteger gasPrice, java.math.BigInteger gasLimit)
@Deprecated 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 void setGasProvider(ContractGasProvider gasProvider)
public void setGasPrice(java.math.BigInteger newPrice)
gasPrice
to be set.newPrice
- gas price to use for subsequent transactionspublic java.math.BigInteger getGasPrice()
gasPrice
value this contract uses when executing transactions.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()
public void setDefaultBlockParameter(DefaultBlockParameter defaultBlockParameter)
defaultBlockParameter
- the default block parameterprotected java.lang.String executeCallWithoutDecoding(org.web3j.abi.datatypes.Function function) throws java.io.IOException
java.io.IOException
protected <T extends org.web3j.abi.datatypes.Type> T executeCallSingleValueReturn(org.web3j.abi.datatypes.Function function) throws java.io.IOException
java.io.IOException
protected <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.IOException
protected java.util.List<org.web3j.abi.datatypes.Type> executeCallMultipleValueReturn(org.web3j.abi.datatypes.Function function) throws java.io.IOException
java.io.IOException
protected TransactionReceipt executeTransaction(org.web3j.abi.datatypes.Function function) throws java.io.IOException, TransactionException
java.io.IOException
TransactionException
protected <T extends org.web3j.abi.datatypes.Type> RemoteFunctionCall<T> executeRemoteCallSingleValueReturn(org.web3j.abi.datatypes.Function function)
protected <T> RemoteFunctionCall<T> executeRemoteCallSingleValueReturn(org.web3j.abi.datatypes.Function function, java.lang.Class<T> returnType)
protected RemoteFunctionCall<java.util.List<org.web3j.abi.datatypes.Type>> executeRemoteCallMultipleValueReturn(org.web3j.abi.datatypes.Function function)
protected RemoteFunctionCall<TransactionReceipt> executeRemoteCallTransaction(org.web3j.abi.datatypes.Function function)
protected RemoteFunctionCall<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, ContractGasProvider contractGasProvider, java.lang.String binary, java.lang.String encodedConstructor, java.math.BigInteger value) throws java.lang.RuntimeException, TransactionException
java.lang.RuntimeException
TransactionException
protected static <T extends Contract> T deploy(java.lang.Class<T> type, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, java.lang.String binary, java.lang.String encodedConstructor, java.math.BigInteger value) throws java.lang.RuntimeException, TransactionException
java.lang.RuntimeException
TransactionException
@Deprecated 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.lang.RuntimeException, TransactionException
java.lang.RuntimeException
TransactionException
@Deprecated protected 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.lang.RuntimeException, TransactionException
java.lang.RuntimeException
TransactionException
public 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)
public 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)
public static <T extends Contract> RemoteCall<T> deployRemoteCall(java.lang.Class<T> type, Web3j web3j, org.web3j.crypto.Credentials credentials, ContractGasProvider contractGasProvider, java.lang.String binary, java.lang.String encodedConstructor, java.math.BigInteger value)
public static <T extends Contract> RemoteCall<T> deployRemoteCall(java.lang.Class<T> type, Web3j web3j, org.web3j.crypto.Credentials credentials, ContractGasProvider contractGasProvider, java.lang.String binary, java.lang.String encodedConstructor)
public 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)
public 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 <T extends Contract> RemoteCall<T> deployRemoteCall(java.lang.Class<T> type, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, java.lang.String binary, java.lang.String encodedConstructor, java.math.BigInteger value)
public static <T extends Contract> RemoteCall<T> deployRemoteCall(java.lang.Class<T> type, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, java.lang.String binary, java.lang.String encodedConstructor)
public static org.web3j.abi.EventValues staticExtractEventParameters(org.web3j.abi.datatypes.Event event, Log log)
protected java.lang.String resolveContractAddress(java.lang.String contractAddress)
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 Contract.EventValuesWithLog extractEventParametersWithLog(org.web3j.abi.datatypes.Event event, Log log)
protected static Contract.EventValuesWithLog staticExtractEventParametersWithLog(org.web3j.abi.datatypes.Event event, Log log)
protected java.util.List<Contract.EventValuesWithLog> extractEventParametersWithLog(org.web3j.abi.datatypes.Event event, TransactionReceipt transactionReceipt)
protected static java.util.List<Contract.EventValuesWithLog> staticExtractEventParametersWithLog(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)
protected static <S extends org.web3j.abi.datatypes.Type,T> java.util.List<T> convertToNative(java.util.List<S> arr)