Class AbiTypes

java.lang.Object
org.web3j.abi.datatypes.AbiTypes

public final class AbiTypes extends Object
Maps Solidity types to web3j data types, allowing to use Java primitive types for numbers. The used primitive type is the smallest that can hold a Solidity value for a specific bit length, e.g. Short for int8, int16 and uint8; Integer for int24, int32, uint16 and uint24, etc.
  • Method Details

    • getType

      public static Class<? extends Type> getType(String type)
      Returns the web3j data type for the given type, without using primitive types.
      Parameters:
      type - A Solidity type.
      Returns:
      The web3j Java class to represent this Solidity type.
    • getType

      public static Class<? extends Type> getType(String type, boolean primitives)
      Returns the web3j data type for the given type.
      Parameters:
      type - A Solidity type.
      primitives - Use Java primitive types to wrap contract parameters.
      Returns:
      The web3j Java class to represent this Solidity type.
    • getTypeAString

      public static String getTypeAString(Class<? extends Type> type)
      Returns the provided class type as a string. In case of a struct, it will return the struct name. For the tuple notation of a struct, example ((string,uint256)), think of taking an instance of the struct and calling the instance.getTypeAsString() method.