Hi I am trying to get txn fee for a test.txraw file.
When I am running the command on terminal I am getting response.
Command used on terminal:
"cardano-cli transaction calculate-min-fee --tx-body-file test.txraw --tx-in-count 1 --tx-out-count 2 --witness-count 2 --testnet-magic 1097911063 --protocol-params-file protocol.json | egrep -o '[0-9]+'"
On Node JS side I am running this using “node-cmd”
let fee = cmd.runSync([
"cardano-cli transaction calculate-min-fee",
`| egrep -o '[0-9]+'`
Response: Cannot read property
'toString' of undefined.
Please help on this.
Please run that without the
| egrep -o '[0-9]+', so that you (and we) can see the whole error message and not just the part that accidentally fulfils the grep pattern.
This is the error I am getting without | egrep -o ‘[0-9]+’
This is my code.
You seem to have two problems here.
The one with the
cmd.runSync wrong. According to http://riaevangelist.github.io/node-cmd/ it does not return the output of the command as a script, but an object with different information about the process. You are probably interested in the
Thanks for your suggestion. I tried with .exec() and got the fee amount.
Thanks a lot.