From c0e6e1f6206f7a16be96253775034c3ac1faf5ab Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 15 Dec 2025 08:48:51 -0800 Subject: [PATCH] =?UTF-8?q?refactor(scripts):=20=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E7=83=AD=E9=92=B1=E5=8C=85=E5=88=9D=E5=A7=8B=E5=8C=96=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 只保留 --username, --threshold-n, --threshold-t 参数 - 移除 --host, --verbose, --help 参数(host 固定为 localhost:4000) - username 改为必填参数 - 更新使用说明和错误提示 用法: ./init-hot-wallet.sh --username rwadurian-system-hot-wallet-01 --threshold-n 3 --threshold-t 2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- backend/scripts/init-hot-wallet.sh | 45 +++++++----------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/backend/scripts/init-hot-wallet.sh b/backend/scripts/init-hot-wallet.sh index 64bc68a5..50cd09ed 100644 --- a/backend/scripts/init-hot-wallet.sh +++ b/backend/scripts/init-hot-wallet.sh @@ -6,26 +6,16 @@ # 用途: 创建系统热钱包的 MPC 密钥,用于提现转账 # # 前提条件: -# 1. mpc-system account-service 正在运行 (默认端口 4000) +# 1. mpc-system account-service 正在运行 (端口 4000) # 2. mpc-system session-coordinator 和 server-party 已启动 # 3. jq 已安装 (用于解析 JSON) # 4. curl 已安装 # # 使用方法: -# ./init-hot-wallet.sh [options] -# -# 选项: -# -u, --username 热钱包用户名 (默认: system-hot-wallet) -# -n, --threshold-n 总 party 数量 (默认: 3) -# -t, --threshold-t 签名门限值 (默认: 2) -# -h, --host mpc-system account-service 地址 (默认: http://localhost:4000) -# -v, --verbose 显示详细调试信息 -# --help 显示帮助 +# ./init-hot-wallet.sh --username --threshold-n --threshold-t # # 示例: -# ./init-hot-wallet.sh -# ./init-hot-wallet.sh -u my-hot-wallet -h http://192.168.1.111:4000 -# ./init-hot-wallet.sh --username prod-hot-wallet --threshold-n 3 --threshold-t 2 +# ./init-hot-wallet.sh --username rwadurian-system-hot-wallet-01 --threshold-n 3 --threshold-t 2 # # ============================================================================= @@ -39,12 +29,12 @@ BLUE='\033[0;34m' CYAN='\033[0;36m' NC='\033[0m' # No Color -# 默认配置 -USERNAME="system-hot-wallet" +# 配置 - 通过参数传入 +USERNAME="" THRESHOLD_N=3 THRESHOLD_T=2 MPC_HOST="http://localhost:4000" -VERBOSE=false +VERBOSE=true # 日志函数 log_info() { @@ -69,12 +59,6 @@ log_debug() { fi } -# 显示帮助 -show_help() { - head -35 "$0" | tail -30 - exit 0 -} - # 检查依赖 check_dependencies() { log_info "检查依赖..." @@ -145,20 +129,9 @@ parse_args() { THRESHOLD_T="$2" shift 2 ;; - -h|--host) - MPC_HOST="$2" - shift 2 - ;; - -v|--verbose) - VERBOSE=true - shift - ;; - --help) - show_help - ;; *) log_error "未知参数: $1" - echo "使用 --help 查看帮助" + echo "用法: ./init-hot-wallet.sh --username --threshold-n --threshold-t " exit 1 ;; esac @@ -169,6 +142,9 @@ parse_args() { validate_params() { if [ -z "$USERNAME" ]; then log_error "用户名不能为空" + echo "" + echo "用法: ./init-hot-wallet.sh --username --threshold-n --threshold-t " + echo "示例: ./init-hot-wallet.sh --username rwadurian-system-hot-wallet-01 --threshold-n 3 --threshold-t 2" exit 1 fi @@ -435,7 +411,6 @@ main() { echo " 用户名: $USERNAME" echo " 门限: $THRESHOLD_T-of-$THRESHOLD_N" echo " MPC 服务: $MPC_HOST" - echo " 详细模式: $VERBOSE" echo "" check_dependencies