mirror of
https://gitee.com/BDWare/ypk-deploy-tool
synced 2025-01-09 17:34:02 +00:00
add start as debug
This commit is contained in:
parent
9eb1102a66
commit
c322a981a9
@ -5,7 +5,7 @@ plugins {
|
||||
id 'signing'
|
||||
}
|
||||
group "org.bdware.bdcontract"
|
||||
version "0.5.2"
|
||||
version "0.5.5"
|
||||
sourceCompatibility = 1.8
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -27,6 +27,7 @@ public class HTTPTool {
|
||||
final static String TAG = "[HTTPTool] ";
|
||||
|
||||
static class DeployConfig {
|
||||
public boolean asDebug;
|
||||
String agentAddress;
|
||||
//common config
|
||||
JsonElement createParam;
|
||||
@ -118,13 +119,24 @@ public class HTTPTool {
|
||||
});
|
||||
|
||||
System.out.println(TAG + "startContract:" + fileNames.get(0));
|
||||
ext.startContract(fileNames.get(0), config.createParam, new ResultCallback() {
|
||||
@Override
|
||||
public void onResult(JsonObject r) {
|
||||
System.out.println(TAG + r);
|
||||
counter.incrementAndGet();
|
||||
}
|
||||
});
|
||||
if (config.asDebug) {
|
||||
ext.startContractAsDebug(fileNames.get(0), config.createParam, new ResultCallback() {
|
||||
@Override
|
||||
public void onResult(JsonObject r) {
|
||||
System.out.println(TAG + r);
|
||||
counter.incrementAndGet();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ext.startContract(fileNames.get(0), config.createParam, new ResultCallback() {
|
||||
@Override
|
||||
public void onResult(JsonObject r) {
|
||||
System.out.println(TAG + r);
|
||||
counter.incrementAndGet();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (; counter.get() == 2; )
|
||||
Thread.yield();
|
||||
}
|
||||
|
@ -92,6 +92,34 @@ public class SmartContractClientExt extends SmartContractClient {
|
||||
}
|
||||
this.sendMsg(new Gson().toJson(ret));
|
||||
}
|
||||
public void startContractAsDebug(String project, JsonElement createParam, ResultCallback rc) {
|
||||
String reqID = System.currentTimeMillis() + "";
|
||||
Map<String, Object> ret = new HashMap<>();
|
||||
ret.put("action", "startContractAsDebug");
|
||||
ret.put("isPrivate", true);
|
||||
ret.put("owner", getKeyPair().getPublicKeyStr());
|
||||
ret.put("requestID", reqID);
|
||||
ret.put("path", "/" + project + "/manifest.json");
|
||||
ret.put("createParam", createParam);
|
||||
String content =
|
||||
String.format("Sole|%s|%s", ret.get("path"), getKeyPair().getPublicKeyStr());
|
||||
String sig;
|
||||
try {
|
||||
sig =
|
||||
ByteUtils.toHexString(
|
||||
SM2Util.sign(
|
||||
getKeyPair().getPrivateKeyParameter(), content.getBytes()));
|
||||
ret.put("signature", sig);
|
||||
} catch (CryptoException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ret.put("script", "empty");
|
||||
if (rc != null) {
|
||||
cbs.put(reqID, rc);
|
||||
}
|
||||
this.sendMsg(new Gson().toJson(ret));
|
||||
}
|
||||
|
||||
public void startContract(String project, JsonElement createParam, ResultCallback rc) {
|
||||
String reqID = System.currentTimeMillis() + "";
|
||||
|
Loading…
Reference in New Issue
Block a user