From a71e808fc2da0aad16e8a6bf955ea2282acef7ff Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 10 Sep 2019 09:03:01 +0000 Subject: [PATCH] [Pangaea] Update wallet.sh usage and download locs --- scripts/wallet.sh | 75 ++++++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 27 deletions(-) diff --git a/scripts/wallet.sh b/scripts/wallet.sh index 83987498f..934888c82 100755 --- a/scripts/wallet.sh +++ b/scripts/wallet.sh @@ -2,30 +2,15 @@ BUCKET=pub.harmony.one OS=$(uname -s) -REL=mainnet - -case "$OS" in - Darwin) - FOLDER=release/darwin-x86_64/${REL}/ - BIN=( wallet libbls384_256.dylib libcrypto.1.0.0.dylib libgmp.10.dylib libgmpxx.4.dylib libmcl.dylib ) - ;; - Linux) - FOLDER=release/linux-x86_64/${REL}/ - BIN=( wallet libbls384_256.so libcrypto.so.10 libgmp.so.10 libgmpxx.so.4 libmcl.so ) - ;; - *) - echo "${OS} not supported." - exit 2 - ;; -esac +# formatted with 4 spaces indentation for consistency with wallet binary usage () { cat << EOT Usage: $0 [option] command Options: - -d download all the binaries/config files (do it when updated) - -p profile use the profile for the given network (default [main], beta, pangaea) + -d download all the binaries/config files (must come after network flag) + -p profile use the profile for the given network (main, local, beta, pangaea; default: main) -t equivalent to -p pangaea (deprecated) -h print this help @@ -44,7 +29,10 @@ Commands: --to - The receiver account's address --amount - The amount of token to transfer --shardID - The shard Id for the transfer + --toShardID - The destination shard Id for the transfer" --inputData - Base64-encoded input data to embed in the transaction + --pass - Passphrase of sender's private key + --waitThenBal - Wait after the transfer with colored balances output 8. export - Export account key to a new file --account - Specify the account to export. Empty will export every key. 9. exportPriKey - Export account private key @@ -64,27 +52,60 @@ Commands: EOT } +set_download () { + case "${network}" in + main) + REL=mainnet + ;; + beta) + REL=testnet + ;; + pangaea) + REL=master + ;; + *) + err 64 "${network}: invalid network" + ;; + esac + + case "$OS" in + Darwin) + FOLDER=release/darwin-x86_64/${REL}/ + BIN=( wallet libbls384_256.dylib libcrypto.1.0.0.dylib libgmp.10.dylib libgmpxx.4.dylib libmcl.dylib ) + ;; + Linux) + FOLDER=release/linux-x86_64/${REL}/ + BIN=( wallet libbls384_256.so libcrypto.so.10 libgmp.so.10 libgmpxx.so.4 libmcl.so ) + ;; + *) + echo "${OS} not supported." + exit 2 + ;; + esac +} + do_download () { # clean up old files - for bin in "${BIN[@]}"; do - rm -f ${bin} - done + for bin in "${BIN[@]}"; do + rm -f ${bin} + done # download all the binaries - for bin in "${BIN[@]}"; do - curl http://${BUCKET}.s3.amazonaws.com/${FOLDER}${bin} -o ${bin} - done + for bin in "${BIN[@]}"; do + curl http://${BUCKET}.s3.amazonaws.com/${FOLDER}${bin} -o ${bin} + done - mkdir -p .hmy/keystore - chmod +x wallet + mkdir -p .hmy/keystore + chmod +x wallet } unset network -network=default +network=main while getopts "dp:th" opt; do case ${opt} in d) + set_download do_download exit 0 ;;