use of io.nuls.kernel.model.RpcClientResult in project nuls by nuls-io.
the class GetWalletBalanceProcessor method execute.
@Override
public CommandResult execute(String[] args) {
RpcClientResult result = restFul.get("/account/balance", null);
if (result.isFailed()) {
return CommandResult.getFailed(result);
}
Map<String, Object> map = (Map) result.getData();
map.put("balance", CommandHelper.naToNuls(((Map) map.get("balance")).get("value")));
map.put("usable", CommandHelper.naToNuls(((Map) map.get("usable")).get("value")));
map.put("locked", CommandHelper.naToNuls(((Map) map.get("locked")).get("value")));
result.setData(map);
return CommandResult.getResult(result);
}
use of io.nuls.kernel.model.RpcClientResult in project nuls by nuls-io.
the class ImportByPrivateKeyProcessor method execute.
@Override
public CommandResult execute(String[] args) {
String prikey = args[1];
String password = CommandHelper.getPwdOptional();
if (StringUtils.isNotBlank(password)) {
CommandHelper.confirmPwd(password);
}
Map<String, Object> parameters = new HashMap<>();
parameters.put("priKey", prikey);
parameters.put("password", password);
parameters.put("overwrite", false);
RpcClientResult result = restFul.post("/account/import/pri", parameters);
if (result.isFailed()) {
return CommandResult.getFailed(result);
}
return CommandResult.getResult(CommandResult.dataTransformValue(result));
}
use of io.nuls.kernel.model.RpcClientResult in project nuls by nuls-io.
the class SignMessageProcessor method execute.
@Override
public CommandResult execute(String[] args) {
String address = args[1];
String message = args[2];
RpcClientResult res = CommandHelper.getPassword(address, restFul);
if (!res.isSuccess()) {
return CommandResult.getFailed(res);
}
String password = (String) res.getData();
Map<String, Object> parameters = new HashMap<>();
parameters.put("address", address);
parameters.put("password", password);
parameters.put("message", message);
RpcClientResult rs = restFul.post("/account/signMessage", parameters);
if (!rs.isSuccess()) {
return CommandResult.getFailed(rs);
}
return CommandResult.getResult(rs);
}
Aggregations