Skip to content

Commit

Permalink
Add tui calls to process-compose demo (#1626)
Browse files Browse the repository at this point in the history
  • Loading branch information
locallycompact authored Sep 12, 2024
1 parent 65f75a5 commit 2d5dce5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
15 changes: 8 additions & 7 deletions demo/seed-devnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,23 @@ function seedFaucet() {
echo >&2 "Seeding a UTXO from faucet to ${ACTOR} with ${AMOUNT}Ł"

# Determine faucet address and just the **first** txin addressed to it
FAUCET_ADDR=$(ccli address build --payment-verification-key-file ${DEVNET_DIR}/credentials/faucet.vk)
FAUCET_TXIN=$(ccli query utxo --address ${FAUCET_ADDR} --out-file /dev/stdout | jq -r 'keys[0]')
FAUCET_ADDR=$(ccli conway address build --payment-verification-key-file ${DEVNET_DIR}/credentials/faucet.vk)
FAUCET_TXIN=$(ccli conway query utxo --address ${FAUCET_ADDR} --out-file /dev/stdout | jq -r 'keys[0]')

ACTOR_ADDR=$(ccli address build --payment-verification-key-file ${DEVNET_DIR}/credentials/${ACTOR}.vk)
ACTOR_ADDR=$(ccli conway address build --payment-verification-key-file ${DEVNET_DIR}/credentials/${ACTOR}.vk)

ccli transaction build --babbage-era --cardano-mode \
ccli conway transaction build --cardano-mode \
--change-address ${FAUCET_ADDR} \
--tx-in ${FAUCET_TXIN} \
--tx-out ${ACTOR_ADDR}+${AMOUNT} \
--out-file ${DEVNET_DIR}/seed-${ACTOR}.draft >&2
ccli transaction sign \
ccli conway transaction sign \
--tx-body-file ${DEVNET_DIR}/seed-${ACTOR}.draft \
--signing-key-file ${DEVNET_DIR}/credentials/faucet.sk \
--out-file ${DEVNET_DIR}/seed-${ACTOR}.signed >&2
SEED_TXID=$(ccli_ transaction txid --tx-file ${DEVNET_DIR}/seed-${ACTOR}.signed | tr -d '\r')
SEED_TXID=$(ccli_ conway transaction txid --tx-file ${DEVNET_DIR}/seed-${ACTOR}.signed | tr -d '\r')
SEED_TXIN="${SEED_TXID}#0"
ccli transaction submit --tx-file ${DEVNET_DIR}/seed-${ACTOR}.signed >&2
ccli conway transaction submit --tx-file ${DEVNET_DIR}/seed-${ACTOR}.signed >&2

echo -n >&2 "Waiting for utxo ${SEED_TXIN}.."

Expand Down Expand Up @@ -117,6 +117,7 @@ echo >&2 "Distributing funds to alice, bob and carol..."
seedFaucet "alice-funds" 100000000 # 100 Ada to commit
seedFaucet "bob-funds" 50000000 # 50 Ada to commit
seedFaucet "carol-funds" 25000000 # 25 Ada to commit

queryPParams
echo "HYDRA_SCRIPTS_TX_ID=$(publishReferenceScripts)" > .env
echo >&2 "Environment variable stored in '.env'"
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
demoDir = ./demo;
inherit (pkgsLatest) process-compose;
inherit (pkgs) cardano-node cardano-cli;
inherit (hydraPackages) hydra-node;
inherit (hydraPackages) hydra-node hydra-tui;
};

checks = let lu = inputs.lint-utils.linters.${system}; in {
Expand Down
34 changes: 34 additions & 0 deletions nix/hydra/demo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
, cardano-cli
, cardano-node
, hydra-node
, hydra-tui
, self
, demoDir
, process-compose
Expand Down Expand Up @@ -119,6 +120,39 @@
ready_log_line = "NodeIsLeader";
depends_on."seed-devnet".condition = "process_completed";
};
hydra-tui-alice = {
command = ''
${hydra-tui}/bin/hydra-tui \
--connect 0.0.0.0:4001 \
--node-socket devnet/node.socket \
--testnet-magic 42 \
--cardano-signing-key devnet/credentials/alice-funds.sk
'';
is_foreground = true;
depends_on."hydra-node-alice".condition = "process_started";
};
hydra-tui-bob = {
command = ''
${hydra-tui}/bin/hydra-tui \
--connect 0.0.0.0:4002 \
--node-socket devnet/node.socket \
--testnet-magic 42 \
--cardano-signing-key devnet/credentials/bob-funds.sk
'';
is_foreground = true;
depends_on."hydra-node-bob".condition = "process_started";
};
hydra-tui-carol = {
command = ''
${hydra-tui}/bin/hydra-tui \
--connect 0.0.0.0:4003 \
--node-socket devnet/node.socket \
--testnet-magic 42 \
--cardano-signing-key devnet/credentials/carol-funds.sk
'';
is_foreground = true;
depends_on."hydra-node-carol".condition = "process_started";
};
};
};
}

0 comments on commit 2d5dce5

Please sign in to comment.