diff --git a/src/main/java/org/bdware/sc/boundry/JavaScriptEntry.java b/src/main/java/org/bdware/sc/boundry/JavaScriptEntry.java index b436616..5a52252 100644 --- a/src/main/java/org/bdware/sc/boundry/JavaScriptEntry.java +++ b/src/main/java/org/bdware/sc/boundry/JavaScriptEntry.java @@ -586,12 +586,13 @@ public class JavaScriptEntry { * @param fun related handler function * @author Kaidong Wu */ - public static void subscribe(String topic, ScriptFunction fun) { + public static String subscribe(String topic, ScriptFunction fun) { subscribe(topic, fun, false); if (topic_handlers.containsKey(topic)) { ContractProcess.instance.unSubscribe(topic_handlers.get(topic).getName()); } topic_handlers.put(topic, fun); + return topic; } /** @@ -602,13 +603,14 @@ public class JavaScriptEntry { * @param fun related handler function * @author Kaidong Wu */ - public static void subscribe(String contractID, String event, ScriptFunction fun) { + public static String subscribe(String contractID, String event, ScriptFunction fun) { String topic = HashUtil.sha3(contractID, event); subscribe(topic, fun, false); if (topic_handlers.containsKey(topic)) { ContractProcess.instance.unSubscribe(topic_handlers.get(topic).getName()); } topic_handlers.put(topic, fun); + return topic; } private static void subscribe(String topic, ScriptFunction fun, boolean fromPreSub) {