NodePortal
This commit is contained in:
@@ -443,6 +443,155 @@ function onExecuteResult(obj) {
|
||||
}
|
||||
}
|
||||
|
||||
function getMask() {
|
||||
const argDiv = $('#maskArg')[0];
|
||||
const request = {};
|
||||
request.action = "getMask";
|
||||
request.requestID = new Date().getTime() + "";
|
||||
request.contractID = global.contractInstance;
|
||||
const operation = $("#selectContractFunction")[0].value;
|
||||
if (operation === " " && !operation) {
|
||||
myToast("执行合约", "请选择合约方法!");
|
||||
return;
|
||||
}
|
||||
//request.operation = operation;
|
||||
request.arg = argDiv.value;
|
||||
request.pubkey = global.sm2Key.publicKey;
|
||||
//request.isDebug = executeContractAsDebug.checked;
|
||||
console.log(request.arg);
|
||||
//const gasLimit = $('#gasLimit').val()/1;
|
||||
var toSign = request.contractID + "|"
|
||||
+ request.operation + "|" + arg ;
|
||||
/*if (gasLimit>0){
|
||||
request.gasLimit = gasLimit;
|
||||
toSign+= "|" + gasLimit;
|
||||
}*/
|
||||
toSign+= "|" + global.sm2Key.publicKey;
|
||||
request.signature = sm2.doSignature(
|
||||
toSign,
|
||||
global.sm2Key.privateKey,
|
||||
{hash: true, der: true});
|
||||
localStorage.setItem("persisArg", JSON.stringify(request));
|
||||
global.wssocket.send(JSON.stringify(request));
|
||||
}
|
||||
function setMask() {
|
||||
const argDiv = $('#maskArg')[0];
|
||||
const request = {};
|
||||
request.action = "setMask";
|
||||
request.requestID = new Date().getTime() + "";
|
||||
request.contractID = global.contractInstance;
|
||||
const operation = $("#selectContractFunction")[0].value;
|
||||
if (operation === " " && !operation) {
|
||||
myToast("执行合约", "请选择合约方法!");
|
||||
return;
|
||||
}
|
||||
//request.operation = operation;
|
||||
request.arg = argDiv.value;
|
||||
request.pubkey = global.sm2Key.publicKey;
|
||||
//request.isDebug = executeContractAsDebug.checked;
|
||||
console.log(request.arg);
|
||||
//const gasLimit = $('#gasLimit').val()/1;
|
||||
var toSign = request.contractID + "|"
|
||||
+ request.operation + "|" + arg ;
|
||||
/*if (gasLimit>0){
|
||||
request.gasLimit = gasLimit;
|
||||
toSign+= "|" + gasLimit;
|
||||
}*/
|
||||
toSign+= "|" + global.sm2Key.publicKey;
|
||||
request.signature = sm2.doSignature(
|
||||
toSign,
|
||||
global.sm2Key.privateKey,
|
||||
{hash: true, der: true});
|
||||
localStorage.setItem("persisArg", JSON.stringify(request));
|
||||
global.wssocket.send(JSON.stringify(request));
|
||||
}
|
||||
|
||||
function onGetMask(obj) {
|
||||
console.log("onGetMask obj.data", obj.data);
|
||||
try {
|
||||
const result = obj;
|
||||
$("#maskResponseArea")[0].value = JSON.stringify(obj.data);
|
||||
|
||||
} catch (e) {
|
||||
$("#maskResponseArea")[0].value = JSON.stringify(obj.data);
|
||||
}
|
||||
}
|
||||
|
||||
function getMock() {
|
||||
const argDiv = $('#mockArg')[0];
|
||||
const request = {};
|
||||
request.action = "getMock";
|
||||
request.requestID = new Date().getTime() + "";
|
||||
request.contractID = global.contractInstance;
|
||||
const operation = $("#selectContractFunction")[0].value;
|
||||
if (operation === " " && !operation) {
|
||||
myToast("执行合约", "请选择合约方法!");
|
||||
return;
|
||||
}
|
||||
//request.operation = operation;
|
||||
request.arg = argDiv.value;
|
||||
request.pubkey = global.sm2Key.publicKey;
|
||||
//request.isDebug = executeContractAsDebug.checked;
|
||||
console.log(request.arg);
|
||||
//const gasLimit = $('#gasLimit').val()/1;
|
||||
var toSign = request.contractID + "|"
|
||||
+ request.operation + "|" + arg ;
|
||||
/*if (gasLimit>0){
|
||||
request.gasLimit = gasLimit;
|
||||
toSign+= "|" + gasLimit;
|
||||
}*/
|
||||
toSign+= "|" + global.sm2Key.publicKey;
|
||||
request.signature = sm2.doSignature(
|
||||
toSign,
|
||||
global.sm2Key.privateKey,
|
||||
{hash: true, der: true});
|
||||
localStorage.setItem("persisArg", JSON.stringify(request));
|
||||
global.wssocket.send(JSON.stringify(request));
|
||||
}
|
||||
|
||||
function setMock() {
|
||||
const argDiv = $('#mockArg')[0];
|
||||
const request = {};
|
||||
request.action = "setMock";
|
||||
request.requestID = new Date().getTime() + "";
|
||||
request.contractID = global.contractInstance;
|
||||
const operation = $("#selectContractFunction")[0].value;
|
||||
if (operation === " " && !operation) {
|
||||
myToast("执行合约", "请选择合约方法!");
|
||||
return;
|
||||
}
|
||||
//request.operation = operation;
|
||||
request.arg = argDiv.value;
|
||||
request.pubkey = global.sm2Key.publicKey;
|
||||
//request.isDebug = executeContractAsDebug.checked;
|
||||
console.log(request.arg);
|
||||
//const gasLimit = $('#gasLimit').val()/1;
|
||||
var toSign = request.contractID + "|"
|
||||
+ request.operation + "|" + arg ;
|
||||
/*if (gasLimit>0){
|
||||
request.gasLimit = gasLimit;
|
||||
toSign+= "|" + gasLimit;
|
||||
}*/
|
||||
toSign+= "|" + global.sm2Key.publicKey;
|
||||
request.signature = sm2.doSignature(
|
||||
toSign,
|
||||
global.sm2Key.privateKey,
|
||||
{hash: true, der: true});
|
||||
localStorage.setItem("persisArg", JSON.stringify(request));
|
||||
global.wssocket.send(JSON.stringify(request));
|
||||
}
|
||||
|
||||
function onGetMock(obj) {
|
||||
console.log("onGetMask obj.data", obj.data);
|
||||
try {
|
||||
const result = obj;
|
||||
$("#mockResponseArea")[0].value = JSON.stringify(obj.data);
|
||||
|
||||
} catch (e) {
|
||||
$("#mockResponseArea")[0].value = JSON.stringify(obj.data);
|
||||
}
|
||||
}
|
||||
|
||||
function onHashResult(obj) {
|
||||
$("#hashResult").html("数链指纹:" + obj.data);
|
||||
}
|
||||
|
||||
@@ -200,6 +200,12 @@ function WSHandler(event) {
|
||||
case 'onListLeakContractProcess':
|
||||
onListLeakContractProcess(obj);
|
||||
break;
|
||||
case 'onGetMask':
|
||||
onGetMask(obj);
|
||||
break;
|
||||
case 'onGetMock':
|
||||
onGetMock(obj);
|
||||
break;
|
||||
default:
|
||||
displayOutput(obj);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user