ContractCallQuery, or ContractExecuteTransaction, or the result of
a contract constructor being called by ContractCreateTransaction.
If you require a type which is not supported here, please let us know on this Github issue.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal com.google.protobuf.ByteStringbloom filter for recordfinal byte[]The parameters passed into the contract call.final ContractIdThe ID of the contract that was invoked.final List<ContractNonceInfo> A list of updated contract account nonces containing the new nonce value for each contract account.final List<ContractId> Deprecated.final Stringmessage in case there was an error during smart contract executionfinal ContractIdThe contract's 20-byte EVM addressfinal longThe amount of gas available for the call, aka the gasLimitfinal longunits of gas used to execute contractfinal HbarNumber of tinybars sent (the function must be payable if this is nonzero).final List<ContractLogInfo> the log info for events returned by the functionfinal AccountIdThe account that is the "sender." If not present it is the accountId from the transactionId.final longIf not null this field specifies what the value of the signer account nonce is post transaction execution.final List<ContractStateChange> Deprecated.- Use mirror node for contract traceability instead -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]asBytes()Get the whole raw function result.getAddress(int valIndex) Get the nth returned value as a Solidity address.booleangetBool(int valIndex) Get the nth value as a boolean.byte[]getBytes(int valIndex) Get the nth value in the result as a dynamic byte array.byte[]getBytes32(int valIndex) Get the nth fixed-width 32-byte value in the result.getInt256(int valIndex) Get the nth returned value as a 256-bit integer.intgetInt32(int valIndex) Get the nth returned value as a 32-bit integer.longgetInt64(int valIndex) Get the nth returned value as a 64-bit integer.bytegetInt8(int valIndex) Get the nth returned value as an 8-bit integer.com.esaulpaugh.headlong.abi.TuplegetString(int valIndex) Get the nth returned value as a stringgetStringArray(int index) Get the nth returned value as a list of stringsgetUint256(int valIndex) Get the nth returned value as a 256-bit unsigned integer.intgetUint32(int valIndex) Get the nth returned value as a 32-bit unsigned integer.longgetUint64(int valIndex) Get the nth returned value as a 64-bit integer.bytegetUint8(int valIndex) Get the nth returned value as a 8-bit unsigned integer.(package private) ContractFunctionResultCreate the protobuf representation.toString()
-
Field Details
-
contractId
The ID of the contract that was invoked. -
evmAddress
The contract's 20-byte EVM address -
errorMessage
message in case there was an error during smart contract execution -
bloom
public final com.google.protobuf.ByteString bloombloom filter for record -
gasUsed
public final long gasUsedunits of gas used to execute contract -
logs
the log info for events returned by the function -
createdContractIds
Deprecated.The created ids will now _also_ be externalized through internal transaction records, where each record has its alias field populated with the new contract's EVM address. (This is needed for contracts created with CREATE2, since there is no longer a simple relationship between the new contract's 0.0.X id and its Solidity address.) -
stateChanges
Deprecated.- Use mirror node for contract traceability instead -
gas
public final long gasThe amount of gas available for the call, aka the gasLimit -
hbarAmount
Number of tinybars sent (the function must be payable if this is nonzero). -
contractFunctionParametersBytes
public final byte[] contractFunctionParametersBytesThe parameters passed into the contract call.
This field should only be populated when the paired TransactionBody in the record stream is not a ContractCreateTransactionBody or a ContractCallTransactionBody. -
senderAccountId
The account that is the "sender." If not present it is the accountId from the transactionId. -
contractNonces
A list of updated contract account nonces containing the new nonce value for each contract account. This is always empty in a ContractCallLocalResponse#ContractFunctionResult message, since no internal creations can happen in a static EVM call. -
signerNonce
public final long signerNonceIf not null this field specifies what the value of the signer account nonce is post transaction execution. For transactions that don't update the signer nonce (like HAPI ContractCall and ContractCreate transactions) this field should be null.
-
-
Constructor Details
-
ContractFunctionResult
ContractFunctionResult(ContractFunctionResultOrBuilder inner) Constructor.- Parameters:
inner- the protobuf
-
-
Method Details
-
asBytes
public byte[] asBytes()Get the whole raw function result.- Returns:
- byte[]
-
getString
Get the nth returned value as a string- Parameters:
valIndex- The index of the string to be retrieved- Returns:
- String
-
getStringArray
Get the nth returned value as a list of strings- Parameters:
index- The index of the list of strings to be retrieved- Returns:
- A List of Strings
-
getBytes
public byte[] getBytes(int valIndex) Get the nth value in the result as a dynamic byte array.- Parameters:
valIndex- The index of the array of bytes to be retrieved- Returns:
- byte[]
-
getBytes32
public byte[] getBytes32(int valIndex) Get the nth fixed-width 32-byte value in the result.This is the native word size for the Solidity ABI.
- Parameters:
valIndex- The index of the array of bytes to be retrieved- Returns:
- byte[]
-
getBool
public boolean getBool(int valIndex) Get the nth value as a boolean.- Parameters:
valIndex- The index of the boolean to be retrieved- Returns:
- boolean
-
getInt8
public byte getInt8(int valIndex) Get the nth returned value as an 8-bit integer.If the actual value is wider it will be truncated to the last byte (similar to Java's integer narrowing semantics).
If you are developing a contract and intending to return more than one of these values from a Solidity function, consider using the
bytes32Solidity type instead as that will be a more compact representation which will save on gas. (Each individualint8value is padded to 32 bytes in the ABI.)- Parameters:
valIndex- The index of the value to be retrieved- Returns:
- byte
-
getInt32
public int getInt32(int valIndex) Get the nth returned value as a 32-bit integer.If the actual value is wider it will be truncated to the last 4 bytes (similar to Java's integer narrowing semantics).
- Parameters:
valIndex- The index of the value to be retrieved- Returns:
- int
-
getInt64
public long getInt64(int valIndex) Get the nth returned value as a 64-bit integer.If the actual value is wider it will be truncated to the last 8 bytes (similar to Java's integer narrowing semantics).
- Parameters:
valIndex- The index of the value to be retrieved- Returns:
- long
-
getInt256
Get the nth returned value as a 256-bit integer.This type can represent the full width of Solidity integers.
- Parameters:
valIndex- The index of the value to be retrieved- Returns:
- BigInteger
-
getUint8
public byte getUint8(int valIndex) Get the nth returned value as a 8-bit unsigned integer.If the actual value is wider it will be truncated to the last byte (similar to Java's integer narrowing semantics).
Because Java does not have native unsigned integers, this is semantically identical to
getInt8(int). To treat the value as unsigned in the range[0, 255], useByte.toUnsignedInt(byte)to widen tointwithout sign-extension.If you are developing a contract and intending to return more than one of these values from a Solidity function, consider using the
bytes32Solidity type instead as that will be a more compact representation which will save on gas. (Each individualuint8value is padded to 32 bytes in the ABI.)- Parameters:
valIndex- The index of the value to be retrieved- Returns:
- byte
-
getUint32
public int getUint32(int valIndex) Get the nth returned value as a 32-bit unsigned integer.If the actual value is wider it will be truncated to the last 4 bytes (similar to Java's integer narrowing semantics).
Because Java does not have native unsigned integers, this is semantically identical to
getInt32(int). TheIntegerclass has static methods for treating anintas unsigned where the difference between signed and unsigned actually matters (comparison, division, printing and widening tolong).- Parameters:
valIndex- The index of the value to be retrieved- Returns:
- int
-
getUint64
public long getUint64(int valIndex) Get the nth returned value as a 64-bit integer.If the actual value is wider it will be truncated to the last 8 bytes (similar to Java's integer narrowing semantics).
Because Java does not have native unsigned integers, this is semantically identical to
getInt64(int). TheLongclass has static methods for treating alongas unsigned where the difference between signed and unsigned actually matters (comparison, division and printing).- Parameters:
valIndex- The index of the value to be retrieved- Returns:
- long
-
getUint256
Get the nth returned value as a 256-bit unsigned integer.The value will be padded with a leading zero-byte so that
BigInteger(byte[])treats the value as positive regardless of whether the most significant bit is set or not.This type can represent the full width of Solidity integers.
- Parameters:
valIndex- The index of the value to be retrieved- Returns:
- BigInteger
-
getAddress
Get the nth returned value as a Solidity address.- Parameters:
valIndex- The index of the value to be retrieved- Returns:
- String
-
toProtobuf
ContractFunctionResult toProtobuf()Create the protobuf representation.- Returns:
ContractFunctionResult
-
toString
-
getResult
-