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 Summary
ConstructorsConstructorDescriptionContractAbi
(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 aContractAbi
record class. -
Method Summary
Modifier and TypeMethodDescriptiontech.deplant.java4ever.binding.Abi.ABI
ABI()
Returns the value of theabiVersion
record component.Returns the value of theabiVersionOld
record component.protected boolean
arrayMatcher
(String typeString) convertFunctionInputs
(String functionName, Map<String, Object> functionInputs) Checks and converts provided Java Map containing inputs for function call to correct representation that will be accepted by ABI.convertInitDataInputs
(Map<String, Object> initDataInputs) Checks and converts provided Java Map containing inputs for initialData to correct representation that will be accepted by ABI.tech.deplant.java4ever.binding.Abi.AbiData[]
data()
Returns the value of thedata
record component.final boolean
Indicates whether some other object is "equal to" this one.tech.deplant.java4ever.binding.Abi.AbiParam
eventInputType
(String functionName, String inputName) tech.deplant.java4ever.binding.Abi.AbiEvent[]
events()
Returns the value of theevents
record component.tech.deplant.java4ever.binding.Abi.AbiParam[]
fields()
Returns the value of thefields
record component.tech.deplant.java4ever.binding.Abi.AbiParam
functionInputType
(String functionName, String inputName) tech.deplant.java4ever.binding.Abi.AbiParam
functionOutputType
(String functionName, String outputName) tech.deplant.java4ever.binding.Abi.AbiFunction[]
Returns the value of thefunctions
record component.boolean
hasFunction
(String name) final int
hashCode()
Returns a hash code value for this object.boolean
boolean
hasInitDataParam
(String initDataName) boolean
boolean
String[]
header()
Returns the value of theheader
record component.tech.deplant.java4ever.binding.Abi.AbiParam
initDataType
(String initDataName) json()
static ContractAbi
static ContractAbi
ofJsonNode
(com.fasterxml.jackson.databind.JsonNode node) static ContractAbi
ofResource
(String resourceName) static ContractAbi
protected Object
serializeSingle
(AbiValueType type, int size, Object inputValue) protected Object
serializeTree
(tech.deplant.java4ever.binding.Abi.AbiParam param, Object inputValue) final String
toString()
Returns a string representation of this record class.protected tech.deplant.java4ever.framework.abi.ContractAbi.TypePair
typeParser
(String typeString) version()
Returns the value of theversion
record component.
-
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 aContractAbi
record class.- Parameters:
abiVersion
- the value for theabiVersion
record componentabiVersionOld
- the value for theabiVersionOld
record componentversion
- the value for theversion
record componentheader
- the value for theheader
record componentdata
- the value for thedata
record componentfields
- the value for thefields
record componentfunctions
- the value for thefunctions
record componentevents
- the value for theevents
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
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
hasHeader
-
hasFunction
-
hasInitDataParam
-
hasInput
-
hasOutput
-
functionInputType
-
initDataType
-
functionOutputType
-
eventInputType
-
ABI
public tech.deplant.java4ever.binding.Abi.ABI ABI() -
serializeSingle
protected Object serializeSingle(AbiValueType type, int size, Object inputValue) throws tech.deplant.java4ever.binding.EverSdkException - Throws:
tech.deplant.java4ever.binding.EverSdkException
-
typeParser
protected tech.deplant.java4ever.framework.abi.ContractAbi.TypePair typeParser(String typeString) throws tech.deplant.java4ever.binding.EverSdkException - Throws:
tech.deplant.java4ever.binding.EverSdkException
-
arrayMatcher
-
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.EverSdkExceptionChecks 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.EverSdkExceptionChecks 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
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
abiVersion
Returns the value of theabiVersion
record component.- Returns:
- the value of the
abiVersion
record component
-
abiVersionOld
Returns the value of theabiVersionOld
record component.- Returns:
- the value of the
abiVersionOld
record component
-
version
Returns the value of theversion
record component.- Returns:
- the value of the
version
record component
-
header
Returns the value of theheader
record component.- Returns:
- the value of the
header
record component
-
data
public tech.deplant.java4ever.binding.Abi.AbiData[] data()Returns the value of thedata
record component.- Returns:
- the value of the
data
record component
-
fields
public tech.deplant.java4ever.binding.Abi.AbiParam[] fields()Returns the value of thefields
record component.- Returns:
- the value of the
fields
record component
-
functions
public tech.deplant.java4ever.binding.Abi.AbiFunction[] functions()Returns the value of thefunctions
record component.- Returns:
- the value of the
functions
record component
-
events
public tech.deplant.java4ever.binding.Abi.AbiEvent[] events()Returns the value of theevents
record component.- Returns:
- the value of the
events
record component
-