|
55 | 55 | rxcnt="1"
|
56 | 56 |
|
57 | 57 | echo -e "\e[0mMinting Asset \e[32m${assetMintAmount} '${assetMintName}'\e[0m with Policy \e[32m'${policyName}'\e[0m:"
|
58 |
| -echo |
59 | 58 |
|
60 | 59 | #get live values
|
61 | 60 | currentTip=$(get_currentTip)
|
62 |
| -ttl=$(get_currentTTL) |
63 |
| -currentEPOCH=$(get_currentEpoch) |
64 | 61 |
|
| 62 | +#set timetolife (inherent hereafter) to the currentTTL or to the value set in the policy.script for the "before" slot (limited policy lifespan) |
| 63 | +ttlFromScript=$(cat ${policyName}.policy.script | jq -r ".scripts[] | select(.type == \"before\") | .slot" 2> /dev/null || echo "unlimited") |
| 64 | +if [[ ! ${ttlFromScript} == "unlimited" ]]; then ttl=${ttlFromScript}; else ttl=$(get_currentTTL); fi |
| 65 | +echo |
| 66 | +echo -e "\e[0mPolicy valid before Slot-Height:\e[33m ${ttlFromScript}\e[0m" |
| 67 | +echo |
65 | 68 | echo -e "\e[0mCurrent Slot-Height:\e[32m ${currentTip} \e[0m(setting TTL[invalid_hereafter] to ${ttl})"
|
66 | 69 | echo
|
| 70 | +if [[ ${ttl} -le ${currentTip} ]]; then echo -e "\e[35mError - Your given Policy has expired, you cannot use it anymore!\e[0m\n"; exit 2; fi |
| 71 | + |
67 | 72 |
|
68 | 73 | sendFromAddr=$(cat ${fromAddr}.addr)
|
69 | 74 | sendToAddr=${sendFromAddr}
|
@@ -214,7 +219,7 @@ if ask "\e[33mDoes this look good for you, continue ?" N; then
|
214 | 219 | if [ ! -f "${assetFileName}" ]; then echo "{}" > ${assetFileName}; fi #generate an empty json if no file present
|
215 | 220 | oldValue=$(jq -r ".minted" ${assetFileName})
|
216 | 221 | newValue=$(( ${oldValue} + ${assetMintAmount} ))
|
217 |
| - assetFileJSON=$( jq ". += {minted: ${newValue}, name: \"${assetMintName}\", policyID: \"${policyID}\", lastUpdate: \"$(date)\", lastAction: \"mint ${assetMintAmount}\"}" < ${assetFileName}) |
| 222 | + assetFileJSON=$( jq ". += {minted: ${newValue}, name: \"${assetMintName}\", policyID: \"${policyID}\", policyValidBeforeSlot: \"${ttlFromScript}\", lastUpdate: \"$(date)\", lastAction: \"mint ${assetMintAmount}\"}" < ${assetFileName}) |
218 | 223 |
|
219 | 224 | file_unlock ${assetFileName}
|
220 | 225 | echo -e "${assetFileJSON}" > ${assetFileName}
|
@@ -247,7 +252,7 @@ if ask "\e[33mDoes this look good for you, continue ?" N; then
|
247 | 252 | if [ ! -f "${assetFileName}" ]; then echo "{}" > ${assetFileName}; fi #generate an empty json if no file present
|
248 | 253 | oldValue=$(jq -r ".minted" ${assetFileName})
|
249 | 254 | newValue=$(( ${oldValue} + ${assetMintAmount} ))
|
250 |
| - assetFileJSON=$( jq ". += {minted: ${newValue}, name: \"${assetMintName}\", policyID: \"${policyID}\", lastUpdate: \"$(date)\", lastAction: \"mint ${assetMintAmount}\"}" < ${assetFileName}) |
| 255 | + assetFileJSON=$( jq ". += {minted: ${newValue}, name: \"${assetMintName}\", policyID: \"${policyID}\", policyValidBeforeSlot: \"${ttlFromScript}\", lastUpdate: \"$(date)\", lastAction: \"mint ${assetMintAmount}\"}" < ${assetFileName}) |
251 | 256 |
|
252 | 257 | file_unlock ${assetFileName}
|
253 | 258 | echo -e "${assetFileJSON}" > ${assetFileName}
|
|
0 commit comments