I'm new and I'm following cardano developers tutorial to create NFT. I arrived at some modified code for what I wanted to do. But get this "Invalid argument `"type":'" error. When building the transaction for minting. The other part of the transaction that is not the minting parts seems to work because I can make ordinary transaction and I'm using the testnet, running a testnet node with zsh. Cardano-cli version 1.33. Macbook pro M1 pro, macOS 12.2.1.
Here is the code:
cardano-cli query protocol-parameters \
--testnet-magic 1097911063 \
--out-file $HOME/nft/protocol.json
tokenname="5465737469616e"
tokenamount=1
txhash="989b03feb8885db90c6ca44065fe950a2208ba60c6d1b1f17aef87dcfd13c03b"
txix=0
policyid=$(cat $HOME/nft/policy/policyID)
script=$(cat $HOME/nft/policy/policy.json)
addressOut=$(cat $HOME/cardanotestwallet/keys/payment1.addr)
addressIn=$(cat $HOME/receive-ada-sample/keys/payment.addr)
fee=$(cardano-cli transaction build-raw \
--alonzo-era \
--tx-in ${txhash}#${txix} \
--tx-out ${addressOut}+0+"${tokenamount} ${policyid}.${tokenname}" \
--tx-out ${addressIn}+0 \
--mint="${tokenamount} ${policyid}.${tokenname}" \
--minting-script-file ${script} \
--invalid-hereafter ${slotnumber} \
--fee 0 \
--metadata-json-file $HOME/nft/metadata.json \
--out-file $HOME/nft/matx.raw
cardano-cli transaction calculate-min-fee \
--tx-body-file $HOME/nft/matx.raw \
--tx-in-count 1 \
--tx-out-count 2 \
--witness-count 1 \
--testnet-magic 1097911063 \
--protocol-params-file $HOME/nft/protocol.json)
fee=${fee%" Lovelace"}
funds=99829967
output=1700000
slotnumber=53264773
change=$((${funds}-${output}-${fee}))
cardano-cli transaction build-raw \
--alonzo-era \
--tx-in ${txhash}#${txix} \
--tx-out ${addressOut}+${output}+"${tokenamount} ${policyid}.${tokenname}" \
--tx-out ${addressIn}+${change} \
--mint="${tokenamount} ${policyid}.${tokenname}" \
--minting-script-file ${script} \
--invalid-hereafter ${slotnumber} \
--fee ${fee} \
--metadata-json-file $HOME/nft/metadata.json \
--out-file $HOME/nft/matx.raw
...And here is the full error code:
Invalid argument `"type":'
Usage: cardano-cli transaction build-raw
[ --byron-era
| --shelley-era
| --allegra-era
| --mary-era
| --alonzo-era
]
[--script-valid | --script-invalid]
(--tx-in TX-IN
[--tx-in-script-file FILE
[(--tx-in-datum-file FILE | --tx-in-datum-value JSON VALUE)
( --tx-in-redeemer-file FILE
| --tx-in-redeemer-value JSON VALUE
)
--tx-in-execution-units (INT, INT)]])
[--tx-in-collateral TX-IN]
[--required-signer FILE | --required-signer-hash HASH]
[--tx-out ADDRESS VALUE
[ --tx-out-datum-hash HASH
| --tx-out-datum-hash-file FILE
| --tx-out-datum-hash-value JSON VALUE
| --tx-out-datum-embed-file FILE
| --tx-out-datum-embed-value JSON VALUE
]]
[--mint VALUE
(--mint-script-file FILE
[(--mint-redeemer-file FILE | --mint-redeemer-value JSON VALUE)
--mint-execution-units (INT, INT)])]
[--invalid-before SLOT]
[--invalid-hereafter SLOT]
[--fee LOVELACE]
[--certificate-file CERTIFICATEFILE
[--certificate-script-file FILE
[
( --certificate-redeemer-file FILE
| --certificate-redeemer-value JSON VALUE
)
--certificate-execution-units (INT, INT)]]]
[--withdrawal WITHDRAWAL
[--withdrawal-script-file FILE
[
( --withdrawal-redeemer-file FILE
| --withdrawal-redeemer-value JSON VALUE
)
--withdrawal-execution-units (INT, INT)]]]
[--json-metadata-no-schema | --json-metadata-detailed-schema]
[--auxiliary-script-file FILE]
[--metadata-json-file FILE | --metadata-cbor-file FILE]
[--genesis FILE | --protocol-params-file FILE]
[--update-proposal-file FILE]
--out-file FILE
Build a transaction (low-level, inconvenient)
Please note the order of some cmd options is crucial. If used incorrectly may produce undesired tx body. See nested [] notation above for details.
Command failed: transaction calculate-min-fee Error: /Users/myyenongianggiang/nft/matx.raw: /Users/myyenongianggiang/nft/matx.raw: openBinaryFile: does not exist (No such file or directory)
createN.sh: line 38: 99829967-1700000-: syntax error: operand expected (error token is "-")
Am I missing something really easy? can't find out what the problem is, would be very happy for getting some help. Been stuck... Thank you very much in advance.
//Koki