Policy Script Smart Contract

The error messages do not fit the code. Are you sure you submitted the latest built by that code and not some old one?

The error messages say:

There is an output with 0 ADA. Can only happen with your code if you call it with minimum_lovelace set to 0.

The transaction is not balanced. Inputs are 20 ADA and no tokens, outputs are 0 ADA and two tokens. This cannot happen with your code at all. cardano-cli transaction build balances the ADA automatically. And the two --mint arguments would definitely lead to the two tokens being on the input side.

Fee is missing completely. This also cannot happen with your code, since transaction build calculates and adds the fee automatically.

Altogether, it really does not look like the transaction throwing those errors was built from this code.

Also: Calling out from Javascript to cardano-cli is really not what I would recommend! It will always only work on a machine with a running cardano-node and you said previously that you do not plan to run one.

And there are libraries to build transactions completely in Javascript. There’s no need to call out to the shell.