Skip to content

Commit

Permalink
chore(e2e): wait for local testnet funding
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceahasegan committed Nov 12, 2024
1 parent ff5828f commit 48f2b6f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/e2e/local-network/scripts/setup-new-delegator-keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,12 @@ currentBalance=$(getAddressBalance "$stakeAddr")
echo "Funding stake addresses with ${AMOUNT_PER_DELEGATOR}"

for NODE_ID in ${SP_NODES_ID}; do
sourceAddr="$(cat "${UTXO_DIR}/utxo${NODE_ID}.addr")"
currentBalance=$(getAddressBalance "$sourceAddr")

cardano-cli latest transaction build \
--testnet-magic $NETWORK_MAGIC \
--tx-in "$(cardano-cli query utxo --address "$(cat "${UTXO_DIR}/utxo${NODE_ID}.addr")" --testnet-magic $NETWORK_MAGIC --out-file /dev/stdout | jq -r 'keys[0]')" \
--tx-in "$(cardano-cli query utxo --address "$sourceAddr" --testnet-magic $NETWORK_MAGIC --out-file /dev/stdout | jq -r 'keys[0]')" \
--tx-out "$(cat ${DELEGATORS_DIR}/payment${NODE_ID}.addr)+${AMOUNT_PER_DELEGATOR}" \
--change-address "$(cat ${UTXO_DIR}/utxo${NODE_ID}.addr)" \
--out-file "${TRANSACTIONS_DIR}/tx${NODE_ID}.raw"
Expand All @@ -122,13 +125,14 @@ for NODE_ID in ${SP_NODES_ID}; do
cardano-cli latest transaction submit \
--testnet-magic $NETWORK_MAGIC \
--tx-file "${TRANSACTIONS_DIR}/tx${NODE_ID}.signed"
done

updatedBalance=$(getAddressBalance "$stakeAddr")
updatedBalance=$(getAddressBalance "$sourceAddr")

while [ "$currentBalance" -eq "$updatedBalance" ]; do
updatedBalance=$(getAddressBalance "$stakeAddr")
sleep 1
while [ "$currentBalance" -eq "$updatedBalance" ]; do
echo "==== Waiting for funding ==="
updatedBalance=$(getAddressBalance "$sourceAddr")
sleep 1
done
done

sleep 10
Expand Down

0 comments on commit 48f2b6f

Please sign in to comment.