SyntaxError: missing ) after argument list- Javascript

Hi,

I am running a small javascript code after calling a few apis & passing data into the code, but that throws a SyntaxError: missing ) after argument list in console every time it is run.

Can someone help with what might be wrong with this code?

const txConfig = JSON.parse(Result of step 2 (Tatum.io - Signat…)'s serializedTransaction);

txConfig.from = accounts[0];
txConfig.gasPrice = txConfig.gasPrice ? parseInt(txConfig.gasPrice).toString(16) : undefined;
console.log(await ethereum.request({
method: ‘eth_sendTransaction’,
params: [txConfig],
}));

Workflow screens-


Screenshot 2022-12-27 at 7.13.56 AM

most likely the step 2 returns a string and you need to wrap it in quotes.
You can try adding the operator formatting to json safe

Needless to say that you are putting all your trust in the source of the dynamic data because it can lead to security issues.

Used json-safe & also tried quotes, both didn’t work. Any other ideas?

You don’t need to add quotes if you are using “formatted as json safe”

anyway you can write your code, without the dynamic expression, in any text editor with a javascript linter and check the syntaxt. This way you get the line where the error is. You can also search a javascript syntax checker online.

If everything is correct then you need to check what it is that you have in your dynamic expression. It’s not clear what it returns (eg. a string, an array, an object)

This topic was automatically closed after 70 days. New replies are no longer allowed.