refactor(scripts): 简化热钱包初始化脚本参数
- 只保留 --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 <noreply@anthropic.com>
This commit is contained in:
parent
fce8a919ff
commit
c0e6e1f620
|
|
@ -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 <wallet-name> --threshold-n <n> --threshold-t <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 <name> --threshold-n <n> --threshold-t <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 <name> --threshold-n <n> --threshold-t <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
|
||||
|
|
|
|||
Loading…
Reference in New Issue