It can use the given amount of gas, and any unspent gas will be refunded to the paying account.
If this function stores information, it is charged gas to store it. There is a fee in hbars to maintain that storage until the expiration time, and that fee is added as part of the transaction fee.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Transaction
Transaction.SignableNodeTransactionBodyBytesNested classes/interfaces inherited from class com.hedera.hashgraph.sdk.Executable
Executable.GrpcRequest -
Field Summary
Fields inherited from class com.hedera.hashgraph.sdk.Transaction
customFeeLimits, DEFAULT_AUTO_RENEW_PERIOD, defaultMaxTransactionFee, DUMMY_ACCOUNT_ID, DUMMY_TRANSACTION_ID, frozenBodyBuilder, innerSignedTransactions, outerTransactions, publicKeys, regenerateTransactionId, signers, sigPairLists, sourceTransactionBody, transactionIdsFields inherited from class com.hedera.hashgraph.sdk.Executable
attemptedAllNodes, blockingUnaryCall, grpcDeadline, logger, maxAttempts, maxBackoff, minBackoff, nodeAccountIds, nodes, random, RST_STREAM -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) ContractCallTransactionBody.Builderbuild()Build the transaction body.Extract the contract id.com.google.protobuf.ByteStringExtract the function parameters.longgetGas()Extract the gas.(package private) io.grpc.MethodDescriptor<Transaction, TransactionResponse> Called to direct the invocation of the query to the appropriate gRPC service.Extract the payable amount.(package private) voidInitialize from the transaction body.(package private) voidonFreeze(TransactionBody.Builder bodyBuilder) Called inTransaction.freezeWith(Client)just before the transaction body is built.(package private) voidonScheduled(SchedulableTransactionBody.Builder scheduled) Called inTransaction.schedule()when converting transaction into a scheduled version.setContractId(ContractId contractId) Sets the contract instance to call.setFunction(String name) Sets the function name to call.setFunction(String name, ContractFunctionParameters params) Sets the function to call, and the parameters to pass to the function.setFunctionParameters(com.google.protobuf.ByteString functionParameters) Sets the function parameters as their raw bytes.setGas(long gas) A maximum limit to the amount of gas to use for this call.setPayableAmount(Hbar amount) Sets the number of hbars sent with this function call.(package private) voidvalidateChecksums(Client client) Methods inherited from class com.hedera.hashgraph.sdk.Transaction
addSignature, addSignature, batchify, buildAllTransactions, buildTransaction, doSchedule, estimateFee, freeze, freezeWith, fromBytes, fromScheduledTransaction, generateTransactionIds, getBatchKey, getDefaultMaxTransactionFee, getExecutionState, getHighVolume, getMaxTransactionFee, getRegenerateTransactionId, getRequiredChunks, getSignableNodeBodyBytesList, getSignatures, getSignaturesAtOffset, getTransactionBodySize, getTransactionHash, getTransactionHashPerNode, getTransactionId, getTransactionIdInternal, getTransactionMemo, getTransactionSize, getTransactionValidDuration, hash, isBatchedAndNotBatchTransaction, isFrozen, keyAlreadySigned, makeRequest, mapResponse, mapResponseStatus, onExecute, onExecuteAsync, regenerateTransactionId, requireNotFrozen, requireOneNodeAccountId, schedule, setBatchKey, setHighVolume, setMaxTransactionFee, setNodeAccountIds, setRegenerateTransactionId, setTransactionId, setTransactionMemo, setTransactionValidDuration, sign, signTransaction, signWith, signWithOperator, spawnBodyBuilder, toBytes, toString, wipeTransactionListsMethods inherited from class com.hedera.hashgraph.sdk.Executable
advanceRequest, checkNodeAccountIds, execute, execute, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, executeAsync, getGrpcRequest, getMaxAttempts, getMaxBackoff, getMaxRetry, getMinBackoff, getNodeAccountIds, getNodeForExecute, grpcDeadline, logTransaction, mergeFromClient, setGrpcDeadline, setLogger, setMaxAttempts, setMaxBackoff, setMaxRetry, setMinBackoff, setNodesFromNodeAccountIds, setRequestListener, setResponseListener, shouldRetryExceptionally
-
Constructor Details
-
ContractExecuteTransaction
public ContractExecuteTransaction()Constructor. -
ContractExecuteTransaction
ContractExecuteTransaction(LinkedHashMap<TransactionId, LinkedHashMap<AccountId, throws com.google.protobuf.InvalidProtocolBufferExceptionTransaction>> txs) Constructor.- Parameters:
txs- Compound list of transaction id's list of (AccountId, Transaction) records- Throws:
com.google.protobuf.InvalidProtocolBufferException- when there is an issue with the protobuf
-
ContractExecuteTransaction
ContractExecuteTransaction(TransactionBody txBody) Constructor.- Parameters:
txBody- protobuf TransactionBody
-
-
Method Details
-
getContractId
Extract the contract id.- Returns:
- the contract id
-
setContractId
Sets the contract instance to call.- Parameters:
contractId- The ContractId to be set- Returns:
this
-
getGas
public long getGas()Extract the gas.- Returns:
- the gas
-
setGas
A maximum limit to the amount of gas to use for this call.The network SHALL charge the greater of the following, but SHALL NOT charge more than the value of this field.
- The actual gas consumed by the smart contract call.
- `80%` of this value.
- Parameters:
gas- The long to be set as gas- Returns:
this
-
getPayableAmount
Extract the payable amount.- Returns:
- the payable amount in hbar
-
setPayableAmount
Sets the number of hbars sent with this function call.- Parameters:
amount- The Hbar to be set- Returns:
this
-
getFunctionParameters
public com.google.protobuf.ByteString getFunctionParameters()Extract the function parameters.- Returns:
- the function parameters
-
setFunctionParameters
public ContractExecuteTransaction setFunctionParameters(com.google.protobuf.ByteString functionParameters) Sets the function parameters as their raw bytes.Use this instead of
setFunction(String, ContractFunctionParameters)if you have already pre-encoded a solidity function call. This MUST contain The application binary interface (ABI) encoding of the function call per the Ethereum contract ABI standard, giving the function signature and arguments being passed to the function.- Parameters:
functionParameters- The function parameters to be set- Returns:
this
-
setFunction
Sets the function name to call.The function will be called with no parameters. Use
setFunction(String, ContractFunctionParameters)to call a function with parameters.- Parameters:
name- The String to be set as the function name- Returns:
this
-
setFunction
Sets the function to call, and the parameters to pass to the function.- Parameters:
name- The String to be set as the function nameparams- The function parameters to be set- Returns:
this
-
initFromTransactionBody
void initFromTransactionBody()Initialize from the transaction body. -
build
Build the transaction body.- Returns:
ContractCallTransactionBody
-
validateChecksums
- Specified by:
validateChecksumsin classTransaction<ContractExecuteTransaction>- Throws:
BadEntityIdException
-
getMethodDescriptor
io.grpc.MethodDescriptor<Transaction,TransactionResponse> getMethodDescriptor()Description copied from class:ExecutableCalled to direct the invocation of the query to the appropriate gRPC service.- Specified by:
getMethodDescriptorin classExecutable<ContractExecuteTransaction,Transaction, TransactionResponse, TransactionResponse>
-
onFreeze
Description copied from class:TransactionCalled inTransaction.freezeWith(Client)just before the transaction body is built. The intent is for the derived class to assign their data variant to the transaction body.- Specified by:
onFreezein classTransaction<ContractExecuteTransaction>
-
onScheduled
Description copied from class:TransactionCalled inTransaction.schedule()when converting transaction into a scheduled version.- Specified by:
onScheduledin classTransaction<ContractExecuteTransaction>
-