irita.sdk.module.wasm.ContractABI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of irita-sdk Show documentation
Show all versions of irita-sdk Show documentation
Irita open alliance chain SDK (java)
package irita.sdk.module.wasm;
import com.alibaba.fastjson.JSON;
import irita.sdk.exception.IritaSDKException;
import org.apache.commons.lang3.StringUtils;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
// ContractABI define a message for executing contract
public class ContractABI {
private String method;
private Map args;
public byte[] build() {
if (StringUtils.isEmpty(method)) {
throw new IritaSDKException("no method pass");
}
Map> map = new HashMap<>();
if (args == null) {
map.put(method, new HashMap<>());
} else {
map.put(method, args);
}
return JSON.toJSONBytes(map);
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public Map getArgs() {
return args;
}
public void setArgs(Map args) {
this.args = args;
}
}