|
|
@ -180,35 +180,7 @@ module.exports = { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (params.length > 0) { |
|
|
|
if (params.length > 0) { |
|
|
|
// Segregate params textbox string with respect to comma (,)
|
|
|
|
funArgs = this.parseFunctionParams(params) |
|
|
|
params = params.split(',') |
|
|
|
|
|
|
|
for (let i = 0; i < params.length; i++) { |
|
|
|
|
|
|
|
let param = params[i].trim() |
|
|
|
|
|
|
|
// Check if param starts with " , it may be string, address etc.
|
|
|
|
|
|
|
|
if (param.charAt(0) === '"') { |
|
|
|
|
|
|
|
// Check if param completes in one location by looking for end quote (case: address data type)
|
|
|
|
|
|
|
|
if (param.charAt(param.length - 1) === '"') { |
|
|
|
|
|
|
|
funArgs.push(param.slice(1, param.length - 1)) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
let lastIndex = false |
|
|
|
|
|
|
|
let paramStr = param.slice(1, param.length) |
|
|
|
|
|
|
|
// For a paramter got divided in multiple location(case: string data type containing comma(,))
|
|
|
|
|
|
|
|
for (let j = i + 1; !lastIndex; j++) { |
|
|
|
|
|
|
|
// Check if end quote is reached
|
|
|
|
|
|
|
|
if (params[j].charAt(params[j].length - 1) === '"') { |
|
|
|
|
|
|
|
paramStr += ',' + params[j].slice(0, params[j].length - 1) |
|
|
|
|
|
|
|
i = j |
|
|
|
|
|
|
|
funArgs.push(paramStr) |
|
|
|
|
|
|
|
lastIndex = true |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
paramStr += ',' + params[j] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
funArgs.push(param) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
callback('Error encoding arguments: ' + e) |
|
|
|
callback('Error encoding arguments: ' + e) |
|
|
@ -412,6 +384,40 @@ module.exports = { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return {} |
|
|
|
return {} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parseFunctionParams: function (params) { |
|
|
|
|
|
|
|
let args = [] |
|
|
|
|
|
|
|
// Segregate params textbox string with respect to comma (,)
|
|
|
|
|
|
|
|
params = params.split(',') |
|
|
|
|
|
|
|
for (let i = 0; i < params.length; i++) { |
|
|
|
|
|
|
|
let param = params[i].trim() |
|
|
|
|
|
|
|
// Check if param starts with " , it may be string, address etc.
|
|
|
|
|
|
|
|
if (param.charAt(0) === '"') { |
|
|
|
|
|
|
|
// Check if param completes in one location by looking for end quote (case: address data type)
|
|
|
|
|
|
|
|
if (param.charAt(param.length - 1) === '"') { |
|
|
|
|
|
|
|
args.push(param.slice(1, param.length - 1)) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
let lastIndex = false |
|
|
|
|
|
|
|
let paramStr = param.slice(1, param.length) |
|
|
|
|
|
|
|
// For a paramter got divided in multiple location(case: string data type containing comma(,))
|
|
|
|
|
|
|
|
for (let j = i + 1; !lastIndex; j++) { |
|
|
|
|
|
|
|
// Check if end quote is reached
|
|
|
|
|
|
|
|
if (params[j].charAt(params[j].length - 1) === '"') { |
|
|
|
|
|
|
|
paramStr += ',' + params[j].slice(0, params[j].length - 1) |
|
|
|
|
|
|
|
i = j |
|
|
|
|
|
|
|
args.push(paramStr) |
|
|
|
|
|
|
|
lastIndex = true |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
paramStr += ',' + params[j] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
args.push(param) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return args |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|