Remove wallet.sh, update entrypoint syntax for wallet network argument
This commit is contained in:
parent
a06f4b1d44
commit
0125163190
|
@ -28,13 +28,7 @@ fi
|
||||||
if [[ -d $SNAP ]]; then # Running inside a Linux Snap?
|
if [[ -d $SNAP ]]; then # Running inside a Linux Snap?
|
||||||
solana_program() {
|
solana_program() {
|
||||||
declare program="$1"
|
declare program="$1"
|
||||||
if [[ "$program" = wallet || "$program" = bench-tps ]]; then
|
printf "%s/command-%s.wrapper" "$SNAP" "$program"
|
||||||
# TODO: Merge wallet.sh/client.sh functionality into
|
|
||||||
# solana-wallet/solana-demo-client proper and remove this special case
|
|
||||||
printf "%s/bin/solana-%s" "$SNAP" "$program"
|
|
||||||
else
|
|
||||||
printf "%s/command-%s.wrapper" "$SNAP" "$program"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
rsync="$SNAP"/bin/rsync
|
rsync="$SNAP"/bin/rsync
|
||||||
multilog="$SNAP/bin/multilog t s16777215 n200"
|
multilog="$SNAP/bin/multilog t s16777215 n200"
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Runs solana-wallet against the specified network
|
|
||||||
#
|
|
||||||
# usage: $0 <rsync network path to solana repo on leader machine>"
|
|
||||||
#
|
|
||||||
|
|
||||||
here=$(dirname "$0")
|
|
||||||
# shellcheck source=multinode-demo/common.sh
|
|
||||||
source "$here"/common.sh
|
|
||||||
|
|
||||||
# shellcheck source=scripts/oom-score-adj.sh
|
|
||||||
source "$here"/../scripts/oom-score-adj.sh
|
|
||||||
|
|
||||||
# if $1 isn't host:path, something.com, or a valid local path
|
|
||||||
if [[ ${1%:} != "$1" || "$1" =~ [^.]\.[^.] || -d $1 ]]; then
|
|
||||||
leader=$1 # interpret
|
|
||||||
shift
|
|
||||||
else
|
|
||||||
if [[ -d "$SNAP" ]]; then
|
|
||||||
leader=testnet.solana.com # Default to testnet when running as a Snap
|
|
||||||
else
|
|
||||||
leader=$here/.. # Default to local solana repo
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$1" = "reset" ]]; then
|
|
||||||
echo Wallet resetting
|
|
||||||
rm -rf "$SOLANA_CONFIG_CLIENT_DIR"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
rsync_leader_url=$(rsync_url "$leader")
|
|
||||||
|
|
||||||
set -e
|
|
||||||
mkdir -p "$SOLANA_CONFIG_CLIENT_DIR"
|
|
||||||
if [[ ! -r "$SOLANA_CONFIG_CLIENT_DIR"/leader.json ]]; then
|
|
||||||
echo "Fetching leader configuration from $rsync_leader_url"
|
|
||||||
$rsync -Pz "$rsync_leader_url"/config/leader.json "$SOLANA_CONFIG_CLIENT_DIR"/
|
|
||||||
fi
|
|
||||||
|
|
||||||
client_id_path="$SOLANA_CONFIG_CLIENT_DIR"/id.json
|
|
||||||
if [[ ! -r $client_id_path ]]; then
|
|
||||||
echo "Generating client identity: $client_id_path"
|
|
||||||
$solana_keygen -o "$client_id_path"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# shellcheck disable=SC2086 # $solana_wallet should not be quoted
|
|
||||||
exec $solana_wallet \
|
|
||||||
-l "$SOLANA_CONFIG_CLIENT_DIR"/leader.json -k "$client_id_path" --timeout 10 "$@"
|
|
|
@ -86,7 +86,7 @@ esac
|
||||||
echo "--- $entrypointIp: wallet sanity"
|
echo "--- $entrypointIp: wallet sanity"
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
scripts/wallet-sanity.sh "$entrypointRsyncUrl"
|
scripts/wallet-sanity.sh "$entrypointIp"
|
||||||
)
|
)
|
||||||
|
|
||||||
echo "+++ $entrypointIp: node count ($numNodes expected)"
|
echo "+++ $entrypointIp: node count ($numNodes expected)"
|
||||||
|
|
|
@ -5,12 +5,13 @@
|
||||||
|
|
||||||
cd "$(dirname "$0")"/..
|
cd "$(dirname "$0")"/..
|
||||||
|
|
||||||
if [[ -n "$USE_SNAP" ]]; then
|
# shellcheck source=multinode-demo/common.sh
|
||||||
# TODO: Merge wallet.sh functionality into solana-wallet proper and
|
source multinode-demo/common.sh
|
||||||
# remove this USE_SNAP case
|
|
||||||
wallet="solana.wallet $1"
|
if [[ -z $1 ]]; then # no network argument, use default
|
||||||
|
entrypoint=()
|
||||||
else
|
else
|
||||||
wallet="multinode-demo/wallet.sh $1"
|
entrypoint=(-n "$1")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Tokens transferred to this address are lost forever...
|
# Tokens transferred to this address are lost forever...
|
||||||
|
@ -19,7 +20,7 @@ garbage_address=vS3ngn1TfQmpsW1Z4NkLuqNAQFF3dYQw8UZ6TCx9bmq
|
||||||
check_balance_output() {
|
check_balance_output() {
|
||||||
declare expected_output="$1"
|
declare expected_output="$1"
|
||||||
exec 42>&1
|
exec 42>&1
|
||||||
output=$($wallet balance | tee >(cat - >&42))
|
output=$($solana_wallet "${entrypoint[@]}" balance | tee >(cat - >&42))
|
||||||
if [[ ! "$output" =~ $expected_output ]]; then
|
if [[ ! "$output" =~ $expected_output ]]; then
|
||||||
echo "Balance is incorrect. Expected: $expected_output"
|
echo "Balance is incorrect. Expected: $expected_output"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -28,16 +29,15 @@ check_balance_output() {
|
||||||
|
|
||||||
pay_and_confirm() {
|
pay_and_confirm() {
|
||||||
exec 42>&1
|
exec 42>&1
|
||||||
signature=$($wallet pay "$@" | tee >(cat - >&42))
|
signature=$($solana_wallet "${entrypoint[@]}" pay "$@" | tee >(cat - >&42))
|
||||||
$wallet confirm "$signature"
|
$solana_wallet "${entrypoint[@]}" confirm "$signature"
|
||||||
}
|
}
|
||||||
|
|
||||||
$wallet reset
|
$solana_wallet "${entrypoint[@]}" address
|
||||||
$wallet address
|
|
||||||
check_balance_output "No account found" "Your balance is: 0"
|
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"
|
check_balance_output "Your balance is: 60"
|
||||||
$wallet airdrop --tokens 40
|
$solana_wallet "${entrypoint[@]}" airdrop --tokens 40
|
||||||
check_balance_output "Your balance is: 100"
|
check_balance_output "Your balance is: 100"
|
||||||
pay_and_confirm --to $garbage_address --tokens 99
|
pay_and_confirm --to $garbage_address --tokens 99
|
||||||
check_balance_output "Your balance is: 1"
|
check_balance_output "Your balance is: 1"
|
||||||
|
|
|
@ -55,9 +55,7 @@ apps:
|
||||||
- network-bind
|
- network-bind
|
||||||
- home
|
- home
|
||||||
wallet:
|
wallet:
|
||||||
# TODO: Merge wallet.sh functionality into solana-wallet proper
|
command: solana-wallet
|
||||||
command: multinode-demo/wallet.sh
|
|
||||||
#command: solana-wallet
|
|
||||||
plugs:
|
plugs:
|
||||||
- network
|
- network
|
||||||
- home
|
- home
|
||||||
|
|
|
@ -88,7 +88,8 @@ fn main() -> Result<(), Box<error::Error>> {
|
||||||
.value_name("PATH")
|
.value_name("PATH")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("/path/to/id.json"),
|
.help("/path/to/id.json"),
|
||||||
).arg(
|
)
|
||||||
|
.arg(
|
||||||
Arg::with_name("timeout")
|
Arg::with_name("timeout")
|
||||||
.long("timeout")
|
.long("timeout")
|
||||||
.value_name("SECS")
|
.value_name("SECS")
|
||||||
|
|
Loading…
Reference in New Issue