Skip to content

Commit 7ff0f9d

Browse files
committed
scripts: add return deleg utxo skipping
1 parent 401b1ad commit 7ff0f9d

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

scripts/playground/return-deleg-utxo.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,30 @@ PICK_UTXO() {
1818
echo "From the $ID sender account the following lovelace only UTXO are available to return:"
1919
cardano-cli latest query utxo --address "$SEND_ADDR" | jq
2020
echo
21-
read -r -p "Enter the return to return: " UTXO
21+
read -r -p "Enter the UTXO to return or hit enter to skip: " 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
2828
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")
29+
[ -n "$UTXO" ] \
30+
&& 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")
3031

3132
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")
33+
[ -n "$UTXO" ] \
34+
&& 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")
3335

3436
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")
37+
[ -n "$UTXO" ] \
38+
&& 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")
3639
fi
3740

3841
if [ -z "${DISABLE_DREP_RETURN:-}" ]; then
3942
PICK_UTXO "drep-0" "$(just sops-decrypt-binary "secrets/envs/${ENV}/drep/drep-0.addr")"
40-
return-utxo "$ENV" "$RICH_ADDR" "$UTXO" \
41-
<(just sops-decrypt-binary "secrets/envs/$ENV/drep/pay-0.skey") \
42-
<(just sops-decrypt-binary "secrets/envs/$ENV/drep/stake-0.skey")
43+
[ -n "$UTXO" ] \
44+
&& return-utxo "$ENV" "$RICH_ADDR" "$UTXO" \
45+
<(just sops-decrypt-binary "secrets/envs/$ENV/drep/pay-0.skey") \
46+
<(just sops-decrypt-binary "secrets/envs/$ENV/drep/stake-0.skey")
4347
fi

0 commit comments

Comments
 (0)