Remove wallet.sh, update entrypoint syntax for wallet network argument
This commit is contained in:
committed by
Tyera Eulberg
parent
a06f4b1d44
commit
0125163190
@ -5,12 +5,13 @@
|
||||
|
||||
cd "$(dirname "$0")"/..
|
||||
|
||||
if [[ -n "$USE_SNAP" ]]; then
|
||||
# TODO: Merge wallet.sh functionality into solana-wallet proper and
|
||||
# remove this USE_SNAP case
|
||||
wallet="solana.wallet $1"
|
||||
# shellcheck source=multinode-demo/common.sh
|
||||
source multinode-demo/common.sh
|
||||
|
||||
if [[ -z $1 ]]; then # no network argument, use default
|
||||
entrypoint=()
|
||||
else
|
||||
wallet="multinode-demo/wallet.sh $1"
|
||||
entrypoint=(-n "$1")
|
||||
fi
|
||||
|
||||
# Tokens transferred to this address are lost forever...
|
||||
@ -19,7 +20,7 @@ garbage_address=vS3ngn1TfQmpsW1Z4NkLuqNAQFF3dYQw8UZ6TCx9bmq
|
||||
check_balance_output() {
|
||||
declare expected_output="$1"
|
||||
exec 42>&1
|
||||
output=$($wallet balance | tee >(cat - >&42))
|
||||
output=$($solana_wallet "${entrypoint[@]}" balance | tee >(cat - >&42))
|
||||
if [[ ! "$output" =~ $expected_output ]]; then
|
||||
echo "Balance is incorrect. Expected: $expected_output"
|
||||
exit 1
|
||||
@ -28,16 +29,15 @@ check_balance_output() {
|
||||
|
||||
pay_and_confirm() {
|
||||
exec 42>&1
|
||||
signature=$($wallet pay "$@" | tee >(cat - >&42))
|
||||
$wallet confirm "$signature"
|
||||
signature=$($solana_wallet "${entrypoint[@]}" pay "$@" | tee >(cat - >&42))
|
||||
$solana_wallet "${entrypoint[@]}" confirm "$signature"
|
||||
}
|
||||
|
||||
$wallet reset
|
||||
$wallet address
|
||||
$solana_wallet "${entrypoint[@]}" address
|
||||
check_balance_output "No account found" "Your balance is: 0"
|
||||
$wallet airdrop --tokens 60
|
||||
$solana_wallet "${entrypoint[@]}" airdrop --tokens 60
|
||||
check_balance_output "Your balance is: 60"
|
||||
$wallet airdrop --tokens 40
|
||||
$solana_wallet "${entrypoint[@]}" airdrop --tokens 40
|
||||
check_balance_output "Your balance is: 100"
|
||||
pay_and_confirm --to $garbage_address --tokens 99
|
||||
check_balance_output "Your balance is: 1"
|
||||
|
Reference in New Issue
Block a user