-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
147 lines (136 loc) · 5.22 KB
/
index.html
File metadata and controls
147 lines (136 loc) · 5.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bitcoin Wallet Address Generator</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<script>
// 设置全局对象
window.global = window;
window.process = { env: {} };
// 为了避免在使用buffer模块之前尝试访问Buffer导致错误
// 先预定义一个基本的Buffer对象
if (!window.Buffer) {
window.Buffer = {
isBuffer: function () { return false; },
alloc: function (size) {
const arr = new Uint8Array(size);
arr.fill(0);
return arr;
},
from: function (data) {
if (Array.isArray(data)) {
return new Uint8Array(data);
}
return new TextEncoder().encode(String(data));
},
concat: function (list) {
const totalLength = list.reduce((acc, buf) => acc + buf.length, 0);
const result = new Uint8Array(totalLength);
let offset = 0;
for (const buf of list) {
result.set(buf, offset);
offset += buf.length;
}
return result;
}
};
}
</script>
</head>
<body>
<div id="app" class="container mt-5">
<h1 class="mb-4 text-center">比特币地址派生工具</h1>
<div class="card mb-4">
<div class="card-header">
<h5>助记词输入</h5>
</div>
<div class="card-body">
<div class="mb-3">
<label for="mnemonicInput" class="form-label">输入BIP39助记词</label>
<textarea id="mnemonicInput" class="form-control" rows="3"
placeholder="输入12/15/18/21/24个单词的助记词,用空格分隔"></textarea>
</div>
<div class="mb-3">
<button id="generateMnemonic" class="btn btn-secondary">生成新助记词</button>
<select id="mnemonicLang" class="form-select d-inline-block ms-2" style="width: auto;">
<option value="english">English</option>
<option value="chinese_simplified">中文(简体)</option>
<option value="chinese_traditional">中文(繁體)</option>
<option value="japanese">日本語</option>
<option value="korean">한국어</option>
<option value="french">Français</option>
<option value="italian">Italiano</option>
<option value="spanish">Español</option>
</select>
</div>
<div class="mb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="usePassphrase">
<label class="form-check-label" for="usePassphrase">使用密码短语 (可选)</label>
</div>
<div id="passphraseGroup" class="mt-2 d-none">
<input type="password" id="passphrase" class="form-control" placeholder="输入密码短语">
</div>
</div>
</div>
</div>
<div class="card mb-4">
<div class="card-header">
<h5>派生选项</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6 mb-3">
<label for="derivationPath" class="form-label">派生路径</label>
<div class="input-group">
<select id="derivationPathPreset" class="form-select">
<option value="m/44'/0'/0'/0">BIP44 - Legacy (P2PKH)</option>
<option value="m/49'/0'/0'/0">BIP49 - SegWit (P2SH-P2WPKH)</option>
<option value="m/84'/0'/0'/0" selected>BIP84 - Native SegWit (P2WPKH)</option>
<option value="m/86'/0'/0'/0">BIP86 - Taproot (P2TR)</option>
<option value="custom">自定义...</option>
</select>
<input type="text" id="customPath" class="form-control d-none" placeholder="例如: m/44'/0'/0'/0">
</div>
</div>
<div class="col-md-6 mb-3">
<label for="addressCount" class="form-label">派生地址数量</label>
<input type="number" id="addressCount" class="form-control" value="5" min="1" max="100">
</div>
</div>
</div>
</div>
<div class="d-grid gap-2 mb-4">
<button id="deriveAddresses" class="btn btn-primary btn-lg">生成地址</button>
</div>
<div id="resultSection" class="card d-none">
<div class="card-header">
<h5>派生地址结果</h5>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>索引</th>
<th>地址</th>
<th>完整路径</th>
</tr>
</thead>
<tbody id="addressResults">
</tbody>
</table>
</div>
<button id="copyResults" class="btn btn-outline-secondary mt-2">复制所有结果</button>
</div>
</div>
<div class="mt-4">
<div id="errorAlert" class="alert alert-danger d-none" role="alert"></div>
</div>
</div>
<script type="module" src="/src/main.js"></script>
</body>
</html>