Package org.web3j.ens

Class EnsResolver

java.lang.Object
org.web3j.ens.EnsResolver

public class EnsResolver extends Object
Resolution logic for contract addresses. According to https://eips.ethereum.org/EIPS/eip-2544
  • Field Details

  • Constructor Details

    • EnsResolver

      public EnsResolver(Web3j web3j, long syncThreshold, int addressLength)
    • EnsResolver

      public EnsResolver(Web3j web3j, long syncThreshold)
    • EnsResolver

      public EnsResolver(Web3j web3j)
  • Method Details

    • setSyncThreshold

      public void setSyncThreshold(long syncThreshold)
    • getSyncThreshold

      public long getSyncThreshold()
    • obtainPublicResolver

      @Deprecated protected PublicResolver obtainPublicResolver(String ensName)
      Deprecated.
      Provides an access to a valid public resolver in order to access other API methods.
      Parameters:
      ensName - our user input ENS name
      Returns:
      PublicResolver
    • obtainOffchainResolver

      protected OffchainResolverContract obtainOffchainResolver(String ensName)
      Provides an access to a valid offchain resolver in order to access other API methods.
      Parameters:
      ensName - our user input ENS name
      Returns:
      OffchainResolver
    • resolve

      public String resolve(String ensName)
      Returns the address of the resolver for the specified node.
      Parameters:
      ensName - The specified node.
      Returns:
      address of the resolver.
    • resolveOffchain

      protected String resolveOffchain(String lookupData, OffchainResolverContract resolver, int lookupCounter) throws Exception
      Throws:
      Exception
    • ccipReadFetch

      protected String ccipReadFetch(List<String> urls, String sender, String data)
    • buildRequest

      protected okhttp3.Request buildRequest(String url, String sender, String data) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • reverseResolve

      public String reverseResolve(String address)
      Reverse name resolution as documented in the specification.
      Parameters:
      address - an ethereum address, example: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
      Returns:
      a EnsName registered for provided address
    • isValidEnsName

      public static boolean isValidEnsName(String input)
    • isValidEnsName

      public static boolean isValidEnsName(String input, int addressLength)
    • setHttpClient

      public void setHttpClient(okhttp3.OkHttpClient client)