Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/action-create-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,12 @@ print_section "Creating action file"
action_file="$input_file.action"
action_json="$input_file.action.json"

gov_action_deposit=$(cardano-cli conway query gov-state | jq -r '.currentPParams.govActionDeposit')
require_nonnull "$gov_action_deposit" "governance action deposit (gov-state .currentPParams.govActionDeposit)"

cardano-cli conway governance action create-info \
--$protocol_magic \
--governance-action-deposit $(cardano-cli conway query gov-state | jq -r '.currentPParams.govActionDeposit') \
--governance-action-deposit "$gov_action_deposit" \
--deposit-return-stake-address "$deposit_return" \
--anchor-url "ipfs://$ipfs_cid" \
--anchor-data-hash "$file_hash" \
Expand Down
10 changes: 8 additions & 2 deletions scripts/action-create-tw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -427,16 +427,22 @@ print_section "Creating action file"
action_file="$input_file.action"
action_json="$input_file.action.json"

gov_action_deposit=$(cardano-cli conway query gov-state | jq -r '.currentPParams.govActionDeposit')
require_nonnull "$gov_action_deposit" "governance action deposit (gov-state .currentPParams.govActionDeposit)"

constitution_script_hash=$(cardano-cli conway query constitution | jq -r '.script')
require_nonnull "$constitution_script_hash" "constitution script hash (constitution .script)"

cardano-cli conway governance action create-treasury-withdrawal \
--$protocol_magic \
--governance-action-deposit $(cardano-cli conway query gov-state | jq -r '.currentPParams.govActionDeposit') \
--governance-action-deposit "$gov_action_deposit" \
--deposit-return-stake-address "$deposit_return" \
--anchor-url "ipfs://$ipfs_cid" \
--anchor-data-hash "$file_hash" \
--check-anchor-data \
--funds-receiving-stake-address "$withdrawal_address" \
--transfer "$withdrawal_amount" \
--constitution-script-hash $(cardano-cli conway query constitution | jq -r '.script') \
--constitution-script-hash "$constitution_script_hash" \
--out-file "$action_file"

print_pass "Action file created at $(fmt_path "$action_file")"
Expand Down
13 changes: 13 additions & 0 deletions scripts/lib/messages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@ fmt_path() {
printf "'%s%s%s'" "$YELLOW" "$1" "$NC"
}

# Abort with a clear [FAIL] if a value pulled from a cardano-cli/jq query is
# empty or the literal "null". Guards against a renamed/reshaped query field
# (e.g. across a cardano-cli upgrade) silently feeding a bad value into a
# downstream command flag. Usage: require_nonnull "$value" "human label"
require_nonnull() {
local value="$1" label="$2"
if [ -z "$value" ] || [ "$value" = "null" ]; then
print_fail "Could not read $label from cardano-cli output (got empty/null)."
print_hint "This can happen if cardano-cli's output format changed or the node is not synced."
exit 1
fi
}

# Single help row, replacing ad-hoc col=50 printf blocks.
print_usage_option() {
printf ' %s%-42s%s %s%s%s\n' "$GREEN" "$1" "$NC" "$GRAY" "$2" "$NC"
Expand Down
4 changes: 2 additions & 2 deletions scripts/preflight.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ source "$SCRIPT_DIR/lib/messages.sh"
# component, preflight WARNs (never fails) — these are advisory, not hard
# requirements. Leave blank to skip the version check for a tool.

cardano_cli_version="cardano-cli 10.8.0"
cardano_signer_version="cardano-signer 1.27.0"
cardano_cli_version="cardano-cli 11.0.0"
cardano_signer_version="cardano-signer 1.34.0"
jq_version="1.7.1"
curl_version="8.7.1"
ipfs_version="0.38.2"
Expand Down