类 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.
  • 字段详细资料

    • logger

      protected static org.slf4j.Logger logger
    • contractBinary

      protected final java.lang.String contractBinary
    • contractAddress

      protected java.lang.String contractAddress
    • deployReceipt

      protected TransactionReceipt deployReceipt
    • transactionProcessor

      protected final TransactionProcessor transactionProcessor
    • client

      protected final Client client
    • FUNC_DEPLOY

      public static final java.lang.String FUNC_DEPLOY
      另请参阅:
      常量字段值
    • functionEncoder

      protected final FunctionEncoder functionEncoder
    • credential

      protected final CryptoKeyPair credential
    • cryptoSuite

      protected final CryptoSuite cryptoSuite
    • eventEncoder

      protected final EventEncoder 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 string
      contractAddress - the contract address
      client - a Client object
      credential - key pair to use when sign transaction
      transactionProcessor - 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 string
      contractAddress - the contract address
      client - a Client object to send requests
      credential - 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 ContractException
      Deploy contract
      类型参数:
      T - a smart contract object extends Contract
      参数:
      type -
      client - a Client object to send requests
      credential - key pair to use when sign transaction
      transactionManager - TransactionProcessor
      binary - the contract binary code hex string
      encodedConstructor -
      返回:
      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
      抛出:
      ContractException
    • getContractAddress

      public java.lang.String getContractAddress()
    • setContractAddress

      public void setContractAddress​(java.lang.String contractAddress)
    • getDeployReceipt

      public TransactionReceipt getDeployReceipt()
    • setDeployReceipt

      public void setDeployReceipt​(TransactionReceipt deployReceipt)
    • executeCallWithSingleValueReturn

      protected <T extends Type> T executeCallWithSingleValueReturn​(Function function) throws ContractException
      抛出:
      ContractException
    • executeCallWithSingleValueReturn

      protected <T extends Type,​ R> R executeCallWithSingleValueReturn​(Function function, java.lang.Class<R> returnType) throws ContractException
      抛出:
      ContractException
    • executeCallWithMultipleValueReturn

      protected java.util.List<Type> executeCallWithMultipleValueReturn​(Function function) throws ContractException
      抛出:
      ContractException
    • asyncExecuteTransaction

      protected byte[] asyncExecuteTransaction​(java.lang.String data, java.lang.String funName, TransactionCallback callback)
    • asyncExecuteTransaction

      protected byte[] asyncExecuteTransaction​(Function function, TransactionCallback callback)
    • executeTransaction

      protected TransactionReceipt executeTransaction​(Function function)
    • executeTransaction

      protected TransactionReceipt executeTransaction​(java.lang.String data, java.lang.String functionName)
    • createSignedTransaction

      protected java.lang.String createSignedTransaction​(Function function)
    • createSignedTransaction

      protected java.lang.String createSignedTransaction​(java.lang.String to, java.lang.String data)
    • subscribeEvent

      public void subscribeEvent​(EventLogParams params, EventCallback callback)
    • 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

      protected EventValues extractEventParameters​(Event event, TransactionReceipt.Logs log)
    • 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

      public static <S extends Type,​ T> java.util.List<T> convertToNative​(java.util.List<S> arr)
    • getTransactionProcessor

      public TransactionProcessor getTransactionProcessor()
    • getCurrentExternalAccountAddress

      public java.lang.String getCurrentExternalAccountAddress()