use of io.nuls.kernel.model.RpcClientResult in project nuls by nuls-io.
the class ImportByKeyStoreProcessor method execute.
@Override
public CommandResult execute(String[] args) {
String path = args[1];
String password = CommandHelper.getPwdOptional();
Result rs = getAccountKeystoreDto(path);
if (rs.isFailed()) {
return CommandResult.getFailed(rs.getMsg());
}
AccountKeyStoreDto accountKeyStoreDto = (AccountKeyStoreDto) rs.getData();
Map<String, Object> parameters = new HashMap<>();
parameters.put("accountKeyStoreDto", accountKeyStoreDto);
parameters.put("password", password);
parameters.put("overwrite", false);
RpcClientResult result = restFul.post("/account/import", 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 ImportForcedByPrivateKeyProcessor 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", true);
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 CreateMultiAliasProcess method execute.
@Override
public CommandResult execute(String[] args) {
String signAddress = args[3];
RpcClientResult res = CommandHelper.getPassword(signAddress, restFul);
if (!res.isSuccess()) {
return CommandResult.getFailed(res);
}
String password = (String) res.getData();
Map<String, Object> parameters = new HashMap<>();
parameters.put("address", args[1]);
parameters.put("alias", args[2]);
parameters.put("signAddress", args[3]);
parameters.put("password", password);
RpcClientResult result = restFul.post("/account/multiAccount/mutilAlias", parameters);
if (result.isFailed()) {
return CommandResult.getFailed(result);
}
return CommandResult.getResult(CommandResult.dataMultiTransformValue(result));
}
use of io.nuls.kernel.model.RpcClientResult in project nuls by nuls-io.
the class VerifyMessageSignatureProcessor method execute.
@Override
public CommandResult execute(String[] args) {
String address = args[1];
String message = args[2];
String signatureBase64 = args[3];
Map<String, Object> parameters = new HashMap<>();
parameters.put("address", address);
parameters.put("message", message);
parameters.put("signatureBase64", signatureBase64);
RpcClientResult rs = restFul.post("/account/verifyMessageSignature", parameters);
if (!rs.isSuccess()) {
return CommandResult.getFailed(rs);
}
return CommandResult.getResult(rs);
}
use of io.nuls.kernel.model.RpcClientResult in project nuls by nuls-io.
the class GetAssetProcessor method execute.
@Override
public CommandResult execute(String[] args) {
String address = args[1];
RpcClientResult result = restFul.get("/account/assets/" + address, null);
if (result.isFailed()) {
return CommandResult.getFailed(result);
}
List<Map<String, Object>> list = (List<Map<String, Object>>) ((Map) result.getData()).get("list");
for (Map<String, Object> map : list) {
map.put("balance", CommandHelper.naToNuls(map.get("balance")));
map.put("usable", CommandHelper.naToNuls(map.get("usable")));
map.put("locked", CommandHelper.naToNuls(map.get("locked")));
}
result.setData(list);
return CommandResult.getResult(result);
}
Aggregations