diff --git a/Makefile b/Makefile index f5e73c2..8aabf8c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SHELL := /bin/bash +SHELL = /bin/bash # Load environment variables from .env file include .env @@ -34,10 +34,10 @@ build: node_modules .SILENT: install install: build dfx canister install identity --argument '(null)' --mode reinstall --yes - $(shell make/install_ledger.sh) - $(shell make/install_ledger_index.sh) + ./make/install_ledger.sh + ./make/install_ledger_index.sh dfx canister install github --mode reinstall --yes - $(shell make/install_bounty.sh) + ./make/install_bounty.sh .PHONY: upgrade .SILENT: upgrade @@ -114,4 +114,4 @@ test-a: install .PHONY: test-deposit .SILENT: test-deposit test-deposit: install - $(shell make/test/deposit.sh) + ./make/test/deposit.sh | grep "PASS" diff --git a/make/test/deposit.sh b/make/test/deposit.sh index 67bbf25..c5a2568 100755 --- a/make/test/deposit.sh +++ b/make/test/deposit.sh @@ -3,15 +3,17 @@ set -e balance_of() { - dfx canister call icrc1_index icrc1_balance_of "(record{owner = principal \"$1\"; })" + dfx canister call --output=json icrc1_index icrc1_balance_of \ + "(record{owner = principal \"$1\"; })" } approve_allowance() { - dfx canister call icrc1_ledger icrc2_approve "(record { amount = $1; spender = record{owner = principal \"$2\";} })" + dfx canister call --output=json icrc1_ledger icrc2_approve \ + "(record { amount = $1; spender = record{owner = principal \"$2\";} })" } deposit() { - dfx canister call bounty deposit "()" + dfx canister call --output=json bounty deposit "()" } CALLER=$(dfx identity get-principal) @@ -21,13 +23,16 @@ BOUNTY=$(dfx canister id bounty) echo "Calling deposit on bounty canister..." # check initial balances -echo "Caller initial balance: $(balance_of "$CALLER")" -echo "Bounty initial balance: $(balance_of "$BOUNTY")" +echo "Caller initial balance: $(balance_of $CALLER)" +echo "Bounty initial balance: $(balance_of $BOUNTY)" # deposit -echo "Bounty allowance: $(approve_allowance 100_000 "$BOUNTY")" +echo "Bounty allowance: $(approve_allowance 100_000 $BOUNTY)" echo "Bounty deposit: $(deposit)" # check final balances -echo "Caller final balance: $(balance_of "$CALLER")" -echo "Bounty final balance: $(balance_of "$BOUNTY")" +sleep 1 +echo "Caller final balance: $(balance_of $CALLER)" +echo "Bounty final balance: $(balance_of $BOUNTY)" + +echo "PASS"