feat: enable gas calculation
This commit is contained in:
@@ -398,8 +398,16 @@ function executeContract() {
|
||||
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(
|
||||
`${request.contractID}|${operation}|${argDiv.value}|${global.sm2Key.publicKey}`,
|
||||
toSign,
|
||||
global.sm2Key.privateKey,
|
||||
{hash: true, der: true});
|
||||
localStorage.setItem("persisArg", JSON.stringify(request));
|
||||
@@ -423,7 +431,10 @@ function onExecuteResult(obj) {
|
||||
$("#responseArea")[0].value = result.result;
|
||||
}
|
||||
$("#responseID").html(`请求ID:${obj['responseID']}`);
|
||||
$("#responseTime").html(`响应时间:${obj['executeTime']}ms${styleTail}`);
|
||||
var gasInfo="";
|
||||
if (obj.executionGas!=undefined && obj.executionGas>0)
|
||||
gasInfo="<br>"+obj.executionGas+"gas";
|
||||
$("#responseTime").html(`响应时间:${obj['executeTime']}ms${gasInfo}${styleTail}`);
|
||||
} catch (e) {
|
||||
$("#responseStatus").html("执行状态:Failed");
|
||||
$("#responseArea")[0].value = obj.data;
|
||||
|
||||
Reference in New Issue
Block a user