Skip to content

Commit 3598b4b

Browse files
committed
scripts: mk return-deleg-utxo work w/ first use
1 parent 9c0afec commit 3598b4b

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

scripts/bash-fns.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ return-utxo() (
126126
STAKE_VKEY=$(cardano-cli latest key verification-key --signing-key-file <(echo -n "$STAKE_SKEY") --verification-key-file /dev/stdout)
127127

128128
SIGNING_TX_ARGS+=(
129-
"--signing-key-file" "<(echo -n \"$STAKE_SKEY\")" \
129+
"--signing-key-file" "<(echo -n \"\$STAKE_SKEY\")"
130130
)
131131
fi
132132

@@ -187,12 +187,15 @@ return-utxo() (
187187
--fee 200000 \
188188
--out-file "$BASENAME.raw"
189189

190-
cardano-cli latest transaction sign \
191-
--tx-body-file "$BASENAME.raw" \
192-
--signing-key-file <(echo -n "$PAYMENT_SKEY") \
193-
"${SIGNING_TX_ARGS[@]}" \
194-
--testnet-magic "$TESTNET_MAGIC" \
195-
--out-file "$BASENAME.signed"
190+
# shellcheck disable=2116
191+
SIGNING_CMD=$(echo "cardano-cli latest transaction sign \
192+
--tx-body-file \"\$BASENAME.raw\" \
193+
--signing-key-file <(echo -n \"\$PAYMENT_SKEY\") \
194+
${SIGNING_TX_ARGS[*]} \
195+
--testnet-magic \"\$TESTNET_MAGIC\" \
196+
--out-file \$BASENAME.signed"
197+
)
198+
eval "$SIGNING_CMD"
196199

197200
echo
198201
echo "The transaction has been prepared and signed:"

scripts/playground/return-deleg-utxo.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,38 @@ set -euo pipefail
55
[ -n "${DEBUG:-}" ] && set -x
66
[ -z "${ENV:-}" ] && { echo "ENV var must be set"; exit 1; }
77

8-
[ -z "${RATIONALE_FILE:-}" ] && { echo "RATIONALE_FILE var must be set"; exit 1; }
9-
108
SCRIPT_PATH=$(readlink -f "$0")
119
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
1210

1311
# shellcheck disable=SC1091
1412
source "$SCRIPT_DIR/../bash-fns.sh"
1513

1614
PICK_UTXO() {
17-
SEND_ADDR="$1"
15+
ID="$1"
16+
SEND_ADDR="$2"
1817

19-
echo "From the sender account the following lovelace only UTXO are available to return:"
20-
cardano-cli latest query utxo --address "$SEND_ADDR"
18+
echo "From the $ID sender account the following lovelace only UTXO are available to return:"
19+
cardano-cli latest query utxo --address "$SEND_ADDR" | jq
20+
echo
2121
read -r -p "Enter the return to return: " UTXO
2222
}
2323

2424
RICH_ADDR=$(just sops-decrypt-binary "secrets/envs/${ENV}/utxo-keys/rich-utxo.addr")
2525
RICH_SKEY=$(just sops-decrypt-binary "secrets/envs/${ENV}/utxo-keys/rich-utxo.skey")
2626

2727
if [ -z "${DISABLE_POOL_RETURN:-}" ]; then
28-
PICK_UTXO "$(just sops-decrypt-binary "secrets/groups/${ENV}1/no-deploy/${ENV}1-bp-a-1-owner-payment-stake.addr")"
29-
return-utxo "$ENV" "$RICH_ADDR" "$UTXO" "$RICH_SKEY" <(just sops-decrypt-binary "secrets/groups/${ENV}1/no-deploy/${ENV}1-bp-a-1-owner-stake.skey")
28+
PICK_UTXO "pool1" "$(just sops-decrypt-binary "secrets/groups/${ENV}1/no-deploy/${ENV}1-bp-a-1-owner-payment-stake.addr")"
29+
return-utxo "$ENV" "$RICH_ADDR" "$UTXO" <(echo "$RICH_SKEY") <(just sops-decrypt-binary "secrets/groups/${ENV}1/no-deploy/${ENV}1-bp-a-1-owner-stake.skey")
3030

31-
PICK_UTXO "$(just sops-decrypt-binary "secrets/groups/${ENV}2/no-deploy/${ENV}2-bp-b-1-owner-payment-stake.addr")"
32-
return-utxo "$ENV" "$RICH_ADDR" "$UTXO" "$RICH_SKEY" <(just sops-decrypt-binary "secrets/groups/${ENV}2/no-deploy/${ENV}2-bp-b-1-owner-stake.skey")
31+
PICK_UTXO "pool2" "$(just sops-decrypt-binary "secrets/groups/${ENV}2/no-deploy/${ENV}2-bp-b-1-owner-payment-stake.addr")"
32+
return-utxo "$ENV" "$RICH_ADDR" "$UTXO" <(echo "$RICH_SKEY") <(just sops-decrypt-binary "secrets/groups/${ENV}2/no-deploy/${ENV}2-bp-b-1-owner-stake.skey")
3333

34-
PICK_UTXO "$(just sops-decrypt-binary "secrets/groups/${ENV}3/no-deploy/${ENV}3-bp-c-1-owner-payment-stake.addr")"
35-
return-utxo "$ENV" "$RICH_ADDR" "$UTXO" "$RICH_SKEY" <(just sops-decrypt-binary "secrets/groups/${ENV}3/no-deploy/${ENV}3-bp-c-1-owner-stake.skey")
34+
PICK_UTXO "pool3" "$(just sops-decrypt-binary "secrets/groups/${ENV}3/no-deploy/${ENV}3-bp-c-1-owner-payment-stake.addr")"
35+
return-utxo "$ENV" "$RICH_ADDR" "$UTXO" <(echo "$RICH_SKEY") <(just sops-decrypt-binary "secrets/groups/${ENV}3/no-deploy/${ENV}3-bp-c-1-owner-stake.skey")
3636
fi
3737

3838
if [ -z "${DISABLE_DREP_RETURN:-}" ]; then
39-
PICK_UTXO "$(just sops-decrypt-binary "secrets/envs/${ENV}/drep/drep.addr")"
39+
PICK_UTXO "drep-0" "$(just sops-decrypt-binary "secrets/envs/${ENV}/drep/drep-0.addr")"
4040
return-utxo "$ENV" "$RICH_ADDR" "$UTXO" \
4141
<(just sops-decrypt-binary "secrets/envs/$ENV/drep/pay-0.skey") \
4242
<(just sops-decrypt-binary "secrets/envs/$ENV/drep/stake-0.skey")

0 commit comments

Comments
 (0)