public class ABI
extends java.lang.Object
Constructor and Description |
---|
ABI() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
buildEventString(ContractEvent event)
Build a event name string.
|
static java.lang.String |
buildFunctionString(ContractMethod method)
Build a function name string.
|
static EventValues |
decodeLog(java.util.List<ContractIOType> inputs,
java.lang.String data,
java.util.List<java.lang.String> topics)
Decodes a ABI-encoded log data and indexed topic data
|
static Type |
decodeParameter(java.lang.String solidityType,
java.lang.String encoded)
Decodes a ABI encoded parameter.
|
static java.util.List<Type> |
decodeParameters(ContractMethod method,
java.lang.String encoded)
Decodes a ABI encoded parameters.
|
static java.util.List<Type> |
decodeParameters(java.util.List<java.lang.String> solidityTypeList,
java.lang.String encoded)
Decodes a ABI encoded parameters.
|
static java.lang.String |
encodeContractDeploy(ContractMethod constructor,
java.lang.String byteCode,
java.util.List<java.lang.Object> constructorParams)
Encodes a data related contract deployment.
|
static java.lang.String |
encodeEventSignature(ContractEvent event)
Encodes a event signature.
|
static java.lang.String |
encodeEventSignature(java.lang.String eventName)
Encodes a event signature.
|
static java.lang.String |
encodeFunctionCall(ContractMethod method,
java.util.List<java.lang.Object> params)
Encodes a function call.
|
static java.lang.String |
encodeFunctionCall(java.lang.String functionSig,
java.util.List<java.lang.String> solTypeList,
java.util.List<java.lang.Object> params)
Encodes a function call.
|
static java.lang.String |
encodeFunctionCallWithSolidityWrapper(ContractMethod method,
java.util.List<Type> params)
Encodes a function call
|
static java.lang.String |
encodeFunctionSignature(ContractMethod method)
Encodes a function signature.
|
static java.lang.String |
encodeFunctionSignature(java.lang.String functionName)
Encodes a function signature.
|
static java.lang.String |
encodeParameter(java.lang.String solidityType,
java.lang.Object value)
Encodes a parameter based on its type to its ABI representation.
|
static java.lang.String |
encodeParameter(Type parameter)
Encodes a parameter based on its type to its ABI representation.
|
static java.lang.String |
encodeParameters(ContractMethod method,
java.util.List<java.lang.Object> values)
Encodes a parameters based on its type to its ABI representation.
|
static java.lang.String |
encodeParameters(java.util.List<java.lang.String> solidityTypes,
java.util.List<java.lang.Object> values)
Encodes a parameters based on its type to its ABI representation.
|
static java.lang.String |
encodeParameters(java.util.List<Type> parameters)
Encodes a parameter based on its type to its ABI representation.
|
public static java.lang.String encodeFunctionCall(ContractMethod method, java.util.List<java.lang.Object> params) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.InstantiationException, java.lang.IllegalAccessException
method
- A ContractMethod instance.params
- A List of method parameter.java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.InstantiationException
java.lang.IllegalAccessException
public static java.lang.String encodeFunctionCall(java.lang.String functionSig, java.util.List<java.lang.String> solTypeList, java.util.List<java.lang.Object> params) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.InstantiationException, java.lang.IllegalAccessException
functionSig
- A function signature string.params
- A List of method parameter.java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.InstantiationException
java.lang.IllegalAccessException
public static java.lang.String encodeFunctionCallWithSolidityWrapper(ContractMethod method, java.util.List<Type> params)
method
- A ContractMethod instance.params
- A List of method parameter wrapped solidity wrapper class.public static java.lang.String encodeFunctionSignature(ContractMethod method)
method
- A ContractMethod instance.public static java.lang.String encodeFunctionSignature(java.lang.String functionName)
functionName
- A function name string.public static java.lang.String encodeContractDeploy(ContractMethod constructor, java.lang.String byteCode, java.util.List<java.lang.Object> constructorParams) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
constructor
- A ContractMethod instance that contains constructor info.byteCode
- A smart contract bytecode.constructorParams
- A list of parameter that need to execute Constructorjava.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public static java.lang.String buildFunctionString(ContractMethod method)
method
- A ContractMethod instance.public static java.lang.String encodeEventSignature(ContractEvent event)
event
- A ContractEvent instance.public static java.lang.String encodeEventSignature(java.lang.String eventName)
eventName
- A event signature.public static java.lang.String buildEventString(ContractEvent event)
event
- A ContractEvent instancepublic static java.lang.String encodeParameter(java.lang.String solidityType, java.lang.Object value) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
solidityType
- A solidity type to encode.value
- A value to encodejava.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public static java.lang.String encodeParameters(ContractMethod method, java.util.List<java.lang.Object> values) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.InstantiationException, java.lang.IllegalAccessException
method
- A ContractMethod instance that contains to solidity typevalues
- A List of value to encodejava.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.InstantiationException
java.lang.IllegalAccessException
public static java.lang.String encodeParameters(java.util.List<java.lang.String> solidityTypes, java.util.List<java.lang.Object> values) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
solidityTypes
- A list of solidity type to encodevalues
- A List of value to encodejava.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public static java.lang.String encodeParameter(Type parameter)
parameter
- A parameter that wrapped solidity type wrapper.public static java.lang.String encodeParameters(java.util.List<Type> parameters)
parameters
- A List of parameters that wrappped solidity type wrapperpublic static Type decodeParameter(java.lang.String solidityType, java.lang.String encoded) throws java.lang.ClassNotFoundException
solidityType
- A solidity type string.encoded
- The ABI byte code to decodejava.lang.ClassNotFoundException
public static java.util.List<Type> decodeParameters(java.util.List<java.lang.String> solidityTypeList, java.lang.String encoded) throws java.lang.ClassNotFoundException
solidityTypeList
- A List of solidity type string.encoded
- The ABI byte code to decodejava.lang.ClassNotFoundException
public static java.util.List<Type> decodeParameters(ContractMethod method, java.lang.String encoded) throws java.lang.ClassNotFoundException
method
- A ContractMethod instance.encoded
- The ABI byte code to decoedjava.lang.ClassNotFoundException
public static EventValues decodeLog(java.util.List<ContractIOType> inputs, java.lang.String data, java.util.List<java.lang.String> topics) throws java.lang.ClassNotFoundException
inputs
- A list of ContractIOType instance.data
- An ABI-encoded in the data field of a logtopics
- A list of indexed parameter topics of the log.java.lang.ClassNotFoundException