public class AbiUtils
extends java.lang.Object
Example usage:
String jsonAbi = "{\"entrys\": [{\"name\": \"transfer\",\"type\": \"function\",...}]}";
// Convert JSON string to ABI object
ABI abi = AbiUtils.jsonStr2ABI(jsonAbi);
// Or use builder pattern
ABI.Builder builder = ABI.newBuilder();
AbiUtils.loadAbiFromJson(jsonAbi, builder);
| Constructor and Description |
|---|
AbiUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Common.SmartContract.ABI |
jsonStr2ABI(java.lang.String jsonStr)
Converts a JSON string representation of an ABI to ABI protobuf object.
|
static void |
loadAbiFromJson(java.lang.String abiString,
Common.SmartContract.ABI.Builder builder)
Loads ABI information from a JSON string into an existing ABI builder.
|
public static void loadAbiFromJson(java.lang.String abiString,
Common.SmartContract.ABI.Builder builder)
abiString - The JSON string containing the ABI definitionbuilder - The ABI builder to populatejava.lang.IllegalArgumentException - if the JSON format is invalid or required fields are missingpublic static Common.SmartContract.ABI jsonStr2ABI(java.lang.String jsonStr)
jsonStr - The JSON string containing the ABI definitionjava.lang.IllegalArgumentException - if the input JSON string is invalid or cannot be parsed