feat: enable gas calculation
This commit is contained in:
@@ -358,30 +358,27 @@ function initResponseAndOutputArea() {
|
||||
}
|
||||
|
||||
function onExecuteResult(obj) {
|
||||
const executeResultTitleEl = $("#executeResultTitle")
|
||||
const executeResultTitleEl = $("#executeResultTitle");
|
||||
const data = obj;
|
||||
executeResultTitleEl
|
||||
.html(`${data.status} (${obj['executeTime']}ms) 未知格式`);
|
||||
var sytleTail = "未知格式";
|
||||
if (data.result instanceof Object) {
|
||||
executeResultTitleEl
|
||||
.html(`${data.status} (${obj['executeTime']}ms) JSON格式`);
|
||||
global.responseEditor.setValue(JSON.stringify(data.result));
|
||||
sytleTail = "JSON格式";
|
||||
} else if (typeof data.result == 'string') {
|
||||
executeResultTitleEl
|
||||
.html(`${data.status} (${obj['executeTime']}ms) 字符串格式`);
|
||||
global.responseEditor.setValue(data.result);
|
||||
} else {
|
||||
if (typeof data.result == 'number') {
|
||||
executeResultTitleEl
|
||||
.html(`${data.status} (${obj['executeTime']}ms) 数值格式`);
|
||||
} else if (typeof data.result == 'boolean') {
|
||||
executeResultTitleEl
|
||||
.html(`${data.status} (${obj['executeTime']}ms) 布尔型格式`);
|
||||
}
|
||||
global.responseEditor.setValue(data.result.toString());
|
||||
styleTail = "字符串格式";
|
||||
} else if (typeof data.result == 'boolean'){
|
||||
styleTail = "布尔值格式";
|
||||
data.result = data.result.toString();
|
||||
}else if (typeof data.result == 'number'){
|
||||
styleTail = "数值格式";
|
||||
data.result = data.result.toString();
|
||||
}
|
||||
|
||||
// console.log(data);
|
||||
var gasInfo = "";
|
||||
if (data.executionGas!=undefined && data.executionGas>0)
|
||||
gasInfo =" "+data.executionGas+"gas";
|
||||
global.responseEditor.setValue(data.result);
|
||||
executeResultTitleEl
|
||||
.html(`${data.status} (${obj['executeTime']}ms)${gasInfo} ${styleTail}`);
|
||||
// console.log(data);
|
||||
const totalLines = global.responseEditor.lineCount();
|
||||
|
||||
global.responseEditor.autoFormatRange({
|
||||
|
||||
Reference in New Issue
Block a user