Skip to content

Commit 7914be8

Browse files
committed
Fix funding script
1 parent 15f3252 commit 7914be8

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

scripts-demo/fund.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
#!/usr/bin/env bash
22
# Example usage:
33
# ./scripts-demo/fund.sh addr_test1vq922scgdwrrfa3n2pzu3empkju9ekregg0tza0xnveya3gfl0ycn 1000000000
4+
5+
set -euo pipefail
6+
7+
trap 'rm -f fundint.txbody' EXIT
8+
rm -f funding.txbody funding.tx
9+
10+
run_cardano_cli() {
11+
cabal run -v0 cardano-cli -- "$@"
12+
}
13+
414
export CARDANO_NODE_SOCKET_PATH=./testnet-data/socket/node1/sock
515
export CARDANO_NODE_NETWORK_ID=42
616
SRC_ADDR=$(cat testnet-data/utxo-keys/utxo1/utxo.addr)
7-
SRC_UTXO=$(cabal run cardano-cli -- latest query utxo --address $SRC_ADDR | jq -r 'keys'[0])
8-
cabal run cardano-cli -- latest transaction build --tx-in $SRC_UTXO --tx-out $1+$2 --change-address $SRC_ADDR --out-file funding.txbody
9-
cabal run cardano-cli -- latest transaction sign --tx-body-file funding.txbody --signing-key-file testnet-data/utxo-keys/utxo1/utxo.skey --out-file funding.tx
10-
cabal run cardano-cli -- latest transaction submit --tx-file funding.tx
11-
rm -f funding.txbody funding.tx
17+
SRC_UTXO=$(run_cardano-cli latest query utxo --address "$SRC_ADDR" | jq -r 'keys[0]')
18+
run_cardano-cli latest transaction build --tx-in "$SRC_UTXO" --tx-out "$1+$2" --change-address "$SRC_ADDR" --out-file funding.txbody
19+
run_cardano-cli latest transaction sign --tx-body-file funding.txbody --signing-key-file testnet-data/utxo-keys/utxo1/utxo.skey --out-file funding.tx
20+
run_cardano-cli latest transaction submit --tx-file funding.tx

0 commit comments

Comments
 (0)