java.lang.Object
com.hedera.hashgraph.sdk.EvmHookMappingEntry
Represents an entry in a Solidity mapping.
This class is used to specify updates to Solidity mapping entries in an EVM hook's storage. It supports both explicit key bytes and preimage-based keys for variable-length mapping keys.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic EvmHookMappingEntryfromProtobuf(EvmHookMappingEntry proto) Create an EvmHookMappingEntry from a protobuf message.byte[]getKey()Get the explicit key if this entry uses one.byte[]Get the preimage if this entry uses one.byte[]getValue()Get the mapping value.booleanCheck if this entry uses an explicit key.inthashCode()booleanCheck if this entry uses a preimage key.static EvmHookMappingEntryofKey(byte[] key, byte[] value) Create a new mapping entry with an explicit key.(package private) EvmHookMappingEntryConvert this mapping entry to a protobuf message.toString()static EvmHookMappingEntrywithPreimage(byte[] preimage, byte[] value) Create a new mapping entry with a preimage key.
-
Method Details
-
ofKey
Create a new mapping entry with an explicit key.- Parameters:
key- the explicit mapping key (max 32 bytes, minimal representation)value- the mapping value (max 32 bytes, minimal representation)
-
withPreimage
Create a new mapping entry with a preimage key.- Parameters:
preimage- the preimage bytes for the mapping keyvalue- the mapping value (max 32 bytes, minimal representation)
-
hasExplicitKey
public boolean hasExplicitKey()Check if this entry uses an explicit key.- Returns:
- true if using explicit key, false if using preimage
-
hasPreimageKey
public boolean hasPreimageKey()Check if this entry uses a preimage key.- Returns:
- true if using preimage, false if using explicit key
-
getKey
public byte[] getKey()Get the explicit key if this entry uses one.- Returns:
- a copy of the key bytes, or null if using preimage
-
getPreimage
public byte[] getPreimage()Get the preimage if this entry uses one.- Returns:
- a copy of the preimage bytes, or null if using explicit key
-
getValue
public byte[] getValue()Get the mapping value.- Returns:
- a copy of the value bytes
-
toProtobuf
EvmHookMappingEntry toProtobuf()Convert this mapping entry to a protobuf message.- Returns:
- the protobuf EvmHookMappingEntry
-
fromProtobuf
Create an EvmHookMappingEntry from a protobuf message.- Parameters:
proto- the protobuf EvmHookMappingEntry- Returns:
- a new EvmHookMappingEntry instance
-
equals
-
hashCode
public int hashCode() -
toString
-