-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtest.html
83 lines (79 loc) · 2.58 KB
/
test.html
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
<!DOCTYPE html>
<html>
<head>
<script src="buidl.js"></script>
</head>
<body>
<select id="network"><option value="mainnet">Mainnet</option><option value="testnet">Testnet</option></select>
<table width="100%">
<tr>
<td width="65%"><h3>INPUT</h3>
<table width="100%">
<tr>
<td width="10">Type</td>
<td width="60%">Transaction Hash/ID</td>
<td width="10%">N Out</td>
<td width="20%">Input Value</td>
</tr>
<tr>
<td><input type="text" id="typei" size="10" onkeyup="return checkWitness();"></td>
<td><input type="text" id="txidi" size="65"></td>
<td><input type="text" id="outni" size="10"></td>
<td><input type="text" id="inputvalue" size="20"></td>
</tr>
</table>
</td>
<td><h3>OUTPUT(S)</h3>
<table width="100%">
<tr>
<td width="70%">Address</td>
<td width="30%">Value</td>
</tr>
<tr>
<td><input type="text" id="outputi" size="30"></td>
<td><input type="text" id="amounti"></td>
</tr>
<tr>
<td><input type="text" id="changeout" size="30"></td>
<td><input type="text" id="changeamt"></td>
</tr>
</table>
</td>
</tr>
</table>
<p>WIF Private Key of Input</p>
<input type="text" id="wifi" size="45">
<br>
<button onclick="return createTx();">Create Transaction</button>
<br>
<textarea id="signedtxoutput" readonly cols="45" rows="3"></textarea>
<script>
function createTx(){
let network = document.getElementById("network").value;
let istestnet = network ==="testnet" ? "testnet" : "";
let typei = document.getElementById("typei").value.trim();
let txidi = document.getElementById("txidi").value.trim();
let outni = parseInt(document.getElementById("outni").value.trim());
let inputvalue = parseInt(document.getElementById("inputvalue").value.trim());
inputvalue ? inputvalue : null;
let outputi = document.getElementById("outputi").value.trim();
let amounti = parseInt(document.getElementById("amounti").value.trim());
let changeout = document.getElementById("changeout").value.trim();
changeout ? changeout : null;
let changeamt = parseInt(document.getElementById("changeamt").value.trim());
changeamt ? changeamt : null;
let wifi = document.getElementById("wifi").value.trim();
let rawtx = buidl.createTransaction(typei, txidi, outni, outputi, amounti, wifi, changeout, changeamt, inputvalue, istestnet);
document.getElementById("signedtxoutput").innerHTML = rawtx.signedtx;
}
function checkWitness(){
let checkType = document.getElementById("typei").value.trim();
if(checkType === "1"){
document.getElementById("inputvalue").disabled = true;
} else {
document.getElementById("inputvalue").disabled = false;
}
}
</script>
</body>
</html>