Record Class ContractAbi

java.lang.Object
java.lang.Record
tech.deplant.java4ever.framework.ContractAbi

public record ContractAbi(tech.deplant.java4ever.binding.Abi.AbiContract abiContract) extends Record
Holds entire ABI structure and has helper methods to check functions availability or getting input types and so on. Use factory methods to create from File or JsonNode.
  • Constructor Details

    • ContractAbi

      public ContractAbi(tech.deplant.java4ever.binding.Abi.AbiContract abiContract)
      Creates an instance of a ContractAbi record class.
      Parameters:
      abiContract - the value for the abiContract record component
  • Method Details

    • ofString

      public static ContractAbi ofString(String jsonString) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • ofResource

      public static ContractAbi ofResource(String resourceName) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • ofFile

      public static ContractAbi ofFile(String filePath) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • ofJsonNode

      public static ContractAbi ofJsonNode(com.fasterxml.jackson.databind.JsonNode node) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • json

      public String json() throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • functionId

      public String functionId(Sdk sdk, String name) throws tech.deplant.java4ever.binding.EverSdkException
      Throws:
      tech.deplant.java4ever.binding.EverSdkException
    • hasHeader

      public boolean hasHeader(String name)
    • hasFunction

      public boolean hasFunction(String name)
    • hasInitDataParam

      public boolean hasInitDataParam(String initDataName)
    • hasInput

      public boolean hasInput(String functionName, String inputName)
    • hasOutput

      public boolean hasOutput(String functionName, String outputName)
    • functionInputType

      public tech.deplant.java4ever.binding.Abi.AbiParam functionInputType(String functionName, String inputName)
    • initDataType

      public tech.deplant.java4ever.binding.Abi.AbiParam initDataType(String initDataName)
    • functionOutputType

      public tech.deplant.java4ever.binding.Abi.AbiParam functionOutputType(String functionName, String outputName)
    • eventInputType

      public tech.deplant.java4ever.binding.Abi.AbiParam eventInputType(String functionName, String inputName)
    • data

      public tech.deplant.java4ever.binding.Abi.AbiData[] data()
    • functions

      public tech.deplant.java4ever.binding.Abi.AbiFunction[] functions()
    • events

      public tech.deplant.java4ever.binding.Abi.AbiEvent[] events()
    • header

      public String[] header()
    • ABI

      public tech.deplant.java4ever.binding.Abi.ABI ABI()
    • functionCallABI

      public tech.deplant.java4ever.binding.Abi.ABI functionCallABI(String functionName)
    • convertFunctionOutputs

      public Map<String,Object> convertFunctionOutputs(String functionName, Map<String,Object> functionOutputs) throws tech.deplant.java4ever.binding.EverSdkException
      Checks and converts provided Java Map containing inputs for function call to correct representation that will be accepted by ABI. If map doesn't meet ABI input structure, this method will fail. If some type doesn't have conversion, it will be serialized as is.
      Parameters:
      functionName -
      functionOutputs -
      Returns:
      Throws:
      tech.deplant.java4ever.binding.EverSdkException
    • convertFunctionInputs

      public Map<String,Object> convertFunctionInputs(String functionName, Map<String,Object> functionInputs) throws tech.deplant.java4ever.binding.EverSdkException
      Checks and converts provided Java Map containing inputs for function call to correct representation that will be accepted by ABI. If map doesn't meet ABI input structure, this method will fail. If some type doesn't have conversion, it will be serialized as is.
      Parameters:
      functionName -
      functionInputs -
      Returns:
      Throws:
      tech.deplant.java4ever.binding.EverSdkException
    • convertInitDataInputs

      public Map<String,Object> convertInitDataInputs(Map<String,Object> initDataInputs) throws tech.deplant.java4ever.binding.EverSdkException
      Checks and converts provided Java Map containing inputs for initialData to correct representation that will be accepted by ABI. If map doesn't meet ABI input structure, this method will fail. If some type doesn't have conversion, it will be serialized as is.
      Parameters:
      initDataInputs -
      Returns:
      Throws:
      tech.deplant.java4ever.binding.EverSdkException
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • abiContract

      public tech.deplant.java4ever.binding.Abi.AbiContract abiContract()
      Returns the value of the abiContract record component.
      Returns:
      the value of the abiContract record component