mirror of
				https://gitee.com/BDWare/common
				synced 2025-11-04 06:42:17 +00:00 
			
		
		
		
	feat: support jsontype in executeContract
This commit is contained in:
		
							parent
							
								
									022b1d3902
								
							
						
					
					
						commit
						42745687ab
					
				@ -1,6 +1,8 @@
 | 
			
		||||
package org.bdware.sc.redo;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import com.google.gson.JsonElement;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
@ -11,16 +13,16 @@ public class TransRecord implements Serializable,Comparable<TransRecord>{
 | 
			
		||||
	boolean needSeq = false;
 | 
			
		||||
	int seq;
 | 
			
		||||
	String functionName;
 | 
			
		||||
	String arg;
 | 
			
		||||
	JsonElement arg;
 | 
			
		||||
	public Map<String,String> executes = new HashMap<String,String>();   //<innvokdeID,(flag1<seperate>flag<seperate>result)>
 | 
			
		||||
 | 
			
		||||
	public TransRecord(String s1,String s2,int sequence) {
 | 
			
		||||
	public TransRecord(String s1,JsonElement s2,int sequence) {
 | 
			
		||||
		this.functionName = s1;
 | 
			
		||||
		this.arg = s2;
 | 
			
		||||
		seq = sequence;
 | 
			
		||||
		needSeq = true;
 | 
			
		||||
	}
 | 
			
		||||
	public TransRecord(String s1,String s2) {
 | 
			
		||||
	public TransRecord(String s1,JsonElement s2) {
 | 
			
		||||
		this.functionName = s1;
 | 
			
		||||
		this.arg = s2;
 | 
			
		||||
	}
 | 
			
		||||
@ -29,7 +31,7 @@ public class TransRecord implements Serializable,Comparable<TransRecord>{
 | 
			
		||||
		return functionName;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getArg() {
 | 
			
		||||
	public JsonElement getArg() {
 | 
			
		||||
		return arg;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -40,7 +40,9 @@ public class JsonUtil {
 | 
			
		||||
    public static JsonObject parseStringAsJsonObject(String json) {
 | 
			
		||||
        return JsonParser.parseString(json).getAsJsonObject();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static JsonElement parseString(String json) {
 | 
			
		||||
        return JsonParser.parseString(json);
 | 
			
		||||
    }
 | 
			
		||||
    public static JsonObject parseReaderAsJsonObject(Reader reader) {
 | 
			
		||||
        return JsonParser.parseReader(reader).getAsJsonObject();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,8 @@
 | 
			
		||||
package org.bdware.sc.bean;
 | 
			
		||||
 | 
			
		||||
import com.google.gson.JsonElement;
 | 
			
		||||
import com.google.gson.JsonPrimitive;
 | 
			
		||||
 | 
			
		||||
import java.io.*;
 | 
			
		||||
 | 
			
		||||
public class ContractRequest extends SM2Verifiable
 | 
			
		||||
@ -21,7 +24,7 @@ public class ContractRequest extends SM2Verifiable
 | 
			
		||||
    // action = rsaPrivKeyEncoded(aesKey);
 | 
			
		||||
    String action;
 | 
			
		||||
    // arg = aesKeyEncoded({action,arg});
 | 
			
		||||
    String arg;
 | 
			
		||||
    JsonElement arg;
 | 
			
		||||
    String requestID;
 | 
			
		||||
    boolean fromDebug = false;
 | 
			
		||||
 | 
			
		||||
@ -71,11 +74,15 @@ public class ContractRequest extends SM2Verifiable
 | 
			
		||||
        this.requesterDOI = requesterDOI;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getArg() {
 | 
			
		||||
    public JsonElement getArg() {
 | 
			
		||||
        return arg;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ContractRequest setArg(String arg) {
 | 
			
		||||
        return setArg(new JsonPrimitive(arg));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ContractRequest setArg(JsonElement arg) {
 | 
			
		||||
        this.arg = arg;
 | 
			
		||||
        return this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user