类 Contract
java.lang.Object
org.fisco.bcos.sdk.contract.Contract
- 直接已知子类:
ChainGovernancePrecompiled
,CNSPrecompiled
,ConsensusPrecompiled
,ContractLifeCyclePrecompiled
,CRUD
,PermissionPrecompiled
,SystemConfigPrecompiled
,TableFactory
public class Contract
extends java.lang.Object
Contract help manage all operations including deploy, send transaction, call contract, and
subscribe event of one specific contract. It is inherited by precompiled contracts and contract
java wrappers.
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
Contract.EventValuesWithLog
Adds a log field toEventValues
. -
字段概要
字段 修饰符和类型 字段 说明 protected Client
client
protected java.lang.String
contractAddress
protected java.lang.String
contractBinary
protected CryptoKeyPair
credential
protected CryptoSuite
cryptoSuite
protected TransactionReceipt
deployReceipt
protected EventEncoder
eventEncoder
static java.lang.String
FUNC_DEPLOY
protected FunctionEncoder
functionEncoder
protected static java.lang.String
LATEST_BLOCK
protected static org.slf4j.Logger
logger
protected TransactionProcessor
transactionProcessor
-
构造器概要
构造器 限定符 构造器 说明 protected
Contract(java.lang.String contractBinary, java.lang.String contractAddress, Client client, CryptoKeyPair credential)
Constructor, auto create a TransactionProcessor objectprotected
Contract(java.lang.String contractBinary, java.lang.String contractAddress, Client client, CryptoKeyPair credential, TransactionProcessor transactionProcessor)
Constructor -
方法概要
修饰符和类型 方法 说明 protected byte[]
asyncExecuteTransaction(java.lang.String data, java.lang.String funName, TransactionCallback callback)
protected byte[]
asyncExecuteTransaction(Function function, TransactionCallback callback)
static <S extends Type, T>
java.util.List<T>convertToNative(java.util.List<S> arr)
protected java.lang.String
createSignedTransaction(java.lang.String to, java.lang.String data)
protected java.lang.String
createSignedTransaction(Function function)
protected static <T extends Contract>
Tdeploy(java.lang.Class<T> type, Client client, CryptoKeyPair credential, java.lang.String binary, java.lang.String encodedConstructor)
protected static <T extends Contract>
Tdeploy(java.lang.Class<T> type, Client client, CryptoKeyPair credential, TransactionProcessor transactionManager, java.lang.String binary, java.lang.String encodedConstructor)
Deploy contractprotected java.util.List<Type>
executeCallWithMultipleValueReturn(Function function)
protected <T extends Type>
TexecuteCallWithSingleValueReturn(Function function)
protected <T extends Type, R>
RexecuteCallWithSingleValueReturn(Function function, java.lang.Class<R> returnType)
protected TransactionReceipt
executeTransaction(java.lang.String data, java.lang.String functionName)
protected TransactionReceipt
executeTransaction(Function function)
protected java.util.List<EventValues>
extractEventParameters(Event event, TransactionReceipt transactionReceipt)
protected EventValues
extractEventParameters(Event event, TransactionReceipt.Logs log)
protected java.util.List<Contract.EventValuesWithLog>
extractEventParametersWithLog(Event event, java.util.List<TransactionReceipt.Logs> logs)
protected java.util.List<Contract.EventValuesWithLog>
extractEventParametersWithLog(Event event, TransactionReceipt transactionReceipt)
protected Contract.EventValuesWithLog
extractEventParametersWithLog(Event event, TransactionReceipt.Logs log)
java.lang.String
getContractAddress()
java.lang.String
getCurrentExternalAccountAddress()
TransactionReceipt
getDeployReceipt()
TransactionProcessor
getTransactionProcessor()
void
setContractAddress(java.lang.String contractAddress)
void
setDeployReceipt(TransactionReceipt deployReceipt)
static EventValues
staticExtractEventParameters(EventEncoder eventEncoder, Event event, TransactionReceipt.Logs log)
void
subscribeEvent(java.lang.String abi, java.lang.String bin, java.lang.String topic0, java.lang.String fromBlock, java.lang.String toBlock, java.util.List<java.lang.String> otherTopics, EventCallback callback)
void
subscribeEvent(java.lang.String abi, java.lang.String bin, java.lang.String topic0, EventCallback callback)
void
subscribeEvent(EventLogParams params, EventCallback callback)
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
字段详细资料
-
logger
protected static org.slf4j.Logger logger -
contractBinary
protected final java.lang.String contractBinary -
contractAddress
protected java.lang.String contractAddress -
deployReceipt
-
transactionProcessor
-
client
-
FUNC_DEPLOY
public static final java.lang.String FUNC_DEPLOY- 另请参阅:
- 常量字段值
-
functionEncoder
-
credential
-
cryptoSuite
-
eventEncoder
-
LATEST_BLOCK
protected static java.lang.String LATEST_BLOCK
-
-
构造器详细资料
-
Contract
protected Contract(java.lang.String contractBinary, java.lang.String contractAddress, Client client, CryptoKeyPair credential, TransactionProcessor transactionProcessor)Constructor- 参数:
contractBinary
- the contract binary code hex stringcontractAddress
- the contract addressclient
- a Client objectcredential
- key pair to use when sign transactiontransactionProcessor
- TransactionProcessor object
-
Contract
protected Contract(java.lang.String contractBinary, java.lang.String contractAddress, Client client, CryptoKeyPair credential)Constructor, auto create a TransactionProcessor object- 参数:
contractBinary
- the contract binary code hex stringcontractAddress
- the contract addressclient
- a Client object to send requestscredential
- key pair to use when sign transaction
-
-
方法详细资料
-
deploy
protected static <T extends Contract> T deploy(java.lang.Class<T> type, Client client, CryptoKeyPair credential, TransactionProcessor transactionManager, java.lang.String binary, java.lang.String encodedConstructor) throws ContractExceptionDeploy contract- 类型参数:
T
- a smart contract object extends Contract- 参数:
type
-client
- a Client object to send requestscredential
- key pair to use when sign transactiontransactionManager
- TransactionProcessorbinary
- the contract binary code hex stringencodedConstructor
-- 返回:
type smart contract - 抛出:
ContractException
-
deploy
protected static <T extends Contract> T deploy(java.lang.Class<T> type, Client client, CryptoKeyPair credential, java.lang.String binary, java.lang.String encodedConstructor) throws ContractException -
getContractAddress
public java.lang.String getContractAddress() -
setContractAddress
public void setContractAddress(java.lang.String contractAddress) -
getDeployReceipt
-
setDeployReceipt
-
executeCallWithSingleValueReturn
protected <T extends Type> T executeCallWithSingleValueReturn(Function function) throws ContractException -
executeCallWithSingleValueReturn
protected <T extends Type, R> R executeCallWithSingleValueReturn(Function function, java.lang.Class<R> returnType) throws ContractException -
executeCallWithMultipleValueReturn
protected java.util.List<Type> executeCallWithMultipleValueReturn(Function function) throws ContractException -
asyncExecuteTransaction
protected byte[] asyncExecuteTransaction(java.lang.String data, java.lang.String funName, TransactionCallback callback) -
asyncExecuteTransaction
-
executeTransaction
-
executeTransaction
protected TransactionReceipt executeTransaction(java.lang.String data, java.lang.String functionName) -
createSignedTransaction
-
createSignedTransaction
protected java.lang.String createSignedTransaction(java.lang.String to, java.lang.String data) -
subscribeEvent
-
subscribeEvent
public void subscribeEvent(java.lang.String abi, java.lang.String bin, java.lang.String topic0, EventCallback callback) -
subscribeEvent
public void subscribeEvent(java.lang.String abi, java.lang.String bin, java.lang.String topic0, java.lang.String fromBlock, java.lang.String toBlock, java.util.List<java.lang.String> otherTopics, EventCallback callback) -
staticExtractEventParameters
public static EventValues staticExtractEventParameters(EventEncoder eventEncoder, Event event, TransactionReceipt.Logs log) -
extractEventParameters
-
extractEventParameters
protected java.util.List<EventValues> extractEventParameters(Event event, TransactionReceipt transactionReceipt) -
extractEventParametersWithLog
protected Contract.EventValuesWithLog extractEventParametersWithLog(Event event, TransactionReceipt.Logs log) -
extractEventParametersWithLog
protected java.util.List<Contract.EventValuesWithLog> extractEventParametersWithLog(Event event, TransactionReceipt transactionReceipt) -
extractEventParametersWithLog
protected java.util.List<Contract.EventValuesWithLog> extractEventParametersWithLog(Event event, java.util.List<TransactionReceipt.Logs> logs) -
convertToNative
-
getTransactionProcessor
-
getCurrentExternalAccountAddress
public java.lang.String getCurrentExternalAccountAddress()
-