mirror of
				https://gitee.com/BDWare/ypk-deploy-tool
				synced 2025-10-31 12:42:16 +00:00 
			
		
		
		
	add start as debug
This commit is contained in:
		
							parent
							
								
									9eb1102a66
								
							
						
					
					
						commit
						c322a981a9
					
				| @ -5,7 +5,7 @@ plugins { | |||||||
|     id 'signing' |     id 'signing' | ||||||
| } | } | ||||||
| group "org.bdware.bdcontract" | group "org.bdware.bdcontract" | ||||||
| version "0.5.2" | version "0.5.5" | ||||||
| sourceCompatibility = 1.8 | sourceCompatibility = 1.8 | ||||||
| repositories { | repositories { | ||||||
|     mavenCentral() |     mavenCentral() | ||||||
|  | |||||||
| @ -27,6 +27,7 @@ public class HTTPTool { | |||||||
|     final static String TAG = "[HTTPTool] "; |     final static String TAG = "[HTTPTool] "; | ||||||
| 
 | 
 | ||||||
|     static class DeployConfig { |     static class DeployConfig { | ||||||
|  |         public boolean asDebug; | ||||||
|         String agentAddress; |         String agentAddress; | ||||||
|         //common config |         //common config | ||||||
|         JsonElement createParam; |         JsonElement createParam; | ||||||
| @ -118,13 +119,24 @@ public class HTTPTool { | |||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         System.out.println(TAG + "startContract:" + fileNames.get(0)); |         System.out.println(TAG + "startContract:" + fileNames.get(0)); | ||||||
|         ext.startContract(fileNames.get(0), config.createParam, new ResultCallback() { |         if (config.asDebug) { | ||||||
|             @Override |             ext.startContractAsDebug(fileNames.get(0), config.createParam, new ResultCallback() { | ||||||
|             public void onResult(JsonObject r) { |                 @Override | ||||||
|                 System.out.println(TAG + r); |                 public void onResult(JsonObject r) { | ||||||
|                 counter.incrementAndGet(); |                     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; ) |         for (; counter.get() == 2; ) | ||||||
|             Thread.yield(); |             Thread.yield(); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -92,6 +92,34 @@ public class SmartContractClientExt extends SmartContractClient { | |||||||
|         } |         } | ||||||
|         this.sendMsg(new Gson().toJson(ret)); |         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) { |     public void startContract(String project, JsonElement createParam, ResultCallback rc) { | ||||||
|         String reqID = System.currentTimeMillis() + ""; |         String reqID = System.currentTimeMillis() + ""; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user