Class EvmHookMappingEntry

java.lang.Object
com.hedera.hashgraph.sdk.EvmHookMappingEntry

public class EvmHookMappingEntry extends Object
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 Details

    • ofKey

      public static EvmHookMappingEntry ofKey(byte[] key, byte[] value)
      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

      public static EvmHookMappingEntry withPreimage(byte[] preimage, byte[] value)
      Create a new mapping entry with a preimage key.
      Parameters:
      preimage - the preimage bytes for the mapping key
      value - 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

      public static EvmHookMappingEntry fromProtobuf(EvmHookMappingEntry proto)
      Create an EvmHookMappingEntry from a protobuf message.
      Parameters:
      proto - the protobuf EvmHookMappingEntry
      Returns:
      a new EvmHookMappingEntry instance
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object