use of org.starcoin.types.ScriptFunction in project starcoin-java by starcoinorg.
the class ScriptFunctionDeserializer method deserialize.
@Override
public ScriptFunction deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
JsonNode node = jsonParser.getCodec().readTree(jsonParser);
ModuleId module = ParseUtil.parseObject(jsonParser, node.get("module"), ModuleId.class);
Identifier function = new Identifier(node.get("function").asText());
List<TypeTag> tyArgs = ParseUtil.parseObjectList(jsonParser, node.get("type_args"), TypeTag.class);
List<Bytes> args = ParseUtil.parseBytesList(node.get("args"));
;
return new ScriptFunction(module, function, tyArgs, args);
}
use of org.starcoin.types.ScriptFunction in project starcoin-java by starcoinorg.
the class ScriptFunctionObj method toScriptFunction.
public ScriptFunction toScriptFunction() {
List<TypeTag> tyAargsTypeTag = Lists.newArrayList();
if (tyArgs != null) {
tyAargsTypeTag = tyArgs.stream().map(TypeObj::toTypeTag).collect(Collectors.toList());
}
Identifier name = new Identifier(getModuleName());
ModuleId moduleId = new ModuleId(AccountAddressUtils.create(getModuleAddress()), name);
Identifier function = new Identifier(getFunctionName());
ScriptFunction scriptFunction = new ScriptFunction(moduleId, function, tyAargsTypeTag, args);
return scriptFunction;
}
Aggregations