Skip to content

Commit

Permalink
Fix 'sui client faucet' commands
Browse files Browse the repository at this point in the history
  • Loading branch information
mario4tier committed Aug 19, 2024
1 parent 4297f6a commit fcc64a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Suibase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- New VSCode extension https://marketplace.visualstudio.com/items?itemName=suibase.suibase

### Fixed
- "lsui/dsui/tsui client faucet" commands now work.
- More robust handling of backend (suibase-daemon)
- Reduce localnet storage need (delete full_node_db on regen).

Expand Down
18 changes: 17 additions & 1 deletion scripts/common/__sui-exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ sui_exec() {
# does not specify path (and default to current dir).
local _OPT_DEFAULT_PATH=""
local _OPT_DEFAULT_INSTALLDIR=""
local _OPT_URL_PARAM=""

if [[ $SUI_SUBCOMMAND == "client" ]]; then
case $1 in
publish | verify-source | verify-bytecode-meter | upgrade)
Expand All @@ -158,6 +160,20 @@ sui_exec() {
_OPT_DEFAULT_INSTALLDIR="--install-dir $USER_CWD"
fi
;;
faucet)
if ! has_param "" "--url" "$@"; then
if [ "$WORKDIR" = "localnet" ]; then
if [ "${CFG_sui_faucet_enabled:?}" != "true" ]; then
error_exit "suibase faucet not enabled for localnet. Check suibase.yaml config."
fi
_OPT_URL_PARAM="--url http://${CFG_sui_faucet_host_ip:?}:${CFG_sui_faucet_port:?}/gas"
elif [ "$WORKDIR" = "devnet" ] || [ "$WORKDIR" = "testnet" ]; then
_OPT_URL_PARAM="--url https://faucet.${WORKDIR}.sui.io/gas"
else
error_exit "faucet command not applicable to $WORKDIR"
fi
fi
;;
*) ;; # Do nothing
esac
fi
Expand All @@ -166,7 +182,7 @@ sui_exec() {
update_CANONICAL_ARGS_var "$@"

# shellcheck disable=SC2086,SC2068
$SUI_BIN "$SUI_SUBCOMMAND" --client.config "$CLIENT_CONFIG" ${CANONICAL_ARGS[@]} $_OPT_DEFAULT_INSTALLDIR $_OPT_DEFAULT_PATH
$SUI_BIN "$SUI_SUBCOMMAND" --client.config "$CLIENT_CONFIG" ${CANONICAL_ARGS[@]} $_OPT_DEFAULT_INSTALLDIR $_OPT_URL_PARAM $_OPT_DEFAULT_PATH

if [ "$WORKDIR" = "localnet" ]; then
# Print a friendly warning if localnet sui process found not running.
Expand Down

0 comments on commit fcc64a5

Please sign in to comment.