From 6512965f774c7939df56a0bf086f53ef0760ed8d Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 19 May 2022 11:28:14 +0200 Subject: [PATCH] use parseFunctionParams --- libs/remix-lib/src/execution/txFormat.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libs/remix-lib/src/execution/txFormat.ts b/libs/remix-lib/src/execution/txFormat.ts index a72549bef2..54ed2b731d 100644 --- a/libs/remix-lib/src/execution/txFormat.ts +++ b/libs/remix-lib/src/execution/txFormat.ts @@ -61,11 +61,9 @@ export function encodeParams (params, funAbi, callback) { data = Buffer.from(dataHex, 'hex') } else { try { - params = params.replace(/(^|,\s+|,)(\d+)(\s+,|,|$)/g, '$1"$2"$3') // replace non quoted number by quoted number - params = params.replace(/(^|,\s+|,)(0[xX][0-9a-fA-F]+)(\s+,|,|$)/g, '$1"$2"$3') // replace non quoted hex string by quoted hex string - const args = '[' + params + ']' - - funArgs = JSON.parse(args) + if (params.length > 0) { + funArgs = parseFunctionParams(params) + } } catch (e) { return callback('Error encoding arguments: ' + e) }