diff --git a/scripts/top-up-cycles-ledger-account b/scripts/top-up-cycles-ledger-account index 846705fcb..f3791544b 100755 --- a/scripts/top-up-cycles-ledger-account +++ b/scripts/top-up-cycles-ledger-account @@ -3,11 +3,13 @@ set -euo pipefail print_help() { cat <<-EOF - Adds cyles to a given principal's main account on the cycles ledger. + Adds cyles to a given principal's main account on the local cycles ledger. Usage: $(basename "$0") E.g. $(basename "$0") bd3sg-teaaa-aaaaa-qaaba-cai 1000000000 Or $(basename "$0") my_canister 1000000000 + + Note: The destination account will be topped up by the desired amount minus fees. EOF } @@ -18,12 +20,14 @@ print_help() { account="$1" sum="$2" +account="$(dfx canister id "$account")" # Converts names to canister IDs +echo "Balance before: $(dfx canister call cycles_ledger icrc1_balance_of '(record { owner = principal "'"$account"'"; subaccount = null })')" dfx wallet send "$(dfx canister id cycles_depositor)" "$sum" dfx canister call cycles_depositor deposit ' ( record { to = record { - owner = principal "'"$(dfx canister id "$account")"'"; + owner = principal "'"$account"'"; subaccount = null; }; memo = null; @@ -31,3 +35,4 @@ dfx canister call cycles_depositor deposit ' }, ) ' +echo "Balance after: $(dfx canister call cycles_ledger icrc1_balance_of '(record { owner = principal "'"$account"'"; subaccount = null })')"