Record Class ContractAbi

java.lang.Object
java.lang.Record
tech.deplant.java4ever.framework.abi.ContractAbi
Record Components:
abiVersion -
version -
header -
data -
fields -
functions -
events -

public record ContractAbi(Integer abiVersion, Number abiVersionOld, String version, String[] header, tech.deplant.java4ever.binding.Abi.AbiData[] data, tech.deplant.java4ever.binding.Abi.AbiParam[] fields, tech.deplant.java4ever.binding.Abi.AbiFunction[] functions, tech.deplant.java4ever.binding.Abi.AbiEvent[] events) 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(Integer abiVersion, Number abiVersionOld, String version, String[] header, tech.deplant.java4ever.binding.Abi.AbiData[] data, tech.deplant.java4ever.binding.Abi.AbiParam[] fields, tech.deplant.java4ever.binding.Abi.AbiFunction[] functions, tech.deplant.java4ever.binding.Abi.AbiEvent[] events)
      Creates an instance of a ContractAbi record class.
      Parameters:
      abiVersion - the value for the abiVersion record component
      abiVersionOld - the value for the abiVersionOld record component
      version - the value for the version record component
      header - the value for the header record component
      data - the value for the data record component
      fields - the value for the fields record component
      functions - the value for the functions record component
      events - the value for the events 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)
    • ABI

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

      protected tech.deplant.java4ever.framework.abi.ContractAbi.AbiTypeDetails typeParser(String typeString) throws tech.deplant.java4ever.binding.EverSdkException
      Throws:
      tech.deplant.java4ever.binding.EverSdkException
    • arrayMatcher

      protected boolean arrayMatcher(String typeString)
    • serializeTree

      protected Object serializeTree(tech.deplant.java4ever.binding.Abi.AbiParam param, Object inputValue) throws tech.deplant.java4ever.binding.EverSdkException
      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.
    • abiVersion

      public Integer abiVersion()
      Returns the value of the abiVersion record component.
      Returns:
      the value of the abiVersion record component
    • abiVersionOld

      public Number abiVersionOld()
      Returns the value of the abiVersionOld record component.
      Returns:
      the value of the abiVersionOld record component
    • version

      public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • header

      public String[] header()
      Returns the value of the header record component.
      Returns:
      the value of the header record component
    • data

      public tech.deplant.java4ever.binding.Abi.AbiData[] data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component
    • fields

      public tech.deplant.java4ever.binding.Abi.AbiParam[] fields()
      Returns the value of the fields record component.
      Returns:
      the value of the fields record component
    • functions

      public tech.deplant.java4ever.binding.Abi.AbiFunction[] functions()
      Returns the value of the functions record component.
      Returns:
      the value of the functions record component
    • events

      public tech.deplant.java4ever.binding.Abi.AbiEvent[] events()
      Returns the value of the events record component.
      Returns:
      the value of the events record component