Record Class OnchainConfig

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

public record OnchainConfig(Artifact<String,String> artifact, OnchainConfig.OnchainInfo info) extends Record
  • Constructor Details

    • OnchainConfig

      public OnchainConfig(Artifact<String,String> artifact, OnchainConfig.OnchainInfo info)
      Creates an instance of a OnchainConfig record class.
      Parameters:
      artifact - the value for the artifact record component
      info - the value for the info record component
  • Method Details

    • EMPTY

      public static OnchainConfig EMPTY(String serializationPath) throws IOException
      Throws:
      IOException
    • LOAD

      public static OnchainConfig LOAD(String serializationPath) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • keys

      public Credentials keys(String keysName)
    • address

      public String address(String contractName)
    • abi

      public ContractAbi abi(String contractName) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • contract

      public <T> T contract(Class<T> clazz, Sdk sdk, String contractName, String keysName) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • contract

      public <T> T contract(Class<T> clazz, Sdk sdk, String contractName) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • addContract

      public Contract addContract(String name, Contract contract) throws IOException
      Adds OwnedContract object to config with a given name as a key.
      Parameters:
      name - key for finding contract in config later
      contract - contract object
      Returns:
      OwnedContract that we successfully putted to config
      Throws:
      IOException - can be thrown by the call of sync() method
    • addKeys

      public Credentials addKeys(String name, Credentials keys) throws IOException
      Throws:
      IOException
    • sync

      public void sync() throws IOException
      Flushes this config to file on serializationPath()
      Throws:
      IOException - can be thrown by work with File
    • 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.
    • artifact

      public Artifact<String,String> artifact()
      Returns the value of the artifact record component.
      Returns:
      the value of the artifact record component
    • info

      Returns the value of the info record component.
      Returns:
      the value of the info record component