java.lang.Object
java.lang.Record
tech.deplant.java4ever.framework.ContractAbi
public record ContractAbi(tech.deplant.java4ever.binding.Abi.AbiContract abiContract)
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
(tech.deplant.java4ever.binding.Abi.AbiContract abiContract) Creates an instance of aContractAbi
record class. -
Method Summary
Modifier and TypeMethodDescriptiontech.deplant.java4ever.binding.Abi.ABI
ABI()
Abi abi . abi.tech.deplant.java4ever.binding.Abi.AbiContract
Returns the value of theabiContract
record component.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.convertFunctionOutputs
(String functionName, Map<String, Object> functionOutputs) 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()
Data abi . abi data [ ].final boolean
Indicates whether some other object is "equal to" this one.tech.deplant.java4ever.binding.Abi.AbiParam
eventInputType
(String functionName, String inputName) Event input type abi . abi param.tech.deplant.java4ever.binding.Abi.AbiEvent[]
events()
Events abi . abi event [ ].tech.deplant.java4ever.binding.Abi.ABI
functionCallABI
(String functionName) Function call abi abi . abi.functionId
(int sdk, String name) Function id string.tech.deplant.java4ever.binding.Abi.AbiParam
functionInputType
(String functionName, String inputName) Function input type abi . abi param.tech.deplant.java4ever.binding.Abi.AbiParam
functionOutputType
(String functionName, String outputName) Function output type abi . abi param.tech.deplant.java4ever.binding.Abi.AbiFunction[]
Functions abi . abi function [ ].boolean
hasFunction
(String name) Has function boolean.final int
hashCode()
Returns a hash code value for this object.boolean
Has header boolean.boolean
hasInitDataParam
(String initDataName) Has init data param boolean.boolean
Has input boolean.boolean
Has output boolean.String[]
header()
Header string [ ].tech.deplant.java4ever.binding.Abi.AbiParam
initDataType
(String initDataName) Init data type abi . abi param.json()
Json string.static ContractAbi
Of file contract abi.static ContractAbi
ofJsonNode
(com.fasterxml.jackson.databind.JsonNode node) Of json node contract abi.static ContractAbi
ofResource
(String resourceName) Of resource contract abi.static ContractAbi
Of string contract abi.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ContractAbi
public ContractAbi(tech.deplant.java4ever.binding.Abi.AbiContract abiContract) Creates an instance of aContractAbi
record class.- Parameters:
abiContract
- the value for theabiContract
record component
-
-
Method Details
-
ofString
public static ContractAbi ofString(String jsonString) throws com.fasterxml.jackson.core.JsonProcessingException Of string contract abi.- Parameters:
jsonString
- the json string- Returns:
- the contract abi
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- the json processing exception
-
ofResource
public static ContractAbi ofResource(String resourceName) throws com.fasterxml.jackson.core.JsonProcessingException Of resource contract abi.- Parameters:
resourceName
- the resource name- Returns:
- the contract abi
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- the json processing exception
-
ofFile
public static ContractAbi ofFile(String filePath) throws com.fasterxml.jackson.core.JsonProcessingException Of file contract abi.- Parameters:
filePath
- the file path- Returns:
- the contract abi
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- the json processing exception
-
ofJsonNode
public static ContractAbi ofJsonNode(com.fasterxml.jackson.databind.JsonNode node) throws com.fasterxml.jackson.core.JsonProcessingException Of json node contract abi.- Parameters:
node
- the node- Returns:
- the contract abi
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- the json processing exception
-
json
Json string.- Returns:
- the string
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- the json processing exception
-
functionId
-
hasHeader
Has header boolean.- Parameters:
name
- the name- Returns:
- the boolean
-
hasFunction
Has function boolean.- Parameters:
name
- the name- Returns:
- the boolean
-
hasInitDataParam
Has init data param boolean.- Parameters:
initDataName
- the init data name- Returns:
- the boolean
-
hasInput
-
hasOutput
-
functionInputType
-
initDataType
Init data type abi . abi param.- Parameters:
initDataName
- the init data name- Returns:
- the abi . abi param
-
functionOutputType
-
eventInputType
-
data
public tech.deplant.java4ever.binding.Abi.AbiData[] data()Data abi . abi data [ ].- Returns:
- the abi . abi data [ ]
-
functions
public tech.deplant.java4ever.binding.Abi.AbiFunction[] functions()Functions abi . abi function [ ].- Returns:
- the abi . abi function [ ]
-
events
public tech.deplant.java4ever.binding.Abi.AbiEvent[] events()Events abi . abi event [ ].- Returns:
- the abi . abi event [ ]
-
header
-
ABI
public tech.deplant.java4ever.binding.Abi.ABI ABI()Abi abi . abi.- Returns:
- the abi . abi
-
functionCallABI
Function call abi abi . abi.- Parameters:
functionName
- the function name- Returns:
- the abi . abi
-
convertFunctionOutputs
public Map<String,Object> convertFunctionOutputs(String functionName, Map<String, Object> functionOutputs) 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
- the function namefunctionOutputs
- the function outputs- Returns:
- map
- Throws:
tech.deplant.java4ever.binding.EverSdkException
- the ever sdk exception
-
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
- the function namefunctionInputs
- the function inputs- Returns:
- map
- Throws:
tech.deplant.java4ever.binding.EverSdkException
- the ever sdk exception
-
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
- the init data inputs- Returns:
- map
- Throws:
tech.deplant.java4ever.binding.EverSdkException
- the ever sdk exception
-
toString
-
hashCode
-
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)
. -
abiContract
public tech.deplant.java4ever.binding.Abi.AbiContract abiContract()Returns the value of theabiContract
record component.- Returns:
- the value of the
abiContract
record component
-